diff options
author | Nicolai Hähnle <nicolai.haehnle@amd.com> | 2018-01-16 13:41:55 +0100 |
---|---|---|
committer | Nicolai Hähnle <nicolai.haehnle@amd.com> | 2018-03-14 09:06:06 +0100 |
commit | c16a076d40bfb40376f1992ba7e63c2131fa2ee6 (patch) | |
tree | fd6ea403f11eb171d826d55575455ee6236437fc | |
parent | 2a96406d0b4266c7da7e62d682197aefc9cd1e0b (diff) |
st/dri: implement __DRI_IMAGE_TRANSFER_MAP_USER_STRIDE
-rw-r--r-- | src/gallium/state_trackers/dri/dri2.c | 17 |
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 31d17d46c2..88692a7be6 100644 --- a/src/gallium/state_trackers/dri/dri2.c +++ b/src/gallium/state_trackers/dri/dri2.c @@ -1633,18 +1633,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; @@ -1667,13 +1673,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, |