panfrost: Move AFBC header_size to a sub-struct
authorBoris Brezillon <boris.brezillon@collabora.com>
Mon, 14 Dec 2020 18:52:48 +0000 (19:52 +0100)
committerBoris Brezillon <boris.brezillon@collabora.com>
Mon, 4 Jan 2021 16:05:42 +0000 (17:05 +0100)
So we can add more AFBC related fields under this struct.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8125>

src/gallium/drivers/panfrost/pan_mfbd.c
src/gallium/drivers/panfrost/pan_resource.c
src/panfrost/lib/pan_texture.h

index 83bd537..299f993 100644 (file)
@@ -175,7 +175,7 @@ panfrost_mfbd_rt_set_buf(struct pipe_surface *surf,
                 else
                         rt->midgard.writeback_block_format = MALI_BLOCK_FORMAT_AFBC;
 
-                unsigned header_size = rsrc->layout.slices[level].header_size;
+                unsigned header_size = rsrc->layout.slices[level].afbc.header_size;
 
                 rt->afbc.header = base;
                 rt->afbc.chunk_size = 9;
@@ -292,7 +292,7 @@ panfrost_mfbd_zs_crc_ext_set_bufs(struct panfrost_batch *batch,
                 ext->zs_msaa_v7 = nr_samples > 1 ? MALI_MSAA_LAYERED : MALI_MSAA_SINGLE;
 
         if (drm_is_afbc(rsrc->layout.modifier)) {
-                unsigned header_size = rsrc->layout.slices[level].header_size;
+                unsigned header_size = rsrc->layout.slices[level].afbc.header_size;
                 ext->zs_afbc_header = base;
                 ext->zs_afbc_body = base + header_size;
                 ext->zs_afbc_body_size = 0x1000;
index be48365..e1a8c01 100644 (file)
@@ -128,7 +128,7 @@ panfrost_resource_from_handle(struct pipe_screen *pscreen,
         }
 
         if (drm_is_afbc(whandle->modifier)) {
-                rsc->layout.slices[0].header_size =
+                rsc->layout.slices[0].afbc.header_size =
                         panfrost_afbc_header_size(templat->width0, templat->height0);
         }
 
@@ -403,10 +403,10 @@ panfrost_setup_layout(struct panfrost_device *dev,
 
                 /* Compute AFBC sizes if necessary */
                 if (afbc) {
-                        slice->header_size =
+                        slice->afbc.header_size =
                                 panfrost_afbc_header_size(width, height);
 
-                        offset += slice->header_size;
+                        offset += slice->afbc.header_size;
                 }
 
                 offset += slice_full_size;
index 7def961..a8d4a00 100644 (file)
@@ -44,9 +44,10 @@ struct panfrost_slice {
         unsigned row_stride;
         unsigned surface_stride;
 
-        /* If there is a header preceding each slice, how big is
-         * that header? Used for AFBC */
-        unsigned header_size;
+        struct {
+                /* Size of the AFBC header preceding each slice */
+                unsigned header_size;
+        } afbc;
 
         /* If checksumming is enabled following the slice, what
          * is its offset/stride? */