panfrost: Implement tiled rendering
[mesa.git] / src / gallium / drivers / panfrost / pan_mfbd.c
index 17f59e0aab247cf8974968892d1d2e39583a7c1f..f9a69e47e45a74ccbfb2c3940915c599e58aea75 100644 (file)
@@ -42,7 +42,8 @@ panfrost_mfbd_format(struct pipe_surface *surf)
                 .unk1 = 0x4000000,
                 .unk2 = 0x1,
                 .nr_channels = MALI_POSITIVE(desc->nr_channels),
-                .flags = 0x444,
+                .unk3 = 0x4,
+                .flags = 0x8,
                 .swizzle = panfrost_translate_swizzle_4(desc->swizzle),
                 .unk4 = 0x8
         };
@@ -52,7 +53,7 @@ panfrost_mfbd_format(struct pipe_surface *surf)
         if (surf->texture->format == PIPE_FORMAT_B5G6R5_UNORM) {
                 fmt.unk1 = 0x14000000;
                 fmt.nr_channels = MALI_POSITIVE(2);
-                fmt.flags |= 0x1;
+                fmt.unk3 |= 0x1;
         }
 
         return fmt;
@@ -100,15 +101,20 @@ panfrost_mfbd_set_cbuf(
         /* Now, we set the layout specific pieces */
 
         if (rsrc->bo->layout == PAN_LINEAR) {
+                rt->format.block = MALI_MFBD_BLOCK_LINEAR;
                 rt->framebuffer = rsrc->bo->gpu + offset;
                 rt->framebuffer_stride = stride / 16;
+        } else if (rsrc->bo->layout == PAN_TILED) {
+                rt->format.block = MALI_MFBD_BLOCK_TILED;
+                rt->framebuffer = rsrc->bo->gpu + offset;
+                rt->framebuffer_stride = stride;
         } else if (rsrc->bo->layout == PAN_AFBC) {
                 assert(level == 0);
                 rt->afbc.metadata = rsrc->bo->afbc_slab.gpu;
                 rt->afbc.stride = 0;
                 rt->afbc.unk = 0x30009;
 
-                rt->format.flags |= MALI_MFBD_FORMAT_AFBC;
+                rt->format.block = MALI_MFBD_BLOCK_AFBC;
 
                 mali_ptr afbc_main = rsrc->bo->afbc_slab.gpu + rsrc->bo->afbc_metadata_size;
                 rt->framebuffer = afbc_main;