diff options
author | Jonathan Gray <jsg@cvs.openbsd.org> | 2016-03-20 10:41:30 +0000 |
---|---|---|
committer | Jonathan Gray <jsg@cvs.openbsd.org> | 2016-03-20 10:41:30 +0000 |
commit | 2b81362b619d5603f28639e669f3030d6c7a8e02 (patch) | |
tree | 03be383fd8d38ff6c65f6a47f99944511a4ff9e6 /lib | |
parent | 463789b8671482b661f77e2cebfb7be3bda94309 (diff) |
Merge libdrm 2.4.67
Diffstat (limited to 'lib')
34 files changed, 1256 insertions, 727 deletions
diff --git a/lib/libdrm/Makefile.am b/lib/libdrm/Makefile.am index a7a0ccae6..feecba72c 100644 --- a/lib/libdrm/Makefile.am +++ b/lib/libdrm/Makefile.am @@ -29,6 +29,7 @@ AM_DISTCHECK_CONFIGURE_FLAGS = \ --enable-radeon \ --enable-amdgpu \ --enable-nouveau \ + --enable-vc4 \ --enable-vmwgfx \ --enable-omap-experimental-api \ --enable-exynos-experimental-api \ @@ -37,7 +38,8 @@ AM_DISTCHECK_CONFIGURE_FLAGS = \ --enable-tegra-experimental-api \ --enable-install-test-programs \ --enable-cairo-tests \ - --enable-manpages + --enable-manpages \ + --enable-valgrind pkgconfigdir = @pkgconfigdir@ pkgconfig_DATA = libdrm.pc @@ -78,6 +80,10 @@ if HAVE_TEGRA TEGRA_SUBDIR = tegra endif +if HAVE_VC4 +VC4_SUBDIR = vc4 +endif + if BUILD_MANPAGES if HAVE_MANPAGES_STYLESHEET MAN_SUBDIR = man @@ -95,6 +101,7 @@ SUBDIRS = \ $(EXYNOS_SUBDIR) \ $(FREEDRENO_SUBDIR) \ $(TEGRA_SUBDIR) \ + $(VC4_SUBDIR) \ tests \ $(MAN_SUBDIR) diff --git a/lib/libdrm/Makefile.bsd-wrapper b/lib/libdrm/Makefile.bsd-wrapper index 51ff009f9..5d71a9857 100644 --- a/lib/libdrm/Makefile.bsd-wrapper +++ b/lib/libdrm/Makefile.bsd-wrapper @@ -1,6 +1,6 @@ -# $OpenBSD: Makefile.bsd-wrapper,v 1.6 2015/08/22 00:30:35 jsg Exp $ +# $OpenBSD: Makefile.bsd-wrapper,v 1.7 2016/03/20 10:41:29 jsg Exp $ -SHARED_LIBS= drm 7.0 drm_radeon 4.0 drm_intel 5.0 \ - drm_amdgpu 1.0 drm_nouveau 2.0 +SHARED_LIBS= drm 7.1 drm_radeon 4.0 drm_intel 5.1 \ + drm_amdgpu 1.1 drm_nouveau 3.0 .include <bsd.xorg.mk> diff --git a/lib/libdrm/Makefile.in b/lib/libdrm/Makefile.in index 3289a2d63..090079254 100644 --- a/lib/libdrm/Makefile.in +++ b/lib/libdrm/Makefile.in @@ -201,7 +201,8 @@ am__klibdrminclude_HEADERS_DIST = include/drm/drm.h \ include/drm/r128_drm.h include/drm/radeon_drm.h \ include/drm/amdgpu_drm.h include/drm/savage_drm.h \ include/drm/sis_drm.h include/drm/tegra_drm.h \ - include/drm/via_drm.h include/drm/vmwgfx_drm.h + include/drm/vc4_drm.h include/drm/via_drm.h \ + include/drm/vmwgfx_drm.h HEADERS = $(klibdrminclude_HEADERS) $(libdrminclude_HEADERS) RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive @@ -212,7 +213,7 @@ ETAGS = etags CTAGS = ctags CSCOPE = cscope DIST_SUBDIRS = . libkms intel nouveau radeon amdgpu omap exynos \ - freedreno tegra tests man + freedreno tegra vc4 tests man DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) distdir = $(PACKAGE)-$(VERSION) top_distdir = $(distdir) @@ -439,6 +440,7 @@ LIBDRM_INCLUDE_H_FILES := \ include/drm/savage_drm.h \ include/drm/sis_drm.h \ include/drm/tegra_drm.h \ + include/drm/vc4_drm.h \ include/drm/via_drm.h LIBDRM_INCLUDE_VMWGFX_H_FILES := \ @@ -452,6 +454,7 @@ AM_DISTCHECK_CONFIGURE_FLAGS = \ --enable-radeon \ --enable-amdgpu \ --enable-nouveau \ + --enable-vc4 \ --enable-vmwgfx \ --enable-omap-experimental-api \ --enable-exynos-experimental-api \ @@ -460,7 +463,8 @@ AM_DISTCHECK_CONFIGURE_FLAGS = \ --enable-tegra-experimental-api \ --enable-install-test-programs \ --enable-cairo-tests \ - --enable-manpages + --enable-manpages \ + --enable-valgrind pkgconfig_DATA = libdrm.pc @HAVE_LIBKMS_TRUE@LIBKMS_SUBDIR = libkms @@ -472,6 +476,7 @@ pkgconfig_DATA = libdrm.pc @HAVE_EXYNOS_TRUE@EXYNOS_SUBDIR = exynos @HAVE_FREEDRENO_TRUE@FREEDRENO_SUBDIR = freedreno @HAVE_TEGRA_TRUE@TEGRA_SUBDIR = tegra +@HAVE_VC4_TRUE@VC4_SUBDIR = vc4 @BUILD_MANPAGES_TRUE@@HAVE_MANPAGES_STYLESHEET_TRUE@MAN_SUBDIR = man SUBDIRS = \ . \ @@ -484,6 +489,7 @@ SUBDIRS = \ $(EXYNOS_SUBDIR) \ $(FREEDRENO_SUBDIR) \ $(TEGRA_SUBDIR) \ + $(VC4_SUBDIR) \ tests \ $(MAN_SUBDIR) diff --git a/lib/libdrm/amdgpu/amdgpu_bo.c b/lib/libdrm/amdgpu/amdgpu_bo.c index 348da0031..d30fd1e71 100644 --- a/lib/libdrm/amdgpu/amdgpu_bo.c +++ b/lib/libdrm/amdgpu/amdgpu_bo.c @@ -537,18 +537,10 @@ int amdgpu_create_bo_from_user_mem(amdgpu_device_handle dev, int r; struct amdgpu_bo *bo; struct drm_amdgpu_gem_userptr args; - uintptr_t cpu0; - uint32_t ps, off; - memset(&args, 0, sizeof(args)); - ps = getpagesize(); - - cpu0 = ROUND_DOWN((uintptr_t)cpu, ps); - off = (uintptr_t)cpu - cpu0; - size = ROUND_UP(size + off, ps); - - args.addr = cpu0; - args.flags = AMDGPU_GEM_USERPTR_ANONONLY | AMDGPU_GEM_USERPTR_REGISTER; + args.addr = (uintptr_t)cpu; + args.flags = AMDGPU_GEM_USERPTR_ANONONLY | AMDGPU_GEM_USERPTR_REGISTER | + AMDGPU_GEM_USERPTR_VALIDATE; args.size = size; r = drmCommandWriteRead(dev->fd, DRM_AMDGPU_GEM_USERPTR, &args, sizeof(args)); @@ -591,6 +583,12 @@ int amdgpu_bo_list_create(amdgpu_device_handle dev, if (!list) return -ENOMEM; + *result = malloc(sizeof(struct amdgpu_bo_list)); + if (!*result) { + free(list); + return -ENOMEM; + } + memset(&args, 0, sizeof(args)); args.in.operation = AMDGPU_BO_LIST_OP_CREATE; args.in.bo_number = number_of_resources; @@ -608,10 +606,11 @@ int amdgpu_bo_list_create(amdgpu_device_handle dev, r = drmCommandWriteRead(dev->fd, DRM_AMDGPU_BO_LIST, &args, sizeof(args)); free(list); - if (r) + if (r) { + free(*result); return r; + } - *result = malloc(sizeof(struct amdgpu_bo_list)); (*result)->dev = dev; (*result)->handle = args.out.list_handle; return 0; diff --git a/lib/libdrm/config.h.in b/lib/libdrm/config.h.in index 2abe6a234..0ae3589fc 100644 --- a/lib/libdrm/config.h.in +++ b/lib/libdrm/config.h.in @@ -87,6 +87,9 @@ /* Define to 1 if you have the <sys/mkdev.h> header file. */ #undef HAVE_SYS_MKDEV_H +/* Define to 1 if you have the <sys/select.h> header file. */ +#undef HAVE_SYS_SELECT_H + /* Define to 1 if you have the <sys/stat.h> header file. */ #undef HAVE_SYS_STAT_H @@ -105,6 +108,9 @@ /* Use valgrind intrinsics to suppress false warnings */ #undef HAVE_VALGRIND +/* Have VC4 support */ +#undef HAVE_VC4 + /* Compiler supports __attribute__(("hidden")) */ #undef HAVE_VISIBILITY diff --git a/lib/libdrm/configure b/lib/libdrm/configure index a8cae76ce..d382c19af 100644 --- a/lib/libdrm/configure +++ b/lib/libdrm/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for libdrm 2.4.65. +# Generated by GNU Autoconf 2.69 for libdrm 2.4.67. # # Report bugs to <https://bugs.freedesktop.org/enter_bug.cgi?product=DRI>. # @@ -591,8 +591,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='libdrm' PACKAGE_TARNAME='libdrm' -PACKAGE_VERSION='2.4.65' -PACKAGE_STRING='libdrm 2.4.65' +PACKAGE_VERSION='2.4.67' +PACKAGE_STRING='libdrm 2.4.67' PACKAGE_BUGREPORT='https://bugs.freedesktop.org/enter_bug.cgi?product=DRI' PACKAGE_URL='' @@ -656,6 +656,8 @@ CAIRO_LIBS CAIRO_CFLAGS HAVE_INSTALL_TESTS_FALSE HAVE_INSTALL_TESTS_TRUE +HAVE_VC4_FALSE +HAVE_VC4_TRUE HAVE_TEGRA_FALSE HAVE_TEGRA_TRUE HAVE_AMDGPU_FALSE @@ -847,6 +849,7 @@ enable_exynos_experimental_api enable_freedreno enable_freedreno_kgsl enable_tegra_experimental_api +enable_vc4 enable_install_test_programs enable_cairo_tests enable_manpages @@ -1418,7 +1421,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures libdrm 2.4.65 to adapt to many kinds of systems. +\`configure' configures libdrm 2.4.67 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1488,7 +1491,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of libdrm 2.4.65:";; + short | recursive ) echo "Configuration of libdrm 2.4.67:";; esac cat <<\_ACEOF @@ -1531,6 +1534,8 @@ Optional Features: --enable-tegra-experimental-api Enable support for Tegra's experimental API (default: disabled) + --disable-vc4 Enable support for vc4's API (default: auto, enabled + on arm) --enable-install-test-programs Install test programs (default: no) --enable-cairo-tests Enable support for Cairo rendering in tests @@ -1654,7 +1659,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -libdrm configure 2.4.65 +libdrm configure 2.4.67 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -2077,7 +2082,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by libdrm $as_me 2.4.65, which was +It was created by libdrm $as_me 2.4.67, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -3277,7 +3282,7 @@ fi # Define the identity of the package. PACKAGE='libdrm' - VERSION='2.4.65' + VERSION='2.4.67' cat >>confdefs.h <<_ACEOF @@ -5385,7 +5390,7 @@ _ACEOF fi -for ac_header in sys/mkdev.h sys/sysctl.h +for ac_header in sys/mkdev.h sys/sysctl.h sys/select.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" @@ -12827,6 +12832,14 @@ else fi +# Check whether --enable-vc4 was given. +if test "${enable_vc4+set}" = set; then : + enableval=$enable_vc4; VC4=$enableval +else + VC4=auto +fi + + # Check whether --enable-install-test-programs was given. if test "${enable_install_test_programs+set}" = set; then : enableval=$enable_install_test_programs; INSTALL_TESTS=$enableval @@ -12916,7 +12929,8 @@ MAYBE_WARN="-Wall -Wextra \ -Wstrict-aliasing=2 -Winit-self \ -Wdeclaration-after-statement -Wold-style-definition \ -Wno-unused-parameter \ --Wno-attributes -Wno-long-long -Winline -Wshadow" +-Wno-attributes -Wno-long-long -Winline -Wshadow \ +-Wno-missing-field-initializers" # invalidate cached value if MAYBE_WARN has changed if test "x$libdrm_cv_warn_maybe" != "x$MAYBE_WARN"; then @@ -12994,7 +13008,7 @@ else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - int atomic_add(int *i) { return __sync_fetch_and_add (i, 1); } + int atomic_add(int *i) { return __sync_add_and_fetch (i, 1); } int atomic_cmpxchg(int *i, int j, int k) { return __sync_val_compare_and_swap (i, j, k); } int @@ -13138,6 +13152,12 @@ else *) FREEDRENO=no ;; esac fi + if test "x$VC4" = xauto; then + case $host_cpu in + arm*|aarch64) VC4=yes ;; + *) VC4=no ;; + esac + fi fi if test "x$INTEL" != "xno"; then @@ -13379,7 +13399,8 @@ $as_echo "#define HAVE_RADEON 1" >>confdefs.h fi -# Detect cunit library +if test "x$AMDGPU" != xno; then + # Detect cunit library pkg_failed=no { $as_echo "$as_me:${as_lineno-$LINENO}: checking for CUNIT" >&5 @@ -13451,11 +13472,11 @@ else $as_echo "yes" >&6; } have_cunit=yes fi -# 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. -# fixed in 2.1-2.dfsg-3: http://anonscm.debian.org/cgit/collab-maint/cunit.git/commit/?h=debian -if test "x${have_cunit}" = "xno"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for CU_initialize_registry in -lcunit" >&5 + # 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. + # fixed in 2.1-2.dfsg-3: http://anonscm.debian.org/cgit/collab-maint/cunit.git/commit/?h=debian + if test "x${have_cunit}" = "xno"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for CU_initialize_registry in -lcunit" >&5 $as_echo_n "checking for CU_initialize_registry in -lcunit... " >&6; } if ${ac_cv_lib_cunit_CU_initialize_registry+:} false; then : $as_echo_n "(cached) " >&6 @@ -13497,12 +13518,15 @@ else have_cunit=no fi - if test "x${have_cunit}" = "xyes"; then - CUNIT_LIBS="-lcunit" - CUNIT_CFLAGS="" + if test "x${have_cunit}" = "xyes"; then + CUNIT_LIBS="-lcunit" + CUNIT_CFLAGS="" + fi fi +else + have_cunit=no fi if test "x$have_cunit" != "xno"; then HAVE_CUNIT_TRUE= @@ -13550,6 +13574,20 @@ $as_echo "#define HAVE_TEGRA 1" >>confdefs.h fi + if test "x$VC4" = xyes; then + HAVE_VC4_TRUE= + HAVE_VC4_FALSE='#' +else + HAVE_VC4_TRUE='#' + HAVE_VC4_FALSE= +fi + +if test "x$VC4" = xyes; then + +$as_echo "#define HAVE_VC4 1" >>confdefs.h + +fi + if test "x$INSTALL_TESTS" = xyes; then HAVE_INSTALL_TESTS_TRUE= HAVE_INSTALL_TESTS_FALSE='#' @@ -13571,6 +13609,7 @@ else CAIRO=auto fi +if test "x$CAIRO" != xno; then pkg_failed=no { $as_echo "$as_me:${as_lineno-$LINENO}: checking for CAIRO" >&5 @@ -13642,6 +13681,7 @@ else $as_echo "yes" >&6; } HAVE_CAIRO=yes fi +fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable Cairo tests" >&5 $as_echo_n "checking whether to enable Cairo tests... " >&6; } if test "x$CAIRO" = xauto; then @@ -13824,6 +13864,7 @@ else VALGRIND=auto fi +if test "x$VALGRIND" != xno; then pkg_failed=no { $as_echo "$as_me:${as_lineno-$LINENO}: checking for VALGRIND" >&5 @@ -13895,6 +13936,7 @@ else $as_echo "yes" >&6; } have_valgrind=yes fi +fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable Valgrind support" >&5 $as_echo_n "checking whether to enable Valgrind support... " >&6; } if test "x$VALGRIND" = xauto; then @@ -13953,7 +13995,7 @@ $as_echo "#define HAVE_VISIBILITY 1" >>confdefs.h fi -ac_config_files="$ac_config_files Makefile libkms/Makefile libkms/libkms.pc intel/Makefile intel/libdrm_intel.pc radeon/Makefile radeon/libdrm_radeon.pc amdgpu/Makefile amdgpu/libdrm_amdgpu.pc nouveau/Makefile nouveau/libdrm_nouveau.pc omap/Makefile omap/libdrm_omap.pc exynos/Makefile exynos/libdrm_exynos.pc freedreno/Makefile freedreno/libdrm_freedreno.pc tegra/Makefile tegra/libdrm_tegra.pc tests/Makefile tests/modeprint/Makefile tests/modetest/Makefile tests/kmstest/Makefile tests/proptest/Makefile tests/radeon/Makefile tests/amdgpu/Makefile tests/vbltest/Makefile tests/exynos/Makefile tests/tegra/Makefile tests/nouveau/Makefile man/Makefile libdrm.pc" +ac_config_files="$ac_config_files Makefile libkms/Makefile libkms/libkms.pc intel/Makefile intel/libdrm_intel.pc radeon/Makefile radeon/libdrm_radeon.pc amdgpu/Makefile amdgpu/libdrm_amdgpu.pc nouveau/Makefile nouveau/libdrm_nouveau.pc omap/Makefile omap/libdrm_omap.pc exynos/Makefile exynos/libdrm_exynos.pc freedreno/Makefile freedreno/libdrm_freedreno.pc tegra/Makefile tegra/libdrm_tegra.pc vc4/Makefile vc4/libdrm_vc4.pc tests/Makefile tests/modeprint/Makefile tests/modetest/Makefile tests/kms/Makefile tests/kmstest/Makefile tests/proptest/Makefile tests/radeon/Makefile tests/amdgpu/Makefile tests/vbltest/Makefile tests/exynos/Makefile tests/tegra/Makefile tests/nouveau/Makefile tests/util/Makefile man/Makefile libdrm.pc" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure @@ -14140,6 +14182,10 @@ if test -z "${HAVE_TEGRA_TRUE}" && test -z "${HAVE_TEGRA_FALSE}"; then as_fn_error $? "conditional \"HAVE_TEGRA\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi +if test -z "${HAVE_VC4_TRUE}" && test -z "${HAVE_VC4_FALSE}"; then + as_fn_error $? "conditional \"HAVE_VC4\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi if test -z "${HAVE_INSTALL_TESTS_TRUE}" && test -z "${HAVE_INSTALL_TESTS_FALSE}"; then as_fn_error $? "conditional \"HAVE_INSTALL_TESTS\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 @@ -14557,7 +14603,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by libdrm $as_me 2.4.65, which was +This file was extended by libdrm $as_me 2.4.67, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -14623,7 +14669,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -libdrm config.status 2.4.65 +libdrm config.status 2.4.67 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" @@ -15051,9 +15097,12 @@ do "freedreno/libdrm_freedreno.pc") CONFIG_FILES="$CONFIG_FILES freedreno/libdrm_freedreno.pc" ;; "tegra/Makefile") CONFIG_FILES="$CONFIG_FILES tegra/Makefile" ;; "tegra/libdrm_tegra.pc") CONFIG_FILES="$CONFIG_FILES tegra/libdrm_tegra.pc" ;; + "vc4/Makefile") CONFIG_FILES="$CONFIG_FILES vc4/Makefile" ;; + "vc4/libdrm_vc4.pc") CONFIG_FILES="$CONFIG_FILES vc4/libdrm_vc4.pc" ;; "tests/Makefile") CONFIG_FILES="$CONFIG_FILES tests/Makefile" ;; "tests/modeprint/Makefile") CONFIG_FILES="$CONFIG_FILES tests/modeprint/Makefile" ;; "tests/modetest/Makefile") CONFIG_FILES="$CONFIG_FILES tests/modetest/Makefile" ;; + "tests/kms/Makefile") CONFIG_FILES="$CONFIG_FILES tests/kms/Makefile" ;; "tests/kmstest/Makefile") CONFIG_FILES="$CONFIG_FILES tests/kmstest/Makefile" ;; "tests/proptest/Makefile") CONFIG_FILES="$CONFIG_FILES tests/proptest/Makefile" ;; "tests/radeon/Makefile") CONFIG_FILES="$CONFIG_FILES tests/radeon/Makefile" ;; @@ -15062,6 +15111,7 @@ do "tests/exynos/Makefile") CONFIG_FILES="$CONFIG_FILES tests/exynos/Makefile" ;; "tests/tegra/Makefile") CONFIG_FILES="$CONFIG_FILES tests/tegra/Makefile" ;; "tests/nouveau/Makefile") CONFIG_FILES="$CONFIG_FILES tests/nouveau/Makefile" ;; + "tests/util/Makefile") CONFIG_FILES="$CONFIG_FILES tests/util/Makefile" ;; "man/Makefile") CONFIG_FILES="$CONFIG_FILES man/Makefile" ;; "libdrm.pc") CONFIG_FILES="$CONFIG_FILES libdrm.pc" ;; @@ -16434,4 +16484,5 @@ echo " OMAP API $OMAP" echo " EXYNOS API $EXYNOS" echo " Freedreno API $FREEDRENO (kgsl: $FREEDRENO_KGSL)" echo " Tegra API $TEGRA" +echo " VC4 API $VC4" echo "" diff --git a/lib/libdrm/configure.ac b/lib/libdrm/configure.ac index 89a3a468e..ed077894a 100644 --- a/lib/libdrm/configure.ac +++ b/lib/libdrm/configure.ac @@ -20,7 +20,7 @@ AC_PREREQ([2.63]) AC_INIT([libdrm], - [2.4.65], + [2.4.67], [https://bugs.freedesktop.org/enter_bug.cgi?product=DRI], [libdrm]) @@ -53,7 +53,7 @@ AC_USE_SYSTEM_EXTENSIONS AC_SYS_LARGEFILE AC_FUNC_ALLOCA -AC_CHECK_HEADERS([sys/mkdev.h sys/sysctl.h]) +AC_CHECK_HEADERS([sys/mkdev.h sys/sysctl.h sys/select.h]) # Initialize libtool LT_PREREQ([2.2]) @@ -126,6 +126,11 @@ AC_ARG_ENABLE(tegra-experimental-api, [Enable support for Tegra's experimental API (default: disabled)]), [TEGRA=$enableval], [TEGRA=no]) +AC_ARG_ENABLE(vc4, + AS_HELP_STRING([--disable-vc4], + [Enable support for vc4's API (default: auto, enabled on arm)]), + [VC4=$enableval], [VC4=auto]) + AC_ARG_ENABLE(install-test-programs, AS_HELP_STRING([--enable-install-test-programs], [Install test programs (default: no)]), @@ -174,7 +179,8 @@ MAYBE_WARN="-Wall -Wextra \ -Wstrict-aliasing=2 -Winit-self \ -Wdeclaration-after-statement -Wold-style-definition \ -Wno-unused-parameter \ --Wno-attributes -Wno-long-long -Winline -Wshadow" +-Wno-attributes -Wno-long-long -Winline -Wshadow \ +-Wno-missing-field-initializers" # invalidate cached value if MAYBE_WARN has changed if test "x$libdrm_cv_warn_maybe" != "x$MAYBE_WARN"; then @@ -210,7 +216,7 @@ AC_CACHE_CHECK([for native atomic primitives], drm_cv_atomic_primitives, [ drm_cv_atomic_primitives="none" AC_LINK_IFELSE([AC_LANG_PROGRAM([[ - int atomic_add(int *i) { return __sync_fetch_and_add (i, 1); } + int atomic_add(int *i) { return __sync_add_and_fetch (i, 1); } int atomic_cmpxchg(int *i, int j, int k) { return __sync_val_compare_and_swap (i, j, k); } ]],[[]])], [drm_cv_atomic_primitives="Intel"],[]) @@ -289,6 +295,12 @@ else *) FREEDRENO=no ;; esac fi + if test "x$VC4" = xauto; then + case $host_cpu in + arm*|aarch64) VC4=yes ;; + *) VC4=no ;; + esac + fi fi if test "x$INTEL" != "xno"; then @@ -359,19 +371,23 @@ if test "x$RADEON" = xyes; then AC_DEFINE(HAVE_RADEON, 1, [Have radeon support]) fi -# 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. -# fixed in 2.1-2.dfsg-3: http://anonscm.debian.org/cgit/collab-maint/cunit.git/commit/?h=debian -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]) +if test "x$AMDGPU" != xno; then + # 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. + # fixed in 2.1-2.dfsg-3: http://anonscm.debian.org/cgit/collab-maint/cunit.git/commit/?h=debian + 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 +else + have_cunit=no fi AM_CONDITIONAL(HAVE_CUNIT, [test "x$have_cunit" != "xno"]) @@ -391,6 +407,11 @@ if test "x$TEGRA" = xyes; then AC_DEFINE(HAVE_TEGRA, 1, [Have Tegra support]) fi +AM_CONDITIONAL(HAVE_VC4, [test "x$VC4" = xyes]) +if test "x$VC4" = xyes; then + AC_DEFINE(HAVE_VC4, 1, [Have VC4 support]) +fi + AM_CONDITIONAL(HAVE_INSTALL_TESTS, [test "x$INSTALL_TESTS" = xyes]) if test "x$INSTALL_TESTS" = xyes; then AC_DEFINE(HAVE_INSTALL_TESTS, 1, [Install test programs]) @@ -400,7 +421,9 @@ AC_ARG_ENABLE([cairo-tests], [AS_HELP_STRING([--enable-cairo-tests], [Enable support for Cairo rendering in tests (default: auto)])], [CAIRO=$enableval], [CAIRO=auto]) -PKG_CHECK_MODULES(CAIRO, cairo, [HAVE_CAIRO=yes], [HAVE_CAIRO=no]) +if test "x$CAIRO" != xno; then + PKG_CHECK_MODULES(CAIRO, cairo, [HAVE_CAIRO=yes], [HAVE_CAIRO=no]) +fi AC_MSG_CHECKING([whether to enable Cairo tests]) if test "x$CAIRO" = xauto; then CAIRO="$HAVE_CAIRO" @@ -445,7 +468,9 @@ AC_ARG_ENABLE(valgrind, [AS_HELP_STRING([--enable-valgrind], [Build libdrm with valgrind support (default: auto)])], [VALGRIND=$enableval], [VALGRIND=auto]) -PKG_CHECK_MODULES(VALGRIND, [valgrind], [have_valgrind=yes], [have_valgrind=no]) +if test "x$VALGRIND" != xno; then + PKG_CHECK_MODULES(VALGRIND, [valgrind], [have_valgrind=yes], [have_valgrind=no]) +fi AC_MSG_CHECKING([whether to enable Valgrind support]) if test "x$VALGRIND" = xauto; then VALGRIND="$have_valgrind" @@ -496,9 +521,12 @@ AC_CONFIG_FILES([ freedreno/libdrm_freedreno.pc tegra/Makefile tegra/libdrm_tegra.pc + vc4/Makefile + vc4/libdrm_vc4.pc tests/Makefile tests/modeprint/Makefile tests/modetest/Makefile + tests/kms/Makefile tests/kmstest/Makefile tests/proptest/Makefile tests/radeon/Makefile @@ -507,6 +535,7 @@ AC_CONFIG_FILES([ tests/exynos/Makefile tests/tegra/Makefile tests/nouveau/Makefile + tests/util/Makefile man/Makefile libdrm.pc]) AC_OUTPUT @@ -524,4 +553,5 @@ echo " OMAP API $OMAP" echo " EXYNOS API $EXYNOS" echo " Freedreno API $FREEDRENO (kgsl: $FREEDRENO_KGSL)" echo " Tegra API $TEGRA" +echo " VC4 API $VC4" echo "" diff --git a/lib/libdrm/include/drm/i915_drm.h b/lib/libdrm/include/drm/i915_drm.h index 1b797326f..e30e3cc67 100644 --- a/lib/libdrm/include/drm/i915_drm.h +++ b/lib/libdrm/include/drm/i915_drm.h @@ -27,7 +27,7 @@ #ifndef _I915_DRM_H_ #define _I915_DRM_H_ -#include <drm.h> +#include "drm.h" /* Please note that modifications to all structs defined here are * subject to backwards-compatibility constraints. @@ -171,8 +171,12 @@ typedef struct _drm_i915_sarea { #define I915_BOX_TEXTURE_LOAD 0x8 #define I915_BOX_LOST_CONTEXT 0x10 -/* I915 specific ioctls - * The device specific ioctl range is 0x40 to 0x79. +/* + * i915 specific ioctls. + * + * The device specific ioctl range is [DRM_COMMAND_BASE, DRM_COMMAND_END) ie + * [0x40, 0xa0) (a0 is excluded). The numbers below are defined as offset + * against DRM_COMMAND_BASE and should be between [0x0, 0x60). */ #define DRM_I915_INIT 0x00 #define DRM_I915_FLUSH 0x01 @@ -357,9 +361,16 @@ typedef struct drm_i915_irq_wait { #define I915_PARAM_REVISION 32 #define I915_PARAM_SUBSLICE_TOTAL 33 #define I915_PARAM_EU_TOTAL 34 +#define I915_PARAM_HAS_GPU_RESET 35 +#define I915_PARAM_HAS_RESOURCE_STREAMER 36 +#define I915_PARAM_HAS_EXEC_SOFTPIN 37 typedef struct drm_i915_getparam { - int param; + __s32 param; + /* + * WARNING: Using pointers instead of fixed-size u64 means we need to write + * compat32 code. Don't repeat this mistake. + */ int *value; } drm_i915_getparam_t; @@ -681,15 +692,21 @@ struct drm_i915_gem_exec_object2 { __u64 alignment; /** - * Returned value of the updated offset of the object, for future - * presumed_offset writes. + * When the EXEC_OBJECT_PINNED flag is specified this is populated by + * the user with the GTT offset at which this object will be pinned. + * When the I915_EXEC_NO_RELOC flag is specified this must contain the + * presumed_offset of the object. + * During execbuffer2 the kernel populates it with the value of the + * current GTT offset of the object, for future presumed_offset writes. */ __u64 offset; #define EXEC_OBJECT_NEEDS_FENCE (1<<0) #define EXEC_OBJECT_NEEDS_GTT (1<<1) #define EXEC_OBJECT_WRITE (1<<2) -#define __EXEC_OBJECT_UNKNOWN_FLAGS -(EXEC_OBJECT_WRITE<<1) +#define EXEC_OBJECT_SUPPORTS_48B_ADDRESS (1<<3) +#define EXEC_OBJECT_PINNED (1<<4) +#define __EXEC_OBJECT_UNKNOWN_FLAGS -(EXEC_OBJECT_PINNED<<1) __u64 flags; __u64 rsvd1; @@ -771,7 +788,12 @@ struct drm_i915_gem_execbuffer2 { #define I915_EXEC_BSD_RING1 (1<<13) #define I915_EXEC_BSD_RING2 (2<<13) -#define __I915_EXEC_UNKNOWN_FLAGS -(1<<15) +/** Tell the kernel that the batchbuffer is processed by + * the resource streamer. + */ +#define I915_EXEC_RESOURCE_STREAMER (1<<15) + +#define __I915_EXEC_UNKNOWN_FLAGS -(I915_EXEC_RESOURCE_STREAMER<<1) #define I915_EXEC_CONTEXT_ID_MASK (0xffffffff) #define i915_execbuffer2_set_context_id(eb2, context) \ @@ -1007,6 +1029,7 @@ struct drm_intel_overlay_put_image { /* flags */ #define I915_OVERLAY_UPDATE_ATTRS (1<<0) #define I915_OVERLAY_UPDATE_GAMMA (1<<1) +#define I915_OVERLAY_DISABLE_DEST_COLORKEY (1<<2) struct drm_intel_overlay_attrs { __u32 flags; __u32 color_key; @@ -1073,9 +1096,23 @@ struct drm_i915_gem_context_destroy { }; struct drm_i915_reg_read { + /* + * Register offset. + * For 64bit wide registers where the upper 32bits don't immediately + * follow the lower 32bits, the offset of the lower 32bits must + * be specified + */ __u64 offset; __u64 val; /* Return value */ }; +/* Known registers: + * + * Render engine timestamp - 0x2358 + 64bit - gen7+ + * - Note this register returns an invalid value if using the default + * single instruction 8byte read, in order to workaround that use + * offset (0x2538 | 1) instead. + * + */ struct drm_i915_reset_stats { __u32 ctx_id; @@ -1111,7 +1148,9 @@ struct drm_i915_gem_context_param { __u32 ctx_id; __u32 size; __u64 param; -#define I915_CONTEXT_PARAM_BAN_PERIOD 0x1 +#define I915_CONTEXT_PARAM_BAN_PERIOD 0x1 +#define I915_CONTEXT_PARAM_NO_ZEROMAP 0x2 +#define I915_CONTEXT_PARAM_GTT_SIZE 0x3 __u64 value; }; diff --git a/lib/libdrm/intel/intel_bufmgr.c b/lib/libdrm/intel/intel_bufmgr.c index 14ea9f9fa..a28534003 100644 --- a/lib/libdrm/intel/intel_bufmgr.c +++ b/lib/libdrm/intel/intel_bufmgr.c @@ -261,6 +261,15 @@ drm_intel_bo_get_tiling(drm_intel_bo *bo, uint32_t * tiling_mode, } int +drm_intel_bo_set_softpin_offset(drm_intel_bo *bo, uint64_t offset) +{ + if (bo->bufmgr->bo_set_softpin_offset) + return bo->bufmgr->bo_set_softpin_offset(bo, offset); + + return -ENODEV; +} + +int drm_intel_bo_disable_reuse(drm_intel_bo *bo) { if (bo->bufmgr->bo_disable_reuse) @@ -293,6 +302,17 @@ drm_intel_bo_madvise(drm_intel_bo *bo, int madv) } int +drm_intel_bo_use_48b_address_range(drm_intel_bo *bo, uint32_t enable) +{ + if (bo->bufmgr->bo_use_48b_address_range) { + bo->bufmgr->bo_use_48b_address_range(bo, enable); + return 0; + } + + return -ENODEV; +} + +int drm_intel_bo_references(drm_intel_bo *bo, drm_intel_bo *target_bo) { return bo->bufmgr->bo_references(bo, target_bo); diff --git a/lib/libdrm/intel/intel_bufmgr.h b/lib/libdrm/intel/intel_bufmgr.h index 95eecb800..a1abbcd2b 100644 --- a/lib/libdrm/intel/intel_bufmgr.h +++ b/lib/libdrm/intel/intel_bufmgr.h @@ -164,6 +164,8 @@ int drm_intel_bo_get_tiling(drm_intel_bo *bo, uint32_t * tiling_mode, int drm_intel_bo_flink(drm_intel_bo *bo, uint32_t * name); int drm_intel_bo_busy(drm_intel_bo *bo); int drm_intel_bo_madvise(drm_intel_bo *bo, int madv); +int drm_intel_bo_use_48b_address_range(drm_intel_bo *bo, uint32_t enable); +int drm_intel_bo_set_softpin_offset(drm_intel_bo *bo, uint64_t offset); int drm_intel_bo_disable_reuse(drm_intel_bo *bo); int drm_intel_bo_is_reusable(drm_intel_bo *bo); diff --git a/lib/libdrm/intel/intel_bufmgr_fake.c b/lib/libdrm/intel/intel_bufmgr_fake.c index 551e05dee..7f4c7b9fa 100644 --- a/lib/libdrm/intel/intel_bufmgr_fake.c +++ b/lib/libdrm/intel/intel_bufmgr_fake.c @@ -42,6 +42,7 @@ #include <string.h> #include <assert.h> #include <errno.h> +#include <strings.h> #include <xf86drm.h> #include <pthread.h> #include "intel_bufmgr.h" diff --git a/lib/libdrm/intel/intel_bufmgr_gem.c b/lib/libdrm/intel/intel_bufmgr_gem.c index ef437cbd2..93261ce97 100644 --- a/lib/libdrm/intel/intel_bufmgr_gem.c +++ b/lib/libdrm/intel/intel_bufmgr_gem.c @@ -83,6 +83,22 @@ #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) #define MAX2(A, B) ((A) > (B) ? (A) : (B)) +/** + * upper_32_bits - return bits 32-63 of a number + * @n: the number we're accessing + * + * A basic shift-right of a 64- or 32-bit quantity. Use this to suppress + * the "right shift count >= width of type" warning when that quantity is + * 32-bits. + */ +#define upper_32_bits(n) ((__u32)(((n) >> 16) >> 16)) + +/** + * lower_32_bits - return bits 0-31 of a number + * @n: the number we're accessing + */ +#define lower_32_bits(n) ((__u32)(n)) + typedef struct _drm_intel_bo_gem drm_intel_bo_gem; struct drm_intel_gem_bo_bucket { @@ -186,6 +202,13 @@ struct _drm_intel_bo_gem { drm_intel_reloc_target *reloc_target_info; /** Number of entries in relocs */ int reloc_count; + /** Array of BOs that are referenced by this buffer and will be softpinned */ + drm_intel_bo **softpin_target; + /** Number softpinned BOs that are referenced by this buffer */ + int softpin_target_count; + /** Maximum amount of softpinned BOs that are referenced by this buffer */ + int softpin_target_size; + /** Mapped address for the buffer, saved across map/unmap cycles */ void *mem_virtual; /** GTT virtual address for the buffer, saved across map/unmap cycles */ @@ -239,6 +262,20 @@ struct _drm_intel_bo_gem { bool is_userptr; /** + * Boolean of whether this buffer can be placed in the full 48-bit + * address range on gen8+. + * + * By default, buffers will be keep in a 32-bit range, unless this + * flag is explicitly set. + */ + bool use_48b_address_range; + + /** + * Whether this buffer is softpinned at offset specified by the user + */ + bool is_softpin; + + /** * Size in bytes of this buffer and its relocation descendents. * * Used to avoid costly tree walking in @@ -391,8 +428,9 @@ drm_intel_gem_dump_validation_list(drm_intel_bufmgr_gem *bufmgr_gem) drm_intel_bo *bo = bufmgr_gem->exec_bos[i]; drm_intel_bo_gem *bo_gem = (drm_intel_bo_gem *) bo; - if (bo_gem->relocs == NULL) { - DBG("%2d: %d (%s)\n", i, bo_gem->gem_handle, + if (bo_gem->relocs == NULL && bo_gem->softpin_target == NULL) { + DBG("%2d: %d %s(%s)\n", i, bo_gem->gem_handle, + bo_gem->is_softpin ? "*" : "", bo_gem->name); continue; } @@ -402,16 +440,36 @@ drm_intel_gem_dump_validation_list(drm_intel_bufmgr_gem *bufmgr_gem) drm_intel_bo_gem *target_gem = (drm_intel_bo_gem *) target_bo; - DBG("%2d: %d (%s)@0x%08llx -> " - "%d (%s)@0x%08lx + 0x%08x\n", + DBG("%2d: %d %s(%s)@0x%08x %08x -> " + "%d (%s)@0x%08x %08x + 0x%08x\n", i, - bo_gem->gem_handle, bo_gem->name, - (unsigned long long)bo_gem->relocs[j].offset, + bo_gem->gem_handle, + bo_gem->is_softpin ? "*" : "", + bo_gem->name, + upper_32_bits(bo_gem->relocs[j].offset), + lower_32_bits(bo_gem->relocs[j].offset), target_gem->gem_handle, target_gem->name, - target_bo->offset64, + upper_32_bits(target_bo->offset64), + lower_32_bits(target_bo->offset64), bo_gem->relocs[j].delta); } + + for (j = 0; j < bo_gem->softpin_target_count; j++) { + drm_intel_bo *target_bo = bo_gem->softpin_target[j]; + drm_intel_bo_gem *target_gem = + (drm_intel_bo_gem *) target_bo; + DBG("%2d: %d %s(%s) -> " + "%d *(%s)@0x%08x %08x\n", + i, + bo_gem->gem_handle, + bo_gem->is_softpin ? "*" : "", + bo_gem->name, + target_gem->gem_handle, + target_gem->name, + upper_32_bits(target_bo->offset64), + lower_32_bits(target_bo->offset64)); + } } } @@ -477,11 +535,17 @@ drm_intel_add_validate_buffer2(drm_intel_bo *bo, int need_fence) drm_intel_bufmgr_gem *bufmgr_gem = (drm_intel_bufmgr_gem *)bo->bufmgr; drm_intel_bo_gem *bo_gem = (drm_intel_bo_gem *)bo; int index; + int flags = 0; + + if (need_fence) + flags |= EXEC_OBJECT_NEEDS_FENCE; + if (bo_gem->use_48b_address_range) + flags |= EXEC_OBJECT_SUPPORTS_48B_ADDRESS; + if (bo_gem->is_softpin) + flags |= EXEC_OBJECT_PINNED; if (bo_gem->validate_index != -1) { - if (need_fence) - bufmgr_gem->exec2_objects[bo_gem->validate_index].flags |= - EXEC_OBJECT_NEEDS_FENCE; + bufmgr_gem->exec2_objects[bo_gem->validate_index].flags |= flags; return; } @@ -508,15 +572,12 @@ drm_intel_add_validate_buffer2(drm_intel_bo *bo, int need_fence) bufmgr_gem->exec2_objects[index].relocation_count = bo_gem->reloc_count; bufmgr_gem->exec2_objects[index].relocs_ptr = (uintptr_t)bo_gem->relocs; bufmgr_gem->exec2_objects[index].alignment = bo->align; - bufmgr_gem->exec2_objects[index].offset = 0; + bufmgr_gem->exec2_objects[index].offset = bo_gem->is_softpin ? + bo->offset64 : 0; bufmgr_gem->exec_bos[index] = bo; - bufmgr_gem->exec2_objects[index].flags = 0; + bufmgr_gem->exec2_objects[index].flags = flags; bufmgr_gem->exec2_objects[index].rsvd1 = 0; bufmgr_gem->exec2_objects[index].rsvd2 = 0; - if (need_fence) { - bufmgr_gem->exec2_objects[index].flags |= - EXEC_OBJECT_NEEDS_FENCE; - } bufmgr_gem->exec_count++; } @@ -789,6 +850,7 @@ retry: bo_gem->used_as_reloc_target = false; bo_gem->has_error = false; bo_gem->reusable = true; + bo_gem->use_48b_address_range = false; drm_intel_bo_gem_set_in_aperture_size(bufmgr_gem, bo_gem, alignment); @@ -935,6 +997,7 @@ drm_intel_gem_bo_alloc_userptr(drm_intel_bufmgr *bufmgr, bo_gem->used_as_reloc_target = false; bo_gem->has_error = false; bo_gem->reusable = false; + bo_gem->use_48b_address_range = false; drm_intel_bo_gem_set_in_aperture_size(bufmgr_gem, bo_gem, 0); @@ -1090,6 +1153,7 @@ drm_intel_bo_gem_create_from_name(drm_intel_bufmgr *bufmgr, bo_gem->bo.handle = open_arg.handle; bo_gem->global_name = handle; bo_gem->reusable = false; + bo_gem->use_48b_address_range = false; memclear(get_tiling); get_tiling.handle = bo_gem->gem_handle; @@ -1265,8 +1329,12 @@ drm_intel_gem_bo_unreference_final(drm_intel_bo *bo, time_t time) time); } } + for (i = 0; i < bo_gem->softpin_target_count; i++) + drm_intel_gem_bo_unreference_locked_timed(bo_gem->softpin_target[i], + time); bo_gem->reloc_count = 0; bo_gem->used_as_reloc_target = false; + bo_gem->softpin_target_count = 0; DBG("bo_unreference final: %d (%s)\n", bo_gem->gem_handle, bo_gem->name); @@ -1280,6 +1348,11 @@ drm_intel_gem_bo_unreference_final(drm_intel_bo *bo, time_t time) free(bo_gem->relocs); bo_gem->relocs = NULL; } + if (bo_gem->softpin_target) { + free(bo_gem->softpin_target); + bo_gem->softpin_target = NULL; + bo_gem->softpin_target_size = 0; + } /* Clear any left-over mappings */ if (bo_gem->map_count) { @@ -1919,14 +1992,6 @@ do_bo_emit_reloc(drm_intel_bo *bo, uint32_t offset, bo_gem->reloc_tree_fences += target_bo_gem->reloc_tree_fences; } - bo_gem->relocs[bo_gem->reloc_count].offset = offset; - bo_gem->relocs[bo_gem->reloc_count].delta = target_offset; - bo_gem->relocs[bo_gem->reloc_count].target_handle = - target_bo_gem->gem_handle; - bo_gem->relocs[bo_gem->reloc_count].read_domains = read_domains; - bo_gem->relocs[bo_gem->reloc_count].write_domain = write_domain; - bo_gem->relocs[bo_gem->reloc_count].presumed_offset = target_bo->offset64; - bo_gem->reloc_target_info[bo_gem->reloc_count].bo = target_bo; if (target_bo != bo) drm_intel_gem_bo_reference(target_bo); @@ -1936,21 +2001,77 @@ do_bo_emit_reloc(drm_intel_bo *bo, uint32_t offset, else bo_gem->reloc_target_info[bo_gem->reloc_count].flags = 0; + bo_gem->relocs[bo_gem->reloc_count].offset = offset; + bo_gem->relocs[bo_gem->reloc_count].delta = target_offset; + bo_gem->relocs[bo_gem->reloc_count].target_handle = + target_bo_gem->gem_handle; + bo_gem->relocs[bo_gem->reloc_count].read_domains = read_domains; + bo_gem->relocs[bo_gem->reloc_count].write_domain = write_domain; + bo_gem->relocs[bo_gem->reloc_count].presumed_offset = target_bo->offset64; bo_gem->reloc_count++; return 0; } +static void +drm_intel_gem_bo_use_48b_address_range(drm_intel_bo *bo, uint32_t enable) +{ + drm_intel_bo_gem *bo_gem = (drm_intel_bo_gem *) bo; + bo_gem->use_48b_address_range = enable; +} + +static int +drm_intel_gem_bo_add_softpin_target(drm_intel_bo *bo, drm_intel_bo *target_bo) +{ + drm_intel_bufmgr_gem *bufmgr_gem = (drm_intel_bufmgr_gem *) bo->bufmgr; + drm_intel_bo_gem *bo_gem = (drm_intel_bo_gem *) bo; + drm_intel_bo_gem *target_bo_gem = (drm_intel_bo_gem *) target_bo; + if (bo_gem->has_error) + return -ENOMEM; + + if (target_bo_gem->has_error) { + bo_gem->has_error = true; + return -ENOMEM; + } + + if (!target_bo_gem->is_softpin) + return -EINVAL; + if (target_bo_gem == bo_gem) + return -EINVAL; + + if (bo_gem->softpin_target_count == bo_gem->softpin_target_size) { + int new_size = bo_gem->softpin_target_size * 2; + if (new_size == 0) + new_size = bufmgr_gem->max_relocs; + + bo_gem->softpin_target = realloc(bo_gem->softpin_target, new_size * + sizeof(drm_intel_bo *)); + if (!bo_gem->softpin_target) + return -ENOMEM; + + bo_gem->softpin_target_size = new_size; + } + bo_gem->softpin_target[bo_gem->softpin_target_count] = target_bo; + drm_intel_gem_bo_reference(target_bo); + bo_gem->softpin_target_count++; + + return 0; +} + static int drm_intel_gem_bo_emit_reloc(drm_intel_bo *bo, uint32_t offset, drm_intel_bo *target_bo, uint32_t target_offset, uint32_t read_domains, uint32_t write_domain) { drm_intel_bufmgr_gem *bufmgr_gem = (drm_intel_bufmgr_gem *)bo->bufmgr; + drm_intel_bo_gem *target_bo_gem = (drm_intel_bo_gem *)target_bo; - return do_bo_emit_reloc(bo, offset, target_bo, target_offset, - read_domains, write_domain, - !bufmgr_gem->fenced_relocs); + if (target_bo_gem->is_softpin) + return drm_intel_gem_bo_add_softpin_target(bo, target_bo); + else + return do_bo_emit_reloc(bo, offset, target_bo, target_offset, + read_domains, write_domain, + !bufmgr_gem->fenced_relocs); } static int @@ -1983,6 +2104,8 @@ drm_intel_gem_bo_get_reloc_count(drm_intel_bo *bo) * * Any further drm_intel_bufmgr_check_aperture_space() queries * involving this buffer in the tree are undefined after this call. + * + * This also removes all softpinned targets being referenced by the BO. */ void drm_intel_gem_bo_clear_relocs(drm_intel_bo *bo, int start) @@ -2009,6 +2132,12 @@ drm_intel_gem_bo_clear_relocs(drm_intel_bo *bo, int start) } bo_gem->reloc_count = start; + for (i = 0; i < bo_gem->softpin_target_count; i++) { + drm_intel_bo_gem *target_bo_gem = (drm_intel_bo_gem *) bo_gem->softpin_target[i]; + drm_intel_gem_bo_unreference_locked_timed(&target_bo_gem->bo, time.tv_sec); + } + bo_gem->softpin_target_count = 0; + pthread_mutex_unlock(&bufmgr_gem->lock); } @@ -2051,7 +2180,7 @@ drm_intel_gem_bo_process_reloc2(drm_intel_bo *bo) drm_intel_bo_gem *bo_gem = (drm_intel_bo_gem *)bo; int i; - if (bo_gem->relocs == NULL) + if (bo_gem->relocs == NULL && bo_gem->softpin_target == NULL) return; for (i = 0; i < bo_gem->reloc_count; i++) { @@ -2072,6 +2201,17 @@ drm_intel_gem_bo_process_reloc2(drm_intel_bo *bo) /* Add the target to the validate list */ drm_intel_add_validate_buffer2(target_bo, need_fence); } + + for (i = 0; i < bo_gem->softpin_target_count; i++) { + drm_intel_bo *target_bo = bo_gem->softpin_target[i]; + + if (target_bo == bo) + continue; + + drm_intel_gem_bo_mark_mmaps_incoherent(bo); + drm_intel_gem_bo_process_reloc2(target_bo); + drm_intel_add_validate_buffer2(target_bo, false); + } } @@ -2087,10 +2227,12 @@ drm_intel_update_buffer_offsets(drm_intel_bufmgr_gem *bufmgr_gem) /* Update the buffer offset */ if (bufmgr_gem->exec_objects[i].offset != bo->offset64) { - DBG("BO %d (%s) migrated: 0x%08lx -> 0x%08llx\n", - bo_gem->gem_handle, bo_gem->name, bo->offset64, - (unsigned long long)bufmgr_gem->exec_objects[i]. - offset); + DBG("BO %d (%s) migrated: 0x%08x %08x -> 0x%08x %08x\n", + bo_gem->gem_handle, bo_gem->name, + upper_32_bits(bo->offset64), + lower_32_bits(bo->offset64), + upper_32_bits(bufmgr_gem->exec_objects[i].offset), + lower_32_bits(bufmgr_gem->exec_objects[i].offset)); bo->offset64 = bufmgr_gem->exec_objects[i].offset; bo->offset = bufmgr_gem->exec_objects[i].offset; } @@ -2109,9 +2251,16 @@ drm_intel_update_buffer_offsets2 (drm_intel_bufmgr_gem *bufmgr_gem) /* Update the buffer offset */ if (bufmgr_gem->exec2_objects[i].offset != bo->offset64) { - DBG("BO %d (%s) migrated: 0x%08lx -> 0x%08llx\n", - bo_gem->gem_handle, bo_gem->name, bo->offset64, - (unsigned long long)bufmgr_gem->exec2_objects[i].offset); + /* If we're seeing softpinned object here it means that the kernel + * has relocated our object... Indicating a programming error + */ + assert(!bo_gem->is_softpin); + DBG("BO %d (%s) migrated: 0x%08x %08x -> 0x%08x %08x\n", + bo_gem->gem_handle, bo_gem->name, + upper_32_bits(bo->offset64), + lower_32_bits(bo->offset64), + upper_32_bits(bufmgr_gem->exec2_objects[i].offset), + lower_32_bits(bufmgr_gem->exec2_objects[i].offset)); bo->offset64 = bufmgr_gem->exec2_objects[i].offset; bo->offset = bufmgr_gem->exec2_objects[i].offset; } @@ -2437,6 +2586,17 @@ drm_intel_gem_bo_get_tiling(drm_intel_bo *bo, uint32_t * tiling_mode, return 0; } +static int +drm_intel_gem_bo_set_softpin_offset(drm_intel_bo *bo, uint64_t offset) +{ + drm_intel_bo_gem *bo_gem = (drm_intel_bo_gem *) bo; + + bo_gem->is_softpin = true; + bo->offset64 = offset; + bo->offset = offset; + return 0; +} + drm_intel_bo * drm_intel_bo_gem_create_from_prime(drm_intel_bufmgr *bufmgr, int prime_fd, int size) { @@ -2500,6 +2660,7 @@ drm_intel_bo_gem_create_from_prime(drm_intel_bufmgr *bufmgr, int prime_fd, int s bo_gem->used_as_reloc_target = false; bo_gem->has_error = false; bo_gem->reusable = false; + bo_gem->use_48b_address_range = false; DRMINITLISTHEAD(&bo_gem->vma_list); DRMLISTADDTAIL(&bo_gem->name_list, &bufmgr_gem->named); @@ -2815,6 +2976,13 @@ _drm_intel_gem_bo_references(drm_intel_bo *bo, drm_intel_bo *target_bo) return 1; } + for (i = 0; i< bo_gem->softpin_target_count; i++) { + if (bo_gem->softpin_target[i] == target_bo) + return 1; + if (_drm_intel_gem_bo_references(bo_gem->softpin_target[i], target_bo)) + return 1; + } + return 0; } @@ -3275,6 +3443,11 @@ drm_intel_bufmgr_gem_init(int fd, int batch_size) ret = drmIoctl(bufmgr_gem->fd, DRM_IOCTL_I915_GETPARAM, &gp); bufmgr_gem->has_vebox = (ret == 0) & (*gp.value > 0); + gp.param = I915_PARAM_HAS_EXEC_SOFTPIN; + ret = drmIoctl(bufmgr_gem->fd, DRM_IOCTL_I915_GETPARAM, &gp); + if (ret == 0 && *gp.value > 0) + bufmgr_gem->bufmgr.bo_set_softpin_offset = drm_intel_gem_bo_set_softpin_offset; + if (bufmgr_gem->gen < 4) { gp.param = I915_PARAM_NUM_FENCES_AVAIL; gp.value = &bufmgr_gem->available_fences; @@ -3301,6 +3474,13 @@ drm_intel_bufmgr_gem_init(int fd, int batch_size) } } + if (bufmgr_gem->gen >= 8) { + gp.param = I915_PARAM_HAS_ALIASING_PPGTT; + ret = drmIoctl(bufmgr_gem->fd, DRM_IOCTL_I915_GETPARAM, &gp); + if (ret == 0 && *gp.value == 3) + bufmgr_gem->bufmgr.bo_use_48b_address_range = drm_intel_gem_bo_use_48b_address_range; + } + /* Let's go with one relocation per every 2 dwords (but round down a bit * since a power of two will mean an extra page allocation for the reloc * buffer). diff --git a/lib/libdrm/intel/intel_bufmgr_priv.h b/lib/libdrm/intel/intel_bufmgr_priv.h index 59ebd1860..7e360a0b2 100644 --- a/lib/libdrm/intel/intel_bufmgr_priv.h +++ b/lib/libdrm/intel/intel_bufmgr_priv.h @@ -152,6 +152,20 @@ struct _drm_intel_bufmgr { void (*destroy) (drm_intel_bufmgr *bufmgr); /** + * Indicate if the buffer can be placed anywhere in the full ppgtt + * address range (2^48). + * + * Any resource used with flat/heapless (0x00000000-0xfffff000) + * General State Heap (GSH) or Intructions State Heap (ISH) must + * be in a 32-bit range. 48-bit range will only be used when explicitly + * requested. + * + * \param bo Buffer to set the use_48b_address_range flag. + * \param enable The flag value. + */ + void (*bo_use_48b_address_range) (drm_intel_bo *bo, uint32_t enable); + + /** * Add relocation entry in reloc_buf, which will be updated with the * target buffer's real offset on on command submission. * @@ -227,6 +241,13 @@ struct _drm_intel_bufmgr { uint32_t * swizzle_mode); /** + * Set the offset at which this buffer will be softpinned + * \param bo Buffer to set the softpin offset for + * \param offset Softpin offset + */ + int (*bo_set_softpin_offset) (drm_intel_bo *bo, uint64_t offset); + + /** * Create a visible name for a buffer which can be used by other apps * * \param buf Buffer to create a name for diff --git a/lib/libdrm/intel/intel_chipset.h b/lib/libdrm/intel/intel_chipset.h index 253ea7105..35148e522 100644 --- a/lib/libdrm/intel/intel_chipset.h +++ b/lib/libdrm/intel/intel_chipset.h @@ -165,21 +165,50 @@ #define PCI_CHIP_CHERRYVIEW_2 0x22b2 #define PCI_CHIP_CHERRYVIEW_3 0x22b3 -#define PCI_CHIP_SKYLAKE_ULT_GT2 0x1916 +#define PCI_CHIP_SKYLAKE_DT_GT1 0x1902 #define PCI_CHIP_SKYLAKE_ULT_GT1 0x1906 -#define PCI_CHIP_SKYLAKE_ULT_GT3 0x1926 -#define PCI_CHIP_SKYLAKE_ULT_GT2F 0x1921 -#define PCI_CHIP_SKYLAKE_ULX_GT1 0x190E -#define PCI_CHIP_SKYLAKE_ULX_GT2 0x191E +#define PCI_CHIP_SKYLAKE_SRV_GT1 0x190A /* Reserved */ +#define PCI_CHIP_SKYLAKE_ULX_GT1 0x190E /* Reserved */ #define PCI_CHIP_SKYLAKE_DT_GT2 0x1912 -#define PCI_CHIP_SKYLAKE_DT_GT1 0x1902 +#define PCI_CHIP_SKYLAKE_FUSED0_GT2 0x1913 /* Reserved */ +#define PCI_CHIP_SKYLAKE_FUSED1_GT2 0x1915 /* Reserved */ +#define PCI_CHIP_SKYLAKE_ULT_GT2 0x1916 +#define PCI_CHIP_SKYLAKE_FUSED2_GT2 0x1917 /* Reserved */ +#define PCI_CHIP_SKYLAKE_SRV_GT2 0x191A /* Reserved */ #define PCI_CHIP_SKYLAKE_HALO_GT2 0x191B -#define PCI_CHIP_SKYLAKE_HALO_GT3 0x192B -#define PCI_CHIP_SKYLAKE_HALO_GT1 0x190B -#define PCI_CHIP_SKYLAKE_SRV_GT2 0x191A -#define PCI_CHIP_SKYLAKE_SRV_GT3 0x192A -#define PCI_CHIP_SKYLAKE_SRV_GT1 0x190A #define PCI_CHIP_SKYLAKE_WKS_GT2 0x191D +#define PCI_CHIP_SKYLAKE_ULX_GT2 0x191E +#define PCI_CHIP_SKYLAKE_MOBILE_GT2 0x1921 /* Reserved */ +#define PCI_CHIP_SKYLAKE_GT3 0x1926 +#define PCI_CHIP_SKYLAKE_HALO_GT3 0x192B /* Reserved */ +#define PCI_CHIP_SKYLAKE_SRV_GT4 0x192A +#define PCI_CHIP_SKYLAKE_DT_GT4 0x1932 +#define PCI_CHIP_SKYLAKE_SRV_GT4X 0x193A +#define PCI_CHIP_SKYLAKE_H_GT4 0x193B +#define PCI_CHIP_SKYLAKE_WKS_GT4 0x193D + +#define PCI_CHIP_KABYLAKE_ULT_GT2 0x5916 +#define PCI_CHIP_KABYLAKE_ULT_GT1_5 0x5913 +#define PCI_CHIP_KABYLAKE_ULT_GT1 0x5906 +#define PCI_CHIP_KABYLAKE_ULT_GT3 0x5926 +#define PCI_CHIP_KABYLAKE_ULT_GT2F 0x5921 +#define PCI_CHIP_KABYLAKE_ULX_GT1_5 0x5915 +#define PCI_CHIP_KABYLAKE_ULX_GT1 0x590E +#define PCI_CHIP_KABYLAKE_ULX_GT2 0x591E +#define PCI_CHIP_KABYLAKE_DT_GT2 0x5912 +#define PCI_CHIP_KABYLAKE_DT_GT1_5 0x5917 +#define PCI_CHIP_KABYLAKE_DT_GT1 0x5902 +#define PCI_CHIP_KABYLAKE_DT_GT4 0x5932 +#define PCI_CHIP_KABYLAKE_HALO_GT2 0x591B +#define PCI_CHIP_KABYLAKE_HALO_GT4 0x593B +#define PCI_CHIP_KABYLAKE_HALO_GT3 0x592B +#define PCI_CHIP_KABYLAKE_HALO_GT1 0x590B +#define PCI_CHIP_KABYLAKE_SRV_GT2 0x591A +#define PCI_CHIP_KABYLAKE_SRV_GT3 0x592A +#define PCI_CHIP_KABYLAKE_SRV_GT1 0x590A +#define PCI_CHIP_KABYLAKE_SRV_GT4 0x593A +#define PCI_CHIP_KABYLAKE_WKS_GT2 0x591D +#define PCI_CHIP_KABYLAKE_WKS_GT4 0x593D #define PCI_CHIP_BROXTON_0 0x0A84 #define PCI_CHIP_BROXTON_1 0x1A84 @@ -347,31 +376,71 @@ #define IS_SKL_GT1(devid) ((devid) == PCI_CHIP_SKYLAKE_ULT_GT1 || \ (devid) == PCI_CHIP_SKYLAKE_ULX_GT1 || \ (devid) == PCI_CHIP_SKYLAKE_DT_GT1 || \ - (devid) == PCI_CHIP_SKYLAKE_HALO_GT1 || \ (devid) == PCI_CHIP_SKYLAKE_SRV_GT1) -#define IS_SKL_GT2(devid) ((devid) == PCI_CHIP_SKYLAKE_ULT_GT2 || \ - (devid) == PCI_CHIP_SKYLAKE_ULT_GT2F || \ - (devid) == PCI_CHIP_SKYLAKE_ULX_GT2 || \ - (devid) == PCI_CHIP_SKYLAKE_DT_GT2 || \ - (devid) == PCI_CHIP_SKYLAKE_HALO_GT2 || \ +#define IS_SKL_GT2(devid) ((devid) == PCI_CHIP_SKYLAKE_DT_GT2 || \ + (devid) == PCI_CHIP_SKYLAKE_FUSED0_GT2 || \ + (devid) == PCI_CHIP_SKYLAKE_FUSED1_GT2 || \ + (devid) == PCI_CHIP_SKYLAKE_ULT_GT2 || \ + (devid) == PCI_CHIP_SKYLAKE_FUSED2_GT2 || \ (devid) == PCI_CHIP_SKYLAKE_SRV_GT2 || \ - (devid) == PCI_CHIP_SKYLAKE_WKS_GT2) - -#define IS_SKL_GT3(devid) ((devid) == PCI_CHIP_SKYLAKE_ULT_GT3 || \ - (devid) == PCI_CHIP_SKYLAKE_HALO_GT3 || \ - (devid) == PCI_CHIP_SKYLAKE_SRV_GT3) + (devid) == PCI_CHIP_SKYLAKE_HALO_GT2 || \ + (devid) == PCI_CHIP_SKYLAKE_WKS_GT2 || \ + (devid) == PCI_CHIP_SKYLAKE_ULX_GT2 || \ + (devid) == PCI_CHIP_SKYLAKE_MOBILE_GT2) + +#define IS_SKL_GT3(devid) ((devid) == PCI_CHIP_SKYLAKE_GT3 || \ + (devid) == PCI_CHIP_SKYLAKE_HALO_GT3) + +#define IS_SKL_GT4(devid) ((devid) == PCI_CHIP_SKYLAKE_SRV_GT4 || \ + (devid) == PCI_CHIP_SKYLAKE_DT_GT4 || \ + (devid) == PCI_CHIP_SKYLAKE_SRV_GT4X || \ + (devid) == PCI_CHIP_SKYLAKE_H_GT4 || \ + (devid) == PCI_CHIP_SKYLAKE_WKS_GT4) + +#define IS_KBL_GT1(devid) ((devid) == PCI_CHIP_KABYLAKE_ULT_GT1_5 || \ + (devid) == PCI_CHIP_KABYLAKE_ULX_GT1_5 || \ + (devid) == PCI_CHIP_KABYLAKE_DT_GT1_5 || \ + (devid) == PCI_CHIP_KABYLAKE_ULT_GT1 || \ + (devid) == PCI_CHIP_KABYLAKE_ULX_GT1 || \ + (devid) == PCI_CHIP_KABYLAKE_DT_GT1 || \ + (devid) == PCI_CHIP_KABYLAKE_HALO_GT1 || \ + (devid) == PCI_CHIP_KABYLAKE_SRV_GT1) + +#define IS_KBL_GT2(devid) ((devid) == PCI_CHIP_KABYLAKE_ULT_GT2 || \ + (devid) == PCI_CHIP_KABYLAKE_ULT_GT2F || \ + (devid) == PCI_CHIP_KABYLAKE_ULX_GT2 || \ + (devid) == PCI_CHIP_KABYLAKE_DT_GT2 || \ + (devid) == PCI_CHIP_KABYLAKE_HALO_GT2 || \ + (devid) == PCI_CHIP_KABYLAKE_SRV_GT2 || \ + (devid) == PCI_CHIP_KABYLAKE_WKS_GT2) + +#define IS_KBL_GT3(devid) ((devid) == PCI_CHIP_KABYLAKE_ULT_GT3 || \ + (devid) == PCI_CHIP_KABYLAKE_HALO_GT3 || \ + (devid) == PCI_CHIP_KABYLAKE_SRV_GT3) + +#define IS_KBL_GT4(devid) ((devid) == PCI_CHIP_KABYLAKE_DT_GT4 || \ + (devid) == PCI_CHIP_KABYLAKE_HALO_GT4 || \ + (devid) == PCI_CHIP_KABYLAKE_SRV_GT4 || \ + (devid) == PCI_CHIP_KABYLAKE_WKS_GT4) + +#define IS_KABYLAKE(devid) (IS_KBL_GT1(devid) || \ + IS_KBL_GT2(devid) || \ + IS_KBL_GT3(devid) || \ + IS_KBL_GT4(devid)) #define IS_SKYLAKE(devid) (IS_SKL_GT1(devid) || \ IS_SKL_GT2(devid) || \ - IS_SKL_GT3(devid)) + IS_SKL_GT3(devid) || \ + IS_SKL_GT4(devid)) #define IS_BROXTON(devid) ((devid) == PCI_CHIP_BROXTON_0 || \ (devid) == PCI_CHIP_BROXTON_1 || \ (devid) == PCI_CHIP_BROXTON_2) #define IS_GEN9(devid) (IS_SKYLAKE(devid) || \ - IS_BROXTON(devid)) + IS_BROXTON(devid) || \ + IS_KABYLAKE(devid)) #define IS_9XX(dev) (IS_GEN3(dev) || \ IS_GEN4(dev) || \ diff --git a/lib/libdrm/intel/intel_decode.c b/lib/libdrm/intel/intel_decode.c index e7aef742a..287c34277 100644 --- a/lib/libdrm/intel/intel_decode.c +++ b/lib/libdrm/intel/intel_decode.c @@ -38,8 +38,6 @@ #include "intel_chipset.h" #include "intel_bufmgr.h" -/* The compiler throws ~90 warnings. Do not spam the build, until we fix them. */ -#pragma GCC diagnostic ignored "-Wmissing-field-initializers" /* Struct for tracking drm_intel_decode state. */ struct drm_intel_decode { diff --git a/lib/libdrm/libkms/libkms.pc.in b/lib/libdrm/libkms/libkms.pc.in index 511535ad5..1421b3eaa 100644 --- a/lib/libdrm/libkms/libkms.pc.in +++ b/lib/libdrm/libkms/libkms.pc.in @@ -8,3 +8,4 @@ Description: Library that abstract aways the different mm interface for kernel d Version: 1.0.0 Libs: -L${libdir} -lkms Cflags: -I${includedir}/libkms +Requires.private: libdrm diff --git a/lib/libdrm/nouveau/Makefile.in b/lib/libdrm/nouveau/Makefile.in index d93e52d03..ae07ccdb0 100644 --- a/lib/libdrm/nouveau/Makefile.in +++ b/lib/libdrm/nouveau/Makefile.in @@ -52,7 +52,8 @@ PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ -DIST_COMMON = $(libdrm_nouveauinclude_HEADERS) $(srcdir)/Makefile.am \ +DIST_COMMON = $(libdrm_nouveauinclude_HEADERS) \ + $(libdrm_nouveaunvifinclude_HEADERS) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in $(srcdir)/Makefile.sources \ $(srcdir)/libdrm_nouveau.pc.in $(top_srcdir)/build-aux/depcomp subdir = nouveau @@ -96,7 +97,8 @@ am__uninstall_files_from_dir = { \ } am__installdirs = "$(DESTDIR)$(libdrm_nouveau_ladir)" \ "$(DESTDIR)$(pkgconfigdir)" \ - "$(DESTDIR)$(libdrm_nouveauincludedir)" + "$(DESTDIR)$(libdrm_nouveauincludedir)" \ + "$(DESTDIR)$(libdrm_nouveaunvifincludedir)" LTLIBRARIES = $(libdrm_nouveau_la_LTLIBRARIES) libdrm_nouveau_la_DEPENDENCIES = ../libdrm.la am__objects_1 = nouveau.lo pushbuf.lo bufctx.lo abi16.lo @@ -152,7 +154,8 @@ am__can_run_installinfo = \ *) (install-info --version) >/dev/null 2>&1;; \ esac DATA = $(pkgconfig_DATA) -HEADERS = $(libdrm_nouveauinclude_HEADERS) +HEADERS = $(libdrm_nouveauinclude_HEADERS) \ + $(libdrm_nouveaunvifinclude_HEADERS) ETAGS = etags CTAGS = ctags am__tty_colors_dummy = \ @@ -332,8 +335,17 @@ libdrm_nouveau_ladir = $(libdir) libdrm_nouveau_la_LDFLAGS = -version-number 2:0:0 -no-undefined libdrm_nouveau_la_LIBADD = ../libdrm.la @PTHREADSTUBS_LIBS@ libdrm_nouveau_la_SOURCES = $(LIBDRM_NOUVEAU_FILES) -libdrm_nouveauincludedir = ${includedir}/libdrm +libdrm_nouveauincludedir = ${includedir}/libdrm/nouveau libdrm_nouveauinclude_HEADERS = $(LIBDRM_NOUVEAU_H_FILES) +libdrm_nouveaunvifincludedir = ${includedir}/libdrm/nouveau/nvif +libdrm_nouveaunvifinclude_HEADERS = nvif/class.h \ + nvif/cl0080.h \ + nvif/cl9097.h \ + nvif/if0002.h \ + nvif/if0003.h \ + nvif/ioctl.h \ + nvif/unpack.h + pkgconfig_DATA = libdrm_nouveau.pc TESTS = nouveau-symbol-check EXTRA_DIST = Android.mk $(TESTS) @@ -490,6 +502,27 @@ uninstall-libdrm_nouveauincludeHEADERS: @list='$(libdrm_nouveauinclude_HEADERS)'; test -n "$(libdrm_nouveauincludedir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(libdrm_nouveauincludedir)'; $(am__uninstall_files_from_dir) +install-libdrm_nouveaunvifincludeHEADERS: $(libdrm_nouveaunvifinclude_HEADERS) + @$(NORMAL_INSTALL) + @list='$(libdrm_nouveaunvifinclude_HEADERS)'; test -n "$(libdrm_nouveaunvifincludedir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(libdrm_nouveaunvifincludedir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(libdrm_nouveaunvifincludedir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(libdrm_nouveaunvifincludedir)'"; \ + $(INSTALL_HEADER) $$files "$(DESTDIR)$(libdrm_nouveaunvifincludedir)" || exit $$?; \ + done + +uninstall-libdrm_nouveaunvifincludeHEADERS: + @$(NORMAL_UNINSTALL) + @list='$(libdrm_nouveaunvifinclude_HEADERS)'; test -n "$(libdrm_nouveaunvifincludedir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + dir='$(DESTDIR)$(libdrm_nouveaunvifincludedir)'; $(am__uninstall_files_from_dir) ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ @@ -685,7 +718,7 @@ check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) $(DATA) $(HEADERS) installdirs: - for dir in "$(DESTDIR)$(libdrm_nouveau_ladir)" "$(DESTDIR)$(pkgconfigdir)" "$(DESTDIR)$(libdrm_nouveauincludedir)"; do \ + for dir in "$(DESTDIR)$(libdrm_nouveau_ladir)" "$(DESTDIR)$(pkgconfigdir)" "$(DESTDIR)$(libdrm_nouveauincludedir)" "$(DESTDIR)$(libdrm_nouveaunvifincludedir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am @@ -742,7 +775,8 @@ info: info-am info-am: install-data-am: install-libdrm_nouveau_laLTLIBRARIES \ - install-libdrm_nouveauincludeHEADERS install-pkgconfigDATA + install-libdrm_nouveauincludeHEADERS \ + install-libdrm_nouveaunvifincludeHEADERS install-pkgconfigDATA install-dvi: install-dvi-am @@ -789,7 +823,9 @@ ps: ps-am ps-am: uninstall-am: uninstall-libdrm_nouveau_laLTLIBRARIES \ - uninstall-libdrm_nouveauincludeHEADERS uninstall-pkgconfigDATA + uninstall-libdrm_nouveauincludeHEADERS \ + uninstall-libdrm_nouveaunvifincludeHEADERS \ + uninstall-pkgconfigDATA .MAKE: check-am install-am install-strip @@ -801,14 +837,17 @@ uninstall-am: uninstall-libdrm_nouveau_laLTLIBRARIES \ install-data-am install-dvi install-dvi-am install-exec \ install-exec-am install-html install-html-am install-info \ install-info-am install-libdrm_nouveau_laLTLIBRARIES \ - install-libdrm_nouveauincludeHEADERS install-man install-pdf \ - install-pdf-am install-pkgconfigDATA install-ps install-ps-am \ - install-strip installcheck installcheck-am installdirs \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ - pdf pdf-am ps ps-am tags uninstall uninstall-am \ - uninstall-libdrm_nouveau_laLTLIBRARIES \ - uninstall-libdrm_nouveauincludeHEADERS uninstall-pkgconfigDATA + install-libdrm_nouveauincludeHEADERS \ + install-libdrm_nouveaunvifincludeHEADERS install-man \ + install-pdf install-pdf-am install-pkgconfigDATA install-ps \ + install-ps-am install-strip installcheck installcheck-am \ + installdirs maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am tags uninstall \ + uninstall-am uninstall-libdrm_nouveau_laLTLIBRARIES \ + uninstall-libdrm_nouveauincludeHEADERS \ + uninstall-libdrm_nouveaunvifincludeHEADERS \ + uninstall-pkgconfigDATA # Tell versions [3.59,3.63) of GNU make to not export all variables. diff --git a/lib/libdrm/radeon/libdrm_radeon.pc.in b/lib/libdrm/radeon/libdrm_radeon.pc.in index 68ef0ab14..432993a37 100644 --- a/lib/libdrm/radeon/libdrm_radeon.pc.in +++ b/lib/libdrm/radeon/libdrm_radeon.pc.in @@ -8,3 +8,4 @@ Description: Userspace interface to kernel DRM services for radeon Version: @PACKAGE_VERSION@ Libs: -L${libdir} -ldrm_radeon Cflags: -I${includedir} -I${includedir}/libdrm +Requires.private: libdrm diff --git a/lib/libdrm/radeon/radeon_bo_gem.c b/lib/libdrm/radeon/radeon_bo_gem.c index c9fe19ff4..fbd453d9c 100644 --- a/lib/libdrm/radeon/radeon_bo_gem.c +++ b/lib/libdrm/radeon/radeon_bo_gem.c @@ -103,7 +103,7 @@ static struct radeon_bo *bo_open(struct radeon_bo_manager *bom, args.size = size; args.alignment = alignment; args.initial_domain = bo->base.domains; - args.flags = 0; + args.flags = flags; args.handle = 0; r = drmCommandWriteRead(bom->fd, DRM_RADEON_GEM_CREATE, &args, sizeof(args)); diff --git a/lib/libdrm/radeon/radeon_surface.c b/lib/libdrm/radeon/radeon_surface.c index fad4bda31..5ec97454d 100644 --- a/lib/libdrm/radeon/radeon_surface.c +++ b/lib/libdrm/radeon/radeon_surface.c @@ -163,7 +163,7 @@ static void surf_minify(struct radeon_surface *surf, struct radeon_surface_level *surflevel, unsigned bpe, unsigned level, uint32_t xalign, uint32_t yalign, uint32_t zalign, - unsigned offset) + uint64_t offset) { surflevel->npix_x = mip_minify(surf->npix_x, level); surflevel->npix_y = mip_minify(surf->npix_y, level); @@ -184,7 +184,7 @@ static void surf_minify(struct radeon_surface *surf, surflevel->offset = offset; surflevel->pitch_bytes = surflevel->nblk_x * bpe * surf->nsamples; - surflevel->slice_size = surflevel->pitch_bytes * surflevel->nblk_y; + surflevel->slice_size = (uint64_t)surflevel->pitch_bytes * surflevel->nblk_y; surf->bo_size = offset + surflevel->slice_size * surflevel->nblk_z * surf->array_size; } @@ -570,7 +570,7 @@ static void eg_surf_minify(struct radeon_surface *surf, unsigned mtilew, unsigned mtileh, unsigned mtileb, - unsigned offset) + uint64_t offset) { unsigned mtile_pr, mtile_ps; @@ -598,7 +598,7 @@ static void eg_surf_minify(struct radeon_surface *surf, surflevel->offset = offset; surflevel->pitch_bytes = surflevel->nblk_x * bpe * surf->nsamples; - surflevel->slice_size = mtile_ps * mtileb * slice_pt; + surflevel->slice_size = (uint64_t)mtile_ps * mtileb * slice_pt; surf->bo_size = offset + surflevel->slice_size * surflevel->nblk_z * surf->array_size; } @@ -1415,7 +1415,7 @@ static void si_surf_minify(struct radeon_surface *surf, struct radeon_surface_level *surflevel, unsigned bpe, unsigned level, uint32_t xalign, uint32_t yalign, uint32_t zalign, - uint32_t slice_align, unsigned offset) + uint32_t slice_align, uint64_t offset) { if (level == 0) { surflevel->npix_x = surf->npix_x; @@ -1453,7 +1453,8 @@ static void si_surf_minify(struct radeon_surface *surf, surflevel->offset = offset; surflevel->pitch_bytes = surflevel->nblk_x * bpe * surf->nsamples; - surflevel->slice_size = ALIGN(surflevel->pitch_bytes * surflevel->nblk_y, slice_align); + surflevel->slice_size = ALIGN((uint64_t)surflevel->pitch_bytes * surflevel->nblk_y, + (uint64_t)slice_align); surf->bo_size = offset + surflevel->slice_size * surflevel->nblk_z * surf->array_size; } @@ -1462,7 +1463,7 @@ static void si_surf_minify_2d(struct radeon_surface *surf, struct radeon_surface_level *surflevel, unsigned bpe, unsigned level, unsigned slice_pt, uint32_t xalign, uint32_t yalign, uint32_t zalign, - unsigned mtileb, unsigned offset) + unsigned mtileb, uint64_t offset) { unsigned mtile_pr, mtile_ps; @@ -1501,7 +1502,7 @@ static void si_surf_minify_2d(struct radeon_surface *surf, mtile_ps = (mtile_pr * surflevel->nblk_y) / yalign; surflevel->offset = offset; surflevel->pitch_bytes = surflevel->nblk_x * bpe * surf->nsamples; - surflevel->slice_size = mtile_ps * mtileb * slice_pt; + surflevel->slice_size = (uint64_t)mtile_ps * mtileb * slice_pt; surf->bo_size = offset + surflevel->slice_size * surflevel->nblk_z * surf->array_size; } diff --git a/lib/libdrm/tests/Makefile.in b/lib/libdrm/tests/Makefile.in index 3f062db05..c3335229a 100644 --- a/lib/libdrm/tests/Makefile.in +++ b/lib/libdrm/tests/Makefile.in @@ -54,7 +54,8 @@ host_triplet = @host@ @HAVE_AMDGPU_TRUE@@HAVE_CUNIT_TRUE@am__append_3 = amdgpu @HAVE_EXYNOS_TRUE@am__append_4 = exynos @HAVE_TEGRA_TRUE@am__append_5 = tegra -check_PROGRAMS = dristat$(EXEEXT) drmstat$(EXEEXT) $(am__EXEEXT_2) +check_PROGRAMS = dristat$(EXEEXT) drmdevice$(EXEEXT) drmstat$(EXEEXT) \ + $(am__EXEEXT_2) @HAVE_NOUVEAU_TRUE@am__append_6 = nouveau TESTS = drmsl$(EXEEXT) hash$(EXEEXT) random$(EXEEXT) $(am__EXEEXT_1) @HAVE_LIBUDEV_TRUE@am__append_7 = \ @@ -102,12 +103,17 @@ am__EXEEXT_2 = drmsl$(EXEEXT) hash$(EXEEXT) random$(EXEEXT) \ dristat_SOURCES = dristat.c dristat_OBJECTS = dristat.$(OBJEXT) dristat_DEPENDENCIES = -drmsl_SOURCES = drmsl.c -drmsl_OBJECTS = drmsl.$(OBJEXT) -drmsl_LDADD = $(LDADD) +drmdevice_SOURCES = drmdevice.c +drmdevice_OBJECTS = drmdevice.$(OBJEXT) +drmdevice_LDADD = $(LDADD) am__DEPENDENCIES_1 = @HAVE_LIBUDEV_TRUE@am__DEPENDENCIES_2 = libdrmtest.la \ @HAVE_LIBUDEV_TRUE@ $(am__DEPENDENCIES_1) +drmdevice_DEPENDENCIES = $(top_builddir)/libdrm.la \ + $(am__DEPENDENCIES_2) +drmsl_SOURCES = drmsl.c +drmsl_OBJECTS = drmsl.$(OBJEXT) +drmsl_LDADD = $(LDADD) drmsl_DEPENDENCIES = $(top_builddir)/libdrm.la $(am__DEPENDENCIES_2) drmstat_SOURCES = drmstat.c drmstat_OBJECTS = drmstat.$(OBJEXT) @@ -190,12 +196,12 @@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = -SOURCES = $(libdrmtest_la_SOURCES) dristat.c drmsl.c drmstat.c \ - getclient.c getstats.c getversion.c hash.c name_from_fd.c \ - openclose.c random.c setversion.c updatedraw.c -DIST_SOURCES = $(am__libdrmtest_la_SOURCES_DIST) dristat.c drmsl.c \ +SOURCES = $(libdrmtest_la_SOURCES) dristat.c drmdevice.c drmsl.c \ drmstat.c getclient.c getstats.c getversion.c hash.c \ name_from_fd.c openclose.c random.c setversion.c updatedraw.c +DIST_SOURCES = $(am__libdrmtest_la_SOURCES_DIST) dristat.c drmdevice.c \ + drmsl.c drmstat.c getclient.c getstats.c getversion.c hash.c \ + name_from_fd.c openclose.c random.c setversion.c updatedraw.c RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ html-recursive info-recursive install-data-recursive \ install-dvi-recursive install-exec-recursive \ @@ -219,8 +225,8 @@ am__tty_colors_dummy = \ mgn= red= grn= lgn= blu= brg= std=; \ am__color_tests=no am__tty_colors = $(am__tty_colors_dummy) -DIST_SUBDIRS = modeprint proptest modetest vbltest kmstest radeon \ - amdgpu exynos tegra nouveau +DIST_SUBDIRS = util kms modeprint proptest modetest vbltest kmstest \ + radeon amdgpu exynos tegra nouveau DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) am__relativize = \ dir0=`pwd`; \ @@ -397,7 +403,7 @@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ -SUBDIRS = modeprint proptest modetest vbltest $(am__append_1) \ +SUBDIRS = util kms modeprint proptest modetest vbltest $(am__append_1) \ $(am__append_2) $(am__append_3) $(am__append_4) \ $(am__append_5) $(am__append_6) AM_CFLAGS = \ @@ -475,6 +481,9 @@ clean-checkPROGRAMS: dristat$(EXEEXT): $(dristat_OBJECTS) $(dristat_DEPENDENCIES) $(EXTRA_dristat_DEPENDENCIES) @rm -f dristat$(EXEEXT) $(AM_V_CCLD)$(LINK) $(dristat_OBJECTS) $(dristat_LDADD) $(LIBS) +drmdevice$(EXEEXT): $(drmdevice_OBJECTS) $(drmdevice_DEPENDENCIES) $(EXTRA_drmdevice_DEPENDENCIES) + @rm -f drmdevice$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(drmdevice_OBJECTS) $(drmdevice_LDADD) $(LIBS) drmsl$(EXEEXT): $(drmsl_OBJECTS) $(drmsl_DEPENDENCIES) $(EXTRA_drmsl_DEPENDENCIES) @rm -f drmsl$(EXEEXT) $(AM_V_CCLD)$(LINK) $(drmsl_OBJECTS) $(drmsl_LDADD) $(LIBS) @@ -516,6 +525,7 @@ distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dristat.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/drmdevice.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/drmsl.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/drmstat.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/drmtest.Plo@am__quote@ diff --git a/lib/libdrm/tests/exynos/Makefile.in b/lib/libdrm/tests/exynos/Makefile.in index e79ce1a58..352772276 100644 --- a/lib/libdrm/tests/exynos/Makefile.in +++ b/lib/libdrm/tests/exynos/Makefile.in @@ -50,8 +50,22 @@ PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ -@HAVE_INSTALL_TESTS_TRUE@@HAVE_LIBKMS_TRUE@bin_PROGRAMS = exynos_fimg2d_test$(EXEEXT) -@HAVE_INSTALL_TESTS_FALSE@@HAVE_LIBKMS_TRUE@noinst_PROGRAMS = exynos_fimg2d_test$(EXEEXT) +bin_PROGRAMS = $(am__EXEEXT_1) $(am__EXEEXT_2) +noinst_PROGRAMS = $(am__EXEEXT_3) $(am__EXEEXT_4) +@HAVE_INSTALL_TESTS_TRUE@@HAVE_LIBKMS_TRUE@am__append_1 = \ +@HAVE_INSTALL_TESTS_TRUE@@HAVE_LIBKMS_TRUE@ exynos_fimg2d_test + +@HAVE_INSTALL_TESTS_FALSE@@HAVE_LIBKMS_TRUE@am__append_2 = \ +@HAVE_INSTALL_TESTS_FALSE@@HAVE_LIBKMS_TRUE@ exynos_fimg2d_test + +@HAVE_INSTALL_TESTS_TRUE@am__append_3 = \ +@HAVE_INSTALL_TESTS_TRUE@ exynos_fimg2d_perf \ +@HAVE_INSTALL_TESTS_TRUE@ exynos_fimg2d_event + +@HAVE_INSTALL_TESTS_FALSE@am__append_4 = \ +@HAVE_INSTALL_TESTS_FALSE@ exynos_fimg2d_perf \ +@HAVE_INSTALL_TESTS_FALSE@ exynos_fimg2d_event + subdir = tests/exynos DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ $(top_srcdir)/build-aux/depcomp @@ -66,17 +80,31 @@ mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = +@HAVE_INSTALL_TESTS_TRUE@@HAVE_LIBKMS_TRUE@am__EXEEXT_1 = exynos_fimg2d_test$(EXEEXT) +@HAVE_INSTALL_TESTS_TRUE@am__EXEEXT_2 = exynos_fimg2d_perf$(EXEEXT) \ +@HAVE_INSTALL_TESTS_TRUE@ exynos_fimg2d_event$(EXEEXT) am__installdirs = "$(DESTDIR)$(bindir)" +@HAVE_INSTALL_TESTS_FALSE@@HAVE_LIBKMS_TRUE@am__EXEEXT_3 = exynos_fimg2d_test$(EXEEXT) +@HAVE_INSTALL_TESTS_FALSE@am__EXEEXT_4 = exynos_fimg2d_perf$(EXEEXT) \ +@HAVE_INSTALL_TESTS_FALSE@ exynos_fimg2d_event$(EXEEXT) PROGRAMS = $(bin_PROGRAMS) $(noinst_PROGRAMS) -am_exynos_fimg2d_test_OBJECTS = exynos_fimg2d_test.$(OBJEXT) -exynos_fimg2d_test_OBJECTS = $(am_exynos_fimg2d_test_OBJECTS) -exynos_fimg2d_test_DEPENDENCIES = $(top_builddir)/libdrm.la \ - $(top_builddir)/libkms/libkms.la \ +exynos_fimg2d_event_SOURCES = exynos_fimg2d_event.c +exynos_fimg2d_event_OBJECTS = exynos_fimg2d_event.$(OBJEXT) +exynos_fimg2d_event_DEPENDENCIES = $(top_builddir)/libdrm.la \ $(top_builddir)/exynos/libdrm_exynos.la AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = +exynos_fimg2d_perf_SOURCES = exynos_fimg2d_perf.c +exynos_fimg2d_perf_OBJECTS = exynos_fimg2d_perf.$(OBJEXT) +exynos_fimg2d_perf_DEPENDENCIES = $(top_builddir)/libdrm.la \ + $(top_builddir)/exynos/libdrm_exynos.la +am_exynos_fimg2d_test_OBJECTS = exynos_fimg2d_test.$(OBJEXT) +exynos_fimg2d_test_OBJECTS = $(am_exynos_fimg2d_test_OBJECTS) +exynos_fimg2d_test_DEPENDENCIES = $(top_builddir)/libdrm.la \ + $(top_builddir)/libkms/libkms.la \ + $(top_builddir)/exynos/libdrm_exynos.la AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false @@ -111,8 +139,10 @@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = -SOURCES = $(exynos_fimg2d_test_SOURCES) -DIST_SOURCES = $(exynos_fimg2d_test_SOURCES) +SOURCES = exynos_fimg2d_event.c exynos_fimg2d_perf.c \ + $(exynos_fimg2d_test_SOURCES) +DIST_SOURCES = exynos_fimg2d_event.c exynos_fimg2d_perf.c \ + $(exynos_fimg2d_test_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ @@ -278,6 +308,15 @@ AM_CFLAGS = \ -I $(top_srcdir)/exynos \ -I $(top_srcdir) +exynos_fimg2d_perf_LDADD = \ + $(top_builddir)/libdrm.la \ + $(top_builddir)/exynos/libdrm_exynos.la + +exynos_fimg2d_event_LDADD = \ + $(top_builddir)/libdrm.la \ + $(top_builddir)/exynos/libdrm_exynos.la \ + -lpthread + exynos_fimg2d_test_LDADD = \ $(top_builddir)/libdrm.la \ $(top_builddir)/libkms/libkms.la \ @@ -375,6 +414,12 @@ clean-noinstPROGRAMS: list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ echo " rm -f" $$list; \ rm -f $$list +exynos_fimg2d_event$(EXEEXT): $(exynos_fimg2d_event_OBJECTS) $(exynos_fimg2d_event_DEPENDENCIES) $(EXTRA_exynos_fimg2d_event_DEPENDENCIES) + @rm -f exynos_fimg2d_event$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(exynos_fimg2d_event_OBJECTS) $(exynos_fimg2d_event_LDADD) $(LIBS) +exynos_fimg2d_perf$(EXEEXT): $(exynos_fimg2d_perf_OBJECTS) $(exynos_fimg2d_perf_DEPENDENCIES) $(EXTRA_exynos_fimg2d_perf_DEPENDENCIES) + @rm -f exynos_fimg2d_perf$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(exynos_fimg2d_perf_OBJECTS) $(exynos_fimg2d_perf_LDADD) $(LIBS) exynos_fimg2d_test$(EXEEXT): $(exynos_fimg2d_test_OBJECTS) $(exynos_fimg2d_test_DEPENDENCIES) $(EXTRA_exynos_fimg2d_test_DEPENDENCIES) @rm -f exynos_fimg2d_test$(EXEEXT) $(AM_V_CCLD)$(LINK) $(exynos_fimg2d_test_OBJECTS) $(exynos_fimg2d_test_LDADD) $(LIBS) @@ -385,6 +430,8 @@ mostlyclean-compile: distclean-compile: -rm -f *.tab.c +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/exynos_fimg2d_event.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/exynos_fimg2d_perf.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/exynos_fimg2d_test.Po@am__quote@ .c.o: diff --git a/lib/libdrm/tests/kms/Makefile.in b/lib/libdrm/tests/kms/Makefile.in index 2a6f2868f..01a87e327 100644 --- a/lib/libdrm/tests/kms/Makefile.in +++ b/lib/libdrm/tests/kms/Makefile.in @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.15 from Makefile.am. +# Makefile.in generated by automake 1.12.6 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2014 Free Software Foundation, Inc. +# Copyright (C) 1994-2012 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -16,61 +16,23 @@ VPATH = @srcdir@ -am__is_gnu_make = { \ - if test -z '$(MAKELEVEL)'; then \ - false; \ - elif test -n '$(MAKE_HOST)'; then \ - true; \ - elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ - true; \ - else \ - false; \ - fi; \ -} -am__make_running_with_option = \ - case $${target_option-} in \ - ?) ;; \ - *) echo "am__make_running_with_option: internal error: invalid" \ - "target option '$${target_option-}' specified" >&2; \ - exit 1;; \ - esac; \ - has_opt=no; \ - sane_makeflags=$$MAKEFLAGS; \ - if $(am__is_gnu_make); then \ - sane_makeflags=$$MFLAGS; \ - else \ +am__make_dryrun = \ + { \ + am__dry=no; \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ - bs=\\; \ - sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ - | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ - esac; \ - fi; \ - skip_next=no; \ - strip_trailopt () \ - { \ - flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ - }; \ - for flg in $$sane_makeflags; do \ - test $$skip_next = yes && { skip_next=no; continue; }; \ - case $$flg in \ - *=*|--*) continue;; \ - -*I) strip_trailopt 'I'; skip_next=yes;; \ - -*I?*) strip_trailopt 'I';; \ - -*O) strip_trailopt 'O'; skip_next=yes;; \ - -*O?*) strip_trailopt 'O';; \ - -*l) strip_trailopt 'l'; skip_next=yes;; \ - -*l?*) strip_trailopt 'l';; \ - -[dEDm]) skip_next=yes;; \ - -[JT]) skip_next=yes;; \ - esac; \ - case $$flg in \ - *$$target_option*) has_opt=yes; break;; \ + echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ + | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ + *) \ + for am__flg in $$MAKEFLAGS; do \ + case $$am__flg in \ + *=*|--*) ;; \ + *n*) am__dry=yes; break;; \ + esac; \ + done;; \ esac; \ - done; \ - test $$has_opt = yes -am__make_dryrun = (target_option=n; $(am__make_running_with_option)) -am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) + test $$am__dry = yes; \ + } pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ @@ -94,6 +56,8 @@ host_triplet = @host@ @HAVE_INSTALL_TESTS_FALSE@noinst_PROGRAMS = kms-steal-crtc$(EXEEXT) \ @HAVE_INSTALL_TESTS_FALSE@ kms-universal-planes$(EXEEXT) subdir = tests/kms +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ + $(top_srcdir)/build-aux/depcomp ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ @@ -101,7 +65,6 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) -DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = @@ -170,27 +133,8 @@ am__can_run_installinfo = \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac -am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) -# Read a list of newline-separated strings from the standard input, -# and print each of them once, without duplicates. Input order is -# *not* preserved. -am__uniquify_input = $(AWK) '\ - BEGIN { nonempty = 0; } \ - { items[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in items) print i; }; } \ -' -# Make sure the list of sources is unique. This is necessary because, -# e.g., the same source file might be shared among _SOURCES variables -# for different programs/libraries. -am__define_uniq_tagged_files = \ - list='$(am__tagged_files)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags -am__DIST_COMMON = $(srcdir)/Makefile.in \ - $(top_srcdir)/build-aux/depcomp DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ADMIN_MAN_DIR = @ADMIN_MAN_DIR@ @@ -249,7 +193,6 @@ LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ -LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MANPAGES_STYLESHEET = @MANPAGES_STYLESHEET@ @@ -383,6 +326,7 @@ $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign tests/kms/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign tests/kms/Makefile +.PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ @@ -411,7 +355,6 @@ clean-noinstLTLIBRARIES: echo rm -f $${locs}; \ rm -f $${locs}; \ } - libkms-test.la: $(libkms_test_la_OBJECTS) $(libkms_test_la_DEPENDENCIES) $(EXTRA_libkms_test_la_DEPENDENCIES) $(AM_V_CCLD)$(LINK) $(libkms_test_la_OBJECTS) $(libkms_test_la_LIBADD) $(LIBS) install-binPROGRAMS: $(bin_PROGRAMS) @@ -423,12 +366,10 @@ install-binPROGRAMS: $(bin_PROGRAMS) fi; \ for p in $$list; do echo "$$p $$p"; done | \ sed 's/$(EXEEXT)$$//' | \ - while read p p1; do if test -f $$p \ - || test -f $$p1 \ - ; then echo "$$p"; echo "$$p"; else :; fi; \ + while read p p1; do if test -f $$p || test -f $$p1; \ + then echo "$$p"; echo "$$p"; else :; fi; \ done | \ - sed -e 'p;s,.*/,,;n;h' \ - -e 's|.*|.|' \ + sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ sed 'N;N;N;s,\n, ,g' | \ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ @@ -449,8 +390,7 @@ uninstall-binPROGRAMS: @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ files=`for p in $$list; do echo "$$p"; done | \ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ - -e 's/$$/$(EXEEXT)/' \ - `; \ + -e 's/$$/$(EXEEXT)/' `; \ test -n "$$list" || exit 0; \ echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(bindir)" && rm -f $$files @@ -472,11 +412,9 @@ clean-noinstPROGRAMS: list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ echo " rm -f" $$list; \ rm -f $$list - kms-steal-crtc$(EXEEXT): $(kms_steal_crtc_OBJECTS) $(kms_steal_crtc_DEPENDENCIES) $(EXTRA_kms_steal_crtc_DEPENDENCIES) @rm -f kms-steal-crtc$(EXEEXT) $(AM_V_CCLD)$(LINK) $(kms_steal_crtc_OBJECTS) $(kms_steal_crtc_LDADD) $(LIBS) - kms-universal-planes$(EXEEXT): $(kms_universal_planes_OBJECTS) $(kms_universal_planes_DEPENDENCIES) $(EXTRA_kms_universal_planes_DEPENDENCIES) @rm -f kms-universal-planes$(EXEEXT) $(AM_V_CCLD)$(LINK) $(kms_universal_planes_OBJECTS) $(kms_universal_planes_LDADD) $(LIBS) @@ -500,14 +438,14 @@ distclean-compile: @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @@ -522,15 +460,26 @@ mostlyclean-libtool: clean-libtool: -rm -rf .libs _libs -ID: $(am__tagged_files) - $(am__define_uniq_tagged_files); mkid -fID $$unique -tags: tags-am -TAGS: tags - -tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ - $(am__define_uniq_tagged_files); \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ @@ -542,11 +491,15 @@ tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $$unique; \ fi; \ fi -ctags: ctags-am - -CTAGS: ctags -ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) - $(am__define_uniq_tagged_files); \ +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique @@ -555,10 +508,9 @@ GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" -cscopelist: cscopelist-am -cscopelist-am: $(am__tagged_files) - list='$(am__tagged_files)'; \ +cscopelist: $(HEADERS) $(SOURCES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ @@ -714,22 +666,20 @@ uninstall-am: uninstall-binPROGRAMS .MAKE: install-am install-strip -.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean \ - clean-binPROGRAMS clean-generic clean-libtool \ - clean-noinstLTLIBRARIES clean-noinstPROGRAMS cscopelist-am \ - ctags ctags-am distclean distclean-compile distclean-generic \ - distclean-libtool distclean-tags distdir dvi dvi-am html \ - html-am info info-am install install-am install-binPROGRAMS \ - install-data install-data-am install-dvi install-dvi-am \ - install-exec install-exec-am install-html install-html-am \ - install-info install-info-am install-man install-pdf \ - install-pdf-am install-ps install-ps-am install-strip \ - installcheck installcheck-am installdirs maintainer-clean \ +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \ + clean-generic clean-libtool clean-noinstLTLIBRARIES \ + clean-noinstPROGRAMS cscopelist ctags distclean \ + distclean-compile distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-binPROGRAMS install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-man install-pdf install-pdf-am \ + install-ps install-ps-am install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ - tags tags-am uninstall uninstall-am uninstall-binPROGRAMS - -.PRECIOUS: Makefile + tags uninstall uninstall-am uninstall-binPROGRAMS # Tell versions [3.59,3.63) of GNU make to not export all variables. diff --git a/lib/libdrm/tests/kmstest/Makefile.in b/lib/libdrm/tests/kmstest/Makefile.in index 783aa449d..90b6e86f0 100644 --- a/lib/libdrm/tests/kmstest/Makefile.in +++ b/lib/libdrm/tests/kmstest/Makefile.in @@ -70,8 +70,8 @@ am__installdirs = "$(DESTDIR)$(bindir)" PROGRAMS = $(bin_PROGRAMS) $(noinst_PROGRAMS) am_kmstest_OBJECTS = main.$(OBJEXT) kmstest_OBJECTS = $(am_kmstest_OBJECTS) -kmstest_DEPENDENCIES = $(top_builddir)/libdrm.la \ - $(top_builddir)/libkms/libkms.la +kmstest_DEPENDENCIES = $(top_builddir)/tests/util/libutil.la \ + $(top_builddir)/libkms/libkms.la $(top_builddir)/libdrm.la AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent @@ -274,14 +274,16 @@ AM_CFLAGS = \ $(WARN_CFLAGS)\ -I$(top_srcdir)/include/drm \ -I$(top_srcdir)/libkms/ \ + -I$(top_srcdir)/tests/ \ -I$(top_srcdir) kmstest_SOURCES = \ main.c kmstest_LDADD = \ - $(top_builddir)/libdrm.la \ - $(top_builddir)/libkms/libkms.la + $(top_builddir)/tests/util/libutil.la \ + $(top_builddir)/libkms/libkms.la \ + $(top_builddir)/libdrm.la all: all-am diff --git a/lib/libdrm/tests/modeprint/Makefile.in b/lib/libdrm/tests/modeprint/Makefile.in index 0ca9fc9f2..935d2ee59 100644 --- a/lib/libdrm/tests/modeprint/Makefile.in +++ b/lib/libdrm/tests/modeprint/Makefile.in @@ -272,6 +272,7 @@ top_srcdir = @top_srcdir@ AM_CFLAGS = \ $(WARN_CFLAGS)\ -I$(top_srcdir)/include/drm \ + -I$(top_srcdir)/tests \ -I$(top_srcdir) modeprint_SOURCES = \ diff --git a/lib/libdrm/tests/modetest/Makefile.in b/lib/libdrm/tests/modetest/Makefile.in index 1e6cbabd0..0632fb684 100644 --- a/lib/libdrm/tests/modetest/Makefile.in +++ b/lib/libdrm/tests/modetest/Makefile.in @@ -54,8 +54,6 @@ DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ $(srcdir)/Makefile.sources $(top_srcdir)/build-aux/depcomp @HAVE_INSTALL_TESTS_TRUE@bin_PROGRAMS = modetest$(EXEEXT) @HAVE_INSTALL_TESTS_FALSE@noinst_PROGRAMS = modetest$(EXEEXT) -@HAVE_CAIRO_TRUE@am__append_1 = $(CAIRO_CFLAGS) -@HAVE_CAIRO_TRUE@am__append_2 = $(CAIRO_LIBS) subdir = tests/modetest ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ @@ -74,9 +72,8 @@ am__objects_1 = buffers.$(OBJEXT) cursor.$(OBJEXT) modetest.$(OBJEXT) am_modetest_OBJECTS = $(am__objects_1) modetest_OBJECTS = $(am_modetest_OBJECTS) am__DEPENDENCIES_1 = -@HAVE_CAIRO_TRUE@am__DEPENDENCIES_2 = $(am__DEPENDENCIES_1) modetest_DEPENDENCIES = $(top_builddir)/libdrm.la \ - $(am__DEPENDENCIES_2) + $(top_builddir)/tests/util/libutil.la $(am__DEPENDENCIES_1) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent @@ -283,9 +280,15 @@ MODETEST_FILES := \ modetest.c AM_CFLAGS = $(filter-out -Wpointer-arith, $(WARN_CFLAGS)) \ - -I$(top_srcdir)/include/drm -I$(top_srcdir) $(am__append_1) + -I$(top_srcdir)/include/drm -I$(top_srcdir)/tests \ + -I$(top_srcdir) modetest_SOURCES = $(MODETEST_FILES) -modetest_LDADD = $(top_builddir)/libdrm.la -lpthread $(am__append_2) +modetest_LDADD = \ + $(top_builddir)/libdrm.la \ + $(top_builddir)/tests/util/libutil.la \ + $(CAIRO_LIBS) \ + -lpthread + EXTRA_DIST = Android.mk all: all-am diff --git a/lib/libdrm/tests/proptest/Makefile.in b/lib/libdrm/tests/proptest/Makefile.in index 701303e9f..515534eb1 100644 --- a/lib/libdrm/tests/proptest/Makefile.in +++ b/lib/libdrm/tests/proptest/Makefile.in @@ -50,11 +50,11 @@ PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ + $(srcdir)/Makefile.sources $(top_srcdir)/build-aux/depcomp @HAVE_INSTALL_TESTS_TRUE@bin_PROGRAMS = proptest$(EXEEXT) @HAVE_INSTALL_TESTS_FALSE@noinst_PROGRAMS = proptest$(EXEEXT) subdir = tests/proptest -DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ - $(top_srcdir)/build-aux/depcomp ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ @@ -68,9 +68,11 @@ CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__installdirs = "$(DESTDIR)$(bindir)" PROGRAMS = $(bin_PROGRAMS) $(noinst_PROGRAMS) -am_proptest_OBJECTS = proptest.$(OBJEXT) +am__objects_1 = proptest.$(OBJEXT) +am_proptest_OBJECTS = $(am__objects_1) proptest_OBJECTS = $(am_proptest_OBJECTS) -proptest_DEPENDENCIES = $(top_builddir)/libdrm.la +proptest_DEPENDENCIES = $(top_builddir)/libdrm.la \ + $(top_builddir)/tests/util/libutil.la AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent @@ -269,22 +271,25 @@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ +PROPTEST_FILES := \ + proptest.c + AM_CFLAGS = \ $(WARN_CFLAGS)\ -I$(top_srcdir)/include/drm \ + -I$(top_srcdir)/tests \ -I$(top_srcdir) -proptest_SOURCES = \ - proptest.c - +proptest_SOURCES = $(PROPTEST_FILES) proptest_LDADD = \ - $(top_builddir)/libdrm.la + $(top_builddir)/libdrm.la \ + $(top_builddir)/tests/util/libutil.la all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(srcdir)/Makefile.sources $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ @@ -305,6 +310,7 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; +$(srcdir)/Makefile.sources: $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh diff --git a/lib/libdrm/tests/util/Makefile.in b/lib/libdrm/tests/util/Makefile.in index 0855b1c5b..82c650a95 100644 --- a/lib/libdrm/tests/util/Makefile.in +++ b/lib/libdrm/tests/util/Makefile.in @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.15 from Makefile.am. +# Makefile.in generated by automake 1.12.6 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2014 Free Software Foundation, Inc. +# Copyright (C) 1994-2012 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -15,61 +15,23 @@ @SET_MAKE@ VPATH = @srcdir@ -am__is_gnu_make = { \ - if test -z '$(MAKELEVEL)'; then \ - false; \ - elif test -n '$(MAKE_HOST)'; then \ - true; \ - elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ - true; \ - else \ - false; \ - fi; \ -} -am__make_running_with_option = \ - case $${target_option-} in \ - ?) ;; \ - *) echo "am__make_running_with_option: internal error: invalid" \ - "target option '$${target_option-}' specified" >&2; \ - exit 1;; \ - esac; \ - has_opt=no; \ - sane_makeflags=$$MAKEFLAGS; \ - if $(am__is_gnu_make); then \ - sane_makeflags=$$MFLAGS; \ - else \ +am__make_dryrun = \ + { \ + am__dry=no; \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ - bs=\\; \ - sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ - | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ - esac; \ - fi; \ - skip_next=no; \ - strip_trailopt () \ - { \ - flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ - }; \ - for flg in $$sane_makeflags; do \ - test $$skip_next = yes && { skip_next=no; continue; }; \ - case $$flg in \ - *=*|--*) continue;; \ - -*I) strip_trailopt 'I'; skip_next=yes;; \ - -*I?*) strip_trailopt 'I';; \ - -*O) strip_trailopt 'O'; skip_next=yes;; \ - -*O?*) strip_trailopt 'O';; \ - -*l) strip_trailopt 'l'; skip_next=yes;; \ - -*l?*) strip_trailopt 'l';; \ - -[dEDm]) skip_next=yes;; \ - -[JT]) skip_next=yes;; \ + echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ + | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ + *) \ + for am__flg in $$MAKEFLAGS; do \ + case $$am__flg in \ + *=*|--*) ;; \ + *n*) am__dry=yes; break;; \ + esac; \ + done;; \ esac; \ - case $$flg in \ - *$$target_option*) has_opt=yes; break;; \ - esac; \ - done; \ - test $$has_opt = yes -am__make_dryrun = (target_option=n; $(am__make_running_with_option)) -am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) + test $$am__dry = yes; \ + } pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ @@ -88,6 +50,8 @@ PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ + $(srcdir)/Makefile.sources $(top_srcdir)/build-aux/depcomp subdir = tests/util ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ @@ -96,7 +60,6 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) -DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = @@ -155,27 +118,8 @@ am__can_run_installinfo = \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac -am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) -# Read a list of newline-separated strings from the standard input, -# and print each of them once, without duplicates. Input order is -# *not* preserved. -am__uniquify_input = $(AWK) '\ - BEGIN { nonempty = 0; } \ - { items[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in items) print i; }; } \ -' -# Make sure the list of sources is unique. This is necessary because, -# e.g., the same source file might be shared among _SOURCES variables -# for different programs/libraries. -am__define_uniq_tagged_files = \ - list='$(am__tagged_files)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags -am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.sources \ - $(top_srcdir)/build-aux/depcomp DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ADMIN_MAN_DIR = @ADMIN_MAN_DIR@ @@ -234,7 +178,6 @@ LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ -LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MANPAGES_STYLESHEET = @MANPAGES_STYLESHEET@ @@ -364,6 +307,7 @@ $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(srcdir)/Makefile.sources $(am__c echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign tests/util/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign tests/util/Makefile +.PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ @@ -372,7 +316,7 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; -$(srcdir)/Makefile.sources $(am__empty): +$(srcdir)/Makefile.sources: $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh @@ -393,7 +337,6 @@ clean-noinstLTLIBRARIES: echo rm -f $${locs}; \ rm -f $${locs}; \ } - libutil.la: $(libutil_la_OBJECTS) $(libutil_la_DEPENDENCIES) $(EXTRA_libutil_la_DEPENDENCIES) $(AM_V_CCLD)$(libutil_la_LINK) $(libutil_la_OBJECTS) $(libutil_la_LIBADD) $(LIBS) @@ -412,14 +355,14 @@ distclean-compile: @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @@ -455,15 +398,26 @@ mostlyclean-libtool: clean-libtool: -rm -rf .libs _libs -ID: $(am__tagged_files) - $(am__define_uniq_tagged_files); mkid -fID $$unique -tags: tags-am -TAGS: tags - -tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ - $(am__define_uniq_tagged_files); \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ @@ -475,11 +429,15 @@ tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $$unique; \ fi; \ fi -ctags: ctags-am - -CTAGS: ctags -ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) - $(am__define_uniq_tagged_files); \ +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique @@ -488,10 +446,9 @@ GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" -cscopelist: cscopelist-am -cscopelist-am: $(am__tagged_files) - list='$(am__tagged_files)'; \ +cscopelist: $(HEADERS) $(SOURCES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ @@ -644,9 +601,9 @@ uninstall-am: .MAKE: install-am install-strip -.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \ - clean-libtool clean-noinstLTLIBRARIES cscopelist-am ctags \ - ctags-am distclean distclean-compile distclean-generic \ +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libtool clean-noinstLTLIBRARIES cscopelist ctags \ + distclean distclean-compile distclean-generic \ distclean-libtool distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-data \ install-data-am install-dvi install-dvi-am install-exec \ @@ -656,9 +613,7 @@ uninstall-am: installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ - tags tags-am uninstall uninstall-am - -.PRECIOUS: Makefile + tags uninstall uninstall-am # Tell versions [3.59,3.63) of GNU make to not export all variables. diff --git a/lib/libdrm/tests/vbltest/Makefile.in b/lib/libdrm/tests/vbltest/Makefile.in index 6fa32ee4f..36db0375e 100644 --- a/lib/libdrm/tests/vbltest/Makefile.in +++ b/lib/libdrm/tests/vbltest/Makefile.in @@ -70,7 +70,8 @@ am__installdirs = "$(DESTDIR)$(bindir)" PROGRAMS = $(bin_PROGRAMS) $(noinst_PROGRAMS) am_vbltest_OBJECTS = vbltest.$(OBJEXT) vbltest_OBJECTS = $(am_vbltest_OBJECTS) -vbltest_DEPENDENCIES = $(top_builddir)/libdrm.la +vbltest_DEPENDENCIES = $(top_builddir)/libdrm.la \ + $(top_builddir)/tests/util/libutil.la AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent @@ -272,13 +273,15 @@ top_srcdir = @top_srcdir@ AM_CFLAGS = \ $(WARN_CFLAGS)\ -I$(top_srcdir)/include/drm \ + -I$(top_srcdir)/tests \ -I$(top_srcdir) vbltest_SOURCES = \ vbltest.c vbltest_LDADD = \ - $(top_builddir)/libdrm.la + $(top_builddir)/libdrm.la \ + $(top_builddir)/tests/util/libutil.la all: all-am diff --git a/lib/libdrm/vc4/Makefile.in b/lib/libdrm/vc4/Makefile.in index 0c1238e77..1861aa0c3 100644 --- a/lib/libdrm/vc4/Makefile.in +++ b/lib/libdrm/vc4/Makefile.in @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.15 from Makefile.am. +# Makefile.in generated by automake 1.12.6 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2014 Free Software Foundation, Inc. +# Copyright (C) 1994-2012 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -37,61 +37,23 @@ VPATH = @srcdir@ -am__is_gnu_make = { \ - if test -z '$(MAKELEVEL)'; then \ - false; \ - elif test -n '$(MAKE_HOST)'; then \ - true; \ - elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ - true; \ - else \ - false; \ - fi; \ -} -am__make_running_with_option = \ - case $${target_option-} in \ - ?) ;; \ - *) echo "am__make_running_with_option: internal error: invalid" \ - "target option '$${target_option-}' specified" >&2; \ - exit 1;; \ - esac; \ - has_opt=no; \ - sane_makeflags=$$MAKEFLAGS; \ - if $(am__is_gnu_make); then \ - sane_makeflags=$$MFLAGS; \ - else \ +am__make_dryrun = \ + { \ + am__dry=no; \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ - bs=\\; \ - sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ - | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ - esac; \ - fi; \ - skip_next=no; \ - strip_trailopt () \ - { \ - flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ - }; \ - for flg in $$sane_makeflags; do \ - test $$skip_next = yes && { skip_next=no; continue; }; \ - case $$flg in \ - *=*|--*) continue;; \ - -*I) strip_trailopt 'I'; skip_next=yes;; \ - -*I?*) strip_trailopt 'I';; \ - -*O) strip_trailopt 'O'; skip_next=yes;; \ - -*O?*) strip_trailopt 'O';; \ - -*l) strip_trailopt 'l'; skip_next=yes;; \ - -*l?*) strip_trailopt 'l';; \ - -[dEDm]) skip_next=yes;; \ - -[JT]) skip_next=yes;; \ - esac; \ - case $$flg in \ - *$$target_option*) has_opt=yes; break;; \ + echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ + | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ + *) \ + for am__flg in $$MAKEFLAGS; do \ + case $$am__flg in \ + *=*|--*) ;; \ + *n*) am__dry=yes; break;; \ + esac; \ + done;; \ esac; \ - done; \ - test $$has_opt = yes -am__make_dryrun = (target_option=n; $(am__make_running_with_option)) -am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) + test $$am__dry = yes; \ + } pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ @@ -110,6 +72,9 @@ PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ +DIST_COMMON = $(libdrm_vc4include_HEADERS) $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in $(srcdir)/Makefile.sources \ + $(srcdir)/libdrm_vc4.pc.in subdir = vc4 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ @@ -118,8 +83,6 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) -DIST_COMMON = $(srcdir)/Makefile.am $(libdrm_vc4include_HEADERS) \ - $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = libdrm_vc4.pc @@ -174,27 +137,8 @@ am__installdirs = "$(DESTDIR)$(pkgconfigdir)" \ "$(DESTDIR)$(libdrm_vc4includedir)" DATA = $(pkgconfig_DATA) HEADERS = $(libdrm_vc4include_HEADERS) -am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) -# Read a list of newline-separated strings from the standard input, -# and print each of them once, without duplicates. Input order is -# *not* preserved. -am__uniquify_input = $(AWK) '\ - BEGIN { nonempty = 0; } \ - { items[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in items) print i; }; } \ -' -# Make sure the list of sources is unique. This is necessary because, -# e.g., the same source file might be shared among _SOURCES variables -# for different programs/libraries. -am__define_uniq_tagged_files = \ - list='$(am__tagged_files)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags -am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.sources \ - $(srcdir)/libdrm_vc4.pc.in DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ADMIN_MAN_DIR = @ADMIN_MAN_DIR@ @@ -253,7 +197,6 @@ LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ -LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MANPAGES_STYLESHEET = @MANPAGES_STYLESHEET@ @@ -376,6 +319,7 @@ $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(srcdir)/Makefile.sources $(am__c echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign vc4/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign vc4/Makefile +.PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ @@ -384,7 +328,7 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; -$(srcdir)/Makefile.sources $(am__empty): +$(srcdir)/Makefile.sources: $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh @@ -445,15 +389,26 @@ uninstall-libdrm_vc4includeHEADERS: files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(libdrm_vc4includedir)'; $(am__uninstall_files_from_dir) -ID: $(am__tagged_files) - $(am__define_uniq_tagged_files); mkid -fID $$unique -tags: tags-am -TAGS: tags - -tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ - $(am__define_uniq_tagged_files); \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ @@ -465,11 +420,15 @@ tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $$unique; \ fi; \ fi -ctags: ctags-am - -CTAGS: ctags -ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) - $(am__define_uniq_tagged_files); \ +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique @@ -478,10 +437,9 @@ GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" -cscopelist: cscopelist-am -cscopelist-am: $(am__tagged_files) - list='$(am__tagged_files)'; \ +cscopelist: $(HEADERS) $(SOURCES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ @@ -634,22 +592,19 @@ uninstall-am: uninstall-libdrm_vc4includeHEADERS \ .MAKE: install-am install-strip -.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \ - clean-libtool cscopelist-am ctags ctags-am distclean \ - distclean-generic distclean-libtool distclean-tags distdir dvi \ - dvi-am html html-am info info-am install install-am \ - install-data install-data-am install-dvi install-dvi-am \ - install-exec install-exec-am install-html install-html-am \ - install-info install-info-am install-libdrm_vc4includeHEADERS \ - install-man install-pdf install-pdf-am install-pkgconfigDATA \ - install-ps install-ps-am install-strip installcheck \ - installcheck-am installdirs maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-generic \ - mostlyclean-libtool pdf pdf-am ps ps-am tags tags-am uninstall \ - uninstall-am uninstall-libdrm_vc4includeHEADERS \ - uninstall-pkgconfigDATA - -.PRECIOUS: Makefile +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libtool cscopelist ctags distclean distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-libdrm_vc4includeHEADERS install-man \ + install-pdf install-pdf-am install-pkgconfigDATA install-ps \ + install-ps-am install-strip installcheck installcheck-am \ + installdirs maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \ + ps ps-am tags uninstall uninstall-am \ + uninstall-libdrm_vc4includeHEADERS uninstall-pkgconfigDATA # Tell versions [3.59,3.63) of GNU make to not export all variables. diff --git a/lib/libdrm/xf86atomic.h b/lib/libdrm/xf86atomic.h index 194554ced..922b37da6 100644 --- a/lib/libdrm/xf86atomic.h +++ b/lib/libdrm/xf86atomic.h @@ -93,7 +93,7 @@ typedef struct { LIBDRM_ATOMIC_TYPE atomic; } atomic_t; # define atomic_read(x) (int) ((x)->atomic) # define atomic_set(x, val) ((x)->atomic = (LIBDRM_ATOMIC_TYPE)(val)) # define atomic_inc(x) (atomic_inc_uint (&(x)->atomic)) -# define atomic_inc_return (atomic_inc_uint_nv(&(x)->atomic)) +# define atomic_inc_return(x) (atomic_inc_uint_nv(&(x)->atomic)) # define atomic_dec_and_test(x) (atomic_dec_uint_nv(&(x)->atomic) == 0) # define atomic_add(x, v) (atomic_add_int(&(x)->atomic, (v))) # define atomic_dec(x, v) (atomic_add_int(&(x)->atomic, -(v))) diff --git a/lib/libdrm/xf86drm.c b/lib/libdrm/xf86drm.c index c99df1f0a..ca282ad36 100644 --- a/lib/libdrm/xf86drm.c +++ b/lib/libdrm/xf86drm.c @@ -36,6 +36,7 @@ #endif #include <stdio.h> #include <stdlib.h> +#include <stdbool.h> #include <unistd.h> #include <string.h> #include <strings.h> @@ -44,6 +45,7 @@ #include <stddef.h> #include <fcntl.h> #include <errno.h> +#include <limits.h> #include <signal.h> #include <time.h> #include <sys/types.h> @@ -65,6 +67,8 @@ #include "xf86drm.h" #include "libdrm_macros.h" +#include "util_math.h" + #ifdef __OpenBSD__ #define DRM_PRIMARY_MINOR_NAME "drm" #define DRM_CONTROL_MINOR_NAME "drmC" @@ -99,14 +103,6 @@ #define X_PRIVSEP #endif -/* - * This definition needs to be changed on some systems if dev_t is a structure. - * If there is a header file we can get it from, there would be best. - */ -#ifndef makedev -#define makedev(x,y) ((dev_t)(((x) << 8) | (y))) -#endif - #define DRM_MSG_VERBOSITY 3 #define memclear(s) memset(&s, 0, sizeof(s)) @@ -2853,6 +2849,8 @@ static char *drmGetMinorNameForFD(int fd, int type) out_close_dir: closedir(sysdir); +#else +#warning "Missing implementation of drmGetMinorNameForFD" #endif return NULL; } @@ -2867,44 +2865,62 @@ char *drmGetRenderDeviceNameFromFd(int fd) return drmGetMinorNameForFD(fd, DRM_NODE_RENDER); } -#ifdef __linux__ -static int drmParseSubsystemType(const char *str) +static int drmParseSubsystemType(int maj, int min) { +#ifdef __linux__ + char path[PATH_MAX + 1]; char link[PATH_MAX + 1] = ""; char *name; - if (readlink(str, link, PATH_MAX) < 0) - return -EINVAL; + snprintf(path, PATH_MAX, "/sys/dev/char/%d:%d/device/subsystem", + maj, min); + + if (readlink(path, link, PATH_MAX) < 0) + return -errno; name = strrchr(link, '/'); if (!name) return -EINVAL; - name++; - - if (strncmp(name, "pci", 3) == 0) + if (strncmp(name, "/pci", 4) == 0) return DRM_BUS_PCI; return -EINVAL; +#else +#warning "Missing implementation of drmParseSubsystemType" + return -EINVAL; +#endif } -static int drmParsePciBusInfo(const char *str, drmPciBusInfoPtr info) +static int drmParsePciBusInfo(int maj, int min, drmPciBusInfoPtr info) { +#ifdef __linux__ + char path[PATH_MAX + 1]; + char data[128 + 1]; + char *str; int domain, bus, dev, func; - char *value; + int fd, ret; - if (str == NULL) - return -EINVAL; + snprintf(path, PATH_MAX, "/sys/dev/char/%d:%d/device/uevent", maj, min); + fd = open(path, O_RDONLY); + if (fd < 0) + return -errno; - value = strstr(str, "PCI_SLOT_NAME="); - if (value == NULL) - return -EINVAL; + ret = read(fd, data, sizeof(data)); + data[128] = '\0'; + close(fd); + if (ret < 0) + return -errno; - value += strlen("PCI_SLOT_NAME="); +#define TAG "PCI_SLOT_NAME=" + str = strstr(data, TAG); + if (str == NULL) + return -EINVAL; - if (sscanf(value, "%04x:%02x:%02x.%1u", + if (sscanf(str, TAG "%04x:%02x:%02x.%1u", &domain, &bus, &dev, &func) != 4) return -EINVAL; +#undef TAG info->domain = domain; info->bus = bus; @@ -2912,22 +2928,28 @@ static int drmParsePciBusInfo(const char *str, drmPciBusInfoPtr info) info->func = func; return 0; +#else +#warning "Missing implementation of drmParsePciBusInfo" + return -EINVAL; +#endif } -static int drmSameDevice(drmDevicePtr a, drmDevicePtr b) +static int drmCompareBusInfo(drmDevicePtr a, drmDevicePtr b) { + if (a == NULL || b == NULL) + return -1; + if (a->bustype != b->bustype) - return 0; + return -1; switch (a->bustype) { case DRM_BUS_PCI: - if (memcmp(a->businfo.pci, b->businfo.pci, sizeof(drmPciBusInfo)) == 0) - return 1; + return memcmp(a->businfo.pci, b->businfo.pci, sizeof(drmPciBusInfo)); default: break; } - return 0; + return -1; } static int drmGetNodeType(const char *name) @@ -2947,11 +2969,32 @@ static int drmGetNodeType(const char *name) return -EINVAL; } -static int drmParsePciDeviceInfo(const unsigned char *config, +static int drmGetMaxNodeName(void) +{ + return sizeof(DRM_DIR_NAME) + + MAX3(sizeof(DRM_PRIMARY_MINOR_NAME), + sizeof(DRM_CONTROL_MINOR_NAME), + sizeof(DRM_RENDER_MINOR_NAME)) + + 3 /* lenght of the node number */; +} + +static int drmParsePciDeviceInfo(const char *d_name, drmPciDeviceInfoPtr device) { - if (config == NULL) - return -EINVAL; +#ifdef __linux__ + char path[PATH_MAX + 1]; + unsigned char config[64]; + int fd, ret; + + snprintf(path, PATH_MAX, "/sys/class/drm/%s/device/config", d_name); + fd = open(path, O_RDONLY); + if (fd < 0) + return -errno; + + ret = read(fd, config, sizeof(config)); + close(fd); + if (ret < 0) + return -errno; device->vendor_id = config[0] | (config[1] << 8); device->device_id = config[2] | (config[3] << 8); @@ -2960,22 +3003,19 @@ static int drmParsePciDeviceInfo(const unsigned char *config, device->subdevice_id = config[46] | (config[47] << 8); return 0; +#else +#warning "Missing implementation of drmParsePciDeviceInfo" + return -EINVAL; +#endif } -static void drmFreeDevice(drmDevicePtr device) +void drmFreeDevice(drmDevicePtr *device) { - int i; - if (device == NULL) return; - if (device->nodes != NULL) - for (i = 0; i < DRM_NODE_MAX; i++) - free(device->nodes[i]); - - free(device->nodes); - free(device->businfo.pci); - free(device->deviceinfo.pci); + free(*device); + *device = NULL; } void drmFreeDevices(drmDevicePtr devices[], int count) @@ -2985,11 +3025,191 @@ void drmFreeDevices(drmDevicePtr devices[], int count) if (devices == NULL) return; + for (i = 0; i < count && devices[i] != NULL; i++) + drmFreeDevice(&devices[i]); +} + +static int drmProcessPciDevice(drmDevicePtr *device, const char *d_name, + const char *node, int node_type, + int maj, int min, bool fetch_deviceinfo) +{ + const int max_node_str = drmGetMaxNodeName(); + int ret, i; + char *addr; + + *device = calloc(1, sizeof(drmDevice) + + (DRM_NODE_MAX * (sizeof(void *) + max_node_str)) + + sizeof(drmPciBusInfo) + + sizeof(drmPciDeviceInfo)); + if (!*device) + return -ENOMEM; + + addr = (char*)*device; + + (*device)->bustype = DRM_BUS_PCI; + (*device)->available_nodes = 1 << node_type; + + addr += sizeof(drmDevice); + (*device)->nodes = (char**)addr; + + addr += DRM_NODE_MAX * sizeof(void *); + for (i = 0; i < DRM_NODE_MAX; i++) { + (*device)->nodes[i] = addr; + addr += max_node_str; + } + memcpy((*device)->nodes[node_type], node, max_node_str); + + (*device)->businfo.pci = (drmPciBusInfoPtr)addr; + + ret = drmParsePciBusInfo(maj, min, (*device)->businfo.pci); + if (ret) + goto free_device; + + // Fetch the device info if the user has requested it + if (fetch_deviceinfo) { + addr += sizeof(drmPciBusInfo); + (*device)->deviceinfo.pci = (drmPciDeviceInfoPtr)addr; + + ret = drmParsePciDeviceInfo(d_name, (*device)->deviceinfo.pci); + if (ret) + goto free_device; + } + return 0; + +free_device: + free(*device); + *device = NULL; + return ret; +} + +static void drmFoldDuplicatedDevices(drmDevicePtr local_devices[], int count) +{ + int node_type, i, j; + for (i = 0; i < count; i++) { - drmFreeDevice(devices[i]); - free(devices[i]); - devices[i] = NULL; + for (j = i + 1; j < count; j++) { + if (drmCompareBusInfo(local_devices[i], local_devices[j]) == 0) { + local_devices[i]->available_nodes |= local_devices[j]->available_nodes; + node_type = log2(local_devices[j]->available_nodes); + memcpy(local_devices[i]->nodes[node_type], + local_devices[j]->nodes[node_type], drmGetMaxNodeName()); + drmFreeDevice(&local_devices[j]); + } + } + } +} + +/** + * Get information about the opened drm device + * + * \param fd file descriptor of the drm device + * \param device the address of a drmDevicePtr where the information + * will be allocated in stored + * + * \return zero on success, negative error code otherwise. + */ +int drmGetDevice(int fd, drmDevicePtr *device) +{ + drmDevicePtr *local_devices; + drmDevicePtr d; + DIR *sysdir; + struct dirent *dent; + struct stat sbuf; + char node[PATH_MAX + 1]; + int node_type, subsystem_type; + int maj, min; + int ret, i, node_count; + int max_count = 16; + + if (fd == -1 || device == NULL) + return -EINVAL; + + if (fstat(fd, &sbuf)) + return -errno; + + maj = major(sbuf.st_rdev); + min = minor(sbuf.st_rdev); + + if (maj != DRM_MAJOR || !S_ISCHR(sbuf.st_mode)) + return -EINVAL; + + subsystem_type = drmParseSubsystemType(maj, min); + + local_devices = calloc(max_count, sizeof(drmDevicePtr)); + if (local_devices == NULL) + return -ENOMEM; + + sysdir = opendir(DRM_DIR_NAME); + if (!sysdir) { + ret = -errno; + goto free_locals; + } + + i = 0; + while ((dent = readdir(sysdir))) { + node_type = drmGetNodeType(dent->d_name); + if (node_type < 0) + continue; + + snprintf(node, PATH_MAX, "%s/%s", DRM_DIR_NAME, dent->d_name); + if (stat(node, &sbuf)) + continue; + + maj = major(sbuf.st_rdev); + min = minor(sbuf.st_rdev); + + if (maj != DRM_MAJOR || !S_ISCHR(sbuf.st_mode)) + continue; + + if (drmParseSubsystemType(maj, min) != subsystem_type) + continue; + + switch (subsystem_type) { + case DRM_BUS_PCI: + ret = drmProcessPciDevice(&d, dent->d_name, node, node_type, + maj, min, true); + if (ret) + goto free_devices; + + break; + default: + fprintf(stderr, "The subsystem type is not supported yet\n"); + continue; + } + + if (i >= max_count) { + drmDevicePtr *temp; + + max_count += 16; + temp = realloc(local_devices, max_count * sizeof(drmDevicePtr)); + if (!temp) + goto free_devices; + local_devices = temp; + } + + local_devices[i] = d; + i++; } + node_count = i; + + /* Fold nodes into a single device if they share the same bus info */ + drmFoldDuplicatedDevices(local_devices, node_count); + + *device = local_devices[0]; + for (i = 1; i < node_count && local_devices[i]; i++) + drmFreeDevice(&local_devices[i]); + + closedir(sysdir); + free(local_devices); + return 0; + +free_devices: + drmFreeDevices(local_devices, i); + closedir(sysdir); + +free_locals: + free(local_devices); + return ret; } /** @@ -3006,25 +3226,19 @@ void drmFreeDevices(drmDevicePtr devices[], int count) */ int drmGetDevices(drmDevicePtr devices[], int max_devices) { - drmDevicePtr devs = NULL; - drmPciBusInfoPtr pcibus = NULL; - drmPciDeviceInfoPtr pcidevice = NULL; - DIR *sysdir = NULL; - struct dirent *dent = NULL; - struct stat sbuf = {0}; - char node[PATH_MAX + 1] = ""; - char path[PATH_MAX + 1] = ""; - char data[128] = ""; - unsigned char config[64] = ""; + drmDevicePtr *local_devices; + drmDevicePtr device; + DIR *sysdir; + struct dirent *dent; + struct stat sbuf; + char node[PATH_MAX + 1]; int node_type, subsystem_type; int maj, min; - int fd; - int ret, i = 0, j, node_count, device_count = 0; + int ret, i, node_count, device_count; int max_count = 16; - int *duplicated = NULL; - devs = calloc(max_count, sizeof(*devs)); - if (devs == NULL) + local_devices = calloc(max_count, sizeof(drmDevicePtr)); + if (local_devices == NULL) return -ENOMEM; sysdir = opendir(DRM_DIR_NAME); @@ -3033,6 +3247,7 @@ int drmGetDevices(drmDevicePtr devices[], int max_devices) goto free_locals; } + i = 0; while ((dent = readdir(sysdir))) { node_type = drmGetNodeType(dent->d_name); if (node_type < 0) @@ -3048,171 +3263,61 @@ int drmGetDevices(drmDevicePtr devices[], int max_devices) if (maj != DRM_MAJOR || !S_ISCHR(sbuf.st_mode)) continue; - snprintf(path, PATH_MAX, "/sys/dev/char/%d:%d/device/subsystem", - maj, min); - subsystem_type = drmParseSubsystemType(path); + subsystem_type = drmParseSubsystemType(maj, min); if (subsystem_type < 0) continue; switch (subsystem_type) { case DRM_BUS_PCI: - pcibus = calloc(1, sizeof(*pcibus)); - if (pcibus == NULL) { - ret = -ENOMEM; - goto free_locals; - } - - snprintf(path, PATH_MAX, "/sys/dev/char/%d:%d/device/uevent", - maj, min); - fd = open(path, O_RDONLY); - if (fd < 0) { - ret = -errno; - goto free_locals; - } - ret = read(fd, data, sizeof(data)); - if (ret < 0) { - ret = -errno; - close(fd); - goto free_locals; - } - - ret = drmParsePciBusInfo(data, pcibus); - close(fd); + ret = drmProcessPciDevice(&device, dent->d_name, node, node_type, + maj, min, devices != NULL); if (ret) - goto free_locals; + goto free_devices; - if (i >= max_count) { - max_count += 16; - devs = realloc(devs, max_count * sizeof(*devs)); - } - - devs[i].businfo.pci = pcibus; - devs[i].bustype = subsystem_type; - devs[i].nodes = calloc(DRM_NODE_MAX, sizeof(char *)); - if (devs[i].nodes == NULL) { - ret = -ENOMEM; - goto free_locals; - } - devs[i].nodes[node_type] = strdup(node); - if (devs[i].nodes[node_type] == NULL) { - ret = -ENOMEM; - goto free_locals; - } - devs[i].available_nodes = 1 << node_type; - - if (devices != NULL) { - snprintf(path, PATH_MAX, "/sys/class/drm/%s/device/config", - dent->d_name); - fd = open(path, O_RDONLY); - if (fd < 0) { - ret = -errno; - goto free_locals; - } - ret = read(fd, config, 64); - if (ret < 0) { - ret = -errno; - close(fd); - goto free_locals; - } - - pcidevice = calloc(1, sizeof(*pcidevice)); - if (pcidevice == NULL) { - ret = -ENOMEM; - goto free_locals; - } - - ret = drmParsePciDeviceInfo(config, pcidevice); - if (ret) - goto free_locals; - - devs[i].deviceinfo.pci = pcidevice; - close(fd); - } break; default: fprintf(stderr, "The subsystem type is not supported yet\n"); - break; + continue; } + + if (i >= max_count) { + drmDevicePtr *temp; + + max_count += 16; + temp = realloc(local_devices, max_count * sizeof(drmDevicePtr)); + if (!temp) + goto free_devices; + local_devices = temp; + } + + local_devices[i] = device; i++; } - node_count = i; - /* merge duplicated devices with same domain/bus/device/func IDs */ - duplicated = calloc(node_count, sizeof(*duplicated)); - if (duplicated == NULL) { - ret = -ENOMEM; - goto free_locals; - } + /* Fold nodes into a single device if they share the same bus info */ + drmFoldDuplicatedDevices(local_devices, node_count); - for (i = 0; i < node_count; i++) { - for (j = i+1; j < node_count; j++) { - if (duplicated[i] || duplicated[j]) - continue; - if (drmSameDevice(&devs[i], &devs[j])) { - duplicated[j] = 1; - devs[i].available_nodes |= devs[j].available_nodes; - node_type = log2(devs[j].available_nodes); - devs[i].nodes[node_type] = devs[j].nodes[node_type]; - free(devs[j].nodes); - free(devs[j].businfo.pci); - free(devs[j].deviceinfo.pci); - } - } - } + device_count = 0; + for (i = 0; i < node_count && local_devices[i]; i++) { + if ((devices != NULL) && (device_count < max_devices)) + devices[device_count] = local_devices[i]; + else + drmFreeDevice(&local_devices[i]); - for (i = 0; i < node_count; i++) { - if(duplicated[i] == 0) { - if ((devices != NULL) && (device_count < max_devices)) { - devices[device_count] = calloc(1, sizeof(drmDevice)); - if (devices[device_count] == NULL) { - ret = -ENOMEM; - break; - } - memcpy(devices[device_count], &devs[i], sizeof(drmDevice)); - } else - drmFreeDevice(&devs[i]); - device_count++; - } + device_count++; } - if (i < node_count) { - drmFreeDevices(devices, device_count); - for ( ; i < node_count; i++) - if(duplicated[i] == 0) - drmFreeDevice(&devs[i]); - } else - ret = device_count; + closedir(sysdir); + free(local_devices); + return device_count; - free(duplicated); - free(devs); +free_devices: + drmFreeDevices(local_devices, i); closedir(sysdir); - return ret; free_locals: - for (j = 0; j < i; j++) - drmFreeDevice(&devs[j]); - free(pcidevice); - free(pcibus); - free(devs); - closedir(sysdir); + free(local_devices); return ret; } -#else -void drmFreeDevices(drmDevicePtr devices[], int count) -{ - (void)devices; - (void)count; -} - -int drmGetDevices(drmDevicePtr devices[], int max_devices) -{ - (void)devices; - (void)max_devices; - return -EINVAL; -} - -#warning "Missing implementation of drmGetDevices/drmFreeDevices" - -#endif diff --git a/lib/libdrm/xf86drm.h b/lib/libdrm/xf86drm.h index e82ca844c..481d882aa 100644 --- a/lib/libdrm/xf86drm.h +++ b/lib/libdrm/xf86drm.h @@ -790,6 +790,9 @@ typedef struct _drmDevice { } deviceinfo; } drmDevice, *drmDevicePtr; +extern int drmGetDevice(int fd, drmDevicePtr *device); +extern void drmFreeDevice(drmDevicePtr *device); + extern int drmGetDevices(drmDevicePtr devices[], int max_devices); extern void drmFreeDevices(drmDevicePtr devices[], int count); diff --git a/lib/libdrm/xf86drmMode.c b/lib/libdrm/xf86drmMode.c index 23800dd18..771006186 100644 --- a/lib/libdrm/xf86drmMode.c +++ b/lib/libdrm/xf86drmMode.c @@ -475,12 +475,13 @@ _drmModeGetConnector(int fd, uint32_t connector_id, int probe) { struct drm_mode_get_connector conn, counts; drmModeConnectorPtr r = NULL; + struct drm_mode_modeinfo stack_mode; memclear(conn); conn.connector_id = connector_id; if (!probe) { conn.count_modes = 1; - conn.modes_ptr = VOID2U64(drmMalloc(sizeof(struct drm_mode_modeinfo))); + conn.modes_ptr = VOID2U64(&stack_mode); } if (drmIoctl(fd, DRM_IOCTL_MODE_GETCONNECTOR, &conn)) @@ -504,7 +505,7 @@ retry: goto err_allocs; } else { conn.count_modes = 1; - conn.modes_ptr = VOID2U64(drmMalloc(sizeof(struct drm_mode_modeinfo))); + conn.modes_ptr = VOID2U64(&stack_mode); } if (conn.count_encoders) { @@ -525,7 +526,8 @@ retry: counts.count_encoders < conn.count_encoders) { drmFree(U642VOID(conn.props_ptr)); drmFree(U642VOID(conn.prop_values_ptr)); - drmFree(U642VOID(conn.modes_ptr)); + if (U642VOID(conn.modes_ptr) != &stack_mode) + drmFree(U642VOID(conn.modes_ptr)); drmFree(U642VOID(conn.encoders_ptr)); goto retry; @@ -567,7 +569,8 @@ retry: err_allocs: drmFree(U642VOID(conn.prop_values_ptr)); drmFree(U642VOID(conn.props_ptr)); - drmFree(U642VOID(conn.modes_ptr)); + if (U642VOID(conn.modes_ptr) != &stack_mode) + drmFree(U642VOID(conn.modes_ptr)); drmFree(U642VOID(conn.encoders_ptr)); return r; @@ -1189,6 +1192,9 @@ drmModeAtomicReqPtr drmModeAtomicDuplicate(drmModeAtomicReqPtr old) { drmModeAtomicReqPtr new; + if (!old) + return NULL; + new = drmMalloc(sizeof *new); if (!new) return NULL; @@ -1213,6 +1219,9 @@ drmModeAtomicReqPtr drmModeAtomicDuplicate(drmModeAtomicReqPtr old) int drmModeAtomicMerge(drmModeAtomicReqPtr base, drmModeAtomicReqPtr augment) { + if (!base) + return -EINVAL; + if (!augment || augment->cursor == 0) return 0; @@ -1239,12 +1248,15 @@ int drmModeAtomicMerge(drmModeAtomicReqPtr base, drmModeAtomicReqPtr augment) int drmModeAtomicGetCursor(drmModeAtomicReqPtr req) { + if (!req) + return -EINVAL; return req->cursor; } void drmModeAtomicSetCursor(drmModeAtomicReqPtr req, int cursor) { - req->cursor = cursor; + if (req) + req->cursor = cursor; } int drmModeAtomicAddProperty(drmModeAtomicReqPtr req, @@ -1252,6 +1264,9 @@ int drmModeAtomicAddProperty(drmModeAtomicReqPtr req, uint32_t property_id, uint64_t value) { + if (!req) + return -EINVAL; + if (req->cursor >= req->size_items) { drmModeAtomicReqItemPtr new; @@ -1309,6 +1324,9 @@ int drmModeAtomicCommit(int fd, drmModeAtomicReqPtr req, uint32_t flags, int obj_idx = -1; int ret = -1; + if (!req) + return -EINVAL; + if (req->cursor == 0) return 0; |