platform/upstream/libdrm.git
2 years agoamdgpu: Add new function to get fd.
Bas Nieuwenhuizen [Tue, 16 Nov 2021 00:41:49 +0000 (01:41 +0100)]
amdgpu: Add new function to get fd.

Dual purpose:
 - The drm fd dedupe functionality confuses the radeonsi
   amdgpu winsys if radeonsi isn't the first thing opening
   the device. By exposing the fd we can detect this case.
 - For a common mesa Vulkan sync objects implementation
   with syncobj. (notable: no buffer allocation)

Both shouldn't interferece with libdrm_amdgpu functionality
though it does somewhat piece the abstraction of the library.

Signed-off-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Gitlab: https://gitlab.freedesktop.org/mesa/mesa/-/issues/3424
Gitlab: https://gitlab.freedesktop.org/mesa/mesa/-/issues/5630
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
2 years agoci: Add FreeBSD support
Emmanuel Vadot [Wed, 10 Nov 2021 16:49:55 +0000 (17:49 +0100)]
ci: Add FreeBSD support

Use qemu to do CI on FreeBSD.
Not everything is compiled as all arm aren't supported on FreeBSD.
Same thing for Nouveau.
The tests aren't enable for now as they are all failing.

Signed-off-by: Emmanuel Vadot <manu@FreeBSD.org>
2 years agoci: Switch freedesktop/ci-templates
Emmanuel Vadot [Tue, 9 Nov 2021 20:26:24 +0000 (21:26 +0100)]
ci: Switch freedesktop/ci-templates

This switch to the latest ci-templates.
Most of the file is taken from the one in wayland.

Signed-off-by: Emmanuel Vadot <manu@FreeBSD.org>
2 years agoxf86drm: add drmGetDeviceFromDevId
Simon Ser [Mon, 1 Mar 2021 09:30:57 +0000 (10:30 +0100)]
xf86drm: add drmGetDeviceFromDevId

This adds a function to get a drmDevicePtr from a dev_t identifier
of a device. This is useful for Wayland that uses these to identify
devices over the protocol.

This is done by taking the implementation of drmGetDevice2, and removing
the call to fstat to find the dev_t.

Signed-off-by: Scott Anderson <scott.anderson@collabora.com>
Signed-off-by: Simon Ser <contact@emersion.fr>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2 years agoradeon: remove duplicate declaration of struct radeon_bo_manager in radeon_bo.h
suijingfeng [Wed, 3 Nov 2021 02:52:03 +0000 (10:52 +0800)]
radeon: remove duplicate declaration of struct radeon_bo_manager in radeon_bo.h

Reviewed-by: Simon Ser <contact@emersion.fr>
Signed-off-by: suijingfeng <suijingfeng@loongson.cn>
2 years agobuild: bump version to 2.4.108 libdrm-2.4.108
Simon Ser [Mon, 8 Nov 2021 16:35:03 +0000 (17:35 +0100)]
build: bump version to 2.4.108

Signed-off-by: Simon Ser <contact@emersion.fr>
2 years agoxf86drm: add iterator API for DRM/KMS IN_FORMATS blobs
Luigi Santivetti [Thu, 25 Mar 2021 22:42:38 +0000 (22:42 +0000)]
xf86drm: add iterator API for DRM/KMS IN_FORMATS blobs

Add support for parsing IN_FORMATS property blobs. Providing libdrm
with this functionality helps to standardise how user-space reads
kernel blobs and decreases duplication on the client side.

drmModeFormatModifierBlobIterNext() allows the caller to view
formats and associated modifiers given a valid property blob.
An example is available inside the libdrm unit test, modetest.c.

Signed-off-by: Luigi Santivetti <luigi.santivetti@imgtec.com>
Reviewed-by: Simon Ser <contact@emersion.fr>
3 years agoamdgpu: Make marketing names consistent
Joshua Ashton [Thu, 4 Nov 2021 06:03:49 +0000 (06:03 +0000)]
amdgpu: Make marketing names consistent

Fixes sporadic (TM), capitalization, missing AMD suffixes and spacing.

Signed-off-by: Joshua Ashton <joshua@froggi.es>
3 years agoFix -Werror=format build errors on FreeBSD
Alex Richardson [Tue, 5 Oct 2021 11:10:08 +0000 (12:10 +0100)]
Fix -Werror=format build errors on FreeBSD

On 64-bit FreeBSD targets uint64_t is generally defined as `unsigned long`
and not `unsigned long long`. Use the PRI macros to fix -Wformat.

Signed-off-by: Alex Richardson <Alexander.Richardson@cl.cam.ac.uk>
Reviewed-by: Simon Ser <contact@emersion.fr>
3 years agoamdgpu: add amdgpu_stress utility v2
Christian König [Wed, 29 Sep 2021 10:48:08 +0000 (12:48 +0200)]
amdgpu: add amdgpu_stress utility v2

Simple yet useful command line utility to simulate memory pressure.

Already found quite a number of problems in TTM with that.

v2: replace spaces with tabs

Signed-off-by: Christian König <christian.koenig@amd.com>
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
3 years agoman: refer to drmCloseBufferHandle instead of DRM_IOCTL_GEM_CLOSE
Simon Ser [Sun, 3 Oct 2021 17:54:50 +0000 (19:54 +0200)]
man: refer to drmCloseBufferHandle instead of DRM_IOCTL_GEM_CLOSE

This function in libdrm core wraps DRM_IOCTL_GEM_CLOSE.

Signed-off-by: Simon Ser <contact@emersion.fr>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
3 years agotegra: use drmCloseBufferHandle
Simon Ser [Sun, 3 Oct 2021 17:53:07 +0000 (19:53 +0200)]
tegra: use drmCloseBufferHandle

Instead of manually calling drmIoctl, use the equivalent function
from libdrm core.

Signed-off-by: Simon Ser <contact@emersion.fr>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
3 years agoomap: use drmCloseBufferHandle
Simon Ser [Sun, 3 Oct 2021 17:51:57 +0000 (19:51 +0200)]
omap: use drmCloseBufferHandle

Instead of manually calling drmIoctl, use the equivalent function
from libdrm core.

Signed-off-by: Simon Ser <contact@emersion.fr>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
3 years agonouveau: use drmCloseBufferHandle
Simon Ser [Sun, 3 Oct 2021 17:50:58 +0000 (19:50 +0200)]
nouveau: use drmCloseBufferHandle

Instead of manually calling drmIoctl, use the equivalent function
from libdrm core.

Signed-off-by: Simon Ser <contact@emersion.fr>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
3 years agofreedreno: use drmCloseBufferHandle
Simon Ser [Sun, 3 Oct 2021 17:49:40 +0000 (19:49 +0200)]
freedreno: use drmCloseBufferHandle

Instead of manually calling drmIoctl, use the equivalent function
from libdrm core.

Signed-off-by: Simon Ser <contact@emersion.fr>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
3 years agoexynos: use drmCloseBufferHandle
Simon Ser [Sun, 3 Oct 2021 17:48:14 +0000 (19:48 +0200)]
exynos: use drmCloseBufferHandle

Instead of manually calling drmIoctl, use the equivalent function
from libdrm core.

Signed-off-by: Simon Ser <contact@emersion.fr>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
3 years agoetnaviv: use drmCloseBufferHandle
Simon Ser [Sun, 3 Oct 2021 17:47:14 +0000 (19:47 +0200)]
etnaviv: use drmCloseBufferHandle

Instead of manually calling drmIoctl, use the equivalent function
from libdrm core.

Signed-off-by: Simon Ser <contact@emersion.fr>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
3 years agoradeon: use drmCloseBufferHandle
Simon Ser [Sun, 3 Oct 2021 17:45:24 +0000 (19:45 +0200)]
radeon: use drmCloseBufferHandle

Instead of manually calling drmIoctl, use the equivalent function
from libdrm core.

Signed-off-by: Simon Ser <contact@emersion.fr>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
3 years agointel: use drmCloseBufferHandle
Simon Ser [Sun, 3 Oct 2021 17:42:55 +0000 (19:42 +0200)]
intel: use drmCloseBufferHandle

Instead of manually calling drmIoctl, use the equivalent function
from libdrm core.

Signed-off-by: Simon Ser <contact@emersion.fr>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
3 years agoamdgpu: use drmCloseBufferHandle
Simon Ser [Sun, 3 Oct 2021 17:38:48 +0000 (19:38 +0200)]
amdgpu: use drmCloseBufferHandle

Instead of using a hand-rolled amdgpu_close_kms_handle function,
use the function from libdrm core, which does exactly the same
thing.

Signed-off-by: Simon Ser <contact@emersion.fr>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
3 years agoxf86drm: Update drmGetFormatModifierNameFromArm to handle AFRC
Dennis Tsiang [Wed, 22 Sep 2021 13:53:50 +0000 (14:53 +0100)]
xf86drm: Update drmGetFormatModifierNameFromArm to handle AFRC

Update drmGetFormatModifierNameFromArm function to handle AFRC
modifiers.

Signed-off-by: Dennis Tsiang <dennis.tsiang@arm.com>
3 years agodrm_fourcc: sync drm_fourcc with latest drm-next kernel
Dennis Tsiang [Mon, 20 Sep 2021 10:14:52 +0000 (11:14 +0100)]
drm_fourcc: sync drm_fourcc with latest drm-next kernel

Update drm_fourcc.h to include latest changes from drm-next branch.
This brings in AFRC (Arm Fixed-Rate Compression) modifiers.

Generated using make headers_install.
Generated from drm-next branch commit 6880fa6

Signed-off-by: Dennis Tsiang <dennis.tsiang@arm.com>
3 years agoxf86drmMode: simplify drm_property_type_is
Simon Ser [Tue, 15 Jun 2021 12:48:28 +0000 (14:48 +0200)]
xf86drmMode: simplify drm_property_type_is

No need to have two branches depending on DRM_MODE_PROP_EXTENDED_TYPE.
We can just use drmModeGetPropertyType instead.

This does introduce a slight change: previously, drm_property_type_is()
could be called with non-type flags such as IMMUTABLE. However no user
seems to do this (checked KWin/Mutter/Sway/Weston/Xorg).

Signed-off-by: Simon Ser <contact@emersion.fr>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
3 years agoxf86drmMode: switch to standard inline qualifier
Simon Ser [Tue, 15 Jun 2021 12:47:04 +0000 (14:47 +0200)]
xf86drmMode: switch to standard inline qualifier

__inline is non-standard, inline is.

Signed-off-by: Simon Ser <contact@emersion.fr>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
3 years agoxf86drmMode: make drm_property_type_is arg const
Simon Ser [Tue, 15 Jun 2021 12:46:05 +0000 (14:46 +0200)]
xf86drmMode: make drm_property_type_is arg const

This function only needs read-only access to the property. This is
not a breaking ABI change.

Signed-off-by: Simon Ser <contact@emersion.fr>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
3 years agointel: Drop legacy execbuffer support
Jason Ekstrand [Wed, 10 Mar 2021 19:52:57 +0000 (13:52 -0600)]
intel: Drop legacy execbuffer support

Execbuffer2 support was introduced to libdrm in b50964027be, 10 years
ago, and no driver has used the old execbuf path since.  There's no need
to support 10-year-old kernels.

Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
3 years agoxf86drm: add GEM_CLOSE ioctl wrapper
Simon Ser [Wed, 1 Sep 2021 19:26:38 +0000 (21:26 +0200)]
xf86drm: add GEM_CLOSE ioctl wrapper

We have wrappers for PRIME_HANDLE_TO_FD and PRIME_FD_TO_HANDLE,
but not for GEM_CLOSE. Add it so that callers don't need to
manually call drmIoctl.

Signed-off-by: Simon Ser <contact@emersion.fr>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Acked-by: Daniel Stone <daniels@collabora.com>
3 years agointel: Do not assert on unknown chips in drm_intel_decode_context_alloc
Tvrtko Ursulin [Wed, 18 Nov 2020 16:31:26 +0000 (16:31 +0000)]
intel: Do not assert on unknown chips in drm_intel_decode_context_alloc

There is this long standing nit of igt/tools/intel_error_decode asserting
when you feed it an error state from a GPU the local libdrm does not know
of.

To fix this I need a tweak in drm_intel_decode_context_alloc to make it
not assert but just return NULL (which seems an already possible return
value).

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Cc: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
3 years agointel: Sync pci ids
José Roberto de Souza [Tue, 14 Sep 2021 20:41:21 +0000 (13:41 -0700)]
intel: Sync pci ids

Sync libdrm with kernel, a new DG1 pci was added.
Commit 5f0d4214938d ("drm/i915/dg1: Add new PCI id")

Signed-off-by: José Roberto de Souza <jose.souza@intel.com>
3 years agoamdgpu: add new marketing name
Alex Deucher [Fri, 17 Sep 2021 13:16:57 +0000 (09:16 -0400)]
amdgpu: add new marketing name

Acked-by: Andrey Grodzovsky <andrey.grodzovsky@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
3 years agoamdgpu: add marketing names from 21.30
Alex Deucher [Fri, 17 Sep 2021 13:14:13 +0000 (09:14 -0400)]
amdgpu: add marketing names from 21.30

Add new marketing names

Acked-by: Andrey Grodzovsky <andrey.grodzovsky@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
3 years agotests/modetest: get cursor width and height by drmGetCap
ZhiJie.Zhang [Mon, 8 Mar 2021 12:35:30 +0000 (20:35 +0800)]
tests/modetest: get cursor width and height by drmGetCap

Should get cursor width and height by drmGetCap.

Signed-off-by: ZhiJie.Zhang <zhangzhijie@loongson.cn>
3 years agointel: sync ADL-S PCI IDs with kernel
Tejas Upadhyay [Tue, 24 Aug 2021 07:19:19 +0000 (12:49 +0530)]
intel: sync ADL-S PCI IDs with kernel

Align with kernel commits:

c79b846f892d ("drm/i915/adl_s: Update ADL-S PCI IDs")
3f50033dd88a ("drm/i915/adl_s: ADL-S platform Update PCI ids for Mobile BGA")

Signed-off-by: Tejas Upadhyay <tejaskumarx.surendrakumar.upadhyay@intel.com>
3 years agoxf86drm: fix mem leak in drm_usb_dev_path()
Eric Engestrom [Fri, 13 Aug 2021 20:19:13 +0000 (21:19 +0100)]
xf86drm: fix mem leak in drm_usb_dev_path()

`sysfs_uevent_get()` returns a `strndup()`ed string, which must be `free()`d.

Fixes: bf63f8acdc94164ad29d ("libdrm: Handle usb_interface devices for usb parsing")
Reviewed-by: Simon Ser <contact@emersion.fr>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
3 years agonouveau: print bo address in the GPU/CPU vm and its size
Karol Herbst [Sun, 30 May 2021 13:10:39 +0000 (15:10 +0200)]
nouveau: print bo address in the GPU/CPU vm and its size

v2: print bo->offset as 64 bit

Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Signed-off-by: Karol Herbst <kherbst@redhat.com>
3 years agolibdrm: NOTE! Default branch is now main
Jordan Justen [Mon, 2 Aug 2021 08:06:44 +0000 (01:06 -0700)]
libdrm: NOTE! Default branch is now main

To update your local repository to use the new default branch, these
commands may help:

$ git fetch origin
$ git checkout master
$ git branch -m main
$ git branch --set-upstream-to=origin/main
$ git remote set-head origin --auto

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
3 years agoheaders: drm: Sync with drm-next
Mario Kleiner [Sat, 3 Jul 2021 19:54:27 +0000 (21:54 +0200)]
headers: drm: Sync with drm-next

Generated using make headers_install from the drm-next
tree - git://anongit.freedesktop.org/drm/drm
branch - drm-next
commit - 8a02ea42bc1d4c448caf1bab0e05899dad503f74

Some changes were omitted, e.g., to nouveau_drm.h, i915_drm.h, and
msm_drm.h, as the nouveau and i915 changes looked to me as if they
could break compatibility or require other compatibility fixes to
libdrm which i can not judge. msm_drm.h broke the build, as there
are definitely changes needed to libdrm's msm support code.

The shortlog below is edited to only list what corresponds to files
that are included here, because it looked safe to me.

The changes were as follows (shortlog from
b10733527bfd864605c33ab2e9a886eec317ec39..HEAD):

Aaron Liu (1):
      drm/amdgpu: add uapi to define yellow carp series

Alex Deucher (1):
      drm/amdgpu: add INFO ioctl support for querying video caps (v4)

Christian Gmeiner (1):
      drm/etnaviv: provide more ID values via GET_PARAM ioctl.

Felix Kuehling (1):
      drm/amdgpu: Add new placement for preemptible SG BOs

Jiawei Gu (1):
      drm/amdgpu: Add vbios info ioctl interface

Lionel Landwerlin (1):
      drm: fix drm_mode_create_blob comment

Mario Kleiner (1):
      drm/fourcc: Add 16 bpc fixed point framebuffer formats.

Nirmoy Das (1):
      drm/amdgpu: remove AMDGPU_GEM_CREATE_SHADOW flag

Noralf Trønnes (1):
      drm/uapi: Add USB connector type

Radhakrishna Sripada (1):
      drm/framebuffer: Format modifier for Intel Gen 12 render compression with Clear Color

Simon Ser (13):
      drm: improve kernel-docs in drm_mode.h
      drm: document drm_mode_get_connector
      drm: document drm_mode_modeinfo
      drm: document that user-space should force-probe connectors
      drm/doc: atomic implicitly enables other caps
      drm/doc: re-format drm.h file comment
      drm/doc: demote old doc-comments in drm.h
      drm/fourcc: fix Amlogic format modifier masks
      drm/uapi: document kernel capabilities
      drm/connector: demote connector force-probes for non-master clients
      drm: reference mode flags in DRM_CLIENT_CAP_* docs
      drm: clarify and linkify DRM_CLIENT_CAP_WRITEBACK_CONNECTORS docs
      drm: document minimum kernel version for DRM_CLIENT_CAP_*

Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com>
3 years agomeson: Don't build libkms for Android.
Eric Anholt [Thu, 22 Apr 2021 23:25:07 +0000 (16:25 -0700)]
meson: Don't build libkms for Android.

Nobody wants that that I know of.

Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
3 years agomeson: Build libdrm.so as an unversioned lib on Android.
Eric Anholt [Thu, 22 Apr 2021 23:03:38 +0000 (16:03 -0700)]
meson: Build libdrm.so as an unversioned lib on Android.

Android vendor libraries don't have sonames, and libdrm.so shouldn't
either.  This lets a Mesa built against a libdrm.so built for Android
be copied directly to a Chrome OS ARC installation.

Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
3 years agotest/amdgpu: Bob to Alice copy should be TMZ in secure bounce test
Aaron Liu [Thu, 22 Jul 2021 09:01:00 +0000 (17:01 +0800)]
test/amdgpu: Bob to Alice copy should be TMZ in secure bounce test

SDMA copy from Alice to Bob is in TMZ mode. Therefore
SDMA copy back from Bob to Alice should be in TMZ mode too.

Signed-off-by: Aaron Liu <aaron.liu@amd.com>
Reviewed-by: Luben Tuikov <luben.tuikov@amd.com>
3 years agotests/amdgpu: Fix TMZ secure bounce test
Luben Tuikov [Fri, 16 Jul 2021 01:28:16 +0000 (21:28 -0400)]
tests/amdgpu: Fix TMZ secure bounce test

Fix the TMZ secure bounce test, in that Bob's
buffer has to be created encrypted (with the
encrypted flag set), so that when we copy from
Alice's buffer, which is also encrypted, to Bob's
buffer, the copy can be successful and the data
actually copied.

This fixes the test and it no longer fails. Tested
on Sienna Cichlid.

Cc: Alex Deucher <Alexander.Deucher@amd.com>
Cc: Christian König <christian.koenig@amd.com>
Cc: Aaron Liu <aaron.liu@amd.com>
Cc: Huang Rui <ray.huang@amd.com>
Signed-off-by: Luben Tuikov <luben.tuikov@amd.com>
Reviewed-by: Alex Deucher <Alexander.Deucher@amd.com>
3 years agoBump version to 2.4.107 libdrm-2.4.107
Bas Nieuwenhuizen [Fri, 2 Jul 2021 01:12:14 +0000 (03:12 +0200)]
Bump version to 2.4.107

Signed-off-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
3 years agoamdgpu: update marketing names
Alex Deucher [Mon, 28 Jun 2021 19:48:14 +0000 (15:48 -0400)]
amdgpu: update marketing names

From 21.20 release.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
3 years agoREADME.rst: Include some notes about syncing uapi headers
Marius Vlad [Thu, 11 Feb 2021 11:08:05 +0000 (13:08 +0200)]
README.rst: Include some notes about syncing uapi headers

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
3 years agoxf86drm: Add support for decoding AMLOGIC format modifiers
Marius Vlad [Tue, 23 Feb 2021 22:51:45 +0000 (00:51 +0200)]
xf86drm: Add support for decoding AMLOGIC format modifiers

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
3 years agoxf86drm: Add support for decoding AMD format modifiers
Marius Vlad [Wed, 17 Feb 2021 13:59:30 +0000 (15:59 +0200)]
xf86drm: Add support for decoding AMD format modifiers

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
3 years agoxf86drm: Add support for decoding Nvidia format modifiers
Marius Vlad [Mon, 1 Feb 2021 11:45:58 +0000 (13:45 +0200)]
xf86drm: Add support for decoding Nvidia format modifiers

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
3 years agoxf86drm: Add a vendor function to decode the format modifier
Marius Vlad [Mon, 1 Feb 2021 11:39:43 +0000 (13:39 +0200)]
xf86drm: Add a vendor function to decode the format modifier

As format modifiers can be encoded in quite complex forms, the static
table previously added is not sufficient to retrieve, extract and decode
the token formats to a human-readable string.  This patch introduces a
vendor specific callback which could be used to perform an additional
search to match up with vendor encoding scheme, which, will be used
first, before resorting to searching the static table.

With it, add support for decoding the ARM format modifiers.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
3 years agoxf86drm: Add a human readable representation for format modifiers
Marius Vlad [Mon, 1 Feb 2021 11:23:20 +0000 (13:23 +0200)]
xf86drm: Add a human readable representation for format modifiers

Introduces two new methods to retrieve a human readable representation of a
format modifier:

drmGetFormatModifierName() - returns a format modifier as a string,
from a token modifier
drmGetFormatModifierVendor() - returns the vendor as a string, from a
token modifier

and the fourcc_mod_get_vendor macro that returns the vendor.

New format modifiers added in drm_fourcc.h uapi kernel header should be
sync'ed up with libdrm and should include a human readable
representation for that format modifier, in order to display it
correctly as a string.

That happens with the help of a python script that reads up drm_fourcc
header file and outputs a static table comprised of token modifiers
alongside a vendor table (Suggested-by Simon Ser <contact@emersion.fr>).

The reason for doing it in libdrm is to have a unified place instead of each
user of libdrm having a way to keep track of the format modifiers.

With this patch, modetest has also been modified to make use of it.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
3 years agoConditionally include <linux/limits.h> and <sys/params.h> on Linux, BSD
Eleni Maria Stea [Sun, 20 Jun 2021 06:33:58 +0000 (09:33 +0300)]
Conditionally include <linux/limits.h> and <sys/params.h> on Linux, BSD

<linux/limits.h> should be included conditionally for Linux only, also
SPECNAMELEN used conditionally when the OS is FreeBSD requires to
include <sys/params.h>.

Signed-off-by: Eleni Maria Stea <elene.mst@gmail.com>
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
3 years ago_WANT_KERNEL_ERRNO must be defined in FreeBSD for ERESTART to be used
Eleni Maria Stea [Mon, 7 Jun 2021 07:24:11 +0000 (10:24 +0300)]
_WANT_KERNEL_ERRNO must be defined in FreeBSD for ERESTART to be used

In FreeBSD's errno.h ERESTART is not defined by default, only when the
user requests the pseudo-errors returned inside the kernel to be
enabled. As a result the block where drmCommandWriteRead is
called returns compile error. Defined _WANT_KERNEL_ERRNO to fix it (see
FreeBSD's /usr/include/errno.h)

Signed-off-by: Eleni Maria Stea <elene.mst@gmail.com>
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
3 years agoinclude <sys/types.h> in xf86drmMode when the OS is FreeBSD
Eleni Maria Stea [Mon, 7 Jun 2021 07:19:18 +0000 (10:19 +0300)]
include <sys/types.h> in xf86drmMode when the OS is FreeBSD

<sys/types.h> need to be included in xf86drmMode.c for type u_int in
<sys/sysctl.h> (that is included when OS is FreeBSD) to be recognized.

Signed-off-by: Eleni Maria Stea <elene.mst@gmail.com>
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
3 years agoamdgpu: Add vamgr for capture/replay.
Bas Nieuwenhuizen [Mon, 23 Nov 2020 01:18:05 +0000 (02:18 +0100)]
amdgpu: Add vamgr for capture/replay.

In Vulkan we have extensions to assist with capture in replay in a
world where addresses are returned to the application. This involves
creating buffers at the same VA during replay as they were during
capture.

By itself libdrm_amdgpu already has support for this, but there is
the obvious failure mode that if another buffer is already allocated
at that VA things fail spectacularly. This is an actual issue as
internal buffers, like winsys images or shader binaries also
participate in the same VA allocation.

To avoid this problem applications have to create buffers which
are going to be captured with a flag, and the implementation is to
separate VA allocation for those buffers to reduce the collision risk:

"Implementations are expected to separate such buffers in the GPU address
space so normal allocations will avoid using these addresses. Apps/tools
should avoid mixing app-provided and implementation-provided addresses for
buffers created with VK_BUFFER_CREATE_DEVICE_ADDRESS_CAPTURE_REPLAY_BIT,
to avoid address space allocation conflicts."

This patch implements that by adding a flag for these buffers and allocating
address space from the top of the address range instead of the bottom.

Signed-off-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Christian König <christian.koenig@amd.com>
3 years agotests/amdgpu/hotunplug: Add hotunplug with exported fence
Andrey Grodzovsky [Fri, 4 Jun 2021 20:08:41 +0000 (16:08 -0400)]
tests/amdgpu/hotunplug: Add hotunplug with exported fence

Disconnect device while fence is exported.
Also disable this test for sytem with single GPU.

Signed-off-by: Andrey Grodzovsky <andrey.grodzovsky@amd.com>
Reviewed-by: Alex Deucher alexander.deucher@amd.com
3 years agotests/amdgpu/hotunplug: Add hotunplug with exported bo test
Andrey Grodzovsky [Tue, 1 Jun 2021 18:30:08 +0000 (14:30 -0400)]
tests/amdgpu/hotunplug: Add hotunplug with exported bo test

Disconnect device while BO is exported.

Signed-off-by: Andrey Grodzovsky <andrey.grodzovsky@amd.com>
Reviewed-by: Alex Deucher alexander.deucher@amd.com
3 years agotests/amdgpu/hotunplug: Add unplug with cs test.
Andrey Grodzovsky [Mon, 31 May 2021 18:13:06 +0000 (14:13 -0400)]
tests/amdgpu/hotunplug: Add unplug with cs test.

Same as simple test but while doing cs

Signed-off-by: Andrey Grodzovsky <andrey.grodzovsky@amd.com>
Reviewed-by: Alex Deucher alexander.deucher@amd.com
3 years agotest/amdgpu/hotunplug: Add test suite for GPU unplug
Andrey Grodzovsky [Wed, 26 May 2021 19:15:33 +0000 (15:15 -0400)]
test/amdgpu/hotunplug: Add test suite for GPU unplug

Add plug/unplug device and open/close device file
infrastructure.
Add basic test - unplug device while device file still
open. Close device file afterwards and replug the device.

Signed-off-by: Andrey Grodzovsky <andrey.grodzovsky@amd.com>
Reviewed-by: Alex Deucher alexander.deucher@amd.com
3 years agotest/amdgpu: Add helper functions for hot unplug
Andrey Grodzovsky [Mon, 31 May 2021 15:11:58 +0000 (11:11 -0400)]
test/amdgpu: Add helper functions for hot unplug

Expose close device and add open device wich preserves
test index.

Signed-off-by: Andrey Grodzovsky <andrey.grodzovsky@amd.com>
Reviewed-by: Alex Deucher alexander.deucher@amd.com
3 years agotests/amdgpu: Fix valgrind warning
Andrey Grodzovsky [Tue, 1 Jun 2021 18:56:54 +0000 (14:56 -0400)]
tests/amdgpu: Fix valgrind warning

Struct access after free

Signed-off-by: Andrey Grodzovsky <andrey.grodzovsky@amd.com>
Reviewed-by: Alex Deucher alexander.deucher@amd.com
3 years agoamdgpu: Added product name for E9390,E9560 and E9565 dgpu
Rahul Kumar [Mon, 7 Jun 2021 14:59:19 +0000 (10:59 -0400)]
amdgpu: Added product name for E9390,E9560 and E9565 dgpu

Update marketing names.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
3 years agoRevert "tests/amdgpu: fix bo eviction test issue"
Lang Yu [Sat, 8 May 2021 05:55:54 +0000 (13:55 +0800)]
Revert "tests/amdgpu: fix bo eviction test issue"

This reverts commit a5a400c9581c3b91598623603067556b18084c5d.

Bo evict test was disabled by default per below commit.
So still keep it as disabled.

1f6a85cc test/amdgpu: disable bo eviction test by default

Signed-off-by: Lang Yu <Lang.Yu@amd.com>
Signed-off-by: Guchun Chen <guchun.chen@amd.com>
Reviewed-by: Lang Yu <Lang.Yu@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
3 years agointel: Add support for ADLP
Tejas Upadhyay [Mon, 17 May 2021 05:35:29 +0000 (11:05 +0530)]
intel: Add support for ADLP

Add ADLP platform support and PCIIDs

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Uma Shankar <uma.shankar@intel.com>
Signed-off-by: Pankaj Bharadiya <pankaj.laxminarayan.bharadiya@intel.com>
Signed-off-by: Caz Yokoyama <caz.yokoyama@intel.com>
Signed-off-by: Anusha Srivatsa <anusha.srivatsa@intel.com>
Signed-off-by: Tejas Upadhyay <tejaskumarx.surendrakumar.upadhyay@intel.com>
3 years agoBump version to 2.4.106 libdrm-2.4.106
Dave Airlie [Tue, 18 May 2021 03:37:56 +0000 (13:37 +1000)]
Bump version to 2.4.106

Signed-off-by: Dave Airlie <airlied@redhat.com>
3 years agonouveau: add debug option to sync pushbuffer submissions
Karol Herbst [Wed, 5 May 2021 12:14:30 +0000 (14:14 +0200)]
nouveau: add debug option to sync pushbuffer submissions

Signed-off-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
3 years agonovueau: document debug flags
Karol Herbst [Wed, 5 May 2021 12:05:52 +0000 (14:05 +0200)]
novueau: document debug flags

Signed-off-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
3 years agonouveau: rework debugging so we can also dump into a file
Karol Herbst [Wed, 5 May 2021 12:01:57 +0000 (14:01 +0200)]
nouveau: rework debugging so we can also dump into a file

Signed-off-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
3 years agonouveau: make debug features accessible in normal builds
Karol Herbst [Wed, 5 May 2021 12:01:29 +0000 (14:01 +0200)]
nouveau: make debug features accessible in normal builds

Signed-off-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
3 years agonouveau: mask push buffer length pushbuf_dump
Karol Herbst [Sun, 3 May 2020 14:21:09 +0000 (16:21 +0200)]
nouveau: mask push buffer length pushbuf_dump

nvc0 sets the NVC0_IB_ENTRY_1_NO_PREFETCH bit on some pushbuffers

Signed-off-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
3 years agonouveau: fix crash in pushbuf_dump with an unmapped bo
Karol Herbst [Sun, 3 May 2020 14:19:53 +0000 (16:19 +0200)]
nouveau: fix crash in pushbuf_dump with an unmapped bo

Signed-off-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
3 years agoci: use `base-devel` tag of archlinux image instead of `base` and then installing...
Eric Engestrom [Thu, 29 Apr 2021 08:15:11 +0000 (10:15 +0200)]
ci: use `base-devel` tag of archlinux image instead of `base` and then installing `base-devel` after

Signed-off-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Simon Ser <contact@emersion.fr>
3 years agoci: use archlinux/archlinux docker image instead of deprecated and now removed archli...
Eric Engestrom [Thu, 29 Apr 2021 08:13:43 +0000 (10:13 +0200)]
ci: use archlinux/archlinux docker image instead of deprecated and now removed archlinux/base

Signed-off-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Simon Ser <contact@emersion.fr>
3 years agoRevert "xf86drmMode: set FB_MODIFIERS flag when modifiers are supplied"
Bas Nieuwenhuizen [Wed, 21 Apr 2021 19:31:06 +0000 (21:31 +0200)]
Revert "xf86drmMode: set FB_MODIFIERS flag when modifiers are supplied"

This reverts commit b362850689d1b0048b7f4641cc236128b5a43773.

This breaks when the kernel driver does not support modifiers and the
application properly zeroes the modifiers.

Acked-by: Simon Ser <contact@emersion.fr>
3 years agotest/amdgpu: Add emit mem sync flag for test IB
Jinzhou Su [Mon, 19 Apr 2021 06:04:22 +0000 (14:04 +0800)]
test/amdgpu: Add emit mem sync flag for test IB

In syncobj test, 3 threads will be created. Sometimes
the first gfx IB and the third sdma IB will use same
physical page. There will be risk that sdma engine will
read gfx IB in the same physical page. So better to flush
the cache before commit the sdma IB.

Signed-off-by: Jinzhou Su <Jinzhou.Su@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
3 years agotest/amdgpu: use tmz ids to check whether enable security tests
Huang Rui [Fri, 9 Apr 2021 10:07:16 +0000 (18:07 +0800)]
test/amdgpu: use tmz ids to check whether enable security tests

Using tmz ids that reported from kernel to decide whether enable
security tests.

Signed-off-by: Huang Rui <ray.huang@amd.com>
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
3 years agotests/amdgpu/vcn: update to support aldebaran
James Zhu [Mon, 12 Apr 2021 12:44:59 +0000 (08:44 -0400)]
tests/amdgpu/vcn: update to support aldebaran

VCN is supported after AI family Arcturus.

Signed-off-by: James Zhu <James.Zhu@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Leo Liu <leo.liu@amd.com>
3 years agotests/amdgpu:retire asic_id check on unsupported cases
Feifei Xu [Wed, 25 Nov 2020 09:20:33 +0000 (17:20 +0800)]
tests/amdgpu:retire asic_id check on unsupported cases

Retire the asic_id check for AI family.

Signed-off-by: Feifei Xu <Feifei.Xu@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
3 years agotests/amdgpu: update gfx9 BufferCopy/BufferClear
Feifei Xu [Thu, 1 Apr 2021 08:33:00 +0000 (16:33 +0800)]
tests/amdgpu: update gfx9 BufferCopy/BufferClear

buffer_load/store_format_xyzw require 64bit vgpr_a[2].
The original parameter is one u32. Modify the shader binary to
fit the 64bit parameter.

Signed-off-by: Feifei Xu <Feifei.Xu@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Tested-by: Gang Long <Gang.Long@amd.com>
3 years agoBump version to 2.4.105 libdrm-2.4.105
Leo Liu [Wed, 7 Apr 2021 13:54:11 +0000 (09:54 -0400)]
Bump version to 2.4.105

Signed-off-by: Leo Liu <leo.liu@amd.com>
3 years agoamdgpu: add function of INFO ioctl for querying video caps
Leo Liu [Tue, 19 Jan 2021 21:51:02 +0000 (16:51 -0500)]
amdgpu: add function of INFO ioctl for querying video caps

via the newly added uapi/amdgpu_drm interface

Signed-off-by: Leo Liu <leo.liu@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
3 years agoamdgpu: sync up amdgpu_drm.h with latest from kernel
Leo Liu [Tue, 23 Feb 2021 16:22:42 +0000 (11:22 -0500)]
amdgpu: sync up amdgpu_drm.h with latest from kernel

From drm-next:

commit 2cbcb78c9ee5520c8d836c7ff57d1b60ebe8e9b7
Merge: 06debd6e1b28 8c44390d8872
Author: Daniel Vetter <daniel.vetter@ffwll.ch>
Date:   Fri Mar 26 15:52:01 2021 +0100

    Merge tag 'amd-drm-next-5.13-2021-03-23' of https://gitlab.freedesktop.org/agd5f/linux into drm-next

    amd-drm-next-5.13-2021-03-23:

    amdgpu:
    ...

    UAPI:
    - amdgpu: Add a new INFO ioctl interface to query video capabilities
      rather than hardcoding them in userspace.  This allows us to provide
      fine grained asic capabilities (e.g., if a particular part is
      bandwidth limited, we can limit the capabilities).  Proposed userspace:
      https://gitlab.freedesktop.org/leoliu/drm/-/commits/info_video_caps
      https://gitlab.freedesktop.org/leoliu/mesa/-/commits/info_video_caps
    ...

    Danvet: A bunch of conflicts all over, but it seems to compile ... I
    did put the call to dc_allow_idle_optimizations() on a single line
    since it looked a bit too jarring to be left alone.

Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
    From: Alex Deucher <alexander.deucher@amd.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20210324040147.1990338-1-alexander.deucher@amd.com
Signed-off-by: Leo Liu <leo.liu@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
3 years agoxf86drmMode: set FB_MODIFIERS flag when modifiers are supplied
Simon Ser [Fri, 5 Mar 2021 15:07:58 +0000 (16:07 +0100)]
xf86drmMode: set FB_MODIFIERS flag when modifiers are supplied

The kernel will always return EINVAL if modifiers are supplied but
the flag DRM_MODE_FB_MODIFIERS isn't set. That's a pretty nice
footgun.

Be a little more helpful and set the flag if the user has supplied
a modifier array.

Signed-off-by: Simon Ser <contact@emersion.fr>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
3 years agotests/amdgpu: fix bo eviction test issue
Lang Yu [Mon, 29 Mar 2021 07:52:51 +0000 (15:52 +0800)]
tests/amdgpu: fix bo eviction test issue

On Raven2/Picasso, the default VRAM size is 2048M,
and the default GTT size is 3072M. If max_allocation
of VRAM exceeds half of GTT size, GTT memory can't
hold evicted bo from VRAM and bo in itself at the
same time. Then amdgpu_cs_list_validate will failed
with "Not enough memory for command submission" error.

NOTE:
The installed DRAM should be larger than 8GB,
if the VRAM size is 2048M.

Signed-off-by: Lang Yu <Lang.Yu@amd.com>
Signed-off-by: Marek Olšák <marek.olsak@amd.com>
3 years agodrm/tests/amdgpu: fix Metadata test failed issue
Lang Yu [Wed, 24 Mar 2021 04:18:41 +0000 (12:18 +0800)]
drm/tests/amdgpu: fix Metadata test failed issue

The unit of size_metadata is one byte not four bytes.
Enable Metadata test.

Signed-off-by: Lang Yu <Lang.Yu@amd.com>
Signed-off-by: Marek Olšák <marek.olsak@amd.com>
3 years agoxf86drmMode: introduce drmModeGetPropertyType
Simon Ser [Thu, 25 Feb 2021 11:19:43 +0000 (12:19 +0100)]
xf86drmMode: introduce drmModeGetPropertyType

We already have drm_property_type_is, but it's needlessly complicated
and doesn't cover all use-cases (requires the caller to provide a
type).

Signed-off-by: Simon Ser <contact@emersion.fr>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
3 years agotest/amdgpu: remove static varible in Syncobj test
Jinzhou Su [Mon, 22 Mar 2021 05:44:30 +0000 (05:44 +0000)]
test/amdgpu: remove static varible in Syncobj test

In syncobj test, wait thread and signal thread create
simultaneously. The ptr for GFX IB and SDMA IP should be
operated separately. With static, there will be risk that
GFX NOP is in SDMA IB or SDMA NOP is in GFX IB, then GFX or
SDMA hang caused.

Signed-off-by: Jinzhou Su <Jinzhou.Su@amd.com>
Signed-off-by: Marek Olšák <marek.olsak@amd.com>
3 years agointel: Keep libdrm working without pread/pwrite ioctls
Ashutosh Dixit [Tue, 22 Sep 2020 00:34:16 +0000 (17:34 -0700)]
intel: Keep libdrm working without pread/pwrite ioctls

The general direction at this time is to phase out pread/write ioctls and
not support them in future products. The ioctls have already been disabled
in i915 for future products. This means libdrm must handle the absence of
these ioctls. This patch does this by modifying drm_intel_gem_bo_subdata()
and drm_intel_gem_bo_get_subdata() to do the read/write using the
pread/pwrite ioctls first but when these ioctls are unavailable fall back
to doing the read/write using a combination of mmap and memcpy.

A similar solution was added to igt-gpu-tools in commit
ad5eb02eb3 ("lib/ioctl_wrappers: Keep IGT working without pread/pwrite
ioctls").

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Signed-off-by: Ashutosh Dixit <ashutosh.dixit@intel.com>
3 years agomeson: use library() instead of shared_library().
Fang Tan [Tue, 9 Mar 2021 08:14:36 +0000 (16:14 +0800)]
meson: use library() instead of shared_library().

This allows users to select the library type (static or shared)
using the Meson -Ddefault_library built-in option.

Issue: https://gitlab.freedesktop.org/mesa/drm/-/issues/45

Reviewed-by: Simon Ser <contact@emersion.fr>
Signed-off-by: Fang Tan <tanfang@uniontech.com>
3 years agoxf86drm: fix null pointer deref in drmGetBufInfo
Alistair Delva [Tue, 2 Mar 2021 16:18:06 +0000 (08:18 -0800)]
xf86drm: fix null pointer deref in drmGetBufInfo

If info.count is large, drmMalloc() / alloca() may fail, and the
resulting null pointer is not null checked before dereference.

Issue: https://gitlab.freedesktop.org/mesa/drm/-/issues/62

Reviewed-by: Simon Ser <contact@emersion.fr>
Signed-off-by: Alistair Delva <adelva@google.com>
3 years agointel: Add support for JSL
Tejas Upadhyay [Mon, 1 Mar 2021 09:52:48 +0000 (09:52 +0000)]
intel: Add support for JSL

Add the PCI ID import for JSL.

V1 - Indentation
Signed-off-by: Tejas Upadhyay <tejaskumarx.surendrakumar.upadhyay@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
3 years agoxf86drm: cap number of reported devices by drmGetDevice(2)
Emil Velikov [Fri, 5 Feb 2021 00:41:13 +0000 (00:41 +0000)]
xf86drm: cap number of reported devices by drmGetDevice(2)

Do as the documentation says - when devices non NULL, cap the reported
devices to max_devices. Otherwise we risk out-of-bound access
for users of the API.

v2:
 - Fix this w/o breaking the API

v3:
 - Drop local variables, flip inverted conditional (Simon)

Issue: https://gitlab.freedesktop.org/mesa/drm/-/issues/56
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Simon Ser <contact@emersion.fr>
3 years agoRevert "xf86drm: cap number of reported devices by drmGetDevice(2)"
Emil Velikov [Thu, 11 Feb 2021 21:38:31 +0000 (21:38 +0000)]
Revert "xf86drm: cap number of reported devices by drmGetDevice(2)"

This reverts commit 8cb12a2528d795c45bba5f03b3486b4040fb0f45.

The commit fixed the OOB, yet it broke drmDevices2(0, NULL, 0) - aka we
did not return the total devices list.

Reviewed-by: Simon Ser <contact@emersion.fr>
3 years agoxf86drm: warn about GEM handle reference counting
Simon Ser [Thu, 21 Jan 2021 10:11:38 +0000 (11:11 +0100)]
xf86drm: warn about GEM handle reference counting

Users need to be careful when using drmPrimeHandleToFD or
drmPrimeFDToHandle directly. Mention GBM as a solution.

See [1] for an example mistake.

[1]: https://gitlab.freedesktop.org/drm/nouveau/-/issues/43#note_772661

Signed-off-by: Simon Ser <contact@emersion.fr>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
3 years agoxf86drmMode: add drmIsKMS
Simon Ser [Tue, 23 Feb 2021 17:19:33 +0000 (18:19 +0100)]
xf86drmMode: add drmIsKMS

If a device has a primary node, it doesn't necessarily mean it's
suitable for KMS usage. For instance, render-only drivers also
expose primary nodes.

The check is extracted from Weston [1].

The motivation for this new function is two-fold:

- Avoid an unnecessary GETRESOURCES call. To check whether a
  primary node is suitable for KMS, we don't actually need to
  retrieve the object IDs we just need to check the counts.
- Avoid confusion in user-space and make sure user-space implements
  the check properly. For instance, wlroots doesn't [2]: it uses
  drmGetVersion which succeeds with render-only drivers.

[1]: https://gitlab.freedesktop.org/wayland/weston/-/blob/master/libweston/backend-drm/drm.c#L2689
[2]: https://github.com/swaywm/wlroots/blob/a290d7a78dc36275e24e54f84570f37a66dc67a4/backend/session/session.c#L268

Signed-off-by: Simon Ser <contact@emersion.fr>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
3 years agoamdgpu_drm: sync up with the latest amdgpu_drm.h based on drm-next (https://cgit...
Leo Liu [Sun, 21 Feb 2021 21:13:51 +0000 (16:13 -0500)]
amdgpu_drm: sync up with the latest amdgpu_drm.h based on drm-next (https://cgit.freedesktop.org/drm/drm)

What are these headers?
Adding currently missing stuff from https://cgit.freedesktop.org/drm/drm/tree/include/uapi/drm/amdgpu_drm.h based on
the latest commit there:

commit f730f39eb981af249d57336b47cfe3925632a7fd (HEAD -> drm-next, tag: drm-next-2021-02-19, origin/drm-next, origin/HEAD)
Merge: 4f8ad4045b38 81ce8f04aa96
Author: Dave Airlie <airlied@redhat.com>
Date:   Fri Feb 19 13:54:29 2021 +1000

    Merge tag 'drm-intel-next-fixes-2021-02-18' of git://anongit.freedesktop.org/drm/drm-intel into drm-next

Which headers go where?
From https://cgit.freedesktop.org/drm/drm/tree/include/uapi/drm/amdgpu_drm.h to
https://cgit.freedesktop.org/mesa/drm/tree/include/drm/amdgpu_drm.h

When and which headers to update?
If the kernel uapi drm header changes, the header here should be sync-ed.

When and how to update these files
The steps for generating this patch:

 - Switch to freedesktop drm-next kernel branch (https://cgit.freedesktop.org/drm/drm);
 - Install the headers via `make headers_install';
 - Copy from kernel "include/uapi/drm/amdgpu_drm.h" to libdrm "include/drm/amdgpu_drm.h";
 - generate the patch;

The commits from drm-next (https://cgit.freedesktop.org/drm/drm) are:

Mauro Carvalho Chehab (1)
c45dd3bda1c809eb120452597097e14a96b58c1f drm/amdgpu: fix some kernel-doc markups

Huang Rui(3)
6fbcb00c7984fa7d49af2c361453c0397cdea400 drm/amdgpu: add TOC firmware definition
1e483203965bdab466af0739c1edf7da07da241d drm/amdgpu: add uapi to define van gogh memory type
f7b2cdb23abf62bc3d33c2e0b0009a09412ff475 drm/amdgpu: add uapi to define van gogh series

Pierre-Eric Pelloux-Prayer(1)
16c642ec3fe9a144fbe1e97dc56f13a6308f1381 drm/amdgpu: new ids flag for tmz (v2)

Yong Zhao(1)
130c88931f6cbdb4513d307b4a13fcfff08a8041 drm/amdgpu: Improve the MTYPE comments

Signed-off-by: Leo Liu <leo.liu@amd.com>
3 years agointel: add INTEL_ADLS_IDS to the pciids list
Tejas Upadhyay [Thu, 18 Feb 2021 10:39:49 +0000 (10:39 +0000)]
intel: add INTEL_ADLS_IDS to the pciids list

This enables drm_intel_bufmgr on ADLS

Signed-off-by: Tejas Upadhyay <tejaskumarx.surendrakumar.upadhyay@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
3 years agointel: sync i915_pciids.h with kernel
Tejas Upadhyay [Thu, 18 Feb 2021 10:12:28 +0000 (10:12 +0000)]
intel: sync i915_pciids.h with kernel

Align with kernel commits:

0883d63b19bb ("drm/i915/adl_s: Add ADL-S platform info and PCI ids")
04057a1afc75 ("drm/i915: Sort EHL/JSL PCI IDs")
0e8e272f1368 ("drm/i915/ehl: Remove invalid PCI ID")
605f9c290c1a ("drm/i915: Sort ICL PCI IDs")
514dc424ce4f ("drm/i915: Sort CNL PCI IDs")
32d4ec9a1681 ("drm/i915: Sort CFL PCI IDs")
df3478af1d73 ("drm/i915: Sort CML PCI IDs")
cd988984cbea ("drm/i915: Sort KBL PCI IDs")
b04d36f73771 ("drm/i915: Sort SKL PCI IDs")
9c0b2d30441b ("drm/i915: Sort HSW PCI IDs")
79033a0a7898 ("drm/i915: Ocd the HSW PCI ID hex numbers")
cfb3db8fdae2 ("drm/i915: Try to fix the SKL GT3/4 vs. GT3e/4e comments")
03e399020cd2 ("drm/i915: Add SKL GT1.5 PCI IDs")
812f044df08c ("drm/i915: Reclassify SKL 0x1923 and 0x1927 as ULT")
194909a32aed ("drm/i915: Reclassify SKL 0x192a as GT3")
82e84284ab7d ("drm/i915: Update Haswell PCI IDs")
24ea098b7c0d ("drm/i915/jsl: Split EHL/JSL platform info and PCI ids")
b50b7991b739 ("drm/i915/dg1: add more PCI ids")
d452bd091e16 ("drm/i915: break TGL pci-ids in GT 1 & 2")
f2bde2546b81 ("drm/i915: Remove dubious Valleyview PCI IDs")
0883d63b19bb ("drm/i915/adl_s: Add ADL-S platform info and PCI ids")
04057a1afc75 ("drm/i915: Sort EHL/JSL PCI IDs")
0e8e272f1368 ("drm/i915/ehl: Remove invalid PCI ID")
605f9c290c1a ("drm/i915: Sort ICL PCI IDs")
514dc424ce4f ("drm/i915: Sort CNL PCI IDs")
32d4ec9a1681 ("drm/i915: Sort CFL PCI IDs")
df3478af1d73 ("drm/i915: Sort CML PCI IDs")
cd988984cbea ("drm/i915: Sort KBL PCI IDs")
b04d36f73771 ("drm/i915: Sort SKL PCI IDs")
9c0b2d30441b ("drm/i915: Sort HSW PCI IDs")
79033a0a7898 ("drm/i915: Ocd the HSW PCI ID hex numbers")
cfb3db8fdae2 ("drm/i915: Try to fix the SKL GT3/4 vs. GT3e/4e comments")
03e399020cd2 ("drm/i915: Add SKL GT1.5 PCI IDs")
812f044df08c ("drm/i915: Reclassify SKL 0x1923 and 0x1927 as ULT")
194909a32aed ("drm/i915: Reclassify SKL 0x192a as GT3")
82e84284ab7d ("drm/i915: Update Haswell PCI IDs")
24ea098b7c0d ("drm/i915/jsl: Split EHL/JSL platform info and PCI ids")
b50b7991b739 ("drm/i915/dg1: add more PCI ids")
d452bd091e16 ("drm/i915: break TGL pci-ids in GT 1 & 2")

Signed-off-by: Tejas Upadhyay <tejaskumarx.surendrakumar.upadhyay@intel.com>
Reviewed-by: Landwerlin, Lionel G <lionel.g.landwerlin@intel.com>
3 years agoamdgpu: update marketing names
Alex Deucher [Mon, 15 Feb 2021 15:02:15 +0000 (10:02 -0500)]
amdgpu: update marketing names

From 20.45 release.

Acked-by: Simon Ser <contact@emersion.fr>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
3 years agoAvoid some compiler errors for tests/util/pattern.c
Victor Hugo Vianna Silva [Wed, 10 Feb 2021 18:16:10 +0000 (18:16 +0000)]
Avoid some compiler errors for tests/util/pattern.c

- Remove one unused variable.
- Convert two int-s into 'unsigned int'.
Motivated by a failed build of Chromium.

Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Signed-off-by: Victor Hugo Vianna Silva <victor.vianna10@gmail.com>
3 years agoxf86drm: cap number of reported devices by drmGetDevice(2)
Emil Velikov [Fri, 5 Feb 2021 00:41:13 +0000 (00:41 +0000)]
xf86drm: cap number of reported devices by drmGetDevice(2)

Do as the documentation says - cap the number of reported devices to the
requested amount - aka max_devices. Otherwise we risk out-of-bound access
for users of the API.

Issue: https://gitlab.freedesktop.org/mesa/drm/-/issues/56
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Simon Ser <contact@emersion.fr>
3 years agotests/amdgpu/vcn: clean abundant codes
Sonny Jiang [Fri, 22 Jan 2021 01:44:03 +0000 (20:44 -0500)]
tests/amdgpu/vcn: clean abundant codes

Remove useless codes.

Signed-off-by: Sonny Jiang <sonny.jiang@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>