Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[xsrc/trunk]: xsrc/external/mit/libdrm/dist initial import of libdrm-2.4.107
details: https://anonhg.NetBSD.org/xsrc/rev/89c29bef88a1
branches: trunk
changeset: 10756:89c29bef88a1
user: mrg <mrg%NetBSD.org@localhost>
date: Sun Jul 11 00:27:20 2021 +0000
description:
initial import of libdrm-2.4.107
diffstat:
external/mit/libdrm/dist/README.rst | 18 +
external/mit/libdrm/dist/amdgpu/amdgpu.h | 1 +
external/mit/libdrm/dist/core-symbols.txt | 2 +
external/mit/libdrm/dist/data/amdgpu.ids | 8 +
external/mit/libdrm/dist/gen_table_fourcc.py | 84 +++
external/mit/libdrm/dist/intel/i915_pciids.h | 21 +
external/mit/libdrm/dist/intel/intel_chipset.c | 1 +
external/mit/libdrm/dist/libkms/vmwgfx.c | 3 +
external/mit/libdrm/dist/meson.build | 11 +-
external/mit/libdrm/dist/nouveau/nouveau.c | 30 +-
external/mit/libdrm/dist/nouveau/private.h | 17 +-
external/mit/libdrm/dist/nouveau/pushbuf.c | 9 +-
external/mit/libdrm/dist/tests/amdgpu/amdgpu_test.c | 115 +++-
external/mit/libdrm/dist/tests/amdgpu/amdgpu_test.h | 44 +-
external/mit/libdrm/dist/tests/amdgpu/basic_tests.c | 61 +-
external/mit/libdrm/dist/tests/amdgpu/cs_tests.c | 7 +-
external/mit/libdrm/dist/tests/amdgpu/deadlock_tests.c | 18 +-
external/mit/libdrm/dist/tests/amdgpu/hotunplug_tests.c | 445 ++++++++++++++++
external/mit/libdrm/dist/tests/amdgpu/meson.build | 1 +
external/mit/libdrm/dist/tests/amdgpu/security_tests.c | 3 +-
external/mit/libdrm/dist/tests/amdgpu/syncobj_tests.c | 24 +-
external/mit/libdrm/dist/tests/amdgpu/vce_tests.c | 2 +-
external/mit/libdrm/dist/tests/amdgpu/vcn_tests.c | 2 +-
external/mit/libdrm/dist/tests/amdgpu/vm_tests.c | 9 +-
24 files changed, 862 insertions(+), 74 deletions(-)
diffs (truncated from 1463 to 300 lines):
diff -r d594523338e2 -r 89c29bef88a1 external/mit/libdrm/dist/README.rst
--- a/external/mit/libdrm/dist/README.rst Sun Jul 11 00:13:26 2021 +0000
+++ b/external/mit/libdrm/dist/README.rst Sun Jul 11 00:27:20 2021 +0000
@@ -13,6 +13,24 @@
libdrm is a low-level library, typically used by graphics drivers such as
the Mesa drivers, the X drivers, libva and similar projects.
+Syncing with the Linux kernel headers
+-------------------------------------
+
+The library should be regularly updated to match the recent changes in the
+`include/uapi/drm/`.
+
+libdrm maintains a human-readable version for the token format modifier, with
+the simpler ones being extracted automatically from `drm_fourcc.h` header file
+with the help of a python script. This might not always possible, as some of
+the vendors require decoding/extracting them programmatically. For that
+reason one can enhance the current vendor functions to include/provide the
+newly added token formats, or, in case there's no such decoding
+function, to add one that performs the tasks of extracting them.
+
+For simpler format modifier tokens there's a script (gen_table_fourcc.py) that
+creates a static table, by going over `drm_fourcc.h` header file. The script
+could be further modified if it can't handle new (simpler) token format
+modifiers instead of the generated static table.
Compiling
---------
diff -r d594523338e2 -r 89c29bef88a1 external/mit/libdrm/dist/amdgpu/amdgpu.h
--- a/external/mit/libdrm/dist/amdgpu/amdgpu.h Sun Jul 11 00:13:26 2021 +0000
+++ b/external/mit/libdrm/dist/amdgpu/amdgpu.h Sun Jul 11 00:27:20 2021 +0000
@@ -1280,6 +1280,7 @@
*/
#define AMDGPU_VA_RANGE_32_BIT 0x1
#define AMDGPU_VA_RANGE_HIGH 0x2
+#define AMDGPU_VA_RANGE_REPLAYABLE 0x4
/**
* Allocate virtual address range
diff -r d594523338e2 -r 89c29bef88a1 external/mit/libdrm/dist/core-symbols.txt
--- a/external/mit/libdrm/dist/core-symbols.txt Sun Jul 11 00:13:26 2021 +0000
+++ b/external/mit/libdrm/dist/core-symbols.txt Sun Jul 11 00:27:20 2021 +0000
@@ -196,3 +196,5 @@
drmUnmapBufs
drmUpdateDrawableInfo
drmWaitVBlank
+drmGetFormatModifierName
+drmGetFormatModifierVendor
diff -r d594523338e2 -r 89c29bef88a1 external/mit/libdrm/dist/data/amdgpu.ids
--- a/external/mit/libdrm/dist/data/amdgpu.ids Sun Jul 11 00:13:26 2021 +0000
+++ b/external/mit/libdrm/dist/data/amdgpu.ids Sun Jul 11 00:27:20 2021 +0000
@@ -135,7 +135,9 @@
67C2, 01, AMD Radeon (TM) Pro V7350x2
67C2, 02, AMD Radeon (TM) Pro V7300X
67C4, 00, AMD Radeon (TM) Pro WX 7100 Graphics
+67C4, 80, AMD Radeon (TM) E9560/E9565 Graphics
67C7, 00, AMD Radeon (TM) Pro WX 5100 Graphics
+67C7, 80, AMD Radeon (TM) Pro E9390 Graphics
67C0, 00, AMD Radeon (TM) Pro WX 7100 Graphics
67D0, 01, AMD Radeon (TM) Pro V7350x2
67D0, 02, AMD Radeon (TM) Pro V7300X
@@ -271,9 +273,15 @@
7340, CF, Radeon RX 5300
7341, 00, AMD Radeon Pro W5500
7347, 00, AMD Radeon Pro W5500M
+73A3, 00, AMD Radeon PRO W6800
+73AF, C0, AMD Radeon RX 6900 XT
73BF, C0, AMD Radeon RX 6900 XT
73BF, C1, AMD Radeon RX 6800 XT
73BF, C3, AMD Radeon RX 6800
+73DF, C1, AMD Radeon RX 6700 XT
+73DF, C5, AMD Radeon RX 6700 XT
+73E1, 00, AMD Radeon PRO W6600M
+73E3, 00, AMD Radeon PRO W6600
9874, C4, AMD Radeon R7 Graphics
9874, C5, AMD Radeon R6 Graphics
9874, C6, AMD Radeon R6 Graphics
diff -r d594523338e2 -r 89c29bef88a1 external/mit/libdrm/dist/gen_table_fourcc.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/external/mit/libdrm/dist/gen_table_fourcc.py Sun Jul 11 00:27:20 2021 +0000
@@ -0,0 +1,84 @@
+#!/usr/bin/env python3
+
+# Copyright 2021 Collabora, Ltd.
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice (including the
+# next paragraph) shall be included in all copies or substantial
+# portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+# BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+# ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+# Helper script that reads drm_fourcc.h and writes a static table with the
+# simpler format token modifiers
+
+import sys
+import re
+
+filename = sys.argv[1]
+towrite = sys.argv[2]
+
+fm_re = {
+ 'intel': r'^#define I915_FORMAT_MOD_(\w+)',
+ 'others': r'^#define DRM_FORMAT_MOD_((?:ARM|SAMSUNG|QCOM|VIVANTE|NVIDIA|BROADCOM|ALLWINNER)\w+)\s',
+ 'vendors': r'^#define DRM_FORMAT_MOD_VENDOR_(\w+)'
+}
+
+def print_fm_intel(f, f_mod):
+ f.write(' {{ DRM_MODIFIER_INTEL({}, {}) }},\n'.format(f_mod, f_mod))
+
+# generic write func
+def print_fm(f, vendor, mod, f_name):
+ f.write(' {{ DRM_MODIFIER({}, {}, {}) }},\n'.format(vendor, mod, f_name))
+
+with open(filename, "r") as f:
+ data = f.read()
+ for k, v in fm_re.items():
+ fm_re[k] = re.findall(v, data, flags=re.M)
+
+with open(towrite, "w") as f:
+ f.write('''\
+/* AUTOMATICALLY GENERATED by gen_table_fourcc.py. You should modify
+ that script instead of adding here entries manually! */
+static const struct drmFormatModifierInfo drm_format_modifier_table[] = {
+''')
+ f.write(' { DRM_MODIFIER_INVALID(NONE, INVALID_MODIFIER) },\n')
+ f.write(' { DRM_MODIFIER_LINEAR(NONE, LINEAR) },\n')
+
+ for entry in fm_re['intel']:
+ print_fm_intel(f, entry)
+
+ for entry in fm_re['others']:
+ (vendor, mod) = entry.split('_', 1)
+ if vendor == 'ARM' and (mod == 'TYPE_AFBC' or mod == 'TYPE_MISC'):
+ continue
+ print_fm(f, vendor, mod, mod)
+
+ f.write('''\
+};
+''')
+
+ f.write('''\
+static const struct drmFormatModifierVendorInfo drm_format_modifier_vendor_table[] = {
+''')
+
+ for entry in fm_re['vendors']:
+ f.write(" {{ DRM_FORMAT_MOD_VENDOR_{}, \"{}\" }},\n".format(entry, entry))
+
+ f.write('''\
+};
+''')
diff -r d594523338e2 -r 89c29bef88a1 external/mit/libdrm/dist/intel/i915_pciids.h
--- a/external/mit/libdrm/dist/intel/i915_pciids.h Sun Jul 11 00:13:26 2021 +0000
+++ b/external/mit/libdrm/dist/intel/i915_pciids.h Sun Jul 11 00:27:20 2021 +0000
@@ -645,4 +645,25 @@
INTEL_VGA_DEVICE(0x4692, info), \
INTEL_VGA_DEVICE(0x4693, info)
+/* ADL-P */
+#define INTEL_ADLP_IDS(info) \
+ INTEL_VGA_DEVICE(0x46A0, info), \
+ INTEL_VGA_DEVICE(0x46A1, info), \
+ INTEL_VGA_DEVICE(0x46A2, info), \
+ INTEL_VGA_DEVICE(0x46A3, info), \
+ INTEL_VGA_DEVICE(0x46A6, info), \
+ INTEL_VGA_DEVICE(0x46A8, info), \
+ INTEL_VGA_DEVICE(0x46AA, info), \
+ INTEL_VGA_DEVICE(0x462A, info), \
+ INTEL_VGA_DEVICE(0x4626, info), \
+ INTEL_VGA_DEVICE(0x4628, info), \
+ INTEL_VGA_DEVICE(0x46B0, info), \
+ INTEL_VGA_DEVICE(0x46B1, info), \
+ INTEL_VGA_DEVICE(0x46B2, info), \
+ INTEL_VGA_DEVICE(0x46B3, info), \
+ INTEL_VGA_DEVICE(0x46C0, info), \
+ INTEL_VGA_DEVICE(0x46C1, info), \
+ INTEL_VGA_DEVICE(0x46C2, info), \
+ INTEL_VGA_DEVICE(0x46C3, info)
+
#endif /* _I915_PCIIDS_H */
diff -r d594523338e2 -r 89c29bef88a1 external/mit/libdrm/dist/intel/intel_chipset.c
--- a/external/mit/libdrm/dist/intel/intel_chipset.c Sun Jul 11 00:13:26 2021 +0000
+++ b/external/mit/libdrm/dist/intel/intel_chipset.c Sun Jul 11 00:27:20 2021 +0000
@@ -35,6 +35,7 @@
uint16_t gen;
} pciids[] = {
/* Keep ids sorted by gen; latest gen first */
+ INTEL_ADLP_IDS(12),
INTEL_ADLS_IDS(12),
INTEL_RKL_IDS(12),
INTEL_DG1_IDS(12),
diff -r d594523338e2 -r 89c29bef88a1 external/mit/libdrm/dist/libkms/vmwgfx.c
--- a/external/mit/libdrm/dist/libkms/vmwgfx.c Sun Jul 11 00:13:26 2021 +0000
+++ b/external/mit/libdrm/dist/libkms/vmwgfx.c Sun Jul 11 00:27:20 2021 +0000
@@ -25,6 +25,9 @@
*
**************************************************************************/
+#ifdef __FreeBSD__
+#define _WANT_KERNEL_ERRNO
+#endif
#include <errno.h>
#include <stdlib.h>
diff -r d594523338e2 -r 89c29bef88a1 external/mit/libdrm/dist/meson.build
--- a/external/mit/libdrm/dist/meson.build Sun Jul 11 00:13:26 2021 +0000
+++ b/external/mit/libdrm/dist/meson.build Sun Jul 11 00:27:20 2021 +0000
@@ -21,9 +21,9 @@
project(
'libdrm',
['c'],
- version : '2.4.105',
+ version : '2.4.107',
license : 'MIT',
- meson_version : '>= 0.43',
+ meson_version : '>= 0.46',
default_options : ['buildtype=debugoptimized', 'c_std=gnu99'],
)
@@ -51,6 +51,11 @@
intel_atomics = false
lib_atomics = false
+python3 = import('python').find_installation()
+format_mod_static_table = custom_target('format_mod_static_table',
+ output : 'generated_static_table_fourcc.h', input: 'include/drm/drm_fourcc.h',
+ command : [python3, files('gen_table_fourcc.py'), '@INPUT@', '@OUTPUT@'])
+
dep_atomic_ops = dependency('atomic_ops', required : false)
if cc.links('''
int atomic_add(int *i) { return __sync_add_and_fetch (i, 1); }
@@ -300,7 +305,7 @@
'xf86drm.c', 'xf86drmHash.c', 'xf86drmRandom.c', 'xf86drmSL.c',
'xf86drmMode.c'
),
- config_file,
+ config_file, format_mod_static_table
],
c_args : libdrm_c_args,
dependencies : [dep_valgrind, dep_rt, dep_m],
diff -r d594523338e2 -r 89c29bef88a1 external/mit/libdrm/dist/nouveau/nouveau.c
--- a/external/mit/libdrm/dist/nouveau/nouveau.c Sun Jul 11 00:13:26 2021 +0000
+++ b/external/mit/libdrm/dist/nouveau/nouveau.c Sun Jul 11 00:27:20 2021 +0000
@@ -46,19 +46,35 @@
#include "nvif/ioctl.h"
#include "nvif/unpack.h"
-#ifdef DEBUG
+drm_private FILE *nouveau_out = NULL;
drm_private uint32_t nouveau_debug = 0;
static void
-debug_init(char *args)
+debug_init(void)
{
- if (args) {
- int n = strtol(args, NULL, 0);
+ static bool once = false;
+ char *debug, *out;
+
+ if (once)
+ return;
+ once = true;
+
+ debug = getenv("NOUVEAU_LIBDRM_DEBUG");
+ if (debug) {
+ int n = strtol(debug, NULL, 0);
if (n >= 0)
nouveau_debug = n;
+
+ }
+
+ nouveau_out = stderr;
+ out = getenv("NOUVEAU_LIBDRM_OUT");
+ if (out) {
+ FILE *fout = fopen(out, "w");
+ if (fout)
+ nouveau_out = fout;
}
}
-#endif
static int
nouveau_object_ioctl(struct nouveau_object *obj, void *data, uint32_t size)
@@ -327,9 +343,7 @@
struct nouveau_drm *drm;
Home |
Main Index |
Thread Index |
Old Index