Commit graph

7132 commits

Author SHA1 Message Date
Simon Ser
ad78bb591d build: bump version to 2.4.122
Signed-off-by: Simon Ser <contact@emersion.fr>
2024-06-26 10:13:31 +02:00
Simon Ser
998d2a2e81 Sync headers with drm-next
Synchronize drm_fourcc.h and drm_mode.h to drm-next.

Generated using make headers_install.
Generated from drm-next branch commit 541b1b0a8fc235bca355921eb7f3f59a8efa3e9a

Signed-off-by: Simon Ser <contact@emersion.fr>
2024-06-26 08:08:40 +00:00
Enrico Weigelt, metux IT consult
a97bd7b4ac ci: upgrade FreeBSD VM to 14.1
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-06-25 12:57:01 +02:00
Enrico Weigelt, metux IT consult
d096affbaa ci: upgrade debian container to bookworm
Buster is oldoldstable and EOL in a few days. Bookworm is the current stable.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-06-25 12:56:11 +02:00
Enrico Weigelt, metux IT consult
589f8e86f1 etnaviv: fix FTBS on undefined linux/* headers on non-Linux platforms.
Using C standard headers instead.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-06-25 10:41:35 +02:00
Enrico Weigelt, metux IT consult
b7338fc842 freedreno: fix FTBS on non-Linux platforms (unused header)
The <linux/fb.h> header only exists on Linux, but isn't used anymore,
so drop it entirely.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-06-24 17:44:54 +00:00
Enrico Weigelt, metux IT consult
90c1a35f2a fix FTBS on FreeBSD (or non-Linux in general)
Several drivers still including <linux/stddef.h>, but not using anything
from it, thus breaking build on non-Linux platforms (eg. FreeBSD).
Since not needed at all, just stop including it.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-06-24 17:24:28 +00:00
Enrico Weigelt, metux IT consult
0cd18d0dfb OpenBSD: fix FTBS on misspelled and missing variables
../xf86drm.c:4622:9: error: use of undeclared identifier 'written'; did you mean 'write'?
    if (written + 1 > max_node_length)
        ^~~~~~~
        write

../xf86drm.c:4624:21: error: use of undeclared identifier 'sbuf'; did you mean 'sbrk'?
    if (stat(node, &sbuf))
                    ^~~~

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-06-24 12:57:51 +02:00
Nicolas Caramelli
7f20912b1b Remove libm in libdrm dependencies
Signed-off-by: Nicolas Caramelli <caramelli.devel@gmail.com>
2024-06-02 22:09:56 +00:00
Marek Olšák
70c4f836cc Bump version to 2.4.121 2024-06-01 13:31:41 -04:00
Marek Olšák
93d037cdd4 amdgpu: sync amdgpu_drm.h 2024-06-01 13:27:04 -04:00
Flora Cui
37265ab0ad tests/amdgpu: fix compile error with gcc14
../../drm/tests/amdgpu/shader_code.h:114:9: error: initialization of
‘const uint32_t *’ {aka ‘const unsigned int *’} from incompatible
pointer type ‘const uint32_t (*)[10][6]’ {aka ‘const unsigned int
(*)[10][6]’} [-Wincompatible-pointer-types]
  114 |         ps_##_ps##_shader_patchinfo_code_gfx##_n, \
      |         ^~~
../../drm/tests/amdgpu/shader_code.h:119:10: note: in expansion of macro
‘SHADER_PS_INFO’
  119 |         {SHADER_PS_INFO(const, 9), SHADER_PS_INFO(tex, 9)},
      |          ^~~~~~~~~~~~~~

Signed-off-by: Flora Cui <flora.cui@amd.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
2024-05-27 10:37:25 +08:00
Flora Cui
cee441f32d tests/amdgpu: fix compile error with gcc7.5
fix commit cc3c80c6("tests/amdgpu: refactor dispatch/draw test")
../../SOURCES/drm/tests/amdgpu/shader_code.h:113:2: error: initializer
element is not constant
  ps_##_ps##_shader_patchinfo_code_size_gfx##_n, \
	    ^

Signed-off-by: Flora Cui <flora.cui@amd.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
2024-05-27 10:37:18 +08:00
Flora Cui
058a04de62 tests/amdgpu: fix compile warning with the guard enum value
../../drm/tests/amdgpu/shader_test_util.c: In function
‘amdgpu_dispatch_init’:
../../drm/tests/amdgpu/shader_test_util.c:296:9: warning: enumeration
value ‘AMDGPU_TEST_GFX_MAX’ not handled in switch [-Wswitch]
  296 |         switch (test_priv->info->version) {
      |         ^~~~~~

Signed-off-by: Flora Cui <flora.cui@amd.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
2024-05-27 10:37:13 +08:00
José Expósito
4df9173595 amdgpu: Make amdgpu_cs_signal_semaphore() thread-safe
The issue was found by a static analysis tool:

    Error: LOCK_EVASION (CWE-543):
    libdrm-2.4.115/amdgpu/amdgpu_cs.c:596: thread1_checks_field:
        Thread1 uses the value read from field "context" in the
        condition "sem->signal_fence.context". It sees that the
        condition is false. Control is switched to Thread2.
    libdrm-2.4.115/amdgpu/amdgpu_cs.c:596: thread2_checks_field:
        Thread2 uses the value read from field "context" in the
        condition "sem->signal_fence.context". It sees that the
        condition is false.
    libdrm-2.4.115/amdgpu/amdgpu_cs.c:598: thread2_acquires_lock:
        Thread2 acquires lock "amdgpu_context.sequence_mutex".
    libdrm-2.4.115/amdgpu/amdgpu_cs.c:599: thread2_modifies_field:
        Thread2 sets "context" to a new value. Note that this write can
        be reordered at runtime to occur before instructions that do
        not access this field within this locked region. After Thread2
        leaves the critical section, control is switched back to
        Thread1.
    libdrm-2.4.115/amdgpu/amdgpu_cs.c:598: thread1_acquires_lock:
        Thread1 acquires lock "amdgpu_context.sequence_mutex".
    libdrm-2.4.115/amdgpu/amdgpu_cs.c:599: thread1_overwrites_value_in_field:
        Thread1 sets "context" to a new value. Now the two threads have
        an inconsistent view of "context" and updates to fields of
        "context" or fields correlated with "context" may be lost.
    libdrm-2.4.115/amdgpu/amdgpu_cs.c:596: use_same_locks_for_read_and_modify:
        Guard the modification of "context" and the read used to decide
        whether to modify "context" with the same set of locks.
    #  597|                   return -EINVAL;
    #  598|           pthread_mutex_lock(&ctx->sequence_mutex);
    #  599|->         sem->signal_fence.context = ctx;
    #  600|           sem->signal_fence.ip_type = ip_type;
    #  601|           sem->signal_fence.ip_instance = ip_instance;

Check `sem->signal_fence.context` in the locked region to avoid a race
condition.

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Signed-off-by: José Expósito <jexposit@redhat.com>
2024-05-23 18:57:18 +00:00
Simon Ser
362b5b0a88 xf86drm: document drmDevicesEqual()
I always need to double-check what the return value means when
using that function (since it's not a bool).

Signed-off-by: Simon Ser <contact@emersion.fr>
2024-04-11 12:11:30 +02:00
David Heidelberg
1179edb49a include poll.h instead of sys/poll.h
Fixes: f803a45e74 ("add libsync.h helper")
Fixes: 4c18828e16 ("tegra: Add job and push buffer APIs")
Signed-off-by: David Heidelberg <david@ixit.cz>
2024-04-10 23:27:16 +00:00
Simon Ser
f94a79a7a7 ci: use "meson setup" sub-command
"meson" without a sub-command is deprecated.

Signed-off-by: Simon Ser <contact@emersion.fr>
2024-03-29 16:09:47 +01:00
Simon Ser
5a9cfb3c59 ci: build with meson --fatal-meson-warnings
This catches uses of deprecated features.

Signed-off-by: Simon Ser <contact@emersion.fr>
2024-03-29 11:44:09 +01:00
Joaquim Monteiro
764ed8b916
meson: Fix broken str.format usage
str.format used to allow any type as an argument, which often resulted
in using an internal string representation. This is considered broken
behavior, and is deprecated since Meson 1.3.0.

Signed-off-by: Joaquim Monteiro <joaquim.monteiro@protonmail.com>
2024-03-29 10:24:22 +00:00
Joaquim Monteiro
fbb83f74d6
meson: Replace usages of deprecated ExternalProgram.path()
!347 fixed some of these, but not all.

Signed-off-by: Joaquim Monteiro <joaquim.monteiro@protonmail.com>
2024-03-29 10:23:52 +00:00
Pierre-Eric Pelloux-Prayer
c7c3c14bfc amdgpu: fix deinit logic
The devices weren't removed from dev_list.

Instead of just fixing the issue by adding:

   if (*node) *node = dev->next;

after the while loop, use this opportunity to use a clearer
control flow.

Fixes: 7275ef8e ("amdgpu: add amdgpu_device_initialize2")
Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
Tested-by: Mike Lothian <mike@fireburn.co.uk>
2024-03-27 08:55:26 +01:00
Matt Turner
c45ffb1edf symbols-check: Add _fbss, _fdata, _ftext
These are exported on mips/mips64.

See also: https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11955
2024-03-25 15:35:58 +00:00
Matt Turner
525e80447f symbols-check: Add _GLOBAL_OFFSET_TABLE_
This is exported on hppa/parisc.

See also: https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26978

Bug: https://bugs.gentoo.org/927204
2024-03-25 15:35:58 +00:00
Pierre-Eric Pelloux-Prayer
7275ef8eba amdgpu: add amdgpu_device_initialize2
Allows to opt-out from the device deduplication logic. This is not the
recommended way of using dev handles, but it's necessary for native context:
in this situation one process (eg: Qemu) will init many devices and we
want independent devices to make sure guest applications are isolated from
each other.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
2024-03-21 11:03:38 +01:00
Pierre-Eric Pelloux-Prayer
6978f999ea amdgpu: add amdgpu_va_range_alloc2
This is the same functionnality that amdgpu_va_range_alloc offers,
except it's now usable without a device handle.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
2024-03-21 10:57:04 +01:00
Pierre-Eric Pelloux-Prayer
96fe43a029 amdgpu: expose amdgpu_va_manager publicly
This will allow applications to use this feature without a device.

The first use case will be native context: we want VA address to
be managed by the guest (to avoid a round-trip to the host to only
generate a VA) but the amdgpu_device only exist on the host.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
2024-03-21 10:57:02 +01:00
Pierre-Eric Pelloux-Prayer
4376848720 amdgpu: add amdgpu_va_manager
Until now VA management was tied to a device handle, but there's no
reason for this.

As a first step to export VA management outside of amdgpu_device,
this commit adds a new structure type holding the 4 va_mgr.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
2024-03-21 10:56:29 +01:00
David Rosca
c8f327ce9c amdgpu: Make amdgpu_device_deinitialize thread-safe
Device will be removed from dev_list when refcount reaches 0, so the
dev_mutex must be locked before decreasing reference otherwise there's
a race where this device is still in dev_list with refcount 0 which will
assert or crash in amdgpu_device_initialize trying to use this device
instead of creating new one.

Fixes issue reported in https://gitlab.freedesktop.org/drm/amd/-/issues/2156#note_2268110

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
2024-03-05 03:53:39 +00:00
Francesco Valla
1b4e04ba68 tests/util: add tidss driver
Add an entry for the "tidss" driver, so that the test utilities work
with this driver without passing the -M argument.

Signed-off-by: Francesco Valla <valla.francesco@gmail.com>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
2024-02-26 23:50:25 +01:00
Adrián Larumbe
01f91aa73d meson: make build system happy by replacing deprecated feature
ExternalProgram.path() is deprecated since 0.55, use
ExternalProgram.full_path() instead.

Signed-off-by: Adrián Larumbe <adrian.larumbe@collabora.com>
2024-02-15 01:20:02 +00:00
Dylan Baker
7c5c742de8 xf86drm: Don't consider node names longer than the maximum allowed
This fixes the logic that decides if a node name is valid to use the
same length restrictions that are used in drmDeviceAlloc, which expects
node names to conform to a specific naming scheme (On OSes except
OpenBSD this means `/dev/dri/renderD123`). This addresses the problem of
node names that are longer than expected, while still allowing symlinks
to work.

I've also applied the same fix to the OpenBSD path, while bringing the
check that `snprintf` didn't error from OpenBSD to the main path.

Signed-off-by: Dylan Baker <dylan.c.baker@intel.com>
Tested-by: Mark Janes <markjanes@swizzler.org>
Tested-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
2024-02-12 12:03:21 -08:00
Dylan Baker
1aa800d464 Revert "xf86drm: ignore symlinks in process_device()"
This reverts commit 7ab1cdac90.

This breaks numerous tools that rely on being able to read symlinks, and
constitutes a regression.

Signed-off-by: Dylan Baker <dylan.c.baker@intel.com>
Tested-by: Mark Janes <markjanes@swizzler.org>
Tested-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
Closes: #103
2024-02-12 12:03:17 -08:00
Tobias Jakobi
7ab1cdac90 xf86drm: ignore symlinks in process_device()
If the user has some UDev rules in place that creates symlinks for
one of the card or render nodes, and the name of the symlink is
too long, then drmDeviceAlloc() ends up truncating the name of
the node.
This in turn results in chaos in different subsystems. E.g.
vulkaninfo dies early with this:

Code 0 : failed to stat DRM primary node /dev/dri/my-favorite- (VK_ERROR_INITIALIZATION_FAILED)
(if the symlink is called /dev/dri/my-favorite-card-node)

Signed-off-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
2024-02-08 14:23:52 +00:00
Jonathan Gray
140943281b amdgpu: add marketing names from amd-6.0.1 2024-01-24 11:17:03 +11:00
Jonathan Gray
9d9498f466 amdgpu: add marketing name for Radeon RX 6550M
from notebookcheck review of Lenovo ThinkPad Z16 Gen 2
2024-01-24 11:17:03 +11:00
Jonathan Gray
dfb8111ecb amdgpu: add marketing names from amd-6.0 2024-01-24 11:17:03 +11:00
Jonathan Gray
fb13af4398 amdgpu: add marketing names from Windows Steam Deck OLED APU driver 2024-01-24 11:17:03 +11:00
Jonathan Gray
6414474000 amdgpu: add marketing names from PRO Edition for W7700 2024-01-24 11:17:03 +11:00
Jonathan Gray
ad750dc608 amdgpu: add marketing names from Adrenalin 23.11.1 2024-01-24 11:17:03 +11:00
Simon Ser
75254bf239 build: bump version to 2.4.120
Signed-off-by: Simon Ser <contact@emersion.fr>
2024-01-13 10:37:07 +01:00
Simon Ser
6c4392f49b Sync headers with drm-next
Synchronize drm.h and drm_mode.h to drm-next.

Generated using make headers_install.
Generated from drm-next branch commit a60501d7c2d3e70b3545b9b96576628e369d8e85

Signed-off-by: Simon Ser <contact@emersion.fr>
Acked-by: Simon Zeni <simon.zeni@collabora.com>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
2024-01-13 10:33:05 +01:00
Pierre-Eric Pelloux-Prayer
118addfaf8 amdgpu: fix use-after-free
Closes: https://gitlab.freedesktop.org/mesa/drm/-/issues/96
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
2024-01-04 11:00:37 +01:00
Eric Engestrom
54b1208138 radeon: fix missing stencil_tile_mode initialisation in the linear/fallback case
../radeon/radeon_surface.c:1611:13: error: 'stencil_tile_mode' may be used uninitialized [-Werror=maybe-uninitialized]
 1611 |         r = si_surface_init_1d(surf_man, surf, surf->stencil_level, 1, stencil_tile_mode, surf->bo_size, 0);
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2024-01-01 07:43:19 +00:00
Marek Olšák
fc5f2239f3 meson: bump libdrm version to 2.4.119
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
2023-12-21 06:49:36 -05:00
Marek Olšák
85343095fd amdgpu: add amdgpu_va_get_start_addr
for Mesa

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
2023-12-21 06:49:34 -05:00
Simon Ser
02a41cf302 build: bump version to 2.4.118
Signed-off-by: Simon Ser <contact@emersion.fr>
2023-11-20 14:03:51 +01:00
Simon Ser
07f4948bfc xf86drmMode: add drmModeCloseFB()
Add a wrapper for the new CLOSEFB IOCTL, to close a framebuffer
without implicitly disabling planes or CRTCs.

See https://lore.kernel.org/dri-devel/20231020101926.145327-2-contact@emersion.fr/

Signed-off-by: Simon Ser <contact@emersion.fr>
2023-11-20 12:55:31 +00:00
Simon Ser
7b60986640 Sync headers with drm-next
Synchronize drm.h, drm_mode.h and drm_fourcc.h to drm-next.

Generated using make headers_install.
Generated from drm-next branch commit c79b972eb88b077d2765e7790d0902b3dc94d55c

Signed-off-by: Simon Ser <contact@emersion.fr>
2023-11-20 12:55:31 +00:00
Simon Ser
15b7fbf3e7 xf86drm: add drmGetNodeTypeFromDevId
This is useful to figure out whether the dev_t refers to a primary
node or a render node. Indeed, drmGetDeviceFromDevId returns a
drmDevice, which holds both the primary and render nodes.

Signed-off-by: Simon Ser <contact@emersion.fr>
2023-11-20 12:22:10 +00:00