platform/upstream/libdrm.git
2 years agobuild: make tests optional
Simon Zeni [Thu, 28 Jul 2022 10:18:33 +0000 (06:18 -0400)]
build: make tests optional

Building the project as a meson subproject, meson inherits the warning level
from the parent project. Making the tests optional bypasses that issue and
reduces build time.

Signed-off-by: Simon Zeni <simon@bl4ckb0ne.ca>
Reviewed-by: Simon Ser <contact@emersion.fr>
2 years agotests/amdgpu: add sdma slow copy linear hang test
Likun Gao [Wed, 13 Jul 2022 05:43:51 +0000 (13:43 +0800)]
tests/amdgpu: add sdma slow copy linear hang test

Issue slow copy linear for sdma to trigger SDMA hang test.

Signed-off-by: Likun Gao <Likun.Gao@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
2 years agotests/amdgpu: add sdma corrupted header hang test
Likun Gao [Wed, 13 Jul 2022 02:28:20 +0000 (10:28 +0800)]
tests/amdgpu: add sdma corrupted header hang test

Issue corrupted header for sdma to trigger SDMA hang test.

Signed-off-by: Likun Gao <Likun.Gao@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
2 years agotests/amdgpu: add dispatch/draw test for gfx11
Flora Cui [Thu, 7 Jul 2022 13:01:56 +0000 (21:01 +0800)]
tests/amdgpu: add dispatch/draw test for gfx11

Signed-off-by: Flora Cui <flora.cui@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
2 years agotests/amdgpu: refactor dispatch/draw test
Flora Cui [Thu, 7 Jul 2022 12:48:19 +0000 (20:48 +0800)]
tests/amdgpu: refactor dispatch/draw test

Signed-off-by: Flora Cui <flora.cui@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
2 years agotests/amdgpu: skip gfx CE subtest in gfx11
Hawking Zhang [Sat, 12 Feb 2022 06:56:01 +0000 (14:56 +0800)]
tests/amdgpu: skip gfx CE subtest in gfx11

CE is not available in gfx11

Signed-off-by: Hawking Zhang <Hawking.Zhang@amd.com>
Reviewed-by: Likun Gao <Likun.Gao@amd.com>
2 years agolib: sync i915_pciids.h with kernel
Matt Roper [Wed, 27 Jul 2022 04:42:50 +0000 (21:42 -0700)]
lib: sync i915_pciids.h with kernel

This synchronizes with kernel commit 7835303982d1 ("drm/i915/mtl: Add
MeteorLake PCI IDs") to bring in the missing PCI IDs for several recent
platforms.

These days adding PCI IDs to libdrm doesn't really matter for real-world
system usage.  However there are still a few driver testing situations
where they're needed (such as the IGT dma-buf tests that still rely on
libdrm's bufmgr code).  At some point we should probably break that
final IGT dependency on libdrm so that these PCI ID resyncs won't be
necessary anymore, but that hasn't happened yet.

References: https://gitlab.freedesktop.org/drm/intel/-/issues/5416
Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
2 years agobuild: set c_std to c11
Stephan Lachnit [Mon, 25 Jul 2022 15:37:32 +0000 (17:37 +0200)]
build: set c_std to c11

Signed-off-by: Stephan Lachnit <stephanlachnit@debian.org>
2 years agotests/util: Add simpledrm driver
Eric Curtin [Mon, 13 Jun 2022 15:07:35 +0000 (16:07 +0100)]
tests/util: Add simpledrm driver

Add an entry for the "simpledrm" driver, so that the test utilities
work with the simpledrm driver without passing the -M argument.

Reviewed-by: Lucas Stach <l.stach@pengutronix.de>
Signed-off-by: Eric Curtin <ecurtin@redhat.com>
2 years agotests/amdgpu/vcn: add unified queue support in vcn4
Ruijing Dong [Mon, 18 Jul 2022 15:41:23 +0000 (11:41 -0400)]
tests/amdgpu/vcn: add unified queue support in vcn4

add unified queue headers on the existing tests.

Reviewed-by: Boyuan Zhang <Boyuan.Zhang@amd.com>
Signed-off-by: Ruijing Dong <ruijing.dong@amd.com>
2 years agotests/amdgpu/vcn: align comments for AMDGPU_HW_IP_VCN_ENC
Ruijing Dong [Mon, 18 Jul 2022 15:36:14 +0000 (11:36 -0400)]
tests/amdgpu/vcn: align comments for AMDGPU_HW_IP_VCN_ENC

From VCN4, AMDGPU_HW_IP_VCN_ENC is re-used to support both encoding
and decoding jobs.

Reviewed-by: Boyuan Zhang <Boyuan.Zhang@amd.com>
Signed-off-by: Ruijing Dong <ruijing.dong@amd.com>
2 years agotests/amdgpu: enable vcn swRing test for version 4 and later
James Zhu [Fri, 11 Mar 2022 17:46:47 +0000 (12:46 -0500)]
tests/amdgpu: enable vcn swRing test for version 4 and later

Enable vcn decode software ring test for version 4 and later.

Signed-off-by: James Zhu <James.Zhu@amd.com>
Reviewed-by: Leo Liu <leo.liu@amd.com>
Reviewed-by: Boyuan Zhang <Boyuan.Zhang@amd.com>
2 years agoamdgpu: update marketing names for 22.20
Alex Deucher [Mon, 18 Jul 2022 21:06:32 +0000 (17:06 -0400)]
amdgpu: update marketing names for 22.20

Add new marketing names.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 years agobuild: bump version to 2.4.112 libdrm-2.4.112
Simon Ser [Wed, 6 Jul 2022 08:43:38 +0000 (10:43 +0200)]
build: bump version to 2.4.112

Signed-off-by: Simon Ser <contact@emersion.fr>
2 years agoxf86drmMode: introduce drmModeConnectorGetPossibleCrtcs
Simon Ser [Fri, 21 Jan 2022 22:14:50 +0000 (23:14 +0100)]
xf86drmMode: introduce drmModeConnectorGetPossibleCrtcs

Nowadays, users don't really care about encoders except for retrieving
the list of CRTCs compatible with a connector. Introduce a new function
so that users no longer need to deal with encoders.

This is a re-do of [1], but with a slightly different API.

Signed-off-by: Simon Ser <contact@emersion.fr>
[1]: https://gitlab.freedesktop.org/mesa/drm/-/merge_requests/102

2 years agotests: use drmModeGetConnectorTypeName
Simon Ser [Tue, 1 Feb 2022 13:36:52 +0000 (14:36 +0100)]
tests: use drmModeGetConnectorTypeName

Drop util_lookup_connector_type_name and use
drmModeGetConnectorTypeName instead.

Signed-off-by: Simon Ser <contact@emersion.fr>
2 years agoxf86drmMode: introduce drmModeGetConnectorTypeName
Simon Ser [Tue, 1 Feb 2022 13:33:34 +0000 (14:33 +0100)]
xf86drmMode: introduce drmModeGetConnectorTypeName

User-space often needs to print the name of a connector type.
When a new connector type is added, all user-space programs need
to be updated to support the new connector type.

Expose a function to get a connector type name in libdrm.

The names are taken from the kernel [1].

[1]: https://cgit.freedesktop.org/drm/drm/tree/drivers/gpu/drm/drm_connector.c?h=4fc8cb47fcfdc93e274a1291757e478df4f9c39b#n83

Signed-off-by: Simon Ser <contact@emersion.fr>
2 years agotests/amdgpu/vcn:vcn encoder unit test
Saleemkhan Jamadar [Tue, 19 Oct 2021 09:00:11 +0000 (14:30 +0530)]
tests/amdgpu/vcn:vcn encoder unit test

 Add support for vcn encoder unit test

Reviewed-by: Ruijing Dong <ruijing.dong@amd.com>
Signed-off-by: Saleemkhan Jamadar <saleemkhan.jamadar@amd.com>
Signed-off-by: Satyajit Sahu <satyajit.sahu@amd.com>
2 years agotests/amdgpu: fix decode test failure on VCN2.5
Sathishkumar S [Wed, 25 May 2022 09:15:08 +0000 (14:45 +0530)]
tests/amdgpu: fix decode test failure on VCN2.5

For VCN2.5 wrong index was chosen, fix it.

Signed-off-by: Sathishkumar S <sathishkumar.sundararaju@amd.com>
Reviewed-by: Leo Liu <leo.liu@amd.com>
2 years agoxf86drmMode: constify drmModeAtomicReq functions
Simon Ser [Mon, 7 Feb 2022 10:59:54 +0000 (11:59 +0100)]
xf86drmMode: constify drmModeAtomicReq functions

This acts as an additional ABI guarantee, and improves
documentation for users.

Signed-off-by: Simon Ser <contact@emersion.fr>
Reviewed-by: Thierry Reding <treding@nvidia.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2 years agogen_table_fourcc: strip _MODIFIER suffix for INVALID
Simon Ser [Mon, 2 May 2022 17:24:43 +0000 (19:24 +0200)]
gen_table_fourcc: strip _MODIFIER suffix for INVALID

This is the only modifier printed with a "_MODIFIER" suffix. It
looks inconsistent when callers already print this word (e.g.
"modifier: INVALID_MODIFIER").

Signed-off-by: Simon Ser <contact@emersion.fr>
Reviewed-by: Marius Vlad <marius.vlad@collabora.com>
2 years agobuild: bump version to 2.4.111 libdrm-2.4.111
Dave Airlie [Fri, 3 Jun 2022 04:02:49 +0000 (14:02 +1000)]
build: bump version to 2.4.111

Signed-off-by: Dave Airlie <airlied@redhat.com>
2 years agotests/amdgpu: use appropriate ring for different asics
Guchun Chen [Thu, 26 May 2022 01:42:58 +0000 (09:42 +0800)]
tests/amdgpu: use appropriate ring for different asics

Use compute ring in case of no gfx ring.

Signed-off-by: Guchun Chen <guchun.chen@amd.com>
2 years agoamdgpu: add marketing names from 22.10
Alex Deucher [Thu, 12 May 2022 20:23:45 +0000 (16:23 -0400)]
amdgpu: add marketing names from 22.10

Add new marketing names

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 years agotests/modeprint: fix argument type
Eleni Maria Stea [Mon, 9 May 2022 12:00:54 +0000 (15:00 +0300)]
tests/modeprint: fix argument type

Replaced the type PRId64 with PRIu64 in a printf as the argument was
unsigned to fix the related compiler warning.

Signed-off-by: Eleni Maria Stea <elene.mst@gmail.com>
Reviewed-by: Simon Ser <contact@emersion.fr>
2 years agomodeprint, modetest, proptest: cast __u64 to uint64_t
Eleni Maria Stea [Mon, 9 May 2022 11:59:37 +0000 (14:59 +0300)]
modeprint, modetest, proptest: cast __u64 to uint64_t

It seems that __u64 values are defined differently across systems. In
glibc it's defined as unsigned long, in Linux kernel headers
(int-ll64.h) as unsigned long long, and on FreeBSD as uint64_t so it
matches glibc. A temporal solution is to cast all __u64 values to
uint64_t to avoid warnings on Linux, but ideally we'd like a better fix
in the future.

See also: https://gitlab.freedesktop.org/mesa/drm/-/merge_requests/212
for discussion.

Signed-off-by: Eleni Maria Stea <elene.mst@gmail.com>
2 years agoxf86drm.c: fix C99 warning
Eleni Maria Stea [Mon, 9 May 2022 11:56:11 +0000 (14:56 +0300)]
xf86drm.c: fix C99 warning

Moved declaration to the top to resolve C99 compliance warning.

Signed-off-by: Eleni Maria Stea <elene.mst@gmail.com>
Reviewed-by: Simon Ser <contact@emersion.fr>
2 years agonouveau: add ioctl wrapper to check for dead channels
Karol Herbst [Tue, 3 Aug 2021 17:29:04 +0000 (19:29 +0200)]
nouveau: add ioctl wrapper to check for dead channels

v2: explicitly set nr_push to 0 as well

Signed-off-by: Karol Herbst <kherbst@redhat.com>
2 years agointel: Add support for RPLP
Tejas Upadhyay [Thu, 21 Apr 2022 17:04:52 +0000 (22:34 +0530)]
intel: Add support for RPLP

Add RPLP platform support and PCIIDs

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Signed-off-by: Tejas Upadhyay <tejaskumarx.surendrakumar.upadhyay@intel.com>
Signed-off-by: Raviteja Goud Talla <ravitejax.goud.talla@intel.com>
2 years agoman: Add formatting to drmModeGetConnector reference
Matt Turner [Tue, 19 Apr 2022 20:10:57 +0000 (13:10 -0700)]
man: Add formatting to drmModeGetConnector reference

Signed-off-by: Matt Turner <mattst88@gmail.com>
2 years agoman: Fix some typos
Matt Turner [Tue, 19 Apr 2022 18:53:55 +0000 (11:53 -0700)]
man: Fix some typos

Signed-off-by: Matt Turner <mattst88@gmail.com>
2 years agolibkms: Remove libkms completely
Daniel Stone [Tue, 29 Mar 2022 12:59:57 +0000 (13:59 +0100)]
libkms: Remove libkms completely

libkms was a very early attempt at a KMS management library, that only
got as far as handling requests to create buffers. It has since been
superseded by GBM in doing this, which everyone uses, unlike libkms
which no-one uses.

Remove it from the tree to avoid any confusion.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2 years agotests/amdgpu: add dispatch test for gfx10
Flora Cui [Wed, 13 Nov 2019 08:16:55 +0000 (16:16 +0800)]
tests/amdgpu: add dispatch test for gfx10

Signed-off-by: Flora Cui <flora.cui@amd.com>
2 years agotests/amdgpu: add draw test for gfx10
Flora Cui [Wed, 13 Nov 2019 05:54:54 +0000 (13:54 +0800)]
tests/amdgpu: add draw test for gfx10

Signed-off-by: Flora Cui <flora.cui@amd.com>
2 years agotests/amdgpu: Add test suite CP DMA
Lu Jiacheng [Wed, 9 Mar 2022 15:05:04 +0000 (15:05 +0000)]
tests/amdgpu: Add test suite CP DMA

2 years agoamdgpu: add marketing names from 21.50
Alex Deucher [Wed, 2 Mar 2022 16:51:08 +0000 (11:51 -0500)]
amdgpu: add marketing names from 21.50

Add new marketing names

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 years agotest/amdgpu: only disable deadlock tests on asics without GPU reset
Alex Deucher [Mon, 14 Feb 2022 21:31:45 +0000 (16:31 -0500)]
test/amdgpu: only disable deadlock tests on asics without GPU reset

Switch the logic to only disable the tests for asics which don't
have GPU reset support.  This way we don't need to update it
every time we add a new asic which does support it.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 years agotests/amdgpu/hotunplu: Enable hotunplug tests.
Andrey Grodzovsky [Tue, 1 Mar 2022 17:56:05 +0000 (12:56 -0500)]
tests/amdgpu/hotunplu: Enable hotunplug tests.

I tested with latest amd-staging-drm-next and after minor
fix for me all the testys pass. I bumped libdrm minor version
for this.

Signed-off-by: Andrey Grodzovsky <andrey.grodzovsky@amd.com>
2 years agotests: tegra: Add VIC flip test
Thierry Reding [Fri, 9 Jul 2021 19:10:22 +0000 (21:10 +0200)]
tests: tegra: Add VIC flip test

This test will attempt to use the VIC to blit one surface to another
and perform a vertical flip.

Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
2 years agotests: tegra: Add VIC blit test
Thierry Reding [Fri, 9 Jul 2021 19:10:02 +0000 (21:10 +0200)]
tests: tegra: Add VIC blit test

This test will attempt to use the VIC to blit from one surface to
another.

Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
2 years agotests: tegra: Add VIC clear test
Thierry Reding [Fri, 9 Jul 2021 19:09:39 +0000 (21:09 +0200)]
tests: tegra: Add VIC clear test

This test will attempt to use VIC to clear a surface.

Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
2 years agotests: tegra: Add VIC 4.2 support
Thierry Reding [Fri, 9 Jul 2021 19:09:04 +0000 (21:09 +0200)]
tests: tegra: Add VIC 4.2 support

The Video Image Composer (VIC) 4.2 can be found on NVIDIA Tegra194 SoCs.
It uses a different class (C5B6) that is slightly incompatible with the
class found on earlier generations, although it is backwards compatible
with the class implemented on Tegra186 (B1B6).

Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
2 years agotests: tegra: Add VIC 4.1 support
Thierry Reding [Fri, 9 Jul 2021 19:08:35 +0000 (21:08 +0200)]
tests: tegra: Add VIC 4.1 support

The Video Image Composer (VIC) 4.1 can be found on NVIDIA Tegra186 SoCs.
It uses a different class (B1B6) that is slightly incompatible with the
class found on earlier generations.

Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
2 years agotests: tegra: Add VIC 4.0 support
Thierry Reding [Fri, 9 Jul 2021 19:07:57 +0000 (21:07 +0200)]
tests: tegra: Add VIC 4.0 support

The Video Image Composer (VIC) 4.0 can be found on NVIDIA Tegra210 SoCs.
It uses a different class (B0B6) that is slightly incompatible with the
class found on earlier generations.

Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
2 years agotests: tegra: Add VIC 3.0 support
Thierry Reding [Fri, 9 Jul 2021 19:06:59 +0000 (21:06 +0200)]
tests: tegra: Add VIC 3.0 support

The Video Image Composer (VIC) 3.0 can be found on NVIDIA Tegra124 SoCs.

Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
2 years agotests: tegra: Add VIC support
Thierry Reding [Fri, 9 Jul 2021 19:02:32 +0000 (21:02 +0200)]
tests: tegra: Add VIC support

Implement a small abstraction interface to allow different versions of
VIC to be used transparently. An implementation will be chosen based on
the VIC version number reported by the DRM_TEGRA_IOCTL_OPEN_CHANNEL
IOCTL.

Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
2 years agotests: tegra: Add syncpoint timeout test
Thierry Reding [Fri, 9 Jul 2021 18:59:32 +0000 (20:59 +0200)]
tests: tegra: Add syncpoint timeout test

This test can be used to purposefully trigger a job timeout.

Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
2 years agotests: tegra: Add syncpt-wait test
Thierry Reding [Fri, 9 Jul 2021 18:58:41 +0000 (20:58 +0200)]
tests: tegra: Add syncpt-wait test

This is a very simple sanity test to check whether or not a syncpt can
be incremented by a host1x client. This uses gr2d on Tegra20 through
Tegra114 and VIC on Tegra124 and later.

Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
2 years agotests: tegra: Add gr2d-fill test
Thierry Reding [Fri, 9 Jul 2021 18:56:56 +0000 (20:56 +0200)]
tests: tegra: Add gr2d-fill test

This test uses the IOCTLs for job submission and fences to fill a sub-
region of the screen to a specific color using gr2d.

Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
2 years agotests: tegra: Add helper library for tests
Thierry Reding [Fri, 9 Jul 2021 18:54:57 +0000 (20:54 +0200)]
tests: tegra: Add helper library for tests

This library provides helpers for common functionality needed by test
programs.

Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
2 years agotegra: Add syncpoint APIs
Thierry Reding [Fri, 9 Jul 2021 18:45:20 +0000 (20:45 +0200)]
tegra: Add syncpoint APIs

These new functions can be used to allocate and free syncpoints, as well
as wait for a syncpoint threshold to be reached. Jobs can also be waited
on if a syncpoint was attached to them.

Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
2 years agotegra: Add job and push buffer APIs
Thierry Reding [Fri, 9 Jul 2021 18:35:32 +0000 (20:35 +0200)]
tegra: Add job and push buffer APIs

These new functions can be used to create a job on a given channel, add
commands to the job using its push buffer and submit the job.

Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
2 years agotegra: Add channel APIs
Thierry Reding [Fri, 9 Jul 2021 18:30:07 +0000 (20:30 +0200)]
tegra: Add channel APIs

These new functions can be used to open a channel to a given engine, map
and unmap buffer objects to that channel, and close the channel.

Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
2 years agotegra: Include private.h in list of source files
Thierry Reding [Fri, 9 Jul 2021 18:21:35 +0000 (20:21 +0200)]
tegra: Include private.h in list of source files

This makes sure that the proper dependencies are created and that the
file is distributed.

Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
2 years agotegra: Update for new UABI
Thierry Reding [Fri, 9 Jul 2021 18:19:38 +0000 (20:19 +0200)]
tegra: Update for new UABI

This new UABI is a more modern version that works better with both old
and recent chips.

Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
2 years agotegra: Install tegra-openclose test
Thierry Reding [Tue, 20 Mar 2018 12:34:48 +0000 (13:34 +0100)]
tegra: Install tegra-openclose test

Allow this simple test to be installed so that it can easily be run on a
target device.

Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
2 years agotegra: Make API more consistent
Thierry Reding [Fri, 9 Jul 2021 18:13:12 +0000 (20:13 +0200)]
tegra: Make API more consistent

Most functions in libdrm_tegra take as first parameter the object that
they operate on. Make the device and buffer object creation functions
follow the same scheme.

Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
2 years agotegra: Add PRIME support helpers
Thierry Reding [Mon, 23 Apr 2018 09:01:36 +0000 (11:01 +0200)]
tegra: Add PRIME support helpers

These helpers facilitate exporting and importing buffer objects to and
from PRIME file descriptors.

Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
2 years agotegra: Add flink helpers
Thierry Reding [Mon, 23 Apr 2018 09:00:56 +0000 (11:00 +0200)]
tegra: Add flink helpers

Add helpers to export and import buffer objects via flink names.

Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
2 years agotegra: Fix mmap() of GEM buffer objects
Thierry Reding [Fri, 9 Jul 2021 18:05:54 +0000 (20:05 +0200)]
tegra: Fix mmap() of GEM buffer objects

Store 64-bit offset values and use libdrm's built-in drm_mmap() function
instead of mmap() to ensure the full 64-bit offset is used.

Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
2 years agotegra: Extract common buffer object allocation code
Thierry Reding [Mon, 23 Apr 2018 08:58:09 +0000 (10:58 +0200)]
tegra: Extract common buffer object allocation code

All of the buffer object allocation functions use the same boilerplate
code. Move that code into a separate function that can be reused.

Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
2 years agotegra: Remove unused IOCTL implementations
Thierry Reding [Fri, 9 Jul 2021 17:53:52 +0000 (19:53 +0200)]
tegra: Remove unused IOCTL implementations

The DRM_TEGRA_GEM_{GET,SET}_FLAGS and DRM_TEGRA_GEM_{GET,SET}_TILING
IOCTLs were badly designed and have since been obsoleted by framebuffer
modifiers. Remove these implementations to make it clear their usage is
discouraged.

Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
2 years agotegra: Indent according to .editorconfig
Thierry Reding [Tue, 20 Mar 2018 11:55:04 +0000 (12:55 +0100)]
tegra: Indent according to .editorconfig

Reindent the sources according to the settings found in the newly added
.editorconfig.

Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
2 years agotests/amdgpu: enable vcn test based on ip query
Sathishkumar S [Thu, 10 Feb 2022 13:49:50 +0000 (19:19 +0530)]
tests/amdgpu: enable vcn test based on ip query

family_id checks can be removed and instead use ip major/minor version

Signed-off-by: Sathishkumar S <sathishkumar.sundararaju@amd.com>
Reviewed-by: Veerabadhran Gopalakrishnan <veerabadhran.gopalakrishnan@amd.com>
Reviewed-by: Leo Liu <leo.liu@amd.com>
2 years agotests/amdgpu: enable jpeg test based on ip query
Sathishkumar S [Thu, 10 Feb 2022 12:20:57 +0000 (17:50 +0530)]
tests/amdgpu: enable jpeg test based on ip query

enable jpeg test if ip query is successful and avoid family_id
based checks, instead use ip major/minor version

Signed-off-by: Sathishkumar S <sathishkumar.sundararaju@amd.com>
Reviewed-by: Veerabadhran Gopalakrishnan <veerabadhran.gopalakrishnan@amd.com>
Reviewed-by: Leo Liu <leo.liu@amd.com>
2 years agobuild: bump version to 2.4.110 libdrm-2.4.110
Samuel Pitoiset [Wed, 16 Feb 2022 10:00:13 +0000 (11:00 +0100)]
build: bump version to 2.4.110

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
2 years agodrm/atomic: Stable sort for atomic request de-duplication
Daniel Stone [Wed, 19 May 2021 10:05:22 +0000 (11:05 +0100)]
drm/atomic: Stable sort for atomic request de-duplication

Atomic request property lists are defined to be de-duplicated: an atomic
request can contain multiple sets for the same property on the same
object, and only the last one will take effect.

drmModeAtomicCommit already sorts the property set by object and
property ID. We were relying on qsort to also sort by cursor - i.e.
pointer value - when object and property ID are equal, however whilst
glibc does this, the sort order is explicitly undefined when the
comparator is equal. Using the pointer is also not stable on all
implementations.

Add an explicit 'cursor' member to each property set which is used as
the tie-breaker comparator.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Fixes: #46

2 years agomeson: use summary() instead of message
Dylan Baker [Wed, 19 Jan 2022 19:26:21 +0000 (11:26 -0800)]
meson: use summary() instead of message

It's cleaner, it's nicer looking, and it's a nice builtin.

Signed-off-by: Dylan Baker <dylan@pnwbakers.com>
Reviewed-by: Simon Ser <contact@emersion.fr>
2 years agomeson: use the modern interface for pkg.generate
Dylan Baker [Wed, 19 Jan 2022 19:14:17 +0000 (11:14 -0800)]
meson: use the modern interface for pkg.generate

This produces no differences in the generated output. I've had to
manually add `requires : 'libdrm'` to libdrm_intel, otherwise libdrm
ends up in `Requires.private` instead of `Requires`.

Signed-off-by: Dylan Baker <dylan@pnwbakers.com>
Reviewed-by: Simon Ser <contact@emersion.fr>
2 years agomeson: use cc.has_function_attribute instead of open coding
Dylan Baker [Wed, 19 Jan 2022 19:12:43 +0000 (11:12 -0800)]
meson: use cc.has_function_attribute instead of open coding

It's less code, and also allows meson to short circuit for compilers is
knows don't support this.

Signed-off-by: Dylan Baker <dylan@pnwbakers.com>
Reviewed-by: Simon Ser <contact@emersion.fr>
2 years agomeson: use cc.check_header instead of open coding
Dylan Baker [Wed, 19 Jan 2022 19:10:58 +0000 (11:10 -0800)]
meson: use cc.check_header instead of open coding

Signed-off-by: Dylan Baker <dylan@pnwbakers.com>
Reviewed-by: Simon Ser <contact@emersion.fr>
2 years agomeson: use more standard formatting for better readability
Dylan Baker [Wed, 19 Jan 2022 19:09:07 +0000 (11:09 -0800)]
meson: use more standard formatting for better readability

Signed-off-by: Dylan Baker <dylan@pnwbakers.com>
Reviewed-by: Simon Ser <contact@emersion.fr>
2 years agomeson: switch to cc.get_supported_arguments
Dylan Baker [Wed, 19 Jan 2022 18:43:04 +0000 (10:43 -0800)]
meson: switch to cc.get_supported_arguments

This is generally faster, as meson is able to parallelize the checks for
us.

This also removes the workaround for checking gcc/clang -Wno-*
arguments, which meson now handles internally so we don't need to handle
it ourselves.

Signed-off-by: Dylan Baker <dylan@pnwbakers.com>
Reviewed-by: Simon Ser <contact@emersion.fr>
2 years agomeson: switch the meson builtin for symbol visiblity
Dylan Baker [Wed, 19 Jan 2022 18:42:20 +0000 (10:42 -0800)]
meson: switch the meson builtin for symbol visiblity

This allows meson to check if the compiler supports gnu style symbol
visibility, and apply the appropriate flags as necessary, rather than us
adding them by hand

Signed-off-by: Dylan Baker <dylan@pnwbakers.com>
Reviewed-by: Simon Ser <contact@emersion.fr>
2 years agotests/amdgpu: add a test for new CTX OP to get/set stable pstates
Samuel Pitoiset [Mon, 3 Jan 2022 09:21:00 +0000 (10:21 +0100)]
tests/amdgpu: add a test for new CTX OP to get/set stable pstates

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
2 years agoamdgpu: implement new CTX OP to set/get stable pstates
Samuel Pitoiset [Fri, 31 Dec 2021 08:10:03 +0000 (09:10 +0100)]
amdgpu: implement new CTX OP to set/get stable pstates

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
2 years agoamdgpu: update_drm.h for new CTX OP to set/get stable pstates
Samuel Pitoiset [Fri, 31 Dec 2021 07:54:34 +0000 (08:54 +0100)]
amdgpu: update_drm.h for new CTX OP to set/get stable pstates

Based on agd5f/drm-next.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
2 years agouse standard `__typeof__()` instead of GNU extension `typeof()`
Eric Engestrom [Tue, 17 Dec 2019 23:01:08 +0000 (23:01 +0000)]
use standard `__typeof__()` instead of GNU extension `typeof()`

And switch to c_std=c99. This simplifies using libdrm as a meson
subproject for mesa.

v2: (dylan)
  - switch to c99 as the standard
  - Fix amdgpu security tests as well

Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
Signed-off-by: Dylan Baker <dylan@pnwbakers.com>
Reviewed-by: Simon Ser <contact@emersion.fr>
Reviewed-by: Emma Anholt <emma@anholt.net>
2 years agotests/amdgpu: Add VCN test support for Biege Goby
Guchun Chen [Thu, 13 Jan 2022 06:47:52 +0000 (14:47 +0800)]
tests/amdgpu: Add VCN test support for Biege Goby

Added Beige Goby chip id in vcn test.

Signed-off-by: Guchun Chen <guchun.chen@amd.com>
Reviewed-By: Veerabadhran Gopalakrishnan <Veerabadhran.gopalakrishnan@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Leo Liu <leo.liu@amd.com>
2 years agointel: Add support for ADL-N
Tejas Upadhyay [Tue, 21 Dec 2021 09:54:59 +0000 (15:24 +0530)]
intel: Add support for ADL-N

Add ADL-N platform support and PCIIDs

Align with kernel commit:
7e28d0b26759 ("drm/i915/adl-n: Enable ADL-N platform")

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Signed-off-by: Tejas Upadhyay <tejaskumarx.surendrakumar.upadhyay@intel.com>
2 years agoreleasing: s/master/main/
Simon Ser [Mon, 8 Nov 2021 16:39:23 +0000 (17:39 +0100)]
releasing: s/master/main/

This default branch name has been changed. Update RELEASING
accordingly.

Signed-off-by: Simon Ser <contact@emersion.fr>
2 years agointel: Add support for RPLS platform
ravitejax [Tue, 21 Dec 2021 05:07:25 +0000 (10:37 +0530)]
intel: Add support for RPLS platform

Fixes: 3d8e59ce019907 ("intel: sync i915_pciids.h with kernel")
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Signed-off-by: Tejas Upadhyay <tejaskumarx.surendrakumar.upadhyay@intel.com>
2 years agointel: sync i915_pciids.h with kernel
Raviteja Goud Talla [Thu, 16 Dec 2021 10:56:24 +0000 (16:26 +0530)]
intel: sync i915_pciids.h with kernel

Align with kernel commit:

52407c220c44c ("drm/i915/rpl-s: Add PCI IDS for Raptor Lake S")

Cc: Anusha Srivatsa <anusha.srivatsa@intel.com>
Signed-off-by: Raviteja Goud Talla <ravitejax.goud.talla@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
2 years agomeson: add override_dependency when possible
Dylan Baker [Wed, 17 Nov 2021 20:57:54 +0000 (12:57 -0800)]
meson: add override_dependency when possible

This allows consumers of libdrm as a subproject to use the simpler
`dependency('libdrm', fallback : 'libdrm')` syntax, as the libdrm build
files already tell meson that they override a dependency called
"libdrm".

Signed-off-by: Dylan Baker <dylan@pnwbakers.com>
Reviewed-by: Simon Ser <contact@emersion.fr>
2 years agomeson: use dictionary kwargs
Dylan Baker [Wed, 17 Nov 2021 20:50:01 +0000 (12:50 -0800)]
meson: use dictionary kwargs

So we don't have to duplicate the libdrm library call just to not set
the version keyword for android

Reviewed-by: Simon Ser <contact@emersion.fr>
Signed-off-by: Dylan Baker <dylan@pnwbakers.com>
2 years agotests/amdgpu: add jpeg tests support
Sathishkumar S [Wed, 8 Dec 2021 23:35:03 +0000 (05:05 +0530)]
tests/amdgpu: add jpeg tests support

v2:
- remove dec create/destroy msg as its not relevant to jpeg (Leo)
- enable the test for jpeg2/jpeg3 (Leo)
- validate checksum of result (Leo)
- add appropriate comments (Leo)

v3:
- linux style function definition indent (James)
- use multiline comment delimiter (Leo)

Signed-off-by: Sathishkumar S <sathishkumar.sundararaju@amd.com>
Reviewed-by: Leo Liu <leo.liu@amd.com>
2 years agobuild: bump version to 2.4.109 libdrm-2.4.109
Simon Ser [Thu, 25 Nov 2021 20:33:02 +0000 (21:33 +0100)]
build: bump version to 2.4.109

2 years agoxf86drm: fix compiler warnings
Eleni Maria Stea [Mon, 22 Nov 2021 10:14:36 +0000 (12:14 +0200)]
xf86drm: fix compiler warnings

Used casting to fix warnings about assigning different enum types to
variables. Used error checks in places where snprintf is called and
output might be truncated to fix gcc format-truncation warnings.

v2: Removed a change in drm.h (Simon Ser)
v3, v4: Removed unecessary braces in snprintf (Simon Ser)

Signed-off-by: Eleni Maria Stea <elene.mst@gmail.com>
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>
3 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>
3 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>