[Mesa-dev] [PATCH 09/10] gallium: pass the current context to the flush_front state tracker function

Marek Olšák maraeo at gmail.com
Mon Dec 3 16:07:18 PST 2012


I will later use the context to resolve an MSAA front buffer.
---
 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 91c5529..419f825 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 7e87f87..dca6def 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 6336c81..6a76991 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 eb5536e..5ebe184 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 533f908..7a5f797 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 50ed669..657845c 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 7b54df5..a681e82 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 660a7af..e9c4a83 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 7151508..dcf9587 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 0b9add9..da58186 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);
 }
 
 /**
-- 
1.7.10.4



More information about the mesa-dev mailing list