amdgpu: A new option to run tests on render node
Tested: 1. As root, tests passed on primary. 2. As root, tests passed on render node. BO export/import test was skipped 3. As non-privileged user, tests failed on primary as expected. 4. As non-privileged user, tests passed on render node. BO export/import test was skipped Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com> Signed-off-by: Alex Xie <AlexBin.Xie@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>main
parent
12dd7a2e9c
commit
8a89d5f620
|
@ -56,6 +56,9 @@
|
||||||
*/
|
*/
|
||||||
int drm_amdgpu[MAX_CARDS_SUPPORTED];
|
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 */
|
/** The table of all known test suites to run */
|
||||||
static CU_SuiteInfo suites[] = {
|
static CU_SuiteInfo suites[] = {
|
||||||
{
|
{
|
||||||
|
@ -109,16 +112,17 @@ static void display_test_suites(void)
|
||||||
|
|
||||||
/** Help string for command line parameters */
|
/** Help string for command line parameters */
|
||||||
static const char usage[] =
|
static const char usage[] =
|
||||||
"Usage: %s [-hlp] [<-s <suite id>> [-t <test id>]] "
|
"Usage: %s [-hlpr] [<-s <suite id>> [-t <test id>]] "
|
||||||
"[-b <pci_bus_id> [-d <pci_device_id>]]\n"
|
"[-b <pci_bus_id> [-d <pci_device_id>]]\n"
|
||||||
"where:\n"
|
"where:\n"
|
||||||
" l - Display all suites and their tests\n"
|
" l - Display all suites and their tests\n"
|
||||||
|
" r - Run the tests on render node\n"
|
||||||
" b - Specify device's PCI bus id to run tests\n"
|
" b - Specify device's PCI bus id to run tests\n"
|
||||||
" d - Specify device's PCI device id to run tests (optional)\n"
|
" d - Specify device's PCI device id to run tests (optional)\n"
|
||||||
" p - Display information of AMDGPU devices in system\n"
|
" p - Display information of AMDGPU devices in system\n"
|
||||||
" h - Display this help\n";
|
" h - Display this help\n";
|
||||||
/** Specified options strings for getopt */
|
/** Specified options strings for getopt */
|
||||||
static const char options[] = "hlps:t:b:d:";
|
static const char options[] = "hlrps:t:b:d:";
|
||||||
|
|
||||||
/* Open AMD devices.
|
/* Open AMD devices.
|
||||||
* Return the number of AMD device openned.
|
* Return the number of AMD device openned.
|
||||||
|
@ -326,6 +330,9 @@ int main(int argc, char **argv)
|
||||||
case 'p':
|
case 'p':
|
||||||
display_devices = 1;
|
display_devices = 1;
|
||||||
break;
|
break;
|
||||||
|
case 'r':
|
||||||
|
open_render_node = 1;
|
||||||
|
break;
|
||||||
case '?':
|
case '?':
|
||||||
case 'h':
|
case 'h':
|
||||||
fprintf(stderr, usage, argv[0]);
|
fprintf(stderr, usage, argv[0]);
|
||||||
|
@ -336,7 +343,7 @@ int main(int argc, char **argv)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (amdgpu_open_devices(0) <= 0) {
|
if (amdgpu_open_devices(open_render_node) <= 0) {
|
||||||
perror("Cannot open AMDGPU device");
|
perror("Cannot open AMDGPU device");
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,6 +35,9 @@
|
||||||
/* Forward reference for array to keep "drm" handles */
|
/* Forward reference for array to keep "drm" handles */
|
||||||
extern int drm_amdgpu[MAX_CARDS_SUPPORTED];
|
extern int drm_amdgpu[MAX_CARDS_SUPPORTED];
|
||||||
|
|
||||||
|
/* Global variables */
|
||||||
|
extern int open_render_node;
|
||||||
|
|
||||||
/************************* Basic test suite ********************************/
|
/************************* Basic test suite ********************************/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -152,6 +152,11 @@ static void amdgpu_bo_export_import_do_type(enum amdgpu_bo_handle_type type)
|
||||||
|
|
||||||
static void amdgpu_bo_export_import(void)
|
static void amdgpu_bo_export_import(void)
|
||||||
{
|
{
|
||||||
|
if (open_render_node) {
|
||||||
|
printf("(DRM render node is used. Skip export/Import test) ");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
amdgpu_bo_export_import_do_type(amdgpu_bo_handle_type_gem_flink_name);
|
amdgpu_bo_export_import_do_type(amdgpu_bo_handle_type_gem_flink_name);
|
||||||
amdgpu_bo_export_import_do_type(amdgpu_bo_handle_type_dma_buf_fd);
|
amdgpu_bo_export_import_do_type(amdgpu_bo_handle_type_dma_buf_fd);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue