etnaviv: avoid using RS for 64bpp formats
authorJonathan Marek <jonathan@marek.ca>
Mon, 12 Aug 2019 15:34:57 +0000 (11:34 -0400)
committerChristian Gmeiner <christian.gmeiner@gmail.com>
Mon, 25 Nov 2019 19:22:43 +0000 (20:22 +0100)
At the same time, this change allows using BLT for 8bpp formats

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
src/gallium/drivers/etnaviv/etnaviv_resource.c
src/gallium/drivers/etnaviv/etnaviv_resource.h
src/gallium/drivers/etnaviv/etnaviv_transfer.c

index be5d87168f1cebc0f7ead992b1d06db2f8090d6b..f4200be437d9cdd5094b8cdff5a76f8820eee652 100644 (file)
@@ -351,17 +351,13 @@ etna_resource_create(struct pipe_screen *pscreen,
     * and a texture-compatible base buffer in other cases
     *
     */
-
    if (templat->bind & (PIPE_BIND_SCANOUT | PIPE_BIND_DEPTH_STENCIL)) {
       if (screen->specs.pixel_pipes > 1 && !screen->specs.single_buffer)
          layout |= ETNA_LAYOUT_BIT_MULTI;
       if (screen->specs.can_supertile)
          layout |= ETNA_LAYOUT_BIT_SUPER;
    } else if (VIV_FEATURE(screen, chipMinorFeatures2, SUPERTILED_TEXTURE) &&
-              /* RS can't tile 1 byte per pixel formats, will have to CPU tile,
-               * which doesn't support super-tiling
-               */
-              util_format_get_blocksize(templat->format) > 1) {
+              etna_resource_hw_tileable(screen->specs.use_blt, templat)) {
       layout |= ETNA_LAYOUT_BIT_SUPER;
    }
 
index 226e444b02ab7fac2dd8824e1237b6a1f316e557..51e54074139b14d1415bc8f09e6de9279f6547d9 100644 (file)
@@ -30,6 +30,7 @@
 #include "etnaviv_internal.h"
 #include "etnaviv_tiling.h"
 #include "pipe/p_state.h"
+#include "util/format/u_format.h"
 #include "util/list.h"
 #include "util/set.h"
 #include "util/u_helpers.h"
@@ -132,6 +133,17 @@ etna_resource_sampler_only(const struct pipe_resource *pres)
           PIPE_BIND_SAMPLER_VIEW;
 }
 
+static inline bool
+etna_resource_hw_tileable(bool use_blt, const struct pipe_resource *pres)
+{
+   if (use_blt)
+      return true;
+
+   /* RS can only tile 16bpp or 32bpp formats */
+   return util_format_get_blocksize(pres->format) == 2 ||
+          util_format_get_blocksize(pres->format) == 4;
+}
+
 static inline struct etna_resource *
 etna_resource(struct pipe_resource *p)
 {
index b0135c068ff58fdce588cfac34a06c234922f6be..0115c5eeb7b9560cedfa4a3a372d0428cb43d80e 100644 (file)
@@ -247,7 +247,7 @@ etna_transfer_map(struct pipe_context *pctx, struct pipe_resource *prsc,
       rsc = etna_resource(rsc->texture);
    } else if (rsc->ts_bo ||
               (rsc->layout != ETNA_LAYOUT_LINEAR &&
-               util_format_get_blocksize(format) > 1 &&
+               etna_resource_hw_tileable(ctx->specs.use_blt, prsc) &&
                /* HALIGN 4 resources are incompatible with the resolve engine,
                 * so fall back to using software to detile this resource. */
                rsc->halign != TEXTURE_HALIGN_FOUR)) {