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) &&
* 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;
}