Commit Graph

686 Commits (6b0b493555af7ef9374d6b2e7feafd848090d6e7)

Author SHA1 Message Date
Aaron Liu 5de99b1fa6 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>
2020-10-15 13:46:22 -04:00
Aaron Liu b352ef44b8 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>
2020-10-15 13:46:16 -04:00
Huang Rui 0cefd4cecd 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>
2020-10-15 13:46:11 -04:00
Huang Rui 76ceb8b806 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>
2020-10-15 13:46:05 -04:00
Huang Rui cfe55a0451 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>
2020-10-15 13:46:00 -04:00
Huang Rui e63b775e5a 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>
2020-10-15 13:45:50 -04:00
Huang Rui 2c0e4991d7 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>
2020-10-15 13:45:41 -04:00
Le Ma 6e10ac07c8 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>
2020-10-15 13:45:27 -04:00
Le Ma bbaec1283f 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>
2020-10-15 13:45:22 -04:00
James Zhu 70c97212b8 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>
2020-10-15 13:45:17 -04:00
Le Ma 236a139f09 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>
2020-10-15 13:45:11 -04:00
Le Ma 301b4b64d0 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>
2020-10-15 13:44:58 -04:00
Le Ma ba0d45eca6 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>
2020-10-15 13:44:34 -04:00
Leo Liu f449081628 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>
2020-06-18 10:08:23 -04:00
Leo Liu f806d438d6 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>
2020-06-18 10:08:23 -04:00
Leo Liu 7b9d4bbdd5 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>
2020-06-18 10:08:23 -04:00
Emil Velikov bf602a2d67 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>
2020-05-19 21:09:35 +01:00
Emil Velikov a04c8abb86 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>
2020-05-19 21:09:35 +01:00
Emil Velikov e341176d9f 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>
2020-05-19 21:09:35 +01:00
Emil Velikov 3d88c993a4 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>
2020-05-19 21:09:35 +01:00
Emil Velikov d928cd803a 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>
2020-05-19 21:09:35 +01:00
Emil Velikov 3b9585d88e 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>
2020-05-19 21:09:35 +01:00
Emil Velikov bdb9b82cf7 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>
2020-05-19 21:09:35 +01:00
Emil Velikov 544fab624d 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>
2020-05-19 21:09:35 +01:00
Emil Velikov 336c04220c 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>
2020-05-19 21:09:14 +01:00
Emil Velikov ef58af6dfc 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>
2020-05-19 21:04:01 +01:00
Emil Velikov 53fde76ce3 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>
2020-05-19 21:03:52 +01:00
Emil Velikov 823669c6c0 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>
2020-05-19 21:03:41 +01:00
Emil Velikov 900ed60848 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>
2020-05-19 21:03:32 +01:00
Emil Velikov 69f25d6a29 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>
2020-05-19 21:03:27 +01:00
Emil Velikov 24c0c44c8d 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>
2020-05-19 21:03:18 +01:00
Emil Velikov 9ffcbf5cd9 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>
2020-05-19 21:02:45 +01:00
Leo Liu fd7f3746e3 tests/amdgpu/vcn: add Renoir VCN2.0 decode support
Renoir is the same family as Raven, but it's with VCN2.0,
so it has to use VCN2.0 reg set

Signed-off-by: Leo Liu <leo.liu@amd.com>
Reviewed-By: Thong Thai <thong.thai@amd.com>
2020-04-26 11:39:19 -04:00
Peter Seiderer 9001c93b7f tests/amdgpu: needs atomic_ops
Signed-off-by: Peter Seiderer <ps.report@gmx.net>
Acked-by: Alex Deucher alexander.deucher@amd.com
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
2020-04-22 23:54:36 -04:00
Emil Velikov cf1afec017 tests: install drmdevice
Just like the other tests (tools really) install drmdevice. It is a
simple tool which is useful for basic check/testing.

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

Signed-off-by: Emmanuel Vadot <manu@FreeBSD.org>
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
2020-04-21 19:26:54 +02:00
James Zhu 8cef557062 tests/amdgpu/vcn: add dummy feedback message
Latest VCN firmware has feedback header check.

Signed-off-by: James Zhu <James.Zhu@amd.com>
Reviewed-by: Leo Liu <leo.liu@amd.com>
2020-04-16 16:01:37 -04:00
Michel Dänzer fe06ee2054 tests: Only copy con->modes[0] if it exists
con->modes can be NULL. Fixes crash in that case.

Closes: https://gitlab.freedesktop.org/mesa/drm/issues/34
Reviewed-by: Daniel Stone <daniels@collabora.com>
2020-02-27 12:21:09 +01:00
Eric Engestrom 2c0a01261d tests: drop redundant and slow `random` test
Suggested by Emil [1]:
> Feel free to drop the random test altogether. It's an old public API
> no active users (pretty ancient code uses it) and the in-tree users
> drmSL and drmHash already have respective tests.

This test takes minutes to run, while all the other tests combined take
barely more than a second.

Dropping it also helps the CI by avoiding random timeouts when `random`
takes more than the 4 minutes (!) we've allowed for it.

[1] https://gitlab.freedesktop.org/mesa/drm/merge_requests/26#note_390066

Suggested-by: Emil Velikov <emil.l.velikov@gmail.com>
Signed-off-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
2020-02-15 12:14:00 +00:00
Eric Engestrom 074947ee4b meson: always define whether headers exist
Combined with -Wundef (added in 75758d2ccf & enforced in ba17673eed),
this provides absolute safety against #ifdef typos.

Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
2020-01-23 17:00:12 +00:00
Ezequiel Garcia 07d48a4c00 modetest: Fix segmentation fault
When a mode is set with just a connector "-s foo",
we get a nasty segmentation fault. Fix it.

Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
2020-01-21 17:56:23 +00:00
John Stultz 899da0f486 libdrm: modetest: Allow selecting modes by index
Often there are many similar modes, which cannot be selected
via modetest due to its simple string matching.

This change adds a mode index in the display output, which can
then be used to specify a specific modeline to be set.

Cc: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: Rob Clark <robdclark@chromium.org>
Cc: Bjorn Andersson <bjorn.andersson@linaro.org>
Cc: Sumit Semwal <sumit.semwal@linaro.org>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Signed-off-by: John Stultz <john.stultz@linaro.org>
[emil: rebase]
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
2020-01-21 17:56:23 +00:00
Luben Tuikov c9d4540bf6 tests/amdgpu: Fix buffer overflow (v3)
This patch fixes the following warning:
-Wformat-overflow=

v2: Use the correct strlcat(3).
v3: Use strncat(3) and remove libbsd dependency.

Signed-off-by: Luben Tuikov <luben.tuikov@amd.com>
2020-01-08 13:21:40 -05:00
Luben Tuikov 29a5a85dae tests/amdgpu: Fix unused function warning (v2)
This patch fixes:
-Wunused-function

v2: Always enable amdgpu_ras_test().

Signed-off-by: Luben Tuikov <luben.tuikov@amd.com>
2020-01-08 13:20:57 -05:00
Luben Tuikov cb3d067587 tests/amdgpu: Fix various warnings (v2)
This patch fixes the following warnings:
-Wformat=
-Wmaybe-uninitialized
-Wmisleading-indentation
-Wstringop-truncation
-Wunused-function
-Wunused-variable

It also removes forward declarations and moves
global functions to the bottom, keeping locals
at the top, in ras_tests.c.

v2: Fix compilation.

Signed-off-by: Luben Tuikov <luben.tuikov@amd.com>
2020-01-08 13:18:50 -05:00
Marek Olšák 9ebfac15a5 Revert "tests/amdgpu: Fix various warnings"
This reverts commit fb1634583f.
2020-01-07 14:44:47 -05:00
Marek Olšák 54b982dc6a Revert "tests/amdgpu: Fix unused function warning (v2)"
This reverts commit 4ff499cd85.
2020-01-07 14:44:47 -05:00
Marek Olšák b9600be207 Revert "tests/amdgpu: Fix buffer overflow (v3)"
This reverts commit 680542ce08.
2020-01-07 14:44:47 -05:00
Luben Tuikov 7fdebb02ff tests/amdgpu: Proper format for "-l"
Proper format for command line option "-l",
listing the supported and unsupported tests:

1) Add an aligned column header.

2) Align all fields into columns.

3) Fixed length fields, come before the last
column, which is a variable length field.

4) Variable length field, which is the name of the
test, goes in the last column.

5) If a suite is disabled, do not iterate over its
tests, as they'd naturally be all disabled.

Now the output looks like this:
$sudo ./amdgpu_test -l
 What: ID:   Status: Name
Suite:  1:  ENABLED: Basic Tests
 Test:  1:  ENABLED: Query Info Test
 Test:  2:  ENABLED: Userptr Test
 Test:  3: DISABLED: bo eviction Test
 Test:  4:  ENABLED: Command submission Test (GFX)
 Test:  5:  ENABLED: Command submission Test (Compute)
 Test:  6:  ENABLED: Command submission Test (Multi-Fence)
 Test:  7:  ENABLED: Command submission Test (SDMA)
 Test:  8:  ENABLED: SW semaphore Test
 Test:  9: DISABLED: Sync dependency Test
 Test: 10: DISABLED: Dispatch Test (Compute)
 Test: 11: DISABLED: Dispatch Test (GFX)
 Test: 12: DISABLED: Draw Test
 Test: 13: DISABLED: GPU reset Test
Suite:  2:  ENABLED: BO Tests
 Test:  1:  ENABLED: Export/Import
 Test:  2: DISABLED: Metadata
 Test:  3:  ENABLED: CPU map/unmap
 Test:  4:  ENABLED: Memory alloc Test
 Test:  5:  ENABLED: Memory fail alloc Test
 Test:  6:  ENABLED: Find bo by CPU mapping
Suite:  3: DISABLED: CS Tests
Suite:  4: DISABLED: VCE Tests
Suite:  5:  ENABLED: VCN Tests
 Test:  1:  ENABLED: VCN DEC create
 Test:  2:  ENABLED: VCN DEC decode
 Test:  3:  ENABLED: VCN DEC destroy
 Test:  4:  ENABLED: VCN ENC create
 Test:  5:  ENABLED: VCN ENC decode
 Test:  6:  ENABLED: VCN ENC destroy
Suite:  6: DISABLED: UVD ENC Tests
Suite:  7: DISABLED: Deadlock Tests
Suite:  8:  ENABLED: VM Tests
 Test:  1:  ENABLED: resere vmid test
 Test:  2:  ENABLED: unaligned map
 Test:  3:  ENABLED: vm mapping test
Suite:  9: DISABLED: RAS Tests
Suite: 10:  ENABLED: SYNCOBJ TIMELINE Tests
 Test:  1:  ENABLED: syncobj timeline test
$_

Signed-off-by: Luben Tuikov <luben.tuikov@amd.com>
2020-01-07 14:38:36 -05:00
Luben Tuikov 680542ce08 tests/amdgpu: Fix buffer overflow (v3)
This patch fixes the following warning:
-Wformat-overflow=

v2: Use the correct strlcat(3).
v3: Use strncat(3) and remove libbsd dependency.

Signed-off-by: Luben Tuikov <luben.tuikov@amd.com>
2020-01-07 14:38:36 -05:00
Luben Tuikov 4ff499cd85 tests/amdgpu: Fix unused function warning (v2)
This patch fixes:
-Wunused-function

v2: Always enable amdgpu_ras_test().

Signed-off-by: Luben Tuikov <luben.tuikov@amd.com>
2020-01-07 14:38:36 -05:00
Luben Tuikov fb1634583f tests/amdgpu: Fix various warnings
This patch fixes the following warnings:
-Wformat=
-Wmaybe-uninitialized
-Wmisleading-indentation
-Wstringop-truncation
-Wunused-function
-Wunused-variable

It also removes forward declarations and moves
global functions to the bottom, keeping locals
at the top, in ras_tests.c.

Signed-off-by: Luben Tuikov <luben.tuikov@amd.com>
2020-01-07 14:38:36 -05:00
Yifan Zhang ed96524001 tests/amdgpu: fix a amdgpu_test hang issue on some platforms.
The computer ring test name mis-match in different files,
thus may be set with TRUE on wrong platforms.

Change-Id: I0b918ff8faf08c9c9f1ad55f4dcd18f66b956901
Signed-off-by: Yifan Zhang <yifan1.zhang@amd.com>
Signed-off-by: Marek Olšák <marek.olsak@amd.com>
2019-12-30 20:25:52 -05:00
Devarsh Thakkar 7f82714522 modetest: Use floating vrefresh while dumping mode
Add function to derive floating value of vertical
refresh rate from drm mode using pixel clock,
horizontal total size and vertical total size.

Use this function to find suitable mode having vrefresh
value which is matching with user provided vrefresh value.

If user doesn't provide any vrefresh value in args then
update vertical refresh rate value in pipe args using this
function.

Also use this function for printing floating vrefresh while
dumping all available modes.

This will give more accurate picture to user for available modes
differentiated by floating vertical refresh rate and help user
select more appropriate mode using suitable refresh rate value.

V4:
1) While setting mode, print mode name and vrefresh using struct
   drmModeModeInfo instead of struct pipe_args.
2) Revert back to using a float value instead of float *
   for vrefresh arg in connector_find_mode().

V3:
1) Change name of function used to derive refresh rate.

V2:
1) Don't use inline function for deriving refresh rate from mode.
2) If requested mode not found, print refresh rate only
   if user had provided it in args.

Signed-off-by: Devarsh Thakkar <devarsh.thakkar@xilinx.com>
Reviewed-by: Neil Armstrong <narmstrong@baylibre.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
2019-12-11 17:47:31 +02:00
Flora Cui 31a6ec141a tests/amdgpu: add gfx ring bad slow draw test
for gfx9

Signed-off-by: Flora Cui <flora.cui@amd.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
2019-12-09 15:46:53 -05:00
Flora Cui 5e1f6533a0 tests/amdgpu: add gfx ring draw hang test
for gfx9

Signed-off-by: Flora Cui <flora.cui@amd.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
2019-12-09 15:46:53 -05:00
Flora Cui 71b9e68d99 tests/amdgpu: add bad slow dispatch test
add gfx/compute bad slow dispatch test for gfx9

Signed-off-by: Flora Cui <flora.cui@amd.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
2019-12-09 15:46:53 -05:00
Flora Cui d72b9189c4 tests/amdgpu: add dispatch hang test
add compute/gfx dispatch hang test for gfx9

Signed-off-by: Flora Cui <flora.cui@amd.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
2019-12-09 15:46:53 -05:00
Flora Cui 67017ea07e tests/amdgpu: update draw test for gfx9
Signed-off-by: Flora Cui <flora.cui@amd.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
2019-12-09 15:46:53 -05:00
changzhu d93856fe82 tests/amdgpu: enable dispatch/draw tests for Renoir
It can run dispatch/draw tests on new renoir chips. So it needs to
enable dispatch/draw tests for Renoir again.

Change-Id: I3a72a4bbfe0fc663ee0e3e58d8e9c304f513e568
Signed-off-by: changzhu <Changfeng.Zhu@amd.com>
Reviewed-by: Flora Cui <flora.cui@amd.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
2019-12-09 15:46:53 -05:00
Ross Burton cd77f114ca tests/nouveau/threaded: adapt ioctl signature
POSIX says ioctl() has the signature (int, int, ...) but glibc has decided to
use (int, unsigned long int, ...) instead.

Use a #ifdef to adapt the replacement function as appropriate.

Signed-off-by: Ross Burton <ross.burton@intel.com>

[Taken from https://raw.githubusercontent.com/openembedded/openembedded-core/master/meta/recipes-graphics/drm/libdrm/musl-ioctl.patch]
Signed-off-by: Peter Seiderer <ps.report@gmx.net>
Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>
2019-11-28 22:01:34 +01:00
xinxu@loongson.cn 0287602015 tests/amdgpu/basic_tests.c: change BUFFER_SIZE used in Userptr Test adjust to PAGE_SIZE
Userptr Test will fail on PAGE_SIZE bigger than BUFFER_SIZE(8 * 1024)

Signed-off-by: xinxu <xinxu@loongson.cn>


(cherry picked from commit fb7dfdc5fb58795365b70117c3eb625f2edb8f06)
2019-11-25 21:23:43 -05:00
Devarsh Thakkar a2d588fe12 modetest: Add support for setting mode having floating vertical refresh rate
For the scenario where user may require to modeset with a mode
supporting a fractional value for vertical refresh-rate,
appropriate mode can be selected by searching for mode
having matching fractional vertical refresh rate using
below equation.

vrefresh = (1000 * pixel clock) / (htotal * vtotal) Hz.

We do this way since driver doesn't return float value of vrefresh
as it use int for vrefresh in struct drm_mode_info, but we can derive
the actual value using pixel clock, horizontal total size and
vertical total size values.

So for e.g. if user want to select mode having 59.94 Hz as refresh rate
then with this patch it be can done as shown in below command,
given there is an appropriate mode is available :

modetest -M xlnx -s 39:1920x1080-59.94@BG24 -v

NOTE: Above command was tested on xilinx DRM driver with DP
monitor which was supporting mode having 59.94 Hz refresh rate.

V2: Update commit message
V3: Update with below changes as per review comments :
  1) Use epsilon for vrefresh comparison
  2) Use implicit type-casting wherever possible
V4: Keep patch version history on main commit message

Signed-off-by: Devarsh Thakkar <devarsh.thakkar@xilinx.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
2019-11-25 16:13:43 +02:00
Eric Engestrom fc933651b1 Revert "Revert "libdrm: remove autotools support""
The external tooling issue has been fixed, so we can delete autotools
again :)
2019-10-18 18:05:45 +01:00
Marek Olšák 51e3bb5665 Revert "libdrm: remove autotools support"
This reverts commit f057dc91e9.
2019-10-16 17:33:28 -04:00
Nirmoy Das 3b0a41d93b test/amdgpu: don't free unused bo handle
Signed-off-by: Nirmoy Das <nirmoy.das@amd.com>
Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>
2019-10-15 13:18:12 +02:00
Eric Engestrom f057dc91e9 libdrm: remove autotools support
Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
2019-10-14 16:07:20 +00:00
Le Ma 0c427545cd tests/amdgpu: add the missing deactivation case for dispatch test
Signed-off-by: Le Ma <le.ma@amd.com>
Reviewed-by: Feifei Xu <Feifei.Xu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2019-09-18 07:54:26 -05:00
Guchun Chen c51809fa67 amdgpu: add ras feature capability check in inject test
When running ras inject test, it's needed to be aligned
with kernel's ras enablement.

Acked-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Tao Zhou <tao.zhou1@amd.com>
Signed-off-by: Guchun Chen <guchun.chen@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2019-09-16 07:57:10 -05:00
Guchun Chen 58fc6d6eae amdgpu: add ras inject unit test
Both UMC and GFX ras single_correctable
inject tests are added.

Acked-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Tao Zhou <tao.zhou1@amd.com>
Signed-off-by: Guchun Chen <guchun.chen@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2019-09-16 07:57:10 -05:00
Guchun Chen cb637bc17b amdgpu: remove json package dependence
Except CUnit library, no additional external
library should be needed when compiling amdgpu_test.
This will keep this binary self containing.

Suggested-by: Christian König <christian.koenig@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Tao Zhou <tao.zhou1@amd.com>
Signed-off-by: Guchun Chen <guchun.chen@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2019-09-16 07:57:10 -05:00
Guchun Chen 1ef1e4db96 tests/amdgpu/ras: refine ras inject test
Ras inject test framework is invalid with original codes,
so refine it to make it work on top of kernel ras inject
feature enablement.

Signed-off-by: Dennis Li <dennis.li@amd.com>
Signed-off-by: Guchun Chen <guchun.chen@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Reviewed-by: Tao Zhou <tao.zhou1@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2019-08-08 12:19:38 -05:00
Le Ma 98996fd021 tests/amdgpu: divide dispatch test into compute and gfx
for better clarification

v2: accordingly change dispatch_test caller in gpu_reset test

Signed-off-by: Le Ma <le.ma@amd.com>
Reviewed-by: Flora Cui <flora.cui@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2019-08-02 22:08:01 -05:00
Flora Cui b0f2d60ba7 tests/amdgpu: disable reset test for now
ASIC hang randomly.

Signed-off-by: Flora Cui <flora.cui@amd.com>
Reviewed-by: Feifei Xu <Feifei.Xu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2019-08-02 22:07:18 -05:00
Flora Cui 3aba0f3889 tests/amdgpu: add gpu reset test
1. perform gpu reset
2. perform dispatch test to verify gpu reset to a good state

Signed-off-by: Flora Cui <flora.cui@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
2019-07-19 16:42:28 +08:00
Flora Cui 0247b19dc0 tests/amdgpu: fix for dispatch/draw test
1. skip test if there's no desired ring
2. clear shader buffer
3. update command buffer for gfx9

Signed-off-by: Flora Cui <flora.cui@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
2019-07-19 16:42:19 +08:00
Ilia Mirkin dcc586c66c tests/util: fix incorrect memset argument order
Make it actually clear the LUT.

Reported-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Dave Airlie <airlied@redhat.com>
2019-07-03 00:19:39 -04:00
Ilia Mirkin 08bd098d84 util: fix include path for drm_mode.h
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
2019-06-22 14:56:49 -04:00
Ilia Mirkin f2da507a04 modetest: add FP16 format support
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
2019-06-22 13:34:36 -04:00
Ilia Mirkin 5d0e9dec3f modetest: add the ability to specify fill patterns on the commandline
Instead of hacking the binary every time, we can now specify directly.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
2019-06-22 13:34:33 -04:00
Ilia Mirkin bfc469f241 modetest: add C8 support to generate SMPTE pattern
This includes logic to configure the LUT accordingly.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
2019-06-22 13:34:29 -04:00
Ilia Mirkin 557d1a2e6f modetest: add an add_property_optional variant that does not print errors
As new features are added and others are declared to be legacy, it's
nice to be able to implement fallbacks. As such, create a
property-setting variant that does not generate errors which can very
well be entirely expected.

Will be used for gamma control in a future change.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
2019-06-22 13:34:25 -04:00
Ilia Mirkin 78ea933460 modetest: don't pretend that atomic mode includes a format
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
2019-06-22 13:34:20 -04:00
Ilia Mirkin def955c09e util: add cairo drawing for 30bpp formats when available
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
2019-06-22 13:34:14 -04:00
Ilia Mirkin b59d14e7fc util: add fp16 format support
This change adds support for all current patterns.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
2019-06-22 13:34:08 -04:00
Ilia Mirkin e5442195fb util: add gradient pattern
The idea is to have a horizontal pattern split into two with the top and
bottom halves having different precision. This allows one to see whether
10bpc support is working properly or not, as there are many pieces to
the puzzle beyond the basic format support (gamma ramps, bpc encodings,
etc).

This is really only useful on 10bpc formats, but we also add support for
8bpc formats to ease testing. In the future, this could be applied to
16bpc formats as well.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
2019-06-22 13:34:05 -04:00
Ilia Mirkin 32401fe5ce util: fix MAKE_RGBA macro for 10bpp modes
We need to shift the values up, otherwise we'd end up with a negative
shift. This works for up-to 16-bit components, which is fine for now.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
2019-06-22 13:33:55 -04:00
Ilia Mirkin 8d27deced9 util: add C8 format, support it with SMPTE pattern
This also adds a helper to generate a color LUT, which has to be used in
conjunction with the C8 indexed format.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Acked-by: Emil Velikov <emil.velikov@collabora.com>
2019-06-22 13:29:54 -04:00
Leo Liu 0eaf5df553 tests/amdgpu/vcn: add VCN2.0 decode support
With different register offsets from VCN1.0

Signed-off-by: Leo Liu <leo.liu@amd.com>
Reviewed-by: James Zhu <James.Zhu@amd.com>
Signed-off-by: Marek Olšák <marek.olsak@amd.com>
2019-06-21 12:46:21 -04:00
Chunming Zhou 5db0f7692d enable syncobj test depending on capability
Feature is controlled by DRM_CAP_SYNCOBJ_TIMELINE drm capability.

Signed-off-by: Chunming Zhou <david1.zhou@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
2019-06-11 15:55:33 +02:00
Chunming Zhou 7ab471ed85 add syncobj timeline tests v3
v2: drop DRM_SYNCOBJ_CREATE_TYPE_TIMELINE, fix timeout calculation,
    fix some warnings
v3: add export/import and cpu signal testing cases

Signed-off-by: Chunming Zhou <david1.zhou@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
Acked-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
2019-05-16 12:07:18 +02:00
Seung-Woo Kim 6a7d1329db tests/libkms-test-plane: fix possbile memory leak
The pointer p aquired with drmModeGetPlane() is not free in error
path. Fix possible memory leak by calling drmModeFreePlane() in
the error path.

Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
2019-04-25 11:08:21 +01:00
Lubomir Rintel 0b474eab3d tests/util: Add armada-drm driver
This makes the test utilities work with the Armada driver without the
necessity of using the -M argument.

Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
2019-04-17 18:52:04 +01:00
Fritz Koenig f8f8b2b9b0 tests/modetest: add QCOM_COMPRESSED to supported modifiers list
Signed-off-by: Fritz Koenig <frkoenig@google.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
2019-04-17 18:28:08 +01:00
Eric Engestrom 360292c7ab fix various typos
Saw a couple of typos fixes in the patch DragonFlyBSD carries [1], so
I ran codespell (a spell checker for code) on the whole repo.

[1] https://github.com/DragonFlyBSD/DPorts/blob/master/graphics/libdrm/files/patch-xf86drm.c

Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
2019-04-17 18:23:25 +01:00
Eric Engestrom ad8bec1ed8 amdgpu/tests: drop unused local vars
Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
2019-04-17 18:18:10 +01:00
Pan, Xinhui fcf80e2fd7 amdgpu: Fix a structure initialization issue
struct drmPciBusInfo has been aligned to 6 bytes. So memcmp will access
the last byte which is not initialized.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: xinhui pan <xinhui.pan@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2019-04-12 11:38:41 -05:00
xinhui pan b4fbc6d70c drm/amdgpu: support test mask
support per device test mask. Skip inject test on non-server card.

Signed-off-by: xinhui pan <xinhui.pan@amd.com>
Reviewed-by: Feifei Xu <Feifei.Xu@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2019-04-04 13:45:19 -05:00
xinhui pan b21d23e3ba amdgpu: add ras tests
Signed-off-by: xinhui pan <xinhui.pan@amd.com>
Reviewed-by: Feifei Xu <Feifei.Xu@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2019-04-04 13:44:37 -05:00
Cui, Flora a85b31c973 tests/amdgpu: minor fix for dispatch/draw test
1. clear cmd buffer
2. make amdgpu_memcpy_dispatch_test static
3. tab/space fix

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Flora Cui <flora.cui@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2019-03-20 21:38:52 -05:00