anv/iris: leave 4k alignments for clear colors with modifiers
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Fixes:17f97a69c1
("iris: Reduce clear color state alignment to 64B") Fixes:063715ed45
("anv: Reduce clear color state alignment to 64B") Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/12195 Closes: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/13057 Reviewed-by: Sagar Ghuge <sagar.ghuge@intel.com> Reviewed-by: Nanley Chery <nanley.g.chery@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32422> (cherry picked from commit888f63cf1b
)
This commit is contained in:

committed by
Dylan Baker

parent
30a6487353
commit
8b1bd4ed76
@@ -244,7 +244,7 @@
|
||||
"description": "anv/iris: leave 4k alignments for clear colors with modifiers",
|
||||
"nominated": true,
|
||||
"nomination_type": 2,
|
||||
"resolution": 0,
|
||||
"resolution": 1,
|
||||
"main_sha": null,
|
||||
"because_sha": "17f97a69c13832a6c1b0b3aad45b06f07d4b852f",
|
||||
"notes": null
|
||||
|
@@ -1157,7 +1157,12 @@ iris_resource_create_for_image(struct pipe_screen *pscreen,
|
||||
|
||||
/* Allocate space for the indirect clear color. */
|
||||
if (iris_get_aux_clear_color_state_size(screen, res) > 0) {
|
||||
res->aux.clear_color_offset = align64(bo_size, 64);
|
||||
/* Kernel expects a 4k alignment, otherwise the display rejects the
|
||||
* surface.
|
||||
*/
|
||||
const uint64_t clear_color_alignment =
|
||||
(res->mod_info && res->mod_info->supports_clear_color) ? 4096 : 64;
|
||||
res->aux.clear_color_offset = align64(bo_size, clear_color_alignment);
|
||||
bo_size = res->aux.clear_color_offset +
|
||||
iris_get_aux_clear_color_state_size(screen, res);
|
||||
}
|
||||
|
@@ -669,6 +669,9 @@ add_aux_state_tracking_buffer(struct anv_device *device,
|
||||
enum anv_image_memory_binding binding =
|
||||
ANV_IMAGE_MEMORY_BINDING_PLANE_0 + plane;
|
||||
|
||||
const struct isl_drm_modifier_info *mod_info =
|
||||
isl_drm_modifier_get_info(image->vk.drm_format_mod);
|
||||
|
||||
/* If an auxiliary surface is used for an externally-shareable image,
|
||||
* we have to hide this from the memory of the image since other
|
||||
* processes with access to the memory may not be aware of it or of
|
||||
@@ -678,14 +681,19 @@ add_aux_state_tracking_buffer(struct anv_device *device,
|
||||
* But when the image is created with a drm modifier that supports
|
||||
* clear color, it will be exported along with main surface.
|
||||
*/
|
||||
if (anv_image_is_externally_shared(image)
|
||||
&& !isl_drm_modifier_get_info(image->vk.drm_format_mod)->supports_clear_color) {
|
||||
if (anv_image_is_externally_shared(image) &&
|
||||
!mod_info->supports_clear_color)
|
||||
binding = ANV_IMAGE_MEMORY_BINDING_PRIVATE;
|
||||
}
|
||||
|
||||
/* The indirect clear color BO requires 64B-alignment on gfx11+. */
|
||||
/* The indirect clear color BO requires 64B-alignment on gfx11+. If we're
|
||||
* using a modifier with clear color, then some kernels might require a 4k
|
||||
* alignment.
|
||||
*/
|
||||
const uint32_t clear_color_alignment =
|
||||
(mod_info && mod_info->supports_clear_color) ? 4096 : 64;
|
||||
|
||||
return image_binding_grow(device, image, binding,
|
||||
state_offset, state_size, 64,
|
||||
state_offset, state_size, clear_color_alignment,
|
||||
&image->planes[plane].fast_clear_memory_range);
|
||||
}
|
||||
|
||||
@@ -1144,7 +1152,7 @@ check_memory_bindings(const struct anv_device *device,
|
||||
}
|
||||
|
||||
/* The indirect clear color BO requires 64B-alignment on gfx11+. */
|
||||
assert(plane->fast_clear_memory_range.alignment == 64);
|
||||
assert(plane->fast_clear_memory_range.alignment % 64 == 0);
|
||||
check_memory_range(accum_ranges,
|
||||
.test_range = &plane->fast_clear_memory_range,
|
||||
.expect_binding = binding);
|
||||
|
Reference in New Issue
Block a user