Mesa (main): iris: Use the aux BO and surf less during init

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Sat Dec 11 04:39:16 UTC 2021


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

Author: Nanley Chery <nanley.g.chery at intel.com>
Date:   Tue Oct 19 08:12:30 2021 -0700

iris: Use the aux BO and surf less during init

res->aux.bo and res->aux.surf will be NULL and zeroed, respectively, for
CCS on XeHP. Move and modify iris_resource_init_aux_buf to support this.

Reviewed-by: Jordan Justen <jordan.l.justen at intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13555>

---

 src/gallium/drivers/iris/iris_resource.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/src/gallium/drivers/iris/iris_resource.c b/src/gallium/drivers/iris/iris_resource.c
index d8c48465419..3e51ecde0d2 100644
--- a/src/gallium/drivers/iris/iris_resource.c
+++ b/src/gallium/drivers/iris/iris_resource.c
@@ -856,7 +856,7 @@ static bool
 iris_resource_init_aux_buf(struct iris_screen *screen,
                            struct iris_resource *res)
 {
-   void *map = iris_bo_map(NULL, res->aux.bo, MAP_WRITE | MAP_RAW);
+   void *map = iris_bo_map(NULL, res->bo, MAP_WRITE | MAP_RAW);
 
    if (!map)
       return false;
@@ -875,10 +875,10 @@ iris_resource_init_aux_buf(struct iris_screen *screen,
    memset((char *)map + res->aux.clear_color_offset, 0,
           iris_get_aux_clear_color_state_size(screen));
 
-   iris_bo_unmap(res->aux.bo);
+   iris_bo_unmap(res->bo);
 
    if (iris_get_aux_clear_color_state_size(screen) > 0) {
-      res->aux.clear_color_bo = res->aux.bo;
+      res->aux.clear_color_bo = res->bo;
       iris_bo_reference(res->aux.clear_color_bo);
    }
 
@@ -1109,11 +1109,13 @@ iris_resource_create_with_modifiers(struct pipe_screen *pscreen,
    if (!res->bo)
       goto fail;
 
+   if (res->aux.usage != ISL_AUX_USAGE_NONE &&
+       !iris_resource_init_aux_buf(screen, res))
+      goto fail;
+
    if (res->aux.surf.size_B > 0) {
       res->aux.bo = res->bo;
       iris_bo_reference(res->aux.bo);
-      if (!iris_resource_init_aux_buf(screen, res))
-         goto fail;
       map_aux_addresses(screen, res, res->surf.format, 0);
    }
 



More information about the mesa-commit mailing list