|
From: Francisco J. <cur...@ri...> - 2010-01-16 22:00:27
|
It can be quite an expensive operation, so we're better off not doing
it unless it's totally required.
Signed-off-by: Francisco Jerez <cur...@ri...>
---
hw/xfree86/dri2/dri2.c | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/hw/xfree86/dri2/dri2.c b/hw/xfree86/dri2/dri2.c
index 3db826e..3f4ed92 100644
--- a/hw/xfree86/dri2/dri2.c
+++ b/hw/xfree86/dri2/dri2.c
@@ -212,6 +212,7 @@ do_get_buffers(DrawablePtr pDraw, int *width, int *height,
int have_fake_front = 0;
int front_format = 0;
int dimensions_match;
+ int buffers_changed;
int i;
if (!pPriv) {
@@ -224,6 +225,8 @@ do_get_buffers(DrawablePtr pDraw, int *width, int *height,
dimensions_match = (pDraw->width == pPriv->width)
&& (pDraw->height == pPriv->height);
+ buffers_changed = (pPriv->buffers == NULL);
+
buffers = xalloc((count + 1) * sizeof(buffers[0]));
for (i = 0; i < count; i++) {
@@ -280,6 +283,7 @@ do_get_buffers(DrawablePtr pDraw, int *width, int *height,
for (i = 0; i < pPriv->bufferCount; i++) {
if (pPriv->buffers[i] != NULL) {
(*ds->DestroyBuffer)(pDraw, pPriv->buffers[i]);
+ buffers_changed = 1;
}
}
@@ -298,7 +302,7 @@ do_get_buffers(DrawablePtr pDraw, int *width, int *height,
* contents of the real front-buffer. This ensures correct operation of
* applications that call glXWaitX before calling glDrawBuffer.
*/
- if (have_fake_front) {
+ if (have_fake_front && buffers_changed) {
BoxRec box;
RegionRec region;
--
1.6.4.4
|