mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-06-09 23:08:18 +02:00
anv: set a private binding when the image is not externally shared
This allows anv to use a suballocator for the clear color address, which should decrease our memory requirement. Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/13091 Signed-off-by: Rohan Garg <rohan.garg@intel.com> Reviewed-by: Nanley Chery <nanley.g.chery@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39562>
This commit is contained in:
parent
651a321ee2
commit
11f8f333e2
2 changed files with 14 additions and 27 deletions
|
|
@ -650,17 +650,12 @@ add_aux_state_tracking_buffer(struct anv_device *device,
|
|||
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
|
||||
* its current state. So put that auxiliary data into a separate
|
||||
* buffer (ANV_IMAGE_MEMORY_BINDING_PRIVATE).
|
||||
*
|
||||
* But when the image is created with a drm modifier that supports
|
||||
* clear color, it will be exported along with main surface.
|
||||
/* If the image is created with a drm modifier that supports clear color,
|
||||
* it will be exported along with main surface. Otherwise, place the
|
||||
* aux-tracking state in a separate, suballocated buffer to achieve better
|
||||
* memory utilization.
|
||||
*/
|
||||
if (anv_image_is_externally_shared(image) &&
|
||||
!mod_info->supports_clear_color)
|
||||
if (!mod_info || !mod_info->supports_clear_color)
|
||||
binding = ANV_IMAGE_MEMORY_BINDING_PRIVATE;
|
||||
|
||||
/* The indirect clear color BO requires 64B-alignment on gfx11+. If we're
|
||||
|
|
@ -1146,20 +1141,16 @@ check_memory_bindings(const struct anv_device *device,
|
|||
/* Check fast clear state */
|
||||
if (plane->fast_clear_memory_range.size > 0) {
|
||||
enum anv_image_memory_binding binding = primary_binding;
|
||||
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
|
||||
* its current state. So put that auxiliary data into a separate
|
||||
* buffer (ANV_IMAGE_MEMORY_BINDING_PRIVATE).
|
||||
*
|
||||
* But when the image is created with a drm modifier that supports
|
||||
* clear color, it will be exported along with main surface.
|
||||
/* If the image is created with a drm modifier that supports clear
|
||||
* color, it will be exported along with main surface. Otherwise,
|
||||
* place the aux-tracking state in a separate, suballocated buffer
|
||||
* to achieve better memory utilization.
|
||||
*/
|
||||
if (anv_image_is_externally_shared(image)
|
||||
&& !isl_drm_modifier_get_info(image->vk.drm_format_mod)->supports_clear_color) {
|
||||
if (!mod_info || !mod_info->supports_clear_color)
|
||||
binding = ANV_IMAGE_MEMORY_BINDING_PRIVATE;
|
||||
}
|
||||
|
||||
/* The indirect clear color BO requires 64B-alignment on gfx11+. */
|
||||
assert(plane->fast_clear_memory_range.alignment % 64 == 0);
|
||||
|
|
|
|||
|
|
@ -5835,12 +5835,8 @@ anv_image_is_externally_shared(const struct anv_image *image)
|
|||
static inline bool
|
||||
anv_image_has_private_binding(const struct anv_image *image)
|
||||
{
|
||||
if (image->bindings[ANV_IMAGE_MEMORY_BINDING_PRIVATE].memory_range.size > 0) {
|
||||
assert(anv_image_is_externally_shared(image));
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
enum anv_image_memory_binding binding = ANV_IMAGE_MEMORY_BINDING_PRIVATE;
|
||||
return image->bindings[binding].memory_range.size > 0;
|
||||
}
|
||||
|
||||
/* The ordering of this enum is important */
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue