Commit Graph

6698 Commits (5aa83dd6fa2bbfeb098877898d10261b2ec4f2d0)

Author SHA1 Message Date
Emmanuel Vadot 5aa83dd6fa libdrm: drmGetDeviceNameFromFd: Always return /dev/dri/ node for FreeBSD
Since we now always returns the /dev/dri/ node for
drmGet<nodetype>DeviceNameFromFd, be consistant with the names returned
in drmGetDeviceNameFromFd.

Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Signed-off-by: Emmanuel Vadot <manu@FreeBSD.org>
2020-05-04 21:19:58 +02:00
Emmanuel Vadot f52e2b20ed libdrm: drmGetMinorNameFromFd: Fix FreeBSD variant
Fix the FreeBSD variant by getting the node type represented by fd to deduce
the target minor name.
We then return the full /dev/dri/<minorname><id> version.

Fix: #41
Fixes: 6818a50b12
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Signed-off-by: Emmanuel Vadot <manu@FreeBSD.org>
2020-05-04 21:19:58 +02:00
Karol Herbst 5ec177b398 nouveau: fix compile error with -DDEBUG on newer gcc
Signed-off-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
2020-05-04 11:58:10 +02:00
Nicholas Bishop 05727548a1 libdrm: intel: add DRM_RDWR flag in drm_intel_bo_gem_export_to_prime
This is similar to b81d44d587d1706d5c7568e539340632a748782b: the
DRM_RDWR flag is needed for mmap to work.

Signed-off-by: Nicholas Bishop <nicholasbishop@gmail.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
2020-04-30 11:12:37 +00:00
Nicholas Bishop dd562b1efd intel: properly escape sed pattern for tests
The sed was incorrectly modifying e.g. "nicholasbishop" to
"nicholasbop". The updated pattern will only match `.sh` at the end of
the string.

Signed-off-by: Nicholas Bishop <nicholasbishop@gmail.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
2020-04-27 15:53:58 +00:00
Leo Liu fd7f3746e3 tests/amdgpu/vcn: add Renoir VCN2.0 decode support
Renoir is the same family as Raven, but it's with VCN2.0,
so it has to use VCN2.0 reg set

Signed-off-by: Leo Liu <leo.liu@amd.com>
Reviewed-By: Thong Thai <thong.thai@amd.com>
2020-04-26 11:39:19 -04:00
Scott Anderson bf63f8acdc libdrm: Handle usb_interface devices for usb parsing
Currently the code expects that the device found at
/sys/char/$maj:$min/device for USB devices is a "usb_device". However,
at least for some devices, such as for the udl driver, they are instead
a "usb_interface".

A usb_interface is a child of the usb_device we're interested in, so we
walk up one in the /sys path to get there.

For example, with a USB device I have, trimmed to show the relevant
information:
```
$ udevadm info /dev/dri/card1
P: /devices/pci0000:00/0000:00:01.3/0000:02:00.0/usb1/1-4/1-4:1.0/drm/card1
E: DEVTYPE=drm_minor
$ udevadm info /sys/devices/pci0000:00/0000:00:01.3/0000:02:00.0/usb1/1-4/1-4:1.0
E: DEVTYPE=usb_interface
E: DRIVER=udl
$ udevadm info /sys/devices/pci0000:00/0000:00:01.3/0000:02:00.0/usb1/1-4
E: DEVTYPE=usb_device
E: DRIVER=usb
E: BUSNUM=001
E: DEVNUM=009
```

Signed-off-by: Scott Anderson <scott@anderso.nz>
2020-04-24 08:53:53 +00:00
Mikhail Golubev 57df07572c xf86drm: Check non-absolute path only for virtio based devices
This fixes bug in drmParseSubsystemType() that cases situation when
subsequent call to readlink() from get_subsystem_type() will result in
EACCESS.

Signed-off-by: Mikhail Golubev <mikhail.golubev@opensynergy.com>
2020-04-24 08:24:46 +00:00
Peter Seiderer 9001c93b7f tests/amdgpu: needs atomic_ops
Signed-off-by: Peter Seiderer <ps.report@gmx.net>
Acked-by: Alex Deucher alexander.deucher@amd.com
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
2020-04-22 23:54:36 -04:00
Emil Velikov cf1afec017 tests: install drmdevice
Just like the other tests (tools really) install drmdevice. It is a
simple tool which is useful for basic check/testing.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Acked-by: Eric Engestrom <eric@engestrom.ch>
2020-04-21 18:50:23 +01:00
Emmanuel Vadot 1600fe1130 tests/nouveau/threaded: adapt ioctl signature for FreeBSD
FreeBSD also use (int, unsigned long int, ...) like GLIBC.

Signed-off-by: Emmanuel Vadot <manu@FreeBSD.org>
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
2020-04-21 19:26:54 +02:00
Emmanuel Vadot e321dd7a4d libdrm: Implement drmParsePciDeviceInfo for FreeBSD
The FreeBSD kernel expose a pseudo-device /dev/pci to obtain information
about present PCI device.
Uee the PCIOCGETCONF ioctl on this device to look up the desired device
information.

Signed-off-by: Emmanuel Vadot <manu@FreeBSD.org>
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
2020-04-21 19:26:54 +02:00
Emmanuel Vadot 44bcf9c0ce libdrm: get_pci_path is Linux only so add an ifdef
Signed-off-by: Emmanuel Vadot <manu@FreeBSD.org>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
2020-04-21 19:26:54 +02:00
Emmanuel Vadot 379113724f libdrm: Add get_sysctl_pci_bus_info for FreeBSD
The FreeBSD drm driver expose a sysctl hw.dri.%d.busid which contain
the busid.
Use this sysctl to parse the busid information based on the major/minor
that allow us to implement FreeBSD support for drmParsePciBusInfo.

Signed-off-by: Emmanuel Vadot <manu@FreeBSD.org>
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
2020-04-21 19:26:54 +02:00
Emmanuel Vadot bb584b8fd2 libdrm: drmCheckModesettingSupported: fix for FreeBSD
FreeBSD only support up to 10 GPUs not 16.

Signed-off-by: Emmanuel Vadot <manu@FreeBSD.org>
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
2020-04-21 19:26:54 +02:00
Emmanuel Vadot 24e68525dc libdrm: drmCheckModesettingSupported: Fix for FreeBSD
Remove some useless busid rewritting.

Signed-off-by: Emmanuel Vadot <manu@FreeBSD.org>
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
2020-04-21 19:26:54 +02:00
Emmanuel Vadot 13c9de39a6 libdrm: drmGetDeviceNameFromFd2: Add FreeBSD variant
The FreeBSD variant of drmGetDeviceNameFromFd can already handle
the different node type so just call it.

Signed-off-by: Emmanuel Vadot <manu@FreeBSD.org>
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
2020-04-21 19:26:54 +02:00
Emmanuel Vadot 41f3a7b3e5 libdrm: Default to PCI for FreeBSD
FreeBSD have some support for DRM on !PCI device but no code is currently
upstream. Default to PCI for now.

Signed-off-by: Emmanuel Vadot <manu@FreeBSD.org>
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
2020-04-21 19:26:54 +02:00
Emmanuel Vadot 57c50cfc45 libdrm: drmGetMinorNameForFD: Add FreeBSD variant
Use the FreeBSD variant function to obtain the minor name and the
device node.
Return the correct path based on where the node is (drm/ versus dri/).

Signed-off-by: Emmanuel Vadot <manu@FreeBSD.org>
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
2020-04-21 19:26:54 +02:00
Emmanuel Vadot 6818a50b12 libdrm: drmGetDeviceNameFromFd: Add FreeBSD variant
Get the major/minor via fstat and after checking that this is a drm node
construct the full device node name using devname.
Note that we should be able to use fdevname to avoid calling fstat + devname
but for some reason it doesn't work on drm node (probably due to how the device
node are created in the linux compat code for drm on FreeBSD).

Signed-off-by: Emmanuel Vadot <manu@FreeBSD.org>
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
2020-04-21 19:26:54 +02:00
Emmanuel Vadot c55a1e564c libdrm: drmGetMinorType: Add FreeBSD version
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>
2020-04-21 19:25:36 +02:00
Emmanuel Vadot 4fbcc9a6a7 xf86drm: Remove ifdef for FreeBSD and DRM_MAJOR
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>
2020-04-21 18:39:48 +02:00
Emmanuel Vadot 1c8d2b73a6 libdrm: drmNodeIsDRM: Add FreeBSD variant
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>
2020-04-21 18:39:48 +02:00
Eric Engestrom 1f8ada8023 meson: don't detect <sys/sysctl.h> on Linux
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>
2020-04-20 23:48:08 +00:00
James Zhu 8cef557062 tests/amdgpu/vcn: add dummy feedback message
Latest VCN firmware has feedback header check.

Signed-off-by: James Zhu <James.Zhu@amd.com>
Reviewed-by: Leo Liu <leo.liu@amd.com>
2020-04-16 16:01:37 -04:00
Timo Aaltonen 27fa47a738 Bump version to 2.4.101 2020-04-03 14:39:47 +03:00
Pierre-Eric Pelloux-Prayer b9bf42d3e1 amdgpu: increase cpu_map_count storage size
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>
2020-03-23 13:18:01 +01:00
Swathi Dhanavanthri bb4e154d3d intel: sync i915_pciids.h with kernel
Changes:
3882581753d1 ("drm/i915/tgl: Add new PCI IDs to TGL")

Signed-off-by: Swathi Dhanavanthri <swathi.dhanavanthri@intel.com>
Reviewed-by: Timo Aaltonen <timo.aaltonen@canonical.com>
2020-03-23 13:51:19 +02:00
Daniel Stone 665c0f7fd8 Add DRM_MODE_CONNECTOR_WRITEBACK to xf86drmMode.h
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>
2020-03-17 12:19:10 +00:00
Michel Dänzer fe06ee2054 tests: Only copy con->modes[0] if it exists
con->modes can be NULL. Fixes crash in that case.

Closes: https://gitlab.freedesktop.org/mesa/drm/issues/34
Reviewed-by: Daniel Stone <daniels@collabora.com>
2020-02-27 12:21:09 +01:00
Vasyl Vavrychuk 8a73372e62 xf86drm: fix subsystem type lookup for virtio mmio-based devices
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>
2020-02-24 21:53:41 +00:00
Vasyl Vavrychuk c4eae71d7e xf86drm: generalize the device subsystem type parsing code
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>
2020-02-24 21:53:41 +00:00
Eric Engestrom 2c0a01261d tests: drop redundant and slow `random` test
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>
2020-02-15 12:14:00 +00:00
Huang Rui a42eb3dfde amdgpu: clean up the cs structure variable
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>
2020-02-12 19:55:22 +08:00
Huang Rui c483259248 amdgpu: remove the un-used chunk_array
This array won't be used.

Signed-off-by: Huang Rui <ray.huang@amd.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
2020-02-12 19:55:16 +08:00
Huang Rui cf9eb78a89 amdgpu: use amdgpu_cs_submit_raw2 in amdgpu_cs_submit
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>
2020-02-12 19:55:09 +08:00
Huang Rui fca0849af3 amdgpu: use alloca for dependencies and sem_dependencies
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>
2020-02-12 19:52:37 +08:00
Daniel Stone d8731e9eec Add drmModeGetFB2
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>
2020-02-12 10:23:44 +11:00
Juston Li 63d914d479 include/drm: sync up drm.h
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>
2020-02-12 10:23:44 +11:00
Alex Deucher 5c8ff57732 amdgpu: add new marketing names from 19.50
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>
2020-02-01 12:12:19 -05:00
Imre Deak 933729720b intel: drm_intel_bo_gem_create_from_* on platforms w/o HW tiling
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>
2020-01-28 15:32:39 +02:00
Eric Engestrom 074947ee4b meson: always define whether headers exist
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>
2020-01-23 17:00:12 +00:00
Eric Engestrom 077e64292c meson: add symbols check for core libdrm
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>
2020-01-23 16:55:04 +00:00
Ezequiel Garcia 07d48a4c00 modetest: Fix segmentation fault
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>
2020-01-21 17:56:23 +00:00
John Stultz 899da0f486 libdrm: modetest: Allow selecting modes by index
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>
2020-01-21 17:56:23 +00:00
Luben Tuikov c9d4540bf6 tests/amdgpu: Fix buffer overflow (v3)
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>
2020-01-08 13:21:40 -05:00
Luben Tuikov 29a5a85dae tests/amdgpu: Fix unused function warning (v2)
This patch fixes:
-Wunused-function

v2: Always enable amdgpu_ras_test().

Signed-off-by: Luben Tuikov <luben.tuikov@amd.com>
2020-01-08 13:20:57 -05:00
Luben Tuikov cb3d067587 tests/amdgpu: Fix various warnings (v2)
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>
2020-01-08 13:18:50 -05:00
Marek Olšák 9ebfac15a5 Revert "tests/amdgpu: Fix various warnings"
This reverts commit fb1634583f.
2020-01-07 14:44:47 -05:00
Marek Olšák 54b982dc6a Revert "tests/amdgpu: Fix unused function warning (v2)"
This reverts commit 4ff499cd85.
2020-01-07 14:44:47 -05:00