It was assumed that fromPlanar() could return NULL to mean
that the planar image is the same as the parent DRI image.
That assumption wasn't made everywhere though.
Let's fix things and make sure that all callers understand
a NULL result
Signed-off-by: Louis-Francis Ratté-Boulianne <lfrb@collabora.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Daniel Stone <daniels@collabora.com>
}
dri_image = dri2_dpy->image->fromPlanar(buffer->driver_buffer, plane, NULL);
-
+ if (dri_image == NULL && plane == 0)
+ dri_image = dri2_dpy->image->dupImage(buffer->driver_buffer, NULL);
if (dri_image == NULL) {
_eglError(EGL_BAD_PARAMETER, "dri2_create_image_wayland_wl_buffer");
return NULL;
int stride, offset;
int fd = -1;
- if (i == 0)
- p_image = image;
- else
- p_image = dri2_dpy->image->fromPlanar(image, i, NULL);
+ p_image = dri2_dpy->image->fromPlanar(image, i, NULL);
if (!p_image) {
- zwp_linux_buffer_params_v1_destroy(params);
- return NULL;
+ assert(i == 0);
+ p_image = image;
}
query = dri2_dpy->image->queryImage(p_image,
dri->image->queryImage(image, __DRI_IMAGE_ATTRIB_OFFSET, &offset);
dri->image->destroyImage(image);
} else {
+ assert(plane == 0);
dri->image->queryImage(bo->image, __DRI_IMAGE_ATTRIB_OFFSET, &offset);
}
ret = image->fromPlanar(image_planar, 0, loaderPrivate);
- image->destroyImage(image_planar);
+ if (!ret)
+ ret = image_planar;
+ else
+ image->destroyImage(image_planar);
return ret;
}