Mesa (master): st/xa: Add new map flags

Thomas Hellstrom thomash at kemper.freedesktop.org
Tue Dec 17 08:02:00 UTC 2013


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

Author: Thomas Hellstrom <thellstrom at vmware.com>
Date:   Thu Sep 20 11:41:23 2012 +0200

st/xa: Add new map flags

Replicate some of the gallium pipe transfer functionality.
Also bump minor to signal availability of this feature.

Signed-off-by: Thomas Hellstrom <thellstrom at vmware.com>
Reviewed-by: Jakob Bornecrantz <jakob at vmware.com>

---

 configure.ac                               |    2 +-
 src/gallium/state_trackers/xa/xa_context.c |   20 ++++++++++++++------
 src/gallium/state_trackers/xa/xa_tracker.h |   10 +++++++---
 3 files changed, 22 insertions(+), 10 deletions(-)

diff --git a/configure.ac b/configure.ac
index c14d39a..6481627 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1943,7 +1943,7 @@ AC_SUBST([XVMC_MAJOR], 1)
 AC_SUBST([XVMC_MINOR], 0)
 
 AC_SUBST([XA_MAJOR], 2)
-AC_SUBST([XA_MINOR], 0)
+AC_SUBST([XA_MINOR], 1)
 AC_SUBST([XA_TINY], 0)
 AC_SUBST([XA_VERSION], "$XA_MAJOR.$XA_MINOR.$XA_TINY")
 
diff --git a/src/gallium/state_trackers/xa/xa_context.c b/src/gallium/state_trackers/xa/xa_context.c
index 50ef469..c2dc53b 100644
--- a/src/gallium/state_trackers/xa/xa_context.c
+++ b/src/gallium/state_trackers/xa/xa_context.c
@@ -132,7 +132,7 @@ xa_surface_map(struct xa_context *ctx,
 	       struct xa_surface *srf, unsigned int usage)
 {
     void *map;
-    unsigned int transfer_direction = 0;
+    unsigned int gallium_usage = 0;
     struct pipe_context *pipe = ctx->pipe;
 
     /*
@@ -142,15 +142,23 @@ xa_surface_map(struct xa_context *ctx,
 	return NULL;
 
     if (usage & XA_MAP_READ)
-	transfer_direction |= PIPE_TRANSFER_READ;
+	gallium_usage |= PIPE_TRANSFER_READ;
     if (usage & XA_MAP_WRITE)
-	transfer_direction |= PIPE_TRANSFER_WRITE;
-
-    if (!transfer_direction)
+	gallium_usage |= PIPE_TRANSFER_WRITE;
+    if (usage & XA_MAP_MAP_DIRECTLY)
+	gallium_usage |= PIPE_TRANSFER_MAP_DIRECTLY;
+    if (usage & XA_MAP_UNSYNCHRONIZED)
+	gallium_usage |= PIPE_TRANSFER_UNSYNCHRONIZED;
+    if (usage & XA_MAP_DONTBLOCK)
+	gallium_usage |= PIPE_TRANSFER_DONTBLOCK;
+    if (usage & XA_MAP_DISCARD_WHOLE_RESOURCE)
+	gallium_usage |= PIPE_TRANSFER_DISCARD_WHOLE_RESOURCE;
+
+    if (!(gallium_usage & (PIPE_TRANSFER_READ_WRITE)))
 	return NULL;
 
     map = pipe_transfer_map(pipe, srf->tex, 0, 0,
-                            transfer_direction, 0, 0,
+                            gallium_usage, 0, 0,
                             srf->tex->width0, srf->tex->height0,
                             &srf->transfer);
     if (!map)
diff --git a/src/gallium/state_trackers/xa/xa_tracker.h b/src/gallium/state_trackers/xa/xa_tracker.h
index 1230dab..43e56ff 100644
--- a/src/gallium/state_trackers/xa/xa_tracker.h
+++ b/src/gallium/state_trackers/xa/xa_tracker.h
@@ -37,15 +37,19 @@
 #include <stdint.h>
 
 #define XA_TRACKER_VERSION_MAJOR 2
-#define XA_TRACKER_VERSION_MINOR 0
+#define XA_TRACKER_VERSION_MINOR 1
 #define XA_TRACKER_VERSION_PATCH 0
 
 #define XA_FLAG_SHARED         (1 << 0)
 #define XA_FLAG_RENDER_TARGET  (1 << 1)
 #define XA_FLAG_SCANOUT        (1 << 2)
 
-#define XA_MAP_READ            (1 << 0)
-#define XA_MAP_WRITE           (1 << 1)
+#define XA_MAP_READ                     (1 << 0)
+#define XA_MAP_WRITE                    (1 << 1)
+#define XA_MAP_MAP_DIRECTLY             (1 << 2)
+#define XA_MAP_UNSYNCHRONIZED           (1 << 3)
+#define XA_MAP_DONTBLOCK                (1 << 4)
+#define XA_MAP_DISCARD_WHOLE_RESOURCE   (1 << 5)
 
 #define XA_ERR_NONE            0
 #define XA_ERR_NORES           1




More information about the mesa-commit mailing list