diff options
author | Nanley Chery <[email protected]> | 2019-10-25 15:07:42 -0700 |
---|---|---|
committer | Sagar Ghuge <[email protected]> | 2019-10-29 14:46:15 -0700 |
commit | ff5bc81b51abc0cd64eaf36ccf2121235250bd56 (patch) | |
tree | 9130a08576a959156e2759d647ccf65c09155edb /src/gallium/drivers/iris/iris_resource.c | |
parent | f0ed86c6c621e227ecd7e680deac2e04cb9be9a0 (diff) |
iris: Determine aux offsets within configure_aux
If a resource has a modifier, the main and aux surfaces will share a BO.
Reviewed-by: Jordan Justen <[email protected]>
Diffstat (limited to 'src/gallium/drivers/iris/iris_resource.c')
-rw-r--r-- | src/gallium/drivers/iris/iris_resource.c | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/src/gallium/drivers/iris/iris_resource.c b/src/gallium/drivers/iris/iris_resource.c index 294044f82f1..0846642f429 100644 --- a/src/gallium/drivers/iris/iris_resource.c +++ b/src/gallium/drivers/iris/iris_resource.c @@ -560,13 +560,18 @@ iris_resource_configure_aux(struct iris_screen *screen, return false; } + /* Increase the aux offset if the main and aux surfaces will share a BO. */ + assert(!res->mod_info || res->mod_info->aux.usage == res->aux.usage); + res->aux.offset = res->mod_info ? + ALIGN(res->surf.size_B, res->aux.surf.alignment_B) : 0; uint64_t size = res->aux.surf.size_B; /* Allocate space in the buffer for storing the CCS. */ if (res->aux.extra_aux.surf.size_B > 0) { - res->aux.extra_aux.offset = + const uint64_t padded_aux_size = ALIGN(size, res->aux.extra_aux.surf.alignment_B); - size = res->aux.extra_aux.offset + res->aux.extra_aux.surf.size_B; + res->aux.extra_aux.offset = res->aux.offset + padded_aux_size; + size = padded_aux_size + res->aux.extra_aux.surf.size_B; } /* Allocate space in the buffer for storing the clear color. On modern @@ -575,7 +580,7 @@ iris_resource_configure_aux(struct iris_screen *screen, * On gen <= 9, we are going to store the clear color on the buffer * anyways, and copy it back to the surface state during state emission. */ - res->aux.clear_color_offset = size; + res->aux.clear_color_offset = res->aux.offset + size; size += iris_get_aux_clear_color_state_size(screen); *aux_size_B = size; @@ -858,17 +863,14 @@ iris_resource_create_with_modifiers(struct pipe_screen *pscreen, const bool aux_enabled = res->aux.surf.size_B > 0; const bool separate_aux = aux_enabled && !res->mod_info; - uint64_t aux_offset; uint64_t bo_size; if (aux_enabled && !separate_aux) { /* Allocate aux data with main surface. This is required for modifiers * with aux data (ccs). */ - aux_offset = ALIGN(res->surf.size_B, res->aux.surf.alignment_B); - bo_size = aux_offset + aux_size; + bo_size = res->aux.offset + aux_size; } else { - aux_offset = 0; bo_size = res->surf.size_B; } @@ -888,11 +890,8 @@ iris_resource_create_with_modifiers(struct pipe_screen *pscreen, } else { res->aux.bo = res->bo; iris_bo_reference(res->aux.bo); - res->aux.offset += aux_offset; unsigned clear_color_state_size = iris_get_aux_clear_color_state_size(screen); - if (clear_color_state_size > 0) - res->aux.clear_color_offset += aux_offset; if (!iris_resource_init_aux_buf(res, flags, clear_color_state_size)) goto fail; map_aux_addresses(screen, res); |