mirror of
https://gitlab.freedesktop.org/mesa/drm.git
synced 2025-12-20 12:50:11 +01:00
Compare commits
15 commits
libdrm-2.4
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
369990d966 | ||
|
|
6bfcfc725f | ||
|
|
64ef303d70 | ||
|
|
b7861fb536 | ||
|
|
523534ee01 | ||
|
|
1b68532f88 | ||
|
|
bef7c6fcf1 | ||
|
|
b71953a199 | ||
|
|
d72d7c6eef | ||
|
|
a050f86ed8 | ||
|
|
c3c7fb21aa | ||
|
|
a8e5e10a87 | ||
|
|
31e68ea81c | ||
|
|
35a21916c8 | ||
|
|
3968028058 |
9 changed files with 540 additions and 41 deletions
12
README.rst
12
README.rst
|
|
@ -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
|
||||
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.
|
||||
|
|
@ -22,6 +22,11 @@
|
|||
*
|
||||
*/
|
||||
|
||||
// secure_getenv requires _GNU_SOURCE
|
||||
#ifndef _GNU_SOURCE
|
||||
#define _GNU_SOURCE
|
||||
#endif
|
||||
|
||||
#include <ctype.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
|
@ -160,6 +165,112 @@ static void amdgpu_parse_proc_cpuinfo(struct amdgpu_device *dev)
|
|||
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");
|
||||
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)
|
||||
{
|
||||
FILE *fp;
|
||||
|
|
@ -169,9 +280,19 @@ void amdgpu_parse_asic_ids(struct amdgpu_device *dev)
|
|||
int line_num = 1;
|
||||
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) {
|
||||
fprintf(stderr, "%s: %s\n", AMDGPU_ASIC_ID_TABLE,
|
||||
fprintf(stderr, "%s: %s\n", amdgpu_asic_id_table_path,
|
||||
strerror(errno));
|
||||
goto get_cpu;
|
||||
}
|
||||
|
|
@ -188,7 +309,7 @@ void amdgpu_parse_asic_ids(struct amdgpu_device *dev)
|
|||
continue;
|
||||
}
|
||||
|
||||
drmMsg("%s version: %s\n", AMDGPU_ASIC_ID_TABLE, line);
|
||||
drmMsg("%s version: %s\n", amdgpu_asic_id_table_path, line);
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
@ -206,7 +327,7 @@ void amdgpu_parse_asic_ids(struct amdgpu_device *dev)
|
|||
|
||||
if (r == -EINVAL) {
|
||||
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) {
|
||||
fprintf(stderr, "%s: Cannot parse ASIC IDs: %s\n",
|
||||
__func__, strerror(-r));
|
||||
|
|
@ -216,6 +337,7 @@ void amdgpu_parse_asic_ids(struct amdgpu_device *dev)
|
|||
fclose(fp);
|
||||
|
||||
get_cpu:
|
||||
free(amdgpu_asic_id_table_path);
|
||||
if (dev->info.ids_flags & AMDGPU_IDS_FLAGS_FUSION &&
|
||||
dev->marketing_name == NULL) {
|
||||
amdgpu_parse_proc_cpuinfo(dev);
|
||||
|
|
|
|||
|
|
@ -39,11 +39,11 @@
|
|||
1506, C3, AMD Radeon 610M
|
||||
1506, C4, AMD Radeon 610M
|
||||
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, C6, 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
|
||||
1586, C1, Radeon 8060S Graphics
|
||||
1586, C2, Radeon 8050S Graphics
|
||||
|
|
@ -557,6 +557,7 @@
|
|||
7448, 00, AMD Radeon Pro W7900
|
||||
7449, 00, AMD Radeon Pro W7800 48GB
|
||||
744A, 00, AMD Radeon Pro W7900 Dual Slot
|
||||
744B, 00, AMD Radeon Pro W7900D
|
||||
744C, C8, AMD Radeon RX 7900 XTX
|
||||
744C, CC, AMD Radeon RX 7900 XT
|
||||
744C, CE, AMD Radeon RX 7900 GRE
|
||||
|
|
@ -567,6 +568,7 @@
|
|||
7470, 00, AMD Radeon Pro W7700
|
||||
747E, C8, AMD Radeon RX 7800 XT
|
||||
747E, D8, AMD Radeon RX 7800M
|
||||
747E, DB, AMD Radeon RX 7700
|
||||
747E, FF, AMD Radeon RX 7700 XT
|
||||
7480, 00, AMD Radeon Pro W7600
|
||||
7480, C0, AMD Radeon RX 7600 XT
|
||||
|
|
@ -575,6 +577,7 @@
|
|||
7480, C3, AMD Radeon RX 7600S
|
||||
7480, C7, AMD Radeon RX 7600M XT
|
||||
7480, CF, AMD Radeon RX 7600
|
||||
7481, C7, AMD Steam Machine
|
||||
7483, CF, AMD Radeon RX 7600M
|
||||
7489, 00, AMD Radeon Pro W7500
|
||||
7499, 00, AMD Radeon Pro W7400
|
||||
|
|
@ -584,6 +587,7 @@
|
|||
74A1, 00, AMD Instinct MI300X
|
||||
74A2, 00, AMD Instinct MI308X
|
||||
74A5, 00, AMD Instinct MI325X
|
||||
74A8, 00, AMD Instinct MI308X HF
|
||||
74A9, 00, AMD Instinct MI300X HF
|
||||
74B5, 00, AMD Instinct MI300X VF
|
||||
74B6, 00, AMD Instinct MI308X
|
||||
|
|
@ -592,6 +596,12 @@
|
|||
7550, C2, AMD Radeon RX 9070 GRE
|
||||
7550, C3, AMD Radeon RX 9070
|
||||
7551, C0, AMD Radeon AI PRO R9700
|
||||
7590, C0, AMD Radeon RX 9060 XT
|
||||
7590, C7, AMD Radeon RX 9060
|
||||
75A0, C0, AMD Instinct MI350X
|
||||
75A3, C0, AMD Instinct MI355X
|
||||
75B0, C0, AMD Instinct MI350X VF
|
||||
75B3, C0, AMD Instinct MI355X VF
|
||||
9830, 00, AMD Radeon HD 8400 / R3 Series
|
||||
9831, 00, AMD Radeon HD 8400E
|
||||
9832, 00, AMD Radeon HD 8330
|
||||
|
|
|
|||
|
|
@ -591,34 +591,65 @@ struct drm_set_version {
|
|||
int drm_dd_minor;
|
||||
};
|
||||
|
||||
/* DRM_IOCTL_GEM_CLOSE ioctl argument type */
|
||||
/**
|
||||
* struct drm_gem_close - Argument for &DRM_IOCTL_GEM_CLOSE ioctl.
|
||||
* @handle: Handle of the object to be closed.
|
||||
* @pad: Padding.
|
||||
*
|
||||
* Releases the handle to an mm object.
|
||||
*/
|
||||
struct drm_gem_close {
|
||||
/** Handle of the object to be closed. */
|
||||
__u32 handle;
|
||||
__u32 pad;
|
||||
};
|
||||
|
||||
/* DRM_IOCTL_GEM_FLINK ioctl argument type */
|
||||
/**
|
||||
* struct drm_gem_flink - Argument for &DRM_IOCTL_GEM_FLINK ioctl.
|
||||
* @handle: Handle for the object being named.
|
||||
* @name: Returned global name.
|
||||
*
|
||||
* Create a global name for an object, returning the name.
|
||||
*
|
||||
* Note that the name does not hold a reference; when the object
|
||||
* is freed, the name goes away.
|
||||
*/
|
||||
struct drm_gem_flink {
|
||||
/** Handle for the object being named */
|
||||
__u32 handle;
|
||||
|
||||
/** Returned global name */
|
||||
__u32 name;
|
||||
};
|
||||
|
||||
/* DRM_IOCTL_GEM_OPEN ioctl argument type */
|
||||
/**
|
||||
* struct drm_gem_open - Argument for &DRM_IOCTL_GEM_OPEN ioctl.
|
||||
* @name: Name of object being opened.
|
||||
* @handle: Returned handle for the object.
|
||||
* @size: Returned size of the object
|
||||
*
|
||||
* Open an object using the global name, returning a handle and the size.
|
||||
*
|
||||
* This handle (of course) holds a reference to the object, so the object
|
||||
* will not go away until the handle is deleted.
|
||||
*/
|
||||
struct drm_gem_open {
|
||||
/** Name of object being opened */
|
||||
__u32 name;
|
||||
|
||||
/** Returned handle for the object */
|
||||
__u32 handle;
|
||||
|
||||
/** Returned size of the object */
|
||||
__u64 size;
|
||||
};
|
||||
|
||||
/**
|
||||
* struct drm_gem_change_handle - Argument for &DRM_IOCTL_GEM_CHANGE_HANDLE ioctl.
|
||||
* @handle: The handle of a gem object.
|
||||
* @new_handle: An available gem handle.
|
||||
*
|
||||
* This ioctl changes the handle of a GEM object to the specified one.
|
||||
* The new handle must be unused. On success the old handle is closed
|
||||
* and all further IOCTL should refer to the new handle only.
|
||||
* Calls to DRM_IOCTL_PRIME_FD_TO_HANDLE will return the new handle.
|
||||
*/
|
||||
struct drm_gem_change_handle {
|
||||
__u32 handle;
|
||||
__u32 new_handle;
|
||||
};
|
||||
|
||||
/**
|
||||
* DRM_CAP_DUMB_BUFFER
|
||||
*
|
||||
|
|
@ -869,6 +900,21 @@ struct drm_get_cap {
|
|||
*/
|
||||
#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 */
|
||||
struct drm_set_client_cap {
|
||||
__u64 capability;
|
||||
|
|
@ -1303,6 +1349,14 @@ extern "C" {
|
|||
*/
|
||||
#define DRM_IOCTL_SET_CLIENT_NAME DRM_IOWR(0xD1, struct drm_set_client_name)
|
||||
|
||||
/**
|
||||
* DRM_IOCTL_GEM_CHANGE_HANDLE - Move an object to a different handle
|
||||
*
|
||||
* Some applications (notably CRIU) need objects to have specific gem handles.
|
||||
* This ioctl changes the object at one gem handle to use a new gem handle.
|
||||
*/
|
||||
#define DRM_IOCTL_GEM_CHANGE_HANDLE DRM_IOWR(0xD2, struct drm_gem_change_handle)
|
||||
|
||||
/*
|
||||
* Device specific ioctls should only be in their respective headers
|
||||
* The device specific ioctl range is from 0x40 to 0x9f.
|
||||
|
|
|
|||
|
|
@ -210,6 +210,10 @@ extern "C" {
|
|||
#define DRM_FORMAT_RGBA1010102 fourcc_code('R', 'A', '3', '0') /* [31:0] R:G:B:A 10:10:10:2 little endian */
|
||||
#define DRM_FORMAT_BGRA1010102 fourcc_code('B', 'A', '3', '0') /* [31:0] B:G:R:A 10:10:10:2 little endian */
|
||||
|
||||
/* 48 bpp RGB */
|
||||
#define DRM_FORMAT_RGB161616 fourcc_code('R', 'G', '4', '8') /* [47:0] R:G:B 16:16:16 little endian */
|
||||
#define DRM_FORMAT_BGR161616 fourcc_code('B', 'G', '4', '8') /* [47:0] B:G:R 16:16:16 little endian */
|
||||
|
||||
/* 64 bpp RGB */
|
||||
#define DRM_FORMAT_XRGB16161616 fourcc_code('X', 'R', '4', '8') /* [63:0] x:R:G:B 16:16:16:16 little endian */
|
||||
#define DRM_FORMAT_XBGR16161616 fourcc_code('X', 'B', '4', '8') /* [63:0] x:B:G:R 16:16:16:16 little endian */
|
||||
|
|
@ -218,7 +222,7 @@ extern "C" {
|
|||
#define DRM_FORMAT_ABGR16161616 fourcc_code('A', 'B', '4', '8') /* [63:0] A:B:G:R 16:16:16:16 little endian */
|
||||
|
||||
/*
|
||||
* Floating point 64bpp RGB
|
||||
* Half-Floating point - 16b/component
|
||||
* IEEE 754-2008 binary16 half-precision float
|
||||
* [15:0] sign:exponent:mantissa 1:5:10
|
||||
*/
|
||||
|
|
@ -228,6 +232,20 @@ extern "C" {
|
|||
#define DRM_FORMAT_ARGB16161616F fourcc_code('A', 'R', '4', 'H') /* [63:0] A:R:G:B 16:16:16:16 little endian */
|
||||
#define DRM_FORMAT_ABGR16161616F fourcc_code('A', 'B', '4', 'H') /* [63:0] A:B:G:R 16:16:16:16 little endian */
|
||||
|
||||
#define DRM_FORMAT_R16F fourcc_code('R', ' ', ' ', 'H') /* [15:0] R 16 little endian */
|
||||
#define DRM_FORMAT_GR1616F fourcc_code('G', 'R', ' ', 'H') /* [31:0] G:R 16:16 little endian */
|
||||
#define DRM_FORMAT_BGR161616F fourcc_code('B', 'G', 'R', 'H') /* [47:0] B:G:R 16:16:16 little endian */
|
||||
|
||||
/*
|
||||
* Floating point - 32b/component
|
||||
* IEEE 754-2008 binary32 float
|
||||
* [31:0] sign:exponent:mantissa 1:8:23
|
||||
*/
|
||||
#define DRM_FORMAT_R32F fourcc_code('R', ' ', ' ', 'F') /* [31:0] R 32 little endian */
|
||||
#define DRM_FORMAT_GR3232F fourcc_code('G', 'R', ' ', 'F') /* [63:0] R:G 32:32 little endian */
|
||||
#define DRM_FORMAT_BGR323232F fourcc_code('B', 'G', 'R', 'F') /* [95:0] R:G:B 32:32:32 little endian */
|
||||
#define DRM_FORMAT_ABGR32323232F fourcc_code('A', 'B', '8', 'F') /* [127:0] R:G:B:A 32:32:32:32 little endian */
|
||||
|
||||
/*
|
||||
* RGBA format with 10-bit components packed in 64-bit per pixel, with 6 bits
|
||||
* of unused padding per component:
|
||||
|
|
@ -961,14 +979,20 @@ extern "C" {
|
|||
* 2 = Gob Height 8, Turing+ Page Kind mapping
|
||||
* 3 = Reserved for future use.
|
||||
*
|
||||
* 22:22 s Sector layout. On Tegra GPUs prior to Xavier, there is a further
|
||||
* bit remapping step that occurs at an even lower level than the
|
||||
* page kind and block linear swizzles. This causes the layout of
|
||||
* surfaces mapped in those SOC's GPUs to be incompatible with the
|
||||
* equivalent mapping on other GPUs in the same system.
|
||||
* 22:22 s Sector layout. There is a further bit remapping step that occurs
|
||||
* 26:27 at an even lower level than the page kind and block linear
|
||||
* swizzles. This causes the bit arrangement of surfaces in memory
|
||||
* to differ subtly, and prevents direct sharing of surfaces between
|
||||
* GPUs with different layouts.
|
||||
*
|
||||
* 0 = Tegra K1 - Tegra Parker/TX2 Layout.
|
||||
* 1 = Desktop GPU and Tegra Xavier+ Layout
|
||||
* 0 = Tegra K1 - Tegra Parker/TX2 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.
|
||||
*
|
||||
|
|
@ -983,7 +1007,7 @@ extern "C" {
|
|||
* 6 = 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) \
|
||||
fourcc_mod_code(NVIDIA, (0x10 | \
|
||||
|
|
@ -991,6 +1015,7 @@ extern "C" {
|
|||
(((k) & 0xff) << 12) | \
|
||||
(((g) & 0x3) << 20) | \
|
||||
(((s) & 0x1) << 22) | \
|
||||
(((s) & 0x6) << 25) | \
|
||||
(((c) & 0x7) << 23)))
|
||||
|
||||
/* To grandfather in prior block linear format modifiers to the above layout,
|
||||
|
|
|
|||
|
|
@ -629,6 +629,7 @@ struct drm_mode_connector_set_property {
|
|||
#define DRM_MODE_OBJECT_FB 0xfbfbfbfb
|
||||
#define DRM_MODE_OBJECT_BLOB 0xbbbbbbbb
|
||||
#define DRM_MODE_OBJECT_PLANE 0xeeeeeeee
|
||||
#define DRM_MODE_OBJECT_COLOROP 0xfafafafa
|
||||
#define DRM_MODE_OBJECT_ANY 0
|
||||
|
||||
struct drm_mode_obj_get_properties {
|
||||
|
|
@ -846,6 +847,20 @@ struct drm_color_ctm {
|
|||
__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 {
|
||||
/*
|
||||
* 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;
|
||||
};
|
||||
|
||||
/*
|
||||
* 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
|
||||
* @width: The width of the plane in pixel
|
||||
|
|
@ -962,6 +1096,14 @@ struct hdr_output_metadata {
|
|||
* Request that the kernel sends back a vblank event (see
|
||||
* struct drm_event_vblank) with the &DRM_EVENT_FLIP_COMPLETE type when the
|
||||
* page-flip is done.
|
||||
*
|
||||
* When used with atomic uAPI, one event will be delivered per CRTC included in
|
||||
* the atomic commit. A CRTC is included in an atomic commit if one of its
|
||||
* properties is set, or if a property is set on a connector or plane linked
|
||||
* via the CRTC_ID property to the CRTC. At least one CRTC must be included,
|
||||
* and all pulled in CRTCs must be either previously or newly powered on (in
|
||||
* other words, a powered off CRTC which stays off cannot be included in the
|
||||
* atomic commit).
|
||||
*/
|
||||
#define DRM_MODE_PAGE_FLIP_EVENT 0x01
|
||||
/**
|
||||
|
|
@ -1058,7 +1200,7 @@ struct drm_mode_crtc_page_flip_target {
|
|||
* struct drm_mode_create_dumb - Create a KMS dumb buffer for scanout.
|
||||
* @height: buffer height in pixels
|
||||
* @width: buffer width in pixels
|
||||
* @bpp: bits per pixel
|
||||
* @bpp: color mode
|
||||
* @flags: must be zero
|
||||
* @handle: buffer object handle
|
||||
* @pitch: number of bytes between two consecutive lines
|
||||
|
|
@ -1066,6 +1208,54 @@ struct drm_mode_crtc_page_flip_target {
|
|||
*
|
||||
* User-space fills @height, @width, @bpp and @flags. If the IOCTL succeeds,
|
||||
* the kernel fills @handle, @pitch and @size.
|
||||
*
|
||||
* The value of @bpp is a color-mode number describing a specific format
|
||||
* or a variant thereof. The value often corresponds to the number of bits
|
||||
* per pixel for most modes, although there are exceptions. Each color mode
|
||||
* maps to a DRM format plus a number of modes with similar pixel layout.
|
||||
* Framebuffer layout is always linear.
|
||||
*
|
||||
* Support for all modes and formats is optional. Even if dumb-buffer
|
||||
* creation with a certain color mode succeeds, it is not guaranteed that
|
||||
* the DRM driver supports any of the related formats. Most drivers support
|
||||
* a color mode of 32 with a format of DRM_FORMAT_XRGB8888 on their primary
|
||||
* plane.
|
||||
*
|
||||
* +------------+------------------------+------------------------+
|
||||
* | Color mode | Framebuffer format | Compatible formats |
|
||||
* +============+========================+========================+
|
||||
* | 32 | * DRM_FORMAT_XRGB8888 | * DRM_FORMAT_BGRX8888 |
|
||||
* | | | * DRM_FORMAT_RGBX8888 |
|
||||
* | | | * DRM_FORMAT_XBGR8888 |
|
||||
* +------------+------------------------+------------------------+
|
||||
* | 24 | * DRM_FORMAT_RGB888 | * DRM_FORMAT_BGR888 |
|
||||
* +------------+------------------------+------------------------+
|
||||
* | 16 | * DRM_FORMAT_RGB565 | * DRM_FORMAT_BGR565 |
|
||||
* +------------+------------------------+------------------------+
|
||||
* | 15 | * DRM_FORMAT_XRGB1555 | * DRM_FORMAT_BGRX1555 |
|
||||
* | | | * DRM_FORMAT_RGBX1555 |
|
||||
* | | | * DRM_FORMAT_XBGR1555 |
|
||||
* +------------+------------------------+------------------------+
|
||||
* | 8 | * DRM_FORMAT_C8 | * DRM_FORMAT_D8 |
|
||||
* | | | * DRM_FORMAT_R8 |
|
||||
* +------------+------------------------+------------------------+
|
||||
* | 4 | * DRM_FORMAT_C4 | * DRM_FORMAT_D4 |
|
||||
* | | | * DRM_FORMAT_R4 |
|
||||
* +------------+------------------------+------------------------+
|
||||
* | 2 | * DRM_FORMAT_C2 | * DRM_FORMAT_D2 |
|
||||
* | | | * DRM_FORMAT_R2 |
|
||||
* +------------+------------------------+------------------------+
|
||||
* | 1 | * DRM_FORMAT_C1 | * DRM_FORMAT_D1 |
|
||||
* | | | * DRM_FORMAT_R1 |
|
||||
* +------------+------------------------+------------------------+
|
||||
*
|
||||
* Color modes of 10, 12, 15, 30 and 64 are only supported for use by
|
||||
* legacy user space. Please don't use them in new code. Other modes
|
||||
* are not support.
|
||||
*
|
||||
* Do not attempt to allocate anything but linear framebuffer memory
|
||||
* with single-plane RGB data. Allocation of other framebuffer
|
||||
* layouts requires dedicated ioctls in the respective DRM driver.
|
||||
*/
|
||||
struct drm_mode_create_dumb {
|
||||
__u32 height;
|
||||
|
|
|
|||
|
|
@ -46,12 +46,16 @@ extern "C" {
|
|||
#define DRM_VIRTGPU_TRANSFER_TO_HOST 0x07
|
||||
#define DRM_VIRTGPU_WAIT 0x08
|
||||
#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_OUT 0x02
|
||||
#define VIRTGPU_EXECBUF_RING_IDX 0x04
|
||||
#define VIRTGPU_EXECBUF_FLAGS (\
|
||||
VIRTGPU_EXECBUF_FENCE_FD_IN |\
|
||||
VIRTGPU_EXECBUF_FENCE_FD_OUT |\
|
||||
VIRTGPU_EXECBUF_RING_IDX |\
|
||||
0)
|
||||
|
||||
struct drm_virtgpu_map {
|
||||
|
|
@ -60,6 +64,17 @@ struct drm_virtgpu_map {
|
|||
__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 {
|
||||
__u32 flags;
|
||||
__u32 size;
|
||||
|
|
@ -67,10 +82,22 @@ struct drm_virtgpu_execbuffer {
|
|||
__u64 bo_handles;
|
||||
__u32 num_bo_handles;
|
||||
__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_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 {
|
||||
__u64 param;
|
||||
|
|
@ -100,7 +127,7 @@ struct drm_virtgpu_resource_info {
|
|||
__u32 bo_handle;
|
||||
__u32 res_handle;
|
||||
__u32 size;
|
||||
__u32 stride;
|
||||
__u32 blob_mem;
|
||||
};
|
||||
|
||||
struct drm_virtgpu_3d_box {
|
||||
|
|
@ -117,6 +144,8 @@ struct drm_virtgpu_3d_transfer_to_host {
|
|||
struct drm_virtgpu_3d_box box;
|
||||
__u32 level;
|
||||
__u32 offset;
|
||||
__u32 stride;
|
||||
__u32 layer_stride;
|
||||
};
|
||||
|
||||
struct drm_virtgpu_3d_transfer_from_host {
|
||||
|
|
@ -124,6 +153,8 @@ struct drm_virtgpu_3d_transfer_from_host {
|
|||
struct drm_virtgpu_3d_box box;
|
||||
__u32 level;
|
||||
__u32 offset;
|
||||
__u32 stride;
|
||||
__u32 layer_stride;
|
||||
};
|
||||
|
||||
#define VIRTGPU_WAIT_NOWAIT 1 /* like it */
|
||||
|
|
@ -132,6 +163,12 @@ struct drm_virtgpu_3d_wait {
|
|||
__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 {
|
||||
__u32 cap_set_id;
|
||||
__u32 cap_set_ver;
|
||||
|
|
@ -140,6 +177,55 @@ struct drm_virtgpu_get_caps {
|
|||
__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 \
|
||||
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, \
|
||||
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)
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@
|
|||
project(
|
||||
'libdrm',
|
||||
['c'],
|
||||
version : '2.4.128',
|
||||
version : '2.4.131',
|
||||
license : 'MIT',
|
||||
meson_version : '>= 0.59',
|
||||
default_options : ['buildtype=debugoptimized', 'c_std=c11'],
|
||||
|
|
@ -51,6 +51,8 @@ dep_threads = dependency('threads')
|
|||
|
||||
cc = meson.get_compiler('c')
|
||||
|
||||
config.set10('HAVE_SECURE_GETENV', cc.has_function('secure_getenv'))
|
||||
|
||||
android = cc.compiles('''int func() { return __ANDROID__; }''')
|
||||
|
||||
# Solaris / Illumos
|
||||
|
|
|
|||
|
|
@ -41,10 +41,6 @@
|
|||
#include "omap_drm.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 void * dev_table;
|
||||
|
||||
|
|
@ -207,12 +203,6 @@ static struct omap_bo * omap_bo_new_impl(struct omap_device *dev,
|
|||
bo = bo_from_handle(dev, req.handle);
|
||||
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;
|
||||
|
||||
fail:
|
||||
|
|
@ -432,7 +422,7 @@ drm_public uint32_t omap_bo_size(struct omap_bo *bo)
|
|||
drm_public void *omap_bo_map(struct omap_bo *bo)
|
||||
{
|
||||
if (!bo->map) {
|
||||
if (!bo->offset) {
|
||||
if (!bo->size || !bo->offset) {
|
||||
get_buffer_info(bo);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue