|
From: GitLab M. <git...@ke...> - 2025-10-27 07:35:03
|
meson.build | 1
tests/amdgpu/amdgpu_test.c | 949 --------------
tests/amdgpu/amdgpu_test.h | 546 --------
tests/amdgpu/basic_tests.c | 2556 ---------------------------------------
tests/amdgpu/bo_tests.c | 317 ----
tests/amdgpu/cp_dma_tests.c | 533 --------
tests/amdgpu/cs_tests.c | 471 -------
tests/amdgpu/deadlock_tests.c | 696 ----------
tests/amdgpu/decode_messages.h | 881 -------------
tests/amdgpu/frame.h | 1949 -----------------------------
tests/amdgpu/hotunplug_tests.c | 447 ------
tests/amdgpu/jpeg_tests.c | 579 --------
tests/amdgpu/meson.build | 16
tests/amdgpu/ras_tests.c | 1003 ---------------
tests/amdgpu/security_tests.c | 486 -------
tests/amdgpu/shader_code.h | 153 --
tests/amdgpu/shader_code_gfx10.h | 202 ---
tests/amdgpu/shader_code_gfx11.h | 320 ----
tests/amdgpu/shader_code_gfx9.h | 205 ---
tests/amdgpu/shader_code_hang.h | 104 -
tests/amdgpu/shader_test_util.c | 2184 ---------------------------------
tests/amdgpu/syncobj_tests.c | 314 ----
tests/amdgpu/uvd_enc_tests.c | 491 -------
tests/amdgpu/uve_ib.h | 527 --------
tests/amdgpu/vce_ib.h | 335 -----
tests/amdgpu/vce_tests.c | 764 -----------
tests/amdgpu/vcn_tests.c | 1652 -------------------------
tests/amdgpu/vm_tests.c | 270 ----
28 files changed, 18951 deletions(-)
New commits:
commit aaf8a893e1733e6c9663c869549ba3cf7204a935
Author: Christian König <chr...@am...>
Date: Thu Oct 16 08:56:53 2025 +0200
test/amdgpu: remove amdgpu unit tests
Those haven't been updated in the last two years and have been replaced by
IGT test cases: https://gitlab.freedesktop.org/drm/igt-gpu-tools
Signed-off-by: Christian König <chr...@am...>
diff --git a/meson.build b/meson.build
index 8f2a6830..2059f4b2 100644
--- a/meson.build
+++ b/meson.build
@@ -205,7 +205,6 @@ libdrm_c_args = cc.get_supported_arguments([
'-Wno-unused-parameter', '-Wno-attributes', '-Wno-long-long',
'-Wno-missing-field-initializers'])
-dep_cunit = dependency('cunit', version : '>= 2.1', required : false)
dep_cairo = dependency('cairo', required : get_option('cairo-tests'))
with_cairo_tests = dep_cairo.found()
diff --git a/tests/amdgpu/amdgpu_test.c b/tests/amdgpu/amdgpu_test.c
deleted file mode 100644
index ec787889..00000000
--- a/tests/amdgpu/amdgpu_test.c
+++ /dev/null
@@ -1,949 +0,0 @@
-/*
- * Copyright 2014 Advanced Micro Devices, Inc.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- *
-*/
-
-#include <string.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-#include <ctype.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <signal.h>
-#include <time.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/ioctl.h>
-#include <sys/time.h>
-#include <stdarg.h>
-#include <stdint.h>
-#ifdef __linux__
-#include <linux/limits.h>
-#elif __FreeBSD__
-/* SPECNAMELEN in FreeBSD is defined here: */
-#include <sys/param.h>
-#endif
-#ifdef MAJOR_IN_MKDEV
-#include <sys/mkdev.h>
-#endif
-#ifdef MAJOR_IN_SYSMACROS
-#include <sys/sysmacros.h>
-#endif
-
-#include "drm.h"
-#include "xf86drmMode.h"
-#include "xf86drm.h"
-
-#include "CUnit/Basic.h"
-
-#include "amdgpu_test.h"
-#include "amdgpu_internal.h"
-
-/* Test suite names */
-#define BASIC_TESTS_STR "Basic Tests"
-#define BO_TESTS_STR "BO Tests"
-#define CS_TESTS_STR "CS Tests"
-#define VCE_TESTS_STR "VCE Tests"
-#define VCN_TESTS_STR "VCN Tests"
-#define JPEG_TESTS_STR "JPEG Tests"
-#define UVD_ENC_TESTS_STR "UVD ENC Tests"
-#define DEADLOCK_TESTS_STR "Deadlock Tests"
-#define VM_TESTS_STR "VM Tests"
-#define RAS_TESTS_STR "RAS Tests"
-#define SYNCOBJ_TIMELINE_TESTS_STR "SYNCOBJ TIMELINE Tests"
-#define SECURITY_TESTS_STR "Security Tests"
-#define HOTUNPLUG_TESTS_STR "Hotunplug Tests"
-#define CP_DMA_TESTS_STR "CP DMA Tests"
-
-/**
- * Open handles for amdgpu devices
- *
- */
-int drm_amdgpu[MAX_CARDS_SUPPORTED];
-
-/** Open render node to test */
-int open_render_node = 0; /* By default run most tests on primary node */
-
-/** The table of all known test suites to run */
-static CU_SuiteInfo suites[] = {
- {
- .pName = BASIC_TESTS_STR,
- .pInitFunc = suite_basic_tests_init,
- .pCleanupFunc = suite_basic_tests_clean,
- .pTests = basic_tests,
- },
- {
- .pName = BO_TESTS_STR,
- .pInitFunc = suite_bo_tests_init,
- .pCleanupFunc = suite_bo_tests_clean,
- .pTests = bo_tests,
- },
- {
- .pName = CS_TESTS_STR,
- .pInitFunc = suite_cs_tests_init,
- .pCleanupFunc = suite_cs_tests_clean,
- .pTests = cs_tests,
- },
- {
- .pName = VCE_TESTS_STR,
- .pInitFunc = suite_vce_tests_init,
- .pCleanupFunc = suite_vce_tests_clean,
- .pTests = vce_tests,
- },
- {
- .pName = VCN_TESTS_STR,
- .pInitFunc = suite_vcn_tests_init,
- .pCleanupFunc = suite_vcn_tests_clean,
- .pTests = vcn_tests,
- },
- {
- .pName = JPEG_TESTS_STR,
- .pInitFunc = suite_jpeg_tests_init,
- .pCleanupFunc = suite_jpeg_tests_clean,
- .pTests = jpeg_tests,
- },
- {
- .pName = UVD_ENC_TESTS_STR,
- .pInitFunc = suite_uvd_enc_tests_init,
- .pCleanupFunc = suite_uvd_enc_tests_clean,
- .pTests = uvd_enc_tests,
- },
- {
- .pName = DEADLOCK_TESTS_STR,
- .pInitFunc = suite_deadlock_tests_init,
- .pCleanupFunc = suite_deadlock_tests_clean,
- .pTests = deadlock_tests,
- },
- {
- .pName = VM_TESTS_STR,
- .pInitFunc = suite_vm_tests_init,
- .pCleanupFunc = suite_vm_tests_clean,
- .pTests = vm_tests,
- },
- {
- .pName = RAS_TESTS_STR,
- .pInitFunc = suite_ras_tests_init,
- .pCleanupFunc = suite_ras_tests_clean,
- .pTests = ras_tests,
- },
- {
- .pName = SYNCOBJ_TIMELINE_TESTS_STR,
- .pInitFunc = suite_syncobj_timeline_tests_init,
- .pCleanupFunc = suite_syncobj_timeline_tests_clean,
- .pTests = syncobj_timeline_tests,
- },
- {
- .pName = SECURITY_TESTS_STR,
- .pInitFunc = suite_security_tests_init,
- .pCleanupFunc = suite_security_tests_clean,
- .pTests = security_tests,
- },
- {
- .pName = HOTUNPLUG_TESTS_STR,
- .pInitFunc = suite_hotunplug_tests_init,
- .pCleanupFunc = suite_hotunplug_tests_clean,
- .pTests = hotunplug_tests,
- },
- {
- .pName = CP_DMA_TESTS_STR,
- .pInitFunc = suite_cp_dma_tests_init,
- .pCleanupFunc = suite_cp_dma_tests_clean,
- .pTests = cp_dma_tests,
- },
-
- CU_SUITE_INFO_NULL,
-};
-
-typedef CU_BOOL (*active__stat_func)(void);
-
-typedef struct Suites_Active_Status {
- char* pName;
- active__stat_func pActive;
-}Suites_Active_Status;
-
-static CU_BOOL always_active()
-{
- return CU_TRUE;
-}
-
-static Suites_Active_Status suites_active_stat[] = {
- {
- .pName = BASIC_TESTS_STR,
- .pActive = suite_basic_tests_enable,
- },
- {
- .pName = BO_TESTS_STR,
- .pActive = always_active,
- },
- {
- .pName = CS_TESTS_STR,
- .pActive = suite_cs_tests_enable,
- },
- {
- .pName = VCE_TESTS_STR,
- .pActive = suite_vce_tests_enable,
- },
- {
- .pName = VCN_TESTS_STR,
- .pActive = suite_vcn_tests_enable,
- },
- {
- .pName = JPEG_TESTS_STR,
- .pActive = suite_jpeg_tests_enable,
- },
- {
- .pName = UVD_ENC_TESTS_STR,
- .pActive = suite_uvd_enc_tests_enable,
- },
- {
- .pName = DEADLOCK_TESTS_STR,
- .pActive = suite_deadlock_tests_enable,
- },
- {
- .pName = VM_TESTS_STR,
- .pActive = suite_vm_tests_enable,
- },
- {
- .pName = RAS_TESTS_STR,
- .pActive = suite_ras_tests_enable,
- },
- {
- .pName = SYNCOBJ_TIMELINE_TESTS_STR,
- .pActive = suite_syncobj_timeline_tests_enable,
- },
- {
- .pName = SECURITY_TESTS_STR,
- .pActive = suite_security_tests_enable,
- },
- {
- .pName = HOTUNPLUG_TESTS_STR,
- .pActive = suite_hotunplug_tests_enable,
- },
- {
- .pName = CP_DMA_TESTS_STR,
- .pActive = suite_cp_dma_tests_enable,
- },
-};
-
-
-/*
- * Display information about all suites and their tests
- *
- * NOTE: Must be run after registry is initialized and suites registered.
- */
-static void display_test_suites(void)
-{
- int iSuite;
- int iTest;
- CU_pSuite pSuite = NULL;
- CU_pTest pTest = NULL;
-
- printf("%5s: %2s: %8s: %s\n", "What", "ID", "Status", "Name");
-
- for (iSuite = 0; suites[iSuite].pName != NULL; iSuite++) {
-
- pSuite = CU_get_suite_by_index((unsigned int) iSuite + 1,
- CU_get_registry());
-
- if (!pSuite) {
- fprintf(stderr, "Invalid suite id : %d\n", iSuite + 1);
- continue;
- }
-
- printf("Suite: %2d: %8s: %s\n",
- iSuite + 1,
- pSuite->fActive ? "ENABLED" : "DISABLED",
- suites[iSuite].pName);
-
- if (!pSuite->fActive)
- continue;
-
- for (iTest = 0; suites[iSuite].pTests[iTest].pName != NULL;
- iTest++) {
- pTest = CU_get_test_by_index((unsigned int) iTest + 1,
- pSuite);
- if (!pTest) {
- fprintf(stderr, "Invalid test id : %d\n", iTest + 1);
- continue;
- }
- printf(" Test: %2d: %8s: %s\n",
- iTest + 1,
- pSuite->fActive && pTest->fActive ? "ENABLED" : "DISABLED",
- suites[iSuite].pTests[iTest].pName);
- }
- }
-}
-
-/** Help string for command line parameters */
-static const char usage[] =
- "Usage: %s [-hlpr] [-s <suite id>] [-e <s>[.<t>] [-e ...]] [-t <test id>] [-f] "
- "[-b <pci_bus_id>] [-d <pci_device_id>]\n"
- "Where,\n"
- " -b Specify device's PCI bus id to run tests\n"
- " -d Specify device's PCI device id to run tests (optional)\n"
- " -e <s>[.<t>] Disable test <t> of suite <s>. If only <s> is given, then disable\n"
- " the whole suite. Can be specified more than once on the command line\n"
- " to disable multiple tests or suites.\n"
- " -f Force executing inactive suite or test\n"
- " -h Display this help\n"
- " -l Display all test suites and their tests\n"
- " -p Display information of AMDGPU devices in system\n"
- " -r Run the tests on render node\n"
- " -s <s> Enable only test suite <s>\n"
- " -t <t> Enable only test <t> of test suite <s>\n";
-/** Specified options strings for getopt */
-static const char options[] = "hlrps:t:e:b:d:f";
-
-/* Open AMD devices.
- * Return the number of AMD device opened.
- */
-static int amdgpu_open_devices(int open_render_node)
-{
- drmDevicePtr devices[MAX_CARDS_SUPPORTED];
- int i;
- int drm_node;
- int amd_index = 0;
- int drm_count;
- int fd;
- drmVersionPtr version;
-
- for (i = 0; i < MAX_CARDS_SUPPORTED; i++) {
- drm_amdgpu[i] = -1;
- }
-
- drm_count = drmGetDevices2(0, devices, MAX_CARDS_SUPPORTED);
-
- if (drm_count < 0) {
- fprintf(stderr,
- "drmGetDevices2() returned an error %d\n",
- drm_count);
- return 0;
- }
-
- for (i = 0; i < drm_count; i++) {
- /* If this is not PCI device, skip*/
- if (devices[i]->bustype != DRM_BUS_PCI)
- continue;
-
- /* If this is not AMD GPU vender ID, skip*/
- if (devices[i]->deviceinfo.pci->vendor_id != 0x1002)
- continue;
-
- if (open_render_node)
- drm_node = DRM_NODE_RENDER;
- else
- drm_node = DRM_NODE_PRIMARY;
-
- fd = -1;
- if (devices[i]->available_nodes & 1 << drm_node)
- fd = open(
- devices[i]->nodes[drm_node],
- O_RDWR | O_CLOEXEC);
-
- /* This node is not available. */
- if (fd < 0) continue;
-
- version = drmGetVersion(fd);
- if (!version) {
- fprintf(stderr,
- "Warning: Cannot get version for %s."
- "Error is %s\n",
- devices[i]->nodes[drm_node],
- strerror(errno));
- close(fd);
- continue;
- }
-
- if (strcmp(version->name, "amdgpu")) {
- /* This is not AMDGPU driver, skip.*/
- drmFreeVersion(version);
- close(fd);
- continue;
- }
-
- drmFreeVersion(version);
-
- drm_amdgpu[amd_index] = fd;
- amd_index++;
- }
-
- drmFreeDevices(devices, drm_count);
- return amd_index;
-}
-
-/* Close AMD devices.
- */
-void amdgpu_close_devices()
-{
- int i;
- for (i = 0; i < MAX_CARDS_SUPPORTED; i++)
- if (drm_amdgpu[i] >=0) {
- close(drm_amdgpu[i]);
- }
-}
-
-/* Print AMD devices information */
-static void amdgpu_print_devices()
-{
- int i;
- drmDevicePtr device;
-
- /* Open the first AMD device to print driver information. */
- if (drm_amdgpu[0] >=0) {
- /* Display AMD driver version information.*/
- drmVersionPtr retval = drmGetVersion(drm_amdgpu[0]);
-
- if (retval == NULL) {
- perror("Cannot get version for AMDGPU device");
- return;
- }
-
- printf("Driver name: %s, Date: %s, Description: %s.\n",
- retval->name, retval->date, retval->desc);
- drmFreeVersion(retval);
- }
-
- /* Display information of AMD devices */
- printf("Devices:\n");
- for (i = 0; i < MAX_CARDS_SUPPORTED && drm_amdgpu[i] >=0; i++)
- if (drmGetDevice2(drm_amdgpu[i],
- DRM_DEVICE_GET_PCI_REVISION,
- &device) == 0) {
- if (device->bustype == DRM_BUS_PCI) {
- printf("PCI ");
- printf(" domain:%04x",
- device->businfo.pci->domain);
- printf(" bus:%02x",
- device->businfo.pci->bus);
- printf(" device:%02x",
- device->businfo.pci->dev);
- printf(" function:%01x",
- device->businfo.pci->func);
- printf(" vendor_id:%04x",
- device->deviceinfo.pci->vendor_id);
- printf(" device_id:%04x",
- device->deviceinfo.pci->device_id);
- printf(" subvendor_id:%04x",
- device->deviceinfo.pci->subvendor_id);
- printf(" subdevice_id:%04x",
- device->deviceinfo.pci->subdevice_id);
- printf(" revision_id:%02x",
- device->deviceinfo.pci->revision_id);
- printf("\n");
- }
- drmFreeDevice(&device);
- }
-}
-
-/* Find a match AMD device in PCI bus
- * Return the index of the device or -1 if not found
- */
-static int amdgpu_find_device(uint8_t bus, uint16_t dev)
-{
- int i;
- drmDevicePtr device;
-
- for (i = 0; i < MAX_CARDS_SUPPORTED && drm_amdgpu[i] >= 0; i++) {
- if (drmGetDevice2(drm_amdgpu[i],
- DRM_DEVICE_GET_PCI_REVISION,
- &device) == 0) {
- if (device->bustype == DRM_BUS_PCI)
- if ((bus == 0xFF || device->businfo.pci->bus == bus) &&
- device->deviceinfo.pci->device_id == dev) {
- drmFreeDevice(&device);
- return i;
- }
-
- drmFreeDevice(&device);
- }
- }
-
- return -1;
-}
-
-static void amdgpu_disable_suites()
-{
- amdgpu_device_handle device_handle;
- uint32_t major_version, minor_version, family_id;
- drmDevicePtr devices[MAX_CARDS_SUPPORTED];
- int i, drm_count;
- int size = sizeof(suites_active_stat) / sizeof(suites_active_stat[0]);
-
- if (amdgpu_device_initialize(drm_amdgpu[0], &major_version,
- &minor_version, &device_handle))
- return;
-
- family_id = device_handle->info.family_id;
-
- if (amdgpu_device_deinitialize(device_handle))
- return;
-
- drm_count = drmGetDevices2(0, devices, MAX_CARDS_SUPPORTED);
-
- /* Set active status for suites based on their policies */
- for (i = 0; i < size; ++i)
- if (amdgpu_set_suite_active(suites_active_stat[i].pName,
- suites_active_stat[i].pActive()))
- fprintf(stderr, "suite deactivation failed - %s\n", CU_get_error_msg());
-
- /* Explicitly disable specific tests due to known bugs or preferences */
- /*
- * BUG: Compute ring stalls and never recovers when the address is
- * written after the command already submitted
- */
- if (amdgpu_set_test_active(DEADLOCK_TESTS_STR,
- "compute ring block test (set amdgpu.lockup_timeout=50)", CU_FALSE))
- fprintf(stderr, "test deactivation failed - %s\n", CU_get_error_msg());
-
- if (amdgpu_set_test_active(DEADLOCK_TESTS_STR,
- "sdma ring block test (set amdgpu.lockup_timeout=50)", CU_FALSE))
- fprintf(stderr, "test deactivation failed - %s\n", CU_get_error_msg());
-
- /* This test was ran on GFX9 only */
- //if (family_id < AMDGPU_FAMILY_AI || family_id > AMDGPU_FAMILY_RV)
- if (amdgpu_set_test_active(DEADLOCK_TESTS_STR,
- "gfx ring bad dispatch test (set amdgpu.lockup_timeout=50)", CU_FALSE))
- fprintf(stderr, "test deactivation failed - %s\n", CU_get_error_msg());
-
- /* This test was ran on GFX9 only */
- //if (family_id < AMDGPU_FAMILY_AI || family_id > AMDGPU_FAMILY_RV)
- if (amdgpu_set_test_active(DEADLOCK_TESTS_STR,
- "compute ring bad dispatch test (set amdgpu.lockup_timeout=50,50)", CU_FALSE))
- fprintf(stderr, "test deactivation failed - %s\n", CU_get_error_msg());
-
- /* This test was ran on GFX9 only */
- //if (family_id < AMDGPU_FAMILY_AI || family_id > AMDGPU_FAMILY_RV)
- if (amdgpu_set_test_active(DEADLOCK_TESTS_STR,
- "gfx ring bad slow dispatch test (set amdgpu.lockup_timeout=50)", CU_FALSE))
- fprintf(stderr, "test deactivation failed - %s\n", CU_get_error_msg());
-
- /* This test was ran on GFX9 only */
- //if (family_id < AMDGPU_FAMILY_AI || family_id > AMDGPU_FAMILY_RV)
- if (amdgpu_set_test_active(DEADLOCK_TESTS_STR,
- "compute ring bad slow dispatch test (set amdgpu.lockup_timeout=50,50)", CU_FALSE))
- fprintf(stderr, "test deactivation failed - %s\n", CU_get_error_msg());
-
- //if (family_id < AMDGPU_FAMILY_AI || family_id > AMDGPU_FAMILY_RV)
- if (amdgpu_set_test_active(DEADLOCK_TESTS_STR,
- "gfx ring bad draw test (set amdgpu.lockup_timeout=50)", CU_FALSE))
- fprintf(stderr, "test deactivation failed - %s\n", CU_get_error_msg());
-
- /* This test was ran on GFX9 only */
- //if (family_id < AMDGPU_FAMILY_AI || family_id > AMDGPU_FAMILY_RV)
- if (amdgpu_set_test_active(DEADLOCK_TESTS_STR,
- "gfx ring slow bad draw test (set amdgpu.lockup_timeout=50)", CU_FALSE))
- fprintf(stderr, "test deactivation failed - %s\n", CU_get_error_msg());
-
- if (amdgpu_set_test_active(DEADLOCK_TESTS_STR,
- "sdma ring corrupted header test (set amdgpu.lockup_timeout=50)", CU_FALSE))
- fprintf(stderr, "test deactivation failed - %s\n", CU_get_error_msg());
-
- if (amdgpu_set_test_active(DEADLOCK_TESTS_STR,
- "sdma ring slow linear copy test (set amdgpu.lockup_timeout=50)", CU_FALSE))
- fprintf(stderr, "test deactivation failed - %s\n", CU_get_error_msg());
-
- if (amdgpu_set_test_active(BASIC_TESTS_STR, "bo eviction Test", CU_FALSE))
- fprintf(stderr, "test deactivation failed - %s\n", CU_get_error_msg());
-
- /* This test was ran on GFX8 and GFX9 only */
- if (family_id < AMDGPU_FAMILY_VI || family_id > AMDGPU_FAMILY_RV)
- if (amdgpu_set_test_active(BASIC_TESTS_STR, "Sync dependency Test", CU_FALSE))
- fprintf(stderr, "test deactivation failed - %s\n", CU_get_error_msg());
-
- /* This test was ran on GFX9 only */
- if (family_id < AMDGPU_FAMILY_AI || family_id > AMDGPU_FAMILY_RV) {
- if (amdgpu_set_test_active(BASIC_TESTS_STR, "Dispatch Test (GFX)", CU_FALSE))
- fprintf(stderr, "test deactivation failed - %s\n", CU_get_error_msg());
- if (amdgpu_set_test_active(BASIC_TESTS_STR, "Dispatch Test (Compute)", CU_FALSE))
- fprintf(stderr, "test deactivation failed - %s\n", CU_get_error_msg());
- }
-
- /* This test was ran on GFX9 only */
- if (family_id < AMDGPU_FAMILY_AI || family_id > AMDGPU_FAMILY_RV)
- if (amdgpu_set_test_active(BASIC_TESTS_STR, "Draw Test", CU_FALSE))
- fprintf(stderr, "test deactivation failed - %s\n", CU_get_error_msg());
-
- /* This test was ran on GFX9 only */
- //if (family_id < AMDGPU_FAMILY_AI || family_id > AMDGPU_FAMILY_RV)
- if (amdgpu_set_test_active(BASIC_TESTS_STR, "GPU reset Test", CU_FALSE))
- fprintf(stderr, "test deactivation failed - %s\n", CU_get_error_msg());
-
- /* You need at least 2 devices for this */
- if (drm_count < 2)
- if (amdgpu_set_test_active(HOTUNPLUG_TESTS_STR, "Unplug with exported fence", CU_FALSE))
- fprintf(stderr, "test deactivation failed - %s\n", CU_get_error_msg());
-}
-
-int test_device_index;
-
-int amdgpu_open_device_on_test_index(int render_node)
-{
- int i;
-
- if (amdgpu_open_devices(open_render_node) <= 0) {
- perror("Cannot open AMDGPU device");
- return -1;
- }
-
- if (test_device_index >= 0) {
- /* Most tests run on device of drm_amdgpu[0].
- * Swap the chosen device to drm_amdgpu[0].
- */
- i = drm_amdgpu[0];
- drm_amdgpu[0] = drm_amdgpu[test_device_index];
- drm_amdgpu[test_device_index] = i;
- }
-
- return 0;
-
-
-}
-
-
-static bool amdgpu_node_is_drm(int maj, int min)
-{
-#ifdef __linux__
- char path[64];
- struct stat sbuf;
-
- snprintf(path, sizeof(path), "/sys/dev/char/%d:%d/device/drm",
- maj, min);
- return stat(path, &sbuf) == 0;
-#elif defined(__FreeBSD__)
- char name[SPECNAMELEN];
-
- if (!devname_r(makedev(maj, min), S_IFCHR, name, sizeof(name)))
- return 0;
- /* Handle drm/ and dri/ as both are present in different FreeBSD version
- * FreeBSD on amd64/i386/powerpc external kernel modules create node in
- * in /dev/drm/ and links in /dev/dri while a WIP in kernel driver creates
- * only device nodes in /dev/dri/ */
- return (!strncmp(name, "drm/", 4) || !strncmp(name, "dri/", 4));
-#else
- return maj == DRM_MAJOR;
-#endif
-}
-
-char *amdgpu_get_device_from_fd(int fd)
-{
-#ifdef __linux__
- struct stat sbuf;
- char path[PATH_MAX + 1];
- unsigned int maj, min;
-
- if (fstat(fd, &sbuf))
- return NULL;
-
- maj = major(sbuf.st_rdev);
- min = minor(sbuf.st_rdev);
-
- if (!amdgpu_node_is_drm(maj, min) || !S_ISCHR(sbuf.st_mode))
- return NULL;
-
- snprintf(path, sizeof(path), "/sys/dev/char/%d:%d/device", maj, min);
- return strdup(path);
-#else
- return NULL;
-#endif
-}
-
-#ifndef ARRAY_SIZE
-#define ARRAY_SIZE(_A) (sizeof(_A)/sizeof(_A[0]))
-#endif
-
-static void amdgpu_test_disable(long suite, long test)
-{
- const char *suite_name;
-
- if (suite < 1)
- return;
-
- /* The array is 0-based, so subract 1. */
- suite--;
- if (suite >= ARRAY_SIZE(suites) - 1)
- return;
-
- suite_name = suites[suite].pName;
- if (test < 1) {
- fprintf(stderr, "Deactivating suite %s\n", suite_name);
- amdgpu_set_suite_active(suite_name, CU_FALSE);
- } else {
- int ii;
-
- /* The array is 0-based so subtract 1. */
- test--;
- for (ii = 0; suites[suite].pTests[ii].pName; ii++) {
- if (ii == test) {
- fprintf(stderr, "Deactivating %s:%s\n",
- suite_name,
- suites[suite].pTests[ii].pName);
- amdgpu_set_test_active(suite_name,
- suites[suite].pTests[ii].pName,
- CU_FALSE);
- break;
- }
- }
-
- if (suites[suite].pTests[ii].pName == NULL)
- fprintf(stderr, "No such suite.test %ld.%ld\n", suite, test);
- }
-}
-
-/* The main() function for setting up and running the tests.
- * Returns a CUE_SUCCESS on successful running, another
- * CUnit error code on failure.
- */
-int main(int argc, char **argv)
-{
- int c; /* Character received from getopt */
- int i = 0;
- int suite_id = -1; /* By default run everything */
- int test_id = -1; /* By default run all tests in the suite */
- int pci_bus_id = -1; /* By default PC bus ID is not specified */
- int pci_device_id = 0; /* By default PC device ID is zero */
- int display_devices = 0;/* By default not to display devices' info */
- CU_pSuite pSuite = NULL;
- CU_pTest pTest = NULL;
- int display_list = 0;
- int force_run = 0;
-
- /* Parse command line string.
- * Process various command line options as early as possible.
- */
- opterr = 0; /* Do not print error messages from getopt */
- while ((c = getopt(argc, argv, options)) != -1) {
- switch (c) {
- case 'h':
- fprintf(stderr, usage, argv[0]);
- exit(EXIT_SUCCESS);
- }
- }
-
- for (i = 0; i < MAX_CARDS_SUPPORTED; i++)
- drm_amdgpu[i] = -1;
-
- if (amdgpu_open_devices(open_render_node) <= 0) {
- perror("Cannot open AMDGPU device");
- exit(EXIT_FAILURE);
- }
-
- if (drm_amdgpu[0] < 0) {
- perror("Cannot open AMDGPU device");
- exit(EXIT_FAILURE);
- }
-
- /* Parse command line string */
- opterr = 0; /* Do not print error messages from getopt */
- optind = 1;
- while ((c = getopt(argc, argv, options)) != -1) {
- switch (c) {
- case 'p':
- display_devices = 1;
- break;
- }
- }
-
- if (display_devices) {
- amdgpu_print_devices();
- amdgpu_close_devices();
- exit(EXIT_SUCCESS);
- }
-
- /* Parse command line string */
- opterr = 0; /* Do not print error messages from getopt */
- optind = 1;
- while ((c = getopt(argc, argv, options)) != -1) {
- switch (c) {
- case 'b':
- pci_bus_id = atoi(optarg);
- break;
- case 'd':
- sscanf(optarg, "%x", &pci_device_id);
- break;
- }
- }
-
- if (pci_bus_id > 0 || pci_device_id) {
- /* A device was specified to run the test */
- test_device_index = amdgpu_find_device(pci_bus_id,
- pci_device_id);
-
- if (test_device_index >= 0) {
- /* Most tests run on device of drm_amdgpu[0].
- * Swap the chosen device to drm_amdgpu[0].
- */
- i = drm_amdgpu[0];
- drm_amdgpu[0] = drm_amdgpu[test_device_index];
- drm_amdgpu[test_device_index] = i;
- } else {
- fprintf(stderr,
- "The specified GPU device does not exist.\n");
- exit(EXIT_FAILURE);
- }
- }
-
- /* Initialize test suites to run */
-
- /* initialize the CUnit test registry */
- if (CUE_SUCCESS != CU_initialize_registry()) {
- amdgpu_close_devices();
- return CU_get_error();
- }
-
- /* Register suites. */
- if (CU_register_suites(suites) != CUE_SUCCESS) {
- fprintf(stderr, "suite registration failed - %s\n",
- CU_get_error_msg());
- CU_cleanup_registry();
- amdgpu_close_devices();
- exit(EXIT_FAILURE);
- }
-
- /* Run tests using the CUnit Basic interface */
- CU_basic_set_mode(CU_BRM_VERBOSE);
-
- /* Disable suites and individual tests based on misc. conditions */
- amdgpu_disable_suites();
-
- /* Parse command line string */
- opterr = 0; /* Do not print error messages from getopt */
- optind = 1;
- while ((c = getopt(argc, argv, options)) != -1) {
- switch (c) {
- case 'l':
- display_list = 1;
- break;
- }
- }
-
- if (display_list) {
- display_test_suites();
- goto end;
- }
-
- /* Parse command line string */
- opterr = 0; /* Do not print error messages from getopt */
- optind = 1;
- while ((c = getopt(argc, argv, options)) != -1) {
- long esuite = -1;
- long etest = -1;
- char *endp;
- switch (c) {
- case 's':
- suite_id = atoi(optarg);
- break;
- case 't':
- test_id = atoi(optarg);
- break;
- case 'r':
- open_render_node = 1;
- break;
- case 'f':
- force_run = 1;
- break;
- case 'e':
- esuite = strtol(optarg, &endp, 0);
- if (endp == optarg) {
- fprintf(stderr, "No digits given for -e argument\n");
- goto end;
- } else if (endp && *endp == '.' && esuite > 0) {
- char *tt = endp + 1;
- etest = strtol(tt, &endp, 0);
- if (endp == tt) {
- fprintf(stderr, "No digits given for test in -e s.t argument\n");
- goto end;
- } else if (endp && *endp != '\0') {
- fprintf(stderr, "Bad input given for test in -e s.t argument\n");
- goto end;
- } else if (etest < 1) {
- fprintf(stderr, "Test in -e s.t argument cannot be smaller than 1\n");
- goto end;
- }
- } else if (endp && *endp != '\0') {
- fprintf(stderr, "Bad input given for suite for -e s argument\n");
- goto end;
- } else if (esuite < 1) {
- fprintf(stderr, "Suite in -e s argument cannot be smaller than 1\n");
- goto end;
- }
- amdgpu_test_disable(esuite, etest);
- break;
- case 'h':
- case 'p':
- case 'b':
- case 'd':
- case 'l':
- /* Those have been processed earlier.
- */
- break;
- case '?':
- default:
- fprintf(stderr, "Unknown command line option '%c'. Try -h.\n",
- c == '?' ? optopt : c);
- goto end;
- }
- }
-
- if (suite_id != -1) { /* If user specify particular suite? */
- pSuite = CU_get_suite_by_index((unsigned int) suite_id,
- CU_get_registry());
-
- if (pSuite) {
-
- if (force_run)
- CU_set_suite_active(pSuite, CU_TRUE);
-
- if (test_id != -1) { /* If user specify test id */
- pTest = CU_get_test_by_index(
- (unsigned int) test_id,
- pSuite);
- if (pTest) {
- if (force_run)
- CU_set_test_active(pTest, CU_TRUE);
-
- CU_basic_run_test(pSuite, pTest);
- }
- else {
- fprintf(stderr, "Invalid test id: %d\n",
- test_id);
- CU_cleanup_registry();
- amdgpu_close_devices();
- exit(EXIT_FAILURE);
- }
- } else
- CU_basic_run_suite(pSuite);
- } else {
- fprintf(stderr, "Invalid suite id : %d\n",
- suite_id);
- CU_cleanup_registry();
- amdgpu_close_devices();
- exit(EXIT_FAILURE);
- }
- } else
- CU_basic_run_tests();
-
-end:
- CU_cleanup_registry();
- amdgpu_close_devices();
- return CU_get_error();
-}
diff --git a/tests/amdgpu/amdgpu_test.h b/tests/amdgpu/amdgpu_test.h
deleted file mode 100644
index e2ba043b..00000000
--- a/tests/amdgpu/amdgpu_test.h
+++ /dev/null
@@ -1,546 +0,0 @@
-/*
- * Copyright 2014 Advanced Micro Devices, Inc.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- *
-*/
-
-#ifndef _AMDGPU_TEST_H_
-#define _AMDGPU_TEST_H_
-
-#include "amdgpu.h"
-#include "amdgpu_drm.h"
-
-/**
- * Define max. number of card in system which we are able to handle
- */
-#define MAX_CARDS_SUPPORTED 128
-
-/* Forward reference for array to keep "drm" handles */
-extern int drm_amdgpu[MAX_CARDS_SUPPORTED];
-
-/* Global variables */
-extern int open_render_node;
-
-/************************* Basic test suite ********************************/
-
-/*
- * Define basic test suite to serve as the starting point for future testing
-*/
-
-/**
- * Initialize basic test suite
- */
-int suite_basic_tests_init();
-
-/**
- * Deinitialize basic test suite
- */
-int suite_basic_tests_clean();
-
-/**
- * Decide if the suite is enabled by default or not.
- */
-CU_BOOL suite_basic_tests_enable(void);
-
-/**
- * Tests in basic test suite
- */
-extern CU_TestInfo basic_tests[];
-
-/**
- * Initialize bo test suite
- */
-int suite_bo_tests_init();
-
-/**
- * Deinitialize bo test suite
- */
-int suite_bo_tests_clean();
-
-/**
- * Tests in bo test suite
- */
-extern CU_TestInfo bo_tests[];
-
-/**
- * Initialize cs test suite
- */
-int suite_cs_tests_init();
-
-/**
- * Deinitialize cs test suite
- */
-int suite_cs_tests_clean();
-
-/**
- * Decide if the suite is enabled by default or not.
- */
-CU_BOOL suite_cs_tests_enable(void);
-
-/**
- * Tests in cs test suite
- */
-extern CU_TestInfo cs_tests[];
-
-/**
- * Initialize vce test suite
- */
-int suite_vce_tests_init();
-
-/**
- * Deinitialize vce test suite
- */
-int suite_vce_tests_clean();
-
-/**
- * Decide if the suite is enabled by default or not.
- */
-CU_BOOL suite_vce_tests_enable(void);
-
-/**
- * Tests in vce test suite
- */
-extern CU_TestInfo vce_tests[];
-
-/**
-+ * Initialize vcn test suite
-+ */
-int suite_vcn_tests_init();
-
-/**
-+ * Deinitialize vcn test suite
-+ */
-int suite_vcn_tests_clean();
-
-/**
- * Decide if the suite is enabled by default or not.
- */
-CU_BOOL suite_vcn_tests_enable(void);
-
-/**
-+ * Tests in vcn test suite
-+ */
-extern CU_TestInfo vcn_tests[];
-
-/**
-+ * Initialize jpeg test suite
-+ */
-int suite_jpeg_tests_init();
-
-/**
-+ * Deinitialize jpeg test suite
-+ */
-int suite_jpeg_tests_clean();
-
-/**
- * Decide if the suite is enabled by default or not.
- */
-CU_BOOL suite_jpeg_tests_enable(void);
-
-/**
-+ * Tests in vcn test suite
-+ */
-extern CU_TestInfo jpeg_tests[];
-
-/**
- * Initialize uvd enc test suite
- */
-int suite_uvd_enc_tests_init();
-
-/**
- * Deinitialize uvd enc test suite
- */
-int suite_uvd_enc_tests_clean();
-
-/**
- * Decide if the suite is enabled by default or not.
- */
-CU_BOOL suite_uvd_enc_tests_enable(void);
-
-/**
- * Tests in uvd enc test suite
- */
-extern CU_TestInfo uvd_enc_tests[];
-
-/**
- * Initialize deadlock test suite
- */
-int suite_deadlock_tests_init();
-
-/**
- * Deinitialize deadlock test suite
- */
-int suite_deadlock_tests_clean();
-
-/**
- * Decide if the suite is enabled by default or not.
- */
-CU_BOOL suite_deadlock_tests_enable(void);
-
-/**
- * Tests in uvd enc test suite
- */
-extern CU_TestInfo deadlock_tests[];
-
-/**
- * Initialize vm test suite
- */
-int suite_vm_tests_init();
-
-/**
- * Deinitialize deadlock test suite
- */
-int suite_vm_tests_clean();
-
-/**
- * Decide if the suite is enabled by default or not.
- */
-CU_BOOL suite_vm_tests_enable(void);
-
-/**
- * Tests in vm test suite
- */
-extern CU_TestInfo vm_tests[];
-
-
-/**
- * Initialize ras test suite
- */
-int suite_ras_tests_init();
-
-/**
- * Deinitialize deadlock test suite
- */
-int suite_ras_tests_clean();
-
-/**
- * Decide if the suite is enabled by default or not.
- */
-CU_BOOL suite_ras_tests_enable(void);
-
-/**
- * Tests in ras test suite
- */
-extern CU_TestInfo ras_tests[];
-
-
-/**
- * Initialize syncobj timeline test suite
- */
-int suite_syncobj_timeline_tests_init();
-
-/**
- * Deinitialize syncobj timeline test suite
- */
-int suite_syncobj_timeline_tests_clean();
-
-/**
- * Decide if the suite is enabled by default or not.
- */
-CU_BOOL suite_syncobj_timeline_tests_enable(void);
-
-/**
- * Tests in syncobj timeline test suite
- */
-extern CU_TestInfo syncobj_timeline_tests[];
-
-
-/**
- * Initialize cp dma test suite
- */
-int suite_cp_dma_tests_init();
-
-/**
- * Deinitialize cp dma test suite
- */
-int suite_cp_dma_tests_clean();
-
-/**
- * Decide if the suite is enabled by default or not.
- */
-CU_BOOL suite_cp_dma_tests_enable(void);
-
-/**
- * Tests in cp dma test suite
- */
-extern CU_TestInfo cp_dma_tests[];
-
-/**
- * Initialize security test suite
- */
-int suite_security_tests_init();
-
-/**
- * Deinitialize security test suite
- */
-int suite_security_tests_clean();
-
-/**
- * Decide if the suite is enabled by default or not.
- */
-CU_BOOL suite_security_tests_enable(void);
-
-/**
- * Tests in security test suite
- */
-extern CU_TestInfo security_tests[];
-
-extern void
-amdgpu_command_submission_write_linear_helper_with_secure(amdgpu_device_handle
- device,
- unsigned ip_type,
- bool secure);
-
-extern void amdgpu_test_dispatch_helper(amdgpu_device_handle device_handle, unsigned ip);
-extern void amdgpu_test_dispatch_hang_helper(amdgpu_device_handle device_handle, uint32_t ip);
-extern void amdgpu_test_dispatch_hang_slow_helper(amdgpu_device_handle device_handle, uint32_t ip);
-extern void amdgpu_test_draw_helper(amdgpu_device_handle device_handle);
-extern void amdgpu_test_draw_hang_helper(amdgpu_device_handle device_handle);
-extern void amdgpu_test_draw_hang_slow_helper(amdgpu_device_handle device_handle);
-
-/**
- * Initialize hotunplug test suite
- */
-int suite_hotunplug_tests_init();
-
-/**
- * Deinitialize hotunplug test suite
- */
-int suite_hotunplug_tests_clean();
-
-/**
- * Decide if the suite is enabled by default or not.
- */
-CU_BOOL suite_hotunplug_tests_enable(void);
-
-/**
- * Tests in uvd enc test suite
- */
-extern CU_TestInfo hotunplug_tests[];
-
-
-/**
- * Helper functions
- */
-static inline amdgpu_bo_handle gpu_mem_alloc(
- amdgpu_device_handle device_handle,
- uint64_t size,
- uint64_t alignment,
- uint32_t type,
- uint64_t flags,
- uint64_t *vmc_addr,
- amdgpu_va_handle *va_handle)
-{
- struct amdgpu_bo_alloc_request req = {0};
- amdgpu_bo_handle buf_handle = NULL;
- int r;
-
- req.alloc_size = size;
- req.phys_alignment = alignment;
- req.preferred_heap = type;
- req.flags = flags;
-
- r = amdgpu_bo_alloc(device_handle, &req, &buf_handle);
- CU_ASSERT_EQUAL(r, 0);
- if (r)
- return NULL;
-
- if (vmc_addr && va_handle) {
- r = amdgpu_va_range_alloc(device_handle,
- amdgpu_gpu_va_range_general,
- size, alignment, 0, vmc_addr,
- va_handle, 0);
- CU_ASSERT_EQUAL(r, 0);
- if (r)
- goto error_free_bo;
-
- r = amdgpu_bo_va_op(buf_handle, 0, size, *vmc_addr, 0,
- AMDGPU_VA_OP_MAP);
- CU_ASSERT_EQUAL(r, 0);
- if (r)
- goto error_free_va;
- }
-
- return buf_handle;
-
-error_free_va:
- r = amdgpu_va_range_free(*va_handle);
- CU_ASSERT_EQUAL(r, 0);
-
-error_free_bo:
- r = amdgpu_bo_free(buf_handle);
- CU_ASSERT_EQUAL(r, 0);
-
- return NULL;
-}
-
-static inline int gpu_mem_free(amdgpu_bo_handle bo,
- amdgpu_va_handle va_handle,
- uint64_t vmc_addr,
- uint64_t size)
-{
- int r;
-
- if (!bo)
- return 0;
-
- if (va_handle) {
- r = amdgpu_bo_va_op(bo, 0, size, vmc_addr, 0,
- AMDGPU_VA_OP_UNMAP);
- CU_ASSERT_EQUAL(r, 0);
- if (r)
- return r;
-
- r = amdgpu_va_range_free(va_handle);
- CU_ASSERT_EQUAL(r, 0);
- if (r)
- return r;
- }
-
- r = amdgpu_bo_free(bo);
- CU_ASSERT_EQUAL(r, 0);
-
- return r;
-}
-
-static inline int
-amdgpu_bo_alloc_wrap(amdgpu_device_handle dev, unsigned size,
- unsigned alignment, unsigned heap, uint64_t flags,
- amdgpu_bo_handle *bo)
-{
- struct amdgpu_bo_alloc_request request = {};
- amdgpu_bo_handle buf_handle;
- int r;
-
- request.alloc_size = size;
- request.phys_alignment = alignment;
- request.preferred_heap = heap;
- request.flags = flags;
-
- r = amdgpu_bo_alloc(dev, &request, &buf_handle);
- if (r)
- return r;
-
- *bo = buf_handle;
-
- return 0;
-}
-
-int amdgpu_bo_alloc_and_map_raw(amdgpu_device_handle dev, unsigned size,
- unsigned alignment, unsigned heap, uint64_t alloc_flags,
- uint64_t mapping_flags, amdgpu_bo_handle *bo, void **cpu,
- uint64_t *mc_address,
- amdgpu_va_handle *va_handle);
-
-static inline int
-amdgpu_bo_alloc_and_map(amdgpu_device_handle dev, unsigned size,
- unsigned alignment, unsigned heap, uint64_t alloc_flags,
- amdgpu_bo_handle *bo, void **cpu, uint64_t *mc_address,
- amdgpu_va_handle *va_handle)
-{
- return amdgpu_bo_alloc_and_map_raw(dev, size, alignment, heap,
- alloc_flags, 0, bo, cpu, mc_address, va_handle);
-}
-
-static inline int
-amdgpu_bo_unmap_and_free(amdgpu_bo_handle bo, amdgpu_va_handle va_handle,
- uint64_t mc_addr, uint64_t size)
-{
- amdgpu_bo_cpu_unmap(bo);
- amdgpu_bo_va_op(bo, 0, size, mc_addr, 0, AMDGPU_VA_OP_UNMAP);
- amdgpu_va_range_free(va_handle);
- amdgpu_bo_free(bo);
-
- return 0;
-
-}
-
-static inline int
-amdgpu_get_bo_list(amdgpu_device_handle dev, amdgpu_bo_handle bo1,
- amdgpu_bo_handle bo2, amdgpu_bo_list_handle *list)
-{
- amdgpu_bo_handle resources[] = {bo1, bo2};
-
- return amdgpu_bo_list_create(dev, bo2 ? 2 : 1, resources, NULL, list);
-}
-
-
-static inline CU_ErrorCode amdgpu_set_suite_active(const char *suite_name,
- CU_BOOL active)
-{
- CU_ErrorCode r = CU_set_suite_active(CU_get_suite(suite_name), active);
-
- if (r != CUE_SUCCESS)
- fprintf(stderr, "Failed to obtain suite %s\n", suite_name);
-
- return r;
-}
-
-static inline CU_ErrorCode amdgpu_set_test_active(const char *suite_name,
- const char *test_name, CU_BOOL active)
-{
- CU_ErrorCode r;
- CU_pSuite pSuite = CU_get_suite(suite_name);
-
- if (!pSuite) {
- fprintf(stderr, "Failed to obtain suite %s\n",
- suite_name);
- return CUE_NOSUITE;
- }
-
- r = CU_set_test_active(CU_get_test(pSuite, test_name), active);
- if (r != CUE_SUCCESS)
- fprintf(stderr, "Failed to obtain test %s\n", test_name);
-
- return r;
-}
-
-
-static inline bool asic_is_gfx_pipe_removed(uint32_t family_id, uint32_t chip_id, uint32_t chip_rev)
-{
-
- if (family_id != AMDGPU_FAMILY_AI)
- return false;
-
- switch (chip_id - chip_rev) {
- /* Arcturus */
- case 0x32:
- /* Aldebaran */
- case 0x3c:
- return true;
- default:
- return false;
- }
-}
-
-void amdgpu_test_exec_cs_helper_raw(amdgpu_device_handle device_handle,
- amdgpu_context_handle context_handle,
- unsigned ip_type, int instance, int pm4_dw,
- uint32_t *pm4_src, int res_cnt,
- amdgpu_bo_handle *resources,
- struct amdgpu_cs_ib_info *ib_info,
- struct amdgpu_cs_request *ibs_request,
- bool secure);
-
-void amdgpu_close_devices();
-int amdgpu_open_device_on_test_index(int render_node);
-char *amdgpu_get_device_from_fd(int fd);
-
-#endif /* #ifdef _AMDGPU_TEST_H_ */
diff --git a/tests/amdgpu/basic_tests.c b/tests/amdgpu/basic_tests.c
deleted file mode 100644
index 0e4a357b..00000000
--- a/tests/amdgpu/basic_tests.c
+++ /dev/null
@@ -1,2556 +0,0 @@
-/*
- * Copyright 2014 Advanced Micro Devices, Inc.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- *
-*/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <sys/types.h>
-#ifdef MAJOR_IN_SYSMACROS
-#include <sys/sysmacros.h>
-#endif
-#include <sys/stat.h>
-#include <fcntl.h>
-#if HAVE_ALLOCA_H
-# include <alloca.h>
-#endif
-#include <sys/wait.h>
-
-#include "CUnit/Basic.h"
-
-#include "amdgpu_test.h"
-#include "amdgpu_drm.h"
-#include "amdgpu_internal.h"
-#include "util_math.h"
-
-static amdgpu_device_handle device_handle;
-static uint32_t major_version;
-static uint32_t minor_version;
-static uint32_t family_id;
-static uint32_t chip_id;
-static uint32_t chip_rev;
-
-static void amdgpu_query_info_test(void);
-static void amdgpu_command_submission_gfx(void);
-static void amdgpu_command_submission_compute(void);
-static void amdgpu_command_submission_multi_fence(void);
-static void amdgpu_command_submission_sdma(void);
-static void amdgpu_userptr_test(void);
-static void amdgpu_semaphore_test(void);
-static void amdgpu_sync_dependency_test(void);
-static void amdgpu_bo_eviction_test(void);
-static void amdgpu_compute_dispatch_test(void);
-static void amdgpu_gfx_dispatch_test(void);
-static void amdgpu_draw_test(void);
-static void amdgpu_gpu_reset_test(void);
-static void amdgpu_stable_pstate_test(void);
-
-static void amdgpu_command_submission_write_linear_helper(unsigned ip_type);
-static void amdgpu_command_submission_const_fill_helper(unsigned ip_type);
-static void amdgpu_command_submission_copy_linear_helper(unsigned ip_type);
-static void amdgpu_test_exec_cs_helper(amdgpu_context_handle context_handle,
- unsigned ip_type,
- int instance, int pm4_dw, uint32_t *pm4_src,
- int res_cnt, amdgpu_bo_handle *resources,
- struct amdgpu_cs_ib_info *ib_info,
- struct amdgpu_cs_request *ibs_request);
-
-CU_TestInfo basic_tests[] = {
- { "Query Info Test", amdgpu_query_info_test },
- { "Userptr Test", amdgpu_userptr_test },
- { "bo eviction Test", amdgpu_bo_eviction_test },
- { "Command submission Test (GFX)", amdgpu_command_submission_gfx },
- { "Command submission Test (Compute)", amdgpu_command_submission_compute },
- { "Command submission Test (Multi-Fence)", amdgpu_command_submission_multi_fence },
- { "Command submission Test (SDMA)", amdgpu_command_submission_sdma },
- { "SW semaphore Test", amdgpu_semaphore_test },
- { "Sync dependency Test", amdgpu_sync_dependency_test },
- { "Dispatch Test (Compute)", amdgpu_compute_dispatch_test },
- { "Dispatch Test (GFX)", amdgpu_gfx_dispatch_test },
- { "Draw Test", amdgpu_draw_test },
- { "GPU reset Test", amdgpu_gpu_reset_test },
- { "Stable pstate Test", amdgpu_stable_pstate_test },
- CU_TEST_INFO_NULL,
-};
-#define BUFFER_SIZE (MAX2(8 * 1024, getpagesize()))
-#define SDMA_PKT_HEADER_op_offset 0
-#define SDMA_PKT_HEADER_op_mask 0x000000FF
-#define SDMA_PKT_HEADER_op_shift 0
-#define SDMA_PKT_HEADER_OP(x) (((x) & SDMA_PKT_HEADER_op_mask) << SDMA_PKT_HEADER_op_shift)
-#define SDMA_OPCODE_CONSTANT_FILL 11
-# define SDMA_CONSTANT_FILL_EXTRA_SIZE(x) ((x) << 14)
- /* 0 = byte fill
- * 2 = DW fill
- */
-#define SDMA_PACKET(op, sub_op, e) ((((e) & 0xFFFF) << 16) | \
- (((sub_op) & 0xFF) << 8) | \
- (((op) & 0xFF) << 0))
-#define SDMA_OPCODE_WRITE 2
-# define SDMA_WRITE_SUB_OPCODE_LINEAR 0
-# define SDMA_WRTIE_SUB_OPCODE_TILED 1
-
-#define SDMA_OPCODE_COPY 1
-# define SDMA_COPY_SUB_OPCODE_LINEAR 0
-
-#define SDMA_OPCODE_ATOMIC 10
-# define SDMA_ATOMIC_LOOP(x) ((x) << 0)
- /* 0 - single_pass_atomic.
- * 1 - loop_until_compare_satisfied.
- */
-# define SDMA_ATOMIC_TMZ(x) ((x) << 2)
- /* 0 - non-TMZ.
- * 1 - TMZ.
- */
-# define SDMA_ATOMIC_OPCODE(x) ((x) << 9)
- /* TC_OP_ATOMIC_CMPSWAP_RTN_32 0x00000008
- * same as Packet 3
- */
-
-#define GFX_COMPUTE_NOP 0xffff1000
-#define SDMA_NOP 0x0
-
-/* PM4 */
-#define PACKET_TYPE0 0
-#define PACKET_TYPE1 1
-#define PACKET_TYPE2 2
-#define PACKET_TYPE3 3
-
-#define CP_PACKET_GET_TYPE(h) (((h) >> 30) & 3)
-#define CP_PACKET_GET_COUNT(h) (((h) >> 16) & 0x3FFF)
-#define CP_PACKET0_GET_REG(h) ((h) & 0xFFFF)
-#define CP_PACKET3_GET_OPCODE(h) (((h) >> 8) & 0xFF)
-#define PACKET0(reg, n) ((PACKET_TYPE0 << 30) | \
- ((reg) & 0xFFFF) | \
- ((n) & 0x3FFF) << 16)
-#define CP_PACKET2 0x80000000
-#define PACKET2_PAD_SHIFT 0
-#define PACKET2_PAD_MASK (0x3fffffff << 0)
-
-#define PACKET2(v) (CP_PACKET2 | REG_SET(PACKET2_PAD, (v)))
-
-#define PACKET3(op, n) ((PACKET_TYPE3 << 30) | \
- (((op) & 0xFF) << 8) | \
- ((n) & 0x3FFF) << 16)
-#define PACKET3_COMPUTE(op, n) PACKET3(op, n) | (1 << 1)
-
-/* Packet 3 types */
-#define PACKET3_NOP 0x10
-
-#define PACKET3_WRITE_DATA 0x37
-#define WRITE_DATA_DST_SEL(x) ((x) << 8)
- /* 0 - register
- * 1 - memory (sync - via GRBM)
- * 2 - gl2
- * 3 - gds
- * 4 - reserved
- * 5 - memory (async - direct)
- */
-#define WR_ONE_ADDR (1 << 16)
-#define WR_CONFIRM (1 << 20)
-#define WRITE_DATA_CACHE_POLICY(x) ((x) << 25)
- /* 0 - LRU
- * 1 - Stream
- */
-#define WRITE_DATA_ENGINE_SEL(x) ((x) << 30)
- /* 0 - me
- * 1 - pfp
- * 2 - ce
- */
-
-#define PACKET3_ATOMIC_MEM 0x1E
-#define TC_OP_ATOMIC_CMPSWAP_RTN_32 0x00000008
-#define ATOMIC_MEM_COMMAND(x) ((x) << 8)
- /* 0 - single_pass_atomic.
- * 1 - loop_until_compare_satisfied.
- */
-#define ATOMIC_MEM_CACHEPOLICAY(x) ((x) << 25)
- /* 0 - lru.
- * 1 - stream.
- */
-#define ATOMIC_MEM_ENGINESEL(x) ((x) << 30)
- /* 0 - micro_engine.
- */
-
-#define PACKET3_DMA_DATA 0x50
-/* 1. header
- * 2. CONTROL
- * 3. SRC_ADDR_LO or DATA [31:0]
- * 4. SRC_ADDR_HI [31:0]
- * 5. DST_ADDR_LO [31:0]
- * 6. DST_ADDR_HI [7:0]
- * 7. COMMAND [30:21] | BYTE_COUNT [20:0]
- */
-/* CONTROL */
-# define PACKET3_DMA_DATA_ENGINE(x) ((x) << 0)
- /* 0 - ME
- * 1 - PFP
- */
-# define PACKET3_DMA_DATA_SRC_CACHE_POLICY(x) ((x) << 13)
- /* 0 - LRU
- * 1 - Stream
- * 2 - Bypass
- */
-# define PACKET3_DMA_DATA_SRC_VOLATILE (1 << 15)
-# define PACKET3_DMA_DATA_DST_SEL(x) ((x) << 20)
- /* 0 - DST_ADDR using DAS
- * 1 - GDS
- * 3 - DST_ADDR using L2
- */
-# define PACKET3_DMA_DATA_DST_CACHE_POLICY(x) ((x) << 25)
- /* 0 - LRU
- * 1 - Stream
- * 2 - Bypass
- */
-# define PACKET3_DMA_DATA_DST_VOLATILE (1 << 27)
-# define PACKET3_DMA_DATA_SRC_SEL(x) ((x) << 29)
- /* 0 - SRC_ADDR using SAS
- * 1 - GDS
- * 2 - DATA
- * 3 - SRC_ADDR using L2
- */
-# define PACKET3_DMA_DATA_CP_SYNC (1 << 31)
-/* COMMAND */
-# define PACKET3_DMA_DATA_DIS_WC (1 << 21)
-# define PACKET3_DMA_DATA_CMD_SRC_SWAP(x) ((x) << 22)
- /* 0 - none
- * 1 - 8 in 16
- * 2 - 8 in 32
- * 3 - 8 in 64
- */
-# define PACKET3_DMA_DATA_CMD_DST_SWAP(x) ((x) << 24)
- /* 0 - none
- * 1 - 8 in 16
- * 2 - 8 in 32
- * 3 - 8 in 64
- */
-# define PACKET3_DMA_DATA_CMD_SAS (1 << 26)
- /* 0 - memory
- * 1 - register
- */
-# define PACKET3_DMA_DATA_CMD_DAS (1 << 27)
- /* 0 - memory
- * 1 - register
- */
-# define PACKET3_DMA_DATA_CMD_SAIC (1 << 28)
-# define PACKET3_DMA_DATA_CMD_DAIC (1 << 29)
-# define PACKET3_DMA_DATA_CMD_RAW_WAIT (1 << 30)
-
-#define SDMA_PACKET_SI(op, b, t, s, cnt) ((((op) & 0xF) << 28) | \
- (((b) & 0x1) << 26) | \
- (((t) & 0x1) << 23) | \
- (((s) & 0x1) << 22) | \
- (((cnt) & 0xFFFFF) << 0))
-#define SDMA_OPCODE_COPY_SI 3
-#define SDMA_OPCODE_CONSTANT_FILL_SI 13
-#define SDMA_NOP_SI 0xf
-#define GFX_COMPUTE_NOP_SI 0x80000000
-#define PACKET3_DMA_DATA_SI 0x41
-# define PACKET3_DMA_DATA_SI_ENGINE(x) ((x) << 27)
- /* 0 - ME
- * 1 - PFP
- */
-# define PACKET3_DMA_DATA_SI_DST_SEL(x) ((x) << 20)
- /* 0 - DST_ADDR using DAS
- * 1 - GDS
- * 3 - DST_ADDR using L2
- */
-# define PACKET3_DMA_DATA_SI_SRC_SEL(x) ((x) << 29)
- /* 0 - SRC_ADDR using SAS
- * 1 - GDS
- * 2 - DATA
- * 3 - SRC_ADDR using L2
- */
-# define PACKET3_DMA_DATA_SI_CP_SYNC (1 << 31)
-
-
-#define PKT3_CONTEXT_CONTROL 0x28
-#define CONTEXT_CONTROL_LOAD_ENABLE(x) (((unsigned)(x) & 0x1) << 31)
-#define CONTEXT_CONTROL_LOAD_CE_RAM(x) (((unsigned)(x) & 0x1) << 28)
-#define CONTEXT_CONTROL_SHADOW_ENABLE(x) (((unsigned)(x) & 0x1) << 31)
-
-#define PKT3_CLEAR_STATE 0x12
-
-#define PKT3_SET_SH_REG 0x76
-#define PACKET3_SET_SH_REG_START 0x00002c00
-
-#define PKT3_SET_SH_REG_INDEX 0x9B
-
-#define PACKET3_DISPATCH_DIRECT 0x15
-#define PACKET3_EVENT_WRITE 0x46
-#define PACKET3_ACQUIRE_MEM 0x58
-#define PACKET3_SET_CONTEXT_REG 0x69
-#define PACKET3_SET_UCONFIG_REG 0x79
-#define PACKET3_DRAW_INDEX_AUTO 0x2D
-/* gfx 8 */
-#define mmCOMPUTE_PGM_LO 0x2e0c
-#define mmCOMPUTE_PGM_RSRC1 0x2e12
-#define mmCOMPUTE_TMPRING_SIZE 0x2e18
-#define mmCOMPUTE_USER_DATA_0 0x2e40
-#define mmCOMPUTE_USER_DATA_1 0x2e41
-#define mmCOMPUTE_RESOURCE_LIMITS 0x2e15
-#define mmCOMPUTE_NUM_THREAD_X 0x2e07
-
-
-
-#define SWAP_32(num) (((num & 0xff000000) >> 24) | \
- ((num & 0x0000ff00) << 8) | \
- ((num & 0x00ff0000) >> 8) | \
- ((num & 0x000000ff) << 24))
-
-
-/* Shader code
- * void main()
-{
-
- float x = some_input;
- for (unsigned i = 0; i < 1000000; i++)
- x = sin(x);
-
- u[0] = 42u;
-}
-*/
-
-static uint32_t shader_bin[] = {
- SWAP_32(0x800082be), SWAP_32(0x02ff08bf), SWAP_32(0x7f969800), SWAP_32(0x040085bf),
- SWAP_32(0x02810281), SWAP_32(0x02ff08bf), SWAP_32(0x7f969800), SWAP_32(0xfcff84bf),
- SWAP_32(0xff0083be), SWAP_32(0x00f00000), SWAP_32(0xc10082be), SWAP_32(0xaa02007e),
- SWAP_32(0x000070e0), SWAP_32(0x00000080), SWAP_32(0x000081bf)
-};
-
-#define CODE_OFFSET 512
-#define DATA_OFFSET 1024
-
-enum cs_type {
- CS_BUFFERCLEAR,
- CS_BUFFERCOPY,
- CS_HANG,
- CS_HANG_SLOW
-};
-
-static const uint32_t bufferclear_cs_shader_gfx9[] = {
- 0x260000ff, 0x000003ff, 0xd1fd0000, 0x04010c08,
- 0x7e020280, 0x7e040204, 0x7e060205, 0x7e080206,
- 0x7e0a0207, 0xe01c2000, 0x80000200, 0xbf8c0000,
- 0xbf810000
-};
-
-static const uint32_t bufferclear_cs_shader_gfx10[] = {
- 0xD7460004, 0x04010C08, 0x7E000204, 0x7E020205,
- 0x7E040206, 0x7E060207, 0xE01C2000, 0x80000004,
- 0xBF810000
-};
-
-static const uint32_t bufferclear_cs_shader_registers_gfx9[][2] = {
- {0x2e12, 0x000C0041}, //{ mmCOMPUTE_PGM_RSRC1, 0x000C0041 },
- {0x2e13, 0x00000090}, //{ mmCOMPUTE_PGM_RSRC2, 0x00000090 },
- {0x2e07, 0x00000040}, //{ mmCOMPUTE_NUM_THREAD_X, 0x00000040 },
- {0x2e08, 0x00000001}, //{ mmCOMPUTE_NUM_THREAD_Y, 0x00000001 },
- {0x2e09, 0x00000001}, //{ mmCOMPUTE_NUM_THREAD_Z, 0x00000001 }
-};
-
-static const uint32_t bufferclear_cs_shader_registers_num_gfx9 = 5;
-
-static const uint32_t buffercopy_cs_shader_gfx9[] = {
- 0x260000ff, 0x000003ff, 0xd1fd0000, 0x04010c08,
- 0x7e020280, 0xe00c2000, 0x80000200, 0xbf8c0f70,
- 0xe01c2000, 0x80010200, 0xbf810000
-};
-
-static const uint32_t buffercopy_cs_shader_gfx10[] = {
- 0xD7460001, 0x04010C08, 0xE00C2000, 0x80000201,
- 0xBF8C3F70, 0xE01C2000, 0x80010201, 0xBF810000
-};
-
-static const uint32_t preamblecache_gfx9[] = {
- 0xc0026900, 0x81, 0x80000000, 0x40004000, 0xc0026900, 0x8c, 0xaa99aaaa, 0x0,
- 0xc0026900, 0x90, 0x80000000, 0x40004000, 0xc0026900, 0x94, 0x80000000, 0x40004000,
- 0xc0026900, 0xb4, 0x0, 0x3f800000, 0xc0016900, 0x103, 0x0,
- 0xc0016900, 0x208, 0x0, 0xc0016900, 0x290, 0x0,
- 0xc0016900, 0x2a1, 0x0, 0xc0026900, 0x2ad, 0x0, 0x0,
- 0xc0016900, 0x2d5, 0x10000, 0xc0016900, 0x2dc, 0x0,
- 0xc0066900, 0x2de, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xc0026900, 0x2e5, 0x0, 0x0,
- 0xc0056900, 0x2f9, 0x5, 0x3f800000, 0x3f800000, 0x3f800000, 0x3f800000,
- 0xc0036900, 0x311, 0x3, 0, 0x100000, 0xc0026900, 0x316, 0x1e, 0x20,
- 0xc0016900, 0x349, 0x0, 0xc0016900, 0x358, 0x0, 0xc0016900, 0x367, 0x0,
- 0xc0016900, 0x376, 0x0, 0xc0016900, 0x385, 0x0, 0xc0016900, 0x19, 0x0,
- 0xc0056900, 0xe8, 0x0, 0x0, 0x0, 0x0, 0x0,
- 0xc0076900, 0x1e1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
- 0xc0026900, 0x204, 0x90000, 0x4, 0xc0046900, 0x20c, 0x0, 0x0, 0x0, 0x0,
- 0xc0016900, 0x2b2, 0x0, 0xc0026900, 0x30e, 0xffffffff, 0xffffffff,
- 0xc0016900, 0x314, 0x0, 0xc0016900, 0x2a6, 0, 0xc0016900, 0x210, 0,
- 0xc0002f00, 0x1, 0xc0016900, 0x1, 0x1,
- 0xc0016900, 0x18, 0x2, 0xc0016900, 0x206, 0x300, 0xc0017900, 0x20000243, 0x0,
- 0xc0017900, 0x248, 0xffffffff, 0xc0017900, 0x249, 0x0, 0xc0017900, 0x24a, 0x0,
- 0xc0017900, 0x24b, 0x0
-};
-
-static const uint32_t preamblecache_gfx10[] = {
- 0xc0026900, 0x81, 0x80000000, 0x40004000, 0xc0026900, 0x8c, 0xaa99aaaa, 0x0,
- 0xc0026900, 0x90, 0x80000000, 0x40004000, 0xc0026900, 0x94, 0x80000000, 0x40004000,
- 0xc0026900, 0xb4, 0x0, 0x3f800000, 0xc0016900, 0x103, 0x0,
- 0xc0016900, 0x208, 0x0, 0xc0016900, 0x290, 0x0,
- 0xc0016900, 0x2a1, 0x0, 0xc0026900, 0x2ad, 0x0, 0x0,
- 0xc0016900, 0x2d5, 0x10000, 0xc0016900, 0x2dc, 0x0,
- 0xc0066900, 0x2de, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xc0026900, 0x2e5, 0x0, 0x0,
- 0xc0056900, 0x2f9, 0x5, 0x3f800000, 0x3f800000, 0x3f800000, 0x3f800000,
- 0xc0046900, 0x310, 0, 0x3, 0, 0x100000, 0xc0026900, 0x316, 0xe, 0x20,
- 0xc0016900, 0x349, 0x0, 0xc0016900, 0x358, 0x0, 0xc0016900, 0x367, 0x0,
- 0xc0016900, 0x376, 0x0, 0xc0016900, 0x385, 0x0, 0xc0016900, 0x6, 0x0,
- 0xc0056900, 0xe8, 0x0, 0x0, 0x0, 0x0, 0x0,
- 0xc0076900, 0x1e1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
- 0xc0026900, 0x204, 0x90000, 0x4, 0xc0046900, 0x20c, 0x0, 0x0, 0x0, 0x0,
- 0xc0016900, 0x2b2, 0x0, 0xc0026900, 0x30e, 0xffffffff, 0xffffffff,
- 0xc0016900, 0x314, 0x0, 0xc0016900, 0x10a, 0, 0xc0016900, 0x2a6, 0, 0xc0016900, 0x210, 0,
- 0xc0016900, 0x2db, 0, 0xc0016900, 0x1d4, 0, 0xc0002f00, 0x1, 0xc0016900, 0x1, 0x1, 0xc0016900, 0xe, 0x2,
- 0xc0016900, 0x206, 0x300, 0xc0016900, 0x212, 0x200, 0xc0017900, 0x7b, 0x20, 0xc0017a00, 0x20000243, 0x0,
- 0xc0017900, 0x249, 0, 0xc0017900, 0x24a, 0, 0xc0017900, 0x24b, 0, 0xc0017900, 0x259, 0xffffffff,
- 0xc0017900, 0x25f, 0, 0xc0017900, 0x260, 0, 0xc0017900, 0x262, 0,
- 0xc0017600, 0x45, 0x0, 0xc0017600, 0x6, 0x0,
- 0xc0067600, 0x70, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
- 0xc0067600, 0x30, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0
-};
-
-enum ps_type {
- PS_CONST,
- PS_TEX,
- PS_HANG,
- PS_HANG_SLOW
-};
-
-static const uint32_t ps_const_shader_gfx9[] = {
- 0x7E000200, 0x7E020201, 0x7E040202, 0x7E060203,
- 0xD2960000, 0x00020300, 0xD2960001, 0x00020702,
- 0xC4001C0F, 0x00000100, 0xBF810000
-};
-
-static const uint32_t ps_const_shader_patchinfo_code_size_gfx9 = 6;
-
-static const uint32_t ps_const_shader_patchinfo_code_gfx9[][10][6] = {
- {{ 0xBF800000, 0xBF800000, 0xBF800000, 0xBF800000, 0xC4001890, 0x00000000 },
- { 0xBF800000, 0xBF800000, 0xBF800000, 0xBF800000, 0xC4001801, 0x00000000 },
- { 0xBF800000, 0xBF800000, 0xBF800000, 0xBF800000, 0xC4001803, 0x00000100 },
- { 0xBF800000, 0xBF800000, 0xBF800000, 0xBF800000, 0xC4001803, 0x00000300 },
- { 0xD2960000, 0x00020300, 0xD2960001, 0x00020702, 0xC4001C0F, 0x00000100 },
- { 0xD2950000, 0x00020300, 0xD2950001, 0x00020702, 0xC4001C0F, 0x00000100 },
- { 0xD2940000, 0x00020300, 0xD2940001, 0x00020702, 0xC4001C0F, 0x00000100 },
- { 0xD2970000, 0x00020300, 0xD2970001, 0x00020702, 0xC4001C0F, 0x00000100 },
- { 0xD2980000, 0x00020300, 0xD2980001, 0x00020702, 0xC4001C0F, 0x00000100 },
- { 0xBF800000, 0xBF800000, 0xBF800000, 0xBF800000, 0xC400180F, 0x03020100 }
- }
-};
-
-static const uint32_t ps_const_shader_patchinfo_offset_gfx9[] = {
- 0x00000004
-};
-
-static const uint32_t ps_num_sh_registers_gfx9 = 2;
-
-static const uint32_t ps_const_sh_registers_gfx9[][2] = {
- {0x2C0A, 0x000C0040},//{ mmSPI_SHADER_PGM_RSRC1_PS, 0x000C0040 },
- {0x2C0B, 0x00000008}, //{ mmSPI_SHADER_PGM_RSRC2_PS, 0x00000008 }
-};
-
-static const uint32_t ps_num_context_registers_gfx9 = 7;
-
-static const uint32_t ps_const_context_reg_gfx9[][2] = {
- {0xA1B4, 0x00000002}, //{ mmSPI_PS_INPUT_ADDR, 0x00000002 },
- {0xA1B6, 0x00000000}, //{ mmSPI_PS_IN_CONTROL, 0x00000000 },
- {0xA08F, 0x0000000F}, //{ mmCB_SHADER_MASK, 0x0000000F },
- {0xA203, 0x00000010}, //{ mmDB_SHADER_CONTROL, 0x00000010 },
- {0xA1C4, 0x00000000}, //{ mmSPI_SHADER_Z_FORMAT, 0x00000000 },
- {0xA1B8, 0x00000000}, //{ mmSPI_BARYC_CNTL, 0x00000000 /* Always 0 for now */},
- {0xA1C5, 0x00000004}, //{ mmSPI_SHADER_COL_FORMAT, 0x00000004 }
-};
-
-static const uint32_t ps_const_shader_gfx10[] = {
- 0x7E000200, 0x7E020201, 0x7E040202, 0x7E060203,
- 0x5E000300, 0x5E020702, 0xBF800000, 0xBF800000,
- 0xF8001C0F, 0x00000100, 0xBF810000
-};
-
-static const uint32_t ps_const_shader_patchinfo_code_size_gfx10 = 6;
-
-static const uint32_t ps_const_shader_patchinfo_code_gfx10[][10][6] = {
- {{ 0xBF800000, 0xBF800000, 0xBF800000, 0xBF800000, 0xF8001890, 0x00000000 },
- { 0xBF800000, 0xBF800000, 0xBF800000, 0xBF800000, 0xF8001801, 0x00000000 },
- { 0xBF800000, 0xBF800000, 0xBF800000, 0xBF800000, 0xF8001803, 0x0000010...
[truncated message content] |