summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBas Nieuwenhuizen <bas@basnieuwenhuizen.nl>2021-01-11 00:40:53 +0100
committerMarge Bot <eric+marge@anholt.net>2021-01-12 23:47:09 +0000
commit9a937330efbc21de64a85a4e80d1e3e92ef2a750 (patch)
tree0c1614f7f69e68f3983a794072ad9568f4b63d65
parentd9c8422c4168c7433f68b97065283ebf26631d56 (diff)
radeonsi: Only set modifier creation function for GFX9+ & with kernel support.
Fixes: c786150dfa5 ("radeonsi: Add modifier support.") Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/3963 Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8407>
-rw-r--r--src/amd/common/ac_gpu_info.c3
-rw-r--r--src/amd/common/ac_gpu_info.h1
-rw-r--r--src/gallium/drivers/radeonsi/si_texture.c15
3 files changed, 14 insertions, 5 deletions
diff --git a/src/amd/common/ac_gpu_info.c b/src/amd/common/ac_gpu_info.c
index 22eebe4370b..d5c7891de62 100644
--- a/src/amd/common/ac_gpu_info.c
+++ b/src/amd/common/ac_gpu_info.c
@@ -672,7 +672,8 @@ bool ac_query_gpu_info(int fd, void *dev_p, struct radeon_info *info,
info->has_read_registers_query = true;
info->has_scheduled_fence_dependency = info->drm_minor >= 28;
info->mid_command_buffer_preemption_enabled = amdinfo->ids_flags & AMDGPU_IDS_FLAGS_PREEMPTION;
- info->has_tmz_support = has_tmz_support(dev, info, amdinfo);
+ info->has_tmz_support = has_tmz_support(dev, info, amdinfo);
+ info->kernel_has_modifiers = info->chip_class >= GFX9 && info->drm_minor >= 40;
info->pa_sc_tile_steering_override = device_info.pa_sc_tile_steering_override;
info->max_render_backends = amdinfo->rb_pipes;
diff --git a/src/amd/common/ac_gpu_info.h b/src/amd/common/ac_gpu_info.h
index ed11d739058..873ce69e98a 100644
--- a/src/amd/common/ac_gpu_info.h
+++ b/src/amd/common/ac_gpu_info.h
@@ -161,6 +161,7 @@ struct radeon_info {
/* Whether SR-IOV is enabled or amdgpu.mcbp=1 was set on the kernel command line. */
bool mid_command_buffer_preemption_enabled;
bool has_tmz_support;
+ bool kernel_has_modifiers;
/* Shader cores. */
uint32_t cu_mask[4][2];
diff --git a/src/gallium/drivers/radeonsi/si_texture.c b/src/gallium/drivers/radeonsi/si_texture.c
index 05d93a21aee..1fa2e5234ef 100644
--- a/src/gallium/drivers/radeonsi/si_texture.c
+++ b/src/gallium/drivers/radeonsi/si_texture.c
@@ -2476,13 +2476,20 @@ void si_init_screen_texture_functions(struct si_screen *sscreen)
sscreen->b.resource_get_param = si_resource_get_param;
sscreen->b.resource_get_info = si_texture_get_info;
sscreen->b.resource_from_memobj = si_resource_from_memobj;
- sscreen->b.resource_create_with_modifiers = si_texture_create_with_modifiers;
sscreen->b.memobj_create_from_handle = si_memobj_from_handle;
sscreen->b.memobj_destroy = si_memobj_destroy;
sscreen->b.check_resource_capability = si_check_resource_capability;
- sscreen->b.query_dmabuf_modifiers = si_query_dmabuf_modifiers;
- sscreen->b.is_dmabuf_modifier_supported = si_is_dmabuf_modifier_supported;
- sscreen->b.get_dmabuf_modifier_planes = si_get_dmabuf_modifier_planes;
+
+ /* By not setting it the frontend will fall back to non-modifier create,
+ * which works around some applications using modifiers that are not
+ * allowed in combination with lack of error reporting in
+ * gbm_dri_surface_create */
+ if (sscreen->info.chip_class >= GFX9 && sscreen->info.kernel_has_modifiers) {
+ sscreen->b.resource_create_with_modifiers = si_texture_create_with_modifiers;
+ sscreen->b.query_dmabuf_modifiers = si_query_dmabuf_modifiers;
+ sscreen->b.is_dmabuf_modifier_supported = si_is_dmabuf_modifier_supported;
+ sscreen->b.get_dmabuf_modifier_planes = si_get_dmabuf_modifier_planes;
+ }
}
void si_init_context_texture_functions(struct si_context *sctx)