Compare commits

..

25 commits

Author SHA1 Message Date
Samuel Pitoiset
b8b7c57c00 meson: do not mark exynos/omap/tegra as disabled features
Otherwise, using `--auto-features=enabled` wouldn't work because it
only "forces" auto options to be enabled.

This will enable these backends in CI to catch possible build errors.

Closes: https://gitlab.freedesktop.org/mesa/libdrm/-/work_items/128
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
2026-04-27 18:23:20 +02:00
Samuel Pitoiset
7f86e45164 omap: stop including linux/types.h
Nothing uses __u32 and friends, so it should be safe to remove.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
2026-04-27 18:23:04 +02:00
Samuel Pitoiset
cb4669afe8 build: bump version to 2.4.133
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
2026-04-27 17:47:19 +02:00
Rudi Heitbaum
91f7cd0ba2 modetest: fix discards 'const' qualifier from pointer target type
Since glibc-2.43:

For ISO C23, the functions bsearch, memchr, strchr, strpbrk, strrchr,
strstr, wcschr, wcspbrk, wcsrchr, wcsstr and wmemchr that return pointers
into their input arrays now have definitions as macros that return a
pointer to a const-qualified type when the input argument is a pointer
to a const-qualified type.

fixes:
    tests/modetest/modetest.c: In function 'parse_connector':
    tests/modetest/modetest.c:1997:22: warning: assignment discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
     1997 |                 endp = strpbrk(p, ",@:");
          |                      ^

Signed-off-by: Rudi Heitbaum <rudi@heitbaum.com>
2026-04-27 17:45:10 +02:00
Rudi Heitbaum
ff12339926 amdgpu: fix discards 'const' qualifier from pointer target type
Since glibc-2.43:

For ISO C23, the functions bsearch, memchr, strchr, strpbrk, strrchr,
strstr, wcschr, wcspbrk, wcsrchr, wcsstr and wmemchr that return pointers
into their input arrays now have definitions as macros that return a
pointer to a const-qualified type when the input argument is a pointer
to a const-qualified type.

fixes:
    amdgpu/amdgpu_asic_id.c: In function 'find_asic_id_table':
    amdgpu/amdgpu_asic_id.c:249:19: warning: assignment discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
      249 |         file_name = strrchr(AMDGPU_ASIC_ID_TABLE, '/');
          |                   ^

Signed-off-by: Rudi Heitbaum <rudi@heitbaum.com>
2026-04-27 17:45:10 +02:00
Samuel Pitoiset
a6e1316d03 add missing include to util_math.h
This fixes a build error with Tegra.

Fixes: 8cc2d09c ("amdgpu: reserve half of the addr space to implement a workaround for PRT")
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
2026-04-27 17:42:30 +02:00
Eric Engestrom
31c6232896 ci: bump debian from bookworm to trixie 2026-04-27 17:31:38 +02:00
Eric Engestrom
b1144c21ca ci: fix indentation 2026-04-27 17:31:23 +02:00
Samuel Pitoiset
979f607906 build: bump version to 2.4.132
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
2026-04-27 10:28:45 +02:00
Samuel Pitoiset
8cc2d09c29 amdgpu: reserve half of the addr space to implement a workaround for PRT
On GFX6-GFX12, except GFX9, SMEM loads on NULL PRT pages would just
fault and hang the GPU. The better workaround that we found is to split
the address space in two equal parts "LOW"/"HIGH", here's more details:

To workaround that, the driver splits the total VA space in half, so
that a single bit controls whether it's the "HIGH" or the "LOW"
address space. Every sparse residency buffer allocations that might
be used with SMEM get two allocations:

- the "HIGH" address space is mapped normally and its VA is returned
  to the application.
- the "LOW" address space is explicitly mapped to a zero-initialized
  buffer when it's allocated or when it's unmapped.

Other buffer allocations are always allocated in the "LOW" address.

The driver also creates a zero-allocated BO that will be used to map
partially resident buffers at creation and when explicitly unmapped.
The size is arbitrary but it seems that allocating 8MiB is perfectly
reasonable and fast enough in most cases. This BO is marked as
read-only for the GPU because the backend compilers don't use SMEM
stores.

For example this makes the "LOW" half of the HIGH VA range like
[0xffff800100000000,0xffffbfffffbfe000], and the "HIGH" half is left
for PRT.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
2026-04-27 09:59:32 +02:00
Rudi Heitbaum
8de45ef60d drm: handle asprintf() allocation failures in format modifier name functions
Check the return value of asprintf() in drmGetFormatModifierNameFromNvidia(),
drmGetFormatModifierNameFromAmlogic(), and drmGetFormatModifierNameFromVivante()
to avoid leaving pointers uninitialized on allocation failure.

asprintf() returns -1 on failure and does not guarantee the output pointer
is set to NULL, which could lead to undefined behavior if the pointer is
used subsequently. Set the pointer to NULL explicitly on failure.

Fixes: -Wunused-result warnings from GCC
Signed-off-by: Rudi Heitbaum <rudi@heitbaum.com>
2026-04-06 08:00:12 +00:00
Janne Grunau
b9dea73dfa gen_table_fourcc: Add Apple as vendor
The modifiers for DRM_FORMAT_MOD_VENDOR_APPLE are simple and cna be
represented in a static table. Add "APPLE" as pattern.

Signed-off-by: Janne Grunau <j@jannau.net>
2026-03-06 13:06:12 +01:00
Alex Deucher
15cdcfe9e1 amdgpu: update marketing names
From ROCm 7.2.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2026-02-25 17:36:48 -05:00
Alex Deucher
bd856bed23 amdgpu: update marketing names
https://www.amd.com/en/products/graphics/workstations/radeon-ai-pro/ai-9000-series/amd-radeon-ai-pro-r9600d.html
https://www.amd.com/en/products/processors/laptop/ryzen/ai-300-series/amd-ryzen-ai-5-330.html
https://www.amd.com/en/products/processors/laptop/ryzen/ai-300-series/amd-ryzen-ai-5-340.html
https://www.amd.com/en/products/processors/laptop/ryzen/ai-300-series/amd-ryzen-ai-7-350.html

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2026-02-23 16:59:55 -05:00
Ilya Zlobintsev
369990d966 amdgpu: update marketing names for strix point revisions 2025-12-19 15:41:40 +02:00
Simon Ser
6bfcfc725f build: bump version to 2.4.131
Signed-off-by: Simon Ser <contact@emersion.fr>
2025-12-11 22:17:34 +01:00
Sergio Costas Rodriguez
64ef303d70
amdgpu: NetBSD lacks secure_getenv
When adding support for defining extra paths for the `amdgpu.ids`
file using an environment variable, the patch used a call to
secure_getenv(), which is only available in GNU. This breaks the
build in NetBSD systems.

This patch adds conditional compilation to use secure_getenv()
only when compiling against the GNU libraries.

Fix c3c7fb21aa (note_3229411)

Signed-off-by: Sergio Costas Rodriguez <sergio.costas@canonical.com>
2025-12-11 15:41:39 +01:00
Samuel Pitoiset
b7861fb536 amdgpu: add Steam Machine marketing name
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
2025-12-11 08:52:33 +01:00
Simon Ser
523534ee01 build: bump version to 2.4.130
Signed-off-by: Simon Ser <contact@emersion.fr>
2025-12-08 14:15:17 +01:00
Simon Ser
1b68532f88 Sync headers with drm-next
Synchronize drm.h, drm_mode.h and drm_fourcc.h to drm-next.

Generated using make headers_install
Generated from drm-next branch commit 0692602defb0c273f80dec9c564ca50726404aca

Signed-off-by: Simon Ser <contact@emersion.fr>
2025-12-08 13:09:09 +00:00
Val Packett
bef7c6fcf1 headers: drm: Sync virtgpu_drm.h with Linux v6.16
The header shipped with libdrm was missing blob resources, context_init,
syncobj support, and capset definitions.

Update to the current version from Linux, which was last modified in 6.16.

Signed-off-by: Val Packett <val@invisiblethingslab.com>
2025-12-07 20:06:56 -03:00
Andrew Davis
b71953a199 omap: fix omap_bo_size for tiled buffers
The buffer size is calculated using pixels, not bytes as it should. The
result is often correct, though, as the stride is aligned to page size,
but there are still many cases where the size ends up being wrong.

Fix this by not calculating the size at all, as in that case
DRM_OMAP_GEM_INFO ioctl is used to get the correct size from the kernel.
This is better in any case as then the userspace library doesn't need to
know how the tiled buffers need to be aligned.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Signed-off-by: Andrew Davis <afd@ti.com>
2025-12-04 09:39:10 +00:00
Sergio Costas Rodriguez
d72d7c6eef
amdgpu: Fix envar name in documentation
After a change in the patch, the environment variable name for
the `amdgpu.ids` file paths changed to plurar form, but the
documentation wasn't updated.

This patch fixes it.
2025-12-03 10:53:38 +01:00
Sergio Costas Rodriguez
a050f86ed8
Support multiple paths in AMDGPU_ASIC_ID_TABLE_PATH envar
This patch allows to specify several colon-separated paths where
to search for the `amdgpu.ids` file in the AMDGPU_ASIC_ID_TABLE_PATH
environment variable.
2025-12-02 17:03:09 +01:00
Sergio Costas Rodriguez
c3c7fb21aa
amdgpu: add env support for amdgpu.ids path
In some cases, like when building a Snap application that uses
libdrm, the `amdgpu.ids` file isn't directly available at the
compiling place, but inside a mounted folder. This forces each
application to link/bind the file from the current place
(usually at the $SNAP/gnome-platform/usr/share/libdrm/amdgpu.ids)
which is cumbersome.

This patch allows to set an environment variable, called
AMDGPU_ASIC_ID_TABLE_PATH, where the file will be also searched
if it isn't located in the default, meson-configured, path.
2025-12-02 17:02:39 +01:00
20 changed files with 656 additions and 65 deletions

View file

@ -39,11 +39,11 @@ stages:
.os-debian: .os-debian:
variables: variables:
BUILD_OS: debian BUILD_OS: debian
FDO_DISTRIBUTION_VERSION: bookworm FDO_DISTRIBUTION_VERSION: trixie-slim
FDO_DISTRIBUTION_PACKAGES: 'build-essential docbook-xsl libatomic-ops-dev libcairo2-dev libcunit1-dev libpciaccess-dev meson ninja-build pkg-config python3 python3-pip python3-wheel python3-setuptools python3-docutils valgrind' FDO_DISTRIBUTION_PACKAGES: 'build-essential docbook-xsl libatomic-ops-dev libcairo2-dev libcunit1-dev libpciaccess-dev meson ninja-build pkg-config python3 python3-pip python3-wheel python3-setuptools python3-docutils valgrind'
# bump this tag every time you change something which requires rebuilding the # bump this tag every time you change something which requires rebuilding the
# base image # base image
FDO_DISTRIBUTION_TAG: "2024-06-25.0" FDO_DISTRIBUTION_TAG: "2026-04-27.0"
.debian-x86_64: .debian-x86_64:
extends: extends:

View file

@ -49,3 +49,15 @@ Then use ninja to build and install:
If you are installing into a system location you will need to run install If you are installing into a system location you will need to run install
separately, and as root. separately, and as root.
AMDGPU ASIC table file
----------------------
The AMDGPU driver requires the `amdgpu.ids` file. It is usually located at
`$PREFIX/share/libdrm`, but it is possible to specify a set of alternative
paths at runtime by setting the `AMDGPU_ASIC_ID_TABLE_PATHS` environment
variable with one or more colon-separated paths where to search for the
`amdgpu.ids` file.
For this option to be available, the C library must support secure_getenv()
function. In systems without it (like NetBSD), this option won't be available.

View file

@ -76,7 +76,9 @@ amdgpu_query_video_caps_info
amdgpu_read_mm_registers amdgpu_read_mm_registers
amdgpu_va_manager_alloc amdgpu_va_manager_alloc
amdgpu_va_manager_init amdgpu_va_manager_init
amdgpu_va_manager_init2
amdgpu_va_manager_deinit amdgpu_va_manager_deinit
amdgpu_va_manager_query_sw_info
amdgpu_va_range_alloc amdgpu_va_range_alloc
amdgpu_va_range_alloc2 amdgpu_va_range_alloc2
amdgpu_va_range_free amdgpu_va_range_free

View file

@ -105,6 +105,19 @@ enum amdgpu_gpu_va_range
enum amdgpu_sw_info { enum amdgpu_sw_info {
amdgpu_sw_info_address32_hi = 0, amdgpu_sw_info_address32_hi = 0,
/** Query the PRT control bit when the half VA range is reserved for
* PRT when the device is initialized. This depends on the GFX version.
* A return value of ~0 should be ignored.
*/
amdgpu_sw_info_address_prt_wa_control_bit = 1,
};
enum amdgpu_va_manager_sw_info {
/** Query the PRT control bit when the half VA range is reserved for
* PRT with AMDGPU_VA_MGR_RESERVE_HALF_VA_FOR_PRT. The default value of
* ~0 shouldn't be considered a valid value.
*/
amdgpu_va_manager_sw_info_address_prt_wa_control_bit = 0,
}; };
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
@ -1467,6 +1480,14 @@ void amdgpu_va_manager_init(amdgpu_va_manager_handle va_mgr,
uint64_t high_va_offset, uint64_t high_va_max, uint64_t high_va_offset, uint64_t high_va_max,
uint32_t virtual_address_alignment); uint32_t virtual_address_alignment);
#define AMDGPU_VA_MGR_RESERVE_HALF_VA_FOR_PRT 0x1
void amdgpu_va_manager_init2(struct amdgpu_va_manager *va_mgr,
uint64_t low_va_offset, uint64_t low_va_max,
uint64_t high_va_offset, uint64_t high_va_max,
uint32_t virtual_address_alignment,
uint32_t flags);
void amdgpu_va_manager_deinit(amdgpu_va_manager_handle va_mgr); void amdgpu_va_manager_deinit(amdgpu_va_manager_handle va_mgr);
/** /**
@ -1484,6 +1505,21 @@ int amdgpu_va_range_alloc2(amdgpu_va_manager_handle va_mgr,
amdgpu_va_handle *va_range_handle, amdgpu_va_handle *va_range_handle,
uint64_t flags); uint64_t flags);
/**
* Query VA manager information.
*
* \param va_mgr - \c [in] VA manager
* \param info - \c [in] amdgpu_va_manager_sw_info_*
* \param value - \c [out] Pointer to the return value.
*
* \return 0 on success\n
* <0 - Negative POSIX error code
*
*/
int amdgpu_va_manager_query_sw_info(struct amdgpu_va_manager *va_mgr,
enum amdgpu_va_manager_sw_info info,
void *value);
/** /**
* VA mapping/unmapping for the buffer object * VA mapping/unmapping for the buffer object
* *

View file

@ -22,6 +22,11 @@
* *
*/ */
// secure_getenv requires _GNU_SOURCE
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif
#include <ctype.h> #include <ctype.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
@ -160,6 +165,112 @@ static void amdgpu_parse_proc_cpuinfo(struct amdgpu_device *dev)
fclose(fp); fclose(fp);
} }
#if HAVE_SECURE_GETENV
static char *join_path(const char *dir, const char *file) {
size_t dir_len = strlen(dir);
size_t file_len = strlen(file);
char *full_path = NULL;
int need_slash = ((dir_len > 0) && (dir[dir_len - 1] != '/'));
size_t total_len = dir_len + (need_slash ? 1 : 0) + file_len + 1; // +1 for null terminator
if (dir_len == 0) {
return strdup(file);
}
full_path = malloc(total_len);
if (!full_path) {
return NULL; // Memory allocation failed
}
strcpy(full_path, dir);
if (need_slash) {
full_path[dir_len] = '/';
dir_len++;
}
strcpy(full_path + dir_len, file);
return full_path;
}
static char **split_env_var(const char *env_var_content)
{
char **ret = NULL;
char *dup_env_val;
int elements = 1;
int index = 1;
if (!env_var_content || env_var_content[0] == '\0')
return NULL;
for(char *p = (char *)env_var_content; *p; p++) {
if (*p == ':')
elements++;
}
dup_env_val = strdup(env_var_content);
if (!dup_env_val) {
return NULL;
}
ret = malloc(sizeof(char *) * (elements + 1));
ret[0] = dup_env_val;
for(char *p = (char *)dup_env_val; *p; p++) {
if (*p == ':') {
*p = 0;
ret[index++] = p + 1;
}
}
ret[index] = NULL; // ensure that the last element in the array is NULL
return ret;
}
static void split_env_var_free(char **split_var)
{
if (split_var) {
// remember that the first element also points to the whole duplicated string,
// which was modified in place by replacing ':' with '\0' characters
free(split_var[0]);
free(split_var);
}
}
static char *find_asic_id_table(void)
{
// first check the paths in AMDGPU_ASIC_ID_TABLE_PATHS environment variable
const char *amdgpu_asic_id_table_paths = secure_getenv("AMDGPU_ASIC_ID_TABLE_PATHS");
const char *file_name = NULL;
char *found_path = NULL;
char **paths = NULL;
if (!amdgpu_asic_id_table_paths)
return NULL;
// extract the file name from AMDGPU_ASIC_ID_TABLE
file_name = strrchr(AMDGPU_ASIC_ID_TABLE, '/');
if (!file_name)
return NULL;
file_name++; // skip the '/'
paths = split_env_var(amdgpu_asic_id_table_paths);
if (!paths)
return NULL;
// for each path, join with file_name and check if it exists
for (int i = 0; paths[i] != NULL; i++) {
char *full_path = join_path(paths[i], file_name);
if (!full_path) {
continue;
}
if (access(full_path, R_OK) == 0) {
found_path = full_path;
break;
}
}
split_env_var_free(paths);
return found_path;
}
#endif
void amdgpu_parse_asic_ids(struct amdgpu_device *dev) void amdgpu_parse_asic_ids(struct amdgpu_device *dev)
{ {
FILE *fp; FILE *fp;
@ -169,9 +280,19 @@ void amdgpu_parse_asic_ids(struct amdgpu_device *dev)
int line_num = 1; int line_num = 1;
int r = 0; int r = 0;
fp = fopen(AMDGPU_ASIC_ID_TABLE, "r"); char *amdgpu_asic_id_table_path = NULL;
#if HAVE_SECURE_GETENV
// if this system lacks secure_getenv(), don't allow extra paths
// for security reasons.
amdgpu_asic_id_table_path = find_asic_id_table();
#endif
// if not found, use the default AMDGPU_ASIC_ID_TABLE path
if (!amdgpu_asic_id_table_path)
amdgpu_asic_id_table_path = strdup(AMDGPU_ASIC_ID_TABLE);
fp = fopen(amdgpu_asic_id_table_path, "r");
if (!fp) { if (!fp) {
fprintf(stderr, "%s: %s\n", AMDGPU_ASIC_ID_TABLE, fprintf(stderr, "%s: %s\n", amdgpu_asic_id_table_path,
strerror(errno)); strerror(errno));
goto get_cpu; goto get_cpu;
} }
@ -188,7 +309,7 @@ void amdgpu_parse_asic_ids(struct amdgpu_device *dev)
continue; continue;
} }
drmMsg("%s version: %s\n", AMDGPU_ASIC_ID_TABLE, line); drmMsg("%s version: %s\n", amdgpu_asic_id_table_path, line);
break; break;
} }
@ -206,7 +327,7 @@ void amdgpu_parse_asic_ids(struct amdgpu_device *dev)
if (r == -EINVAL) { if (r == -EINVAL) {
fprintf(stderr, "Invalid format: %s: line %d: %s\n", fprintf(stderr, "Invalid format: %s: line %d: %s\n",
AMDGPU_ASIC_ID_TABLE, line_num, line); amdgpu_asic_id_table_path, line_num, line);
} else if (r && r != -EAGAIN) { } else if (r && r != -EAGAIN) {
fprintf(stderr, "%s: Cannot parse ASIC IDs: %s\n", fprintf(stderr, "%s: Cannot parse ASIC IDs: %s\n",
__func__, strerror(-r)); __func__, strerror(-r));
@ -216,6 +337,7 @@ void amdgpu_parse_asic_ids(struct amdgpu_device *dev)
fclose(fp); fclose(fp);
get_cpu: get_cpu:
free(amdgpu_asic_id_table_path);
if (dev->info.ids_flags & AMDGPU_IDS_FLAGS_FUSION && if (dev->info.ids_flags & AMDGPU_IDS_FLAGS_FUSION &&
dev->marketing_name == NULL) { dev->marketing_name == NULL) {
amdgpu_parse_proc_cpuinfo(dev); amdgpu_parse_proc_cpuinfo(dev);

View file

@ -144,6 +144,39 @@ static void amdgpu_device_reference(struct amdgpu_device **dst,
*dst = src; *dst = src;
} }
static int amdgpu_query_gfx_level_major(amdgpu_device_handle dev,
uint8_t *gfx_ip_version_major)
{
struct drm_amdgpu_info_hw_ip ip_info;
uint32_t gfx_ip_count = 0;
int r;
*gfx_ip_version_major = 0;
r = amdgpu_query_hw_ip_count(dev, AMDGPU_HW_IP_GFX, &gfx_ip_count);
if (r)
return r;
/* No graphics support. */
if (gfx_ip_count == 0)
return 0;
memset(&ip_info, 0, sizeof(ip_info));
r = amdgpu_query_hw_ip_info(dev, AMDGPU_HW_IP_GFX, 0, &ip_info);
if (r)
return r;
/* GFX6-8 don't set ip_discovery_version. */
if (dev->minor_version >= 48 && ip_info.ip_discovery_version) {
*gfx_ip_version_major = (ip_info.ip_discovery_version >> 16) & 0xff;
} else {
*gfx_ip_version_major = ip_info.hw_ip_version_major;
}
return r;
}
static int _amdgpu_device_initialize(int fd, static int _amdgpu_device_initialize(int fd,
uint32_t *major_version, uint32_t *major_version,
uint32_t *minor_version, uint32_t *minor_version,
@ -151,11 +184,13 @@ static int _amdgpu_device_initialize(int fd,
bool deduplicate_device) bool deduplicate_device)
{ {
struct amdgpu_device *dev = NULL; struct amdgpu_device *dev = NULL;
uint8_t gfx_ip_version_major = 0;
drmVersionPtr version; drmVersionPtr version;
int r; int r;
int flag_auth = 0; int flag_auth = 0;
int flag_authexist=0; int flag_authexist=0;
uint32_t accel_working = 0; uint32_t accel_working = 0;
uint32_t va_mgr_flags = 0;
*device_handle = NULL; *device_handle = NULL;
@ -244,12 +279,25 @@ static int _amdgpu_device_initialize(int fd,
goto cleanup; goto cleanup;
} }
amdgpu_va_manager_init(&dev->va_mgr, r = amdgpu_query_gfx_level_major(dev, &gfx_ip_version_major);
if (!r) {
/* Split the HIGH addr space for GFX6-GFX12, except GFX9 to
* implement a workaround for SMEM loads with NULL PRT pages.
* This is silently ignored if querying the GFX level failed.
*/
if (gfx_ip_version_major >= 6 && gfx_ip_version_major <= 12 &&
gfx_ip_version_major != 9) {
va_mgr_flags |= AMDGPU_VA_MGR_RESERVE_HALF_VA_FOR_PRT;
}
}
amdgpu_va_manager_init2(&dev->va_mgr,
dev->dev_info.virtual_address_offset, dev->dev_info.virtual_address_offset,
dev->dev_info.virtual_address_max, dev->dev_info.virtual_address_max,
dev->dev_info.high_va_offset, dev->dev_info.high_va_offset,
dev->dev_info.high_va_max, dev->dev_info.high_va_max,
dev->dev_info.virtual_address_alignment); dev->dev_info.virtual_address_alignment,
va_mgr_flags);
amdgpu_parse_asic_ids(dev); amdgpu_parse_asic_ids(dev);
@ -322,6 +370,9 @@ drm_public int amdgpu_query_sw_info(amdgpu_device_handle dev,
else else
*val32 = (dev->va_mgr.vamgr_32.va_max - 1) >> 32; *val32 = (dev->va_mgr.vamgr_32.va_max - 1) >> 32;
return 0; return 0;
case amdgpu_sw_info_address_prt_wa_control_bit:
*val32 = dev->va_mgr.address_prt_wa_control_bit;
return 0;
} }
return -EINVAL; return -EINVAL;
} }

View file

@ -72,6 +72,11 @@ struct amdgpu_va_manager {
struct amdgpu_bo_va_mgr vamgr_high; struct amdgpu_bo_va_mgr vamgr_high;
/** The VA manager for the 32bit high address space */ /** The VA manager for the 32bit high address space */
struct amdgpu_bo_va_mgr vamgr_high_32; struct amdgpu_bo_va_mgr vamgr_high_32;
/** The bit to control whether it's the "LOW" or "HIGH" halves, when
* half of the address space is reserved for PRT to implement a SW
* workaround. */
unsigned address_prt_wa_control_bit;
}; };
struct amdgpu_device { struct amdgpu_device {

View file

@ -326,16 +326,39 @@ drm_public void amdgpu_va_manager_init(struct amdgpu_va_manager *va_mgr,
uint64_t low_va_offset, uint64_t low_va_max, uint64_t low_va_offset, uint64_t low_va_max,
uint64_t high_va_offset, uint64_t high_va_max, uint64_t high_va_offset, uint64_t high_va_max,
uint32_t virtual_address_alignment) uint32_t virtual_address_alignment)
{
amdgpu_va_manager_init2(va_mgr, low_va_offset, low_va_max,
high_va_offset, high_va_max,
virtual_address_alignment, 0);
}
drm_public void amdgpu_va_manager_init2(struct amdgpu_va_manager *va_mgr,
uint64_t low_va_offset, uint64_t low_va_max,
uint64_t high_va_offset, uint64_t high_va_max,
uint32_t virtual_address_alignment,
uint32_t flags)
{ {
uint64_t start, max; uint64_t start, max;
va_mgr->address_prt_wa_control_bit = ~0;
start = low_va_offset; start = low_va_offset;
max = MIN2(low_va_max, 0x100000000ULL); max = MIN2(low_va_max, 0x100000000ULL);
amdgpu_vamgr_init(&va_mgr->vamgr_32, start, max, amdgpu_vamgr_init(&va_mgr->vamgr_32, start, max,
virtual_address_alignment); virtual_address_alignment);
start = max; start = max;
if ((flags & AMDGPU_VA_MGR_RESERVE_HALF_VA_FOR_PRT) && !high_va_max) {
/* Reserve the half VA range for PRT by splitting it in two
* equal halves where one bit controls whether it's the LOW or
* HIGH half.
*/
va_mgr->address_prt_wa_control_bit = util_last_bit64(low_va_offset ^ low_va_max) - 1;
max = low_va_max ^ (1ull << va_mgr->address_prt_wa_control_bit);
} else {
max = MAX2(low_va_max, 0x100000000ULL); max = MAX2(low_va_max, 0x100000000ULL);
}
amdgpu_vamgr_init(&va_mgr->vamgr_low, start, max, amdgpu_vamgr_init(&va_mgr->vamgr_low, start, max,
virtual_address_alignment); virtual_address_alignment);
@ -345,7 +368,17 @@ drm_public void amdgpu_va_manager_init(struct amdgpu_va_manager *va_mgr,
virtual_address_alignment); virtual_address_alignment);
start = max; start = max;
if ((flags & AMDGPU_VA_MGR_RESERVE_HALF_VA_FOR_PRT) && high_va_max) {
/* Reserve the half VA range for PRT by splitting it in two
* equal halves where one bit controls whether it's the LOW or
* HIGH half.
*/
va_mgr->address_prt_wa_control_bit = util_last_bit64(high_va_offset ^ high_va_max) - 1;
max = high_va_max ^ (1ull << va_mgr->address_prt_wa_control_bit);
} else {
max = MAX2(high_va_max, (start & ~0xffffffffULL) + 0x100000000ULL); max = MAX2(high_va_max, (start & ~0xffffffffULL) + 0x100000000ULL);
}
amdgpu_vamgr_init(&va_mgr->vamgr_high, start, max, amdgpu_vamgr_init(&va_mgr->vamgr_high, start, max,
virtual_address_alignment); virtual_address_alignment);
} }
@ -357,3 +390,17 @@ drm_public void amdgpu_va_manager_deinit(struct amdgpu_va_manager *va_mgr)
amdgpu_vamgr_deinit(&va_mgr->vamgr_high_32); amdgpu_vamgr_deinit(&va_mgr->vamgr_high_32);
amdgpu_vamgr_deinit(&va_mgr->vamgr_high); amdgpu_vamgr_deinit(&va_mgr->vamgr_high);
} }
drm_public int amdgpu_va_manager_query_sw_info(struct amdgpu_va_manager *va_mgr,
enum amdgpu_va_manager_sw_info info,
void *value)
{
uint32_t *val32 = (uint32_t*)value;
switch (info) {
case amdgpu_va_manager_sw_info_address_prt_wa_control_bit:
*val32 = va_mgr->address_prt_wa_control_bit;
return 0;
}
return -EINVAL;
}

View file

@ -8,6 +8,19 @@
1114, C3, AMD Radeon 840M Graphics 1114, C3, AMD Radeon 840M Graphics
1114, D2, AMD Radeon 860M Graphics 1114, D2, AMD Radeon 860M Graphics
1114, D3, AMD Radeon 840M Graphics 1114, D3, AMD Radeon 840M Graphics
1114, E2, AMD Radeon 860M Graphics
1114, E4, AMD Radeon 860M Graphics
1114, E5, AMD Radeon 840M Graphics
1114, E9, AMD Radeon 860M Graphics
1114, EA, AMD Radeon 840M Graphics
1114, ED, AMD Radeon 860M Graphics
1114, EE, AMD Radeon 840M Graphics
1114, F2, AMD Radeon 860M Graphics
1114, F3, AMD Radeon 840M Graphics
1114, F9, AMD Radeon 860M Graphics
1114, FA, AMD Radeon 840M Graphics
1114, FC, AMD Radeon 860M Graphics
1114, FD, AMD Radeon 840M Graphics
1309, 00, AMD Radeon R7 Graphics 1309, 00, AMD Radeon R7 Graphics
130A, 00, AMD Radeon R6 Graphics 130A, 00, AMD Radeon R6 Graphics
130B, 00, AMD Radeon R4 Graphics 130B, 00, AMD Radeon R4 Graphics
@ -39,23 +52,35 @@
1506, C3, AMD Radeon 610M 1506, C3, AMD Radeon 610M
1506, C4, AMD Radeon 610M 1506, C4, AMD Radeon 610M
150E, C1, AMD Radeon 890M Graphics 150E, C1, AMD Radeon 890M Graphics
150E, C4, AMD Radeon 890M Graphics 150E, C4, AMD Radeon 880M Graphics
150E, C5, AMD Radeon 890M Graphics 150E, C5, AMD Radeon 890M Graphics
150E, C6, AMD Radeon 890M Graphics 150E, C6, AMD Radeon 890M Graphics
150E, C7, AMD Radeon 890M Graphics
150E, D1, AMD Radeon 890M Graphics 150E, D1, AMD Radeon 890M Graphics
150E, D2, AMD Radeon 890M Graphics 150E, D2, AMD Radeon 880M Graphics
150E, D3, AMD Radeon 890M Graphics 150E, D3, AMD Radeon 890M Graphics
1586, C1, Radeon 8060S Graphics 150E, E1, AMD Radeon 890M Graphics
1586, C2, Radeon 8050S Graphics 150E, E3, AMD Radeon 890M Graphics
1586, C4, Radeon 8050S Graphics 150E, E4, AMD Radeon 890M Graphics
1586, D1, Radeon 8060S Graphics 150E, F1, AMD Radeon 890M Graphics
1586, D2, Radeon 8050S Graphics 150E, F3, AMD Radeon 890M Graphics
1586, D4, Radeon 8050S Graphics 1586, C1, AMD Radeon 8060S Graphics
1586, D5, Radeon 8040S Graphics 1586, C2, AMD Radeon 8050S Graphics
1586, C3, AMD Radeon 8060S Graphics
1586, C4, AMD Radeon 8050S Graphics
1586, C6, AMD Radeon 8060S Graphics
1586, D1, AMD Radeon 8060S Graphics
1586, D2, AMD Radeon 8050S Graphics
1586, D4, AMD Radeon 8050S Graphics
1586, D5, AMD Radeon 8040S Graphics
15BF, 00, AMD Radeon 780M Graphics 15BF, 00, AMD Radeon 780M Graphics
15BF, 01, AMD Radeon 760M Graphics 15BF, 01, AMD Radeon 760M Graphics
15BF, 02, AMD Radeon 780M Graphics 15BF, 02, AMD Radeon 780M Graphics
15BF, 03, AMD Radeon 760M Graphics 15BF, 03, AMD Radeon 760M Graphics
15BF, 05, AMD Radeon 760M Graphics
15BF, 06, AMD Radeon 780M Graphics
15BF, 07, AMD Radeon 740M Graphics
15BF, 08, AMD Radeon 740M Graphics
15BF, C1, AMD Radeon 780M Graphics 15BF, C1, AMD Radeon 780M Graphics
15BF, C2, AMD Radeon 780M Graphics 15BF, C2, AMD Radeon 780M Graphics
15BF, C3, AMD Radeon 760M Graphics 15BF, C3, AMD Radeon 760M Graphics
@ -69,6 +94,7 @@
15BF, CB, AMD Radeon 760M Graphics 15BF, CB, AMD Radeon 760M Graphics
15BF, CC, AMD Radeon 740M Graphics 15BF, CC, AMD Radeon 740M Graphics
15BF, CD, AMD Radeon 760M Graphics 15BF, CD, AMD Radeon 760M Graphics
15BF, CE, AMD Radeon 740M Graphics
15BF, CF, AMD Radeon 780M Graphics 15BF, CF, AMD Radeon 780M Graphics
15BF, D0, AMD Radeon 780M Graphics 15BF, D0, AMD Radeon 780M Graphics
15BF, D1, AMD Radeon 780M Graphics 15BF, D1, AMD Radeon 780M Graphics
@ -91,10 +117,18 @@
15C8, C2, AMD Radeon 740M Graphics 15C8, C2, AMD Radeon 740M Graphics
15C8, C3, AMD Radeon 740M Graphics 15C8, C3, AMD Radeon 740M Graphics
15C8, C4, AMD Radeon 740M Graphics 15C8, C4, AMD Radeon 740M Graphics
15C8, C5, AMD Radeon 740M Graphics
15C8, C6, AMD Radeon 740M Graphics
15C8, C7, AMD Radeon 740M Graphics
15C8, C8, AMD Radeon 740M Graphics
15C8, D1, AMD Radeon 740M Graphics 15C8, D1, AMD Radeon 740M Graphics
15C8, D2, AMD Radeon 740M Graphics 15C8, D2, AMD Radeon 740M Graphics
15C8, D3, AMD Radeon 740M Graphics 15C8, D3, AMD Radeon 740M Graphics
15C8, D4, AMD Radeon 740M Graphics 15C8, D4, AMD Radeon 740M Graphics
15C8, D5, AMD Radeon 740M Graphics
15C8, D6, AMD Radeon 740M Graphics
15C8, D7, AMD Radeon 740M Graphics
15C8, D8, AMD Radeon 740M Graphics
15D8, 00, AMD Radeon RX Vega 8 Graphics WS 15D8, 00, AMD Radeon RX Vega 8 Graphics WS
15D8, 91, AMD Radeon Vega 3 Graphics 15D8, 91, AMD Radeon Vega 3 Graphics
15D8, 91, AMD Ryzen Embedded R1606G with Radeon Vega Gfx 15D8, 91, AMD Ryzen Embedded R1606G with Radeon Vega Gfx
@ -250,6 +284,19 @@
1901, D6, AMD Radeon 740M Graphics 1901, D6, AMD Radeon 740M Graphics
1901, D7, AMD Radeon 740M Graphics 1901, D7, AMD Radeon 740M Graphics
1901, D8, AMD Radeon 740M Graphics 1901, D8, AMD Radeon 740M Graphics
1902, C0, AMD Radeon 840M Graphics
1902, C1, AMD Radeon 840M Graphics
1902, C2, AMD Radeon 820M Graphics
1902, C3, AMD Radeon 840M Graphics
1902, C6, AMD Radeon 820M Graphics
1902, C7, AMD Radeon 840M Graphics
1902, C8, AMD Radeon 840M Graphics
1902, C9, AMD Radeon 820M Graphics
1902, CA, AMD Radeon 840M Graphics
1902, D1, AMD Radeon 840M Graphics
1902, D3, AMD Radeon 840M Graphics
1902, D7, AMD Radeon 840M Graphics
1902, D8, AMD Radeon 840M Graphics
6600, 00, AMD Radeon HD 8600 / 8700M 6600, 00, AMD Radeon HD 8600 / 8700M
6600, 81, AMD Radeon R7 M370 6600, 81, AMD Radeon R7 M370
6601, 00, AMD Radeon HD 8500M / 8700M 6601, 00, AMD Radeon HD 8500M / 8700M
@ -577,6 +624,7 @@
7480, C3, AMD Radeon RX 7600S 7480, C3, AMD Radeon RX 7600S
7480, C7, AMD Radeon RX 7600M XT 7480, C7, AMD Radeon RX 7600M XT
7480, CF, AMD Radeon RX 7600 7480, CF, AMD Radeon RX 7600
7481, C7, AMD Steam Machine
7483, CF, AMD Radeon RX 7600M 7483, CF, AMD Radeon RX 7600M
7489, 00, AMD Radeon Pro W7500 7489, 00, AMD Radeon Pro W7500
7499, 00, AMD Radeon Pro W7400 7499, 00, AMD Radeon Pro W7400
@ -595,12 +643,14 @@
7550, C2, AMD Radeon RX 9070 GRE 7550, C2, AMD Radeon RX 9070 GRE
7550, C3, AMD Radeon RX 9070 7550, C3, AMD Radeon RX 9070
7551, C0, AMD Radeon AI PRO R9700 7551, C0, AMD Radeon AI PRO R9700
7551, C8, AMD Radeon AI PRO R9600D
7590, C0, AMD Radeon RX 9060 XT 7590, C0, AMD Radeon RX 9060 XT
7590, C1, AMD Radeon RX 9060 XT LP
7590, C7, AMD Radeon RX 9060 7590, C7, AMD Radeon RX 9060
75A0, C0, AMD Instinct MI350X 75A0, 00, AMD Instinct MI350X
75A3, C0, AMD Instinct MI355X 75A3, 00, AMD Instinct MI355X
75B0, C0, AMD Instinct MI350X VF 75B0, 00, AMD Instinct MI350X VF
75B3, C0, AMD Instinct MI355X VF 75B3, 00, AMD Instinct MI355X VF
9830, 00, AMD Radeon HD 8400 / R3 Series 9830, 00, AMD Radeon HD 8400 / R3 Series
9831, 00, AMD Radeon HD 8400E 9831, 00, AMD Radeon HD 8400E
9832, 00, AMD Radeon HD 8330 9832, 00, AMD Radeon HD 8330

View file

@ -34,7 +34,7 @@ towrite = sys.argv[2]
fm_re = { fm_re = {
'intel': r'^#define I915_FORMAT_MOD_(\w+)', 'intel': r'^#define I915_FORMAT_MOD_(\w+)',
'others': r'^#define DRM_FORMAT_MOD_((?:ARM|SAMSUNG|QCOM|VIVANTE|NVIDIA|BROADCOM|ALLWINNER)\w+)\s', 'others': r'^#define DRM_FORMAT_MOD_((?:ARM|APPLE|SAMSUNG|QCOM|VIVANTE|NVIDIA|BROADCOM|ALLWINNER)\w+)\s',
'vendors': r'^#define DRM_FORMAT_MOD_VENDOR_(\w+)' 'vendors': r'^#define DRM_FORMAT_MOD_VENDOR_(\w+)'
} }

View file

@ -900,6 +900,21 @@ struct drm_get_cap {
*/ */
#define DRM_CLIENT_CAP_CURSOR_PLANE_HOTSPOT 6 #define DRM_CLIENT_CAP_CURSOR_PLANE_HOTSPOT 6
/**
* DRM_CLIENT_CAP_PLANE_COLOR_PIPELINE
*
* If set to 1 the DRM core will allow setting the COLOR_PIPELINE
* property on a &drm_plane, as well as drm_colorop properties.
*
* Setting of these plane properties will be rejected when this client
* cap is set:
* - COLOR_ENCODING
* - COLOR_RANGE
*
* The client must enable &DRM_CLIENT_CAP_ATOMIC first.
*/
#define DRM_CLIENT_CAP_PLANE_COLOR_PIPELINE 7
/* DRM_IOCTL_SET_CLIENT_CAP ioctl argument type */ /* DRM_IOCTL_SET_CLIENT_CAP ioctl argument type */
struct drm_set_client_cap { struct drm_set_client_cap {
__u64 capability; __u64 capability;

View file

@ -979,14 +979,20 @@ extern "C" {
* 2 = Gob Height 8, Turing+ Page Kind mapping * 2 = Gob Height 8, Turing+ Page Kind mapping
* 3 = Reserved for future use. * 3 = Reserved for future use.
* *
* 22:22 s Sector layout. On Tegra GPUs prior to Xavier, there is a further * 22:22 s Sector layout. There is a further bit remapping step that occurs
* bit remapping step that occurs at an even lower level than the * 26:27 at an even lower level than the page kind and block linear
* page kind and block linear swizzles. This causes the layout of * swizzles. This causes the bit arrangement of surfaces in memory
* surfaces mapped in those SOC's GPUs to be incompatible with the * to differ subtly, and prevents direct sharing of surfaces between
* equivalent mapping on other GPUs in the same system. * GPUs with different layouts.
* *
* 0 = Tegra K1 - Tegra Parker/TX2 Layout. * 0 = Tegra K1 - Tegra Parker/TX2 Layout
* 1 = Desktop GPU and Tegra Xavier+ Layout * 1 = Pre-GB20x, GB20x 32+ bpp, GB10, Tegra Xavier-Orin Layout
* 2 = GB20x(Blackwell 2)+ 8 bpp surface layout
* 3 = GB20x(Blackwell 2)+ 16 bpp surface layout
* 4 = Reserved for future use.
* 5 = Reserved for future use.
* 6 = Reserved for future use.
* 7 = Reserved for future use.
* *
* 25:23 c Lossless Framebuffer Compression type. * 25:23 c Lossless Framebuffer Compression type.
* *
@ -1001,7 +1007,7 @@ extern "C" {
* 6 = Reserved for future use * 6 = Reserved for future use
* 7 = Reserved for future use * 7 = Reserved for future use
* *
* 55:25 - Reserved for future use. Must be zero. * 55:28 - Reserved for future use. Must be zero.
*/ */
#define DRM_FORMAT_MOD_NVIDIA_BLOCK_LINEAR_2D(c, s, g, k, h) \ #define DRM_FORMAT_MOD_NVIDIA_BLOCK_LINEAR_2D(c, s, g, k, h) \
fourcc_mod_code(NVIDIA, (0x10 | \ fourcc_mod_code(NVIDIA, (0x10 | \
@ -1009,6 +1015,7 @@ extern "C" {
(((k) & 0xff) << 12) | \ (((k) & 0xff) << 12) | \
(((g) & 0x3) << 20) | \ (((g) & 0x3) << 20) | \
(((s) & 0x1) << 22) | \ (((s) & 0x1) << 22) | \
(((s) & 0x6) << 25) | \
(((c) & 0x7) << 23))) (((c) & 0x7) << 23)))
/* To grandfather in prior block linear format modifiers to the above layout, /* To grandfather in prior block linear format modifiers to the above layout,

View file

@ -629,6 +629,7 @@ struct drm_mode_connector_set_property {
#define DRM_MODE_OBJECT_FB 0xfbfbfbfb #define DRM_MODE_OBJECT_FB 0xfbfbfbfb
#define DRM_MODE_OBJECT_BLOB 0xbbbbbbbb #define DRM_MODE_OBJECT_BLOB 0xbbbbbbbb
#define DRM_MODE_OBJECT_PLANE 0xeeeeeeee #define DRM_MODE_OBJECT_PLANE 0xeeeeeeee
#define DRM_MODE_OBJECT_COLOROP 0xfafafafa
#define DRM_MODE_OBJECT_ANY 0 #define DRM_MODE_OBJECT_ANY 0
struct drm_mode_obj_get_properties { struct drm_mode_obj_get_properties {
@ -846,6 +847,20 @@ struct drm_color_ctm {
__u64 matrix[9]; __u64 matrix[9];
}; };
struct drm_color_ctm_3x4 {
/*
* Conversion matrix with 3x4 dimensions in S31.32 sign-magnitude
* (not two's complement!) format.
*
* out matrix in
* |R| |0 1 2 3 | | R |
* |G| = |4 5 6 7 | x | G |
* |B| |8 9 10 11| | B |
* |1.0|
*/
__u64 matrix[12];
};
struct drm_color_lut { struct drm_color_lut {
/* /*
* Values are mapped linearly to 0.0 - 1.0 range, with 0x0 == 0.0 and * Values are mapped linearly to 0.0 - 1.0 range, with 0x0 == 0.0 and
@ -857,6 +872,125 @@ struct drm_color_lut {
__u16 reserved; __u16 reserved;
}; };
/*
* struct drm_color_lut32
*
* 32-bit per channel color LUT entry, similar to drm_color_lut.
*/
struct drm_color_lut32 {
__u32 red;
__u32 green;
__u32 blue;
__u32 reserved;
};
/**
* enum drm_colorop_type - Type of color operation
*
* drm_colorops can be of many different types. Each type behaves differently
* and defines a different set of properties. This enum defines all types and
* gives a high-level description.
*/
enum drm_colorop_type {
/**
* @DRM_COLOROP_1D_CURVE:
*
* enum string "1D Curve"
*
* A 1D curve that is being applied to all color channels. The
* curve is specified via the CURVE_1D_TYPE colorop property.
*/
DRM_COLOROP_1D_CURVE,
/**
* @DRM_COLOROP_1D_LUT:
*
* enum string "1D LUT"
*
* A simple 1D LUT of uniformly spaced &drm_color_lut32 entries,
* packed into a blob via the DATA property. The driver's
* expected LUT size is advertised via the SIZE property.
*
* The DATA blob is an array of struct drm_color_lut32 with size
* of "size".
*/
DRM_COLOROP_1D_LUT,
/**
* @DRM_COLOROP_CTM_3X4:
*
* enum string "3x4 Matrix"
*
* A 3x4 matrix. Its values are specified via the
* &drm_color_ctm_3x4 struct provided via the DATA property.
*
* The DATA blob is a float[12]:
* out matrix in
* | R | | 0 1 2 3 | | R |
* | G | = | 4 5 6 7 | x | G |
* | B | | 8 9 10 12 | | B |
*/
DRM_COLOROP_CTM_3X4,
/**
* @DRM_COLOROP_MULTIPLIER:
*
* enum string "Multiplier"
*
* A simple multiplier, applied to all color values. The
* multiplier is specified as a S31.32 via the MULTIPLIER
* property.
*/
DRM_COLOROP_MULTIPLIER,
/**
* @DRM_COLOROP_3D_LUT:
*
* enum string "3D LUT"
*
* A 3D LUT of &drm_color_lut32 entries,
* packed into a blob via the DATA property. The driver's expected
* LUT size is advertised via the SIZE property, i.e., a 3D LUT with
* 17x17x17 entries will have SIZE set to 17.
*
* The DATA blob is a 3D array of struct drm_color_lut32 with dimension
* length of "size".
* The LUT elements are traversed like so:
*
* for B in range 0..n
* for G in range 0..n
* for R in range 0..n
* index = R + n * (G + n * B)
* color = lut3d[index]
*/
DRM_COLOROP_3D_LUT,
};
/**
* enum drm_colorop_lut3d_interpolation_type - type of 3DLUT interpolation
*/
enum drm_colorop_lut3d_interpolation_type {
/**
* @DRM_COLOROP_LUT3D_INTERPOLATION_TETRAHEDRAL:
*
* Tetrahedral 3DLUT interpolation
*/
DRM_COLOROP_LUT3D_INTERPOLATION_TETRAHEDRAL,
};
/**
* enum drm_colorop_lut1d_interpolation_type - type of interpolation for 1D LUTs
*/
enum drm_colorop_lut1d_interpolation_type {
/**
* @DRM_COLOROP_LUT1D_INTERPOLATION_LINEAR:
*
* Linear interpolation. Values between points of the LUT will be
* linearly interpolated.
*/
DRM_COLOROP_LUT1D_INTERPOLATION_LINEAR,
};
/** /**
* struct drm_plane_size_hint - Plane size hints * struct drm_plane_size_hint - Plane size hints
* @width: The width of the plane in pixel * @width: The width of the plane in pixel

View file

@ -46,12 +46,16 @@ extern "C" {
#define DRM_VIRTGPU_TRANSFER_TO_HOST 0x07 #define DRM_VIRTGPU_TRANSFER_TO_HOST 0x07
#define DRM_VIRTGPU_WAIT 0x08 #define DRM_VIRTGPU_WAIT 0x08
#define DRM_VIRTGPU_GET_CAPS 0x09 #define DRM_VIRTGPU_GET_CAPS 0x09
#define DRM_VIRTGPU_RESOURCE_CREATE_BLOB 0x0a
#define DRM_VIRTGPU_CONTEXT_INIT 0x0b
#define VIRTGPU_EXECBUF_FENCE_FD_IN 0x01 #define VIRTGPU_EXECBUF_FENCE_FD_IN 0x01
#define VIRTGPU_EXECBUF_FENCE_FD_OUT 0x02 #define VIRTGPU_EXECBUF_FENCE_FD_OUT 0x02
#define VIRTGPU_EXECBUF_RING_IDX 0x04
#define VIRTGPU_EXECBUF_FLAGS (\ #define VIRTGPU_EXECBUF_FLAGS (\
VIRTGPU_EXECBUF_FENCE_FD_IN |\ VIRTGPU_EXECBUF_FENCE_FD_IN |\
VIRTGPU_EXECBUF_FENCE_FD_OUT |\ VIRTGPU_EXECBUF_FENCE_FD_OUT |\
VIRTGPU_EXECBUF_RING_IDX |\
0) 0)
struct drm_virtgpu_map { struct drm_virtgpu_map {
@ -60,6 +64,17 @@ struct drm_virtgpu_map {
__u32 pad; __u32 pad;
}; };
#define VIRTGPU_EXECBUF_SYNCOBJ_RESET 0x01
#define VIRTGPU_EXECBUF_SYNCOBJ_FLAGS ( \
VIRTGPU_EXECBUF_SYNCOBJ_RESET | \
0)
struct drm_virtgpu_execbuffer_syncobj {
__u32 handle;
__u32 flags;
__u64 point;
};
/* fence_fd is modified on success if VIRTGPU_EXECBUF_FENCE_FD_OUT flag is set. */
struct drm_virtgpu_execbuffer { struct drm_virtgpu_execbuffer {
__u32 flags; __u32 flags;
__u32 size; __u32 size;
@ -67,10 +82,22 @@ struct drm_virtgpu_execbuffer {
__u64 bo_handles; __u64 bo_handles;
__u32 num_bo_handles; __u32 num_bo_handles;
__s32 fence_fd; /* in/out fence fd (see VIRTGPU_EXECBUF_FENCE_FD_IN/OUT) */ __s32 fence_fd; /* in/out fence fd (see VIRTGPU_EXECBUF_FENCE_FD_IN/OUT) */
__u32 ring_idx; /* command ring index (see VIRTGPU_EXECBUF_RING_IDX) */
__u32 syncobj_stride; /* size of @drm_virtgpu_execbuffer_syncobj */
__u32 num_in_syncobjs;
__u32 num_out_syncobjs;
__u64 in_syncobjs;
__u64 out_syncobjs;
}; };
#define VIRTGPU_PARAM_3D_FEATURES 1 /* do we have 3D features in the hw */ #define VIRTGPU_PARAM_3D_FEATURES 1 /* do we have 3D features in the hw */
#define VIRTGPU_PARAM_CAPSET_QUERY_FIX 2 /* do we have the capset fix */ #define VIRTGPU_PARAM_CAPSET_QUERY_FIX 2 /* do we have the capset fix */
#define VIRTGPU_PARAM_RESOURCE_BLOB 3 /* DRM_VIRTGPU_RESOURCE_CREATE_BLOB */
#define VIRTGPU_PARAM_HOST_VISIBLE 4 /* Host blob resources are mappable */
#define VIRTGPU_PARAM_CROSS_DEVICE 5 /* Cross virtio-device resource sharing */
#define VIRTGPU_PARAM_CONTEXT_INIT 6 /* DRM_VIRTGPU_CONTEXT_INIT */
#define VIRTGPU_PARAM_SUPPORTED_CAPSET_IDs 7 /* Bitmask of supported capability set ids */
#define VIRTGPU_PARAM_EXPLICIT_DEBUG_NAME 8 /* Ability to set debug name from userspace */
struct drm_virtgpu_getparam { struct drm_virtgpu_getparam {
__u64 param; __u64 param;
@ -100,7 +127,7 @@ struct drm_virtgpu_resource_info {
__u32 bo_handle; __u32 bo_handle;
__u32 res_handle; __u32 res_handle;
__u32 size; __u32 size;
__u32 stride; __u32 blob_mem;
}; };
struct drm_virtgpu_3d_box { struct drm_virtgpu_3d_box {
@ -117,6 +144,8 @@ struct drm_virtgpu_3d_transfer_to_host {
struct drm_virtgpu_3d_box box; struct drm_virtgpu_3d_box box;
__u32 level; __u32 level;
__u32 offset; __u32 offset;
__u32 stride;
__u32 layer_stride;
}; };
struct drm_virtgpu_3d_transfer_from_host { struct drm_virtgpu_3d_transfer_from_host {
@ -124,6 +153,8 @@ struct drm_virtgpu_3d_transfer_from_host {
struct drm_virtgpu_3d_box box; struct drm_virtgpu_3d_box box;
__u32 level; __u32 level;
__u32 offset; __u32 offset;
__u32 stride;
__u32 layer_stride;
}; };
#define VIRTGPU_WAIT_NOWAIT 1 /* like it */ #define VIRTGPU_WAIT_NOWAIT 1 /* like it */
@ -132,6 +163,12 @@ struct drm_virtgpu_3d_wait {
__u32 flags; __u32 flags;
}; };
#define VIRTGPU_DRM_CAPSET_VIRGL 1
#define VIRTGPU_DRM_CAPSET_VIRGL2 2
#define VIRTGPU_DRM_CAPSET_GFXSTREAM_VULKAN 3
#define VIRTGPU_DRM_CAPSET_VENUS 4
#define VIRTGPU_DRM_CAPSET_CROSS_DOMAIN 5
#define VIRTGPU_DRM_CAPSET_DRM 6
struct drm_virtgpu_get_caps { struct drm_virtgpu_get_caps {
__u32 cap_set_id; __u32 cap_set_id;
__u32 cap_set_ver; __u32 cap_set_ver;
@ -140,6 +177,55 @@ struct drm_virtgpu_get_caps {
__u32 pad; __u32 pad;
}; };
struct drm_virtgpu_resource_create_blob {
#define VIRTGPU_BLOB_MEM_GUEST 0x0001
#define VIRTGPU_BLOB_MEM_HOST3D 0x0002
#define VIRTGPU_BLOB_MEM_HOST3D_GUEST 0x0003
#define VIRTGPU_BLOB_FLAG_USE_MAPPABLE 0x0001
#define VIRTGPU_BLOB_FLAG_USE_SHAREABLE 0x0002
#define VIRTGPU_BLOB_FLAG_USE_CROSS_DEVICE 0x0004
/* zero is invalid blob_mem */
__u32 blob_mem;
__u32 blob_flags;
__u32 bo_handle;
__u32 res_handle;
__u64 size;
/*
* for 3D contexts with VIRTGPU_BLOB_MEM_HOST3D_GUEST and
* VIRTGPU_BLOB_MEM_HOST3D otherwise, must be zero.
*/
__u32 pad;
__u32 cmd_size;
__u64 cmd;
__u64 blob_id;
};
#define VIRTGPU_CONTEXT_PARAM_CAPSET_ID 0x0001
#define VIRTGPU_CONTEXT_PARAM_NUM_RINGS 0x0002
#define VIRTGPU_CONTEXT_PARAM_POLL_RINGS_MASK 0x0003
#define VIRTGPU_CONTEXT_PARAM_DEBUG_NAME 0x0004
struct drm_virtgpu_context_set_param {
__u64 param;
__u64 value;
};
struct drm_virtgpu_context_init {
__u32 num_params;
__u32 pad;
/* pointer to drm_virtgpu_context_set_param array */
__u64 ctx_set_params;
};
/*
* Event code that's given when VIRTGPU_CONTEXT_PARAM_POLL_RINGS_MASK is in
* effect. The event size is sizeof(drm_event), since there is no additional
* payload.
*/
#define VIRTGPU_EVENT_FENCE_SIGNALED 0x90000000
#define DRM_IOCTL_VIRTGPU_MAP \ #define DRM_IOCTL_VIRTGPU_MAP \
DRM_IOWR(DRM_COMMAND_BASE + DRM_VIRTGPU_MAP, struct drm_virtgpu_map) DRM_IOWR(DRM_COMMAND_BASE + DRM_VIRTGPU_MAP, struct drm_virtgpu_map)
@ -175,6 +261,14 @@ struct drm_virtgpu_get_caps {
DRM_IOWR(DRM_COMMAND_BASE + DRM_VIRTGPU_GET_CAPS, \ DRM_IOWR(DRM_COMMAND_BASE + DRM_VIRTGPU_GET_CAPS, \
struct drm_virtgpu_get_caps) struct drm_virtgpu_get_caps)
#define DRM_IOCTL_VIRTGPU_RESOURCE_CREATE_BLOB \
DRM_IOWR(DRM_COMMAND_BASE + DRM_VIRTGPU_RESOURCE_CREATE_BLOB, \
struct drm_virtgpu_resource_create_blob)
#define DRM_IOCTL_VIRTGPU_CONTEXT_INIT \
DRM_IOWR(DRM_COMMAND_BASE + DRM_VIRTGPU_CONTEXT_INIT, \
struct drm_virtgpu_context_init)
#if defined(__cplusplus) #if defined(__cplusplus)
} }
#endif #endif

View file

@ -26,7 +26,7 @@
project( project(
'libdrm', 'libdrm',
['c'], ['c'],
version : '2.4.129', version : '2.4.133',
license : 'MIT', license : 'MIT',
meson_version : '>= 0.59', meson_version : '>= 0.59',
default_options : ['buildtype=debugoptimized', 'c_std=c11'], default_options : ['buildtype=debugoptimized', 'c_std=c11'],
@ -51,6 +51,8 @@ dep_threads = dependency('threads')
cc = meson.get_compiler('c') cc = meson.get_compiler('c')
config.set10('HAVE_SECURE_GETENV', cc.has_function('secure_getenv'))
android = cc.compiles('''int func() { return __ANDROID__; }''') android = cc.compiles('''int func() { return __ANDROID__; }''')
# Solaris / Illumos # Solaris / Illumos

View file

@ -46,13 +46,11 @@ option(
option( option(
'omap', 'omap',
type : 'feature', type : 'feature',
value : 'disabled',
description : '''Enable support for OMAP's experimental KMS API.''', description : '''Enable support for OMAP's experimental KMS API.''',
) )
option( option(
'exynos', 'exynos',
type : 'feature', type : 'feature',
value : 'disabled',
description : '''Enable support for EXYNOS's experimental KMS API.''', description : '''Enable support for EXYNOS's experimental KMS API.''',
) )
option( option(
@ -63,7 +61,6 @@ option(
option( option(
'tegra', 'tegra',
type : 'feature', type : 'feature',
value : 'disabled',
description : '''Enable support for Tegra's experimental KMS API.''', description : '''Enable support for Tegra's experimental KMS API.''',
) )
option( option(

View file

@ -27,7 +27,6 @@
*/ */
#include <stdlib.h> #include <stdlib.h>
#include <linux/types.h>
#include <errno.h> #include <errno.h>
#include <sys/mman.h> #include <sys/mman.h>
#include <fcntl.h> #include <fcntl.h>
@ -41,10 +40,6 @@
#include "omap_drm.h" #include "omap_drm.h"
#include "omap_drmif.h" #include "omap_drmif.h"
#define __round_mask(x, y) ((__typeof__(x))((y)-1))
#define round_up(x, y) ((((x)-1) | __round_mask(x, y))+1)
#define PAGE_SIZE 4096
static pthread_mutex_t table_lock = PTHREAD_MUTEX_INITIALIZER; static pthread_mutex_t table_lock = PTHREAD_MUTEX_INITIALIZER;
static void * dev_table; static void * dev_table;
@ -207,12 +202,6 @@ static struct omap_bo * omap_bo_new_impl(struct omap_device *dev,
bo = bo_from_handle(dev, req.handle); bo = bo_from_handle(dev, req.handle);
pthread_mutex_unlock(&table_lock); pthread_mutex_unlock(&table_lock);
if (flags & OMAP_BO_TILED) {
bo->size = round_up(size.tiled.width, PAGE_SIZE) * size.tiled.height;
} else {
bo->size = size.bytes;
}
return bo; return bo;
fail: fail:
@ -432,7 +421,7 @@ drm_public uint32_t omap_bo_size(struct omap_bo *bo)
drm_public void *omap_bo_map(struct omap_bo *bo) drm_public void *omap_bo_map(struct omap_bo *bo)
{ {
if (!bo->map) { if (!bo->map) {
if (!bo->offset) { if (!bo->size || !bo->offset) {
get_buffer_info(bo); get_buffer_info(bo);
} }

View file

@ -1974,7 +1974,8 @@ static int parse_connector(struct pipe_arg *pipe, const char *arg)
unsigned int len; unsigned int len;
unsigned int i; unsigned int i;
const char *p; const char *p;
char *endp; const char *endp;
char *endp_tok;
pipe->vrefresh = 0; pipe->vrefresh = 0;
pipe->crtc_id = (uint32_t)-1; pipe->crtc_id = (uint32_t)-1;
@ -2012,7 +2013,8 @@ static int parse_connector(struct pipe_arg *pipe, const char *arg)
return -1; return -1;
if (*endp == '@') { if (*endp == '@') {
arg = endp + 1; arg = endp + 1;
pipe->crtc_id = strtoul(arg, &endp, 10); pipe->crtc_id = strtoul(arg, &endp_tok, 10);
endp = endp_tok;
} }
if (*endp != ':') if (*endp != ':')
return -1; return -1;
@ -2028,8 +2030,8 @@ static int parse_connector(struct pipe_arg *pipe, const char *arg)
pipe->mode_str[len] = '\0'; pipe->mode_str[len] = '\0';
if (*p == '-') { if (*p == '-') {
pipe->vrefresh = strtof(p + 1, &endp); pipe->vrefresh = strtof(p + 1, &endp_tok);
p = endp; p = endp_tok;
} }
if (*p == '@') { if (*p == '@') {

View file

@ -24,6 +24,8 @@
#ifndef _UTIL_MATH_H_ #ifndef _UTIL_MATH_H_
#define _UTIL_MATH_H_ #define _UTIL_MATH_H_
#include <stdint.h>
#define MIN2( A, B ) ( (A)<(B) ? (A) : (B) ) #define MIN2( A, B ) ( (A)<(B) ? (A) : (B) )
#define MAX2( A, B ) ( (A)>(B) ? (A) : (B) ) #define MAX2( A, B ) ( (A)>(B) ? (A) : (B) )
#define MAX3( A, B, C ) ((A) > (B) ? MAX2(A, C) : MAX2(B, C)) #define MAX3( A, B, C ) ((A) > (B) ? MAX2(A, C) : MAX2(B, C))
@ -31,4 +33,25 @@
#define __align_mask(value, mask) (((value) + (mask)) & ~(mask)) #define __align_mask(value, mask) (((value) + (mask)) & ~(mask))
#define ALIGN(value, alignment) __align_mask(value, (__typeof__(value))((alignment) - 1)) #define ALIGN(value, alignment) __align_mask(value, (__typeof__(value))((alignment) - 1))
static inline unsigned
util_last_bit64(uint64_t u)
{
#if defined(HAVE___BUILTIN_CLZLL)
return u == 0 ? 0 : 64 - __builtin_clzll(u);
#elif defined(_MSC_VER) && (_M_AMD64 || _M_ARM64 || _M_IA64)
unsigned long index;
if (_BitScanReverse64(&index, u))
return index + 1;
else
return 0;
#else
unsigned r = 0;
while (u) {
r++;
u >>= 1;
}
return r;
#endif
}
#endif /*_UTIL_MATH_H_*/ #endif /*_UTIL_MATH_H_*/

View file

@ -348,9 +348,10 @@ drmGetFormatModifierNameFromNvidia(uint64_t modifier)
* testing against TEGRA_TILE */ * testing against TEGRA_TILE */
if ((modifier & 0x10) == 0x10) { if ((modifier & 0x10) == 0x10) {
char *mod_nvidia; char *mod_nvidia;
asprintf(&mod_nvidia, "BLOCK_LINEAR_2D,HEIGHT=%"PRIu64",KIND=%"PRIu64"," if (asprintf(&mod_nvidia, "BLOCK_LINEAR_2D,HEIGHT=%"PRIu64",KIND=%"PRIu64","
"GEN=%"PRIu64",SECTOR=%"PRIu64",COMPRESSION=%"PRIu64"", height, "GEN=%"PRIu64",SECTOR=%"PRIu64",COMPRESSION=%"PRIu64"", height,
kind, gen, sector, compression); kind, gen, sector, compression) < 0)
mod_nvidia = NULL;
return mod_nvidia; return mod_nvidia;
} }
@ -542,7 +543,8 @@ drmGetFormatModifierNameFromAmlogic(uint64_t modifier)
else else
opts_str = "0"; opts_str = "0";
asprintf(&mod_amlogic, "FBC,LAYOUT=%s,OPTIONS=%s", layout_str, opts_str); if (asprintf(&mod_amlogic, "FBC,LAYOUT=%s,OPTIONS=%s", layout_str, opts_str) < 0)
mod_amlogic = NULL;
return mod_amlogic; return mod_amlogic;
} }
@ -606,7 +608,8 @@ drmGetFormatModifierNameFromVivante(uint64_t modifier)
break; break;
} }
asprintf(&mod_vivante, "%s%s%s", color_tiling, tile_status, compression); if (asprintf(&mod_vivante, "%s%s%s", color_tiling, tile_status, compression) < 0)
mod_vivante = NULL;
return mod_vivante; return mod_vivante;
} }