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@vmware.com>
Reviewed-by: Jakob Bornecrantz <jakob@vmware.com>
This commit is contained in:
Thomas Hellstrom 2012-09-20 11:41:23 +02:00
parent 56d920a5c1
commit 3e2b0f801d
3 changed files with 21 additions and 9 deletions

View 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")

View 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;
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 (!transfer_direction)
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)

View File

@ -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