gallium/dri: fix dri2_query_image for multiplanar images

Images with multiple planes in separate chained texture resources should
report the correct number of planes.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7028>
This commit is contained in:
Philipp Zabel
2019-02-14 18:40:57 +01:00
committed by Lucas Stach
parent 0f3594cd7b
commit 6c118aebb1
+5 -1
View File
@@ -1122,9 +1122,11 @@ dri2_query_image_by_resource_handle(__DRIimage *image, int attrib, int *value)
{
struct pipe_screen *pscreen = image->texture->screen;
struct winsys_handle whandle;
struct pipe_resource *tex;
unsigned usage;
memset(&whandle, 0, sizeof(whandle));
whandle.plane = image->plane;
int i;
switch (attrib) {
case __DRI_IMAGE_ATTRIB_STRIDE:
@@ -1139,7 +1141,9 @@ dri2_query_image_by_resource_handle(__DRIimage *image, int attrib, int *value)
whandle.type = WINSYS_HANDLE_TYPE_FD;
break;
case __DRI_IMAGE_ATTRIB_NUM_PLANES:
*value = 1;
for (i = 0, tex = image->texture; tex; tex = tex->next)
i++;
*value = i;
return true;
case __DRI_IMAGE_ATTRIB_MODIFIER_UPPER:
case __DRI_IMAGE_ATTRIB_MODIFIER_LOWER: