From 3e2b0f801d7c8d80f6c0d9da3813d7ed8b84e3dd Mon Sep 17 00:00:00 2001 From: Thomas Hellstrom Date: Thu, 20 Sep 2012 11:41:23 +0200 Subject: [PATCH] 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 Reviewed-by: Jakob Bornecrantz --- 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 c14d39a285a..64816271e1f 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 50ef469ed6d..c2dc53bd83a 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 1230dabc8f4..43e56ff0c77 100644 --- a/src/gallium/state_trackers/xa/xa_tracker.h +++ b/src/gallium/state_trackers/xa/xa_tracker.h @@ -37,15 +37,19 @@ #include #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 -- 2.30.2