summaryrefslogtreecommitdiff
path: root/src/gallium/state_trackers/egl_g3d/x11/native_ximage.c
diff options
context:
space:
mode:
authorChia-I Wu <olvaffe@gmail.com>2010-01-12 18:08:02 +0800
committerChia-I Wu <olvaffe@gmail.com>2010-01-14 17:25:19 +0800
commit6cb89b23eeac50cfb0c5fb8d77e19f869b524eac (patch)
tree1ce2fd6938d95521cc64e35cfb629d98da4b9260 /src/gallium/state_trackers/egl_g3d/x11/native_ximage.c
parent6a2936b87683d39beb81ccba831ae7de47063bc6 (diff)
st/egl_g3d: Use a sequence number to decide if validation is required.
It is not safe to assume that the native surface has not changed since the last validation by checking the geometry alone. Add a sequence number to "validate" callback for that purpose. This is inspired by Luca Barbieri's work.
Diffstat (limited to 'src/gallium/state_trackers/egl_g3d/x11/native_ximage.c')
-rw-r--r--src/gallium/state_trackers/egl_g3d/x11/native_ximage.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/gallium/state_trackers/egl_g3d/x11/native_ximage.c b/src/gallium/state_trackers/egl_g3d/x11/native_ximage.c
index e02faa9b7b..1a1844ec49 100644
--- a/src/gallium/state_trackers/egl_g3d/x11/native_ximage.c
+++ b/src/gallium/state_trackers/egl_g3d/x11/native_ximage.c
@@ -83,6 +83,7 @@ struct ximage_surface {
GC gc;
struct ximage_buffer buffers[NUM_NATIVE_ATTACHMENTS];
+ unsigned int sequence_number;
};
struct ximage_config {
@@ -260,6 +261,9 @@ ximage_surface_swap_buffers(struct native_surface *nsurf)
*xfront = *xback;
*xback = xtmp;
+ /* the front/back textures are swapped */
+ xsurf->sequence_number++;
+
return ximage_surface_draw_buffer(nsurf, NATIVE_ATTACHMENT_FRONT_LEFT);
}
@@ -288,11 +292,12 @@ static boolean
ximage_surface_validate(struct native_surface *nsurf,
const enum native_attachment *natts,
unsigned num_natts,
+ unsigned int *seq_num,
struct pipe_texture **textures,
int *width, int *height)
{
struct ximage_surface *xsurf = ximage_surface(nsurf);
- boolean error = FALSE;
+ boolean new_buffers = FALSE, error = FALSE;
unsigned i;
ximage_surface_update_geometry(&xsurf->base);
@@ -311,6 +316,7 @@ ximage_surface_validate(struct native_surface *nsurf,
if (!xbuf->texture ||
xsurf->width != xbuf->texture->width0 ||
xsurf->height != xbuf->texture->height0) {
+ new_buffers = TRUE;
if (ximage_surface_alloc_buffer(&xsurf->base, natt)) {
/* update ximage */
if (xbuf->ximage) {
@@ -336,6 +342,12 @@ ximage_surface_validate(struct native_surface *nsurf,
pipe_texture_reference(&textures[i], xbuf->texture);
}
+ /* increase the sequence number so that caller knows */
+ if (new_buffers)
+ xsurf->sequence_number++;
+
+ if (seq_num)
+ *seq_num = xsurf->sequence_number;
if (width)
*width = xsurf->width;
if (height)