iris: Report correct number of planes for planar images
authorKenneth Graunke <kenneth@whitecape.org>
Wed, 28 Aug 2019 19:52:23 +0000 (12:52 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Wed, 4 Sep 2019 04:55:23 +0000 (21:55 -0700)
We were only handling the modifiers case and not counting the number of
planes in actual planar images.

Fixes Piglit's ext_image_dma_buf_import-export.

Fixes: fc12fd05f56 ("iris: Implement pipe_screen::resource_get_param")
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=111509
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
src/gallium/drivers/iris/iris_resource.c

index 0cf4b91f927c09f6ac94ec4db0cc2e5b3d71ef5f..989c112a3e3e29431c3b3cb23c134df3fee8b24e 100644 (file)
@@ -1040,7 +1040,14 @@ iris_resource_get_param(struct pipe_screen *screen,
 
    switch (param) {
    case PIPE_RESOURCE_PARAM_NPLANES:
-      *value = mod_with_aux ? 2 : 1;
+      if (mod_with_aux) {
+         *value = 2;
+      } else {
+         unsigned count = 0;
+         for (struct pipe_resource *cur = resource; cur; cur = cur->next)
+            count++;
+         *value = count;
+      }
       return true;
    case PIPE_RESOURCE_PARAM_STRIDE:
       *value = wants_aux ? res->aux.surf.row_pitch_B : res->surf.row_pitch_B;