radeonsi: Only set modifier creation function for GFX9+ & with kernel support.

Fixes: c786150dfa ("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>
This commit is contained in:
Bas Nieuwenhuizen 2021-01-11 00:40:53 +01:00 committed by Marge Bot
parent d9c8422c41
commit 9a937330ef
3 changed files with 14 additions and 5 deletions

View File

@ -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;

View File

@ -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];

View File

@ -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)