amd/common: Use cap to test kernel modifier support.
Turns out both kernel v5.10 and v5.11 have the same amdgpu driver
version and only one has modifiers ... In addition the version check
is kinda annoying for backports.
So lets use the cap. Since the cap is technically about ADDFB2 I
tested that this works on rendernodes (and reading the code there
is no distinction from what kind of node this is called).
Fixes: 9a937330ef ("radeonsi: Only set modifier creation function for GFX9+ & with kernel support.")
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10337>
This commit is contained in:
committed by
Marge Bot
parent
8d9b52f45a
commit
9da4590df8
@@ -34,6 +34,7 @@
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef _WIN32
|
||||
#define DRM_CAP_ADDFB2_MODIFIERS 0x10
|
||||
#define DRM_CAP_SYNCOBJ 0x13
|
||||
#define DRM_CAP_SYNCOBJ_TIMELINE 0x14
|
||||
#define AMDGPU_GEM_DOMAIN_GTT 0x2
|
||||
@@ -278,6 +279,14 @@ static bool has_timeline_syncobj(int fd)
|
||||
return value ? true : false;
|
||||
}
|
||||
|
||||
static bool has_modifiers(int fd)
|
||||
{
|
||||
uint64_t value;
|
||||
if (drmGetCap(fd, DRM_CAP_ADDFB2_MODIFIERS, &value))
|
||||
return false;
|
||||
return value ? true : false;
|
||||
}
|
||||
|
||||
static uint64_t fix_vram_size(uint64_t size)
|
||||
{
|
||||
/* The VRAM size is underreported, so we need to fix it, because
|
||||
@@ -705,7 +714,7 @@ bool ac_query_gpu_info(int fd, void *dev_p, struct radeon_info *info,
|
||||
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->kernel_has_modifiers = info->chip_class >= GFX9 && info->drm_minor >= 40;
|
||||
info->kernel_has_modifiers = has_modifiers(fd);
|
||||
info->has_graphics = gfx.available_rings > 0;
|
||||
|
||||
info->pa_sc_tile_steering_override = device_info.pa_sc_tile_steering_override;
|
||||
|
||||
Reference in New Issue
Block a user