Commit graph

7210 commits

Author SHA1 Message Date
Alex Deucher
e7d4b1df2d amdgpu: add new marketing names
Updated from 6.3 branch.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2024-12-18 13:15:57 -05:00
Alex Deucher
1f140f7d65 amdgpu: add new marketing names
Updated from 6.2 branch.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2024-12-18 13:11:38 -05:00
Matt Turner
38ec7dbd4d build: bump version to 2.4.124 2024-12-04 13:30:30 -05:00
Rob Barnes
f314a43f14 modetest: Make modetest availble to vendor on Android
Make modetest available to vendors on Android. libdrm_util and
libdrm_test_headers is also made available to vendors since these are
depenencies of modetest. This results in the module target
modetest.vendor being availble to vendor modules.

Signed-off-by: Rob Barnes <robbarnes at google.com>
2024-10-29 10:49:10 -06:00
Mauro Rossi
e68e9b8013 android: add genrule for generated_static_table_fourcc.h
Fixes the following building error:

external/libdrm/xf86drm.c:158:10: fatal error: 'generated_static_table_fourcc.h' file not found
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.

Change-Id: I1b0cac498ed63ebec6e8c03629bbf4a1b6a9618d
Reviewed-by: Mauro Rossi <issor.oruam@gmail.com>
2024-10-20 12:26:53 +02:00
Marek Olšák
50da61eebd xf86drm: print AMD modifiers properly
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
2024-10-15 19:49:05 -04:00
Alan Coopersmith
c0a08f06ae include/drm/README: update drm-next link to use gitlab instead of cgit 2024-09-29 17:47:51 -07:00
Dmitry Baryshkov
0a1162e2af modetest: add support for YUV422 and YUV444 plane format
Currently modetest supports only the YUV420 and YVU420 planar YCbCr
plane formats (aka YV12 and YU12). Extend the code to add support for
YUV422 / YVU422 and YUV444 / YVU444 plane formats.

Reviewed-by: Marijn Suijten <marijn.suijten@somainline.org>
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
2024-09-23 21:11:29 +02:00
Dmitry Baryshkov
38c043dca2 modetest: simplify planar YUV handling
In preparation to adding more planar YUV formats, introduce X, Y
subsampling ratios and use them to calculate plane offsets and buffer
size.

Reviewed-by: Marijn Suijten <marijn.suijten@somainline.org>
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
2024-09-23 21:11:29 +02:00
Simon Ser
bea14386bc build: simplify Linux system check
No need for contains() here.

Signed-off-by: Simon Ser <contact@emersion.fr>
2024-09-08 09:15:08 +00:00
Marijn Suijten
887fec2c28
tests/util: Call drmGetDevices2() instead of drmOpen()ing all modules
Whenever `util_open()` is called to open a device for the first matching
module, it will skip devices for the `nvidia_drm` kernel module which
is not in the list.  We could add this module for now, but keeping this
list of DRM modules up to date is cumbersome.

At the same time walking a list of modules and calling `drmOpen()` for
each of them is incredibly expensive (when the user doesn't explicitly
specify one with `-M`), as each each call opens every DRM node just
to see if they are associated to the requested module.  And for no
good reason: all we want is the first `DRM_NODE_PRIMARY` (which is what
`drmOpen()` also returns) to use by default.

For example on the `"msm"` driver, which used to be the 9th in the
modules list, all nodes are opened for the 9th time before e.g.
`modetest` returns a useful result, which takes ages unless the user
painstakingly provides the module for the currently known device on
the cmdline.

This is very simply solved by calling `drmGetDevices(2)()`, which
iterates through all DRM nodes only once and allows us to immediately
find + `open()` the first device that has a PRIMARY node.  A random
search for the error shows that this was also attempted in (a fork of?)
kmscube:
https://git.ti.com/cgit/glsdk/kmscube/commit/?id=456cabc661caac5c60729751d45efd668faa8e97

Finally we add a `drmIsKMS()` check to make sure we only include primary
nodes that actually support rendering, and also print the values from
`drmGetVersion()` on success to make it easier to identify the device.

In the future we could extrapolate this feature by letting query
commands like `modetest -c` list connectors for every device/module, not
just the first PRIMARY node that we found.
2024-09-03 13:30:41 +02:00
Matt Turner
25dec5b91f build: bump version to 2.4.123 2024-08-26 13:10:22 -07:00
Mark Collins
f3f56f41bb Disable ioctl signed overload for Bionic libc
Bionic libc ships with `ioctl` that has two signatures, one with an
unsigned `request` parameter and one with a signed request parameter.

This leads to compilation failing due to `__typeof__(ioctl)` being used
by DRM which fails to resolve which overload to use, this has been fixed
by defining `BIONIC_IOCTL_NO_SIGNEDNESS_OVERLOAD` on Android.

Signed-off-by: Mark Collins <mark@igalia.com>
2024-08-22 18:45:38 +00:00
Su Hong Koo
88db611498 tests: Make modetest and proptest cc_binary in Android.bp
Change module type of modetest and proptest from cc_test to cc_binary,
as neither are tests.

Signed-off-by: Su Hong Koo <sukoo@google.com>
2024-08-01 10:09:05 -04:00
Daniel Stone
b0815faac0 libs: Tie DSO minor versions to libdrm version
There is an excellent writeup explaining this requirement here:
    https://gitlab.freedesktop.org/wayland/wayland/-/issues/175

In short, for mixed environments such as the Steam Runtime and other
container-like environments, choosing which libdrm to link into the
client's address space is a hard problem. If the runtime has a newer
libdrm than the host, then it should be preferred, because the client
may be using newly-added symbols. But if the host has a newer libdrm,
then that should be used, because drivers may be depending on those.

Bumping the DSO minor version is transparent to all users because apps
only link against the major version, e.g. DT_NEEDED libdrm.so.2; the
fact that libdrm.so.2 is a link to libdrm.so.2.122.0 is a detail known
only to the loader, but it does let a smart runtime make better
decisions.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2024-08-01 13:28:41 +01:00
Jiyong Park
4bd09d78df Enable GPU in crosvm
When the GPU feature is turned on in crosvm, these modules are added as
dependencies. Since crosvm is included in the virt APEX, add the APEX to
the apex_available properties of the modules to make them available in
the APEX.
2024-07-30 10:54:34 -04:00
Jiyong Park
d9043a256f add crosvm to com.android.virt
To do so, crosvm and its dependencies have the apex_available property
set to "//apex_available:platform", "com.android.virt" to explicitly
acknowledge the joining.
2024-07-30 10:54:34 -04:00
Jason Macnak
f22956a4e9 Adds libdrm_headers
... as being able to use cc_library in header_libs is not
intended and does not work on all branches which blocks
aosp/1497292.
2024-07-30 10:54:34 -04:00
Inseob Kim
460f7907de Export include dirs with -isystem
drm_property_type_is function in xf86drmMode.h file can cause compiler
error because it performs unsigned to signed conversion. Some Android.mk
modules have been avoiding this by adding "-isystem external/libdrm"
flag, because warnings from system headers are suppressed.

This changes exported_include_dirs to export_system_include_dirs
to workaround the potential error with the same manner above.
2024-07-30 10:54:34 -04:00
Jason Macnak
dcb14fe0c6 Makes libdrm available on host
... to make drm format header visible for host wayland server.

Adds -Wno-implicit-function-declaration for vasprintf() on
xf86drm.c:2965.

Adds -Wno-int-conversion for drm_mmap() on libdrm_macros.h:60.

Also, drive-by alphabetize cflags.
2024-07-30 10:54:34 -04:00
Jerry Zhang
6aa6411c5a Make libdrm recovery_available 2024-07-30 10:54:34 -04:00
John Stultz
c2b5759a2f Android.bp: Add include exports for android dir
This forward ports Stefan Schake's patch
32ee9c0e05 "android: Add missing include exports" to the
Android.bp file.
2024-07-30 10:54:34 -04:00
Elliott Hughes
aef24b66d9 readdir_r is deprecated.
Add -Wno-deprecated-declarations to suppress compiler warning about
using readdir_r, which is deprecated.
2024-07-30 10:54:34 -04:00
Su Hong Koo
aefb5fa987 Delete all Makefile.sources files
Delete all Makefile.sources as all the makefiles that use them have
been replaced with Android.*.bp files for Soong.
2024-07-30 10:54:23 -04:00
Dan Willemsen
21ac1816a4 Convert to Android.bp
See build/soong/README.md for more information about Soong.

Removes BOARD_GPU_DRIVERS, which wasn't affecting anything, since none
of the HAVE_* macros are defined. Even if they were, we'd prefer to
compile all of them so that a single library can support multiple
boards.
2024-07-29 14:47:30 -04:00
Alex Deucher
11cafdd8d6 amdgpu: add new marketing names
Updated from 6.1 branch.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2024-07-11 21:46:17 -04:00
Alex Deucher
5e1e7c4d71 amdgpu: add new marketing names
https://www.amd.com/en/processors/ryzen-processors-laptop-business
https://www.amd.com/en/products/ryzen-pro-processors-laptop

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2024-07-11 21:31:50 -04:00
Enrico Weigelt, metux IT consult
b065dbc5cc Fix FTBS on undefined clock_gettime() and asprintf()
Some platforms (eg. SunOS) explicitly need extra symbols in order to define
those functions. There're many files needing the __EXTENSIONS__ symbol,
so doing this on a global scale.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-06-27 02:07:00 +02:00
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