summaryrefslogtreecommitdiff
path: root/src/gallium/state_trackers/egl_g3d/kms/native_kms.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/kms/native_kms.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/kms/native_kms.c')
-rw-r--r--src/gallium/state_trackers/egl_g3d/kms/native_kms.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/gallium/state_trackers/egl_g3d/kms/native_kms.c b/src/gallium/state_trackers/egl_g3d/kms/native_kms.c
index 0e0babdb14..a44b9b9ae5 100644
--- a/src/gallium/state_trackers/egl_g3d/kms/native_kms.c
+++ b/src/gallium/state_trackers/egl_g3d/kms/native_kms.c
@@ -36,7 +36,7 @@ static boolean
kms_surface_validate(struct native_surface *nsurf,
const enum native_attachment *natts,
unsigned num_natts,
- struct pipe_texture **textures,
+ unsigned int *seq_num, struct pipe_texture **textures,
int *width, int *height)
{
struct kms_surface *ksurf = kms_surface(nsurf);
@@ -75,6 +75,8 @@ kms_surface_validate(struct native_surface *nsurf,
pipe_texture_reference(&textures[i], ptex);
}
+ if (seq_num)
+ *seq_num = ksurf->sequence_number;
if (width)
*width = ksurf->width;
if (height)
@@ -111,7 +113,7 @@ kms_surface_init_framebuffers(struct native_surface *nsurf, boolean need_back)
if (!fb->texture) {
/* make sure the texture has been allocated */
- kms_surface_validate(&ksurf->base, &natt, 1, NULL, NULL, NULL);
+ kms_surface_validate(&ksurf->base, &natt, 1, NULL, NULL, NULL, NULL);
if (!ksurf->textures[natt])
return FALSE;
@@ -196,6 +198,9 @@ kms_surface_swap_buffers(struct native_surface *nsurf)
ksurf->textures[NATIVE_ATTACHMENT_BACK_LEFT];
ksurf->textures[NATIVE_ATTACHMENT_BACK_LEFT] = tmp_texture;
+ /* the front/back textures are swapped */
+ ksurf->sequence_number++;
+
return TRUE;
}