summaryrefslogtreecommitdiffstats
path: root/src/gallium/state_trackers/dri/dri_drawable.c
diff options
context:
space:
mode:
authorJakob Bornecrantz <jakob@vmware.com>2009-08-22 02:12:21 +0100
committerJakob Bornecrantz <jakob@vmware.com>2009-08-22 02:16:02 +0100
commita3e59b9d06bcad6b1ab741ee659a4db0d119d5ef (patch)
tree6a53bcf79c3e19d91b46aa9f09b0621d768d9d47 /src/gallium/state_trackers/dri/dri_drawable.c
parent6237ac2412b08a3b6239203be69ce542335ae47e (diff)
downloadexternal_mesa3d-a3e59b9d06bcad6b1ab741ee659a4db0d119d5ef.zip
external_mesa3d-a3e59b9d06bcad6b1ab741ee659a4db0d119d5ef.tar.gz
external_mesa3d-a3e59b9d06bcad6b1ab741ee659a4db0d119d5ef.tar.bz2
st/dri: Find out if the drawable is a pixmap
Part of this code is disabled since no performance gains where detected with it enabled. This code only detects if it is a pixmap that it is rendering to on the st/xorg DDX since it sets the fake front to the same handle as front.
Diffstat (limited to 'src/gallium/state_trackers/dri/dri_drawable.c')
-rw-r--r--src/gallium/state_trackers/dri/dri_drawable.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/src/gallium/state_trackers/dri/dri_drawable.c b/src/gallium/state_trackers/dri/dri_drawable.c
index 16dab62..2d5510a 100644
--- a/src/gallium/state_trackers/dri/dri_drawable.c
+++ b/src/gallium/state_trackers/dri/dri_drawable.c
@@ -88,6 +88,35 @@ dri_surface_from_handle(struct drm_api *api,
}
/**
+ * Pixmaps have will have the same name of fake front and front.
+ */
+static boolean
+dri2_check_if_pixmap(__DRIbuffer *buffers, int count)
+{
+ boolean found = FALSE;
+ boolean is_pixmap = FALSE;
+ unsigned name;
+ int i;
+
+ for (i = 0; i < count; i++) {
+ switch (buffers[i].attachment) {
+ case __DRI_BUFFER_FRONT_LEFT:
+ case __DRI_BUFFER_FAKE_FRONT_LEFT:
+ if (found) {
+ is_pixmap = buffers[i].name == name;
+ } else {
+ name = buffers[i].name;
+ found = TRUE;
+ }
+ default:
+ continue;
+ }
+ }
+
+ return is_pixmap;
+}
+
+/**
* This will be called a drawable is known to have been resized.
*/
void
@@ -145,6 +174,8 @@ dri_get_buffers(__DRIdrawablePrivate * dPriv)
memcpy(drawable->old, buffers, sizeof(__DRIbuffer) * count);
}
+ drawable->is_pixmap = dri2_check_if_pixmap(buffers, count);
+
for (i = 0; i < count; i++) {
enum pipe_format format = 0;
int index = 0;
@@ -234,6 +265,12 @@ dri_flush_frontbuffer(struct pipe_screen *screen,
return;
}
+#if 0
+ /* TODO if rendering to pixmaps is slow enable this code. */
+ if (drawable->is_pixmap)
+ return;
+#endif
+
(*dri_screen->dri2.loader->flushFrontBuffer)(dri_drawable,
dri_drawable->loaderPrivate);
}