mirror of
https://github.com/X11Libre/xf86-video-amdgpu.git
synced 2026-03-24 01:24:31 +00:00
fix for outdated libdrm on Ubuntu
This commit is contained in:
@@ -134,6 +134,15 @@ AC_CHECK_DECL(GBM_BO_USE_FRONT_RENDERING,
|
||||
|
||||
CPPFLAGS="$SAVE_CPPFLAGS"
|
||||
|
||||
# Check for GFX12 tile version support in libdrm
|
||||
SAVE_CPPFLAGS="$CPPFLAGS"
|
||||
CPPFLAGS="$CPPFLAGS $LIBDRM_CFLAGS"
|
||||
AC_CHECK_DECLS([AMD_FMT_MOD_TILE_VER_GFX12, AMD_FMT_MOD_TILE_GFX12_256B_2D, AMD_FMT_MOD_TILE_GFX12_4K_2D, AMD_FMT_MOD_TILE_GFX12_64K_2D, AMD_FMT_MOD_TILE_GFX12_256K_2D],
|
||||
[AC_DEFINE(HAVE_AMD_FMT_MOD_TILE_GFX12, 1, [libdrm has GFX12 tile support])],
|
||||
[AC_MSG_WARN([Some GFX12 tile constants missing - disabling GFX12 support])],
|
||||
[#include <drm_fourcc.h>])
|
||||
CPPFLAGS="$SAVE_CPPFLAGS"
|
||||
|
||||
AC_CONFIG_FILES([Makefile src/Makefile man/Makefile conf/Makefile])
|
||||
AC_OUTPUT
|
||||
|
||||
|
||||
@@ -60,6 +60,7 @@ amdgpu_tiling_info_to_modifier(uint64_t tiling_info, int asic_family)
|
||||
|
||||
/* GFX12 and later use a different tiling format */
|
||||
if (asic_family >= AMDGPU_FAMILY_GC_12_0_0) {
|
||||
#ifdef HAVE_AMD_FMT_MOD_TILE_VER_GFX12
|
||||
uint32_t swizzle_mode = AMDGPU_TILING_GET(tiling_info, GFX12_SWIZZLE_MODE);
|
||||
uint64_t modifier = AMD_FMT_MOD |
|
||||
AMD_FMT_MOD_SET(TILE_VERSION, AMD_FMT_MOD_TILE_VER_GFX12);
|
||||
@@ -85,6 +86,10 @@ amdgpu_tiling_info_to_modifier(uint64_t tiling_info, int asic_family)
|
||||
}
|
||||
|
||||
return modifier;
|
||||
#else
|
||||
/* GFX12 not supported by this libdrm version */
|
||||
return DRM_FORMAT_MOD_INVALID;
|
||||
#endif
|
||||
}
|
||||
|
||||
/* GFX9 - GFX11: Check for 64K tiled modes */
|
||||
@@ -864,6 +869,7 @@ amdgpu_dri3_get_modifiers(ScreenPtr screen, uint32_t format,
|
||||
AMD_FMT_MOD | AMD_FMT_MOD_TILE_VER_GFX10 |
|
||||
AMD_FMT_MOD_TILE_GFX9_64K_D,
|
||||
};
|
||||
#ifdef HAVE_AMD_FMT_MOD_TILE_VER_GFX12
|
||||
static uint64_t amd_tiled_modifiers_gfx12[] = {
|
||||
/* LINEAR - no tiling */
|
||||
DRM_FORMAT_MOD_INVALID,
|
||||
@@ -871,6 +877,7 @@ amdgpu_dri3_get_modifiers(ScreenPtr screen, uint32_t format,
|
||||
AMD_FMT_MOD | AMD_FMT_MOD_TILE_VER_GFX12 |
|
||||
AMD_FMT_MOD_TILE_GFX12_64K_2D,
|
||||
};
|
||||
#endif
|
||||
uint64_t *mods;
|
||||
uint32_t count;
|
||||
int asic_family;
|
||||
@@ -880,8 +887,14 @@ amdgpu_dri3_get_modifiers(ScreenPtr screen, uint32_t format,
|
||||
|
||||
/* Determine which set of modifiers to return based on ASIC family */
|
||||
if (asic_family >= AMDGPU_FAMILY_GC_12_0_0) {
|
||||
#ifdef HAVE_AMD_FMT_MOD_TILE_VER_GFX12
|
||||
mods = amd_tiled_modifiers_gfx12;
|
||||
count = sizeof(amd_tiled_modifiers_gfx12) / sizeof(amd_tiled_modifiers_gfx12[0]);
|
||||
#else
|
||||
/* GFX12 not supported, fall back to GFX10 modifiers */
|
||||
mods = amd_tiled_modifiers_gfx10;
|
||||
count = sizeof(amd_tiled_modifiers_gfx10) / sizeof(amd_tiled_modifiers_gfx10[0]);
|
||||
#endif
|
||||
} else if (asic_family >= AMDGPU_FAMILY_NV) {
|
||||
/* Navi and newer (GFX10+) */
|
||||
mods = amd_tiled_modifiers_gfx10;
|
||||
@@ -935,6 +948,7 @@ amdgpu_dri3_get_drawable_modifiers(DrawablePtr draw, uint32_t format,
|
||||
* For drawables, we return the same modifiers as screen-level modifiers.
|
||||
*/
|
||||
if (asic_family >= AMDGPU_FAMILY_GC_12_0_0) {
|
||||
#ifdef HAVE_AMD_FMT_MOD_TILE_VER_GFX12
|
||||
static uint64_t gfx12_mods[] = {
|
||||
DRM_FORMAT_MOD_INVALID,
|
||||
AMD_FMT_MOD | AMD_FMT_MOD_TILE_VER_GFX12 |
|
||||
@@ -942,6 +956,12 @@ amdgpu_dri3_get_drawable_modifiers(DrawablePtr draw, uint32_t format,
|
||||
};
|
||||
mods = gfx12_mods;
|
||||
count = sizeof(gfx12_mods) / sizeof(gfx12_mods[0]);
|
||||
#else
|
||||
/* GFX12 not supported, fall back to invalid modifier */
|
||||
static uint64_t invalid_mods[] = { DRM_FORMAT_MOD_INVALID };
|
||||
mods = invalid_mods;
|
||||
count = 1;
|
||||
#endif
|
||||
} else if (asic_family >= AMDGPU_FAMILY_NV) {
|
||||
/* Navi and newer (GFX10+) */
|
||||
static uint64_t gfx10_mods[] = {
|
||||
|
||||
@@ -328,7 +328,12 @@ amdgpu_glamor_share_pixmap_backing(PixmapPtr pixmap, ScreenPtr secondary,
|
||||
tiling_info = amdgpu_pixmap_get_tiling_info(pixmap);
|
||||
|
||||
if (info->family >= AMDGPU_FAMILY_GC_12_0_0)
|
||||
#ifdef HAVE_AMD_FMT_MOD_TILE_VER_GFX12
|
||||
is_linear = AMDGPU_TILING_GET(tiling_info, GFX12_SWIZZLE_MODE) == 0;
|
||||
#else
|
||||
/* GFX12 not supported, fall back to assuming non-linear */
|
||||
is_linear = FALSE;
|
||||
#endif
|
||||
else if (info->family >= AMDGPU_FAMILY_AI)
|
||||
is_linear = AMDGPU_TILING_GET(tiling_info, SWIZZLE_MODE) == 0;
|
||||
else
|
||||
|
||||
@@ -29,6 +29,25 @@ else
|
||||
error('libdrm headers not found - libdrm required')
|
||||
endif
|
||||
|
||||
# Check for GFX12 tile version support in libdrm
|
||||
gfx12_args = []
|
||||
gfx12_test = '''
|
||||
#include <drm_fourcc.h>
|
||||
int main() {
|
||||
int x = AMD_FMT_MOD_TILE_VER_GFX12;
|
||||
x = AMD_FMT_MOD_TILE_GFX12_256B_2D;
|
||||
x = AMD_FMT_MOD_TILE_GFX12_4K_2D;
|
||||
x = AMD_FMT_MOD_TILE_GFX12_64K_2D;
|
||||
x = AMD_FMT_MOD_TILE_GFX12_256K_2D;
|
||||
return 0;
|
||||
}
|
||||
'''
|
||||
if meson.get_compiler('c').compiles(gfx12_test, dependencies: [libdrm_dep])
|
||||
gfx12_args = ['-DHAVE_AMD_FMT_MOD_TILE_GFX12']
|
||||
else
|
||||
message('Some GFX12 tile constants missing - disabling GFX12 support')
|
||||
endif
|
||||
|
||||
amdgpu_drv_libs = [
|
||||
fontsproto_dep,
|
||||
gbm_dep,
|
||||
@@ -51,7 +70,7 @@ shared_module(
|
||||
srcs,
|
||||
include_directories: include_directories('..'),
|
||||
dependencies: amdgpu_drv_libs,
|
||||
c_args: drm_args,
|
||||
c_args: drm_args + gfx12_args,
|
||||
install: true,
|
||||
install_dir: join_paths(moduledir, 'drivers'),
|
||||
name_prefix: '',
|
||||
|
||||
Reference in New Issue
Block a user