drm: add tests/amdgpu (v3)
PATCH 1/1 drm: add tests/amdgpu (v3)
This adds some basic unit tests for the new amdgpu driver.
v2: use common util_math.h
v3: implement suggestions from Emil
replace malloc/memset with calloc
make header guards all caps
use posix_memalign rather than mem_align
replace malloc with calloc for pm4 allocations make CU_SuiteInfo static
fix Makefile.am
fix fd numbering
use drmGetVersion/drmFreeVersion rather than open coding it close fd, clean up CU registry on error
Signed-off-by Alex Deucher <[email protected]>
--- configure.ac | 23 ++ tests/Makefile.am | 6 + tests/amdgpu/Makefile.am | 26 ++ tests/amdgpu/amdgpu_test.c | 220 ++++++++++++ tests/amdgpu/amdgpu_test.h | 119 +++++++ tests/amdgpu/basic_tests.c | 669 ++++++++++++++++++++++++++++++++++++ tests/amdgpu/bo_tests.c | 151 ++++++++ tests/amdgpu/cs_tests.c | 319 +++++++++++++++++ tests/amdgpu/uvd_messages.h | 813 ++++++++++++++++++++++++++++++++++++++++++++ tests/kmstest/main.c | 1 + 10 files changed, 2347 insertions(+) create mode 100644 tests/amdgpu/Makefile.am create mode 100644 tests/amdgpu/amdgpu_test.c create mode 100644 tests/amdgpu/amdgpu_test.h create mode 100644 tests/amdgpu/basic_tests.c create mode 100644 tests/amdgpu/bo_tests.c create mode 100644 tests/amdgpu/cs_tests.c create mode 100644 tests/amdgpu/uvd_messages.h
configure.ac +23 -0
@@ -350,6 +350,28 @@ fi AM_CONDITIONAL(HAVE_AMDGPU, [test "x$AMDGPU" = xyes]) if test "x$AMDGPU" = xyes; then AC_DEFINE(HAVE_AMDGPU, 1, [Have amdgpu support]) + + # Detect cunit library + PKG_CHECK_MODULES([CUNIT], [cunit >= 2.1], [have_cunit=yes], [have_cunit=no]) + + # If pkg-config does not find cunit, check it using AC_CHECK_LIB. We + # do this because Debian (Ubuntu) lacks pkg-config file for cunit. + if test "x${have_cunit}" = "xno"; then + AC_CHECK_LIB([cunit], [CU_initialize_registry], [have_cunit=yes], [have_cunit=no]) + if test "x${have_cunit}" = "xyes"; then + CUNIT_LIBS="-lcunit" + CUNIT_CFLAGS="" + AC_SUBST([CUNIT_LIBS]) + AC_SUBST([CUNIT_CFLAGS]) + fi + fi + + AM_CONDITIONAL(HAVE_CUNIT, [test "x$have_cunit" != "xno"]) + AC_DEFINE(HAVE_CUNIT, [test "x$have_cunit" != "xno"], [Enable CUNIT Have amdgpu support]) + + if test "x$have_cunit" = "xno"; then + AC_MSG_WARN([Could not find cunit library. Disabling amdgpu tests]) + fi fi AM_CONDITIONAL(HAVE_TEGRA, [test "x$TEGRA" = xyes])
@@ -466,6 +488,7 @@ AC_CONFIG_FILES([ tests/kmstest/Makefile tests/proptest/Makefile tests/radeon/Makefile + tests/amdgpu/Makefile tests/vbltest/Makefile tests/exynos/Makefile tests/tegra/Makefile
tests/Makefile.am +6 -0
@@ -8,6 +8,12 @@ if HAVE_RADEON SUBDIRS += radeon endif +if HAVE_AMDGPU +if HAVE_CUNIT +SUBDIRS += amdgpu +endif +endif + if HAVE_EXYNOS SUBDIRS += exynos endif
tests/amdgpu/Makefile.am new file +26 -0
@@ -0,0 +1,26 @@ +AM_CFLAGS = \ + -I $(top_srcdir)/include/drm \ + -I $(top_srcdir)/amdgpu \ + -I $(top_srcdir) + +LDADD = $(top_builddir)/libdrm.la \ + $(top_builddir)/amdgpu/libdrm_amdgpu.la \ + $(CUNIT_LIBS) + +if HAVE_INSTALL_TESTS +bin_PROGRAMS = \ + amdgpu_test +else +noinst_PROGRAMS = \ + amdgpu_test +endif + +amdgpu_test_CPPFLAGS = $(CUNIT_CFLAGS) + +amdgpu_test_SOURCES = \ + amdgpu_test.c \ + amdgpu_test.h \ + basic_tests.c \ + bo_tests.c \ + cs_tests.c \ + uvd_messages.h
tests/amdgpu/amdgpu_test.c new file +220 -0
220 lines not on this page · raw message
tests/amdgpu/amdgpu_test.h new file +119 -0
119 lines not on this page · raw message
tests/amdgpu/basic_tests.c new file +669 -0
669 lines not on this page · raw message
tests/amdgpu/bo_tests.c new file +151 -0
151 lines not on this page · raw message
tests/amdgpu/cs_tests.c new file +319 -0
319 lines not on this page · raw message
tests/amdgpu/uvd_messages.h new file +813 -0
813 lines not on this page · raw message
tests/kmstest/main.c +1 -0
@@ -62,6 +62,7 @@ static const char *drivers[] = {"nouveau" ,"vmwgfx" ,"exynos" , +"amdgpu" ,"imx-drm" ,"rockchip" ,NULL
Signature · 6 lines
1.8.3.1 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel