platform/upstream/libdrm.git
3 years agotests/amdgpu: add atomic dma command to verify the secure buffer (v2)
Aaron Liu [Fri, 15 Nov 2019 01:42:03 +0000 (09:42 +0800)]
tests/amdgpu: add atomic dma command to verify the secure buffer (v2)

DMA's atomic behavir is unlike GFX,If the comparing data is not
equal to destination data,
For GFX, loop again till gfx timeout(system hang).
For DMA, loop again till timer expired and then send interrupt.
So testcase can't use interrupt mechanism.
We take another way to verify. When the comparing data is not
equal to destination data, overwrite the source data to the destination
buffer. Otherwise, original destination data unchanged.
So if the bo_cpu data is overwritten, the result is passed.

Steps:
1. use linear write packet to write 0xdeadbeaf to secure buffer,
2. use atmoic packet and ATOMIC_CMPSWAP_RTN_32 opcode to compare
the cmp_data(0xdeadbeaf) to the written data which has been encrypted.

v2: add the case of (dest_data != cmp_data).

Acked-by: Huang Rui <ray.huang@amd.com>
Acked-by: Leo Liu <leo.liu@amd.com>
Signed-off-by: Aaron Liu <aaron.liu@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
3 years agotests/amdgpu: add test to submit a gfx command with secure context
Aaron Liu [Thu, 14 Nov 2019 08:36:53 +0000 (16:36 +0800)]
tests/amdgpu: add test to submit a gfx command with secure context

This patch is to test the command submission with secure context.

Acked-by: Huang Rui <ray.huang@amd.com>
Acked-by: Leo Liu <leo.liu@amd.com>
Signed-off-by: Aaron Liu <aaron.liu@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
3 years agotests/amdgpu: add atomic_mem cp_packet to verify the secure buffer
Aaron Liu [Thu, 14 Nov 2019 08:14:06 +0000 (16:14 +0800)]
tests/amdgpu: add atomic_mem cp_packet to verify the secure buffer

Secure buffer is only able to be read with trusted ip block.
So we need use GFX ip to read it back instead of CPU.
Steps:
1. use write_data packet to write 0xdeadbeaf to secure buffer,
2. use atmoic_mem packet and ATOMIC_CMPSWAP_RTN_32 opcode to compare
the cmp_data(0xdeadbeaf) to the written data which has been encrypted.
If the result is equal, then overwrite the src_data(0x12345678) to the
secure buffer and return directly. Otherwise loop again until gfx timeout
and the secure buffer data unchanged.

Acked-by: Huang Rui <ray.huang@amd.com>
Acked-by: Leo Liu <leo.liu@amd.com>
Signed-off-by: Aaron Liu <aaron.liu@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
3 years agotests/amdgpu: expand secure param for exec_cs_helper (v2)
Aaron Liu [Thu, 14 Nov 2019 07:54:10 +0000 (15:54 +0800)]
tests/amdgpu: expand secure param for exec_cs_helper (v2)

This patch expands secure param for amdgpu_test_exec_cs_helper_raw.
The flag is transfered to kernel with cs.

v2: squash in change from context to IB flag

Acked-by: Huang Rui <ray.huang@amd.com>
Acked-by: Leo Liu <leo.liu@amd.com>
Signed-off-by: Aaron Liu <aaron.liu@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
Acked-by: Huang Rui <ray.huang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
3 years agotests/amdgpu: add device handle as input param for exec_cs_helper and write_linear_he...
Huang Rui [Fri, 16 Aug 2019 11:02:51 +0000 (19:02 +0800)]
tests/amdgpu: add device handle as input param for exec_cs_helper and write_linear_helper (v4)

This patch is to add add device handle as input param for exec_cs_helper
and write_linear_helper.

Because they are needed in security tests.

v2: fix typo that basic tests should be un-secure.
v3: refine the function implementation.
v4: remove amdgpu_cs_ctx_create3 calling.

Acked-by: Huang Rui <ray.huang@amd.com>
Acked-by: Leo Liu <leo.liu@amd.com>
Signed-off-by: Huang Rui <ray.huang@amd.com>
Signed-off-by: Aaron Liu <aaron.liu@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
3 years agotests/amdgpu: expand write linear helper for security (v3)
Huang Rui [Fri, 16 Aug 2019 09:07:07 +0000 (17:07 +0800)]
tests/amdgpu: expand write linear helper for security (v3)

This patch expand write linear helper for security to submit the command
with secure context.

v2: refine the function implementation.
v3: remove amdgpu_cs_ctx_create3.

Acked-by: Huang Rui <ray.huang@amd.com>
Acked-by: Leo Liu <leo.liu@amd.com>
Signed-off-by: Huang Rui <ray.huang@amd.com>
Signed-off-by: Aaron Liu <aaron.liu@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
3 years agotests/amdgpu: add secure buffer allocation test for invisible VRAM
Huang Rui [Fri, 16 Aug 2019 08:32:16 +0000 (16:32 +0800)]
tests/amdgpu: add secure buffer allocation test for invisible VRAM

This patch is to add secure buffer allocation test for invisible VRAM.

Acked-by: Huang Rui <ray.huang@amd.com>
Acked-by: Leo Liu <leo.liu@amd.com>
Signed-off-by: Huang Rui <ray.huang@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
3 years agotests/amdgpu: add secure buffer allocation test for system memory
Huang Rui [Fri, 16 Aug 2019 08:18:21 +0000 (16:18 +0800)]
tests/amdgpu: add secure buffer allocation test for system memory

This patch is to add secure buffer allocation test for system memory.

Acked-by: Huang Rui <ray.huang@amd.com>
Acked-by: Leo Liu <leo.liu@amd.com>
Signed-off-by: Huang Rui <ray.huang@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
3 years agotests/amdgpu: add security test suite (v2)
Huang Rui [Sun, 11 Aug 2019 13:23:24 +0000 (21:23 +0800)]
tests/amdgpu: add security test suite (v2)

This patch is to add a new test suite to store security tests.
In Raven+ asics, it will support TMZ (trust memory zone), and it is
page-based protection feature.

v2: remove tests/amdgpu/Makefile.am and update to
tests/amdgpu/meson.build

Acked-by: Huang Rui <ray.huang@amd.com>
Acked-by: Leo Liu <leo.liu@amd.com>
Signed-off-by: Huang Rui <ray.huang@amd.com>
Signed-off-by: Aaron Liu <aaron.liu@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
3 years agoamdgpu: sync up amdgpu_drm.h with latest from kernel
Alex Deucher [Thu, 21 May 2020 19:28:23 +0000 (15:28 -0400)]
amdgpu: sync up amdgpu_drm.h with latest from kernel

From drm-next:

commit c41219fda6e04255c44d37fd2c0d898c1c46abf1
Merge: e20bb857dea2 d96536f0fe69
Author: Dave Airlie <airlied@redhat.com>
Date:   Thu May 21 10:44:32 2020 +1000

    Merge tag 'drm-intel-next-fixes-2020-05-20' of git://anongit.freedesktop.org/drm/drm-intel into drm-next

    Fix for TypeC power domain toggling on resets (Cc: stable).
    Two compile time warning fixes.

Signed-off-by: Dave Airlie <airlied@redhat.com>
    From: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200520123227.GA21104@jlahtine-desk.ger.corp.intel.com
Acked-by: Huang Rui <ray.huang@amd.com>
Acked-by: Leo Liu <leo.liu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
3 years agotests/amdgpu: disable unsupported test cases for Arcturus
Le Ma [Wed, 24 Jul 2019 08:47:08 +0000 (16:47 +0800)]
tests/amdgpu: disable unsupported test cases for Arcturus

Acked-by: Huang Rui <ray.huang@amd.com>
Acked-by: Leo Liu <leo.liu@amd.com>
Signed-off-by: Le Ma <le.ma@amd.com>
Reviewed-by: Evan Quan <evan.quan@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
3 years agotests/amdgpu: move arcturus asic check function to common place
Le Ma [Wed, 24 Jul 2019 07:42:24 +0000 (15:42 +0800)]
tests/amdgpu: move arcturus asic check function to common place

Acked-by: Huang Rui <ray.huang@amd.com>
Acked-by: Leo Liu <leo.liu@amd.com>
Signed-off-by: Le Ma <le.ma@amd.com>
Reviewed-by: Evan Quan <evan.quan@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
3 years agotests/amdgpu/vcn: add Arcturus decode test support
James Zhu [Thu, 15 Oct 2020 17:41:26 +0000 (13:41 -0400)]
tests/amdgpu/vcn: add Arcturus decode test support

Add Arcturus decode test support only

Acked-by: Huang Rui <ray.huang@amd.com>
Acked-by: Leo Liu <leo.liu@amd.com>
Signed-off-by: James Zhu <James.Zhu@amd.com>
Reviewed-by: Leo Liu <leo.liu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
3 years agotests/amdgpu: disable gfx engine basic test cases for Arcturus
Le Ma [Mon, 4 Mar 2019 08:56:55 +0000 (16:56 +0800)]
tests/amdgpu: disable gfx engine basic test cases for Arcturus

Since Arcturus has no gfx pipeline(CPG), cases below is not suitable:
  - Command submission Test (GFX)
  - Command submission Test (Multi-Fence)
  - Sync dependency Test

Acked-by: Huang Rui <ray.huang@amd.com>
Acked-by: Leo Liu <leo.liu@amd.com>
Signed-off-by: Le Ma <le.ma@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
3 years agotests/amdgpu: create Active function for basic test suite
Le Ma [Mon, 4 Mar 2019 10:27:48 +0000 (18:27 +0800)]
tests/amdgpu: create Active function for basic test suite

Acked-by: Huang Rui <ray.huang@amd.com>
Acked-by: Leo Liu <leo.liu@amd.com>
Signed-off-by: Le Ma <le.ma@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
3 years agotests/amdgpu: add function to check Asic is Arcturus
Le Ma [Thu, 27 Jun 2019 10:57:14 +0000 (18:57 +0800)]
tests/amdgpu: add function to check Asic is Arcturus

Since Arcturus has no gfx engine, add function to blacklist gfx related test.

Acked-by: Huang Rui <ray.huang@amd.com>
Acked-by: Leo Liu <leo.liu@amd.com>
Signed-off-by: Le Ma <le.ma@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
3 years agoamdgpu: add marketing names from 20.40
Alex Deucher [Mon, 5 Oct 2020 14:55:25 +0000 (10:55 -0400)]
amdgpu: add marketing names from 20.40

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
3 years agointel: add INTEL_DG1_IDS to the pciids list
Tapani Pälli [Fri, 25 Sep 2020 06:19:35 +0000 (09:19 +0300)]
intel: add INTEL_DG1_IDS to the pciids list

This enables drm_intel_bufmgr on DG1 and allows us to pass dmabuf
import/export related tests with Piglit.

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Lucas De Marchi <lucas.demarchi@intel.com>
3 years agoamdgpu: add device IDs for Raven, Picasso and Renoir
sitanliu [Thu, 27 Aug 2020 17:01:28 +0000 (17:01 +0000)]
amdgpu: add device IDs for Raven, Picasso and Renoir

3 years agointel: sync i915_pciids.h with kernel
Adam Miszczak [Fri, 21 Aug 2020 06:15:10 +0000 (08:15 +0200)]
intel: sync i915_pciids.h with kernel

Add DG1 and clean-up VLV PCI IDs.

Align with kernel commits:
f2bde2546b81 ("drm/i915: Remove dubious Valleyview PCI IDs")
fd38cdb81105 ("drm/i915/dg1: Add DG1 PCI IDs")

Signed-off-by: Adam Miszczak <adam.miszczak@intel.com>
Reviewed-by: José Roberto de Souza <jose.souza@intel.com>
3 years agoman: Update the bug URL to gitlab.freedesktop.org
Jeremy Cline [Thu, 13 Aug 2020 17:00:53 +0000 (13:00 -0400)]
man: Update the bug URL to gitlab.freedesktop.org

Point users to the GitLab issue tracker instead of Bugzilla, which is no
longer used.

Signed-off-by: Jeremy Cline <jcline@redhat.com>
3 years ago intel: Add PCI ID support to RKL platform
sunil kumar dora sermsity [Fri, 21 Aug 2020 20:02:53 +0000 (20:02 +0000)]
intel: Add PCI ID support to RKL platform

    Missing RKL PCI ID preventing below test cases to succeed on RKL Platform.
    igt@kms_frontbuffer_tracking
    igt@kms_draw-crc
    igt@kms_big_fb

Signed-off-by: sunil kumar dora sermsity <sunilx.kumar.dora.sermsity@intel.com>
Reviewed-by: Matt Roper <matthew.d.roper@intel.com>
3 years agoamdgpu: Add Device IDs for Embedded Raven2 platforms
Pavan Kumar Ramayanam [Tue, 18 Aug 2020 11:28:51 +0000 (16:58 +0530)]
amdgpu: Add Device IDs for Embedded Raven2 platforms

Acked-by: Leo Liu <leo.liu@amd.com>
Signed-off-by: Pavan Kumar Ramayanam <pavan.ramayanam@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
3 years agointel: sync i915_pciids.h with kernel
José Roberto de Souza [Wed, 8 Jul 2020 17:44:53 +0000 (10:44 -0700)]
intel: sync i915_pciids.h with kernel

Two new patches landed in kernel adding new PCI ids:
123f62de419f ("drm/i915/rkl: Add RKL platform info and PCI ids")
52797a8e8529 ("drm/i915/ehl: Add new PCI ids")

Cc: Matt Roper <matthew.d.roper@intel.com>
Signed-off-by: José Roberto de Souza <jose.souza@intel.com>
3 years agotests/amdgpu: clear the extension flag
Leo Liu [Thu, 14 May 2020 16:30:28 +0000 (12:30 -0400)]
tests/amdgpu: clear the extension flag

This is workaround of firmware issue, and the change has no impact
on the legacy HW.

Signed-off-by: Leo Liu <leo.liu@amd.com>
Reviewed-by: Thong Thai <thong.thai@amd.com>
Reviewed-by: James Zhu <James.Zhu@amd.com>
3 years agotests/amdgpu: clear msg decode flag
Leo Liu [Thu, 14 May 2020 16:27:41 +0000 (12:27 -0400)]
tests/amdgpu: clear msg decode flag

It is not used for VCN from VCN1, but VCN3 use it
for other feature, so clear it, because we don't
use the feature for now

Signed-off-by: Leo Liu <leo.liu@amd.com>
Reviewed-by: Thong Thai <thong.thai@amd.com>
Reviewed-by: James Zhu <James.Zhu@amd.com>
3 years agotests/amdgpu: add VCN3.0 regs support
Leo Liu [Thu, 14 May 2020 16:24:53 +0000 (12:24 -0400)]
tests/amdgpu: add VCN3.0 regs support

VCN3.0 has its own set of internal regs

Signed-off-by: Leo Liu <leo.liu@amd.com>
Reviewed-by: Thong Thai <thong.thai@amd.com>
Reviewed-by: James Zhu <James.Zhu@amd.com>
3 years agoxf86drm.c: fix build failure
Heiko Thiery [Fri, 5 Jun 2020 21:46:52 +0000 (23:46 +0200)]
xf86drm.c: fix build failure

./xf86drm.c: In function 'drmNodeIsDRM':
../xf86drm.c:2825:7: error: "__FreeBSD__" is not defined [-Werror=undef]
 #elif __FreeBSD__
       ^
../xf86drm.c: In function 'drmGetMinorNameForFD':
../xf86drm.c:2938:7: error: "__FreeBSD__" is not defined [-Werror=undef]
 #elif __FreeBSD__
       ^
../xf86drm.c: In function 'drmParsePciBusInfo':
../xf86drm.c:3258:7: error: "__FreeBSD__" is not defined [-Werror=undef]
 #elif __FreeBSD__
       ^
../xf86drm.c: In function 'drmParsePciDeviceInfo':
../xf86drm.c:3427:7: error: "__FreeBSD__" is not defined [-Werror=undef]
 #elif __FreeBSD__
       ^
../xf86drm.c: In function 'drmGetDeviceNameFromFd2':
../xf86drm.c:4305:7: error: "__FreeBSD__" is not defined [-Werror=undef]
 #elif __FreeBSD__
       ^

Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com>
3 years agocore: use `O_RDONLY` instead of ambiguous `0` flag
Eric Engestrom [Thu, 28 May 2020 15:17:26 +0000 (17:17 +0200)]
core: use `O_RDONLY` instead of ambiguous `0` flag

Signed-off-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
3 years agoamdgpu: add marketing names from 20.10
Alex Deucher [Thu, 21 May 2020 17:21:54 +0000 (13:21 -0400)]
amdgpu: add marketing names from 20.10

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
3 years agoBump version to 2.4.102 libdrm-2.4.102
Dave Airlie [Tue, 26 May 2020 20:32:57 +0000 (06:32 +1000)]
Bump version to 2.4.102

Signed-off-by: Dave Airlie <airlied@redhat.com>
3 years agomodetest: Add a new "-r" option to set a default mode
Emil Velikov [Mon, 22 Jul 2019 16:08:23 +0000 (13:08 -0300)]
modetest: Add a new "-r" option to set a default mode

This option finds all connected connector and then sets its preferred
mode on it. If no preferred mode is available, first mode is used.

This option must be set w/o any mode or plane.

This allows for a quick test on all connected outputs.

Loosely based on the work by Ezequiel Garcia <ezequiel@collabora.com>

Changes since Ezequiel's work:
 - implement atomic codepath
 - set all connectors
 - pick correct crtc
 - don't set -r by default
 - nearly identical output in atomic and non-atomic codepaths

v2:
 - Use the crtc->crtc_id, instead of the plane's current crtc_id

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Ezequiel Garcia <ezequiel@collabora.com>
Tested-by: Ezequiel Garcia <ezequiel@collabora.com>
3 years agomodetest: reorder atomic path alike the non-atomic
Emil Velikov [Wed, 15 Apr 2020 09:37:24 +0000 (10:37 +0100)]
modetest: reorder atomic path alike the non-atomic

Makes the code a tiny bit more symmetrical.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Ezequiel Garcia <ezequiel@collabora.com>
Tested-by: Ezequiel Garcia <ezequiel@collabora.com>
3 years agomodetest: don't error out of final AtomicCommit
Emil Velikov [Wed, 15 Apr 2020 09:28:36 +0000 (10:28 +0100)]
modetest: don't error out of final AtomicCommit

The very final drmModeAtommicCommit tears down the existing mode/plane
setup. Following it we clean up other misc state laying around.

Chances are that it will not fail, but in the extremely unlikely case it
does, there's nothing one can do.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Ezequiel Garcia <ezequiel@collabora.com>
Tested-by: Ezequiel Garcia <ezequiel@collabora.com>
3 years agomodetest: factor out atomic pageflip test
Emil Velikov [Wed, 15 Apr 2020 09:20:07 +0000 (10:20 +0100)]
modetest: factor out atomic pageflip test

Move the hunk of code into a function, making the overall flow easier to
follow and providing some symmetry to the non-atomic path.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Ezequiel Garcia <ezequiel@collabora.com>
Tested-by: Ezequiel Garcia <ezequiel@collabora.com>
3 years agomodetest: push pipe_resolve_connectors() to set_mode
Emil Velikov [Mon, 13 Apr 2020 14:33:50 +0000 (15:33 +0100)]
modetest: push pipe_resolve_connectors() to set_mode

The function is closely related to pipe_find_crtc_and_mode() so we might
as well keep them together.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Ezequiel Garcia <ezequiel@collabora.com>
Tested-by: Ezequiel Garcia <ezequiel@collabora.com>
3 years agomodetest: move pipe_resolve_connectors() further up
Emil Velikov [Wed, 15 Apr 2020 08:57:09 +0000 (09:57 +0100)]
modetest: move pipe_resolve_connectors() further up

Move the function above set_mode, since we'll be using it from there as
of next commit.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Ezequiel Garcia <ezequiel@collabora.com>
Tested-by: Ezequiel Garcia <ezequiel@collabora.com>
3 years agomodetest: unify {,atomic_}set_mode()
Emil Velikov [Mon, 13 Apr 2020 15:05:52 +0000 (16:05 +0100)]
modetest: unify {,atomic_}set_mode()

Instead of duplicating the exact same code across the two functions,
fold them into one.

For some strange reason git diff may show atomic_clear_mode() as changed
The function in untouched, despite the misleading output.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Ezequiel Garcia <ezequiel@collabora.com>
Tested-by: Ezequiel Garcia <ezequiel@collabora.com>
3 years agomodetest: get the crtc_id from the pipe_arg
Emil Velikov [Mon, 13 Apr 2020 11:09:59 +0000 (12:09 +0100)]
modetest: get the crtc_id from the pipe_arg

Makes the code shorter and easier to read.

Currently if the user has not set the crtc_id, we fetch the crtc yet do
not "bother" setting the id - do so.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Ezequiel Garcia <ezequiel@collabora.com>
Tested-by: Ezequiel Garcia <ezequiel@collabora.com>
3 years agomodetest: introduce and use get_crtc_by_id() and get_crtc_mask()
Emil Velikov [Mon, 13 Apr 2020 11:31:23 +0000 (12:31 +0100)]
modetest: introduce and use get_crtc_by_id() and get_crtc_mask()

Let's make the code shorter, this avoid crashes (when drmModeGetCrtc()
fails) by using a couple of helpers. As get_resources() considers the
drmModeGetCrtc() fail non-fatal, we might as well handle it properly.

v2: Add a comment above the unreachable abort() (Eze)

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Ezequiel Garcia <ezequiel@collabora.com>
Tested-by: Ezequiel Garcia <ezequiel@collabora.com>
3 years agomodetest: close the device on exit
Emil Velikov [Tue, 14 Apr 2020 10:31:07 +0000 (11:31 +0100)]
modetest: close the device on exit

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Ezequiel Garcia <ezequiel@collabora.com>
Tested-by: Ezequiel Garcia <ezequiel@collabora.com>
3 years agomodetest: remove drmMode{,Plane}Res
Emil Velikov [Mon, 13 Apr 2020 10:26:18 +0000 (11:26 +0100)]
modetest: remove drmMode{,Plane}Res

There's no point in keeping these around since we already fetch the
complete data set. Add respective count_ variables and greatly simplify
the existing code.

Extra brownie points for:
 - using the inverse order in free_resources()
 - don't memory leak the connector properties
 - free the properties themselves, instead of only the objects

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Ezequiel Garcia <ezequiel@collabora.com>
Tested-by: Ezequiel Garcia <ezequiel@collabora.com>
3 years agomodetest: add and use bo_fb_create() helper
Emil Velikov [Fri, 10 Apr 2020 22:29:58 +0000 (23:29 +0100)]
modetest: add and use bo_fb_create() helper

Flesh out the bo_create + drmModeAddFB2 dance into a helper and use it.
Currently we're duplicating that in 4 places, many of which leaking et
al.

As a bonus point this highlights that the atomic_set_plane() seems tad
buggy. That'll be fixed with separate commit.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Ezequiel Garcia <ezequiel@collabora.com>
Tested-by: Ezequiel Garcia <ezequiel@collabora.com>
3 years agomodetest: set atomic cap, _only_ when needed
Emil Velikov [Fri, 10 Apr 2020 17:31:18 +0000 (18:31 +0100)]
modetest: set atomic cap, _only_ when needed

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Ezequiel Garcia <ezequiel@collabora.com>
Tested-by: Ezequiel Garcia <ezequiel@collabora.com>
3 years agomodetest: move basic args check before open()
Emil Velikov [Fri, 10 Apr 2020 19:17:07 +0000 (20:17 +0100)]
modetest: move basic args check before open()

Don't bother opening the device node, if the args combination is invalid

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Ezequiel Garcia <ezequiel@collabora.com>
Tested-by: Ezequiel Garcia <ezequiel@collabora.com>
3 years agomodetest: remove cursor/page_flipping_supported stubs
Emil Velikov [Fri, 10 Apr 2020 19:14:32 +0000 (20:14 +0100)]
modetest: remove cursor/page_flipping_supported stubs

The two functions have been stubs for ages. The alluded generic ioctls
never came to be, assumingly because all new drivers support those.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Ezequiel Garcia <ezequiel@collabora.com>
Tested-by: Ezequiel Garcia <ezequiel@collabora.com>
3 years agomodetest: simplify "dump all" logic
Emil Velikov [Fri, 10 Apr 2020 19:12:54 +0000 (20:12 +0100)]
modetest: simplify "dump all" logic

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Ezequiel Garcia <ezequiel@collabora.com>
Tested-by: Ezequiel Garcia <ezequiel@collabora.com>
4 years agomeson: require valgrind 3.10.0 to enable it with freedreno
Jose Maria Casanova Crespo [Tue, 5 May 2020 19:50:33 +0000 (21:50 +0200)]
meson: require valgrind 3.10.0 to enable it with freedreno

Freedreno uses VALGRIND_ENABLE_ADDR_ERROR_REPORTING_IN_RANGE that was
introduced in Valgrind 3.10.0

Raspbian Buster includes Valgrind 3.7.0, so when valgrind is installed
as freedreno is build by default the build becomes broken. So lets
require 3.10 to enable valgrind when freedreno is built.

v2: Keep the arguments listed in the same order (Emil Velikov)

Closes: https://gitlab.freedesktop.org/mesa/drm/-/issues/37
Signed-off-by: Jose Maria Casanova Crespo <jmcasanova@igalia.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
4 years agonouveau: sync up with nouveau_abi16.h and nouveau_drm.h
Karol Herbst [Tue, 5 May 2020 17:14:55 +0000 (19:14 +0200)]
nouveau: sync up with nouveau_abi16.h and nouveau_drm.h

Signed-off-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Ben Skeggs <bskeggs@redhat.com>
4 years agodrm mode : fix memory leak when freeing drmModePropertyPtr
Boram Park [Sat, 1 Oct 2011 00:30:09 +0000 (09:30 +0900)]
drm mode : fix memory leak when freeing drmModePropertyPtr

Closes: https://gitlab.freedesktop.org/mesa/drm/-/issues/5
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
4 years agolibdrm: drmGetDeviceNameFromFd: Always return /dev/dri/ node for FreeBSD
Emmanuel Vadot [Tue, 28 Apr 2020 14:33:05 +0000 (16:33 +0200)]
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>
4 years agolibdrm: drmGetMinorNameFromFd: Fix FreeBSD variant
Emmanuel Vadot [Tue, 28 Apr 2020 13:26:13 +0000 (15:26 +0200)]
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>
4 years agonouveau: fix compile error with -DDEBUG on newer gcc
Karol Herbst [Sun, 3 May 2020 14:17:42 +0000 (16:17 +0200)]
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>
4 years agolibdrm: intel: add DRM_RDWR flag in drm_intel_bo_gem_export_to_prime
Nicholas Bishop [Wed, 5 Feb 2020 01:27:33 +0000 (20:27 -0500)]
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>
4 years agointel: properly escape sed pattern for tests
Nicholas Bishop [Fri, 24 Apr 2020 16:16:31 +0000 (12:16 -0400)]
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>
4 years agotests/amdgpu/vcn: add Renoir VCN2.0 decode support
Leo Liu [Thu, 23 Apr 2020 16:05:09 +0000 (12:05 -0400)]
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>
4 years agolibdrm: Handle usb_interface devices for usb parsing
Scott Anderson [Fri, 31 Jan 2020 03:18:19 +0000 (16:18 +1300)]
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>
4 years agoxf86drm: Check non-absolute path only for virtio based devices
Mikhail Golubev [Mon, 20 Apr 2020 18:08:50 +0000 (20:08 +0200)]
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>
4 years agotests/amdgpu: needs atomic_ops
Peter Seiderer [Sat, 7 Mar 2020 11:23:09 +0000 (12:23 +0100)]
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>
4 years agotests: install drmdevice
Emil Velikov [Tue, 21 Apr 2020 10:27:01 +0000 (11:27 +0100)]
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>
4 years agotests/nouveau/threaded: adapt ioctl signature for FreeBSD
Emmanuel Vadot [Fri, 24 Jan 2020 18:27:41 +0000 (19:27 +0100)]
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>
4 years agolibdrm: Implement drmParsePciDeviceInfo for FreeBSD
Emmanuel Vadot [Tue, 21 Jan 2020 17:49:47 +0000 (18:49 +0100)]
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>
4 years agolibdrm: get_pci_path is Linux only so add an ifdef
Emmanuel Vadot [Mon, 20 Apr 2020 20:44:02 +0000 (22:44 +0200)]
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>
4 years agolibdrm: Add get_sysctl_pci_bus_info for FreeBSD
Emmanuel Vadot [Tue, 21 Jan 2020 17:49:11 +0000 (18:49 +0100)]
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>
4 years agolibdrm: drmCheckModesettingSupported: fix for FreeBSD
Emmanuel Vadot [Fri, 24 Jan 2020 19:43:05 +0000 (20:43 +0100)]
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>
4 years agolibdrm: drmCheckModesettingSupported: Fix for FreeBSD
Emmanuel Vadot [Tue, 21 Jan 2020 17:41:38 +0000 (18:41 +0100)]
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>
4 years agolibdrm: drmGetDeviceNameFromFd2: Add FreeBSD variant
Emmanuel Vadot [Tue, 21 Jan 2020 16:58:28 +0000 (17:58 +0100)]
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>
4 years agolibdrm: Default to PCI for FreeBSD
Emmanuel Vadot [Tue, 21 Jan 2020 16:56:49 +0000 (17:56 +0100)]
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>
4 years agolibdrm: drmGetMinorNameForFD: Add FreeBSD variant
Emmanuel Vadot [Tue, 21 Jan 2020 16:53:07 +0000 (17:53 +0100)]
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>
4 years agolibdrm: drmGetDeviceNameFromFd: Add FreeBSD variant
Emmanuel Vadot [Tue, 21 Jan 2020 16:50:15 +0000 (17:50 +0100)]
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>
4 years agolibdrm: drmGetMinorType: Add FreeBSD version
Emmanuel Vadot [Tue, 21 Jan 2020 16:47:09 +0000 (17:47 +0100)]
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>
4 years agoxf86drm: Remove ifdef for FreeBSD and DRM_MAJOR
Emmanuel Vadot [Tue, 21 Jan 2020 16:39:10 +0000 (17:39 +0100)]
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>
4 years agolibdrm: drmNodeIsDRM: Add FreeBSD variant
Emmanuel Vadot [Tue, 21 Jan 2020 16:42:44 +0000 (17:42 +0100)]
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>
4 years agomeson: don't detect <sys/sysctl.h> on Linux
Eric Engestrom [Sun, 29 Mar 2020 20:45:52 +0000 (22:45 +0200)]
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>
4 years agotests/amdgpu/vcn: add dummy feedback message
James Zhu [Sat, 11 Apr 2020 13:50:15 +0000 (09:50 -0400)]
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>
4 years agoBump version to 2.4.101 libdrm-2.4.101
Timo Aaltonen [Fri, 3 Apr 2020 11:39:47 +0000 (14:39 +0300)]
Bump version to 2.4.101

4 years agoamdgpu: increase cpu_map_count storage size
Pierre-Eric Pelloux-Prayer [Tue, 17 Mar 2020 15:50:56 +0000 (16:50 +0100)]
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>
4 years agointel: sync i915_pciids.h with kernel
Swathi Dhanavanthri [Fri, 20 Mar 2020 00:38:30 +0000 (17:38 -0700)]
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>
4 years agoAdd DRM_MODE_CONNECTOR_WRITEBACK to xf86drmMode.h
Daniel Stone [Tue, 26 Nov 2019 10:41:26 +0000 (10:41 +0000)]
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>
4 years agotests: Only copy con->modes[0] if it exists
Michel Dänzer [Thu, 27 Feb 2020 11:21:09 +0000 (12:21 +0100)]
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>
4 years agoxf86drm: fix subsystem type lookup for virtio mmio-based devices
Vasyl Vavrychuk [Wed, 29 Jan 2020 15:08:41 +0000 (16:08 +0100)]
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>
4 years agoxf86drm: generalize the device subsystem type parsing code
Vasyl Vavrychuk [Wed, 29 Jan 2020 02:54:56 +0000 (03:54 +0100)]
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>
4 years agotests: drop redundant and slow `random` test
Eric Engestrom [Tue, 11 Feb 2020 20:25:00 +0000 (20:25 +0000)]
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>
4 years agoamdgpu: clean up the cs structure variable
Huang Rui [Tue, 11 Feb 2020 10:52:41 +0000 (18:52 +0800)]
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>
4 years agoamdgpu: remove the un-used chunk_array
Huang Rui [Tue, 11 Feb 2020 10:42:34 +0000 (18:42 +0800)]
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>
4 years agoamdgpu: use amdgpu_cs_submit_raw2 in amdgpu_cs_submit
Huang Rui [Tue, 11 Feb 2020 10:26:07 +0000 (18:26 +0800)]
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>
4 years agoamdgpu: use alloca for dependencies and sem_dependencies
Huang Rui [Tue, 11 Feb 2020 07:40:24 +0000 (15:40 +0800)]
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>
4 years agoAdd drmModeGetFB2
Daniel Stone [Tue, 11 Feb 2020 20:19:16 +0000 (12:19 -0800)]
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>
4 years agoinclude/drm: sync up drm.h
Juston Li [Tue, 11 Feb 2020 20:19:15 +0000 (12:19 -0800)]
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>
4 years agoamdgpu: add new marketing names from 19.50
Alex Deucher [Thu, 30 Jan 2020 17:54:40 +0000 (12:54 -0500)]
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>
4 years agointel: drm_intel_bo_gem_create_from_* on platforms w/o HW tiling
Imre Deak [Wed, 22 Jan 2020 09:31:22 +0000 (11:31 +0200)]
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>
4 years agomeson: always define whether headers exist
Eric Engestrom [Wed, 7 Nov 2018 15:00:24 +0000 (15:00 +0000)]
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>
4 years agomeson: add symbols check for core libdrm
Eric Engestrom [Mon, 11 Nov 2019 23:51:04 +0000 (23:51 +0000)]
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>
4 years agomodetest: Fix segmentation fault
Ezequiel Garcia [Mon, 22 Jul 2019 16:08:22 +0000 (13:08 -0300)]
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>
4 years agolibdrm: modetest: Allow selecting modes by index
John Stultz [Thu, 27 Jun 2019 21:37:07 +0000 (21:37 +0000)]
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>
4 years agotests/amdgpu: Fix buffer overflow (v3)
Luben Tuikov [Fri, 6 Dec 2019 03:02:28 +0000 (22:02 -0500)]
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>
4 years agotests/amdgpu: Fix unused function warning (v2)
Luben Tuikov [Fri, 6 Dec 2019 03:10:43 +0000 (22:10 -0500)]
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>
4 years agotests/amdgpu: Fix various warnings (v2)
Luben Tuikov [Fri, 6 Dec 2019 02:05:13 +0000 (21:05 -0500)]
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>
4 years agoRevert "tests/amdgpu: Fix various warnings"
Marek Olšák [Tue, 7 Jan 2020 19:44:35 +0000 (14:44 -0500)]
Revert "tests/amdgpu: Fix various warnings"

This reverts commit fb1634583f3ba22c67cad0df7022b6ac48a40c56.

4 years agoRevert "tests/amdgpu: Fix unused function warning (v2)"
Marek Olšák [Tue, 7 Jan 2020 19:44:31 +0000 (14:44 -0500)]
Revert "tests/amdgpu: Fix unused function warning (v2)"

This reverts commit 4ff499cd85f86a7b5b28f3449de2fbad1b91c795.