asahi: Don't allow linear depth/stencil buffers
authorAlyssa Rosenzweig <alyssa@rosenzweig.io>
Sat, 4 Mar 2023 18:16:54 +0000 (13:16 -0500)
committerMarge Bot <emma+marge@anholt.net>
Fri, 10 Mar 2023 18:29:52 +0000 (18:29 +0000)
We don't have a way to tell the ZLS hardware to use linear buffers, so if a
buffer could be used for depth/stencil, we have to twiddle. This isn't a problem
in practice, since depth/stencil buffers can't be shared across processes or
mapped directly as linear.

Fixes faults in depthstencil-render-miplevels, which was picking linear for one
buffer because of a STAGING bind flag. But that won't work :-)

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21753>

src/gallium/drivers/asahi/agx_pipe.c

index 077c8d4..20d3360 100644 (file)
@@ -289,6 +289,10 @@ agx_linear_allowed(const struct agx_resource *pres)
    if (pres->base.last_level != 0)
       return false;
 
+   /* Depth/stencil buffers must not be linear */
+   if (pres->base.bind & PIPE_BIND_DEPTH_STENCIL)
+      return false;
+
    switch (pres->base.target) {
    /* 1D is always linear */
    case PIPE_BUFFER: