summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolai Hähnle <nicolai.haehnle@amd.com>2018-01-16 13:41:55 +0100
committerNicolai Hähnle <nicolai.haehnle@amd.com>2018-01-16 20:15:32 +0100
commit507651df680704593148377c6c171e9592105d8e (patch)
tree7ec7b01293ccd941ef698b45af9f635747707e84
parent8522949604a85bf27cce981a7f1b7f70d2292fad (diff)
st/dri: implement __DRI_IMAGE_TRANSFER_MAP_USER_STRIDE
-rw-r--r--src/gallium/state_trackers/dri/dri2.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/gallium/state_trackers/dri/dri2.c b/src/gallium/state_trackers/dri/dri2.c
index d073141952..e546fc55d5 100644
--- a/src/gallium/state_trackers/dri/dri2.c
+++ b/src/gallium/state_trackers/dri/dri2.c
@@ -1597,18 +1597,24 @@ dri2_map_image(__DRIcontext *context, __DRIimage *image,
struct pipe_context *pipe = ctx->st->pipe;
enum pipe_transfer_usage pipe_access = 0;
struct pipe_transfer *trans;
+ struct pipe_box box;
+ unsigned user_stride = 0;
void *map;
if (!image || !data || *data)
return NULL;
if (flags & __DRI_IMAGE_TRANSFER_READ)
- pipe_access |= PIPE_TRANSFER_READ;
+ pipe_access |= PIPE_TRANSFER_READ;
if (flags & __DRI_IMAGE_TRANSFER_WRITE)
- pipe_access |= PIPE_TRANSFER_WRITE;
+ pipe_access |= PIPE_TRANSFER_WRITE;
+ if (flags & __DRI_IMAGE_TRANSFER_USER_STRIDE)
+ user_stride = *stride;
- map = pipe_transfer_map(pipe, image->texture,
- 0, 0, pipe_access, x0, y0, width, height,
+ u_box_2d(x0, y0, width, height, &box);
+
+ map = pipe->transfer_map(pipe, image->texture,
+ 0, pipe_access, &box, user_stride,
&trans);
if (map) {
*data = trans;
@@ -1631,13 +1637,12 @@ static int
dri2_get_capabilities(__DRIscreen *_screen)
{
struct dri_screen *screen = dri_screen(_screen);
-
return (screen->can_share_buffer ? __DRI_IMAGE_CAP_GLOBAL_NAMES : 0);
}
/* The extension is modified during runtime if DRI_PRIME is detected */
static __DRIimageExtension dri2ImageExtension = {
- .base = { __DRI_IMAGE, 17 },
+ .base = { __DRI_IMAGE, 18 },
.createImageFromName = dri2_create_image_from_name,
.createImageFromRenderbuffer = dri2_create_image_from_renderbuffer,