read->texture_stamp = driReadPriv->lastStamp - 1;
}
- stapi->make_current(stapi, ctx->st, draw->stfb, read->stfb);
+ stapi->make_current(stapi, ctx->st, &draw->base, &read->base);
}
else {
stapi->make_current(stapi, NULL, NULL, NULL);
goto fail;
dri_fill_st_visual(&drawable->stvis, screen, visual);
- drawable->stfb = dri_create_st_framebuffer(drawable);
- if (drawable->stfb == NULL)
- goto fail;
+ dri_init_st_framebuffer(drawable);
drawable->sPriv = sPriv;
drawable->dPriv = dPriv;
dri1_destroy_pipe_surface(drawable);
- dri_destroy_st_framebuffer(drawable->stfb);
+ dri_close_st_framebuffer(drawable);
drawable->desired_fences = 0;
struct dri_drawable
{
+ struct st_framebuffer_iface base;
+ struct st_visual stvis;
+
/* dri */
__DRIdrawable *dPriv;
__DRIscreen *sPriv;
- /* gallium */
- struct st_framebuffer_iface *stfb;
- struct st_visual stvis;
-
__DRIbuffer old[8];
unsigned old_num;
unsigned old_w;
}
/**
- * Create a framebuffer from the given drawable.
+ * Init a framebuffer from the given drawable.
*/
-struct st_framebuffer_iface *
-dri_create_st_framebuffer(struct dri_drawable *drawable)
+void
+dri_init_st_framebuffer(struct dri_drawable *drawable)
{
- struct st_framebuffer_iface *stfbi;
-
- stfbi = CALLOC_STRUCT(st_framebuffer_iface);
- if (stfbi) {
- stfbi->visual = &drawable->stvis;
- stfbi->flush_front = dri_st_framebuffer_flush_front;
- stfbi->validate = dri_st_framebuffer_validate;
- stfbi->st_manager_private = (void *) drawable;
- }
-
- return stfbi;
+ drawable->base.visual = &drawable->stvis;
+ drawable->base.flush_front = dri_st_framebuffer_flush_front;
+ drawable->base.validate = dri_st_framebuffer_validate;
+ drawable->base.st_manager_private = (void *) drawable;
}
/**
* Destroy a framebuffer.
*/
void
-dri_destroy_st_framebuffer(struct st_framebuffer_iface *stfbi)
+dri_close_st_framebuffer(struct dri_drawable *drawable)
{
- struct dri_drawable *drawable =
- (struct dri_drawable *) stfbi->st_manager_private;
int i;
for (i = 0; i < ST_ATTACHMENT_COUNT; i++)
pipe_resource_reference(&drawable->textures[i], NULL);
-
- FREE(stfbi);
}
/**
* exist.
*/
void
-dri_st_framebuffer_validate_att(struct st_framebuffer_iface *stfbi,
+dri_st_framebuffer_validate_att(struct dri_drawable *drawable,
enum st_attachment_type statt)
{
- struct dri_drawable *drawable =
- (struct dri_drawable *) stfbi->st_manager_private;
enum st_attachment_type statts[ST_ATTACHMENT_COUNT];
unsigned i, count = 0;
drawable->texture_stamp = drawable->dPriv->lastStamp - 1;
- stfbi->validate(stfbi, statts, count, NULL);
+ /* this calles into the manager */
+ drawable->base.validate(&drawable->base, statts, count, NULL);
}
static boolean
void
dri_close_st_manager(struct dri_screen *screen);
-struct st_framebuffer_iface *
-dri_create_st_framebuffer(struct dri_drawable *drawable);
+void
+dri_init_st_framebuffer(struct dri_drawable *drawable);
void
-dri_destroy_st_framebuffer(struct st_framebuffer_iface *stfbi);
+dri_close_st_framebuffer(struct dri_drawable *drawable);
void
-dri_st_framebuffer_validate_att(struct st_framebuffer_iface *stfbi,
+dri_st_framebuffer_validate_att(struct dri_drawable *drawable,
enum st_attachment_type statt);
#endif /* _DRI_ST_API_H_ */
if (dPriv && draw->texture_stamp != dPriv->lastStamp) {
ctx->st->flush(ctx->st, PIPE_FLUSH_RENDER_CACHE, NULL);
flushed = TRUE;
- ctx->st->notify_invalid_framebuffer(ctx->st, draw->stfb);
+ ctx->st->notify_invalid_framebuffer(ctx->st, &draw->base);
}
if (rPriv && dPriv != rPriv && read->texture_stamp != rPriv->lastStamp) {
if (!flushed)
ctx->st->flush(ctx->st, PIPE_FLUSH_RENDER_CACHE, NULL);
- ctx->st->notify_invalid_framebuffer(ctx->st, read->stfb);
+ ctx->st->notify_invalid_framebuffer(ctx->st, &read->base);
}
}
drawable->dPriv->lastStamp = *drawable->dPriv->pStamp;
if (ctx)
- ctx->st->notify_invalid_framebuffer(ctx->st, drawable->stfb);
+ ctx->st->notify_invalid_framebuffer(ctx->st, &drawable->base);
}
static const __DRI2flushExtension dri2FlushExtension = {
struct dri_drawable *drawable = dri_drawable(dPriv);
struct pipe_resource *pt;
- dri_st_framebuffer_validate_att(drawable->stfb, ST_ATTACHMENT_FRONT_LEFT);
+ dri_st_framebuffer_validate_att(drawable, ST_ATTACHMENT_FRONT_LEFT);
pt = drawable->textures[ST_ATTACHMENT_FRONT_LEFT];
/* check if swapping currently bound buffer */
if (ctx && ctx->dPriv == dPriv)
- ctx->st->notify_invalid_framebuffer(ctx->st, drawable->stfb);
+ ctx->st->notify_invalid_framebuffer(ctx->st, &drawable->base);
}
static INLINE void