st/dri: update dri2 drawables when viewport is changed
authorBen Skeggs <bskeggs@redhat.com>
Mon, 11 Jan 2010 01:41:47 +0000 (11:41 +1000)
committerBen Skeggs <bskeggs@redhat.com>
Mon, 11 Jan 2010 01:44:38 +0000 (11:44 +1000)
Fixes gnome-shell on nouveau, as well as window resize with various
other applications.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
src/gallium/include/pipe/p_screen.h
src/gallium/state_trackers/dri/dri_drawable.c
src/gallium/state_trackers/dri/dri_drawable.h
src/gallium/state_trackers/dri/dri_screen.c
src/mesa/state_tracker/st_cb_viewport.c

index f0a4de5df33c0beec416c6f80143c5328b766fe3..b8e001a6b01aafa95cbd27cc434eb0419b19afed 100644 (file)
@@ -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
index 1058dd38c258c0e1eb78d6fe82e3dd1ca8cd1b7d..f131e77ac5e83d234dbf690806e04ce71daa1fcb 100644 (file)
@@ -267,6 +267,14 @@ void dri2_set_tex_buffer(__DRIcontext *pDRICtx, GLint target,
    dri2_set_tex_buffer2(pDRICtx, target, GLX_TEXTURE_FORMAT_RGBA_EXT, dPriv);
 }
 
+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)
index 80bb5d7f617f19bd5dabb3284774dc2528fbf171..8bc59cb4c3d20bd05be9570c26b4cc7d71d102d6 100644 (file)
@@ -80,6 +80,9 @@ dri_create_buffer(__DRIscreen * sPriv,
                  __DRIdrawable * dPriv,
                  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);
index bb12baf2815d62a6d02c4a6b2fda6d204bcce3d7..793db087ee1056468abbd70160b1103dd7d1110b 100644 (file)
@@ -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,
index 75b0a219ce3a557ce8f4df086e3ae38c2292cdb5..ab11c5b4fe0b766e49034f9cfcd3b13e03743d21 100644 (file)
@@ -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 );
 }