From 6c118aebb116c6e6d019f150d9b738d9b4054f15 Mon Sep 17 00:00:00 2001 From: Philipp Zabel Date: Thu, 14 Feb 2019 18:40:57 +0100 Subject: [PATCH] gallium/dri: fix dri2_query_image for multiplanar images MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Images with multiple planes in separate chained texture resources should report the correct number of planes. Signed-off-by: Philipp Zabel Reviewed-by: Eric Anholt Reviewed-by: Marek Olšák Part-of: --- src/gallium/frontends/dri/dri2.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/gallium/frontends/dri/dri2.c b/src/gallium/frontends/dri/dri2.c index 12633277452..86ac38df1f4 100644 --- a/src/gallium/frontends/dri/dri2.c +++ b/src/gallium/frontends/dri/dri2.c @@ -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: