zink: store drm format as internal_format for imported resources
authorMike Blumenkrantz <michael.blumenkrantz@gmail.com>
Tue, 17 Jan 2023 19:43:51 +0000 (14:43 -0500)
committerMarge Bot <emma+marge@anholt.net>
Thu, 19 Jan 2023 16:01:14 +0000 (16:01 +0000)
internal_format is the "real" format of a resource, and the "real" format
of imported resources is the external-facing format, not the pipe format

this ensures the correct format is available for internal ops, such as nplanes queries

Fixes: 2e2775c11b0 ("zink: fix PIPE_RESOURCE_PARAM_NPLANES with format modifier")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20753>

src/gallium/drivers/zink/zink_resource.c

index 476e301..b68d711 100644 (file)
@@ -1553,6 +1553,7 @@ zink_resource_from_handle(struct pipe_screen *pscreen,
          res->valid = true;
       else
          tc_buffer_disable_cpu_storage(pres);
+      res->internal_format = whandle->format;
    }
    return pres;
 #else