From 919f788b92362676fa368d9950532f82f762cdfb Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Mon, 3 Dec 2012 16:24:59 +0100 Subject: [PATCH] gallium: pass the current context to the flush_front state tracker function I will later use the context to resolve an MSAA front buffer. Reviewed-by: Brian Paul --- src/gallium/include/state_tracker/st_api.h | 5 ++++- src/gallium/state_trackers/dri/common/dri_drawable.c | 6 ++++-- src/gallium/state_trackers/dri/common/dri_drawable.h | 3 ++- src/gallium/state_trackers/dri/drm/dri2.c | 3 ++- src/gallium/state_trackers/dri/sw/drisw.c | 4 ++-- src/gallium/state_trackers/egl/common/egl_g3d_st.c | 6 ++++-- src/gallium/state_trackers/glx/xlib/xm_st.c | 3 ++- src/gallium/state_trackers/vega/vg_manager.c | 2 +- src/gallium/state_trackers/wgl/stw_st.c | 3 ++- src/mesa/state_tracker/st_manager.c | 2 +- 10 files changed, 24 insertions(+), 13 deletions(-) diff --git a/src/gallium/include/state_tracker/st_api.h b/src/gallium/include/state_tracker/st_api.h index 91c5529a1f5..419f825696c 100644 --- a/src/gallium/include/state_tracker/st_api.h +++ b/src/gallium/include/state_tracker/st_api.h @@ -269,6 +269,8 @@ struct st_context_attribs struct st_config_options options; }; +struct st_context_iface; + /** * Represent a windowing system drawable. * @@ -313,7 +315,8 @@ struct st_framebuffer_iface * * @att is one of the front buffer attachments. */ - boolean (*flush_front)(struct st_framebuffer_iface *stfbi, + boolean (*flush_front)(struct st_context_iface *stctx, + struct st_framebuffer_iface *stfbi, enum st_attachment_type statt); /** diff --git a/src/gallium/state_trackers/dri/common/dri_drawable.c b/src/gallium/state_trackers/dri/common/dri_drawable.c index 7e87f87ed67..dca6def284c 100644 --- a/src/gallium/state_trackers/dri/common/dri_drawable.c +++ b/src/gallium/state_trackers/dri/common/dri_drawable.c @@ -100,14 +100,16 @@ dri_st_framebuffer_validate(struct st_framebuffer_iface *stfbi, } static boolean -dri_st_framebuffer_flush_front(struct st_framebuffer_iface *stfbi, +dri_st_framebuffer_flush_front(struct st_context_iface *stctx, + struct st_framebuffer_iface *stfbi, enum st_attachment_type statt) { + struct dri_context *ctx = (struct dri_context *)stctx->st_manager_private; struct dri_drawable *drawable = (struct dri_drawable *) stfbi->st_manager_private; /* XXX remove this and just set the correct one on the framebuffer */ - drawable->flush_frontbuffer(drawable, statt); + drawable->flush_frontbuffer(ctx, drawable, statt); return TRUE; } diff --git a/src/gallium/state_trackers/dri/common/dri_drawable.h b/src/gallium/state_trackers/dri/common/dri_drawable.h index 6336c81a715..6a769910fe6 100644 --- a/src/gallium/state_trackers/dri/common/dri_drawable.h +++ b/src/gallium/state_trackers/dri/common/dri_drawable.h @@ -75,7 +75,8 @@ struct dri_drawable void (*update_drawable_info)(struct dri_drawable *drawable); - void (*flush_frontbuffer)(struct dri_drawable *drawable, + void (*flush_frontbuffer)(struct dri_context *ctx, + struct dri_drawable *drawable, enum st_attachment_type statt); void (*update_tex_buffer)(struct dri_drawable *drawable, diff --git a/src/gallium/state_trackers/dri/drm/dri2.c b/src/gallium/state_trackers/dri/drm/dri2.c index eb5536ee279..5ebe18480d8 100644 --- a/src/gallium/state_trackers/dri/drm/dri2.c +++ b/src/gallium/state_trackers/dri/drm/dri2.c @@ -373,7 +373,8 @@ dri2_allocate_textures(struct dri_drawable *drawable, } static void -dri2_flush_frontbuffer(struct dri_drawable *drawable, +dri2_flush_frontbuffer(struct dri_context *ctx, + struct dri_drawable *drawable, enum st_attachment_type statt) { __DRIdrawable *dri_drawable = drawable->dPriv; diff --git a/src/gallium/state_trackers/dri/sw/drisw.c b/src/gallium/state_trackers/dri/sw/drisw.c index 533f908bce2..7a5f79716c0 100644 --- a/src/gallium/state_trackers/dri/sw/drisw.c +++ b/src/gallium/state_trackers/dri/sw/drisw.c @@ -158,10 +158,10 @@ drisw_swap_buffers(__DRIdrawable *dPriv) } static void -drisw_flush_frontbuffer(struct dri_drawable *drawable, +drisw_flush_frontbuffer(struct dri_context *ctx, + struct dri_drawable *drawable, enum st_attachment_type statt) { - struct dri_context *ctx = dri_get_current(drawable->sPriv); struct pipe_resource *ptex; if (!ctx) diff --git a/src/gallium/state_trackers/egl/common/egl_g3d_st.c b/src/gallium/state_trackers/egl/common/egl_g3d_st.c index 50ed669ba30..657845cf951 100644 --- a/src/gallium/state_trackers/egl/common/egl_g3d_st.c +++ b/src/gallium/state_trackers/egl/common/egl_g3d_st.c @@ -113,7 +113,8 @@ egl_g3d_destroy_st_manager(struct st_manager *smapi) } static boolean -egl_g3d_st_framebuffer_flush_front_pbuffer(struct st_framebuffer_iface *stfbi, +egl_g3d_st_framebuffer_flush_front_pbuffer(struct st_context_iface *stctx, + struct st_framebuffer_iface *stfbi, enum st_attachment_type statt) { return TRUE; @@ -187,7 +188,8 @@ egl_g3d_st_framebuffer_validate_pbuffer(struct st_framebuffer_iface *stfbi, } static boolean -egl_g3d_st_framebuffer_flush_front(struct st_framebuffer_iface *stfbi, +egl_g3d_st_framebuffer_flush_front(struct st_context_iface *stctx, + struct st_framebuffer_iface *stfbi, enum st_attachment_type statt) { _EGLSurface *surf = (_EGLSurface *) stfbi->st_manager_private; diff --git a/src/gallium/state_trackers/glx/xlib/xm_st.c b/src/gallium/state_trackers/glx/xlib/xm_st.c index 7b54df5998c..a681e82fe01 100644 --- a/src/gallium/state_trackers/glx/xlib/xm_st.c +++ b/src/gallium/state_trackers/glx/xlib/xm_st.c @@ -253,7 +253,8 @@ xmesa_st_framebuffer_validate(struct st_framebuffer_iface *stfbi, * Called via st_framebuffer_iface::flush_front() */ static boolean -xmesa_st_framebuffer_flush_front(struct st_framebuffer_iface *stfbi, +xmesa_st_framebuffer_flush_front(struct st_context_iface *stctx, + struct st_framebuffer_iface *stfbi, enum st_attachment_type statt) { struct xmesa_st_framebuffer *xstfb = xmesa_st_framebuffer(stfbi); diff --git a/src/gallium/state_trackers/vega/vg_manager.c b/src/gallium/state_trackers/vega/vg_manager.c index 660a7af884f..e9c4a832a58 100644 --- a/src/gallium/state_trackers/vega/vg_manager.c +++ b/src/gallium/state_trackers/vega/vg_manager.c @@ -91,7 +91,7 @@ vg_manager_flush_frontbuffer(struct vg_context *ctx) switch (stfb->strb_att) { case ST_ATTACHMENT_FRONT_LEFT: case ST_ATTACHMENT_FRONT_RIGHT: - stfb->iface->flush_front(stfb->iface, stfb->strb_att); + stfb->iface->flush_front(&ctx->iface, stfb->iface, stfb->strb_att); break; default: break; diff --git a/src/gallium/state_trackers/wgl/stw_st.c b/src/gallium/state_trackers/wgl/stw_st.c index 7151508b73e..dcf958769e8 100644 --- a/src/gallium/state_trackers/wgl/stw_st.c +++ b/src/gallium/state_trackers/wgl/stw_st.c @@ -171,7 +171,8 @@ stw_st_framebuffer_present_locked(HDC hdc, } static boolean -stw_st_framebuffer_flush_front(struct st_framebuffer_iface *stfb, +stw_st_framebuffer_flush_front(struct st_context_iface *stctx, + struct st_framebuffer_iface *stfb, enum st_attachment_type statt) { struct stw_st_framebuffer *stwfb = stw_st_framebuffer(stfb); diff --git a/src/mesa/state_tracker/st_manager.c b/src/mesa/state_tracker/st_manager.c index 0b9add95e69..da581861479 100644 --- a/src/mesa/state_tracker/st_manager.c +++ b/src/mesa/state_tracker/st_manager.c @@ -789,7 +789,7 @@ st_manager_flush_frontbuffer(struct st_context *st) /* never a dummy fb */ assert(&stfb->Base != _mesa_get_incomplete_framebuffer()); - stfb->iface->flush_front(stfb->iface, ST_ATTACHMENT_FRONT_LEFT); + stfb->iface->flush_front(&st->iface, stfb->iface, ST_ATTACHMENT_FRONT_LEFT); } /** -- 2.30.2