panfrost: Allocate extra data for depth buffer
authorAlyssa Rosenzweig <alyssa@rosenzweig.io>
Wed, 13 Mar 2019 00:53:34 +0000 (00:53 +0000)
committerAlyssa Rosenzweig <alyssa@rosenzweig.io>
Thu, 14 Mar 2019 22:47:12 +0000 (22:47 +0000)
It's not clear why the hardware "spills" a little bit, but if we don't
do this, we get MMU faults with linear depth buffers.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
src/gallium/drivers/panfrost/pan_resource.c

index 2fa468b177b94fd9439bfca2f4522c548791313d..89be07871a515ee394f30ea2c3cde93cd1f66a9e 100644 (file)
@@ -197,6 +197,11 @@ panfrost_create_bo(struct panfrost_screen *screen, const struct pipe_resource *t
         if (template->height0) sz *= template->height0;
         if (template->depth0) sz *= template->depth0;
 
+        /* Depth buffers require extra space for unknown reasons */
+
+        if (template->bind & PIPE_BIND_DEPTH_STENCIL)
+                sz = sz + sz/256;
+
         /* Based on the usage, figure out what storing will be used. There are
          * various tradeoffs:
          *