panfrost: Tweak Bifrost colour buffer magic
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Tue, 26 May 2020 22:20:56 +0000 (18:20 -0400)
committerAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Wed, 27 May 2020 20:49:43 +0000 (16:49 -0400)
For tiled or linear.

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

src/gallium/drivers/panfrost/pan_mfbd.c

index 2212f6a301fcf60f8115028c2304dc6343f4f336..f477ad6dd35bf9c528587951b839c6a926f72061 100644 (file)
@@ -31,9 +31,6 @@
 static struct mali_rt_format
 panfrost_mfbd_format(struct pipe_surface *surf)
 {
-        struct panfrost_device *dev = pan_device(surf->context->screen);
-        bool is_bifrost = dev->quirks & IS_BIFROST;
-
         /* Explode details on the format */
 
         const struct util_format_description *desc =
@@ -51,7 +48,6 @@ panfrost_mfbd_format(struct pipe_surface *surf)
                 .unk2 = 0x1,
                 .nr_channels = MALI_POSITIVE(desc->nr_channels),
                 .unk3 = 0x4,
-                .unk4 = is_bifrost,
                 .flags = 0x8,
                 .swizzle = panfrost_translate_swizzle_4(swizzle),
                 .no_preload = true
@@ -205,6 +201,8 @@ panfrost_mfbd_set_cbuf(
         struct pipe_surface *surf)
 {
         struct panfrost_resource *rsrc = pan_resource(surf->texture);
+        struct panfrost_device *dev = pan_device(surf->context->screen);
+        bool is_bifrost = dev->quirks & IS_BIFROST;
 
         unsigned level = surf->u.tex.level;
         unsigned first_layer = surf->u.tex.first_layer;
@@ -218,11 +216,21 @@ panfrost_mfbd_set_cbuf(
         /* Now, we set the layout specific pieces */
 
         if (rsrc->layout == MALI_TEXTURE_LINEAR) {
-                rt->format.block = MALI_BLOCK_LINEAR;
+                if (is_bifrost) {
+                        rt->format.unk4 = 0x1;
+                } else {
+                        rt->format.block = MALI_BLOCK_LINEAR;
+                }
+
                 rt->framebuffer = base;
                 rt->framebuffer_stride = stride / 16;
         } else if (rsrc->layout == MALI_TEXTURE_TILED) {
-                rt->format.block = MALI_BLOCK_TILED;
+                if (is_bifrost) {
+                        rt->format.unk3 |= 0x8;
+                } else {
+                        rt->format.block = MALI_BLOCK_TILED;
+                }
+
                 rt->framebuffer = base;
                 rt->framebuffer_stride = stride;
         } else if (rsrc->layout == MALI_TEXTURE_AFBC) {