Module: Mesa
Branch: main
Commit: 2c23bb49effab7cdbb029f1651cf80a3e6177925
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=2c23bb49effab7cdbb029f1651cf80a3e6177925

Author: Alyssa Rosenzweig <[email protected]>
Date:   Mon Feb 21 19:28:13 2022 -0500

asahi: Add size field to slices

Needed to size attachments for the kernel... for some reason. We already
compute this; just save it.

Signed-off-by: Alyssa Rosenzweig <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15482>

---

 src/gallium/drivers/asahi/agx_pipe.c  | 4 +++-
 src/gallium/drivers/asahi/agx_state.h | 1 +
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/gallium/drivers/asahi/agx_pipe.c 
b/src/gallium/drivers/asahi/agx_pipe.c
index 843725a98fc..3c2bec2412f 100644
--- a/src/gallium/drivers/asahi/agx_pipe.c
+++ b/src/gallium/drivers/asahi/agx_pipe.c
@@ -186,7 +186,9 @@ agx_resource_create(struct pipe_screen *screen,
       }
 
       nresource->slices[l].offset = offset;
-      offset += ALIGN_POT(nresource->slices[l].line_stride * height, 0x80);
+      nresource->slices[l].size = ALIGN_POT(nresource->slices[l].line_stride * 
height, 0x80);
+
+      offset += nresource->slices[l].size;
    }
 
    /* Arrays and cubemaps have the entire miptree duplicated and page aligned 
(16K) */
diff --git a/src/gallium/drivers/asahi/agx_state.h 
b/src/gallium/drivers/asahi/agx_state.h
index 145c67c784f..558c7966d90 100644
--- a/src/gallium/drivers/asahi/agx_state.h
+++ b/src/gallium/drivers/asahi/agx_state.h
@@ -251,6 +251,7 @@ struct agx_resource {
    struct {
       unsigned offset;
       unsigned line_stride;
+      unsigned size;
    } slices[PIPE_MAX_TEXTURE_LEVELS];
 
    /* Bytes from one miptree to the next */

Reply via email to