Mesa (master): st/dri: update dri2 drawables when viewport is changed

Ben Skeggs darktama at kemper.freedesktop.org
Mon Jan 11 01:47:30 UTC 2010


Module: Mesa
Branch: master
Commit: 32da02f7c19f49802fe9589e73c3945502a197c9
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=32da02f7c19f49802fe9589e73c3945502a197c9

Author: Ben Skeggs <bskeggs at redhat.com>
Date:   Mon Jan 11 11:41:47 2010 +1000

st/dri: update dri2 drawables when viewport is changed

Fixes gnome-shell on nouveau, as well as window resize with various
other applications.

Signed-off-by: Ben Skeggs <bskeggs at redhat.com>

---

 src/gallium/include/pipe/p_screen.h           |    5 +++++
 src/gallium/state_trackers/dri/dri_drawable.c |    8 ++++++++
 src/gallium/state_trackers/dri/dri_drawable.h |    3 +++
 src/gallium/state_trackers/dri/dri_screen.c   |    1 +
 src/mesa/state_tracker/st_cb_viewport.c       |    4 ++--
 5 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/src/gallium/include/pipe/p_screen.h b/src/gallium/include/pipe/p_screen.h
index f0a4de5..b8e001a 100644
--- a/src/gallium/include/pipe/p_screen.h
+++ b/src/gallium/include/pipe/p_screen.h
@@ -266,6 +266,11 @@ struct pipe_screen {
 
    void (*video_surface_destroy)( struct pipe_video_surface *vsfc );
 
+   /**
+    * Do any special operations to ensure buffer size is correct
+    */
+   void (*update_buffer)( struct pipe_screen *ws,
+                          void *context_private );
 
    /**
     * Do any special operations to ensure frontbuffer contents are
diff --git a/src/gallium/state_trackers/dri/dri_drawable.c b/src/gallium/state_trackers/dri/dri_drawable.c
index 1058dd3..f131e77 100644
--- a/src/gallium/state_trackers/dri/dri_drawable.c
+++ b/src/gallium/state_trackers/dri/dri_drawable.c
@@ -268,6 +268,14 @@ void dri2_set_tex_buffer(__DRIcontext *pDRICtx, GLint target,
 }
 
 void
+dri_update_buffer(struct pipe_screen *screen, void *context_private)
+{
+   struct dri_context *ctx = (struct dri_context *)context_private;
+
+   dri_get_buffers(ctx->dPriv);
+}
+
+void
 dri_flush_frontbuffer(struct pipe_screen *screen,
 		      struct pipe_surface *surf, void *context_private)
 {
diff --git a/src/gallium/state_trackers/dri/dri_drawable.h b/src/gallium/state_trackers/dri/dri_drawable.h
index 80bb5d7..8bc59cb 100644
--- a/src/gallium/state_trackers/dri/dri_drawable.h
+++ b/src/gallium/state_trackers/dri/dri_drawable.h
@@ -81,6 +81,9 @@ dri_create_buffer(__DRIscreen * sPriv,
 		  const __GLcontextModes * visual, boolean isPixmap);
 
 void
+dri_update_buffer(struct pipe_screen *screen, void *context_private);
+
+void
 dri_flush_frontbuffer(struct pipe_screen *screen,
 		      struct pipe_surface *surf, void *context_private);
 
diff --git a/src/gallium/state_trackers/dri/dri_screen.c b/src/gallium/state_trackers/dri/dri_screen.c
index bb12baf..793db08 100644
--- a/src/gallium/state_trackers/dri/dri_screen.c
+++ b/src/gallium/state_trackers/dri/dri_screen.c
@@ -308,6 +308,7 @@ dri_init_screen2(__DRIscreen * sPriv)
    }
 
    /* We need to hook in here */
+   screen->pipe_screen->update_buffer = dri_update_buffer;
    screen->pipe_screen->flush_frontbuffer = dri_flush_frontbuffer;
 
    driParseOptionInfo(&screen->optionCache,
diff --git a/src/mesa/state_tracker/st_cb_viewport.c b/src/mesa/state_tracker/st_cb_viewport.c
index 75b0a21..ab11c5b 100644
--- a/src/mesa/state_tracker/st_cb_viewport.c
+++ b/src/mesa/state_tracker/st_cb_viewport.c
@@ -42,8 +42,8 @@ static void st_viewport(GLcontext * ctx, GLint x, GLint y,
 {
    struct st_context *st = ctx->st;
 
-   if (st->pipe->winsys && st->pipe->winsys->update_buffer)
-      st->pipe->winsys->update_buffer( st->pipe->winsys,
+   if (st->pipe->screen && st->pipe->screen->update_buffer)
+      st->pipe->screen->update_buffer( st->pipe->screen,
                                        st->pipe->priv );
 }
 




More information about the mesa-commit mailing list