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)
committerJakob Bornecrantz <jakob@vmware.com>
Tue, 19 Jan 2010 16:06:22 +0000 (17:06 +0100)
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 99dc02254932fb1b567df7424e7ec594fa96de1f..c20b71e95818a71f5445c43dce5e4f0381257325 100644 (file)
@@ -271,6 +271,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 b910930db4235c58f5c4e8bba595071b491040fe..a0fb05d7b27ad1179a4e8d7815a779ec0d8babe7 100644 (file)
@@ -80,6 +80,9 @@ dri_create_buffer(__DRIscreenPrivate * sPriv,
                  __DRIdrawablePrivate * 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 d95c62745e6c0508262b0c8149edd7550ad5912b..25c392e84941e5e6337077831e63e80d567a7284 100644 (file)
@@ -310,6 +310,7 @@ dri_init_screen2(__DRIscreenPrivate * 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 9450b3a45bc8c3b1c5c7c9a6f06954db60907a0c..d8bd24405ceac022ecf083f5dca7f774aeb6e5bd 100644 (file)
@@ -40,8 +40,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 );
 }