freedreno/a6xx: don't tile things that are too small
authorRob Clark <robdclark@chromium.org>
Mon, 9 Sep 2019 23:19:40 +0000 (16:19 -0700)
committerRob Clark <robdclark@gmail.com>
Tue, 10 Sep 2019 22:08:33 +0000 (22:08 +0000)
If the lowest (largest) mipmap level is too small to tile, then don't
bother pretending.

Note that this requires initializing pipe->screen before
fd_resource_level_linear() is called.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
src/gallium/drivers/freedreno/a6xx/fd6_blitter.c
src/gallium/drivers/freedreno/freedreno_resource.c

index 68cc4e7ab69aeb8537787c2a67c151a786c4e32e..9e145e55e5b4db5befa8aefe665457e2707cad8f 100644 (file)
@@ -718,6 +718,12 @@ fd6_blitter_init(struct pipe_context *pctx)
 unsigned
 fd6_tile_mode(const struct pipe_resource *tmpl)
 {
+       /* if the mipmap level 0 is still too small to be tiled, then don't
+        * bother pretending:
+        */
+       if (fd_resource_level_linear(tmpl, 0))
+               return TILE6_LINEAR;
+
        /* basically just has to be a format we can blit, so uploads/downloads
         * via linear staging buffer works:
         */
index 4d188c24d64e7b1b166547d2a077d853bfd111a4..fcc8fc66189e0583b4d20f642023d6bf62f800b6 100644 (file)
@@ -977,16 +977,16 @@ fd_resource_create_with_modifiers(struct pipe_screen *pscreen,
 
        allow_ubwc &= !(fd_mesa_debug & FD_DBG_NOUBWC);
 
+       pipe_reference_init(&prsc->reference, 1);
+
+       prsc->screen = pscreen;
+
        if (screen->tile_mode &&
                        (tmpl->target != PIPE_BUFFER) &&
                        !linear) {
-               rsc->tile_mode = screen->tile_mode(tmpl);
+               rsc->tile_mode = screen->tile_mode(prsc);
        }
 
-       pipe_reference_init(&prsc->reference, 1);
-
-       prsc->screen = pscreen;
-
        util_range_init(&rsc->valid_buffer_range);
 
        rsc->internal_format = format;