img->layer = 0;
img->use = 0;
img->loader_private = loaderPrivate;
+ img->lowered_yuv = use_lowered;
return img;
}
img->dri_fourcc = map->dri_fourcc;
img->dri_components = 0;
img->use = use;
+ img->lowered_yuv = false;
img->loader_private = loaderPrivate;
return img;
/* This should be 0 for sub images, but dup is also used for base images. */
img->dri_components = image->dri_components;
img->loader_private = loaderPrivate;
+ img->lowered_yuv = image->lowered_yuv;
return img;
}
struct dri_context *ctx = dri_context(context);
struct pipe_context *pipe = ctx->st->pipe;
enum pipe_transfer_usage pipe_access = 0;
+ struct pipe_resource *resource = image->texture;
struct pipe_transfer *trans;
void *map;
if (!image || !data || *data)
return NULL;
+ if (image->lowered_yuv) {
+ unsigned plane = image->plane;
+ if (plane >= dri2_get_mapping_by_format(image->dri_format)->nplanes)
+ return NULL;
+
+ while (plane--)
+ resource = resource->next;
+ } else if (dri2_get_mapping_by_format(image->dri_format)->nplanes > 1)
+ return NULL;
+
if (flags & __DRI_IMAGE_TRANSFER_READ)
pipe_access |= PIPE_TRANSFER_READ;
if (flags & __DRI_IMAGE_TRANSFER_WRITE)
pipe_access |= PIPE_TRANSFER_WRITE;
- map = pipe_transfer_map(pipe, image->texture,
- 0, 0, pipe_access, x0, y0, width, height,
- &trans);
+ map = pipe_transfer_map(pipe, resource, 0, 0, pipe_access, x0, y0,
+ width, height, &trans);
if (map) {
*data = trans;
*stride = trans->stride;