diff options
author | Jakob Bornecrantz <wallbraker@gmail.com> | 2010-04-24 14:05:59 +0100 |
---|---|---|
committer | Jakob Bornecrantz <wallbraker@gmail.com> | 2010-04-26 00:40:17 +0100 |
commit | 27779ddad5c61d2fc46367e1556b5e53403c2a97 (patch) | |
tree | 7ad6054cd497b955a0fdde2a36b7332e45af659a /src/gallium/state_trackers/dri/common | |
parent | a66b391edf746a5eb0cb4aad1ff2e546df00a11d (diff) |
st/dri: Make st_framebuffer_iface the base for dri_drawable
Diffstat (limited to 'src/gallium/state_trackers/dri/common')
5 files changed, 21 insertions, 36 deletions
diff --git a/src/gallium/state_trackers/dri/common/dri_context.c b/src/gallium/state_trackers/dri/common/dri_context.c index 97e3b0628f..ba9fe62125 100644 --- a/src/gallium/state_trackers/dri/common/dri_context.c +++ b/src/gallium/state_trackers/dri/common/dri_context.c @@ -165,7 +165,7 @@ dri_make_current(__DRIcontext * cPriv, 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); diff --git a/src/gallium/state_trackers/dri/common/dri_drawable.c b/src/gallium/state_trackers/dri/common/dri_drawable.c index 6b551ea3f9..a61e7e1b1b 100644 --- a/src/gallium/state_trackers/dri/common/dri_drawable.c +++ b/src/gallium/state_trackers/dri/common/dri_drawable.c @@ -58,9 +58,7 @@ dri_create_buffer(__DRIscreen * sPriv, 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; @@ -83,7 +81,7 @@ dri_destroy_buffer(__DRIdrawable * dPriv) dri1_destroy_pipe_surface(drawable); - dri_destroy_st_framebuffer(drawable->stfb); + dri_close_st_framebuffer(drawable); drawable->desired_fences = 0; diff --git a/src/gallium/state_trackers/dri/common/dri_drawable.h b/src/gallium/state_trackers/dri/common/dri_drawable.h index dad218bde2..6c54a6953b 100644 --- a/src/gallium/state_trackers/dri/common/dri_drawable.h +++ b/src/gallium/state_trackers/dri/common/dri_drawable.h @@ -42,14 +42,13 @@ struct dri_context; 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; diff --git a/src/gallium/state_trackers/dri/common/dri_st_api.c b/src/gallium/state_trackers/dri/common/dri_st_api.c index 6c8a7e82ab..42e0ba020a 100644 --- a/src/gallium/state_trackers/dri/common/dri_st_api.c +++ b/src/gallium/state_trackers/dri/common/dri_st_api.c @@ -106,38 +106,27 @@ dri_st_framebuffer_flush_front(struct st_framebuffer_iface *stfbi, } /** - * 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); } /** @@ -145,11 +134,9 @@ dri_destroy_st_framebuffer(struct st_framebuffer_iface *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; @@ -167,7 +154,8 @@ dri_st_framebuffer_validate_att(struct st_framebuffer_iface *stfbi, 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 diff --git a/src/gallium/state_trackers/dri/common/dri_st_api.h b/src/gallium/state_trackers/dri/common/dri_st_api.h index 0a0d43073c..8cb9fabd4e 100644 --- a/src/gallium/state_trackers/dri/common/dri_st_api.h +++ b/src/gallium/state_trackers/dri/common/dri_st_api.h @@ -49,14 +49,14 @@ dri_init_st_manager(struct dri_screen *screen); 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_ */ |