Mesa (master): st/dri2: Hook up flush_frontbuffer
Jakob Bornecrantz
wallbraker at kemper.freedesktop.org
Tue Mar 3 23:52:17 UTC 2009
Module: Mesa
Branch: master
Commit: 28c325f8d3925d703a0cc5a3d3d3fa57b7f11fe4
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=28c325f8d3925d703a0cc5a3d3d3fa57b7f11fe4
Author: Jakob Bornecrantz <wallbraker at gmail.com>
Date: Wed Mar 4 00:35:33 2009 +0100
st/dri2: Hook up flush_frontbuffer
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 | 4 +++-
src/gallium/state_trackers/dri2/dri_drawable.c | 19 +++++++++++++++++++
src/gallium/state_trackers/dri2/dri_drawable.h | 5 +++++
src/gallium/state_trackers/dri2/dri_screen.c | 3 +++
4 files changed, 30 insertions(+), 1 deletions(-)
diff --git a/src/gallium/state_trackers/dri2/dri_context.c b/src/gallium/state_trackers/dri2/dri_context.c
index b8e92a7..92c26ac 100644
--- a/src/gallium/state_trackers/dri2/dri_context.c
+++ b/src/gallium/state_trackers/dri2/dri_context.c
@@ -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)
diff --git a/src/gallium/state_trackers/dri2/dri_drawable.c b/src/gallium/state_trackers/dri2/dri_drawable.c
index 5c8f3ba..8a00c6c 100644
--- a/src/gallium/state_trackers/dri2/dri_drawable.c
+++ b/src/gallium/state_trackers/dri2/dri_drawable.c
@@ -44,6 +44,15 @@
#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,
@@ -185,6 +194,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)
{
/* not needed for dri2 */
diff --git a/src/gallium/state_trackers/dri2/dri_drawable.h b/src/gallium/state_trackers/dri2/dri_drawable.h
index d40d09c..185c657 100644
--- a/src/gallium/state_trackers/dri2/dri_drawable.h
+++ b/src/gallium/state_trackers/dri2/dri_drawable.h
@@ -66,6 +66,11 @@ dri_create_buffer(__DRIscreenPrivate *sPriv,
boolean isPixmap);
void
+dri_flush_frontbuffer(struct pipe_screen *screen,
+ struct pipe_surface *surf,
+ void *context_private);
+
+void
dri_swap_buffers(__DRIdrawablePrivate * dPriv);
void
diff --git a/src/gallium/state_trackers/dri2/dri_screen.c b/src/gallium/state_trackers/dri2/dri_screen.c
index 57249a5..ab5878a 100644
--- a/src/gallium/state_trackers/dri2/dri_screen.c
+++ b/src/gallium/state_trackers/dri2/dri_screen.c
@@ -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);
More information about the mesa-commit
mailing list