Resolve the minor type based on the device node path.
The minor type is either in /dev/drm/X where X is the type or
in a Linux-compatible device node in /dev/dri/
This means we need the major number on FreeBSD so add it to the function
arguments.
Signed-off-by: Emmanuel Vadot <manu@FreeBSD.org>
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
FreeBSD devfs only provides on the fly generated major/minor.
The major number is irrelevant for FreeBSD so remove the special case.
Signed-off-by: Emmanuel Vadot <manu@FreeBSD.org>
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
FreeBSD devfs have on the gly generated major minor so we cannot use them
to test if the device is a drm node.
Instead get the devfs node name and test if it is in a subdirectory "drm/"
or "dri/".
Historycally DRM device on FreeBSD are created in /dev/drm/ and link are
present in /dev/dri/ for compatibility reason.
Signed-off-by: Emmanuel Vadot <manu@FreeBSD.org>
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
The header is not required on Linux, and is in fact deprecated in glibc 2.30+
Reported-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Cc: Niclas Zeising <zeising@daemonic.se>
Signed-off-by: Eric Engestrom <eric@engestrom.ch>
Tested-by: Niclas Zeising <zeising@daemonc.se>
Mesa expects to be able to map the same buffer, without unmapping it.
This leads to problem on long-running program.
On the other hand, libdrm uses cpu_map_count as a refcount and expects
its value to decrease so it can unmap buffers.
The previoulsy proprosed fix (https://patchwork.freedesktop.org/patch/258005/)
stopped increased the counter when it went past INT_MAX.
This commit instead proposes to use a larger type to store cpu_map_count.
The outcome is the same: long running apps will not crash, only the
implementation differs.
Closes: https://gitlab.freedesktop.org/mesa/mesa/issues/1423
Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
xf86drmMode.h currently duplicates the connector-type definitions from
drm_mode.h. Add DRM_MODE_CONNECTOR_WRITEBACK, which is only visible
through a client cap, from drm_mode.h.
Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
Currently the code assumes that a virtio based device is always located
on the PCI bus.
Modify the parser to make it check the device's parent directory to
determine on which bus it is located.
Output for virtio-pci is the PCI bus.
Output for virtio-mmio is the Platform bus.
Signed-off-by: Vasyl Vavrychuk <vasyl.vavrychuk@opensynergy.com>
Signed-off-by: Mikhail Golubev <Mikhail.Golubev@opensynergy.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Move the code, which used to get the device subsystem type from a device
path in sysfs, to a separate function to be reusable.
Signed-off-by: Vasyl Vavrychuk <vasyl.vavrychuk@opensynergy.com>
Signed-off-by: Mikhail Golubev <Mikhail.Golubev@opensynergy.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Suggested by Emil [1]:
> Feel free to drop the random test altogether. It's an old public API
> no active users (pretty ancient code uses it) and the in-tree users
> drmSL and drmHash already have respective tests.
This test takes minutes to run, while all the other tests combined take
barely more than a second.
Dropping it also helps the CI by avoiding random timeouts when `random`
takes more than the 4 minutes (!) we've allowed for it.
[1] https://gitlab.freedesktop.org/mesa/drm/merge_requests/26#note_390066
Suggested-by: Emil Velikov <emil.l.velikov@gmail.com>
Signed-off-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
This patch is to use generic variables as the input of amdgpu_cs_submit_raw2.
Because amdgpu_cs_submit_one won't handle IOCTL directly.
Signed-off-by: Huang Rui <ray.huang@amd.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
So far, amdgpu_cs_submit_raw2 is mainly used for upper layer (Mesa), however,
amdgpu_cs_submit is used for current all unit tests. Our intention is that the
unit tests can actually verify the API which is really used.
Signed-off-by: Huang Rui <ray.huang@amd.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Use alloca instead of malloc, then we don't need free them at the end of this
function.
Signed-off-by: Huang Rui <ray.huang@amd.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Add a wrapper around the getfb2 ioctl, which returns extended
framebuffer information mirroring addfb2, including multiple planes and
modifiers.
Changes since v7:
- add new symbols to core-symbol.txt (Eric Engestrom)
Changes since v5:
- style change
Changes since v4:
- Set fb_id at init instead of memclear() and set (Eric Engestrom)
Changes since v3:
- remove unnecessary null check in drmModeFreeFB2 (Daniel Stone)
Changes since v2:
- getfb2 ioctl has been merged upstream
- sync include/drm/drm.h in a seperate patch
Changes since v1:
- functions should be drm_public
- modifier should be 64 bits
- update ioctl number
Signed-off-by: Juston Li <juston.li@intel.com>
Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
a) delta: Adds DRM_IOCTL_MODE_GETFB2
b) Generated using make headers_install
c) Taken from drm-next-misc:
commit 3ff4c24bdb1f494c217c80348f9db4896043ed81
Author: Lyude Paul <lyude@redhat.com>
Date: Fri Jan 17 17:47:48 2020 -0500
drm/dp_mst: Fix indenting in drm_dp_mst_topology_mgr_set_mst()
Signed-off-by: Juston Li <juston.li@intel.com>
Acked-by: Eric Engestrom <eric@engestrom.ch>
Add new marketing names.
Acked-by: Leo Liu <leo.liu@amd.com>
Acked-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Platforms without a HW detiler doesn't support the get_tiling IOCTL.
Fix the drm_intel_bo_gem_create_from_* functions assuming the default
no-tiling, no-swizzling setting for the GEM buffer in this case.
v2:
- Add the missing gem handle IOCTL parameter. (Eric)
Signed-off-by: Imre Deak <imre.deak@intel.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
Combined with -Wundef (added in 75758d2ccf & enforced in ba17673eed),
this provides absolute safety against #ifdef typos.
Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
All the libdrm_* submodules have symbols checks, no reason to keep core
libdrm wild.
Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
Acked-by: Emil Velikov <emil.velikov@collabora.com>
When a mode is set with just a connector "-s foo",
we get a nasty segmentation fault. Fix it.
Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Often there are many similar modes, which cannot be selected
via modetest due to its simple string matching.
This change adds a mode index in the display output, which can
then be used to specify a specific modeline to be set.
Cc: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: Rob Clark <robdclark@chromium.org>
Cc: Bjorn Andersson <bjorn.andersson@linaro.org>
Cc: Sumit Semwal <sumit.semwal@linaro.org>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Signed-off-by: John Stultz <john.stultz@linaro.org>
[emil: rebase]
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
This patch fixes the following warning:
-Wformat-overflow=
v2: Use the correct strlcat(3).
v3: Use strncat(3) and remove libbsd dependency.
Signed-off-by: Luben Tuikov <luben.tuikov@amd.com>
This patch fixes the following warnings:
-Wformat=
-Wmaybe-uninitialized
-Wmisleading-indentation
-Wstringop-truncation
-Wunused-function
-Wunused-variable
It also removes forward declarations and moves
global functions to the bottom, keeping locals
at the top, in ras_tests.c.
v2: Fix compilation.
Signed-off-by: Luben Tuikov <luben.tuikov@amd.com>
Proper format for command line option "-l",
listing the supported and unsupported tests:
1) Add an aligned column header.
2) Align all fields into columns.
3) Fixed length fields, come before the last
column, which is a variable length field.
4) Variable length field, which is the name of the
test, goes in the last column.
5) If a suite is disabled, do not iterate over its
tests, as they'd naturally be all disabled.
Now the output looks like this:
$sudo ./amdgpu_test -l
What: ID: Status: Name
Suite: 1: ENABLED: Basic Tests
Test: 1: ENABLED: Query Info Test
Test: 2: ENABLED: Userptr Test
Test: 3: DISABLED: bo eviction Test
Test: 4: ENABLED: Command submission Test (GFX)
Test: 5: ENABLED: Command submission Test (Compute)
Test: 6: ENABLED: Command submission Test (Multi-Fence)
Test: 7: ENABLED: Command submission Test (SDMA)
Test: 8: ENABLED: SW semaphore Test
Test: 9: DISABLED: Sync dependency Test
Test: 10: DISABLED: Dispatch Test (Compute)
Test: 11: DISABLED: Dispatch Test (GFX)
Test: 12: DISABLED: Draw Test
Test: 13: DISABLED: GPU reset Test
Suite: 2: ENABLED: BO Tests
Test: 1: ENABLED: Export/Import
Test: 2: DISABLED: Metadata
Test: 3: ENABLED: CPU map/unmap
Test: 4: ENABLED: Memory alloc Test
Test: 5: ENABLED: Memory fail alloc Test
Test: 6: ENABLED: Find bo by CPU mapping
Suite: 3: DISABLED: CS Tests
Suite: 4: DISABLED: VCE Tests
Suite: 5: ENABLED: VCN Tests
Test: 1: ENABLED: VCN DEC create
Test: 2: ENABLED: VCN DEC decode
Test: 3: ENABLED: VCN DEC destroy
Test: 4: ENABLED: VCN ENC create
Test: 5: ENABLED: VCN ENC decode
Test: 6: ENABLED: VCN ENC destroy
Suite: 6: DISABLED: UVD ENC Tests
Suite: 7: DISABLED: Deadlock Tests
Suite: 8: ENABLED: VM Tests
Test: 1: ENABLED: resere vmid test
Test: 2: ENABLED: unaligned map
Test: 3: ENABLED: vm mapping test
Suite: 9: DISABLED: RAS Tests
Suite: 10: ENABLED: SYNCOBJ TIMELINE Tests
Test: 1: ENABLED: syncobj timeline test
$_
Signed-off-by: Luben Tuikov <luben.tuikov@amd.com>
This patch fixes the following warning:
-Wformat-overflow=
v2: Use the correct strlcat(3).
v3: Use strncat(3) and remove libbsd dependency.
Signed-off-by: Luben Tuikov <luben.tuikov@amd.com>
This patch fixes the following warnings:
-Wformat=
-Wmaybe-uninitialized
-Wmisleading-indentation
-Wstringop-truncation
-Wunused-function
-Wunused-variable
It also removes forward declarations and moves
global functions to the bottom, keeping locals
at the top, in ras_tests.c.
Signed-off-by: Luben Tuikov <luben.tuikov@amd.com>
The computer ring test name mis-match in different files,
thus may be set with TRUE on wrong platforms.
Change-Id: I0b918ff8faf08c9c9f1ad55f4dcd18f66b956901
Signed-off-by: Yifan Zhang <yifan1.zhang@amd.com>
Signed-off-by: Marek Olšák <marek.olsak@amd.com>
This fixes an issue with libdrm failing to build when used as a meson
subproject. Using 'config.h' directly will cause it to possibly refer to
the wrong file.
By using `@0@.format(config_file)`, it will be transformed into the
correct relative path, e.g. `./config.h` in normal build,
`./subprojects/libdrm/config.h` in subproject build.
Signed-off-by: Scott Anderson <scott@anderso.nz>
Acked-by: Eric Engestrom <eric.engestrom@intel.com>
It was entirely deleted along with autotools, but adding this simple one
will cover most people's needs.
Suggested-by: Lucas De Marchi <lucas.demarchi@intel.com>
Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by: Lucas De Marchi <lucas.demarchi@intel.com>
Changes:
651cc835d5f6 ("drm/i915: Add new EHL/JSL PCI ids")
b6a8781a447c ("drm/i915/cml: Remove unsupport PCI ID")
8717c6b7414f ("drm/i915/cml: Separate U series pci id from origianl list.")
v2: added the latest CML changes
Cc: James Ausmus <james.ausmus@intel.com>
Cc: Matt Roper <matthew.d.roper@intel.com>
Cc: Lucas De Marchi <lucas.demarchi@intel.com>
Reviewed-by: Matt Roper <matthew.d.roper@intel.com>
Signed-off-by: José Roberto de Souza <jose.souza@intel.com>
Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
Add function to derive floating value of vertical
refresh rate from drm mode using pixel clock,
horizontal total size and vertical total size.
Use this function to find suitable mode having vrefresh
value which is matching with user provided vrefresh value.
If user doesn't provide any vrefresh value in args then
update vertical refresh rate value in pipe args using this
function.
Also use this function for printing floating vrefresh while
dumping all available modes.
This will give more accurate picture to user for available modes
differentiated by floating vertical refresh rate and help user
select more appropriate mode using suitable refresh rate value.
V4:
1) While setting mode, print mode name and vrefresh using struct
drmModeModeInfo instead of struct pipe_args.
2) Revert back to using a float value instead of float *
for vrefresh arg in connector_find_mode().
V3:
1) Change name of function used to derive refresh rate.
V2:
1) Don't use inline function for deriving refresh rate from mode.
2) If requested mode not found, print refresh rate only
if user had provided it in args.
Signed-off-by: Devarsh Thakkar <devarsh.thakkar@xilinx.com>
Reviewed-by: Neil Armstrong <narmstrong@baylibre.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
It can run dispatch/draw tests on new renoir chips. So it needs to
enable dispatch/draw tests for Renoir again.
Change-Id: I3a72a4bbfe0fc663ee0e3e58d8e9c304f513e568
Signed-off-by: changzhu <Changfeng.Zhu@amd.com>
Reviewed-by: Flora Cui <flora.cui@amd.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Since AO_compare_and_swap_full() is used by libdrm, AO_REQUIRE_CAS
must be defined before including <atomic_ops.h> so that we are sure
that CAS support will be provided. This is necessary to make sure that
the AO_compare_and_swap_full() function will be provided on all
architectures, including the ones that don't have built-in CAS support
such as SPARCv8.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Peter Seiderer <ps.report@gmx.net>
Acked-by: Eric Engestrom <eric.engestrom@intel.com>
This provides support for Xorg interface. Without this the vivante
samples will hang during close requiring a reboot
[Adapted from yocto project]
Upstream-Status: Pending
Signed-off-by: Lauren Post <lauren.post@freescale.com>
Signed-off-by: Evan Kotara <evan.kotara@freescale.com>
[Thomas: change CAS code to only be used on ARMv6/ARMv7, and not
ARMv4/ARMv5, which don't support ldrex/strex. If no CAS implementation
is provided libdrm falls back to a system call for locking/unlocking.]
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Peter Seiderer <ps.report@gmx.net>
Acked-by: Eric Engestrom <eric.engestrom@intel.com>
---
Changes v1 -> v2:
- add comment explaining exclusion of ARMv4/ARMv5 and lower
Use the stronger compiler.link() test (instead of the weaker
compiler.compile()) to fix the intel atomics detection.
Fixes false positive in case of sparc compile (buildroot toolchain).
Signed-off-by: Peter Seiderer <ps.report@gmx.net>
Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>