Mesa (master): st/dri: Claim to support validate_usage

Jakob Bornecrantz wallbraker at kemper.freedesktop.org
Sun Aug 26 14:05:54 UTC 2012


Module: Mesa
Branch: master
Commit: 15effe1fabe9e47e680f9f9c12ea6b61acf97cd5
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=15effe1fabe9e47e680f9f9c12ea6b61acf97cd5

Author: Jakob Bornecrantz <jakob at vmware.com>
Date:   Tue Aug 21 23:19:32 2012 +0200

st/dri: Claim to support validate_usage

Support version 3 as well as 2, since that is only the new format query,
which Jesse added support for to st/dri when he added it to dri_inteface.h.

Tested-by: Scott Moreau <oreaus at gmail.com>
Signed-off-by: Jakob Bornecrantz <jakob at vmware.com>

---

 src/gallium/state_trackers/dri/drm/dri2.c |   17 ++++++++++++++++-
 1 files changed, 16 insertions(+), 1 deletions(-)

diff --git a/src/gallium/state_trackers/dri/drm/dri2.c b/src/gallium/state_trackers/dri/drm/dri2.c
index 1f14b5c..5c7acfe 100644
--- a/src/gallium/state_trackers/dri/drm/dri2.c
+++ b/src/gallium/state_trackers/dri/drm/dri2.c
@@ -629,6 +629,20 @@ dri2_dup_image(__DRIimage *image, void *loaderPrivate)
    return img;
 }
 
+static GLboolean
+dri2_validate_usage(__DRIimage *image, unsigned int use)
+{
+   /*
+    * Gallium drivers are bad at adding usages to the resources
+    * once opened again in another process, which is the main use
+    * case for this, so we have to lie.
+    */
+   if (image != NULL)
+      return GL_TRUE;
+   else
+      return GL_FALSE;
+}
+
 static void
 dri2_destroy_image(__DRIimage *img)
 {
@@ -637,13 +651,14 @@ dri2_destroy_image(__DRIimage *img)
 }
 
 static struct __DRIimageExtensionRec dri2ImageExtension = {
-    { __DRI_IMAGE, 1 },
+    { __DRI_IMAGE, 3 },
     dri2_create_image_from_name,
     dri2_create_image_from_renderbuffer,
     dri2_destroy_image,
     dri2_create_image,
     dri2_query_image,
     dri2_dup_image,
+    dri2_validate_usage,
 };
 
 /*




More information about the mesa-commit mailing list