st/dri2: Hook up flush_frontbuffer
authorJakob Bornecrantz <wallbraker@gmail.com>
Tue, 3 Mar 2009 23:35:33 +0000 (00:35 +0100)
committerJakob Bornecrantz <wallbraker@gmail.com>
Tue, 3 Mar 2009 23:35:33 +0000 (00:35 +0100)
Doesn't do anything because we can't tell the X server about
any changes to the fake front buffer.

src/gallium/state_trackers/dri2/dri_context.c
src/gallium/state_trackers/dri2/dri_drawable.c
src/gallium/state_trackers/dri2/dri_drawable.h
src/gallium/state_trackers/dri2/dri_screen.c

index b8e92a76c02c0877eaa71824c5e986da18251c34..92c26ac70fe5849d55b27303d741ded9f7973f19 100644 (file)
@@ -76,7 +76,8 @@ dri_create_context(const __GLcontextModes *visual,
    if (ctx->pipe == NULL)
       goto fail;
 
-   ctx->pipe->priv = ctx;       /* I guess */
+   /* used in dri_flush_frontbuffer */
+   ctx->pipe->priv = ctx;
 
    ctx->st = st_create_context(ctx->pipe, visual, st_share);
    if (ctx->st == NULL)
@@ -152,6 +153,7 @@ dri_make_current(__DRIcontextPrivate *cPriv,
                       draw->stfb,
                       read->stfb);
 
+      /* used in dri_flush_frontbuffer */
       ctx->dPriv = driDrawPriv;
 
       if (driDrawPriv)
index 5c8f3ba86627485b692187d02d2be60521196560..8a00c6caf1a032541959213f907f1b002e961081 100644 (file)
 #include "util/u_memory.h"
 
 
+static void
+dri_copy_to_front(__DRIdrawablePrivate *dPriv,
+                  struct pipe_surface *from,
+                  int x, int y, unsigned w, unsigned h)
+{
+   /* TODO send a message to the Xserver to copy to the real front buffer */
+}
+
+
 static struct pipe_surface *
 dri_surface_from_handle(struct pipe_screen *screen,
                         unsigned handle,
@@ -184,6 +193,16 @@ dri_get_buffers(__DRIdrawablePrivate *dPriv)
 }
 
 
+void
+dri_flush_frontbuffer(struct pipe_screen *screen,
+                      struct pipe_surface *surf,
+                      void *context_private)
+{
+   struct dri_context *ctx = (struct dri_context *)context_private;
+   dri_copy_to_front(ctx->dPriv, surf, 0, 0, surf->width, surf->height);
+}
+
+
 void
 dri_swap_buffers(__DRIdrawablePrivate * dPriv)
 {
index d40d09c9b5b57f97037032e90a50ca78be1fa229..185c657b35a238be3c0f05e04c86abd207af2c24 100644 (file)
@@ -65,6 +65,11 @@ dri_create_buffer(__DRIscreenPrivate *sPriv,
                   const __GLcontextModes *visual,
                   boolean isPixmap);
 
+void
+dri_flush_frontbuffer(struct pipe_screen *screen,
+                      struct pipe_surface *surf,
+                      void *context_private);
+
 void
 dri_swap_buffers(__DRIdrawablePrivate * dPriv);
 
index 57249a51118dc56b75f81d15e4f60e41a5da7df0..ab5878a4bce88ea2e7799fff4b32a28d1a27e287 100644 (file)
@@ -224,6 +224,9 @@ dri_init_screen2(__DRIscreenPrivate *sPriv)
       goto fail;
    }
 
+   /* We need to hook in here */
+   screen->pipe_screen->flush_frontbuffer = dri_flush_frontbuffer;
+
    driParseOptionInfo(&screen->optionCache,
                       __driConfigOptions,
                       __driNConfigOptions);