Mesa (master): st/dri: Only create new textures if drawable has changed
Jakob Bornecrantz
wallbraker at kemper.freedesktop.org
Mon May 18 19:55:44 UTC 2009
Module: Mesa
Branch: master
Commit: 7d11a392d780ef7f0374f8da87e3ba416d880cf2
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=7d11a392d780ef7f0374f8da87e3ba416d880cf2
Author: Jakob Bornecrantz <jakob at vmware.com>
Date: Mon May 18 02:50:15 2009 +0100
st/dri: Only create new textures if drawable has changed
---
src/gallium/state_trackers/dri/dri_drawable.c | 12 ++++++++++++
src/gallium/state_trackers/dri/dri_drawable.h | 5 +++++
2 files changed, 17 insertions(+), 0 deletions(-)
diff --git a/src/gallium/state_trackers/dri/dri_drawable.c b/src/gallium/state_trackers/dri/dri_drawable.c
index 15a2088..865cc8d 100644
--- a/src/gallium/state_trackers/dri/dri_drawable.c
+++ b/src/gallium/state_trackers/dri/dri_drawable.c
@@ -138,6 +138,18 @@ dri_get_buffers(__DRIdrawablePrivate * dPriv)
dri_drawable->pBackClipRects[0].x2 = dri_drawable->w;
dri_drawable->pBackClipRects[0].y2 = dri_drawable->h;
+ if (drawable->old_num == count &&
+ drawable->old_w == dri_drawable->w &&
+ drawable->old_h == dri_drawable->h &&
+ memcmp(drawable->old, buffers, sizeof(__DRIbuffer) * count) == 0) {
+ return;
+ } else {
+ drawable->old_num = count;
+ drawable->old_w = dri_drawable->w;
+ drawable->old_h = dri_drawable->h;
+ memcpy(drawable->old, buffers, sizeof(__DRIbuffer) * count);
+ }
+
for (i = 0; i < count; i++) {
enum pipe_format format = 0;
int index = 0;
diff --git a/src/gallium/state_trackers/dri/dri_drawable.h b/src/gallium/state_trackers/dri/dri_drawable.h
index 78a6662..0f654d8 100644
--- a/src/gallium/state_trackers/dri/dri_drawable.h
+++ b/src/gallium/state_trackers/dri/dri_drawable.h
@@ -46,6 +46,11 @@ struct dri_drawable
unsigned attachments[8];
unsigned num_attachments;
+ __DRIbuffer old[8];
+ unsigned old_num;
+ unsigned old_w;
+ unsigned old_h;
+
/* gallium */
struct st_framebuffer *stfb;
struct pipe_fence_handle *swap_fences[DRI_SWAP_FENCES_MAX];
More information about the mesa-commit
mailing list