asahi: Print reasons why compression is disabled
authorAsahi Lina <lina@asahilina.net>
Wed, 5 Apr 2023 07:17:50 +0000 (16:17 +0900)
committerMarge Bot <emma+marge@anholt.net>
Fri, 7 Apr 2023 03:23:04 +0000 (03:23 +0000)
For resource debug. Found a regression in compressed depth this way.

Signed-off-by: Asahi Lina <lina@asahilina.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22353>

src/gallium/drivers/asahi/agx_pipe.c

index 9674e74..7cc4164 100644 (file)
@@ -388,21 +388,27 @@ static bool
 agx_compression_allowed(const struct agx_resource *pres)
 {
    /* Allow disabling compression for debugging */
-   if (agx_device(pres->base.screen)->debug & AGX_DBG_NOCOMPRESS)
+   if (agx_device(pres->base.screen)->debug & AGX_DBG_NOCOMPRESS) {
+      rsrc_debug(pres, "No compression: disabled\n");
       return false;
+   }
 
    /* Limited to renderable */
    if (pres->base.bind &
        ~(PIPE_BIND_SAMPLER_VIEW | PIPE_BIND_RENDER_TARGET |
-         PIPE_BIND_DEPTH_STENCIL | PIPE_BIND_SHARED | PIPE_BIND_SCANOUT))
+         PIPE_BIND_DEPTH_STENCIL | PIPE_BIND_SHARED | PIPE_BIND_SCANOUT)) {
+      rsrc_debug(pres, "No compression: not renderable\n");
       return false;
+   }
 
    /* We use the PBE for compression via staging blits, so we can only compress
     * renderable formats. As framebuffer compression, other formats don't make a
     * ton of sense to compress anyway.
     */
-   if (!agx_pixel_format[pres->base.format].renderable)
+   if (!agx_pixel_format[pres->base.format].renderable) {
+      rsrc_debug(pres, "No compression: format not renderable\n");
       return false;
+   }
 
    /* Lossy-compressed texture formats cannot be compressed */
    assert(!util_format_is_compressed(pres->base.format) &&
@@ -413,12 +419,16 @@ agx_compression_allowed(const struct agx_resource *pres)
     * could be worked around with more sophisticated blit code.
     */
    if (pres->base.target != PIPE_TEXTURE_2D &&
-       pres->base.target != PIPE_TEXTURE_RECT)
+       pres->base.target != PIPE_TEXTURE_RECT) {
+      rsrc_debug(pres, "No compression: array/cube\n");
       return false;
+   }
 
    /* Small textures cannot (should not?) be compressed */
-   if (pres->base.width0 < 16 || pres->base.height0 < 16)
+   if (pres->base.width0 < 16 || pres->base.height0 < 16) {
+      rsrc_debug(pres, "No compression: too small\n");
       return false;
+   }
 
    return true;
 }