st/xa: Add new map flags
authorThomas Hellstrom <thellstrom@vmware.com>
Thu, 20 Sep 2012 09:41:23 +0000 (11:41 +0200)
committerThomas Hellstrom <thellstrom@vmware.com>
Tue, 17 Dec 2013 08:01:29 +0000 (09:01 +0100)
Replicate some of the gallium pipe transfer functionality.
Also bump minor to signal availability of this feature.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Jakob Bornecrantz <jakob@vmware.com>
configure.ac
src/gallium/state_trackers/xa/xa_context.c
src/gallium/state_trackers/xa/xa_tracker.h

index c14d39a285a6540d0cc6ca4c45b450b47e9e6cd8..64816271e1fba290e4da18a84c120e64faf4f3c5 100644 (file)
@@ -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")
 
index 50ef469ed6d0ce1f28f7b0c840d34e73c665f7cc..c2dc53bd83a8e52bc533c8d7f6400b5d993e3f9d 100644 (file)
@@ -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)
index 1230dabc8f46ea57ea37f2beb8a311e6c382ab9f..43e56ff0c77c9e0b3415e6f4d460e2ad90525aed 100644 (file)
 #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