Merge libdrm 2.4.100

This commit is contained in:
jsg 2019-11-27 02:17:47 +00:00
parent a628e08ec1
commit 94e5bba011
12 changed files with 350 additions and 202 deletions

View File

@ -1,7 +1,7 @@
# $OpenBSD: Makefile.bsd-wrapper,v 1.21 2019/05/05 23:27:58 schwarze Exp $ # $OpenBSD: Makefile.bsd-wrapper,v 1.22 2019/11/27 02:17:47 jsg Exp $
SHARED_LIBS= drm 7.7 drm_radeon 4.0 drm_intel 5.4 \ SHARED_LIBS= drm 7.8 drm_radeon 4.0 drm_intel 5.4 \
drm_amdgpu 1.8 drm_nouveau 3.0 drm_amdgpu 1.9 drm_nouveau 3.0
MDOCS= drmAvailable 3 drmHandleEvent 3 drmModeGetResources 3 \ MDOCS= drmAvailable 3 drmHandleEvent 3 drmModeGetResources 3 \
drm 7 drm-kms 7 drm-memory 7 drm 7 drm-kms 7 drm-memory 7

View File

@ -39,13 +39,12 @@
#include "amdgpu_internal.h" #include "amdgpu_internal.h"
#include "util_math.h" #include "util_math.h"
static void amdgpu_close_kms_handle(amdgpu_device_handle dev, static int amdgpu_close_kms_handle(int fd, uint32_t handle)
uint32_t handle)
{ {
struct drm_gem_close args = {}; struct drm_gem_close args = {};
args.handle = handle; args.handle = handle;
drmIoctl(dev->fd, DRM_IOCTL_GEM_CLOSE, &args); return drmIoctl(fd, DRM_IOCTL_GEM_CLOSE, &args);
} }
static int amdgpu_bo_create(amdgpu_device_handle dev, static int amdgpu_bo_create(amdgpu_device_handle dev,
@ -54,11 +53,18 @@ static int amdgpu_bo_create(amdgpu_device_handle dev,
amdgpu_bo_handle *buf_handle) amdgpu_bo_handle *buf_handle)
{ {
struct amdgpu_bo *bo; struct amdgpu_bo *bo;
int r;
bo = calloc(1, sizeof(struct amdgpu_bo)); bo = calloc(1, sizeof(struct amdgpu_bo));
if (!bo) if (!bo)
return -ENOMEM; return -ENOMEM;
r = handle_table_insert(&dev->bo_handles, handle, bo);
if (r) {
free(bo);
return r;
}
atomic_set(&bo->refcount, 1); atomic_set(&bo->refcount, 1);
bo->dev = dev; bo->dev = dev;
bo->alloc_size = size; bo->alloc_size = size;
@ -90,19 +96,14 @@ drm_public int amdgpu_bo_alloc(amdgpu_device_handle dev,
if (r) if (r)
goto out; goto out;
pthread_mutex_lock(&dev->bo_table_mutex);
r = amdgpu_bo_create(dev, alloc_buffer->alloc_size, args.out.handle, r = amdgpu_bo_create(dev, alloc_buffer->alloc_size, args.out.handle,
buf_handle); buf_handle);
pthread_mutex_unlock(&dev->bo_table_mutex);
if (r) { if (r) {
amdgpu_close_kms_handle(dev, args.out.handle); amdgpu_close_kms_handle(dev->fd, args.out.handle);
goto out;
} }
pthread_mutex_lock(&dev->bo_table_mutex);
r = handle_table_insert(&dev->bo_handles, (*buf_handle)->handle,
*buf_handle);
pthread_mutex_unlock(&dev->bo_table_mutex);
if (r)
amdgpu_bo_free(*buf_handle);
out: out:
return r; return r;
} }
@ -214,11 +215,8 @@ static int amdgpu_bo_export_flink(amdgpu_bo_handle bo)
bo->flink_name = flink.name; bo->flink_name = flink.name;
if (bo->dev->flink_fd != bo->dev->fd) { if (bo->dev->flink_fd != bo->dev->fd)
struct drm_gem_close args = {}; amdgpu_close_kms_handle(bo->dev->flink_fd, handle);
args.handle = handle;
drmIoctl(bo->dev->flink_fd, DRM_IOCTL_GEM_CLOSE, &args);
}
pthread_mutex_lock(&bo->dev->bo_table_mutex); pthread_mutex_lock(&bo->dev->bo_table_mutex);
r = handle_table_insert(&bo->dev->bo_flink_names, bo->flink_name, bo); r = handle_table_insert(&bo->dev->bo_flink_names, bo->flink_name, bo);
@ -261,7 +259,6 @@ drm_public int amdgpu_bo_import(amdgpu_device_handle dev,
struct amdgpu_bo_import_result *output) struct amdgpu_bo_import_result *output)
{ {
struct drm_gem_open open_arg = {}; struct drm_gem_open open_arg = {};
struct drm_gem_close close_arg = {};
struct amdgpu_bo *bo = NULL; struct amdgpu_bo *bo = NULL;
uint32_t handle = 0, flink_name = 0; uint32_t handle = 0, flink_name = 0;
uint64_t alloc_size = 0; uint64_t alloc_size = 0;
@ -345,12 +342,12 @@ drm_public int amdgpu_bo_import(amdgpu_device_handle dev,
close(dma_fd); close(dma_fd);
if (r) if (r)
goto free_bo_handle; goto free_bo_handle;
close_arg.handle = open_arg.handle; r = amdgpu_close_kms_handle(dev->flink_fd,
r = drmIoctl(dev->flink_fd, DRM_IOCTL_GEM_CLOSE, open_arg.handle);
&close_arg);
if (r) if (r)
goto free_bo_handle; goto free_bo_handle;
} }
open_arg.handle = 0;
break; break;
case amdgpu_bo_handle_type_dma_buf_fd: case amdgpu_bo_handle_type_dma_buf_fd:
@ -368,15 +365,12 @@ drm_public int amdgpu_bo_import(amdgpu_device_handle dev,
if (r) if (r)
goto free_bo_handle; goto free_bo_handle;
r = handle_table_insert(&dev->bo_handles, bo->handle, bo);
if (r)
goto free_bo_handle;
if (flink_name) { if (flink_name) {
bo->flink_name = flink_name; bo->flink_name = flink_name;
r = handle_table_insert(&dev->bo_flink_names, flink_name, r = handle_table_insert(&dev->bo_flink_names, flink_name,
bo); bo);
if (r) if (r)
goto remove_handle; goto free_bo_handle;
} }
@ -385,17 +379,14 @@ drm_public int amdgpu_bo_import(amdgpu_device_handle dev,
pthread_mutex_unlock(&dev->bo_table_mutex); pthread_mutex_unlock(&dev->bo_table_mutex);
return 0; return 0;
remove_handle:
handle_table_remove(&dev->bo_handles, bo->handle);
free_bo_handle: free_bo_handle:
if (flink_name && !close_arg.handle && open_arg.handle) { if (flink_name && open_arg.handle)
close_arg.handle = open_arg.handle; amdgpu_close_kms_handle(dev->flink_fd, open_arg.handle);
drmIoctl(dev->flink_fd, DRM_IOCTL_GEM_CLOSE, &close_arg);
}
if (bo) if (bo)
amdgpu_bo_free(bo); amdgpu_bo_free(bo);
else else
amdgpu_close_kms_handle(dev, handle); amdgpu_close_kms_handle(dev->fd, handle);
unlock: unlock:
pthread_mutex_unlock(&dev->bo_table_mutex); pthread_mutex_unlock(&dev->bo_table_mutex);
return r; return r;
@ -424,12 +415,13 @@ drm_public int amdgpu_bo_free(amdgpu_bo_handle buf_handle)
amdgpu_bo_cpu_unmap(bo); amdgpu_bo_cpu_unmap(bo);
} }
amdgpu_close_kms_handle(dev, bo->handle); amdgpu_close_kms_handle(dev->fd, bo->handle);
pthread_mutex_destroy(&bo->cpu_access_mutex); pthread_mutex_destroy(&bo->cpu_access_mutex);
free(bo); free(bo);
} }
pthread_mutex_unlock(&dev->bo_table_mutex); pthread_mutex_unlock(&dev->bo_table_mutex);
return 0; return 0;
} }
@ -602,18 +594,13 @@ drm_public int amdgpu_create_bo_from_user_mem(amdgpu_device_handle dev,
if (r) if (r)
goto out; goto out;
pthread_mutex_lock(&dev->bo_table_mutex);
r = amdgpu_bo_create(dev, size, args.handle, buf_handle); r = amdgpu_bo_create(dev, size, args.handle, buf_handle);
pthread_mutex_unlock(&dev->bo_table_mutex);
if (r) { if (r) {
amdgpu_close_kms_handle(dev, args.handle); amdgpu_close_kms_handle(dev->fd, args.handle);
goto out;
} }
pthread_mutex_lock(&dev->bo_table_mutex);
r = handle_table_insert(&dev->bo_handles, (*buf_handle)->handle,
*buf_handle);
pthread_mutex_unlock(&dev->bo_table_mutex);
if (r)
amdgpu_bo_free(*buf_handle);
out: out:
return r; return r;
} }

20
lib/libdrm/configure vendored
View File

@ -1,6 +1,6 @@
#! /bin/sh #! /bin/sh
# Guess values for system-dependent variables and create Makefiles. # Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.69 for libdrm 2.4.98. # Generated by GNU Autoconf 2.69 for libdrm 2.4.100.
# #
# Report bugs to <https://bugs.freedesktop.org/enter_bug.cgi?product=DRI>. # Report bugs to <https://bugs.freedesktop.org/enter_bug.cgi?product=DRI>.
# #
@ -591,8 +591,8 @@ MAKEFLAGS=
# Identity of this package. # Identity of this package.
PACKAGE_NAME='libdrm' PACKAGE_NAME='libdrm'
PACKAGE_TARNAME='libdrm' PACKAGE_TARNAME='libdrm'
PACKAGE_VERSION='2.4.98' PACKAGE_VERSION='2.4.100'
PACKAGE_STRING='libdrm 2.4.98' PACKAGE_STRING='libdrm 2.4.100'
PACKAGE_BUGREPORT='https://bugs.freedesktop.org/enter_bug.cgi?product=DRI' PACKAGE_BUGREPORT='https://bugs.freedesktop.org/enter_bug.cgi?product=DRI'
PACKAGE_URL='' PACKAGE_URL=''
@ -1423,7 +1423,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing. # Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh. # This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF cat <<_ACEOF
\`configure' configures libdrm 2.4.98 to adapt to many kinds of systems. \`configure' configures libdrm 2.4.100 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]... Usage: $0 [OPTION]... [VAR=VALUE]...
@ -1493,7 +1493,7 @@ fi
if test -n "$ac_init_help"; then if test -n "$ac_init_help"; then
case $ac_init_help in case $ac_init_help in
short | recursive ) echo "Configuration of libdrm 2.4.98:";; short | recursive ) echo "Configuration of libdrm 2.4.100:";;
esac esac
cat <<\_ACEOF cat <<\_ACEOF
@ -1663,7 +1663,7 @@ fi
test -n "$ac_init_help" && exit $ac_status test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then if $ac_init_version; then
cat <<\_ACEOF cat <<\_ACEOF
libdrm configure 2.4.98 libdrm configure 2.4.100
generated by GNU Autoconf 2.69 generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc. Copyright (C) 2012 Free Software Foundation, Inc.
@ -2086,7 +2086,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake. running configure, to aid debugging if configure makes a mistake.
It was created by libdrm $as_me 2.4.98, which was It was created by libdrm $as_me 2.4.100, which was
generated by GNU Autoconf 2.69. Invocation command line was generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@ $ $0 $@
@ -3459,7 +3459,7 @@ fi
# Define the identity of the package. # Define the identity of the package.
PACKAGE='libdrm' PACKAGE='libdrm'
VERSION='2.4.98' VERSION='2.4.100'
cat >>confdefs.h <<_ACEOF cat >>confdefs.h <<_ACEOF
@ -14697,7 +14697,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their # report actual input values of CONFIG_FILES etc. instead of their
# values after options handling. # values after options handling.
ac_log=" ac_log="
This file was extended by libdrm $as_me 2.4.98, which was This file was extended by libdrm $as_me 2.4.100, which was
generated by GNU Autoconf 2.69. Invocation command line was generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES CONFIG_FILES = $CONFIG_FILES
@ -14763,7 +14763,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\ ac_cs_version="\\
libdrm config.status 2.4.98 libdrm config.status 2.4.100
configured by $0, generated by GNU Autoconf 2.69, configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\" with options \\"\$ac_cs_config\\"

View File

@ -20,7 +20,7 @@
AC_PREREQ([2.63]) AC_PREREQ([2.63])
AC_INIT([libdrm], AC_INIT([libdrm],
[2.4.98], [2.4.100],
[https://bugs.freedesktop.org/enter_bug.cgi?product=DRI], [https://bugs.freedesktop.org/enter_bug.cgi?product=DRI],
[libdrm]) [libdrm])

View File

@ -44,6 +44,7 @@ typedef unsigned int drm_handle_t;
#else /* One of the BSDs */ #else /* One of the BSDs */
#include <stdint.h>
#include <sys/ioccom.h> #include <sys/ioccom.h>
#include <sys/types.h> #include <sys/types.h>
typedef int8_t __s8; typedef int8_t __s8;
@ -643,6 +644,7 @@ struct drm_gem_open {
#define DRM_CAP_PAGE_FLIP_TARGET 0x11 #define DRM_CAP_PAGE_FLIP_TARGET 0x11
#define DRM_CAP_CRTC_IN_VBLANK_EVENT 0x12 #define DRM_CAP_CRTC_IN_VBLANK_EVENT 0x12
#define DRM_CAP_SYNCOBJ 0x13 #define DRM_CAP_SYNCOBJ 0x13
#define DRM_CAP_SYNCOBJ_TIMELINE 0x14
/** DRM_IOCTL_GET_CAP ioctl argument type */ /** DRM_IOCTL_GET_CAP ioctl argument type */
struct drm_get_cap { struct drm_get_cap {

View File

@ -108,8 +108,10 @@
INTEL_VGA_DEVICE(0x2e42, info), /* B43_G */ \ INTEL_VGA_DEVICE(0x2e42, info), /* B43_G */ \
INTEL_VGA_DEVICE(0x2e92, info) /* B43_G.1 */ INTEL_VGA_DEVICE(0x2e92, info) /* B43_G.1 */
#define INTEL_PINEVIEW_IDS(info) \ #define INTEL_PINEVIEW_G_IDS(info) \
INTEL_VGA_DEVICE(0xa001, info), \ INTEL_VGA_DEVICE(0xa001, info)
#define INTEL_PINEVIEW_M_IDS(info) \
INTEL_VGA_DEVICE(0xa011, info) INTEL_VGA_DEVICE(0xa011, info)
#define INTEL_IRONLAKE_D_IDS(info) \ #define INTEL_IRONLAKE_D_IDS(info) \
@ -166,7 +168,18 @@
#define INTEL_IVB_Q_IDS(info) \ #define INTEL_IVB_Q_IDS(info) \
INTEL_QUANTA_VGA_DEVICE(info) /* Quanta transcode */ INTEL_QUANTA_VGA_DEVICE(info) /* Quanta transcode */
#define INTEL_HSW_ULT_GT1_IDS(info) \
INTEL_VGA_DEVICE(0x0A02, info), /* ULT GT1 desktop */ \
INTEL_VGA_DEVICE(0x0A0A, info), /* ULT GT1 server */ \
INTEL_VGA_DEVICE(0x0A0B, info), /* ULT GT1 reserved */ \
INTEL_VGA_DEVICE(0x0A06, info) /* ULT GT1 mobile */
#define INTEL_HSW_ULX_GT1_IDS(info) \
INTEL_VGA_DEVICE(0x0A0E, info) /* ULX GT1 mobile */
#define INTEL_HSW_GT1_IDS(info) \ #define INTEL_HSW_GT1_IDS(info) \
INTEL_HSW_ULT_GT1_IDS(info), \
INTEL_HSW_ULX_GT1_IDS(info), \
INTEL_VGA_DEVICE(0x0402, info), /* GT1 desktop */ \ INTEL_VGA_DEVICE(0x0402, info), /* GT1 desktop */ \
INTEL_VGA_DEVICE(0x040a, info), /* GT1 server */ \ INTEL_VGA_DEVICE(0x040a, info), /* GT1 server */ \
INTEL_VGA_DEVICE(0x040B, info), /* GT1 reserved */ \ INTEL_VGA_DEVICE(0x040B, info), /* GT1 reserved */ \
@ -175,20 +188,26 @@
INTEL_VGA_DEVICE(0x0C0A, info), /* SDV GT1 server */ \ INTEL_VGA_DEVICE(0x0C0A, info), /* SDV GT1 server */ \
INTEL_VGA_DEVICE(0x0C0B, info), /* SDV GT1 reserved */ \ INTEL_VGA_DEVICE(0x0C0B, info), /* SDV GT1 reserved */ \
INTEL_VGA_DEVICE(0x0C0E, info), /* SDV GT1 reserved */ \ INTEL_VGA_DEVICE(0x0C0E, info), /* SDV GT1 reserved */ \
INTEL_VGA_DEVICE(0x0A02, info), /* ULT GT1 desktop */ \
INTEL_VGA_DEVICE(0x0A0A, info), /* ULT GT1 server */ \
INTEL_VGA_DEVICE(0x0A0B, info), /* ULT GT1 reserved */ \
INTEL_VGA_DEVICE(0x0D02, info), /* CRW GT1 desktop */ \ INTEL_VGA_DEVICE(0x0D02, info), /* CRW GT1 desktop */ \
INTEL_VGA_DEVICE(0x0D0A, info), /* CRW GT1 server */ \ INTEL_VGA_DEVICE(0x0D0A, info), /* CRW GT1 server */ \
INTEL_VGA_DEVICE(0x0D0B, info), /* CRW GT1 reserved */ \ INTEL_VGA_DEVICE(0x0D0B, info), /* CRW GT1 reserved */ \
INTEL_VGA_DEVICE(0x0D0E, info), /* CRW GT1 reserved */ \ INTEL_VGA_DEVICE(0x0D0E, info), /* CRW GT1 reserved */ \
INTEL_VGA_DEVICE(0x0406, info), /* GT1 mobile */ \ INTEL_VGA_DEVICE(0x0406, info), /* GT1 mobile */ \
INTEL_VGA_DEVICE(0x0C06, info), /* SDV GT1 mobile */ \ INTEL_VGA_DEVICE(0x0C06, info), /* SDV GT1 mobile */ \
INTEL_VGA_DEVICE(0x0A06, info), /* ULT GT1 mobile */ \
INTEL_VGA_DEVICE(0x0A0E, info), /* ULX GT1 mobile */ \
INTEL_VGA_DEVICE(0x0D06, info) /* CRW GT1 mobile */ INTEL_VGA_DEVICE(0x0D06, info) /* CRW GT1 mobile */
#define INTEL_HSW_ULT_GT2_IDS(info) \
INTEL_VGA_DEVICE(0x0A12, info), /* ULT GT2 desktop */ \
INTEL_VGA_DEVICE(0x0A1A, info), /* ULT GT2 server */ \
INTEL_VGA_DEVICE(0x0A1B, info), /* ULT GT2 reserved */ \
INTEL_VGA_DEVICE(0x0A16, info) /* ULT GT2 mobile */
#define INTEL_HSW_ULX_GT2_IDS(info) \
INTEL_VGA_DEVICE(0x0A1E, info) /* ULX GT2 mobile */ \
#define INTEL_HSW_GT2_IDS(info) \ #define INTEL_HSW_GT2_IDS(info) \
INTEL_HSW_ULT_GT2_IDS(info), \
INTEL_HSW_ULX_GT2_IDS(info), \
INTEL_VGA_DEVICE(0x0412, info), /* GT2 desktop */ \ INTEL_VGA_DEVICE(0x0412, info), /* GT2 desktop */ \
INTEL_VGA_DEVICE(0x041a, info), /* GT2 server */ \ INTEL_VGA_DEVICE(0x041a, info), /* GT2 server */ \
INTEL_VGA_DEVICE(0x041B, info), /* GT2 reserved */ \ INTEL_VGA_DEVICE(0x041B, info), /* GT2 reserved */ \
@ -197,9 +216,6 @@
INTEL_VGA_DEVICE(0x0C1A, info), /* SDV GT2 server */ \ INTEL_VGA_DEVICE(0x0C1A, info), /* SDV GT2 server */ \
INTEL_VGA_DEVICE(0x0C1B, info), /* SDV GT2 reserved */ \ INTEL_VGA_DEVICE(0x0C1B, info), /* SDV GT2 reserved */ \
INTEL_VGA_DEVICE(0x0C1E, info), /* SDV GT2 reserved */ \ INTEL_VGA_DEVICE(0x0C1E, info), /* SDV GT2 reserved */ \
INTEL_VGA_DEVICE(0x0A12, info), /* ULT GT2 desktop */ \
INTEL_VGA_DEVICE(0x0A1A, info), /* ULT GT2 server */ \
INTEL_VGA_DEVICE(0x0A1B, info), /* ULT GT2 reserved */ \
INTEL_VGA_DEVICE(0x0D12, info), /* CRW GT2 desktop */ \ INTEL_VGA_DEVICE(0x0D12, info), /* CRW GT2 desktop */ \
INTEL_VGA_DEVICE(0x0D1A, info), /* CRW GT2 server */ \ INTEL_VGA_DEVICE(0x0D1A, info), /* CRW GT2 server */ \
INTEL_VGA_DEVICE(0x0D1B, info), /* CRW GT2 reserved */ \ INTEL_VGA_DEVICE(0x0D1B, info), /* CRW GT2 reserved */ \
@ -207,11 +223,17 @@
INTEL_VGA_DEVICE(0x0416, info), /* GT2 mobile */ \ INTEL_VGA_DEVICE(0x0416, info), /* GT2 mobile */ \
INTEL_VGA_DEVICE(0x0426, info), /* GT2 mobile */ \ INTEL_VGA_DEVICE(0x0426, info), /* GT2 mobile */ \
INTEL_VGA_DEVICE(0x0C16, info), /* SDV GT2 mobile */ \ INTEL_VGA_DEVICE(0x0C16, info), /* SDV GT2 mobile */ \
INTEL_VGA_DEVICE(0x0A16, info), /* ULT GT2 mobile */ \
INTEL_VGA_DEVICE(0x0A1E, info), /* ULX GT2 mobile */ \
INTEL_VGA_DEVICE(0x0D16, info) /* CRW GT2 mobile */ INTEL_VGA_DEVICE(0x0D16, info) /* CRW GT2 mobile */
#define INTEL_HSW_ULT_GT3_IDS(info) \
INTEL_VGA_DEVICE(0x0A22, info), /* ULT GT3 desktop */ \
INTEL_VGA_DEVICE(0x0A2A, info), /* ULT GT3 server */ \
INTEL_VGA_DEVICE(0x0A2B, info), /* ULT GT3 reserved */ \
INTEL_VGA_DEVICE(0x0A26, info), /* ULT GT3 mobile */ \
INTEL_VGA_DEVICE(0x0A2E, info) /* ULT GT3 reserved */
#define INTEL_HSW_GT3_IDS(info) \ #define INTEL_HSW_GT3_IDS(info) \
INTEL_HSW_ULT_GT3_IDS(info), \
INTEL_VGA_DEVICE(0x0422, info), /* GT3 desktop */ \ INTEL_VGA_DEVICE(0x0422, info), /* GT3 desktop */ \
INTEL_VGA_DEVICE(0x042a, info), /* GT3 server */ \ INTEL_VGA_DEVICE(0x042a, info), /* GT3 server */ \
INTEL_VGA_DEVICE(0x042B, info), /* GT3 reserved */ \ INTEL_VGA_DEVICE(0x042B, info), /* GT3 reserved */ \
@ -220,16 +242,11 @@
INTEL_VGA_DEVICE(0x0C2A, info), /* SDV GT3 server */ \ INTEL_VGA_DEVICE(0x0C2A, info), /* SDV GT3 server */ \
INTEL_VGA_DEVICE(0x0C2B, info), /* SDV GT3 reserved */ \ INTEL_VGA_DEVICE(0x0C2B, info), /* SDV GT3 reserved */ \
INTEL_VGA_DEVICE(0x0C2E, info), /* SDV GT3 reserved */ \ INTEL_VGA_DEVICE(0x0C2E, info), /* SDV GT3 reserved */ \
INTEL_VGA_DEVICE(0x0A22, info), /* ULT GT3 desktop */ \
INTEL_VGA_DEVICE(0x0A2A, info), /* ULT GT3 server */ \
INTEL_VGA_DEVICE(0x0A2B, info), /* ULT GT3 reserved */ \
INTEL_VGA_DEVICE(0x0D22, info), /* CRW GT3 desktop */ \ INTEL_VGA_DEVICE(0x0D22, info), /* CRW GT3 desktop */ \
INTEL_VGA_DEVICE(0x0D2A, info), /* CRW GT3 server */ \ INTEL_VGA_DEVICE(0x0D2A, info), /* CRW GT3 server */ \
INTEL_VGA_DEVICE(0x0D2B, info), /* CRW GT3 reserved */ \ INTEL_VGA_DEVICE(0x0D2B, info), /* CRW GT3 reserved */ \
INTEL_VGA_DEVICE(0x0D2E, info), /* CRW GT3 reserved */ \ INTEL_VGA_DEVICE(0x0D2E, info), /* CRW GT3 reserved */ \
INTEL_VGA_DEVICE(0x0C26, info), /* SDV GT3 mobile */ \ INTEL_VGA_DEVICE(0x0C26, info), /* SDV GT3 mobile */ \
INTEL_VGA_DEVICE(0x0A26, info), /* ULT GT3 mobile */ \
INTEL_VGA_DEVICE(0x0A2E, info), /* ULT GT3 reserved */ \
INTEL_VGA_DEVICE(0x0D26, info) /* CRW GT3 mobile */ INTEL_VGA_DEVICE(0x0D26, info) /* CRW GT3 mobile */
#define INTEL_HSW_IDS(info) \ #define INTEL_HSW_IDS(info) \
@ -245,35 +262,59 @@
INTEL_VGA_DEVICE(0x0157, info), \ INTEL_VGA_DEVICE(0x0157, info), \
INTEL_VGA_DEVICE(0x0155, info) INTEL_VGA_DEVICE(0x0155, info)
#define INTEL_BDW_GT1_IDS(info) \ #define INTEL_BDW_ULT_GT1_IDS(info) \
INTEL_VGA_DEVICE(0x1602, info), /* GT1 ULT */ \
INTEL_VGA_DEVICE(0x1606, info), /* GT1 ULT */ \ INTEL_VGA_DEVICE(0x1606, info), /* GT1 ULT */ \
INTEL_VGA_DEVICE(0x160B, info), /* GT1 Iris */ \ INTEL_VGA_DEVICE(0x160B, info) /* GT1 Iris */
INTEL_VGA_DEVICE(0x160E, info), /* GT1 ULX */ \
#define INTEL_BDW_ULX_GT1_IDS(info) \
INTEL_VGA_DEVICE(0x160E, info) /* GT1 ULX */
#define INTEL_BDW_GT1_IDS(info) \
INTEL_BDW_ULT_GT1_IDS(info), \
INTEL_BDW_ULX_GT1_IDS(info), \
INTEL_VGA_DEVICE(0x1602, info), /* GT1 ULT */ \
INTEL_VGA_DEVICE(0x160A, info), /* GT1 Server */ \ INTEL_VGA_DEVICE(0x160A, info), /* GT1 Server */ \
INTEL_VGA_DEVICE(0x160D, info) /* GT1 Workstation */ INTEL_VGA_DEVICE(0x160D, info) /* GT1 Workstation */
#define INTEL_BDW_GT2_IDS(info) \ #define INTEL_BDW_ULT_GT2_IDS(info) \
INTEL_VGA_DEVICE(0x1612, info), /* GT2 Halo */ \
INTEL_VGA_DEVICE(0x1616, info), /* GT2 ULT */ \ INTEL_VGA_DEVICE(0x1616, info), /* GT2 ULT */ \
INTEL_VGA_DEVICE(0x161B, info), /* GT2 ULT */ \ INTEL_VGA_DEVICE(0x161B, info) /* GT2 ULT */
INTEL_VGA_DEVICE(0x161E, info), /* GT2 ULX */ \
#define INTEL_BDW_ULX_GT2_IDS(info) \
INTEL_VGA_DEVICE(0x161E, info) /* GT2 ULX */
#define INTEL_BDW_GT2_IDS(info) \
INTEL_BDW_ULT_GT2_IDS(info), \
INTEL_BDW_ULX_GT2_IDS(info), \
INTEL_VGA_DEVICE(0x1612, info), /* GT2 Halo */ \
INTEL_VGA_DEVICE(0x161A, info), /* GT2 Server */ \ INTEL_VGA_DEVICE(0x161A, info), /* GT2 Server */ \
INTEL_VGA_DEVICE(0x161D, info) /* GT2 Workstation */ INTEL_VGA_DEVICE(0x161D, info) /* GT2 Workstation */
#define INTEL_BDW_GT3_IDS(info) \ #define INTEL_BDW_ULT_GT3_IDS(info) \
INTEL_VGA_DEVICE(0x1622, info), /* ULT */ \
INTEL_VGA_DEVICE(0x1626, info), /* ULT */ \ INTEL_VGA_DEVICE(0x1626, info), /* ULT */ \
INTEL_VGA_DEVICE(0x162B, info), /* Iris */ \ INTEL_VGA_DEVICE(0x162B, info) /* Iris */ \
INTEL_VGA_DEVICE(0x162E, info), /* ULX */\
#define INTEL_BDW_ULX_GT3_IDS(info) \
INTEL_VGA_DEVICE(0x162E, info) /* ULX */
#define INTEL_BDW_GT3_IDS(info) \
INTEL_BDW_ULT_GT3_IDS(info), \
INTEL_BDW_ULX_GT3_IDS(info), \
INTEL_VGA_DEVICE(0x1622, info), /* ULT */ \
INTEL_VGA_DEVICE(0x162A, info), /* Server */ \ INTEL_VGA_DEVICE(0x162A, info), /* Server */ \
INTEL_VGA_DEVICE(0x162D, info) /* Workstation */ INTEL_VGA_DEVICE(0x162D, info) /* Workstation */
#define INTEL_BDW_RSVD_IDS(info) \ #define INTEL_BDW_ULT_RSVD_IDS(info) \
INTEL_VGA_DEVICE(0x1632, info), /* ULT */ \
INTEL_VGA_DEVICE(0x1636, info), /* ULT */ \ INTEL_VGA_DEVICE(0x1636, info), /* ULT */ \
INTEL_VGA_DEVICE(0x163B, info), /* Iris */ \ INTEL_VGA_DEVICE(0x163B, info) /* Iris */
INTEL_VGA_DEVICE(0x163E, info), /* ULX */ \
#define INTEL_BDW_ULX_RSVD_IDS(info) \
INTEL_VGA_DEVICE(0x163E, info) /* ULX */
#define INTEL_BDW_RSVD_IDS(info) \
INTEL_BDW_ULT_RSVD_IDS(info), \
INTEL_BDW_ULX_RSVD_IDS(info), \
INTEL_VGA_DEVICE(0x1632, info), /* ULT */ \
INTEL_VGA_DEVICE(0x163A, info), /* Server */ \ INTEL_VGA_DEVICE(0x163A, info), /* Server */ \
INTEL_VGA_DEVICE(0x163D, info) /* Workstation */ INTEL_VGA_DEVICE(0x163D, info) /* Workstation */
@ -289,25 +330,40 @@
INTEL_VGA_DEVICE(0x22b2, info), \ INTEL_VGA_DEVICE(0x22b2, info), \
INTEL_VGA_DEVICE(0x22b3, info) INTEL_VGA_DEVICE(0x22b3, info)
#define INTEL_SKL_ULT_GT1_IDS(info) \
INTEL_VGA_DEVICE(0x1906, info) /* ULT GT1 */
#define INTEL_SKL_ULX_GT1_IDS(info) \
INTEL_VGA_DEVICE(0x190E, info) /* ULX GT1 */
#define INTEL_SKL_GT1_IDS(info) \ #define INTEL_SKL_GT1_IDS(info) \
INTEL_VGA_DEVICE(0x1906, info), /* ULT GT1 */ \ INTEL_SKL_ULT_GT1_IDS(info), \
INTEL_VGA_DEVICE(0x190E, info), /* ULX GT1 */ \ INTEL_SKL_ULX_GT1_IDS(info), \
INTEL_VGA_DEVICE(0x1902, info), /* DT GT1 */ \ INTEL_VGA_DEVICE(0x1902, info), /* DT GT1 */ \
INTEL_VGA_DEVICE(0x190B, info), /* Halo GT1 */ \ INTEL_VGA_DEVICE(0x190B, info), /* Halo GT1 */ \
INTEL_VGA_DEVICE(0x190A, info) /* SRV GT1 */ INTEL_VGA_DEVICE(0x190A, info) /* SRV GT1 */
#define INTEL_SKL_GT2_IDS(info) \ #define INTEL_SKL_ULT_GT2_IDS(info) \
INTEL_VGA_DEVICE(0x1916, info), /* ULT GT2 */ \ INTEL_VGA_DEVICE(0x1916, info), /* ULT GT2 */ \
INTEL_VGA_DEVICE(0x1921, info), /* ULT GT2F */ \ INTEL_VGA_DEVICE(0x1921, info) /* ULT GT2F */
INTEL_VGA_DEVICE(0x191E, info), /* ULX GT2 */ \
#define INTEL_SKL_ULX_GT2_IDS(info) \
INTEL_VGA_DEVICE(0x191E, info) /* ULX GT2 */
#define INTEL_SKL_GT2_IDS(info) \
INTEL_SKL_ULT_GT2_IDS(info), \
INTEL_SKL_ULX_GT2_IDS(info), \
INTEL_VGA_DEVICE(0x1912, info), /* DT GT2 */ \ INTEL_VGA_DEVICE(0x1912, info), /* DT GT2 */ \
INTEL_VGA_DEVICE(0x191B, info), /* Halo GT2 */ \ INTEL_VGA_DEVICE(0x191B, info), /* Halo GT2 */ \
INTEL_VGA_DEVICE(0x191A, info), /* SRV GT2 */ \ INTEL_VGA_DEVICE(0x191A, info), /* SRV GT2 */ \
INTEL_VGA_DEVICE(0x191D, info) /* WKS GT2 */ INTEL_VGA_DEVICE(0x191D, info) /* WKS GT2 */
#define INTEL_SKL_ULT_GT3_IDS(info) \
INTEL_VGA_DEVICE(0x1926, info) /* ULT GT3 */
#define INTEL_SKL_GT3_IDS(info) \ #define INTEL_SKL_GT3_IDS(info) \
INTEL_SKL_ULT_GT3_IDS(info), \
INTEL_VGA_DEVICE(0x1923, info), /* ULT GT3 */ \ INTEL_VGA_DEVICE(0x1923, info), /* ULT GT3 */ \
INTEL_VGA_DEVICE(0x1926, info), /* ULT GT3 */ \
INTEL_VGA_DEVICE(0x1927, info), /* ULT GT3 */ \ INTEL_VGA_DEVICE(0x1927, info), /* ULT GT3 */ \
INTEL_VGA_DEVICE(0x192B, info), /* Halo GT3 */ \ INTEL_VGA_DEVICE(0x192B, info), /* Halo GT3 */ \
INTEL_VGA_DEVICE(0x192D, info) /* SRV GT3 */ INTEL_VGA_DEVICE(0x192D, info) /* SRV GT3 */
@ -336,29 +392,44 @@
INTEL_VGA_DEVICE(0x3184, info), \ INTEL_VGA_DEVICE(0x3184, info), \
INTEL_VGA_DEVICE(0x3185, info) INTEL_VGA_DEVICE(0x3185, info)
#define INTEL_KBL_GT1_IDS(info) \ #define INTEL_KBL_ULT_GT1_IDS(info) \
INTEL_VGA_DEVICE(0x5913, info), /* ULT GT1.5 */ \
INTEL_VGA_DEVICE(0x5915, info), /* ULX GT1.5 */ \
INTEL_VGA_DEVICE(0x5906, info), /* ULT GT1 */ \ INTEL_VGA_DEVICE(0x5906, info), /* ULT GT1 */ \
INTEL_VGA_DEVICE(0x5913, info) /* ULT GT1.5 */
#define INTEL_KBL_ULX_GT1_IDS(info) \
INTEL_VGA_DEVICE(0x590E, info), /* ULX GT1 */ \ INTEL_VGA_DEVICE(0x590E, info), /* ULX GT1 */ \
INTEL_VGA_DEVICE(0x5915, info) /* ULX GT1.5 */
#define INTEL_KBL_GT1_IDS(info) \
INTEL_KBL_ULT_GT1_IDS(info), \
INTEL_KBL_ULX_GT1_IDS(info), \
INTEL_VGA_DEVICE(0x5902, info), /* DT GT1 */ \ INTEL_VGA_DEVICE(0x5902, info), /* DT GT1 */ \
INTEL_VGA_DEVICE(0x5908, info), /* Halo GT1 */ \ INTEL_VGA_DEVICE(0x5908, info), /* Halo GT1 */ \
INTEL_VGA_DEVICE(0x590B, info), /* Halo GT1 */ \ INTEL_VGA_DEVICE(0x590B, info), /* Halo GT1 */ \
INTEL_VGA_DEVICE(0x590A, info) /* SRV GT1 */ INTEL_VGA_DEVICE(0x590A, info) /* SRV GT1 */
#define INTEL_KBL_GT2_IDS(info) \ #define INTEL_KBL_ULT_GT2_IDS(info) \
INTEL_VGA_DEVICE(0x5916, info), /* ULT GT2 */ \ INTEL_VGA_DEVICE(0x5916, info), /* ULT GT2 */ \
INTEL_VGA_DEVICE(0x5921, info) /* ULT GT2F */
#define INTEL_KBL_ULX_GT2_IDS(info) \
INTEL_VGA_DEVICE(0x591E, info) /* ULX GT2 */
#define INTEL_KBL_GT2_IDS(info) \
INTEL_KBL_ULT_GT2_IDS(info), \
INTEL_KBL_ULX_GT2_IDS(info), \
INTEL_VGA_DEVICE(0x5917, info), /* Mobile GT2 */ \ INTEL_VGA_DEVICE(0x5917, info), /* Mobile GT2 */ \
INTEL_VGA_DEVICE(0x5921, info), /* ULT GT2F */ \
INTEL_VGA_DEVICE(0x591E, info), /* ULX GT2 */ \
INTEL_VGA_DEVICE(0x5912, info), /* DT GT2 */ \ INTEL_VGA_DEVICE(0x5912, info), /* DT GT2 */ \
INTEL_VGA_DEVICE(0x591B, info), /* Halo GT2 */ \ INTEL_VGA_DEVICE(0x591B, info), /* Halo GT2 */ \
INTEL_VGA_DEVICE(0x591A, info), /* SRV GT2 */ \ INTEL_VGA_DEVICE(0x591A, info), /* SRV GT2 */ \
INTEL_VGA_DEVICE(0x591D, info) /* WKS GT2 */ INTEL_VGA_DEVICE(0x591D, info) /* WKS GT2 */
#define INTEL_KBL_ULT_GT3_IDS(info) \
INTEL_VGA_DEVICE(0x5926, info) /* ULT GT3 */
#define INTEL_KBL_GT3_IDS(info) \ #define INTEL_KBL_GT3_IDS(info) \
INTEL_KBL_ULT_GT3_IDS(info), \
INTEL_VGA_DEVICE(0x5923, info), /* ULT GT3 */ \ INTEL_VGA_DEVICE(0x5923, info), /* ULT GT3 */ \
INTEL_VGA_DEVICE(0x5926, info), /* ULT GT3 */ \
INTEL_VGA_DEVICE(0x5927, info) /* ULT GT3 */ INTEL_VGA_DEVICE(0x5927, info) /* ULT GT3 */
#define INTEL_KBL_GT4_IDS(info) \ #define INTEL_KBL_GT4_IDS(info) \
@ -395,7 +466,10 @@
INTEL_VGA_DEVICE(0x9BC5, info), \ INTEL_VGA_DEVICE(0x9BC5, info), \
INTEL_VGA_DEVICE(0x9BC8, info), \ INTEL_VGA_DEVICE(0x9BC8, info), \
INTEL_VGA_DEVICE(0x9BC4, info), \ INTEL_VGA_DEVICE(0x9BC4, info), \
INTEL_VGA_DEVICE(0x9BC2, info) INTEL_VGA_DEVICE(0x9BC2, info), \
INTEL_VGA_DEVICE(0x9BC6, info), \
INTEL_VGA_DEVICE(0x9BE6, info), \
INTEL_VGA_DEVICE(0x9BF6, info)
#define INTEL_KBL_IDS(info) \ #define INTEL_KBL_IDS(info) \
INTEL_KBL_GT1_IDS(info), \ INTEL_KBL_GT1_IDS(info), \
@ -465,7 +539,14 @@
INTEL_CML_GT2_IDS(info) INTEL_CML_GT2_IDS(info)
/* CNL */ /* CNL */
#define INTEL_CNL_PORT_F_IDS(info) \
INTEL_VGA_DEVICE(0x5A54, info), \
INTEL_VGA_DEVICE(0x5A5C, info), \
INTEL_VGA_DEVICE(0x5A44, info), \
INTEL_VGA_DEVICE(0x5A4C, info)
#define INTEL_CNL_IDS(info) \ #define INTEL_CNL_IDS(info) \
INTEL_CNL_PORT_F_IDS(info), \
INTEL_VGA_DEVICE(0x5A51, info), \ INTEL_VGA_DEVICE(0x5A51, info), \
INTEL_VGA_DEVICE(0x5A59, info), \ INTEL_VGA_DEVICE(0x5A59, info), \
INTEL_VGA_DEVICE(0x5A41, info), \ INTEL_VGA_DEVICE(0x5A41, info), \
@ -475,18 +556,12 @@
INTEL_VGA_DEVICE(0x5A42, info), \ INTEL_VGA_DEVICE(0x5A42, info), \
INTEL_VGA_DEVICE(0x5A4A, info), \ INTEL_VGA_DEVICE(0x5A4A, info), \
INTEL_VGA_DEVICE(0x5A50, info), \ INTEL_VGA_DEVICE(0x5A50, info), \
INTEL_VGA_DEVICE(0x5A40, info), \ INTEL_VGA_DEVICE(0x5A40, info)
INTEL_VGA_DEVICE(0x5A54, info), \
INTEL_VGA_DEVICE(0x5A5C, info), \
INTEL_VGA_DEVICE(0x5A44, info), \
INTEL_VGA_DEVICE(0x5A4C, info)
/* ICL */ /* ICL */
#define INTEL_ICL_11_IDS(info) \ #define INTEL_ICL_PORT_F_IDS(info) \
INTEL_VGA_DEVICE(0x8A50, info), \ INTEL_VGA_DEVICE(0x8A50, info), \
INTEL_VGA_DEVICE(0x8A51, info), \
INTEL_VGA_DEVICE(0x8A5C, info), \ INTEL_VGA_DEVICE(0x8A5C, info), \
INTEL_VGA_DEVICE(0x8A5D, info), \
INTEL_VGA_DEVICE(0x8A59, info), \ INTEL_VGA_DEVICE(0x8A59, info), \
INTEL_VGA_DEVICE(0x8A58, info), \ INTEL_VGA_DEVICE(0x8A58, info), \
INTEL_VGA_DEVICE(0x8A52, info), \ INTEL_VGA_DEVICE(0x8A52, info), \
@ -496,7 +571,13 @@
INTEL_VGA_DEVICE(0x8A56, info), \ INTEL_VGA_DEVICE(0x8A56, info), \
INTEL_VGA_DEVICE(0x8A71, info), \ INTEL_VGA_DEVICE(0x8A71, info), \
INTEL_VGA_DEVICE(0x8A70, info), \ INTEL_VGA_DEVICE(0x8A70, info), \
INTEL_VGA_DEVICE(0x8A53, info) INTEL_VGA_DEVICE(0x8A53, info), \
INTEL_VGA_DEVICE(0x8A54, info)
#define INTEL_ICL_11_IDS(info) \
INTEL_ICL_PORT_F_IDS(info), \
INTEL_VGA_DEVICE(0x8A51, info), \
INTEL_VGA_DEVICE(0x8A5D, info)
/* EHL */ /* EHL */
#define INTEL_EHL_IDS(info) \ #define INTEL_EHL_IDS(info) \
@ -505,4 +586,14 @@
INTEL_VGA_DEVICE(0x4551, info), \ INTEL_VGA_DEVICE(0x4551, info), \
INTEL_VGA_DEVICE(0x4541, info) INTEL_VGA_DEVICE(0x4541, info)
/* TGL */
#define INTEL_TGL_12_IDS(info) \
INTEL_VGA_DEVICE(0x9A49, info), \
INTEL_VGA_DEVICE(0x9A40, info), \
INTEL_VGA_DEVICE(0x9A59, info), \
INTEL_VGA_DEVICE(0x9A60, info), \
INTEL_VGA_DEVICE(0x9A68, info), \
INTEL_VGA_DEVICE(0x9A70, info), \
INTEL_VGA_DEVICE(0x9A78, info)
#endif /* _I915_PCIIDS_H */ #endif /* _I915_PCIIDS_H */

View File

@ -337,6 +337,7 @@ drm_private bool intel_get_genx(unsigned int devid, int *gen);
#define IS_GEN9(devid) intel_is_genx(devid, 9) #define IS_GEN9(devid) intel_is_genx(devid, 9)
#define IS_GEN10(devid) intel_is_genx(devid, 10) #define IS_GEN10(devid) intel_is_genx(devid, 10)
#define IS_GEN11(devid) intel_is_genx(devid, 11) #define IS_GEN11(devid) intel_is_genx(devid, 11)
#define IS_GEN12(devid) intel_is_genx(devid, 12)
#define IS_9XX(dev) (IS_GEN3(dev) || \ #define IS_9XX(dev) (IS_GEN3(dev) || \
IS_GEN4(dev) || \ IS_GEN4(dev) || \

View File

@ -48,8 +48,6 @@
#if defined(ANDROID) && !defined(__LP64__) #if defined(ANDROID) && !defined(__LP64__)
#include <errno.h> /* for EINVAL */ #include <errno.h> /* for EINVAL */
extern void *__mmap2(void *, size_t, int, int, int, size_t);
static inline void *drm_mmap(void *addr, size_t length, int prot, int flags, static inline void *drm_mmap(void *addr, size_t length, int prot, int flags,
int fd, loff_t offset) int fd, loff_t offset)
{ {
@ -59,7 +57,7 @@ static inline void *drm_mmap(void *addr, size_t length, int prot, int flags,
return MAP_FAILED; return MAP_FAILED;
} }
return __mmap2(addr, length, prot, flags, fd, (size_t) (offset >> 12)); return mmap64(addr, length, prot, flags, fd, offset);
} }
# define drm_munmap(addr, length) \ # define drm_munmap(addr, length) \

View File

@ -75,7 +75,8 @@ am_amdgpu_test_OBJECTS = amdgpu_test-amdgpu_test.$(OBJEXT) \
amdgpu_test-uvd_enc_tests.$(OBJEXT) \ amdgpu_test-uvd_enc_tests.$(OBJEXT) \
amdgpu_test-vcn_tests.$(OBJEXT) \ amdgpu_test-vcn_tests.$(OBJEXT) \
amdgpu_test-deadlock_tests.$(OBJEXT) \ amdgpu_test-deadlock_tests.$(OBJEXT) \
amdgpu_test-vm_tests.$(OBJEXT) amdgpu_test-ras_tests.$(OBJEXT) amdgpu_test-vm_tests.$(OBJEXT) amdgpu_test-ras_tests.$(OBJEXT) \
amdgpu_test-syncobj_tests.$(OBJEXT)
amdgpu_test_OBJECTS = $(am_amdgpu_test_OBJECTS) amdgpu_test_OBJECTS = $(am_amdgpu_test_OBJECTS)
amdgpu_test_LDADD = $(LDADD) amdgpu_test_LDADD = $(LDADD)
am__DEPENDENCIES_1 = am__DEPENDENCIES_1 =
@ -306,7 +307,8 @@ amdgpu_test_SOURCES = \
uve_ib.h \ uve_ib.h \
deadlock_tests.c \ deadlock_tests.c \
vm_tests.c \ vm_tests.c \
ras_tests.c ras_tests.c \
syncobj_tests.c
all: all-am all: all-am
@ -413,6 +415,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/amdgpu_test-cs_tests.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/amdgpu_test-cs_tests.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/amdgpu_test-deadlock_tests.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/amdgpu_test-deadlock_tests.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/amdgpu_test-ras_tests.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/amdgpu_test-ras_tests.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/amdgpu_test-syncobj_tests.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/amdgpu_test-uvd_enc_tests.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/amdgpu_test-uvd_enc_tests.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/amdgpu_test-vce_tests.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/amdgpu_test-vce_tests.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/amdgpu_test-vcn_tests.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/amdgpu_test-vcn_tests.Po@am__quote@
@ -579,6 +582,20 @@ amdgpu_test-ras_tests.obj: ras_tests.c
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(amdgpu_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o amdgpu_test-ras_tests.obj `if test -f 'ras_tests.c'; then $(CYGPATH_W) 'ras_tests.c'; else $(CYGPATH_W) '$(srcdir)/ras_tests.c'; fi` @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(amdgpu_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o amdgpu_test-ras_tests.obj `if test -f 'ras_tests.c'; then $(CYGPATH_W) 'ras_tests.c'; else $(CYGPATH_W) '$(srcdir)/ras_tests.c'; fi`
amdgpu_test-syncobj_tests.o: syncobj_tests.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(amdgpu_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT amdgpu_test-syncobj_tests.o -MD -MP -MF $(DEPDIR)/amdgpu_test-syncobj_tests.Tpo -c -o amdgpu_test-syncobj_tests.o `test -f 'syncobj_tests.c' || echo '$(srcdir)/'`syncobj_tests.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/amdgpu_test-syncobj_tests.Tpo $(DEPDIR)/amdgpu_test-syncobj_tests.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='syncobj_tests.c' object='amdgpu_test-syncobj_tests.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(amdgpu_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o amdgpu_test-syncobj_tests.o `test -f 'syncobj_tests.c' || echo '$(srcdir)/'`syncobj_tests.c
amdgpu_test-syncobj_tests.obj: syncobj_tests.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(amdgpu_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT amdgpu_test-syncobj_tests.obj -MD -MP -MF $(DEPDIR)/amdgpu_test-syncobj_tests.Tpo -c -o amdgpu_test-syncobj_tests.obj `if test -f 'syncobj_tests.c'; then $(CYGPATH_W) 'syncobj_tests.c'; else $(CYGPATH_W) '$(srcdir)/syncobj_tests.c'; fi`
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/amdgpu_test-syncobj_tests.Tpo $(DEPDIR)/amdgpu_test-syncobj_tests.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='syncobj_tests.c' object='amdgpu_test-syncobj_tests.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(amdgpu_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o amdgpu_test-syncobj_tests.obj `if test -f 'syncobj_tests.c'; then $(CYGPATH_W) 'syncobj_tests.c'; else $(CYGPATH_W) '$(srcdir)/syncobj_tests.c'; fi`
mostlyclean-libtool: mostlyclean-libtool:
-rm -f *.lo -rm -f *.lo

View File

@ -71,16 +71,6 @@
#include "util_math.h" #include "util_math.h"
#ifdef __OpenBSD__
#define DRM_PRIMARY_MINOR_NAME "drm"
#define DRM_CONTROL_MINOR_NAME "drmC"
#define DRM_RENDER_MINOR_NAME "drmR"
#else
#define DRM_PRIMARY_MINOR_NAME "card"
#define DRM_CONTROL_MINOR_NAME "controlD"
#define DRM_RENDER_MINOR_NAME "renderD"
#endif
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__) #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
#define DRM_MAJOR 145 #define DRM_MAJOR 145
#endif #endif
@ -314,6 +304,19 @@ static int chown_check_return(const char *path, uid_t owner, gid_t group)
} }
#endif #endif
static const char *drmGetDeviceName(int type)
{
switch (type) {
case DRM_NODE_PRIMARY:
return DRM_DEV_NAME;
case DRM_NODE_CONTROL:
return DRM_CONTROL_DEV_NAME;
case DRM_NODE_RENDER:
return DRM_RENDER_DEV_NAME;
}
return NULL;
}
#ifdef X_PRIVSEP #ifdef X_PRIVSEP
static int static int
_priv_open_device(const char *path) _priv_open_device(const char *path)
@ -342,8 +345,8 @@ drm_public int priv_open_device(const char *)
static int drmOpenDevice(dev_t dev, int minor, int type) static int drmOpenDevice(dev_t dev, int minor, int type)
{ {
stat_t st; stat_t st;
const char *dev_name; const char *dev_name = drmGetDeviceName(type);
char buf[64]; char buf[DRM_NODE_NAME_MAX];
int fd; int fd;
mode_t devmode = DRM_DEV_MODE, serv_mode; mode_t devmode = DRM_DEV_MODE, serv_mode;
gid_t serv_group; gid_t serv_group;
@ -353,19 +356,8 @@ static int drmOpenDevice(dev_t dev, int minor, int type)
gid_t group = DRM_DEV_GID; gid_t group = DRM_DEV_GID;
#endif #endif
switch (type) { if (!dev_name)
case DRM_NODE_PRIMARY:
dev_name = DRM_DEV_NAME;
break;
case DRM_NODE_CONTROL:
dev_name = DRM_CONTROL_DEV_NAME;
break;
case DRM_NODE_RENDER:
dev_name = DRM_RENDER_DEV_NAME;
break;
default:
return -EINVAL; return -EINVAL;
};
sprintf(buf, dev_name, DRM_DIR_NAME, minor); sprintf(buf, dev_name, DRM_DIR_NAME, minor);
drmMsg("drmOpenDevice: node name is %s\n", buf); drmMsg("drmOpenDevice: node name is %s\n", buf);
@ -477,25 +469,14 @@ wait_for_udev:
static int drmOpenMinor(int minor, int create, int type) static int drmOpenMinor(int minor, int create, int type)
{ {
int fd; int fd;
char buf[64]; char buf[DRM_NODE_NAME_MAX];
const char *dev_name; const char *dev_name = drmGetDeviceName(type);
if (create) if (create)
return drmOpenDevice(makedev(DRM_MAJOR, minor), minor, type); return drmOpenDevice(makedev(DRM_MAJOR, minor), minor, type);
switch (type) { if (!dev_name)
case DRM_NODE_PRIMARY:
dev_name = DRM_DEV_NAME;
break;
case DRM_NODE_CONTROL:
dev_name = DRM_CONTROL_DEV_NAME;
break;
case DRM_NODE_RENDER:
dev_name = DRM_RENDER_DEV_NAME;
break;
default:
return -EINVAL; return -EINVAL;
};
sprintf(buf, dev_name, DRM_DIR_NAME, minor); sprintf(buf, dev_name, DRM_DIR_NAME, minor);
#ifndef X_PRIVSEP #ifndef X_PRIVSEP
@ -777,8 +758,8 @@ drm_public int drmOpen(const char *name, const char *busid)
*/ */
drm_public int drmOpenWithType(const char *name, const char *busid, int type) drm_public int drmOpenWithType(const char *name, const char *busid, int type)
{ {
if (!drmAvailable() && name != NULL && drm_server_info && if (name != NULL && drm_server_info &&
drm_server_info->load_module) { drm_server_info->load_module && !drmAvailable()) {
/* try to load the kernel module */ /* try to load the kernel module */
if (!drm_server_info->load_module(name)) { if (!drm_server_info->load_module(name)) {
drmMsg("[drm] failed to load kernel module \"%s\"\n", name); drmMsg("[drm] failed to load kernel module \"%s\"\n", name);
@ -2929,7 +2910,7 @@ static char *drmGetMinorNameForFD(int fd, int type)
#else #else
struct stat sbuf; struct stat sbuf;
char buf[PATH_MAX + 1]; char buf[PATH_MAX + 1];
const char *dev_name; const char *dev_name = drmGetDeviceName(type);
unsigned int maj, min; unsigned int maj, min;
int n; int n;
@ -2942,19 +2923,8 @@ static char *drmGetMinorNameForFD(int fd, int type)
if (!drmNodeIsDRM(maj, min) || !S_ISCHR(sbuf.st_mode)) if (!drmNodeIsDRM(maj, min) || !S_ISCHR(sbuf.st_mode))
return NULL; return NULL;
switch (type) { if (!dev_name)
case DRM_NODE_PRIMARY:
dev_name = DRM_DEV_NAME;
break;
case DRM_NODE_CONTROL:
dev_name = DRM_CONTROL_DEV_NAME;
break;
case DRM_NODE_RENDER:
dev_name = DRM_RENDER_DEV_NAME;
break;
default:
return NULL; return NULL;
};
n = snprintf(buf, sizeof(buf), dev_name, DRM_DIR_NAME, min); n = snprintf(buf, sizeof(buf), dev_name, DRM_DIR_NAME, min);
if (n == -1 || n >= sizeof(buf)) if (n == -1 || n >= sizeof(buf))
@ -3868,19 +3838,9 @@ drm_public int drmGetDevice2(int fd, uint32_t flags, drmDevicePtr *device)
if (node_type == -1) if (node_type == -1)
return -ENODEV; return -ENODEV;
switch (node_type) { dev_name = drmGetDeviceName(node_type);
case DRM_NODE_PRIMARY: if (!dev_name)
dev_name = DRM_DEV_NAME;
break;
case DRM_NODE_CONTROL:
dev_name = DRM_CONTROL_DEV_NAME;
break;
case DRM_NODE_RENDER:
dev_name = DRM_RENDER_DEV_NAME;
break;
default:
return -EINVAL; return -EINVAL;
};
n = snprintf(node, PATH_MAX, dev_name, DRM_DIR_NAME, min); n = snprintf(node, PATH_MAX, dev_name, DRM_DIR_NAME, min);
if (n == -1 || n >= PATH_MAX) if (n == -1 || n >= PATH_MAX)
@ -4117,19 +4077,9 @@ drm_public char *drmGetDeviceNameFromFd2(int fd)
if (node_type == -1) if (node_type == -1)
return NULL; return NULL;
switch (node_type) { dev_name = drmGetDeviceName(node_type);
case DRM_NODE_PRIMARY: if (!dev_name)
dev_name = DRM_DEV_NAME;
break;
case DRM_NODE_CONTROL:
dev_name = DRM_CONTROL_DEV_NAME;
break;
case DRM_NODE_RENDER:
dev_name = DRM_RENDER_DEV_NAME;
break;
default:
return NULL; return NULL;
};
n = snprintf(node, PATH_MAX, dev_name, DRM_DIR_NAME, min); n = snprintf(node, PATH_MAX, dev_name, DRM_DIR_NAME, min);
if (n == -1 || n >= PATH_MAX) if (n == -1 || n >= PATH_MAX)
@ -4271,3 +4221,80 @@ drm_public int drmSyncobjSignal(int fd, const uint32_t *handles,
ret = drmIoctl(fd, DRM_IOCTL_SYNCOBJ_SIGNAL, &args); ret = drmIoctl(fd, DRM_IOCTL_SYNCOBJ_SIGNAL, &args);
return ret; return ret;
} }
drm_public int drmSyncobjTimelineSignal(int fd, const uint32_t *handles,
uint64_t *points, uint32_t handle_count)
{
struct drm_syncobj_timeline_array args;
int ret;
memclear(args);
args.handles = (uintptr_t)handles;
args.points = (uintptr_t)points;
args.count_handles = handle_count;
ret = drmIoctl(fd, DRM_IOCTL_SYNCOBJ_TIMELINE_SIGNAL, &args);
return ret;
}
drm_public int drmSyncobjTimelineWait(int fd, uint32_t *handles, uint64_t *points,
unsigned num_handles,
int64_t timeout_nsec, unsigned flags,
uint32_t *first_signaled)
{
struct drm_syncobj_timeline_wait args;
int ret;
memclear(args);
args.handles = (uintptr_t)handles;
args.points = (uintptr_t)points;
args.timeout_nsec = timeout_nsec;
args.count_handles = num_handles;
args.flags = flags;
ret = drmIoctl(fd, DRM_IOCTL_SYNCOBJ_TIMELINE_WAIT, &args);
if (ret < 0)
return -errno;
if (first_signaled)
*first_signaled = args.first_signaled;
return ret;
}
drm_public int drmSyncobjQuery(int fd, uint32_t *handles, uint64_t *points,
uint32_t handle_count)
{
struct drm_syncobj_timeline_array args;
int ret;
memclear(args);
args.handles = (uintptr_t)handles;
args.points = (uintptr_t)points;
args.count_handles = handle_count;
ret = drmIoctl(fd, DRM_IOCTL_SYNCOBJ_QUERY, &args);
if (ret)
return ret;
return 0;
}
drm_public int drmSyncobjTransfer(int fd,
uint32_t dst_handle, uint64_t dst_point,
uint32_t src_handle, uint64_t src_point,
uint32_t flags)
{
struct drm_syncobj_transfer args;
int ret;
memclear(args);
args.src_handle = src_handle;
args.dst_handle = dst_handle;
args.src_point = src_point;
args.dst_point = dst_point;
args.flags = flags;
ret = drmIoctl(fd, DRM_IOCTL_SYNCOBJ_TRANSFER, &args);
return ret;
}

View File

@ -78,17 +78,29 @@ extern "C" {
#ifdef __OpenBSD__ #ifdef __OpenBSD__
#define DRM_DIR_NAME "/dev" #define DRM_DIR_NAME "/dev"
#define DRM_DEV_NAME "%s/drm%d" #define DRM_PRIMARY_MINOR_NAME "drm"
#define DRM_CONTROL_DEV_NAME "%s/drmC%d" #define DRM_CONTROL_MINOR_NAME "drmC"
#define DRM_RENDER_DEV_NAME "%s/drmR%d" #define DRM_RENDER_MINOR_NAME "drmR"
#else #else
#define DRM_DIR_NAME "/dev/dri" #define DRM_DIR_NAME "/dev/dri"
#define DRM_DEV_NAME "%s/card%d" #define DRM_PRIMARY_MINOR_NAME "card"
#define DRM_CONTROL_DEV_NAME "%s/controlD%d" #define DRM_CONTROL_MINOR_NAME "controlD"
#define DRM_RENDER_DEV_NAME "%s/renderD%d" #define DRM_RENDER_MINOR_NAME "renderD"
#define DRM_PROC_NAME "/proc/dri/" /* For backward Linux compatibility */ #define DRM_PROC_NAME "/proc/dri/" /* For backward Linux compatibility */
#endif #endif
#define DRM_DEV_NAME "%s/" DRM_PRIMARY_MINOR_NAME "%d"
#define DRM_CONTROL_DEV_NAME "%s/" DRM_CONTROL_MINOR_NAME "%d"
#define DRM_RENDER_DEV_NAME "%s/" DRM_RENDER_MINOR_NAME "%d"
#define DRM_NODE_NAME_MAX \
(sizeof(DRM_DIR_NAME) + 1 /* slash */ \
+ MAX3(sizeof(DRM_PRIMARY_MINOR_NAME), \
sizeof(DRM_CONTROL_MINOR_NAME), \
sizeof(DRM_RENDER_MINOR_NAME)) \
+ sizeof("144") /* highest possible node number */ \
+ 1) /* NULL-terminator */
#define DRM_ERR_NO_DEVICE (-1001) #define DRM_ERR_NO_DEVICE (-1001)
#define DRM_ERR_NO_ACCESS (-1002) #define DRM_ERR_NO_ACCESS (-1002)
#define DRM_ERR_NOT_ROOT (-1003) #define DRM_ERR_NOT_ROOT (-1003)
@ -876,6 +888,18 @@ extern int drmSyncobjWait(int fd, uint32_t *handles, unsigned num_handles,
uint32_t *first_signaled); uint32_t *first_signaled);
extern int drmSyncobjReset(int fd, const uint32_t *handles, uint32_t handle_count); extern int drmSyncobjReset(int fd, const uint32_t *handles, uint32_t handle_count);
extern int drmSyncobjSignal(int fd, const uint32_t *handles, uint32_t handle_count); extern int drmSyncobjSignal(int fd, const uint32_t *handles, uint32_t handle_count);
extern int drmSyncobjTimelineSignal(int fd, const uint32_t *handles,
uint64_t *points, uint32_t handle_count);
extern int drmSyncobjTimelineWait(int fd, uint32_t *handles, uint64_t *points,
unsigned num_handles,
int64_t timeout_nsec, unsigned flags,
uint32_t *first_signaled);
extern int drmSyncobjQuery(int fd, uint32_t *handles, uint64_t *points,
uint32_t handle_count);
extern int drmSyncobjTransfer(int fd,
uint32_t dst_handle, uint64_t dst_point,
uint32_t src_handle, uint64_t src_point,
uint32_t flags);
#if defined(__cplusplus) #if defined(__cplusplus)
} }

View File

@ -650,7 +650,7 @@ drm_public drmModePropertyPtr drmModeGetProperty(int fd, uint32_t property_id)
} }
if (!(r = drmMalloc(sizeof(*r)))) if (!(r = drmMalloc(sizeof(*r))))
return NULL; goto err_allocs;
r->prop_id = prop.prop_id; r->prop_id = prop.prop_id;
r->count_values = prop.count_values; r->count_values = prop.count_values;
@ -1259,7 +1259,7 @@ drm_public drmModeAtomicReqPtr drmModeAtomicDuplicate(drmModeAtomicReqPtr old)
return NULL; return NULL;
} }
memcpy(new->items, old->items, memcpy(new->items, old->items,
old->size_items * sizeof(*new->items)); old->cursor * sizeof(*new->items));
} else { } else {
new->items = NULL; new->items = NULL;
} }
@ -1322,12 +1322,13 @@ drm_public int drmModeAtomicAddProperty(drmModeAtomicReqPtr req,
return -EINVAL; return -EINVAL;
if (req->cursor >= req->size_items) { if (req->cursor >= req->size_items) {
const uint32_t item_size_inc = getpagesize() / sizeof(*req->items);
drmModeAtomicReqItemPtr new; drmModeAtomicReqItemPtr new;
req->size_items += 16; req->size_items += item_size_inc;
new = realloc(req->items, req->size_items * sizeof(*req->items)); new = realloc(req->items, req->size_items * sizeof(*req->items));
if (!new) { if (!new) {
req->size_items -= 16; req->size_items -= item_size_inc;
return -ENOMEM; return -ENOMEM;
} }
req->items = new; req->items = new;