From baff748cb071085c4b9972c8e9ba94e73d69cd6c Mon Sep 17 00:00:00 2001 From: Joshua Ashton Date: Sun, 26 Sep 2021 20:14:34 +0100 Subject: [PATCH] radeonsi: Check if modifier supports the image extent MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit DCN only supports an extent < 4K on !64B && 128B. Signed-off-by: Joshua Ashton Reviewed-by: Bas Nieuwenhuizen Reviewed-by: Marek Olšák Part-of: --- src/gallium/drivers/radeonsi/si_texture.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/gallium/drivers/radeonsi/si_texture.c b/src/gallium/drivers/radeonsi/si_texture.c index 5205c719028..f17fe14309a 100644 --- a/src/gallium/drivers/radeonsi/si_texture.c +++ b/src/gallium/drivers/radeonsi/si_texture.c @@ -1384,6 +1384,18 @@ si_get_dmabuf_modifier_planes(struct pipe_screen *pscreen, uint64_t modifier, return planes; } +static bool +si_modifier_supports_resource(struct pipe_screen *screen, + uint64_t modifier, + const struct pipe_resource *templ) +{ + struct si_screen *sscreen = (struct si_screen *)screen; + uint32_t max_width, max_height; + + ac_modifier_max_extent(&sscreen->info, modifier, &max_width, &max_height); + return templ->width0 <= max_width && templ->height0 <= max_height; +} + static struct pipe_resource * si_texture_create_with_modifiers(struct pipe_screen *screen, const struct pipe_resource *templ, @@ -1413,7 +1425,7 @@ si_texture_create_with_modifiers(struct pipe_screen *screen, for (int i = 0; i < allowed_mod_count; ++i) { bool found = false; for (int j = 0; j < modifier_count && !found; ++j) - if (modifiers[j] == allowed_modifiers[i]) + if (modifiers[j] == allowed_modifiers[i] && si_modifier_supports_resource(screen, modifiers[j], templ)) found = true; if (found) {