dri2_from_planar(__DRIimage *image, int plane, void *loaderPrivate)
{
__DRIimage *img;
+ struct pipe_resource *tex = image->texture;
+ int i;
if (plane < 0) {
return NULL;
} else if (plane > 0) {
uint64_t planes;
- if (!dri2_resource_get_param(image, PIPE_RESOURCE_PARAM_NPLANES, 0,
- &planes) ||
+ if (dri2_resource_get_param(image, PIPE_RESOURCE_PARAM_NPLANES, 0,
+ &planes) &&
plane >= planes) {
return NULL;
}
}
+ if (tex->next) {
+ for (i = 0; i < plane; i++) {
+ tex = tex->next;
+ if (!tex)
+ return NULL;
+ }
+ }
+
if (image->dri_components == 0) {
uint64_t modifier;
if (!dri2_resource_get_param(image, PIPE_RESOURCE_PARAM_MODIFIER, 0,
if (img == NULL)
return NULL;
+ pipe_resource_reference(&img->texture, tex);
+
if (img->texture->screen->resource_changed)
img->texture->screen->resource_changed(img->texture->screen,
img->texture);