v3d: Always lay out shared tiled buffers with UIF_TOP set.
authorEric Anholt <eric@anholt.net>
Mon, 18 Mar 2019 21:25:06 +0000 (14:25 -0700)
committerEric Anholt <eric@anholt.net>
Tue, 19 Mar 2019 15:54:46 +0000 (08:54 -0700)
The samplers are already ready for this, we just needed to make sure that
layout chose UIF for level 0.

src/gallium/drivers/v3d/v3d_resource.c

index 71248e9ca1e730f3f8d967b7aa37563dae03ed00..61432a09d2f88d9555099495b413840b0c748308 100644 (file)
@@ -462,7 +462,8 @@ v3d_get_ub_pad(struct v3d_resource *rsc, uint32_t height)
 }
 
 static void
-v3d_setup_slices(struct v3d_resource *rsc, uint32_t winsys_stride)
+v3d_setup_slices(struct v3d_resource *rsc, uint32_t winsys_stride,
+                 bool uif_top)
 {
         struct pipe_resource *prsc = &rsc->base;
         uint32_t width = prsc->width0;
@@ -484,10 +485,11 @@ v3d_setup_slices(struct v3d_resource *rsc, uint32_t winsys_stride)
         uint32_t block_width = util_format_get_blockwidth(prsc->format);
         uint32_t block_height = util_format_get_blockheight(prsc->format);
         bool msaa = prsc->nr_samples > 1;
+
         /* MSAA textures/renderbuffers are always laid out as single-level
          * UIF.
          */
-        bool uif_top = msaa;
+        uif_top |= msaa;
 
         /* Check some easy mistakes to make in a resource_create() call that
          * will break our setup.
@@ -773,7 +775,7 @@ v3d_resource_create_with_modifiers(struct pipe_screen *pscreen,
 
         rsc->internal_format = prsc->format;
 
-        v3d_setup_slices(rsc, 0);
+        v3d_setup_slices(rsc, 0, tmpl->bind & PIPE_BIND_SHARED);
 
         if (!v3d_resource_bo_alloc(rsc))
            goto fail;
@@ -849,7 +851,7 @@ v3d_resource_from_handle(struct pipe_screen *pscreen,
 
         rsc->internal_format = prsc->format;
 
-        v3d_setup_slices(rsc, whandle->stride);
+        v3d_setup_slices(rsc, whandle->stride, true);
         v3d_debug_resource_layout(rsc, "import");
 
         if (screen->ro) {