[Mesa-dev] [PATCH 2/6] st/dri: fix dri2_query_image for multiplanar images

Lucas Stach l.stach at pengutronix.de
Fri Apr 12 17:33:31 UTC 2019


From: Philipp Zabel <p.zabel at pengutronix.de>

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

Signed-off-by: Philipp Zabel <p.zabel at pengutronix.de>
---
 src/gallium/state_trackers/dri/dri2.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/gallium/state_trackers/dri/dri2.c b/src/gallium/state_trackers/dri/dri2.c
index 510b7f8d04a7..4c8ea485cc70 100644
--- a/src/gallium/state_trackers/dri/dri2.c
+++ b/src/gallium/state_trackers/dri/dri2.c
@@ -1083,7 +1083,9 @@ static GLboolean
 dri2_query_image(__DRIimage *image, int attrib, int *value)
 {
    struct winsys_handle whandle;
+   struct pipe_resource *tex;
    unsigned usage;
+   int i;
 
    if (image->use & __DRI_IMAGE_USE_BACKBUFFER)
       usage = PIPE_HANDLE_USAGE_EXPLICIT_FLUSH;
@@ -1157,7 +1159,9 @@ dri2_query_image(__DRIimage *image, int attrib, int *value)
       }
       return GL_TRUE;
    case __DRI_IMAGE_ATTRIB_NUM_PLANES:
-      *value = 1;
+      for (i = 0, tex = image->texture; i < 4 && tex; tex = tex->next)
+         i++;
+      *value = i;
       return GL_TRUE;
    case __DRI_IMAGE_ATTRIB_MODIFIER_UPPER:
       whandle.type = WINSYS_HANDLE_TYPE_KMS;
-- 
2.20.1



More information about the mesa-dev mailing list