diff -Nru libdrm-2.4.67/aclocal.m4 libdrm-2.4.70/aclocal.m4 --- libdrm-2.4.67/aclocal.m4 2016-02-15 18:23:59.000000000 +0000 +++ libdrm-2.4.70/aclocal.m4 2016-07-23 13:19:06.000000000 +0000 @@ -20,32 +20,63 @@ If you have problems, you may need to regenerate the build system entirely. To do so, use the procedure documented by the package, typically 'autoreconf'.])]) -# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- -# serial 1 (pkg-config-0.24) -# -# Copyright © 2004 Scott James Remnant . -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - -# PKG_PROG_PKG_CONFIG([MIN-VERSION]) -# ---------------------------------- +dnl pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- +dnl serial 11 (pkg-config-0.29) +dnl +dnl Copyright © 2004 Scott James Remnant . +dnl Copyright © 2012-2015 Dan Nicholson +dnl +dnl This program is free software; you can redistribute it and/or modify +dnl it under the terms of the GNU General Public License as published by +dnl the Free Software Foundation; either version 2 of the License, or +dnl (at your option) any later version. +dnl +dnl This program is distributed in the hope that it will be useful, but +dnl WITHOUT ANY WARRANTY; without even the implied warranty of +dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +dnl General Public License for more details. +dnl +dnl You should have received a copy of the GNU General Public License +dnl along with this program; if not, write to the Free Software +dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +dnl 02111-1307, USA. +dnl +dnl As a special exception to the GNU General Public License, if you +dnl distribute this file as part of a program that contains a +dnl configuration script generated by Autoconf, you may include it under +dnl the same distribution terms that you use for the rest of that +dnl program. + +dnl PKG_PREREQ(MIN-VERSION) +dnl ----------------------- +dnl Since: 0.29 +dnl +dnl Verify that the version of the pkg-config macros are at least +dnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's +dnl installed version of pkg-config, this checks the developer's version +dnl of pkg.m4 when generating configure. +dnl +dnl To ensure that this macro is defined, also add: +dnl m4_ifndef([PKG_PREREQ], +dnl [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])]) +dnl +dnl See the "Since" comment for each macro you use to see what version +dnl of the macros you require. +m4_defun([PKG_PREREQ], +[m4_define([PKG_MACROS_VERSION], [0.29]) +m4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1, + [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])]) +])dnl PKG_PREREQ + +dnl PKG_PROG_PKG_CONFIG([MIN-VERSION]) +dnl ---------------------------------- +dnl Since: 0.16 +dnl +dnl Search for the pkg-config tool and set the PKG_CONFIG variable to +dnl first found in the path. Checks that the version of pkg-config found +dnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is +dnl used since that's the first version where most current features of +dnl pkg-config existed. AC_DEFUN([PKG_PROG_PKG_CONFIG], [m4_pattern_forbid([^_?PKG_[A-Z_]+$]) m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$]) @@ -67,18 +98,19 @@ PKG_CONFIG="" fi fi[]dnl -])# PKG_PROG_PKG_CONFIG +])dnl PKG_PROG_PKG_CONFIG -# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) -# -# Check to see whether a particular set of modules exists. Similar -# to PKG_CHECK_MODULES(), but does not set variables or print errors. -# -# Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG]) -# only at the first occurence in configure.ac, so if the first place -# it's called might be skipped (such as if it is within an "if", you -# have to call PKG_CHECK_EXISTS manually -# -------------------------------------------------------------- +dnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) +dnl ------------------------------------------------------------------- +dnl Since: 0.18 +dnl +dnl Check to see whether a particular set of modules exists. Similar to +dnl PKG_CHECK_MODULES(), but does not set variables or print errors. +dnl +dnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG]) +dnl only at the first occurence in configure.ac, so if the first place +dnl it's called might be skipped (such as if it is within an "if", you +dnl have to call PKG_CHECK_EXISTS manually AC_DEFUN([PKG_CHECK_EXISTS], [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl if test -n "$PKG_CONFIG" && \ @@ -88,8 +120,10 @@ $3])dnl fi]) -# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES]) -# --------------------------------------------- +dnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES]) +dnl --------------------------------------------- +dnl Internal wrapper calling pkg-config via PKG_CONFIG and setting +dnl pkg_failed based on the result. m4_define([_PKG_CONFIG], [if test -n "$$1"; then pkg_cv_[]$1="$$1" @@ -101,10 +135,11 @@ else pkg_failed=untried fi[]dnl -])# _PKG_CONFIG +])dnl _PKG_CONFIG -# _PKG_SHORT_ERRORS_SUPPORTED -# ----------------------------- +dnl _PKG_SHORT_ERRORS_SUPPORTED +dnl --------------------------- +dnl Internal check to see if pkg-config supports short errors. AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED], [AC_REQUIRE([PKG_PROG_PKG_CONFIG]) if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then @@ -112,19 +147,17 @@ else _pkg_short_errors_supported=no fi[]dnl -])# _PKG_SHORT_ERRORS_SUPPORTED +])dnl _PKG_SHORT_ERRORS_SUPPORTED -# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], -# [ACTION-IF-NOT-FOUND]) -# -# -# Note that if there is a possibility the first call to -# PKG_CHECK_MODULES might not happen, you should be sure to include an -# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac -# -# -# -------------------------------------------------------------- +dnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], +dnl [ACTION-IF-NOT-FOUND]) +dnl -------------------------------------------------------------- +dnl Since: 0.4.0 +dnl +dnl Note that if there is a possibility the first call to +dnl PKG_CHECK_MODULES might not happen, you should be sure to include an +dnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac AC_DEFUN([PKG_CHECK_MODULES], [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl @@ -178,16 +211,40 @@ AC_MSG_RESULT([yes]) $3 fi[]dnl -])# PKG_CHECK_MODULES +])dnl PKG_CHECK_MODULES + + +dnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], +dnl [ACTION-IF-NOT-FOUND]) +dnl --------------------------------------------------------------------- +dnl Since: 0.29 +dnl +dnl Checks for existence of MODULES and gathers its build flags with +dnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags +dnl and VARIABLE-PREFIX_LIBS from --libs. +dnl +dnl Note that if there is a possibility the first call to +dnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to +dnl include an explicit call to PKG_PROG_PKG_CONFIG in your +dnl configure.ac. +AC_DEFUN([PKG_CHECK_MODULES_STATIC], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl +_save_PKG_CONFIG=$PKG_CONFIG +PKG_CONFIG="$PKG_CONFIG --static" +PKG_CHECK_MODULES($@) +PKG_CONFIG=$_save_PKG_CONFIG[]dnl +])dnl PKG_CHECK_MODULES_STATIC -# PKG_INSTALLDIR(DIRECTORY) -# ------------------------- -# Substitutes the variable pkgconfigdir as the location where a module -# should install pkg-config .pc files. By default the directory is -# $libdir/pkgconfig, but the default can be changed by passing -# DIRECTORY. The user can override through the --with-pkgconfigdir -# parameter. +dnl PKG_INSTALLDIR([DIRECTORY]) +dnl ------------------------- +dnl Since: 0.27 +dnl +dnl Substitutes the variable pkgconfigdir as the location where a module +dnl should install pkg-config .pc files. By default the directory is +dnl $libdir/pkgconfig, but the default can be changed by passing +dnl DIRECTORY. The user can override through the --with-pkgconfigdir +dnl parameter. AC_DEFUN([PKG_INSTALLDIR], [m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])]) m4_pushdef([pkg_description], @@ -198,16 +255,18 @@ AC_SUBST([pkgconfigdir], [$with_pkgconfigdir]) m4_popdef([pkg_default]) m4_popdef([pkg_description]) -]) dnl PKG_INSTALLDIR +])dnl PKG_INSTALLDIR -# PKG_NOARCH_INSTALLDIR(DIRECTORY) -# ------------------------- -# Substitutes the variable noarch_pkgconfigdir as the location where a -# module should install arch-independent pkg-config .pc files. By -# default the directory is $datadir/pkgconfig, but the default can be -# changed by passing DIRECTORY. The user can override through the -# --with-noarch-pkgconfigdir parameter. +dnl PKG_NOARCH_INSTALLDIR([DIRECTORY]) +dnl -------------------------------- +dnl Since: 0.27 +dnl +dnl Substitutes the variable noarch_pkgconfigdir as the location where a +dnl module should install arch-independent pkg-config .pc files. By +dnl default the directory is $datadir/pkgconfig, but the default can be +dnl changed by passing DIRECTORY. The user can override through the +dnl --with-noarch-pkgconfigdir parameter. AC_DEFUN([PKG_NOARCH_INSTALLDIR], [m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])]) m4_pushdef([pkg_description], @@ -218,13 +277,15 @@ AC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir]) m4_popdef([pkg_default]) m4_popdef([pkg_description]) -]) dnl PKG_NOARCH_INSTALLDIR +])dnl PKG_NOARCH_INSTALLDIR -# PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE, -# [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) -# ------------------------------------------- -# Retrieves the value of the pkg-config variable for the given module. +dnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE, +dnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) +dnl ------------------------------------------- +dnl Since: 0.28 +dnl +dnl Retrieves the value of the pkg-config variable for the given module. AC_DEFUN([PKG_CHECK_VAR], [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl AC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl @@ -233,7 +294,7 @@ AS_VAR_COPY([$1], [pkg_cv_][$1]) AS_VAR_IF([$1], [""], [$5], [$4])dnl -])# PKG_CHECK_VAR +])dnl PKG_CHECK_VAR dnl xorg-macros.m4. Generated from xorg-macros.m4.in xorgversion.m4 by configure. dnl diff -Nru libdrm-2.4.67/amdgpu/amdgpu.h libdrm-2.4.70/amdgpu/amdgpu.h --- libdrm-2.4.67/amdgpu/amdgpu.h 2016-02-10 16:49:00.000000000 +0000 +++ libdrm-2.4.70/amdgpu/amdgpu.h 2016-04-21 13:40:06.000000000 +0000 @@ -685,7 +685,7 @@ int amdgpu_bo_free(amdgpu_bo_handle buf_handle); /** - * Request CPU access to GPU accessable memory + * Request CPU access to GPU accessible memory * * \param buf_handle - \c [in] Buffer handle * \param cpu - \c [out] CPU address to be used for access @@ -851,7 +851,7 @@ * order. * * The caller can specify the user fence buffer/location with the fence_info in the - * cs_request.The sequence number is returned via the 'seq_no' paramter + * cs_request.The sequence number is returned via the 'seq_no' parameter * in ibs_request structure. * * diff -Nru libdrm-2.4.67/amdgpu/Android.mk libdrm-2.4.70/amdgpu/Android.mk --- libdrm-2.4.67/amdgpu/Android.mk 2016-08-31 20:20:36.000000000 +0000 +++ libdrm-2.4.70/amdgpu/Android.mk 1970-01-01 00:00:00.000000000 +0000 @@ -1,18 +0,0 @@ -LOCAL_PATH := $(call my-dir) -include $(CLEAR_VARS) - -# Import variables LIBDRM_AMDGPU_FILES, LIBDRM_AMDGPU_H_FILES -include $(LOCAL_PATH)/Makefile.sources - -LOCAL_MODULE := libdrm_amdgpu -LOCAL_MODULE_TAGS := optional - -LOCAL_SHARED_LIBRARIES := libdrm - -LOCAL_SRC_FILES := $(LIBDRM_AMDGPU_FILES) -LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH) - -LOCAL_CFLAGS := \ - -DHAVE_LIBDRM_ATOMIC_PRIMITIVES=1 - -include $(BUILD_SHARED_LIBRARY) diff -Nru libdrm-2.4.67/Android.mk libdrm-2.4.70/Android.mk --- libdrm-2.4.67/Android.mk 2016-02-10 16:49:00.000000000 +0000 +++ libdrm-2.4.70/Android.mk 1970-01-01 00:00:00.000000000 +0000 @@ -1,66 +0,0 @@ -# -# Copyright © 2011-2012 Intel Corporation -# -# Permission is hereby granted, free of charge, to any person obtaining a -# copy of this software and associated documentation files (the "Software"), -# to deal in the Software without restriction, including without limitation -# the rights to use, copy, modify, merge, publish, distribute, sublicense, -# and/or sell copies of the Software, and to permit persons to whom the -# Software is furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice (including the next -# paragraph) shall be included in all copies or substantial portions of the -# Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -# IN THE SOFTWARE. -# - -LOCAL_PATH := $(call my-dir) -include $(CLEAR_VARS) - -# Import variables LIBDRM_{,H_,INCLUDE_H_,INCLUDE_VMWGFX_H_}FILES -include $(LOCAL_PATH)/Makefile.sources - -#static library for the device (recovery) -include $(CLEAR_VARS) -LOCAL_MODULE := libdrm -LOCAL_MODULE_TAGS := optional - -LOCAL_SRC_FILES := $(LIBDRM_FILES) -LOCAL_EXPORT_C_INCLUDE_DIRS := \ - $(LOCAL_PATH) \ - $(LOCAL_PATH)/include/drm - -LOCAL_C_INCLUDES := \ - $(LOCAL_PATH)/include/drm - -LOCAL_CFLAGS := \ - -DHAVE_VISIBILITY=1 \ - -DHAVE_LIBDRM_ATOMIC_PRIMITIVES=1 -include $(BUILD_STATIC_LIBRARY) - -# Shared library for the device -include $(CLEAR_VARS) -LOCAL_MODULE := libdrm -LOCAL_MODULE_TAGS := optional - -LOCAL_SRC_FILES := $(LIBDRM_FILES) -LOCAL_EXPORT_C_INCLUDE_DIRS := \ - $(LOCAL_PATH) \ - $(LOCAL_PATH)/include/drm - -LOCAL_C_INCLUDES := \ - $(LOCAL_PATH)/include/drm - -LOCAL_CFLAGS := \ - -DHAVE_VISIBILITY=1 \ - -DHAVE_LIBDRM_ATOMIC_PRIMITIVES=1 -include $(BUILD_SHARED_LIBRARY) - -include $(call all-makefiles-under,$(LOCAL_PATH)) diff -Nru libdrm-2.4.67/autogen.sh libdrm-2.4.70/autogen.sh --- libdrm-2.4.67/autogen.sh 2016-08-31 20:20:36.000000000 +0000 +++ libdrm-2.4.70/autogen.sh 1970-01-01 00:00:00.000000000 +0000 @@ -1,14 +0,0 @@ -#! /bin/sh - -srcdir=`dirname "$0"` -test -z "$srcdir" && srcdir=. - -ORIGDIR=`pwd` -cd "$srcdir" - -autoreconf --force --verbose --install || exit 1 -cd "$ORIGDIR" || exit $? - -if test -z "$NOCONFIGURE"; then - "$srcdir"/configure "$@" -fi diff -Nru libdrm-2.4.67/CleanSpec.mk libdrm-2.4.70/CleanSpec.mk --- libdrm-2.4.67/CleanSpec.mk 2016-08-31 20:20:36.000000000 +0000 +++ libdrm-2.4.70/CleanSpec.mk 1970-01-01 00:00:00.000000000 +0000 @@ -1,4 +0,0 @@ -$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/include/libdrm) -$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/include/freedreno) -$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/SHARED_LIBRARIES/libdrm_*intermediates) -$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/STATIC_LIBRARIES/libdrm_*intermediates) diff -Nru libdrm-2.4.67/config.h.in libdrm-2.4.70/config.h.in --- libdrm-2.4.67/config.h.in 2016-02-15 18:24:00.000000000 +0000 +++ libdrm-2.4.70/config.h.in 2016-07-23 13:19:25.000000000 +0000 @@ -84,9 +84,6 @@ /* Define to 1 if you have the header file. */ #undef HAVE_STRING_H -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_MKDEV_H - /* Define to 1 if you have the header file. */ #undef HAVE_SYS_SELECT_H @@ -120,6 +117,14 @@ /* Define to the sub-directory where libtool stores uninstalled libraries. */ #undef LT_OBJDIR +/* Define to 1 if `major', `minor', and `makedev' are declared in . + */ +#undef MAJOR_IN_MKDEV + +/* Define to 1 if `major', `minor', and `makedev' are declared in + . */ +#undef MAJOR_IN_SYSMACROS + /* Name of package */ #undef PACKAGE diff -Nru libdrm-2.4.67/configure libdrm-2.4.70/configure --- libdrm-2.4.67/configure 2016-02-15 18:23:59.000000000 +0000 +++ libdrm-2.4.70/configure 2016-07-23 13:19:06.000000000 +0000 @@ -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.67. +# Generated by GNU Autoconf 2.69 for libdrm 2.4.70. # # Report bugs to . # @@ -591,8 +591,8 @@ # Identity of this package. PACKAGE_NAME='libdrm' PACKAGE_TARNAME='libdrm' -PACKAGE_VERSION='2.4.67' -PACKAGE_STRING='libdrm 2.4.67' +PACKAGE_VERSION='2.4.70' +PACKAGE_STRING='libdrm 2.4.70' PACKAGE_BUGREPORT='https://bugs.freedesktop.org/enter_bug.cgi?product=DRI' PACKAGE_URL='' @@ -1424,7 +1424,7 @@ # 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.67 to adapt to many kinds of systems. +\`configure' configures libdrm 2.4.70 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1494,7 +1494,7 @@ if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of libdrm 2.4.67:";; + short | recursive ) echo "Configuration of libdrm 2.4.70:";; esac cat <<\_ACEOF @@ -1667,7 +1667,7 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -libdrm configure 2.4.67 +libdrm configure 2.4.70 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -2090,7 +2090,7 @@ 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.67, which was +It was created by libdrm $as_me 2.4.70, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -3329,7 +3329,7 @@ # Define the identity of the package. PACKAGE='libdrm' - VERSION='2.4.67' + VERSION='2.4.70' cat >>confdefs.h <<_ACEOF @@ -5543,7 +5543,57 @@ fi -for ac_header in sys/mkdev.h sys/sysctl.h sys/select.h +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether sys/types.h defines makedev" >&5 +$as_echo_n "checking whether sys/types.h defines makedev... " >&6; } +if ${ac_cv_header_sys_types_h_makedev+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main () +{ +return makedev(0, 0); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_header_sys_types_h_makedev=yes +else + ac_cv_header_sys_types_h_makedev=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_sys_types_h_makedev" >&5 +$as_echo "$ac_cv_header_sys_types_h_makedev" >&6; } + +if test $ac_cv_header_sys_types_h_makedev = no; then +ac_fn_c_check_header_mongrel "$LINENO" "sys/mkdev.h" "ac_cv_header_sys_mkdev_h" "$ac_includes_default" +if test "x$ac_cv_header_sys_mkdev_h" = xyes; then : + +$as_echo "#define MAJOR_IN_MKDEV 1" >>confdefs.h + +fi + + + + if test $ac_cv_header_sys_mkdev_h = no; then + ac_fn_c_check_header_mongrel "$LINENO" "sys/sysmacros.h" "ac_cv_header_sys_sysmacros_h" "$ac_includes_default" +if test "x$ac_cv_header_sys_sysmacros_h" = xyes; then : + +$as_echo "#define MAJOR_IN_SYSMACROS 1" >>confdefs.h + +fi + + + fi +fi + +for ac_header in 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" @@ -15246,7 +15296,7 @@ # 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.67, which was +This file was extended by libdrm $as_me 2.4.70, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -15312,7 +15362,7 @@ 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.67 +libdrm config.status 2.4.70 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff -Nru libdrm-2.4.67/configure.ac libdrm-2.4.70/configure.ac --- libdrm-2.4.67/configure.ac 2016-02-15 18:23:29.000000000 +0000 +++ libdrm-2.4.70/configure.ac 2016-07-23 13:16:35.000000000 +0000 @@ -20,7 +20,7 @@ AC_PREREQ([2.63]) AC_INIT([libdrm], - [2.4.67], + [2.4.70], [https://bugs.freedesktop.org/enter_bug.cgi?product=DRI], [libdrm]) @@ -53,7 +53,8 @@ AC_SYS_LARGEFILE AC_FUNC_ALLOCA -AC_CHECK_HEADERS([sys/mkdev.h sys/sysctl.h sys/select.h]) +AC_HEADER_MAJOR +AC_CHECK_HEADERS([sys/sysctl.h sys/select.h]) # Initialize libtool LT_PREREQ([2.2]) diff -Nru libdrm-2.4.67/debian/changelog libdrm-2.4.70/debian/changelog --- libdrm-2.4.67/debian/changelog 2016-08-31 20:20:36.000000000 +0000 +++ libdrm-2.4.70/debian/changelog 2016-08-31 20:20:36.000000000 +0000 @@ -1,3 +1,37 @@ +libdrm (2.4.70-1~ppa16.04+1) xenial; urgency=medium + + * Merge from Debian Unstable. + + -- Nicolas Derive Wed, 31 Aug 2016 22:16:01 +0200 + +libdrm (2.4.70-1) unstable; urgency=medium + + * New upstream release. + * Update libdrm-freedreno1.symbols and shlibs. + * source/local-options: Add more files to extend-diff-ignore option. + Fixes 17 patch-system-but-direct-changes-in-diff lintian warnings. + + -- Andreas Boll Mon, 25 Jul 2016 12:32:20 +0200 + +libdrm (2.4.69-1) unstable; urgency=medium + + [ Andreas Boll ] + * New upstream release. + * Update debian/upstream/signing-key.asc. + * Bump Standards-Version to 3.9.8, no changes needed. + * Update watch url to use https instead of http. + + [ Julien Cristau ] + * Build libdrm-tegra on arm64 (closes: #828023). Thanks, Martin Michlmayr! + + -- Andreas Boll Thu, 21 Jul 2016 10:25:17 +0200 + +libdrm (2.4.68-1) unstable; urgency=medium + + * New upstream release. (LP: #1577735) + + -- Timo Aaltonen Tue, 03 May 2016 14:30:06 +0300 + libdrm (2.4.67-1) unstable; urgency=medium * New upstream release. diff -Nru libdrm-2.4.67/debian/control libdrm-2.4.70/debian/control --- libdrm-2.4.67/debian/control 2016-08-31 20:20:36.000000000 +0000 +++ libdrm-2.4.70/debian/control 2016-08-31 20:20:36.000000000 +0000 @@ -16,7 +16,7 @@ libpciaccess-dev, valgrind [amd64 armhf i386 mips mipsel powerpc s390x], libbsd-dev [kfreebsd-any], -Standards-Version: 3.9.6 +Standards-Version: 3.9.8 Section: libs Vcs-Git: https://anonscm.debian.org/git/pkg-xorg/lib/libdrm.git Vcs-Browser: https://anonscm.debian.org/cgit/pkg-xorg/lib/libdrm.git @@ -34,7 +34,7 @@ libdrm-omap1 (= ${binary:Version}) [any-arm], libdrm-freedreno1 (= ${binary:Version}) [any-arm arm64], libdrm-exynos1 (= ${binary:Version}) [any-arm], - libdrm-tegra0 (= ${binary:Version}) [any-arm], + libdrm-tegra0 (= ${binary:Version}) [any-arm arm64], ${misc:Depends}, Multi-Arch: same Description: Userspace interface to kernel DRM services -- development files @@ -274,7 +274,7 @@ This package provides the debugging symbols for the libdrm-exynos1 package. Package: libdrm-tegra0 -Architecture: any-arm +Architecture: any-arm arm64 Depends: ${shlibs:Depends}, ${misc:Depends}, @@ -290,7 +290,7 @@ Package: libdrm-tegra0-dbg Section: debug Priority: extra -Architecture: any-arm +Architecture: any-arm arm64 Depends: libdrm-tegra0 (= ${binary:Version}), ${misc:Depends}, diff -Nru libdrm-2.4.67/debian/libdrm-freedreno1.symbols libdrm-2.4.70/debian/libdrm-freedreno1.symbols --- libdrm-2.4.67/debian/libdrm-freedreno1.symbols 2016-08-31 20:20:36.000000000 +0000 +++ libdrm-2.4.70/debian/libdrm-freedreno1.symbols 2016-08-31 20:20:36.000000000 +0000 @@ -18,14 +18,18 @@ fd_device_new@Base 0 fd_device_new_dup@Base 0 fd_device_ref@Base 0 + fd_device_version@Base 2.4.70 fd_pipe_del@Base 0 fd_pipe_get_param@Base 0 fd_pipe_new@Base 0 fd_pipe_wait@Base 0 fd_pipe_wait_timeout@Base 2.4.64 + fd_ringbuffer_cmd_count@Base 2.4.70 fd_ringbuffer_del@Base 0 fd_ringbuffer_emit_reloc_ring@Base 0 + fd_ringbuffer_emit_reloc_ring_full@Base 2.4.70 fd_ringbuffer_flush@Base 0 + fd_ringbuffer_grow@Base 2.4.70 fd_ringbuffer_new@Base 0 fd_ringbuffer_reloc@Base 0 fd_ringbuffer_reset@Base 0 diff -Nru libdrm-2.4.67/debian/rules libdrm-2.4.70/debian/rules --- libdrm-2.4.67/debian/rules 2016-08-31 20:20:36.000000000 +0000 +++ libdrm-2.4.70/debian/rules 2016-08-31 20:20:36.000000000 +0000 @@ -49,10 +49,18 @@ ifeq ($(ARM), yes) confflags += --enable-exynos-experimental-api confflags += --enable-omap-experimental-api - confflags += --enable-tegra-experimental-api else confflags += --disable-exynos-experimental-api confflags += --disable-omap-experimental-api +endif + +# Tegra is on arm and arm64 +ifneq (,$(filter arm arm64,$(DEB_HOST_ARCH_CPU))) + TEGRA = yes +endif +ifeq ($(TEGRA), yes) + confflags += --enable-tegra-experimental-api +else confflags += --disable-tegra-experimental-api endif @@ -96,6 +104,8 @@ ifeq ($(ARM), yes) dh_strip -plibdrm-omap1 --dbg-package=libdrm-omap1-dbg dh_strip -plibdrm-exynos1 --dbg-package=libdrm-exynos1-dbg +endif +ifeq ($(TEGRA), yes) dh_strip -plibdrm-tegra0 --dbg-package=libdrm-tegra0-dbg endif ifeq ($(FREEDRENO), yes) @@ -116,10 +126,12 @@ ifeq ($(ARM), yes) dh_makeshlibs -plibdrm-omap1 -V'libdrm-omap1 (>= 2.4.38)' -- -c4 dh_makeshlibs -plibdrm-exynos1 -V'libdrm-exynos1 (>= 2.4.66)' -- -c4 +endif +ifeq ($(TEGRA), yes) dh_makeshlibs -plibdrm-tegra0 -V'libdrm-tegra0' -- -c4 endif ifeq ($(FREEDRENO), yes) - dh_makeshlibs -plibdrm-freedreno1 -V'libdrm-freedreno1 (>= 2.4.65)' -- -c4 + dh_makeshlibs -plibdrm-freedreno1 -V'libdrm-freedreno1 (>= 2.4.70)' -- -c4 endif %: diff -Nru libdrm-2.4.67/debian/upstream/signing-key.asc libdrm-2.4.70/debian/upstream/signing-key.asc --- libdrm-2.4.67/debian/upstream/signing-key.asc 2016-08-31 20:20:36.000000000 +0000 +++ libdrm-2.4.70/debian/upstream/signing-key.asc 2016-08-31 20:20:36.000000000 +0000 @@ -267,3 +267,305 @@ lPS0zfDC+hiRF5twRXRVzP3jYFe6+cyQ0FqMayLcdnov =lkAG -----END PGP PUBLIC KEY BLOCK----- +-----BEGIN PGP PUBLIC KEY BLOCK----- + +mQINBFLdfBoBEACk5Aqcovsc+iPUvtltTE9tAz/f4uFghce2b9KIJ5z4tUCbgBQe +nWJt0H/IWCTRfkFVrIoKFTOTgEZ/YMAGM6wQNMlkK+R1DJQK2FBTTR/cR9PY7hzT +ZjRCPd5tpkZ5C9iikwtuMeaZuDNlBhKrByyCJYS00z6n63hcONdJ9cuE+fodAMc/ +nMBgQ5HF/rBVKmP7/KG31MYRbvbhHTvta+P6i5nVRMoZYFA6UJiDyqbcE0s2u2X8 +GFTw0afvQ52CsrGKlRGTbVFX4AFp7oxjJmpfDZhFtuM4iGGgG1rSrWmcMt6y0h+A +3So/FbVzNM/0vtgGUR5sZf762/lKLdaMdF1n4VrsmFfLRFZ7fI9JlRmmiShDxyLZ +jPNfj+a5SQNW+NYbQ9ZjTbfpmNOQnDZliuMpvY07qGHdC9kAzEKjRBOL/XRqHMaF +mh/JNICPvPA1jIUByrmZoAxOZ5OTXvpahK8O9/YYT6qB74QOtK4pFFuEiKO/aKSJ +WyYDP8bzgdl984cYE+kgymV7Mmh5zL+t1JeoToIEexG4dJlVLXJcdNFvKyzsvkuX +Wg3gCUpyNW1MLvFng7rZL7g4glVI3+XKe3Ox36QZ+koMC6VohigTrtTOYc44SMGv +RmOdI4sx2RlQGlnu76sLRlQJ/Ct5lZZcZSqr67CKhBrD6BBmdX193+grUwARAQAB +tCVLZW5uZXRoIEdyYXVua2UgPGt3Z0BmcmVlZGVza3RvcC5vcmc+iQI5BBMBAgAj +BQJS3YKOAhsDBwsJCAcDAgEGFQgCCQoLBBYCAwECHgECF4AACgkQW1vaBx1JzDjA +SA//YoorF9TP+do7vzaNwoi/nLigxjbDAiVX0/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luBxlWkTaQ== +=zFx6 +-----END PGP PUBLIC KEY BLOCK----- diff -Nru libdrm-2.4.67/debian/watch libdrm-2.4.70/debian/watch --- libdrm-2.4.67/debian/watch 2016-08-31 20:20:36.000000000 +0000 +++ libdrm-2.4.70/debian/watch 2016-08-31 20:20:36.000000000 +0000 @@ -1,4 +1,4 @@ #git=git://anongit.freedesktop.org/mesa/drm version=3 opts=pgpsigurlmangle=s/$/.sig/ \ -http://dri.freedesktop.org/libdrm/libdrm-(.*)\.tar\.gz +https://dri.freedesktop.org/libdrm/libdrm-(.*)\.tar\.gz diff -Nru libdrm-2.4.67/exynos/exynos_drm.c libdrm-2.4.70/exynos/exynos_drm.c --- libdrm-2.4.67/exynos/exynos_drm.c 2016-01-17 21:22:14.000000000 +0000 +++ libdrm-2.4.70/exynos/exynos_drm.c 2016-04-21 13:40:06.000000000 +0000 @@ -347,7 +347,7 @@ * * @dev: a exynos device object. * @connect: indicate whether connectoin or disconnection request. - * @ext: indicate whether edid data includes extentions data or not. + * @ext: indicate whether edid data includes extensions data or not. * @edid: a pointer to edid data from Wireless Display device. * * this interface is used to request Virtual Display driver connection or diff -Nru libdrm-2.4.67/freedreno/Android.mk libdrm-2.4.70/freedreno/Android.mk --- libdrm-2.4.67/freedreno/Android.mk 2015-03-29 23:45:04.000000000 +0000 +++ libdrm-2.4.70/freedreno/Android.mk 1970-01-01 00:00:00.000000000 +0000 @@ -1,18 +0,0 @@ -LOCAL_PATH := $(call my-dir) -include $(CLEAR_VARS) - -# Import variables LIBDRM_FREEDRENO_FILES, LIBDRM_FREEDRENO_H_FILES -include $(LOCAL_PATH)/Makefile.sources - -LOCAL_MODULE := libdrm_freedreno -LOCAL_MODULE_TAGS := optional - -LOCAL_SHARED_LIBRARIES := libdrm - -LOCAL_SRC_FILES := $(LIBDRM_FREEDRENO_FILES) -LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH) - -LOCAL_CFLAGS := \ - -DHAVE_LIBDRM_ATOMIC_PRIMITIVES=1 - -include $(BUILD_SHARED_LIBRARY) diff -Nru libdrm-2.4.67/freedreno/freedreno_bo.c libdrm-2.4.70/freedreno/freedreno_bo.c --- libdrm-2.4.67/freedreno/freedreno_bo.c 2015-09-19 16:12:01.000000000 +0000 +++ libdrm-2.4.70/freedreno/freedreno_bo.c 2016-07-20 23:42:21.000000000 +0000 @@ -33,9 +33,8 @@ #include "freedreno_drmif.h" #include "freedreno_priv.h" -static pthread_mutex_t table_lock = PTHREAD_MUTEX_INITIALIZER; - -static void bo_del(struct fd_bo *bo); +drm_private pthread_mutex_t table_lock = PTHREAD_MUTEX_INITIALIZER; +drm_private void bo_del(struct fd_bo *bo); /* set buffer name, and add to table, call w/ table_lock held: */ static void set_name(struct fd_bo *bo, uint32_t name) @@ -83,114 +82,16 @@ return bo; } -/* Frees older cached buffers. Called under table_lock */ -drm_private void fd_cleanup_bo_cache(struct fd_device *dev, time_t time) -{ - int i; - - if (dev->time == time) - return; - - for (i = 0; i < dev->num_buckets; i++) { - struct fd_bo_bucket *bucket = &dev->cache_bucket[i]; - struct fd_bo *bo; - - while (!LIST_IS_EMPTY(&bucket->list)) { - bo = LIST_ENTRY(struct fd_bo, bucket->list.next, list); - - /* keep things in cache for at least 1 second: */ - if (time && ((time - bo->free_time) <= 1)) - break; - - list_del(&bo->list); - bo_del(bo); - } - } - - dev->time = time; -} - -static struct fd_bo_bucket * get_bucket(struct fd_device *dev, uint32_t size) -{ - int i; - - /* hmm, this is what intel does, but I suppose we could calculate our - * way to the correct bucket size rather than looping.. - */ - for (i = 0; i < dev->num_buckets; i++) { - struct fd_bo_bucket *bucket = &dev->cache_bucket[i]; - if (bucket->size >= size) { - return bucket; - } - } - - return NULL; -} - -static int is_idle(struct fd_bo *bo) -{ - return fd_bo_cpu_prep(bo, NULL, - DRM_FREEDRENO_PREP_READ | - DRM_FREEDRENO_PREP_WRITE | - DRM_FREEDRENO_PREP_NOSYNC) == 0; -} - -static struct fd_bo *find_in_bucket(struct fd_device *dev, - struct fd_bo_bucket *bucket, uint32_t flags) -{ - struct fd_bo *bo = NULL; - - /* TODO .. if we had an ALLOC_FOR_RENDER flag like intel, we could - * skip the busy check.. if it is only going to be a render target - * then we probably don't need to stall.. - * - * NOTE that intel takes ALLOC_FOR_RENDER bo's from the list tail - * (MRU, since likely to be in GPU cache), rather than head (LRU).. - */ - pthread_mutex_lock(&table_lock); - while (!LIST_IS_EMPTY(&bucket->list)) { - bo = LIST_ENTRY(struct fd_bo, bucket->list.next, list); - if (0 /* TODO: if madvise tells us bo is gone... */) { - list_del(&bo->list); - bo_del(bo); - bo = NULL; - continue; - } - /* TODO check for compatible flags? */ - if (is_idle(bo)) { - list_del(&bo->list); - break; - } - bo = NULL; - break; - } - pthread_mutex_unlock(&table_lock); - - return bo; -} - - struct fd_bo * fd_bo_new(struct fd_device *dev, uint32_t size, uint32_t flags) { struct fd_bo *bo = NULL; - struct fd_bo_bucket *bucket; uint32_t handle; int ret; - size = ALIGN(size, 4096); - bucket = get_bucket(dev, size); - - /* see if we can be green and recycle: */ - if (bucket) { - size = bucket->size; - bo = find_in_bucket(dev, bucket, flags); - if (bo) { - atomic_set(&bo->refcnt, 1); - fd_device_ref(bo->dev); - return bo; - } - } + bo = fd_bo_cache_alloc(&dev->bo_cache, &size, flags); + if (bo) + return bo; ret = dev->funcs->bo_new_handle(dev, size, flags, &handle); if (ret) @@ -198,7 +99,7 @@ pthread_mutex_lock(&table_lock); bo = bo_from_handle(dev, size, handle); - bo->bo_reuse = 1; + bo->bo_reuse = TRUE; pthread_mutex_unlock(&table_lock); return bo; @@ -300,35 +201,17 @@ pthread_mutex_lock(&table_lock); - if (bo->bo_reuse) { - struct fd_bo_bucket *bucket = get_bucket(dev, bo->size); - - /* see if we can be green and recycle: */ - if (bucket) { - struct timespec time; - - clock_gettime(CLOCK_MONOTONIC, &time); - - bo->free_time = time.tv_sec; - list_addtail(&bo->list, &bucket->list); - fd_cleanup_bo_cache(dev, time.tv_sec); - - /* bo's in the bucket cache don't have a ref and - * don't hold a ref to the dev: - */ - - goto out; - } - } + if (bo->bo_reuse && (fd_bo_cache_free(&dev->bo_cache, bo) == 0)) + goto out; bo_del(bo); -out: fd_device_del_locked(dev); +out: pthread_mutex_unlock(&table_lock); } /* Called under table_lock */ -static void bo_del(struct fd_bo *bo) +drm_private void bo_del(struct fd_bo *bo) { if (bo->map) drm_munmap(bo->map, bo->size); @@ -366,7 +249,7 @@ pthread_mutex_lock(&table_lock); set_name(bo, req.name); pthread_mutex_unlock(&table_lock); - bo->bo_reuse = 0; + bo->bo_reuse = FALSE; } *name = bo->name; @@ -390,7 +273,7 @@ return ret; } - bo->bo_reuse = 0; + bo->bo_reuse = FALSE; return prime_fd; } @@ -431,3 +314,10 @@ { bo->funcs->cpu_fini(bo); } + +#ifndef HAVE_FREEDRENO_KGSL +struct fd_bo * fd_bo_from_fbdev(struct fd_pipe *pipe, int fbfd, uint32_t size) +{ + return NULL; +} +#endif diff -Nru libdrm-2.4.67/freedreno/freedreno_bo_cache.c libdrm-2.4.70/freedreno/freedreno_bo_cache.c --- libdrm-2.4.67/freedreno/freedreno_bo_cache.c 1970-01-01 00:00:00.000000000 +0000 +++ libdrm-2.4.70/freedreno/freedreno_bo_cache.c 2016-07-20 23:42:21.000000000 +0000 @@ -0,0 +1,222 @@ +/* -*- mode: C; c-file-style: "k&r"; tab-width 4; indent-tabs-mode: t; -*- */ + +/* + * Copyright (C) 2016 Rob Clark + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * Authors: + * Rob Clark + */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include "freedreno_drmif.h" +#include "freedreno_priv.h" + + +drm_private void bo_del(struct fd_bo *bo); +drm_private extern pthread_mutex_t table_lock; + +static void +add_bucket(struct fd_bo_cache *cache, int size) +{ + unsigned int i = cache->num_buckets; + + assert(i < ARRAY_SIZE(cache->cache_bucket)); + + list_inithead(&cache->cache_bucket[i].list); + cache->cache_bucket[i].size = size; + cache->num_buckets++; +} + +/** + * @coarse: if true, only power-of-two bucket sizes, otherwise + * fill in for a bit smoother size curve.. + */ +drm_private void +fd_bo_cache_init(struct fd_bo_cache *cache, int course) +{ + unsigned long size, cache_max_size = 64 * 1024 * 1024; + + /* OK, so power of two buckets was too wasteful of memory. + * Give 3 other sizes between each power of two, to hopefully + * cover things accurately enough. (The alternative is + * probably to just go for exact matching of sizes, and assume + * that for things like composited window resize the tiled + * width/height alignment and rounding of sizes to pages will + * get us useful cache hit rates anyway) + */ + add_bucket(cache, 4096); + add_bucket(cache, 4096 * 2); + if (!course) + add_bucket(cache, 4096 * 3); + + /* Initialize the linked lists for BO reuse cache. */ + for (size = 4 * 4096; size <= cache_max_size; size *= 2) { + add_bucket(cache, size); + if (!course) { + add_bucket(cache, size + size * 1 / 4); + add_bucket(cache, size + size * 2 / 4); + add_bucket(cache, size + size * 3 / 4); + } + } +} + +/* Frees older cached buffers. Called under table_lock */ +drm_private void +fd_bo_cache_cleanup(struct fd_bo_cache *cache, time_t time) +{ + int i; + + if (cache->time == time) + return; + + for (i = 0; i < cache->num_buckets; i++) { + struct fd_bo_bucket *bucket = &cache->cache_bucket[i]; + struct fd_bo *bo; + + while (!LIST_IS_EMPTY(&bucket->list)) { + bo = LIST_ENTRY(struct fd_bo, bucket->list.next, list); + + /* keep things in cache for at least 1 second: */ + if (time && ((time - bo->free_time) <= 1)) + break; + + list_del(&bo->list); + bo_del(bo); + } + } + + cache->time = time; +} + +static struct fd_bo_bucket * get_bucket(struct fd_bo_cache *cache, uint32_t size) +{ + int i; + + /* hmm, this is what intel does, but I suppose we could calculate our + * way to the correct bucket size rather than looping.. + */ + for (i = 0; i < cache->num_buckets; i++) { + struct fd_bo_bucket *bucket = &cache->cache_bucket[i]; + if (bucket->size >= size) { + return bucket; + } + } + + return NULL; +} + +static int is_idle(struct fd_bo *bo) +{ + return fd_bo_cpu_prep(bo, NULL, + DRM_FREEDRENO_PREP_READ | + DRM_FREEDRENO_PREP_WRITE | + DRM_FREEDRENO_PREP_NOSYNC) == 0; +} + +static struct fd_bo *find_in_bucket(struct fd_bo_bucket *bucket, uint32_t flags) +{ + struct fd_bo *bo = NULL; + + /* TODO .. if we had an ALLOC_FOR_RENDER flag like intel, we could + * skip the busy check.. if it is only going to be a render target + * then we probably don't need to stall.. + * + * NOTE that intel takes ALLOC_FOR_RENDER bo's from the list tail + * (MRU, since likely to be in GPU cache), rather than head (LRU).. + */ + pthread_mutex_lock(&table_lock); + if (!LIST_IS_EMPTY(&bucket->list)) { + bo = LIST_ENTRY(struct fd_bo, bucket->list.next, list); + /* TODO check for compatible flags? */ + if (is_idle(bo)) { + list_del(&bo->list); + } else { + bo = NULL; + } + } + pthread_mutex_unlock(&table_lock); + + return bo; +} + +/* NOTE: size is potentially rounded up to bucket size: */ +drm_private struct fd_bo * +fd_bo_cache_alloc(struct fd_bo_cache *cache, uint32_t *size, uint32_t flags) +{ + struct fd_bo *bo = NULL; + struct fd_bo_bucket *bucket; + + *size = ALIGN(*size, 4096); + bucket = get_bucket(cache, *size); + + /* see if we can be green and recycle: */ +retry: + if (bucket) { + *size = bucket->size; + bo = find_in_bucket(bucket, flags); + if (bo) { + if (bo->funcs->madvise(bo, TRUE) <= 0) { + /* we've lost the backing pages, delete and try again: */ + pthread_mutex_lock(&table_lock); + bo_del(bo); + pthread_mutex_unlock(&table_lock); + goto retry; + } + atomic_set(&bo->refcnt, 1); + fd_device_ref(bo->dev); + return bo; + } + } + + return NULL; +} + +drm_private int +fd_bo_cache_free(struct fd_bo_cache *cache, struct fd_bo *bo) +{ + struct fd_bo_bucket *bucket = get_bucket(cache, bo->size); + + /* see if we can be green and recycle: */ + if (bucket) { + struct timespec time; + + bo->funcs->madvise(bo, FALSE); + + clock_gettime(CLOCK_MONOTONIC, &time); + + bo->free_time = time.tv_sec; + list_addtail(&bo->list, &bucket->list); + fd_bo_cache_cleanup(cache, time.tv_sec); + + /* bo's in the bucket cache don't have a ref and + * don't hold a ref to the dev: + */ + fd_device_del_locked(bo->dev); + + return 0; + } + + return -1; +} diff -Nru libdrm-2.4.67/freedreno/freedreno_device.c libdrm-2.4.70/freedreno/freedreno_device.c --- libdrm-2.4.67/freedreno/freedreno_device.c 2015-09-04 15:06:44.000000000 +0000 +++ libdrm-2.4.70/freedreno/freedreno_device.c 2016-07-20 23:42:21.000000000 +0000 @@ -42,44 +42,6 @@ struct fd_device * kgsl_device_new(int fd); struct fd_device * msm_device_new(int fd); -static void -add_bucket(struct fd_device *dev, int size) -{ - unsigned int i = dev->num_buckets; - - assert(i < ARRAY_SIZE(dev->cache_bucket)); - - list_inithead(&dev->cache_bucket[i].list); - dev->cache_bucket[i].size = size; - dev->num_buckets++; -} - -static void -init_cache_buckets(struct fd_device *dev) -{ - unsigned long size, cache_max_size = 64 * 1024 * 1024; - - /* OK, so power of two buckets was too wasteful of memory. - * Give 3 other sizes between each power of two, to hopefully - * cover things accurately enough. (The alternative is - * probably to just go for exact matching of sizes, and assume - * that for things like composited window resize the tiled - * width/height alignment and rounding of sizes to pages will - * get us useful cache hit rates anyway) - */ - add_bucket(dev, 4096); - add_bucket(dev, 4096 * 2); - add_bucket(dev, 4096 * 3); - - /* Initialize the linked lists for BO reuse cache. */ - for (size = 4 * 4096; size <= cache_max_size; size *= 2) { - add_bucket(dev, size); - add_bucket(dev, size + size * 1 / 4); - add_bucket(dev, size + size * 2 / 4); - add_bucket(dev, size + size * 3 / 4); - } -} - struct fd_device * fd_device_new(int fd) { struct fd_device *dev; @@ -94,7 +56,15 @@ if (!strcmp(version->name, "msm")) { DEBUG_MSG("msm DRM device"); + if (version->version_major != 1) { + ERROR_MSG("unsupported version: %u.%u.%u", version->version_major, + version->version_minor, version->version_patchlevel); + dev = NULL; + goto out; + } + dev = msm_device_new(fd); + dev->version = version->version_minor; #ifdef HAVE_FREEDRENO_KGSL } else if (!strcmp(version->name, "kgsl")) { DEBUG_MSG("kgsl DRM device"); @@ -104,6 +74,8 @@ ERROR_MSG("unknown device: %s", version->name); dev = NULL; } + +out: drmFreeVersion(version); if (!dev) @@ -113,7 +85,7 @@ dev->fd = fd; dev->handle_table = drmHashCreate(); dev->name_table = drmHashCreate(); - init_cache_buckets(dev); + fd_bo_cache_init(&dev->bo_cache, FALSE); return dev; } @@ -123,9 +95,12 @@ */ struct fd_device * fd_device_new_dup(int fd) { - struct fd_device *dev = fd_device_new(dup(fd)); + int dup_fd = dup(fd); + struct fd_device *dev = fd_device_new(dup_fd); if (dev) dev->closefd = 1; + else + close(dup_fd); return dev; } @@ -137,7 +112,7 @@ static void fd_device_del_impl(struct fd_device *dev) { - fd_cleanup_bo_cache(dev, 0); + fd_bo_cache_cleanup(&dev->bo_cache, 0); drmHashDestroy(dev->handle_table); drmHashDestroy(dev->name_table); if (dev->closefd) @@ -165,3 +140,8 @@ { return dev->fd; } + +enum fd_version fd_device_version(struct fd_device *dev) +{ + return dev->version; +} diff -Nru libdrm-2.4.67/freedreno/freedreno_drmif.h libdrm-2.4.70/freedreno/freedreno_drmif.h --- libdrm-2.4.67/freedreno/freedreno_drmif.h 2016-02-12 23:32:22.000000000 +0000 +++ libdrm-2.4.70/freedreno/freedreno_drmif.h 2016-07-21 18:10:45.000000000 +0000 @@ -32,6 +32,15 @@ #include #include +#if defined(__GNUC__) +# define drm_deprecated __attribute__((__deprecated__)) +#else +# define drm_deprecated +#endif + +/* an empty marker for things that will be deprecated in the future: */ +#define will_be_deprecated + struct fd_bo; struct fd_pipe; struct fd_device; @@ -51,6 +60,7 @@ FD_GPU_ID, FD_CHIP_ID, FD_MAX_FREQ, + FD_TIMESTAMP, }; /* bo flags: */ @@ -79,6 +89,11 @@ void fd_device_del(struct fd_device *dev); int fd_device_fd(struct fd_device *dev); +enum fd_version { + FD_VERSION_MADVISE = 1, /* kernel supports madvise */ + FD_VERSION_UNLIMITED_CMDS = 1, /* submits w/ >4 cmd buffers (growable ringbuffer) */ +}; +enum fd_version fd_device_version(struct fd_device *dev); /* pipe functions: */ diff -Nru libdrm-2.4.67/freedreno/freedreno_priv.h libdrm-2.4.70/freedreno/freedreno_priv.h --- libdrm-2.4.67/freedreno/freedreno_priv.h 2015-09-19 16:12:01.000000000 +0000 +++ libdrm-2.4.70/freedreno/freedreno_priv.h 2016-07-20 23:42:21.000000000 +0000 @@ -54,6 +54,13 @@ #include "freedreno_ringbuffer.h" #include "drm.h" +#ifndef TRUE +# define TRUE 1 +#endif +#ifndef FALSE +# define FALSE 0 +#endif + struct fd_device_funcs { int (*bo_new_handle)(struct fd_device *dev, uint32_t size, uint32_t flags, uint32_t *handle); @@ -68,8 +75,15 @@ struct list_head list; }; +struct fd_bo_cache { + struct fd_bo_bucket cache_bucket[14 * 4]; + int num_buckets; + time_t time; +}; + struct fd_device { int fd; + enum fd_version version; atomic_t refcnt; /* tables to keep track of bo's, to avoid "evil-twin" fd_bo objects: @@ -85,14 +99,16 @@ const struct fd_device_funcs *funcs; - struct fd_bo_bucket cache_bucket[14 * 4]; - int num_buckets; - time_t time; + struct fd_bo_cache bo_cache; int closefd; /* call close(fd) upon destruction */ }; -drm_private void fd_cleanup_bo_cache(struct fd_device *dev, time_t time); +drm_private void fd_bo_cache_init(struct fd_bo_cache *cache, int coarse); +drm_private void fd_bo_cache_cleanup(struct fd_bo_cache *cache, time_t time); +drm_private struct fd_bo * fd_bo_cache_alloc(struct fd_bo_cache *cache, + uint32_t *size, uint32_t flags); +drm_private int fd_bo_cache_free(struct fd_bo_cache *cache, struct fd_bo *bo); /* for where @table_lock is already held: */ drm_private void fd_device_del_locked(struct fd_device *dev); @@ -118,11 +134,14 @@ struct fd_ringbuffer_funcs { void * (*hostptr)(struct fd_ringbuffer *ring); int (*flush)(struct fd_ringbuffer *ring, uint32_t *last_start); + void (*grow)(struct fd_ringbuffer *ring, uint32_t size); void (*reset)(struct fd_ringbuffer *ring); void (*emit_reloc)(struct fd_ringbuffer *ring, const struct fd_reloc *reloc); - void (*emit_reloc_ring)(struct fd_ringbuffer *ring, - struct fd_ringmarker *target, struct fd_ringmarker *end); + uint32_t (*emit_reloc_ring)(struct fd_ringbuffer *ring, + struct fd_ringbuffer *target, uint32_t cmd_idx, + uint32_t submit_offset, uint32_t size); + uint32_t (*cmd_count)(struct fd_ringbuffer *ring); void (*destroy)(struct fd_ringbuffer *ring); }; @@ -130,6 +149,7 @@ int (*offset)(struct fd_bo *bo, uint64_t *offset); int (*cpu_prep)(struct fd_bo *bo, struct fd_pipe *pipe, uint32_t op); void (*cpu_fini)(struct fd_bo *bo); + int (*madvise)(struct fd_bo *bo, int willneed); void (*destroy)(struct fd_bo *bo); }; @@ -168,4 +188,10 @@ #define U642VOID(x) ((void *)(unsigned long)(x)) #define VOID2U64(x) ((uint64_t)(unsigned long)(x)) +static inline uint32_t +offset_bytes(void *end, void *start) +{ + return ((char *)end) - ((char *)start); +} + #endif /* FREEDRENO_PRIV_H_ */ diff -Nru libdrm-2.4.67/freedreno/freedreno_ringbuffer.c libdrm-2.4.70/freedreno/freedreno_ringbuffer.c --- libdrm-2.4.67/freedreno/freedreno_ringbuffer.c 2015-05-04 15:47:43.000000000 +0000 +++ libdrm-2.4.70/freedreno/freedreno_ringbuffer.c 2016-07-20 23:42:21.000000000 +0000 @@ -45,10 +45,9 @@ if (!ring) return NULL; - ring->size = size; ring->pipe = pipe; ring->start = ring->funcs->hostptr(ring); - ring->end = &(ring->start[size/4]); + ring->end = &(ring->start[ring->size/4]); ring->cur = ring->last_start = ring->start; @@ -57,6 +56,7 @@ void fd_ringbuffer_del(struct fd_ringbuffer *ring) { + fd_ringbuffer_reset(ring); ring->funcs->destroy(ring); } @@ -86,6 +86,22 @@ return ring->funcs->flush(ring, ring->last_start); } +void fd_ringbuffer_grow(struct fd_ringbuffer *ring, uint32_t ndwords) +{ + assert(ring->funcs->grow); /* unsupported on kgsl */ + + /* there is an upper bound on IB size, which appears to be 0x100000 */ + if (ring->size < 0x100000) + ring->size *= 2; + + ring->funcs->grow(ring, ring->size); + + ring->start = ring->funcs->hostptr(ring); + ring->end = &(ring->start[ring->size/4]); + + ring->cur = ring->last_start = ring->start; +} + uint32_t fd_ringbuffer_timestamp(struct fd_ringbuffer *ring) { return ring->last_timestamp; @@ -97,13 +113,32 @@ ring->funcs->emit_reloc(ring, reloc); } -void -fd_ringbuffer_emit_reloc_ring(struct fd_ringbuffer *ring, - struct fd_ringmarker *target, - struct fd_ringmarker *end) +void fd_ringbuffer_emit_reloc_ring(struct fd_ringbuffer *ring, + struct fd_ringmarker *target, struct fd_ringmarker *end) { + uint32_t submit_offset, size; + assert(target->ring == end->ring); - ring->funcs->emit_reloc_ring(ring, target, end); + + submit_offset = offset_bytes(target->cur, target->ring->start); + size = offset_bytes(end->cur, target->cur); + + ring->funcs->emit_reloc_ring(ring, target->ring, 0, submit_offset, size); +} + +uint32_t fd_ringbuffer_cmd_count(struct fd_ringbuffer *ring) +{ + if (!ring->funcs->cmd_count) + return 1; + return ring->funcs->cmd_count(ring); +} + +uint32_t +fd_ringbuffer_emit_reloc_ring_full(struct fd_ringbuffer *ring, + struct fd_ringbuffer *target, uint32_t cmd_idx) +{ + uint32_t size = offset_bytes(target->cur, target->start); + return ring->funcs->emit_reloc_ring(ring, target, cmd_idx, 0, size); } struct fd_ringmarker * fd_ringmarker_new(struct fd_ringbuffer *ring) @@ -118,7 +153,7 @@ marker->ring = ring; - fd_ringmarker_mark(marker); + marker->cur = marker->ring->cur; return marker; } diff -Nru libdrm-2.4.67/freedreno/freedreno_ringbuffer.h libdrm-2.4.70/freedreno/freedreno_ringbuffer.h --- libdrm-2.4.67/freedreno/freedreno_ringbuffer.h 2015-09-09 14:06:56.000000000 +0000 +++ libdrm-2.4.70/freedreno/freedreno_ringbuffer.h 2016-07-20 23:42:21.000000000 +0000 @@ -56,6 +56,7 @@ struct fd_ringbuffer *parent); void fd_ringbuffer_reset(struct fd_ringbuffer *ring); int fd_ringbuffer_flush(struct fd_ringbuffer *ring); +void fd_ringbuffer_grow(struct fd_ringbuffer *ring, uint32_t ndwords); uint32_t fd_ringbuffer_timestamp(struct fd_ringbuffer *ring); static inline void fd_ringbuffer_emit(struct fd_ringbuffer *ring, @@ -75,14 +76,17 @@ }; void fd_ringbuffer_reloc(struct fd_ringbuffer *ring, const struct fd_reloc *reloc); -void fd_ringbuffer_emit_reloc_ring(struct fd_ringbuffer *ring, +will_be_deprecated void fd_ringbuffer_emit_reloc_ring(struct fd_ringbuffer *ring, struct fd_ringmarker *target, struct fd_ringmarker *end); +uint32_t fd_ringbuffer_cmd_count(struct fd_ringbuffer *ring); +uint32_t fd_ringbuffer_emit_reloc_ring_full(struct fd_ringbuffer *ring, + struct fd_ringbuffer *target, uint32_t cmd_idx); -struct fd_ringmarker * fd_ringmarker_new(struct fd_ringbuffer *ring); -void fd_ringmarker_del(struct fd_ringmarker *marker); -void fd_ringmarker_mark(struct fd_ringmarker *marker); -uint32_t fd_ringmarker_dwords(struct fd_ringmarker *start, +will_be_deprecated struct fd_ringmarker * fd_ringmarker_new(struct fd_ringbuffer *ring); +will_be_deprecated void fd_ringmarker_del(struct fd_ringmarker *marker); +will_be_deprecated void fd_ringmarker_mark(struct fd_ringmarker *marker); +will_be_deprecated uint32_t fd_ringmarker_dwords(struct fd_ringmarker *start, struct fd_ringmarker *end); -int fd_ringmarker_flush(struct fd_ringmarker *marker); +will_be_deprecated int fd_ringmarker_flush(struct fd_ringmarker *marker); #endif /* FREEDRENO_RINGBUFFER_H_ */ diff -Nru libdrm-2.4.67/freedreno/freedreno-symbol-check libdrm-2.4.70/freedreno/freedreno-symbol-check --- libdrm-2.4.67/freedreno/freedreno-symbol-check 2015-09-04 15:07:40.000000000 +0000 +++ libdrm-2.4.70/freedreno/freedreno-symbol-check 2016-07-21 14:47:54.000000000 +0000 @@ -29,14 +29,18 @@ fd_device_new fd_device_new_dup fd_device_ref +fd_device_version fd_pipe_del fd_pipe_get_param fd_pipe_new fd_pipe_wait fd_pipe_wait_timeout +fd_ringbuffer_cmd_count fd_ringbuffer_del fd_ringbuffer_emit_reloc_ring +fd_ringbuffer_emit_reloc_ring_full fd_ringbuffer_flush +fd_ringbuffer_grow fd_ringbuffer_new fd_ringbuffer_reloc fd_ringbuffer_reset diff -Nru libdrm-2.4.67/freedreno/kgsl/kgsl_bo.c libdrm-2.4.70/freedreno/kgsl/kgsl_bo.c --- libdrm-2.4.67/freedreno/kgsl/kgsl_bo.c 2015-09-19 16:12:01.000000000 +0000 +++ libdrm-2.4.70/freedreno/kgsl/kgsl_bo.c 2016-07-20 23:42:21.000000000 +0000 @@ -116,6 +116,11 @@ { } +static int kgsl_bo_madvise(struct fd_bo *bo, int willneed) +{ + return willneed; /* not supported by kgsl */ +} + static void kgsl_bo_destroy(struct fd_bo *bo) { struct kgsl_bo *kgsl_bo = to_kgsl_bo(bo); @@ -127,6 +132,7 @@ .offset = kgsl_bo_offset, .cpu_prep = kgsl_bo_cpu_prep, .cpu_fini = kgsl_bo_cpu_fini, + .madvise = kgsl_bo_madvise, .destroy = kgsl_bo_destroy, }; diff -Nru libdrm-2.4.67/freedreno/kgsl/kgsl_drm.h libdrm-2.4.70/freedreno/kgsl/kgsl_drm.h --- libdrm-2.4.67/freedreno/kgsl/kgsl_drm.h 2013-10-09 16:03:23.000000000 +0000 +++ libdrm-2.4.70/freedreno/kgsl/kgsl_drm.h 2016-04-21 13:40:06.000000000 +0000 @@ -81,7 +81,7 @@ /* Memory types - these define the source and caching policies of the GEM memory chunk */ -/* Legacy definitions left for compatability */ +/* Legacy definitions left for compatibility */ #define DRM_KGSL_GEM_TYPE_EBI 0 #define DRM_KGSL_GEM_TYPE_SMI 1 diff -Nru libdrm-2.4.67/freedreno/kgsl/kgsl_pipe.c libdrm-2.4.70/freedreno/kgsl/kgsl_pipe.c --- libdrm-2.4.67/freedreno/kgsl/kgsl_pipe.c 2016-02-12 23:32:22.000000000 +0000 +++ libdrm-2.4.70/freedreno/kgsl/kgsl_pipe.c 2016-03-13 16:27:27.000000000 +0000 @@ -51,6 +51,7 @@ *value = kgsl_pipe->devinfo.chip_id; return 0; case FD_MAX_FREQ: + case FD_TIMESTAMP: /* unsupported on kgsl */ return -1; default: diff -Nru libdrm-2.4.67/freedreno/kgsl/kgsl_ringbuffer.c libdrm-2.4.70/freedreno/kgsl/kgsl_ringbuffer.c --- libdrm-2.4.67/freedreno/kgsl/kgsl_ringbuffer.c 2015-09-09 14:06:56.000000000 +0000 +++ libdrm-2.4.70/freedreno/kgsl/kgsl_ringbuffer.c 2016-07-20 23:42:21.000000000 +0000 @@ -173,12 +173,14 @@ kgsl_pipe_add_submit(to_kgsl_pipe(ring->pipe), kgsl_bo); } -static void kgsl_ringbuffer_emit_reloc_ring(struct fd_ringbuffer *ring, - struct fd_ringmarker *target, struct fd_ringmarker *end) +static uint32_t kgsl_ringbuffer_emit_reloc_ring(struct fd_ringbuffer *ring, + struct fd_ringbuffer *target, uint32_t cmd_idx, + uint32_t submit_offset, uint32_t size) { - struct kgsl_ringbuffer *target_ring = to_kgsl_ringbuffer(target->ring); - (*ring->cur++) = target_ring->bo->gpuaddr + - (uint8_t *)target->cur - (uint8_t *)target->ring->start; + struct kgsl_ringbuffer *target_ring = to_kgsl_ringbuffer(target); + assert(cmd_idx == 0); + (*ring->cur++) = target_ring->bo->gpuaddr + submit_offset; + return size; } static void kgsl_ringbuffer_destroy(struct fd_ringbuffer *ring) @@ -213,6 +215,7 @@ ring = &kgsl_ring->base; ring->funcs = &funcs; + ring->size = size; kgsl_ring->bo = kgsl_rb_bo_new(to_kgsl_pipe(pipe), size); if (!kgsl_ring->bo) { diff -Nru libdrm-2.4.67/freedreno/kgsl/msm_kgsl.h libdrm-2.4.70/freedreno/kgsl/msm_kgsl.h --- libdrm-2.4.67/freedreno/kgsl/msm_kgsl.h 2013-10-09 16:03:23.000000000 +0000 +++ libdrm-2.4.70/freedreno/kgsl/msm_kgsl.h 2016-04-21 13:40:06.000000000 +0000 @@ -31,7 +31,7 @@ #define KGSL_FLAGS_SOFT_RESET 0x00000100 #define KGSL_FLAGS_PER_CONTEXT_TIMESTAMPS 0x00000200 -/* Clock flags to show which clocks should be controled by a given platform */ +/* Clock flags to show which clocks should be controlled by a given platform */ #define KGSL_CLK_SRC 0x00000001 #define KGSL_CLK_CORE 0x00000002 #define KGSL_CLK_IFACE 0x00000004 @@ -295,7 +295,7 @@ /* Previous versions of this header had incorrectly defined IOCTL_KGSL_CMDSTREAM_FREEMEMONTIMESTAMP as a read-only ioctl instead - of a write only ioctl. To ensure binary compatability, the following + of a write only ioctl. To ensure binary compatibility, the following #define will be used to intercept the incorrect ioctl */ diff -Nru libdrm-2.4.67/freedreno/Makefile.am libdrm-2.4.70/freedreno/Makefile.am --- libdrm-2.4.67/freedreno/Makefile.am 2015-05-04 15:47:43.000000000 +0000 +++ libdrm-2.4.70/freedreno/Makefile.am 2016-07-23 12:53:10.000000000 +0000 @@ -27,4 +27,4 @@ pkgconfig_DATA = libdrm_freedreno.pc TESTS = freedreno-symbol-check -EXTRA_DIST = Android.mk $(TESTS) +EXTRA_DIST = $(TESTS) diff -Nru libdrm-2.4.67/freedreno/Makefile.in libdrm-2.4.70/freedreno/Makefile.in --- libdrm-2.4.67/freedreno/Makefile.in 2016-02-15 18:24:00.000000000 +0000 +++ libdrm-2.4.70/freedreno/Makefile.in 2016-07-23 13:19:07.000000000 +0000 @@ -139,15 +139,16 @@ libdrm_freedreno_la_DEPENDENCIES = ../libdrm.la am__libdrm_freedreno_la_SOURCES_DIST = freedreno_device.c \ freedreno_pipe.c freedreno_priv.h freedreno_ringbuffer.c \ - freedreno_bo.c msm/msm_bo.c msm/msm_device.c msm/msm_drm.h \ - msm/msm_pipe.c msm/msm_priv.h msm/msm_ringbuffer.c \ - kgsl/kgsl_bo.c kgsl/kgsl_device.c kgsl/kgsl_drm.h \ - kgsl/kgsl_pipe.c kgsl/kgsl_priv.h kgsl/kgsl_ringbuffer.c \ - kgsl/msm_kgsl.h + freedreno_bo.c freedreno_bo_cache.c msm/msm_bo.c \ + msm/msm_device.c msm/msm_drm.h msm/msm_pipe.c msm/msm_priv.h \ + msm/msm_ringbuffer.c kgsl/kgsl_bo.c kgsl/kgsl_device.c \ + kgsl/kgsl_drm.h kgsl/kgsl_pipe.c kgsl/kgsl_priv.h \ + kgsl/kgsl_ringbuffer.c kgsl/msm_kgsl.h am__dirstamp = $(am__leading_dot)dirstamp am__objects_1 = freedreno_device.lo freedreno_pipe.lo \ - freedreno_ringbuffer.lo freedreno_bo.lo msm/msm_bo.lo \ - msm/msm_device.lo msm/msm_pipe.lo msm/msm_ringbuffer.lo + freedreno_ringbuffer.lo freedreno_bo.lo freedreno_bo_cache.lo \ + msm/msm_bo.lo msm/msm_device.lo msm/msm_pipe.lo \ + msm/msm_ringbuffer.lo am__objects_2 = kgsl/kgsl_bo.lo kgsl/kgsl_device.lo kgsl/kgsl_pipe.lo \ kgsl/kgsl_ringbuffer.lo @HAVE_FREEDRENO_KGSL_TRUE@am__objects_3 = $(am__objects_2) @@ -403,7 +404,7 @@ am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.sources \ $(srcdir)/libdrm_freedreno.pc.in \ $(top_srcdir)/build-aux/depcomp \ - $(top_srcdir)/build-aux/test-driver README + $(top_srcdir)/build-aux/test-driver DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ADMIN_MAN_DIR = @ADMIN_MAN_DIR@ @@ -563,6 +564,7 @@ freedreno_priv.h \ freedreno_ringbuffer.c \ freedreno_bo.c \ + freedreno_bo_cache.c \ msm/msm_bo.c \ msm/msm_device.c \ msm/msm_drm.h \ @@ -603,7 +605,7 @@ libdrm_freedrenocommoninclude_HEADERS = $(LIBDRM_FREEDRENO_H_FILES) pkgconfig_DATA = libdrm_freedreno.pc TESTS = freedreno-symbol-check -EXTRA_DIST = Android.mk $(TESTS) +EXTRA_DIST = $(TESTS) all: all-am .SUFFIXES: @@ -713,6 +715,7 @@ -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/freedreno_bo.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/freedreno_bo_cache.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/freedreno_device.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/freedreno_pipe.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/freedreno_ringbuffer.Plo@am__quote@ diff -Nru libdrm-2.4.67/freedreno/Makefile.sources libdrm-2.4.70/freedreno/Makefile.sources --- libdrm-2.4.67/freedreno/Makefile.sources 2015-08-05 22:59:54.000000000 +0000 +++ libdrm-2.4.70/freedreno/Makefile.sources 2016-07-20 23:42:21.000000000 +0000 @@ -4,6 +4,7 @@ freedreno_priv.h \ freedreno_ringbuffer.c \ freedreno_bo.c \ + freedreno_bo_cache.c \ msm/msm_bo.c \ msm/msm_device.c \ msm/msm_drm.h \ diff -Nru libdrm-2.4.67/freedreno/msm/msm_bo.c libdrm-2.4.70/freedreno/msm/msm_bo.c --- libdrm-2.4.67/freedreno/msm/msm_bo.c 2015-09-19 16:12:01.000000000 +0000 +++ libdrm-2.4.70/freedreno/msm/msm_bo.c 2016-07-20 23:42:21.000000000 +0000 @@ -89,6 +89,25 @@ drmCommandWrite(bo->dev->fd, DRM_MSM_GEM_CPU_FINI, &req, sizeof(req)); } +static int msm_bo_madvise(struct fd_bo *bo, int willneed) +{ + struct drm_msm_gem_madvise req = { + .handle = bo->handle, + .madv = willneed ? MSM_MADV_WILLNEED : MSM_MADV_DONTNEED, + }; + int ret; + + /* older kernels do not support this: */ + if (bo->dev->version < FD_VERSION_MADVISE) + return willneed; + + ret = drmCommandWriteRead(bo->dev->fd, DRM_MSM_GEM_MADVISE, &req, sizeof(req)); + if (ret) + return ret; + + return req.retained; +} + static void msm_bo_destroy(struct fd_bo *bo) { struct msm_bo *msm_bo = to_msm_bo(bo); @@ -100,6 +119,7 @@ .offset = msm_bo_offset, .cpu_prep = msm_bo_cpu_prep, .cpu_fini = msm_bo_cpu_fini, + .madvise = msm_bo_madvise, .destroy = msm_bo_destroy, }; diff -Nru libdrm-2.4.67/freedreno/msm/msm_device.c libdrm-2.4.70/freedreno/msm/msm_device.c --- libdrm-2.4.67/freedreno/msm/msm_device.c 2015-09-09 14:06:56.000000000 +0000 +++ libdrm-2.4.70/freedreno/msm/msm_device.c 2016-07-20 23:42:21.000000000 +0000 @@ -39,6 +39,7 @@ static void msm_device_destroy(struct fd_device *dev) { struct msm_device *msm_dev = to_msm_device(dev); + fd_bo_cache_cleanup(&msm_dev->ring_cache, 0); free(msm_dev); } @@ -61,5 +62,7 @@ dev = &msm_dev->base; dev->funcs = &funcs; + fd_bo_cache_init(&msm_dev->ring_cache, TRUE); + return dev; } diff -Nru libdrm-2.4.67/freedreno/msm/msm_drm.h libdrm-2.4.70/freedreno/msm/msm_drm.h --- libdrm-2.4.67/freedreno/msm/msm_drm.h 2016-02-12 23:32:22.000000000 +0000 +++ libdrm-2.4.70/freedreno/msm/msm_drm.h 2016-07-20 23:42:21.000000000 +0000 @@ -28,9 +28,13 @@ #include #include "drm.h" +#if defined(__cplusplus) +extern "C" { +#endif + /* Please note that modifications to all structs defined here are * subject to backwards-compatibility constraints: - * 1) Do not use pointers, use uint64_t instead for 32 bit / 64 bit + * 1) Do not use pointers, use __u64 instead for 32 bit / 64 bit * user/kernel compatibility * 2) Keep fields aligned to their size * 3) Because of how drm_ioctl() works, we can add new fields at @@ -51,19 +55,20 @@ * same as 'struct timespec' but 32/64b ABI safe. */ struct drm_msm_timespec { - int64_t tv_sec; /* seconds */ - int64_t tv_nsec; /* nanoseconds */ + __s64 tv_sec; /* seconds */ + __s64 tv_nsec; /* nanoseconds */ }; #define MSM_PARAM_GPU_ID 0x01 #define MSM_PARAM_GMEM_SIZE 0x02 #define MSM_PARAM_CHIP_ID 0x03 #define MSM_PARAM_MAX_FREQ 0x04 +#define MSM_PARAM_TIMESTAMP 0x05 struct drm_msm_param { - uint32_t pipe; /* in, MSM_PIPE_x */ - uint32_t param; /* in, MSM_PARAM_x */ - uint64_t value; /* out (get_param) or in (set_param) */ + __u32 pipe; /* in, MSM_PIPE_x */ + __u32 param; /* in, MSM_PARAM_x */ + __u64 value; /* out (get_param) or in (set_param) */ }; /* @@ -85,15 +90,15 @@ MSM_BO_UNCACHED) struct drm_msm_gem_new { - uint64_t size; /* in */ - uint32_t flags; /* in, mask of MSM_BO_x */ - uint32_t handle; /* out */ + __u64 size; /* in */ + __u32 flags; /* in, mask of MSM_BO_x */ + __u32 handle; /* out */ }; struct drm_msm_gem_info { - uint32_t handle; /* in */ - uint32_t pad; - uint64_t offset; /* out, offset to pass to mmap() */ + __u32 handle; /* in */ + __u32 pad; + __u64 offset; /* out, offset to pass to mmap() */ }; #define MSM_PREP_READ 0x01 @@ -103,13 +108,13 @@ #define MSM_PREP_FLAGS (MSM_PREP_READ | MSM_PREP_WRITE | MSM_PREP_NOSYNC) struct drm_msm_gem_cpu_prep { - uint32_t handle; /* in */ - uint32_t op; /* in, mask of MSM_PREP_x */ + __u32 handle; /* in */ + __u32 op; /* in, mask of MSM_PREP_x */ struct drm_msm_timespec timeout; /* in */ }; struct drm_msm_gem_cpu_fini { - uint32_t handle; /* in */ + __u32 handle; /* in */ }; /* @@ -128,11 +133,11 @@ * otherwise EINVAL. */ struct drm_msm_gem_submit_reloc { - uint32_t submit_offset; /* in, offset from submit_bo */ - uint32_t or; /* in, value OR'd with result */ - int32_t shift; /* in, amount of left shift (can be negative) */ - uint32_t reloc_idx; /* in, index of reloc_bo buffer */ - uint64_t reloc_offset; /* in, offset from start of reloc_bo */ + __u32 submit_offset; /* in, offset from submit_bo */ + __u32 or; /* in, value OR'd with result */ + __s32 shift; /* in, amount of left shift (can be negative) */ + __u32 reloc_idx; /* in, index of reloc_bo buffer */ + __u64 reloc_offset; /* in, offset from start of reloc_bo */ }; /* submit-types: @@ -147,13 +152,13 @@ #define MSM_SUBMIT_CMD_IB_TARGET_BUF 0x0002 #define MSM_SUBMIT_CMD_CTX_RESTORE_BUF 0x0003 struct drm_msm_gem_submit_cmd { - uint32_t type; /* in, one of MSM_SUBMIT_CMD_x */ - uint32_t submit_idx; /* in, index of submit_bo cmdstream buffer */ - uint32_t submit_offset; /* in, offset into submit_bo */ - uint32_t size; /* in, cmdstream size */ - uint32_t pad; - uint32_t nr_relocs; /* in, number of submit_reloc's */ - uint64_t __user relocs; /* in, ptr to array of submit_reloc's */ + __u32 type; /* in, one of MSM_SUBMIT_CMD_x */ + __u32 submit_idx; /* in, index of submit_bo cmdstream buffer */ + __u32 submit_offset; /* in, offset into submit_bo */ + __u32 size; /* in, cmdstream size */ + __u32 pad; + __u32 nr_relocs; /* in, number of submit_reloc's */ + __u64 __user relocs; /* in, ptr to array of submit_reloc's */ }; /* Each buffer referenced elsewhere in the cmdstream submit (ie. the @@ -173,9 +178,9 @@ #define MSM_SUBMIT_BO_FLAGS (MSM_SUBMIT_BO_READ | MSM_SUBMIT_BO_WRITE) struct drm_msm_gem_submit_bo { - uint32_t flags; /* in, mask of MSM_SUBMIT_BO_x */ - uint32_t handle; /* in, GEM handle */ - uint64_t presumed; /* in/out, presumed buffer address */ + __u32 flags; /* in, mask of MSM_SUBMIT_BO_x */ + __u32 handle; /* in, GEM handle */ + __u64 presumed; /* in/out, presumed buffer address */ }; /* Each cmdstream submit consists of a table of buffers involved, and @@ -183,12 +188,12 @@ * (context-restore), and IB buffers needed for per tile/bin draw cmds. */ struct drm_msm_gem_submit { - uint32_t pipe; /* in, MSM_PIPE_x */ - uint32_t fence; /* out */ - uint32_t nr_bos; /* in, number of submit_bo's */ - uint32_t nr_cmds; /* in, number of submit_cmd's */ - uint64_t __user bos; /* in, ptr to array of submit_bo's */ - uint64_t __user cmds; /* in, ptr to array of submit_cmd's */ + __u32 pipe; /* in, MSM_PIPE_x */ + __u32 fence; /* out */ + __u32 nr_bos; /* in, number of submit_bo's */ + __u32 nr_cmds; /* in, number of submit_cmd's */ + __u64 __user bos; /* in, ptr to array of submit_bo's */ + __u64 __user cmds; /* in, ptr to array of submit_cmd's */ }; /* The normal way to synchronize with the GPU is just to CPU_PREP on @@ -199,11 +204,32 @@ * APIs without requiring a dummy bo to synchronize on. */ struct drm_msm_wait_fence { - uint32_t fence; /* in */ - uint32_t pad; + __u32 fence; /* in */ + __u32 pad; struct drm_msm_timespec timeout; /* in */ }; +/* madvise provides a way to tell the kernel in case a buffers contents + * can be discarded under memory pressure, which is useful for userspace + * bo cache where we want to optimistically hold on to buffer allocate + * and potential mmap, but allow the pages to be discarded under memory + * pressure. + * + * Typical usage would involve madvise(DONTNEED) when buffer enters BO + * cache, and madvise(WILLNEED) if trying to recycle buffer from BO cache. + * In the WILLNEED case, 'retained' indicates to userspace whether the + * backing pages still exist. + */ +#define MSM_MADV_WILLNEED 0 /* backing pages are needed, status returned in 'retained' */ +#define MSM_MADV_DONTNEED 1 /* backing pages not needed */ +#define __MSM_MADV_PURGED 2 /* internal state */ + +struct drm_msm_gem_madvise { + __u32 handle; /* in, GEM handle */ + __u32 madv; /* in, MSM_MADV_x */ + __u32 retained; /* out, whether backing store still exists */ +}; + #define DRM_MSM_GET_PARAM 0x00 /* placeholder: #define DRM_MSM_SET_PARAM 0x01 @@ -214,7 +240,8 @@ #define DRM_MSM_GEM_CPU_FINI 0x05 #define DRM_MSM_GEM_SUBMIT 0x06 #define DRM_MSM_WAIT_FENCE 0x07 -#define DRM_MSM_NUM_IOCTLS 0x08 +#define DRM_MSM_GEM_MADVISE 0x08 +#define DRM_MSM_NUM_IOCTLS 0x09 #define DRM_IOCTL_MSM_GET_PARAM DRM_IOWR(DRM_COMMAND_BASE + DRM_MSM_GET_PARAM, struct drm_msm_param) #define DRM_IOCTL_MSM_GEM_NEW DRM_IOWR(DRM_COMMAND_BASE + DRM_MSM_GEM_NEW, struct drm_msm_gem_new) @@ -223,5 +250,10 @@ #define DRM_IOCTL_MSM_GEM_CPU_FINI DRM_IOW (DRM_COMMAND_BASE + DRM_MSM_GEM_CPU_FINI, struct drm_msm_gem_cpu_fini) #define DRM_IOCTL_MSM_GEM_SUBMIT DRM_IOWR(DRM_COMMAND_BASE + DRM_MSM_GEM_SUBMIT, struct drm_msm_gem_submit) #define DRM_IOCTL_MSM_WAIT_FENCE DRM_IOW (DRM_COMMAND_BASE + DRM_MSM_WAIT_FENCE, struct drm_msm_wait_fence) +#define DRM_IOCTL_MSM_GEM_MADVISE DRM_IOWR(DRM_COMMAND_BASE + DRM_MSM_GEM_MADVISE, struct drm_msm_gem_madvise) + +#if defined(__cplusplus) +} +#endif #endif /* __MSM_DRM_H__ */ diff -Nru libdrm-2.4.67/freedreno/msm/msm_pipe.c libdrm-2.4.70/freedreno/msm/msm_pipe.c --- libdrm-2.4.67/freedreno/msm/msm_pipe.c 2016-02-12 23:32:22.000000000 +0000 +++ libdrm-2.4.70/freedreno/msm/msm_pipe.c 2016-03-13 16:27:27.000000000 +0000 @@ -69,6 +69,8 @@ return 0; case FD_MAX_FREQ: return query_param(pipe, MSM_PARAM_MAX_FREQ, value); + case FD_TIMESTAMP: + return query_param(pipe, MSM_PARAM_TIMESTAMP, value); default: ERROR_MSG("invalid param id: %d", param); return -1; diff -Nru libdrm-2.4.67/freedreno/msm/msm_priv.h libdrm-2.4.70/freedreno/msm/msm_priv.h --- libdrm-2.4.67/freedreno/msm/msm_priv.h 2015-08-17 14:35:08.000000000 +0000 +++ libdrm-2.4.70/freedreno/msm/msm_priv.h 2016-07-20 23:42:21.000000000 +0000 @@ -39,6 +39,8 @@ struct msm_device { struct fd_device base; + struct fd_bo_cache ring_cache; + unsigned ring_cnt; }; static inline struct msm_device * to_msm_device(struct fd_device *x) @@ -71,18 +73,11 @@ struct fd_bo base; uint64_t offset; uint64_t presumed; - /* in the common case, a bo won't be referenced by more than a single - * (parent) ring[*]. So to avoid looping over all the bo's in the - * reloc table to find the idx of a bo that might already be in the - * table, we cache the idx in the bo. But in order to detect the - * slow-path where bo is ref'd in multiple rb's, we also must track - * the current_ring for which the idx is valid. See bo2idx(). - * - * [*] in case multiple ringbuffers, ie. one toplevel and other rb(s) - * used for IB target(s), the toplevel rb is the parent which is - * tracking bo's for the submit + /* to avoid excess hashtable lookups, cache the ring this bo was + * last emitted on (since that will probably also be the next ring + * it is emitted on) */ - struct fd_ringbuffer *current_ring; + unsigned current_ring_seqno; uint32_t idx; }; diff -Nru libdrm-2.4.67/freedreno/msm/msm_ringbuffer.c libdrm-2.4.70/freedreno/msm/msm_ringbuffer.c --- libdrm-2.4.67/freedreno/msm/msm_ringbuffer.c 2016-01-17 21:22:10.000000000 +0000 +++ libdrm-2.4.70/freedreno/msm/msm_ringbuffer.c 2016-07-21 18:11:05.000000000 +0000 @@ -36,11 +36,30 @@ #include "freedreno_ringbuffer.h" #include "msm_priv.h" +/* represents a single cmd buffer in the submit ioctl. Each cmd buffer has + * a backing bo, and a reloc table. + */ +struct msm_cmd { + struct list_head list; + + struct fd_ringbuffer *ring; + struct fd_bo *ring_bo; + + /* reloc's table: */ + struct drm_msm_gem_submit_reloc *relocs; + uint32_t nr_relocs, max_relocs; + + uint32_t size; +}; + struct msm_ringbuffer { struct fd_ringbuffer base; - struct fd_bo *ring_bo; - /* submit ioctl related tables: */ + /* submit ioctl related tables: + * Note that bos and cmds are tracked by the parent ringbuffer, since + * that is global to the submit ioctl call. The reloc's table is tracked + * per cmd-buffer. + */ struct { /* bo's table: */ struct drm_msm_gem_submit_bo *bos; @@ -49,22 +68,111 @@ /* cmd's table: */ struct drm_msm_gem_submit_cmd *cmds; uint32_t nr_cmds, max_cmds; - - /* reloc's table: */ - struct drm_msm_gem_submit_reloc *relocs; - uint32_t nr_relocs, max_relocs; } submit; /* should have matching entries in submit.bos: */ + /* Note, only in parent ringbuffer */ struct fd_bo **bos; uint32_t nr_bos, max_bos; /* should have matching entries in submit.cmds: */ - struct fd_ringbuffer **rings; - uint32_t nr_rings, max_rings; + struct msm_cmd **cmds; + uint32_t nr_cmds, max_cmds; + + /* List of physical cmdstream buffers (msm_cmd) assocated with this + * logical fd_ringbuffer. + * + * Note that this is different from msm_ringbuffer::cmds (which + * shadows msm_ringbuffer::submit::cmds for tracking submit ioctl + * related stuff, and *only* is tracked in the parent ringbuffer. + * And only has "completed" cmd buffers (ie. we already know the + * size) added via get_cmd(). + */ + struct list_head cmd_list; + + int is_growable; + unsigned cmd_count; + + unsigned seqno; + + /* maps fd_bo to idx: */ + void *bo_table; }; +static inline struct msm_ringbuffer * to_msm_ringbuffer(struct fd_ringbuffer *x) +{ + return (struct msm_ringbuffer *)x; +} + +#define INIT_SIZE 0x1000 + static pthread_mutex_t idx_lock = PTHREAD_MUTEX_INITIALIZER; +drm_private extern pthread_mutex_t table_lock; + +static void ring_bo_del(struct fd_device *dev, struct fd_bo *bo) +{ + int ret; + + pthread_mutex_lock(&table_lock); + ret = fd_bo_cache_free(&to_msm_device(dev)->ring_cache, bo); + pthread_mutex_unlock(&table_lock); + + if (ret == 0) + return; + + fd_bo_del(bo); +} + +static struct fd_bo * ring_bo_new(struct fd_device *dev, uint32_t size) +{ + struct fd_bo *bo; + + bo = fd_bo_cache_alloc(&to_msm_device(dev)->ring_cache, &size, 0); + if (bo) + return bo; + + bo = fd_bo_new(dev, size, 0); + if (!bo) + return NULL; + + /* keep ringbuffer bo's out of the normal bo cache: */ + bo->bo_reuse = FALSE; + + return bo; +} + +static void ring_cmd_del(struct msm_cmd *cmd) +{ + if (cmd->ring_bo) + ring_bo_del(cmd->ring->pipe->dev, cmd->ring_bo); + list_del(&cmd->list); + to_msm_ringbuffer(cmd->ring)->cmd_count--; + free(cmd->relocs); + free(cmd); +} + +static struct msm_cmd * ring_cmd_new(struct fd_ringbuffer *ring, uint32_t size) +{ + struct msm_ringbuffer *msm_ring = to_msm_ringbuffer(ring); + struct msm_cmd *cmd = calloc(1, sizeof(*cmd)); + + if (!cmd) + return NULL; + + cmd->ring = ring; + cmd->ring_bo = ring_bo_new(ring->pipe->dev, size); + if (!cmd->ring_bo) + goto fail; + + list_addtail(&cmd->list, &msm_ring->cmd_list); + msm_ring->cmd_count++; + + return cmd; + +fail: + ring_cmd_del(cmd); + return NULL; +} static void *grow(void *ptr, uint32_t nr, uint32_t *max, uint32_t sz) { @@ -83,9 +191,11 @@ (x)->nr_ ## name ++; \ }) -static inline struct msm_ringbuffer * to_msm_ringbuffer(struct fd_ringbuffer *x) +static struct msm_cmd *current_cmd(struct fd_ringbuffer *ring) { - return (struct msm_ringbuffer *)x; + struct msm_ringbuffer *msm_ring = to_msm_ringbuffer(ring); + assert(!LIST_IS_EMPTY(&msm_ring->cmd_list)); + return LIST_LAST_ENTRY(&msm_ring->cmd_list, struct msm_cmd, list); } static uint32_t append_bo(struct fd_ringbuffer *ring, struct fd_bo *bo) @@ -112,21 +222,24 @@ struct msm_bo *msm_bo = to_msm_bo(bo); uint32_t idx; pthread_mutex_lock(&idx_lock); - if (!msm_bo->current_ring) { - idx = append_bo(ring, bo); - msm_bo->current_ring = ring; - msm_bo->idx = idx; - } else if (msm_bo->current_ring == ring) { + if (msm_bo->current_ring_seqno == msm_ring->seqno) { idx = msm_bo->idx; } else { - /* slow-path: */ - for (idx = 0; idx < msm_ring->nr_bos; idx++) - if (msm_ring->bos[idx] == bo) - break; - if (idx == msm_ring->nr_bos) { - /* not found */ + void *val; + + if (!msm_ring->bo_table) + msm_ring->bo_table = drmHashCreate(); + + if (!drmHashLookup(msm_ring->bo_table, bo->handle, &val)) { + /* found */ + idx = (uint32_t)(uintptr_t)val; + } else { idx = append_bo(ring, bo); + val = (void *)(uintptr_t)idx; + drmHashInsert(msm_ring->bo_table, bo->handle, val); } + msm_bo->current_ring_seqno = msm_ring->seqno; + msm_bo->idx = idx; } pthread_mutex_unlock(&idx_lock); if (flags & FD_RELOC_READ) @@ -143,17 +256,14 @@ return msm_ring->submit.bos[cmd->submit_idx].handle == bo->handle; } -static uint32_t offset_bytes(void *end, void *start) -{ - return ((char *)end) - ((char *)start); -} - -static struct drm_msm_gem_submit_cmd * get_cmd(struct fd_ringbuffer *ring, - struct fd_ringbuffer *target_ring, struct fd_bo *target_bo, +/* Ensure that submit has corresponding entry in cmds table for the + * target cmdstream buffer: + */ +static void get_cmd(struct fd_ringbuffer *ring, struct msm_cmd *target_cmd, uint32_t submit_offset, uint32_t size, uint32_t type) { struct msm_ringbuffer *msm_ring = to_msm_ringbuffer(ring); - struct drm_msm_gem_submit_cmd *cmd = NULL; + struct drm_msm_gem_submit_cmd *cmd; uint32_t i; /* figure out if we already have a cmd buf: */ @@ -162,41 +272,37 @@ if ((cmd->submit_offset == submit_offset) && (cmd->size == size) && (cmd->type == type) && - check_cmd_bo(ring, cmd, target_bo)) - break; - cmd = NULL; + check_cmd_bo(ring, cmd, target_cmd->ring_bo)) + return; } /* create cmd buf if not: */ - if (!cmd) { - uint32_t idx = APPEND(&msm_ring->submit, cmds); - APPEND(msm_ring, rings); - msm_ring->rings[idx] = target_ring; - cmd = &msm_ring->submit.cmds[idx]; - cmd->type = type; - cmd->submit_idx = bo2idx(ring, target_bo, FD_RELOC_READ); - cmd->submit_offset = submit_offset; - cmd->size = size; - cmd->pad = 0; - } + i = APPEND(&msm_ring->submit, cmds); + APPEND(msm_ring, cmds); + msm_ring->cmds[i] = target_cmd; + cmd = &msm_ring->submit.cmds[i]; + cmd->type = type; + cmd->submit_idx = bo2idx(ring, target_cmd->ring_bo, FD_RELOC_READ); + cmd->submit_offset = submit_offset; + cmd->size = size; + cmd->pad = 0; - return cmd; + target_cmd->size = size; } static void * msm_ringbuffer_hostptr(struct fd_ringbuffer *ring) { - struct msm_ringbuffer *msm_ring = to_msm_ringbuffer(ring); - return fd_bo_map(msm_ring->ring_bo); + return fd_bo_map(current_cmd(ring)->ring_bo); } -static uint32_t find_next_reloc_idx(struct msm_ringbuffer *msm_ring, +static uint32_t find_next_reloc_idx(struct msm_cmd *msm_cmd, uint32_t start, uint32_t offset) { uint32_t i; /* a binary search would be more clever.. */ - for (i = start; i < msm_ring->submit.nr_relocs; i++) { - struct drm_msm_gem_submit_reloc *reloc = &msm_ring->submit.relocs[i]; + for (i = start; i < msm_cmd->nr_relocs; i++) { + struct drm_msm_gem_submit_reloc *reloc = &msm_cmd->relocs[i]; if (reloc->submit_offset >= offset) return i; } @@ -204,38 +310,101 @@ return i; } +static void delete_cmds(struct msm_ringbuffer *msm_ring) +{ + struct msm_cmd *cmd, *tmp; + + LIST_FOR_EACH_ENTRY_SAFE(cmd, tmp, &msm_ring->cmd_list, list) { + ring_cmd_del(cmd); + } +} + static void flush_reset(struct fd_ringbuffer *ring) { struct msm_ringbuffer *msm_ring = to_msm_ringbuffer(ring); unsigned i; + for (i = 0; i < msm_ring->nr_bos; i++) { + struct msm_bo *msm_bo = to_msm_bo(msm_ring->bos[i]); + msm_bo->current_ring_seqno = 0; + fd_bo_del(&msm_bo->base); + } + /* for each of the cmd buffers, clear their reloc's: */ for (i = 0; i < msm_ring->submit.nr_cmds; i++) { - struct msm_ringbuffer *target_ring = to_msm_ringbuffer(msm_ring->rings[i]); - target_ring->submit.nr_relocs = 0; + struct msm_cmd *target_cmd = msm_ring->cmds[i]; + target_cmd->nr_relocs = 0; } - msm_ring->submit.nr_relocs = 0; msm_ring->submit.nr_cmds = 0; msm_ring->submit.nr_bos = 0; - msm_ring->nr_rings = 0; + msm_ring->nr_cmds = 0; msm_ring->nr_bos = 0; + + if (msm_ring->bo_table) { + drmHashDestroy(msm_ring->bo_table); + msm_ring->bo_table = NULL; + } + + if (msm_ring->is_growable) { + delete_cmds(msm_ring); + } else { + /* in old mode, just reset the # of relocs: */ + current_cmd(ring)->nr_relocs = 0; + } +} + +static void finalize_current_cmd(struct fd_ringbuffer *ring, uint32_t *last_start) +{ + uint32_t submit_offset, size, type; + struct fd_ringbuffer *parent; + + if (ring->parent) { + parent = ring->parent; + type = MSM_SUBMIT_CMD_IB_TARGET_BUF; + } else { + parent = ring; + type = MSM_SUBMIT_CMD_BUF; + } + + submit_offset = offset_bytes(last_start, ring->start); + size = offset_bytes(ring->cur, last_start); + + get_cmd(parent, current_cmd(ring), submit_offset, size, type); +} + +static void dump_submit(struct msm_ringbuffer *msm_ring) +{ + uint32_t i, j; + + for (i = 0; i < msm_ring->submit.nr_bos; i++) { + struct drm_msm_gem_submit_bo *bo = &msm_ring->submit.bos[i]; + ERROR_MSG(" bos[%d]: handle=%u, flags=%x", i, bo->handle, bo->flags); + } + for (i = 0; i < msm_ring->submit.nr_cmds; i++) { + struct drm_msm_gem_submit_cmd *cmd = &msm_ring->submit.cmds[i]; + struct drm_msm_gem_submit_reloc *relocs = U642VOID(cmd->relocs); + ERROR_MSG(" cmd[%d]: type=%u, submit_idx=%u, submit_offset=%u, size=%u", + i, cmd->type, cmd->submit_idx, cmd->submit_offset, cmd->size); + for (j = 0; j < cmd->nr_relocs; j++) { + struct drm_msm_gem_submit_reloc *r = &relocs[j]; + ERROR_MSG(" reloc[%d]: submit_offset=%u, or=%08x, shift=%d, reloc_idx=%u" + ", reloc_offset=%"PRIu64, j, r->submit_offset, r->or, r->shift, + r->reloc_idx, r->reloc_offset); + } + } } static int msm_ringbuffer_flush(struct fd_ringbuffer *ring, uint32_t *last_start) { struct msm_ringbuffer *msm_ring = to_msm_ringbuffer(ring); - struct fd_bo *ring_bo = msm_ring->ring_bo; struct drm_msm_gem_submit req = { .pipe = to_msm_pipe(ring->pipe)->pipe, }; - uint32_t i, j, submit_offset, size; + uint32_t i; int ret; - submit_offset = offset_bytes(last_start, ring->start); - size = offset_bytes(ring->cur, last_start); - - get_cmd(ring, ring, ring_bo, submit_offset, size, MSM_SUBMIT_CMD_BUF); + finalize_current_cmd(ring, last_start); /* needs to be after get_cmd() as that could create bos/cmds table: */ req.bos = VOID2U64(msm_ring->submit.bos), @@ -246,10 +415,10 @@ /* for each of the cmd's fix up their reloc's: */ for (i = 0; i < msm_ring->submit.nr_cmds; i++) { struct drm_msm_gem_submit_cmd *cmd = &msm_ring->submit.cmds[i]; - struct msm_ringbuffer *target_ring = to_msm_ringbuffer(msm_ring->rings[i]); - uint32_t a = find_next_reloc_idx(target_ring, 0, cmd->submit_offset); - uint32_t b = find_next_reloc_idx(target_ring, a, cmd->submit_offset + cmd->size); - cmd->relocs = VOID2U64(&target_ring->submit.relocs[a]); + struct msm_cmd *msm_cmd = msm_ring->cmds[i]; + uint32_t a = find_next_reloc_idx(msm_cmd, 0, cmd->submit_offset); + uint32_t b = find_next_reloc_idx(msm_cmd, a, cmd->submit_offset + cmd->size); + cmd->relocs = VOID2U64(&msm_cmd->relocs[a]); cmd->nr_relocs = (b > a) ? b - a : 0; } @@ -259,43 +428,27 @@ &req, sizeof(req)); if (ret) { ERROR_MSG("submit failed: %d (%s)", ret, strerror(errno)); - ERROR_MSG(" pipe: %u", req.pipe); - for (i = 0; i < msm_ring->submit.nr_bos; i++) { - struct drm_msm_gem_submit_bo *bo = &msm_ring->submit.bos[i]; - ERROR_MSG(" bos[%d]: handle=%u, flags=%x", i, bo->handle, bo->flags); - } - for (i = 0; i < msm_ring->submit.nr_cmds; i++) { - struct drm_msm_gem_submit_cmd *cmd = &msm_ring->submit.cmds[i]; - struct drm_msm_gem_submit_reloc *relocs = U642VOID(cmd->relocs); - ERROR_MSG(" cmd[%d]: type=%u, submit_idx=%u, submit_offset=%u, size=%u", - i, cmd->type, cmd->submit_idx, cmd->submit_offset, cmd->size); - for (j = 0; j < cmd->nr_relocs; j++) { - struct drm_msm_gem_submit_reloc *r = &relocs[j]; - ERROR_MSG(" reloc[%d]: submit_offset=%u, or=%08x, shift=%d, reloc_idx=%u" - ", reloc_offset=%"PRIu64, j, r->submit_offset, r->or, r->shift, - r->reloc_idx, r->reloc_offset); - } - } - } else { + dump_submit(msm_ring); + } else if (!ret) { /* update timestamp on all rings associated with submit: */ for (i = 0; i < msm_ring->submit.nr_cmds; i++) { - struct fd_ringbuffer *target_ring = msm_ring->rings[i]; - if (!ret) - target_ring->last_timestamp = req.fence; + struct msm_cmd *msm_cmd = msm_ring->cmds[i]; + msm_cmd->ring->last_timestamp = req.fence; } } - for (i = 0; i < msm_ring->nr_bos; i++) { - struct msm_bo *msm_bo = to_msm_bo(msm_ring->bos[i]); - msm_bo->current_ring = NULL; - fd_bo_del(&msm_bo->base); - } - flush_reset(ring); return ret; } +static void msm_ringbuffer_grow(struct fd_ringbuffer *ring, uint32_t size) +{ + assert(to_msm_ringbuffer(ring)->is_growable); + finalize_current_cmd(ring, ring->last_start); + ring_cmd_new(ring, size); +} + static void msm_ringbuffer_reset(struct fd_ringbuffer *ring) { flush_reset(ring); @@ -304,14 +457,14 @@ static void msm_ringbuffer_emit_reloc(struct fd_ringbuffer *ring, const struct fd_reloc *r) { - struct msm_ringbuffer *msm_ring = to_msm_ringbuffer(ring); struct fd_ringbuffer *parent = ring->parent ? ring->parent : ring; struct msm_bo *msm_bo = to_msm_bo(r->bo); struct drm_msm_gem_submit_reloc *reloc; - uint32_t idx = APPEND(&msm_ring->submit, relocs); + struct msm_cmd *cmd = current_cmd(ring); + uint32_t idx = APPEND(cmd, relocs); uint32_t addr; - reloc = &msm_ring->submit.relocs[idx]; + reloc = &cmd->relocs[idx]; reloc->reloc_idx = bo2idx(parent, r->bo, r->flags); reloc->reloc_offset = r->offset; @@ -327,41 +480,68 @@ (*ring->cur++) = addr | r->or; } -static void msm_ringbuffer_emit_reloc_ring(struct fd_ringbuffer *ring, - struct fd_ringmarker *target, struct fd_ringmarker *end) +static uint32_t msm_ringbuffer_emit_reloc_ring(struct fd_ringbuffer *ring, + struct fd_ringbuffer *target, uint32_t cmd_idx, + uint32_t submit_offset, uint32_t size) { - struct fd_bo *target_bo = to_msm_ringbuffer(target->ring)->ring_bo; - struct drm_msm_gem_submit_cmd *cmd; - uint32_t submit_offset, size; + struct msm_cmd *cmd = NULL; + uint32_t idx = 0; + + LIST_FOR_EACH_ENTRY(cmd, &to_msm_ringbuffer(target)->cmd_list, list) { + if (idx == cmd_idx) + break; + idx++; + } - submit_offset = offset_bytes(target->cur, target->ring->start); - size = offset_bytes(end->cur, target->cur); + assert(cmd && (idx == cmd_idx)); - cmd = get_cmd(ring, target->ring, target_bo, submit_offset, size, - MSM_SUBMIT_CMD_IB_TARGET_BUF); - assert(cmd); + if (idx < (to_msm_ringbuffer(target)->cmd_count - 1)) { + /* All but the last cmd buffer is fully "baked" (ie. already has + * done get_cmd() to add it to the cmds table). But in this case, + * the size we get is invalid (since it is calculated from the + * last cmd buffer): + */ + size = cmd->size; + } else { + get_cmd(ring, cmd, submit_offset, size, MSM_SUBMIT_CMD_IB_TARGET_BUF); + } msm_ringbuffer_emit_reloc(ring, &(struct fd_reloc){ - .bo = target_bo, + .bo = cmd->ring_bo, .flags = FD_RELOC_READ, .offset = submit_offset, }); + + return size; +} + +static uint32_t msm_ringbuffer_cmd_count(struct fd_ringbuffer *ring) +{ + return to_msm_ringbuffer(ring)->cmd_count; } static void msm_ringbuffer_destroy(struct fd_ringbuffer *ring) { struct msm_ringbuffer *msm_ring = to_msm_ringbuffer(ring); - if (msm_ring->ring_bo) - fd_bo_del(msm_ring->ring_bo); + + flush_reset(ring); + delete_cmds(msm_ring); + + free(msm_ring->submit.cmds); + free(msm_ring->submit.bos); + free(msm_ring->bos); + free(msm_ring->cmds); free(msm_ring); } static const struct fd_ringbuffer_funcs funcs = { .hostptr = msm_ringbuffer_hostptr, .flush = msm_ringbuffer_flush, + .grow = msm_ringbuffer_grow, .reset = msm_ringbuffer_reset, .emit_reloc = msm_ringbuffer_emit_reloc, .emit_reloc_ring = msm_ringbuffer_emit_reloc_ring, + .cmd_count = msm_ringbuffer_cmd_count, .destroy = msm_ringbuffer_destroy, }; @@ -377,14 +557,21 @@ goto fail; } + if (size == 0) { + assert(pipe->dev->version >= FD_VERSION_UNLIMITED_CMDS); + size = INIT_SIZE; + msm_ring->is_growable = TRUE; + } + + list_inithead(&msm_ring->cmd_list); + msm_ring->seqno = ++to_msm_device(pipe->dev)->ring_cnt; + ring = &msm_ring->base; ring->funcs = &funcs; + ring->size = size; + ring->pipe = pipe; /* needed in ring_cmd_new() */ - msm_ring->ring_bo = fd_bo_new(pipe->dev, size, 0); - if (!msm_ring->ring_bo) { - ERROR_MSG("ringbuffer allocation failed"); - goto fail; - } + ring_cmd_new(ring, size); return ring; fail: diff -Nru libdrm-2.4.67/freedreno/README libdrm-2.4.70/freedreno/README --- libdrm-2.4.67/freedreno/README 2013-10-09 16:03:23.000000000 +0000 +++ libdrm-2.4.70/freedreno/README 1970-01-01 00:00:00.000000000 +0000 @@ -1,16 +0,0 @@ -Note that current msm kernel driver is a bit strange. It provides a -DRM interface for GEM, which is basically sufficient to have DRI2 -working. But it does not provide KMS. And interface to 2d and 3d -cores is via different other devices (/dev/kgsl-*). This is not -quite how I'd write a DRM driver, but at this stage it is useful for -xf86-video-freedreno and fdre (and eventual gallium driver) to be -able to work on existing kernel driver from QCOM, to allow to -capture cmdstream dumps from the binary blob drivers without having -to reboot. So libdrm_freedreno attempts to hide most of the crazy. -The intention is that when there is a proper kernel driver, it will -be mostly just changes in libdrm_freedreno to adapt the gallium -driver and xf86-video-freedreno (ignoring the fbdev->KMS changes). - -So don't look at freedreno as an example of how to write a libdrm -module or a DRM driver.. it is just an attempt to paper over a non- -standard kernel driver architecture. diff -Nru libdrm-2.4.67/include/drm/drm_fourcc.h libdrm-2.4.70/include/drm/drm_fourcc.h --- libdrm-2.4.67/include/drm/drm_fourcc.h 2015-11-05 21:10:59.000000000 +0000 +++ libdrm-2.4.70/include/drm/drm_fourcc.h 2016-04-21 13:40:06.000000000 +0000 @@ -24,16 +24,23 @@ #ifndef DRM_FOURCC_H #define DRM_FOURCC_H -#include +#include "drm.h" -#define fourcc_code(a,b,c,d) ((uint32_t)(a) | ((uint32_t)(b) << 8) | \ - ((uint32_t)(c) << 16) | ((uint32_t)(d) << 24)) +#define fourcc_code(a, b, c, d) ((__u32)(a) | ((__u32)(b) << 8) | \ + ((__u32)(c) << 16) | ((__u32)(d) << 24)) #define DRM_FORMAT_BIG_ENDIAN (1<<31) /* format is big endian instead of little endian */ /* color index */ #define DRM_FORMAT_C8 fourcc_code('C', '8', ' ', ' ') /* [7:0] C */ +/* 8 bpp Red */ +#define DRM_FORMAT_R8 fourcc_code('R', '8', ' ', ' ') /* [7:0] R */ + +/* 16 bpp RG */ +#define DRM_FORMAT_RG88 fourcc_code('R', 'G', '8', '8') /* [15:0] R:G 8:8 little endian */ +#define DRM_FORMAT_GR88 fourcc_code('G', 'R', '8', '8') /* [15:0] G:R 8:8 little endian */ + /* 8 bpp RGB */ #define DRM_FORMAT_RGB332 fourcc_code('R', 'G', 'B', '8') /* [7:0] R:G:B 3:3:2 */ #define DRM_FORMAT_BGR233 fourcc_code('B', 'G', 'R', '8') /* [7:0] B:G:R 2:3:3 */ @@ -106,6 +113,8 @@ #define DRM_FORMAT_NV21 fourcc_code('N', 'V', '2', '1') /* 2x2 subsampled Cb:Cr plane */ #define DRM_FORMAT_NV16 fourcc_code('N', 'V', '1', '6') /* 2x1 subsampled Cr:Cb plane */ #define DRM_FORMAT_NV61 fourcc_code('N', 'V', '6', '1') /* 2x1 subsampled Cb:Cr plane */ +#define DRM_FORMAT_NV24 fourcc_code('N', 'V', '2', '4') /* non-subsampled Cr:Cb plane */ +#define DRM_FORMAT_NV42 fourcc_code('N', 'V', '4', '2') /* non-subsampled Cb:Cr plane */ /* * 3 plane YCbCr @@ -216,7 +225,7 @@ * - multiple of 128 pixels for the width * - multiple of 32 pixels for the height * - * For more information: see http://linuxtv.org/downloads/v4l-dvb-apis/re32.html + * For more information: see https://linuxtv.org/downloads/v4l-dvb-apis/re32.html */ #define DRM_FORMAT_MOD_SAMSUNG_64_32_TILE fourcc_mod_code(SAMSUNG, 1) diff -Nru libdrm-2.4.67/include/drm/drm.h libdrm-2.4.70/include/drm/drm.h --- libdrm-2.4.67/include/drm/drm.h 2015-09-09 15:14:17.000000000 +0000 +++ libdrm-2.4.70/include/drm/drm.h 2016-04-21 13:40:06.000000000 +0000 @@ -36,7 +36,7 @@ #ifndef _DRM_H_ #define _DRM_H_ -#if defined(__linux__) +#if defined(__linux__) #include #include @@ -54,6 +54,7 @@ typedef uint32_t __u32; typedef int64_t __s64; typedef uint64_t __u64; +typedef size_t __kernel_size_t; typedef unsigned long drm_handle_t; #endif @@ -129,11 +130,11 @@ int version_major; /**< Major version */ int version_minor; /**< Minor version */ int version_patchlevel; /**< Patch level */ - size_t name_len; /**< Length of name buffer */ + __kernel_size_t name_len; /**< Length of name buffer */ char *name; /**< Name of driver */ - size_t date_len; /**< Length of date buffer */ + __kernel_size_t date_len; /**< Length of date buffer */ char *date; /**< User-space buffer to hold date */ - size_t desc_len; /**< Length of desc buffer */ + __kernel_size_t desc_len; /**< Length of desc buffer */ char *desc; /**< User-space buffer to hold desc */ }; @@ -143,7 +144,7 @@ * \sa drmGetBusid() and drmSetBusId(). */ struct drm_unique { - size_t unique_len; /**< Length of unique */ + __kernel_size_t unique_len; /**< Length of unique */ char *unique; /**< Unique name for driver instantiation */ }; @@ -180,8 +181,7 @@ _DRM_SHM = 2, /**< shared, cached */ _DRM_AGP = 3, /**< AGP/GART */ _DRM_SCATTER_GATHER = 4, /**< Scatter/gather memory for PCI DMA */ - _DRM_CONSISTENT = 5, /**< Consistent memory for PCI DMA */ - _DRM_GEM = 6 /**< GEM object */ + _DRM_CONSISTENT = 5 /**< Consistent memory for PCI DMA */ }; /** @@ -467,12 +467,15 @@ enum drm_vblank_seq_type { _DRM_VBLANK_ABSOLUTE = 0x0, /**< Wait for specific vblank sequence number */ _DRM_VBLANK_RELATIVE = 0x1, /**< Wait for given number of vblanks */ + /* bits 1-6 are reserved for high crtcs */ + _DRM_VBLANK_HIGH_CRTC_MASK = 0x0000003e, _DRM_VBLANK_EVENT = 0x4000000, /**< Send event instead of blocking */ _DRM_VBLANK_FLIP = 0x8000000, /**< Scheduled buffer swap should flip */ _DRM_VBLANK_NEXTONMISS = 0x10000000, /**< If missed, wait for next vblank */ _DRM_VBLANK_SECONDARY = 0x20000000, /**< Secondary display controller */ _DRM_VBLANK_SIGNAL = 0x40000000 /**< Send signal instead of blocking, unsupported */ }; +#define _DRM_VBLANK_HIGH_CRTC_SHIFT 1 #define _DRM_VBLANK_TYPES_MASK (_DRM_VBLANK_ABSOLUTE | _DRM_VBLANK_RELATIVE) #define _DRM_VBLANK_FLAGS_MASK (_DRM_VBLANK_EVENT | _DRM_VBLANK_SIGNAL | \ @@ -612,6 +615,28 @@ __u64 size; }; +#define DRM_CAP_DUMB_BUFFER 0x1 +#define DRM_CAP_VBLANK_HIGH_CRTC 0x2 +#define DRM_CAP_DUMB_PREFERRED_DEPTH 0x3 +#define DRM_CAP_DUMB_PREFER_SHADOW 0x4 +#define DRM_CAP_PRIME 0x5 +#define DRM_PRIME_CAP_IMPORT 0x1 +#define DRM_PRIME_CAP_EXPORT 0x2 +#define DRM_CAP_TIMESTAMP_MONOTONIC 0x6 +#define DRM_CAP_ASYNC_PAGE_FLIP 0x7 +/* + * The CURSOR_WIDTH and CURSOR_HEIGHT capabilities return a valid widthxheight + * combination for the hardware cursor. The intention is that a hardware + * agnostic userspace can query a cursor plane size to use. + * + * Note that the cross-driver contract is to merely return a valid size; + * drivers are free to attach another meaning on top, eg. i915 returns the + * maximum plane size. + */ +#define DRM_CAP_CURSOR_WIDTH 0x8 +#define DRM_CAP_CURSOR_HEIGHT 0x9 +#define DRM_CAP_ADDFB2_MODIFIERS 0x10 + /** DRM_IOCTL_GET_CAP ioctl argument type */ struct drm_get_cap { __u64 capability; @@ -630,17 +655,17 @@ /** * DRM_CLIENT_CAP_UNIVERSAL_PLANES * - * if set to 1, the DRM core will expose the full universal plane list - * (including primary and cursor planes). + * If set to 1, the DRM core will expose all planes (overlay, primary, and + * cursor) to userspace. */ -#define DRM_CLIENT_CAP_UNIVERSAL_PLANES 2 +#define DRM_CLIENT_CAP_UNIVERSAL_PLANES 2 /** * DRM_CLIENT_CAP_ATOMIC * - * If set to 1, the DRM core will allow atomic modesetting requests. + * If set to 1, the DRM core will expose atomic properties to userspace */ -#define DRM_CLIENT_CAP_ATOMIC 3 +#define DRM_CLIENT_CAP_ATOMIC 3 /** DRM_IOCTL_SET_CLIENT_CAP ioctl argument type */ struct drm_set_client_cap { @@ -648,6 +673,7 @@ __u64 value; }; +#define DRM_RDWR O_RDWR #define DRM_CLOEXEC O_CLOEXEC struct drm_prime_handle { __u32 handle; @@ -743,8 +769,8 @@ #define DRM_IOCTL_MODE_SETGAMMA DRM_IOWR(0xA5, struct drm_mode_crtc_lut) #define DRM_IOCTL_MODE_GETENCODER DRM_IOWR(0xA6, struct drm_mode_get_encoder) #define DRM_IOCTL_MODE_GETCONNECTOR DRM_IOWR(0xA7, struct drm_mode_get_connector) -#define DRM_IOCTL_MODE_ATTACHMODE DRM_IOWR(0xA8, struct drm_mode_mode_cmd) -#define DRM_IOCTL_MODE_DETACHMODE DRM_IOWR(0xA9, struct drm_mode_mode_cmd) +#define DRM_IOCTL_MODE_ATTACHMODE DRM_IOWR(0xA8, struct drm_mode_mode_cmd) /* deprecated (never worked) */ +#define DRM_IOCTL_MODE_DETACHMODE DRM_IOWR(0xA9, struct drm_mode_mode_cmd) /* deprecated (never worked) */ #define DRM_IOCTL_MODE_GETPROPERTY DRM_IOWR(0xAA, struct drm_mode_get_property) #define DRM_IOCTL_MODE_SETPROPERTY DRM_IOWR(0xAB, struct drm_mode_connector_set_property) @@ -771,7 +797,7 @@ /** * Device specific ioctls should only be in their respective headers - * The device specific ioctl range is from 0x40 to 0x99. + * The device specific ioctl range is from 0x40 to 0x9f. * Generic IOCTLS restart at 0xA0. * * \sa drmCommandNone(), drmCommandRead(), drmCommandWrite(), and @@ -809,18 +835,6 @@ __u32 reserved; }; -#define DRM_CAP_DUMB_BUFFER 0x1 -#define DRM_CAP_VBLANK_HIGH_CRTC 0x2 -#define DRM_CAP_DUMB_PREFERRED_DEPTH 0x3 -#define DRM_CAP_DUMB_PREFER_SHADOW 0x4 -#define DRM_CAP_PRIME 0x5 -#define DRM_CAP_TIMESTAMP_MONOTONIC 0x6 -#define DRM_CAP_ASYNC_PAGE_FLIP 0x7 -#define DRM_CAP_ADDFB2_MODIFIERS 0x10 - -#define DRM_PRIME_CAP_IMPORT 0x1 -#define DRM_PRIME_CAP_EXPORT 0x2 - /* typedef area */ typedef struct drm_clip_rect drm_clip_rect_t; typedef struct drm_drawable_info drm_drawable_info_t; diff -Nru libdrm-2.4.67/include/drm/drm_mode.h libdrm-2.4.70/include/drm/drm_mode.h --- libdrm-2.4.67/include/drm/drm_mode.h 2015-09-09 15:14:17.000000000 +0000 +++ libdrm-2.4.70/include/drm/drm_mode.h 2016-04-21 13:40:06.000000000 +0000 @@ -27,6 +27,8 @@ #ifndef _DRM_MODE_H #define _DRM_MODE_H +#include "drm.h" + #define DRM_DISPLAY_INFO_LEN 32 #define DRM_CONNECTOR_NAME_LEN 32 #define DRM_DISPLAY_MODE_LEN 32 @@ -56,6 +58,10 @@ #define DRM_MODE_FLAG_PIXMUX (1<<11) #define DRM_MODE_FLAG_DBLCLK (1<<12) #define DRM_MODE_FLAG_CLKDIV2 (1<<13) + /* + * When adding a new stereo mode don't forget to adjust DRM_MODE_FLAGS_3D_MAX + * (define not exposed to user space). + */ #define DRM_MODE_FLAG_3D_MASK (0x1f<<14) #define DRM_MODE_FLAG_3D_NONE (0<<14) #define DRM_MODE_FLAG_3D_FRAME_PACKING (1<<14) @@ -82,6 +88,11 @@ #define DRM_MODE_SCALE_CENTER 2 /* Centered, no scaling */ #define DRM_MODE_SCALE_ASPECT 3 /* Full screen, preserve aspect */ +/* Picture aspect ratio options */ +#define DRM_MODE_PICTURE_ASPECT_NONE 0 +#define DRM_MODE_PICTURE_ASPECT_4_3 1 +#define DRM_MODE_PICTURE_ASPECT_16_9 2 + /* Dithering mode options */ #define DRM_MODE_DITHERING_OFF 0 #define DRM_MODE_DITHERING_ON 1 @@ -94,8 +105,16 @@ struct drm_mode_modeinfo { __u32 clock; - __u16 hdisplay, hsync_start, hsync_end, htotal, hskew; - __u16 vdisplay, vsync_start, vsync_end, vtotal, vscan; + __u16 hdisplay; + __u16 hsync_start; + __u16 hsync_end; + __u16 htotal; + __u16 hskew; + __u16 vdisplay; + __u16 vsync_start; + __u16 vsync_end; + __u16 vtotal; + __u16 vscan; __u32 vrefresh; @@ -113,8 +132,10 @@ __u32 count_crtcs; __u32 count_connectors; __u32 count_encoders; - __u32 min_width, max_width; - __u32 min_height, max_height; + __u32 min_width; + __u32 max_width; + __u32 min_height; + __u32 max_height; }; struct drm_mode_crtc { @@ -124,30 +145,35 @@ __u32 crtc_id; /**< Id */ __u32 fb_id; /**< Id of framebuffer */ - __u32 x, y; /**< Position on the frameuffer */ + __u32 x; /**< x Position on the framebuffer */ + __u32 y; /**< y Position on the framebuffer */ __u32 gamma_size; __u32 mode_valid; struct drm_mode_modeinfo mode; }; -#define DRM_MODE_PRESENT_TOP_FIELD (1<<0) -#define DRM_MODE_PRESENT_BOTTOM_FIELD (1<<1) +#define DRM_MODE_PRESENT_TOP_FIELD (1<<0) +#define DRM_MODE_PRESENT_BOTTOM_FIELD (1<<1) /* Planes blend with or override other bits on the CRTC */ struct drm_mode_set_plane { __u32 plane_id; __u32 crtc_id; __u32 fb_id; /* fb object contains surface format type */ - __u32 flags; + __u32 flags; /* see above flags */ /* Signed dest location allows it to be partially off screen */ - __s32 crtc_x, crtc_y; - __u32 crtc_w, crtc_h; + __s32 crtc_x; + __s32 crtc_y; + __u32 crtc_w; + __u32 crtc_h; /* Source values are 16.16 fixed point */ - __u32 src_x, src_y; - __u32 src_h, src_w; + __u32 src_x; + __u32 src_y; + __u32 src_h; + __u32 src_w; }; struct drm_mode_get_plane { @@ -233,8 +259,11 @@ __u32 connector_type_id; __u32 connection; - __u32 mm_width, mm_height; /**< HxW in millimeters */ + __u32 mm_width; /**< width in millimeters */ + __u32 mm_height; /**< height in millimeters */ __u32 subpixel; + + __u32 pad; }; #define DRM_MODE_PROP_PENDING (1<<0) @@ -259,6 +288,13 @@ #define DRM_MODE_PROP_OBJECT DRM_MODE_PROP_TYPE(1) #define DRM_MODE_PROP_SIGNED_RANGE DRM_MODE_PROP_TYPE(2) +/* the PROP_ATOMIC flag is used to hide properties from userspace that + * is not aware of atomic properties. This is mostly to work around + * older userspace (DDX drivers) that read/write each prop they find, + * witout being aware that this could be triggering a lengthy modeset. + */ +#define DRM_MODE_PROP_ATOMIC 0x80000000 + struct drm_mode_property_enum { __u64 value; char name[DRM_PROP_NAME_LEN]; @@ -273,6 +309,8 @@ char name[DRM_PROP_NAME_LEN]; __u32 count_values; + /* This is only used to count enum values, not blobs. The _blobs is + * simply because of a historical reason, i.e. backwards compat. */ __u32 count_enum_blobs; }; @@ -290,6 +328,7 @@ #define DRM_MODE_OBJECT_FB 0xfbfbfbfb #define DRM_MODE_OBJECT_BLOB 0xbbbbbbbb #define DRM_MODE_OBJECT_PLANE 0xeeeeeeee +#define DRM_MODE_OBJECT_ANY 0 struct drm_mode_obj_get_properties { __u64 props_ptr; @@ -314,7 +353,8 @@ struct drm_mode_fb_cmd { __u32 fb_id; - __u32 width, height; + __u32 width; + __u32 height; __u32 pitch; __u32 bpp; __u32 depth; @@ -327,9 +367,10 @@ struct drm_mode_fb_cmd2 { __u32 fb_id; - __u32 width, height; + __u32 width; + __u32 height; __u32 pixel_format; /* fourcc code from drm_fourcc.h */ - __u32 flags; + __u32 flags; /* see above flags */ /* * In case of planar formats, this ioctl allows up to 4 @@ -341,9 +382,9 @@ * followed by an interleaved U/V plane containing * 8 bit 2x2 subsampled colour difference samples. * - * So it would consist of Y as offset[0] and UV as - * offset[1]. Note that offset[0] will generally - * be 0. + * So it would consist of Y as offsets[0] and UV as + * offsets[1]. Note that offsets[0] will generally + * be 0 (but this is not required). * * To accommodate tiled, compressed, etc formats, a per-plane * modifier can be specified. The default value of zero @@ -362,6 +403,8 @@ #define DRM_MODE_FB_DIRTY_ANNOTATE_FILL 0x02 #define DRM_MODE_FB_DIRTY_FLAGS 0x03 +#define DRM_MODE_FB_DIRTY_MAX_CLIPS 256 + /* * Mark a region of a framebuffer as dirty. * @@ -402,20 +445,21 @@ struct drm_mode_modeinfo mode; }; -#define DRM_MODE_CURSOR_BO (1<<0) -#define DRM_MODE_CURSOR_MOVE (1<<1) +#define DRM_MODE_CURSOR_BO 0x01 +#define DRM_MODE_CURSOR_MOVE 0x02 +#define DRM_MODE_CURSOR_FLAGS 0x03 /* - * depending on the value in flags diffrent members are used. + * depending on the value in flags different members are used. * * CURSOR_BO uses - * crtc + * crtc_id * width * height - * handle - if 0 turns the cursor of + * handle - if 0 turns the cursor off * * CURSOR_MOVE uses - * crtc + * crtc_id * x * y */ @@ -453,6 +497,21 @@ __u64 blue; }; +struct drm_color_ctm { + /* Conversion matrix in S31.32 format. */ + __s64 matrix[9]; +}; + +struct drm_color_lut { + /* + * Data is U0.16 fixed point format. + */ + __u16 red; + __u16 green; + __u16 blue; + __u16 reserved; +}; + #define DRM_MODE_PAGE_FLIP_EVENT 0x01 #define DRM_MODE_PAGE_FLIP_ASYNC 0x02 #define DRM_MODE_PAGE_FLIP_FLAGS (DRM_MODE_PAGE_FLIP_EVENT|DRM_MODE_PAGE_FLIP_ASYNC) @@ -469,11 +528,14 @@ * flip is already pending as the ioctl is called, EBUSY will be * returned. * - * The ioctl supports one flag, DRM_MODE_PAGE_FLIP_EVENT, which will - * request that drm sends back a vblank event (see drm.h: struct - * drm_event_vblank) when the page flip is done. The user_data field - * passed in with this ioctl will be returned as the user_data field - * in the vblank event struct. + * Flag DRM_MODE_PAGE_FLIP_EVENT requests that drm sends back a vblank + * event (see drm.h: struct drm_event_vblank) when the page flip is + * done. The user_data field passed in with this ioctl will be + * returned as the user_data field in the vblank event struct. + * + * Flag DRM_MODE_PAGE_FLIP_ASYNC requests that the flip happen + * 'as soon as possible', meaning that it not delay waiting for vblank. + * This may cause tearing on the screen. * * The reserved field must be zero until we figure out something * clever to use it for. @@ -489,27 +551,27 @@ /* create a dumb scanout buffer */ struct drm_mode_create_dumb { - __u32 height; - __u32 width; - __u32 bpp; - __u32 flags; - /* handle, pitch, size will be returned */ - __u32 handle; - __u32 pitch; - __u64 size; + __u32 height; + __u32 width; + __u32 bpp; + __u32 flags; + /* handle, pitch, size will be returned */ + __u32 handle; + __u32 pitch; + __u64 size; }; /* set up for mmap of a dumb scanout buffer */ struct drm_mode_map_dumb { - /** Handle for the object being mapped. */ - __u32 handle; - __u32 pad; - /** - * Fake offset to use for subsequent mmap call - * - * This is a fixed-size type for 32/64 compatibility. - */ - __u64 offset; + /** Handle for the object being mapped. */ + __u32 handle; + __u32 pad; + /** + * Fake offset to use for subsequent mmap call + * + * This is a fixed-size type for 32/64 compatibility. + */ + __u64 offset; }; struct drm_mode_destroy_dumb { @@ -517,9 +579,16 @@ }; /* page-flip flags are valid, plus: */ -#define DRM_MODE_ATOMIC_TEST_ONLY 0x0100 -#define DRM_MODE_ATOMIC_NONBLOCK 0x0200 -#define DRM_MODE_ATOMIC_ALLOW_MODESET 0x0400 +#define DRM_MODE_ATOMIC_TEST_ONLY 0x0100 +#define DRM_MODE_ATOMIC_NONBLOCK 0x0200 +#define DRM_MODE_ATOMIC_ALLOW_MODESET 0x0400 + +#define DRM_MODE_ATOMIC_FLAGS (\ + DRM_MODE_PAGE_FLIP_EVENT |\ + DRM_MODE_PAGE_FLIP_ASYNC |\ + DRM_MODE_ATOMIC_TEST_ONLY |\ + DRM_MODE_ATOMIC_NONBLOCK |\ + DRM_MODE_ATOMIC_ALLOW_MODESET) struct drm_mode_atomic { __u32 flags; @@ -552,5 +621,4 @@ __u32 blob_id; }; - #endif diff -Nru libdrm-2.4.67/include/drm/drm_sarea.h libdrm-2.4.70/include/drm/drm_sarea.h --- libdrm-2.4.67/include/drm/drm_sarea.h 2013-02-14 15:14:08.000000000 +0000 +++ libdrm-2.4.70/include/drm/drm_sarea.h 2016-04-21 13:40:06.000000000 +0000 @@ -37,6 +37,8 @@ /* SAREA area needs to be at least a page */ #if defined(__alpha__) #define SAREA_MAX 0x2000U +#elif defined(__mips__) +#define SAREA_MAX 0x4000U #elif defined(__ia64__) #define SAREA_MAX 0x10000U /* 64kB */ #else diff -Nru libdrm-2.4.67/include/drm/i915_drm.h libdrm-2.4.70/include/drm/i915_drm.h --- libdrm-2.4.67/include/drm/i915_drm.h 2016-01-17 21:22:14.000000000 +0000 +++ libdrm-2.4.70/include/drm/i915_drm.h 2016-04-21 13:40:06.000000000 +0000 @@ -772,10 +772,12 @@ #define I915_EXEC_HANDLE_LUT (1<<12) /** Used for switching BSD rings on the platforms with two BSD rings */ -#define I915_EXEC_BSD_MASK (3<<13) -#define I915_EXEC_BSD_DEFAULT (0<<13) /* default ping-pong mode */ -#define I915_EXEC_BSD_RING1 (1<<13) -#define I915_EXEC_BSD_RING2 (2<<13) +#define I915_EXEC_BSD_SHIFT (13) +#define I915_EXEC_BSD_MASK (3 << I915_EXEC_BSD_SHIFT) +/* default ping-pong mode */ +#define I915_EXEC_BSD_DEFAULT (0 << I915_EXEC_BSD_SHIFT) +#define I915_EXEC_BSD_RING1 (1 << I915_EXEC_BSD_SHIFT) +#define I915_EXEC_BSD_RING2 (2 << I915_EXEC_BSD_SHIFT) /** Tell the kernel that the batchbuffer is processed by * the resource streamer. @@ -812,10 +814,35 @@ /** Handle of the buffer to check for busy */ __u32 handle; - /** Return busy status (1 if busy, 0 if idle). - * The high word is used to indicate on which rings the object - * currently resides: - * 16:31 - busy (r or r/w) rings (16 render, 17 bsd, 18 blt, etc) + /** Return busy status + * + * A return of 0 implies that the object is idle (after + * having flushed any pending activity), and a non-zero return that + * the object is still in-flight on the GPU. (The GPU has not yet + * signaled completion for all pending requests that reference the + * object.) + * + * The returned dword is split into two fields to indicate both + * the engines on which the object is being read, and the + * engine on which it is currently being written (if any). + * + * The low word (bits 0:15) indicate if the object is being written + * to by any engine (there can only be one, as the GEM implicit + * synchronisation rules force writes to be serialised). Only the + * engine for the last write is reported. + * + * The high word (bits 16:31) are a bitmask of which engines are + * currently reading from the object. Multiple engines may be + * reading from the object simultaneously. + * + * The value of each engine is the same as specified in the + * EXECBUFFER2 ioctl, i.e. I915_EXEC_RENDER, I915_EXEC_BSD etc. + * Note I915_EXEC_DEFAULT is a symbolic value and is mapped to + * the I915_EXEC_RENDER engine for execution, and so it is never + * reported as active itself. Some hardware may have parallel + * execution engines, e.g. multiple media engines, which are + * mapped to the same identifier in the EXECBUFFER2 ioctl and + * so are not separately reported for busyness. */ __u32 busy; }; diff -Nru libdrm-2.4.67/include/drm/tegra_drm.h libdrm-2.4.70/include/drm/tegra_drm.h --- libdrm-2.4.67/include/drm/tegra_drm.h 2015-01-05 19:31:24.000000000 +0000 +++ libdrm-2.4.70/include/drm/tegra_drm.h 2016-04-21 13:40:06.000000000 +0000 @@ -36,7 +36,8 @@ struct drm_tegra_gem_mmap { __u32 handle; - __u32 offset; + __u32 pad; + __u64 offset; }; struct drm_tegra_syncpt_read { diff -Nru libdrm-2.4.67/include/drm/vc4_drm.h libdrm-2.4.70/include/drm/vc4_drm.h --- libdrm-2.4.67/include/drm/vc4_drm.h 2016-02-10 16:49:00.000000000 +0000 +++ libdrm-2.4.70/include/drm/vc4_drm.h 2016-07-20 23:42:21.000000000 +0000 @@ -26,6 +26,10 @@ #include "drm.h" +#if defined(__cplusplus) +extern "C" { +#endif + #define DRM_VC4_SUBMIT_CL 0x00 #define DRM_VC4_WAIT_SEQNO 0x01 #define DRM_VC4_WAIT_BO 0x02 @@ -33,6 +37,7 @@ #define DRM_VC4_MMAP_BO 0x04 #define DRM_VC4_CREATE_SHADER_BO 0x05 #define DRM_VC4_GET_HANG_STATE 0x06 +#define DRM_VC4_GET_PARAM 0x07 #define DRM_IOCTL_VC4_SUBMIT_CL DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_SUBMIT_CL, struct drm_vc4_submit_cl) #define DRM_IOCTL_VC4_WAIT_SEQNO DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_WAIT_SEQNO, struct drm_vc4_wait_seqno) @@ -41,6 +46,7 @@ #define DRM_IOCTL_VC4_MMAP_BO DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_MMAP_BO, struct drm_vc4_mmap_bo) #define DRM_IOCTL_VC4_CREATE_SHADER_BO DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_CREATE_SHADER_BO, struct drm_vc4_create_shader_bo) #define DRM_IOCTL_VC4_GET_HANG_STATE DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_GET_HANG_STATE, struct drm_vc4_get_hang_state) +#define DRM_IOCTL_VC4_GET_PARAM DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_GET_PARAM, struct drm_vc4_get_param) struct drm_vc4_submit_rcl_surface { __u32 hindex; /* Handle index, or ~0 if not present. */ @@ -276,4 +282,19 @@ __u32 pad[16]; }; +#define DRM_VC4_PARAM_V3D_IDENT0 0 +#define DRM_VC4_PARAM_V3D_IDENT1 1 +#define DRM_VC4_PARAM_V3D_IDENT2 2 +#define DRM_VC4_PARAM_SUPPORTS_BRANCHES 3 + +struct drm_vc4_get_param { + __u32 param; + __u32 pad; + __u64 value; +}; + +#if defined(__cplusplus) +} +#endif + #endif /* _VC4_DRM_H_ */ diff -Nru libdrm-2.4.67/include/drm/virtgpu_drm.h libdrm-2.4.70/include/drm/virtgpu_drm.h --- libdrm-2.4.67/include/drm/virtgpu_drm.h 2016-08-31 20:20:36.000000000 +0000 +++ libdrm-2.4.70/include/drm/virtgpu_drm.h 2016-07-23 12:53:10.000000000 +0000 @@ -24,13 +24,16 @@ #ifndef VIRTGPU_DRM_H #define VIRTGPU_DRM_H -#include -#include "drm/drm.h" +#include "drm.h" + +#if defined(__cplusplus) +extern "C" { +#endif /* Please note that modifications to all structs defined here are * subject to backwards-compatibility constraints. * - * Do not use pointers, use uint64_t instead for 32 bit / 64 bit user/kernel + * Do not use pointers, use __u64 instead for 32 bit / 64 bit user/kernel * compatibility Keep fields aligned to their size */ @@ -45,88 +48,88 @@ #define DRM_VIRTGPU_GET_CAPS 0x09 struct drm_virtgpu_map { - uint64_t offset; /* use for mmap system call */ - uint32_t handle; - uint32_t pad; + __u64 offset; /* use for mmap system call */ + __u32 handle; + __u32 pad; }; struct drm_virtgpu_execbuffer { - uint32_t flags; /* for future use */ - uint32_t size; - uint64_t command; /* void* */ - uint64_t bo_handles; - uint32_t num_bo_handles; - uint32_t pad; + __u32 flags; /* for future use */ + __u32 size; + __u64 command; /* void* */ + __u64 bo_handles; + __u32 num_bo_handles; + __u32 pad; }; #define VIRTGPU_PARAM_3D_FEATURES 1 /* do we have 3D features in the hw */ struct drm_virtgpu_getparam { - uint64_t param; - uint64_t value; + __u64 param; + __u64 value; }; /* NO_BO flags? NO resource flag? */ /* resource flag for y_0_top */ struct drm_virtgpu_resource_create { - uint32_t target; - uint32_t format; - uint32_t bind; - uint32_t width; - uint32_t height; - uint32_t depth; - uint32_t array_size; - uint32_t last_level; - uint32_t nr_samples; - uint32_t flags; - uint32_t bo_handle; /* if this is set - recreate a new resource attached to this bo ? */ - uint32_t res_handle; /* returned by kernel */ - uint32_t size; /* validate transfer in the host */ - uint32_t stride; /* validate transfer in the host */ + __u32 target; + __u32 format; + __u32 bind; + __u32 width; + __u32 height; + __u32 depth; + __u32 array_size; + __u32 last_level; + __u32 nr_samples; + __u32 flags; + __u32 bo_handle; /* if this is set - recreate a new resource attached to this bo ? */ + __u32 res_handle; /* returned by kernel */ + __u32 size; /* validate transfer in the host */ + __u32 stride; /* validate transfer in the host */ }; struct drm_virtgpu_resource_info { - uint32_t bo_handle; - uint32_t res_handle; - uint32_t size; - uint32_t stride; + __u32 bo_handle; + __u32 res_handle; + __u32 size; + __u32 stride; }; struct drm_virtgpu_3d_box { - uint32_t x; - uint32_t y; - uint32_t z; - uint32_t w; - uint32_t h; - uint32_t d; + __u32 x; + __u32 y; + __u32 z; + __u32 w; + __u32 h; + __u32 d; }; struct drm_virtgpu_3d_transfer_to_host { - uint32_t bo_handle; + __u32 bo_handle; struct drm_virtgpu_3d_box box; - uint32_t level; - uint32_t offset; + __u32 level; + __u32 offset; }; struct drm_virtgpu_3d_transfer_from_host { - uint32_t bo_handle; + __u32 bo_handle; struct drm_virtgpu_3d_box box; - uint32_t level; - uint32_t offset; + __u32 level; + __u32 offset; }; #define VIRTGPU_WAIT_NOWAIT 1 /* like it */ struct drm_virtgpu_3d_wait { - uint32_t handle; /* 0 is an invalid handle */ - uint32_t flags; + __u32 handle; /* 0 is an invalid handle */ + __u32 flags; }; struct drm_virtgpu_get_caps { - uint32_t cap_set_id; - uint32_t cap_set_ver; - uint64_t addr; - uint32_t size; - uint32_t pad; + __u32 cap_set_id; + __u32 cap_set_ver; + __u64 addr; + __u32 size; + __u32 pad; }; #define DRM_IOCTL_VIRTGPU_MAP \ @@ -164,4 +167,8 @@ DRM_IOWR(DRM_COMMAND_BASE + DRM_VIRTGPU_GET_CAPS, \ struct drm_virtgpu_get_caps) +#if defined(__cplusplus) +} +#endif + #endif diff -Nru libdrm-2.4.67/include/drm/vmwgfx_drm.h libdrm-2.4.70/include/drm/vmwgfx_drm.h --- libdrm-2.4.67/include/drm/vmwgfx_drm.h 2013-02-14 15:14:08.000000000 +0000 +++ libdrm-2.4.70/include/drm/vmwgfx_drm.h 2016-03-13 16:26:22.000000000 +0000 @@ -1,6 +1,6 @@ /************************************************************************** * - * Copyright © 2009 VMware, Inc., Palo Alto, CA., USA + * Copyright © 2009-2015 VMware, Inc., Palo Alto, CA., USA * All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a @@ -28,10 +28,11 @@ #ifndef __VMWGFX_DRM_H__ #define __VMWGFX_DRM_H__ +#include "drm.h" + #define DRM_VMW_MAX_SURFACE_FACES 6 #define DRM_VMW_MAX_MIP_LEVELS 24 -#define DRM_VMW_EXT_NAME_LEN 128 #define DRM_VMW_GET_PARAM 0 #define DRM_VMW_ALLOC_DMABUF 1 @@ -48,11 +49,20 @@ #define DRM_VMW_UNREF_SURFACE 10 #define DRM_VMW_REF_SURFACE 11 #define DRM_VMW_EXECBUF 12 -#define DRM_VMW_FIFO_DEBUG 13 +#define DRM_VMW_GET_3D_CAP 13 #define DRM_VMW_FENCE_WAIT 14 -/* guarded by minor version >= 2 */ -#define DRM_VMW_UPDATE_LAYOUT 15 - +#define DRM_VMW_FENCE_SIGNALED 15 +#define DRM_VMW_FENCE_UNREF 16 +#define DRM_VMW_FENCE_EVENT 17 +#define DRM_VMW_PRESENT 18 +#define DRM_VMW_PRESENT_READBACK 19 +#define DRM_VMW_UPDATE_LAYOUT 20 +#define DRM_VMW_CREATE_SHADER 21 +#define DRM_VMW_UNREF_SHADER 22 +#define DRM_VMW_GB_SURFACE_CREATE 23 +#define DRM_VMW_GB_SURFACE_REF 24 +#define DRM_VMW_SYNCCPU 25 +#define DRM_VMW_CREATE_EXTENDED_CONTEXT 26 /*************************************************************************/ /** @@ -69,9 +79,25 @@ #define DRM_VMW_PARAM_NUM_STREAMS 0 #define DRM_VMW_PARAM_NUM_FREE_STREAMS 1 #define DRM_VMW_PARAM_3D 2 -#define DRM_VMW_PARAM_FIFO_OFFSET 3 -#define DRM_VMW_PARAM_HW_CAPS 4 -#define DRM_VMW_PARAM_FIFO_CAPS 5 +#define DRM_VMW_PARAM_HW_CAPS 3 +#define DRM_VMW_PARAM_FIFO_CAPS 4 +#define DRM_VMW_PARAM_MAX_FB_SIZE 5 +#define DRM_VMW_PARAM_FIFO_HW_VERSION 6 +#define DRM_VMW_PARAM_MAX_SURF_MEMORY 7 +#define DRM_VMW_PARAM_3D_CAPS_SIZE 8 +#define DRM_VMW_PARAM_MAX_MOB_MEMORY 9 +#define DRM_VMW_PARAM_MAX_MOB_SIZE 10 +#define DRM_VMW_PARAM_SCREEN_TARGET 11 +#define DRM_VMW_PARAM_DX 12 + +/** + * enum drm_vmw_handle_type - handle type for ref ioctls + * + */ +enum drm_vmw_handle_type { + DRM_VMW_HANDLE_LEGACY = 0, + DRM_VMW_HANDLE_PRIME = 1 +}; /** * struct drm_vmw_getparam_arg @@ -83,52 +109,9 @@ */ struct drm_vmw_getparam_arg { - uint64_t value; - uint32_t param; - uint32_t pad64; -}; - -/*************************************************************************/ -/** - * DRM_VMW_EXTENSION - Query device extensions. - */ - -/** - * struct drm_vmw_extension_rep - * - * @exists: The queried extension exists. - * @driver_ioctl_offset: Ioctl number of the first ioctl in the extension. - * @driver_sarea_offset: Offset to any space in the DRI SAREA - * used by the extension. - * @major: Major version number of the extension. - * @minor: Minor version number of the extension. - * @pl: Patch level version number of the extension. - * - * Output argument to the DRM_VMW_EXTENSION Ioctl. - */ - -struct drm_vmw_extension_rep { - int32_t exists; - uint32_t driver_ioctl_offset; - uint32_t driver_sarea_offset; - uint32_t major; - uint32_t minor; - uint32_t pl; - uint32_t pad64; -}; - -/** - * union drm_vmw_extension_arg - * - * @extension - Ascii name of the extension to be queried. //In - * @rep - Reply as defined above. //Out - * - * Argument to the DRM_VMW_EXTENSION Ioctl. - */ - -union drm_vmw_extension_arg { - char extension[DRM_VMW_EXT_NAME_LEN]; - struct drm_vmw_extension_rep rep; + __u64 value; + __u32 param; + __u32 pad64; }; /*************************************************************************/ @@ -149,8 +132,8 @@ */ struct drm_vmw_context_arg { - int32_t cid; - uint32_t pad64; + __s32 cid; + __u32 pad64; }; /*************************************************************************/ @@ -180,7 +163,7 @@ * @mip_levels: Number of mip levels for each face. * An unused face should have 0 encoded. * @size_addr: Address of a user-space array of sruct drm_vmw_size - * cast to an uint64_t for 32-64 bit compatibility. + * cast to an __u64 for 32-64 bit compatibility. * The size of the array should equal the total number of mipmap levels. * @shareable: Boolean whether other clients (as identified by file descriptors) * may reference this surface. @@ -192,18 +175,19 @@ */ struct drm_vmw_surface_create_req { - uint32_t flags; - uint32_t format; - uint32_t mip_levels[DRM_VMW_MAX_SURFACE_FACES]; - uint64_t size_addr; - int32_t shareable; - int32_t scanout; + __u32 flags; + __u32 format; + __u32 mip_levels[DRM_VMW_MAX_SURFACE_FACES]; + __u64 size_addr; + __s32 shareable; + __s32 scanout; }; /** * struct drm_wmv_surface_arg * * @sid: Surface id of created surface or surface to destroy or reference. + * @handle_type: Handle type for DRM_VMW_REF_SURFACE Ioctl. * * Output data from the DRM_VMW_CREATE_SURFACE Ioctl. * Input argument to the DRM_VMW_UNREF_SURFACE Ioctl. @@ -211,8 +195,8 @@ */ struct drm_vmw_surface_arg { - int32_t sid; - uint32_t pad64; + __s32 sid; + enum drm_vmw_handle_type handle_type; }; /** @@ -227,10 +211,10 @@ */ struct drm_vmw_size { - uint32_t width; - uint32_t height; - uint32_t depth; - uint32_t pad64; + __u32 width; + __u32 height; + __u32 depth; + __u32 pad64; }; /** @@ -291,20 +275,20 @@ * DRM_VMW_EXECBUF * * Submit a command buffer for execution on the host, and return a - * fence sequence that when signaled, indicates that the command buffer has + * fence seqno that when signaled, indicates that the command buffer has * executed. */ /** * struct drm_vmw_execbuf_arg * - * @commands: User-space address of a command buffer cast to an uint64_t. + * @commands: User-space address of a command buffer cast to an __u64. * @command-size: Size in bytes of the command buffer. * @throttle-us: Sleep until software is less than @throttle_us * microseconds ahead of hardware. The driver may round this value * to the nearest kernel tick. * @fence_rep: User-space address of a struct drm_vmw_fence_rep cast to an - * uint64_t. + * __u64. * @version: Allows expanding the execbuf ioctl parameters without breaking * backwards compatibility, since user-space will always tell the kernel * which version it uses. @@ -313,21 +297,32 @@ * Argument to the DRM_VMW_EXECBUF Ioctl. */ -#define DRM_VMW_EXECBUF_VERSION 0 +#define DRM_VMW_EXECBUF_VERSION 2 struct drm_vmw_execbuf_arg { - uint64_t commands; - uint32_t command_size; - uint32_t throttle_us; - uint64_t fence_rep; - uint32_t version; - uint32_t flags; + __u64 commands; + __u32 command_size; + __u32 throttle_us; + __u64 fence_rep; + __u32 version; + __u32 flags; + __u32 context_handle; + __u32 pad64; }; /** * struct drm_vmw_fence_rep * - * @fence_seq: Fence sequence associated with a command submission. + * @handle: Fence object handle for fence associated with a command submission. + * @mask: Fence flags relevant for this fence object. + * @seqno: Fence sequence number in fifo. A fence object with a lower + * seqno will signal the EXEC flag before a fence object with a higher + * seqno. This can be used by user-space to avoid kernel calls to determine + * whether a fence has signaled the EXEC flag. Note that @seqno will + * wrap at 32-bit. + * @passed_seqno: The highest seqno number processed by the hardware + * so far. This can be used to mark user-space fence objects as signaled, and + * to determine whether a fence seqno might be stale. * @error: This member should've been set to -EFAULT on submission. * The following actions should be take on completion: * error == -EFAULT: Fence communication failed. The host is synchronized. @@ -341,9 +336,12 @@ */ struct drm_vmw_fence_rep { - uint64_t fence_seq; - int32_t error; - uint32_t pad64; + __u32 handle; + __u32 mask; + __u32 seqno; + __u32 passed_seqno; + __u32 pad64; + __s32 error; }; /*************************************************************************/ @@ -373,8 +371,8 @@ */ struct drm_vmw_alloc_dmabuf_req { - uint32_t size; - uint32_t pad64; + __u32 size; + __u32 pad64; }; /** @@ -391,11 +389,11 @@ */ struct drm_vmw_dmabuf_rep { - uint64_t map_handle; - uint32_t handle; - uint32_t cur_gmr_id; - uint32_t cur_gmr_offset; - uint32_t pad64; + __u64 map_handle; + __u32 handle; + __u32 cur_gmr_id; + __u32 cur_gmr_offset; + __u32 pad64; }; /** @@ -428,41 +426,8 @@ */ struct drm_vmw_unref_dmabuf_arg { - uint32_t handle; - uint32_t pad64; -}; - -/*************************************************************************/ -/** - * DRM_VMW_FIFO_DEBUG - Get last FIFO submission. - * - * This IOCTL copies the last FIFO submission directly out of the FIFO buffer. - */ - -/** - * struct drm_vmw_fifo_debug_arg - * - * @debug_buffer: User space address of a debug_buffer cast to an uint64_t //In - * @debug_buffer_size: Size in bytes of debug buffer //In - * @used_size: Number of bytes copied to the buffer // Out - * @did_not_fit: Boolean indicating that the fifo contents did not fit. //Out - * - * Argument to the DRM_VMW_FIFO_DEBUG Ioctl. - */ - -struct drm_vmw_fifo_debug_arg { - uint64_t debug_buffer; - uint32_t debug_buffer_size; - uint32_t used_size; - int32_t did_not_fit; - uint32_t pad64; -}; - -struct drm_vmw_fence_wait_arg { - uint64_t sequence; - uint64_t kernel_cookie; - int32_t cookie_valid; - int32_t pad64; + __u32 handle; + __u32 pad64; }; /*************************************************************************/ @@ -485,10 +450,10 @@ */ struct drm_vmw_rect { - int32_t x; - int32_t y; - uint32_t w; - uint32_t h; + __s32 x; + __s32 y; + __u32 w; + __u32 h; }; /** @@ -510,21 +475,21 @@ */ struct drm_vmw_control_stream_arg { - uint32_t stream_id; - uint32_t enabled; + __u32 stream_id; + __u32 enabled; - uint32_t flags; - uint32_t color_key; + __u32 flags; + __u32 color_key; - uint32_t handle; - uint32_t offset; - int32_t format; - uint32_t size; - uint32_t width; - uint32_t height; - uint32_t pitch[3]; + __u32 handle; + __u32 offset; + __s32 format; + __u32 size; + __u32 width; + __u32 height; + __u32 pitch[3]; - uint32_t pad64; + __u32 pad64; struct drm_vmw_rect src; struct drm_vmw_rect dst; }; @@ -552,12 +517,12 @@ */ struct drm_vmw_cursor_bypass_arg { - uint32_t flags; - uint32_t crtc_id; - int32_t xpos; - int32_t ypos; - int32_t xhot; - int32_t yhot; + __u32 flags; + __u32 crtc_id; + __s32 xpos; + __s32 ypos; + __s32 xhot; + __s32 yhot; }; /*************************************************************************/ @@ -575,8 +540,8 @@ */ struct drm_vmw_stream_arg { - uint32_t stream_id; - uint32_t pad64; + __u32 stream_id; + __u32 pad64; }; /*************************************************************************/ @@ -589,26 +554,537 @@ /*************************************************************************/ /** + * DRM_VMW_GET_3D_CAP + * + * Read 3D capabilities from the FIFO + * + */ + +/** + * struct drm_vmw_get_3d_cap_arg + * + * @buffer: Pointer to a buffer for capability data, cast to an __u64 + * @size: Max size to copy + * + * Input argument to the DRM_VMW_GET_3D_CAP_IOCTL + * ioctls. + */ + +struct drm_vmw_get_3d_cap_arg { + __u64 buffer; + __u32 max_size; + __u32 pad64; +}; + +/*************************************************************************/ +/** + * DRM_VMW_FENCE_WAIT + * + * Waits for a fence object to signal. The wait is interruptible, so that + * signals may be delivered during the interrupt. The wait may timeout, + * in which case the calls returns -EBUSY. If the wait is restarted, + * that is restarting without resetting @cookie_valid to zero, + * the timeout is computed from the first call. + * + * The flags argument to the DRM_VMW_FENCE_WAIT ioctl indicates what to wait + * on: + * DRM_VMW_FENCE_FLAG_EXEC: All commands ahead of the fence in the command + * stream + * have executed. + * DRM_VMW_FENCE_FLAG_QUERY: All query results resulting from query finish + * commands + * in the buffer given to the EXECBUF ioctl returning the fence object handle + * are available to user-space. + * + * DRM_VMW_WAIT_OPTION_UNREF: If this wait option is given, and the + * fenc wait ioctl returns 0, the fence object has been unreferenced after + * the wait. + */ + +#define DRM_VMW_FENCE_FLAG_EXEC (1 << 0) +#define DRM_VMW_FENCE_FLAG_QUERY (1 << 1) + +#define DRM_VMW_WAIT_OPTION_UNREF (1 << 0) + +/** + * struct drm_vmw_fence_wait_arg + * + * @handle: Fence object handle as returned by the DRM_VMW_EXECBUF ioctl. + * @cookie_valid: Must be reset to 0 on first call. Left alone on restart. + * @kernel_cookie: Set to 0 on first call. Left alone on restart. + * @timeout_us: Wait timeout in microseconds. 0 for indefinite timeout. + * @lazy: Set to 1 if timing is not critical. Allow more than a kernel tick + * before returning. + * @flags: Fence flags to wait on. + * @wait_options: Options that control the behaviour of the wait ioctl. + * + * Input argument to the DRM_VMW_FENCE_WAIT ioctl. + */ + +struct drm_vmw_fence_wait_arg { + __u32 handle; + __s32 cookie_valid; + __u64 kernel_cookie; + __u64 timeout_us; + __s32 lazy; + __s32 flags; + __s32 wait_options; + __s32 pad64; +}; + +/*************************************************************************/ +/** + * DRM_VMW_FENCE_SIGNALED + * + * Checks if a fence object is signaled.. + */ + +/** + * struct drm_vmw_fence_signaled_arg + * + * @handle: Fence object handle as returned by the DRM_VMW_EXECBUF ioctl. + * @flags: Fence object flags input to DRM_VMW_FENCE_SIGNALED ioctl + * @signaled: Out: Flags signaled. + * @sequence: Out: Highest sequence passed so far. Can be used to signal the + * EXEC flag of user-space fence objects. + * + * Input/Output argument to the DRM_VMW_FENCE_SIGNALED and DRM_VMW_FENCE_UNREF + * ioctls. + */ + +struct drm_vmw_fence_signaled_arg { + __u32 handle; + __u32 flags; + __s32 signaled; + __u32 passed_seqno; + __u32 signaled_flags; + __u32 pad64; +}; + +/*************************************************************************/ +/** + * DRM_VMW_FENCE_UNREF + * + * Unreferences a fence object, and causes it to be destroyed if there are no + * other references to it. + * + */ + +/** + * struct drm_vmw_fence_arg + * + * @handle: Fence object handle as returned by the DRM_VMW_EXECBUF ioctl. + * + * Input/Output argument to the DRM_VMW_FENCE_UNREF ioctl.. + */ + +struct drm_vmw_fence_arg { + __u32 handle; + __u32 pad64; +}; + + +/*************************************************************************/ +/** + * DRM_VMW_FENCE_EVENT + * + * Queues an event on a fence to be delivered on the drm character device + * when the fence has signaled the DRM_VMW_FENCE_FLAG_EXEC flag. + * Optionally the approximate time when the fence signaled is + * given by the event. + */ + +/* + * The event type + */ +#define DRM_VMW_EVENT_FENCE_SIGNALED 0x80000000 + +struct drm_vmw_event_fence { + struct drm_event base; + __u64 user_data; + __u32 tv_sec; + __u32 tv_usec; +}; + +/* + * Flags that may be given to the command. + */ +/* Request fence signaled time on the event. */ +#define DRM_VMW_FE_FLAG_REQ_TIME (1 << 0) + +/** + * struct drm_vmw_fence_event_arg + * + * @fence_rep: Pointer to fence_rep structure cast to __u64 or 0 if + * the fence is not supposed to be referenced by user-space. + * @user_info: Info to be delivered with the event. + * @handle: Attach the event to this fence only. + * @flags: A set of flags as defined above. + */ +struct drm_vmw_fence_event_arg { + __u64 fence_rep; + __u64 user_data; + __u32 handle; + __u32 flags; +}; + + +/*************************************************************************/ +/** + * DRM_VMW_PRESENT + * + * Executes an SVGA present on a given fb for a given surface. The surface + * is placed on the framebuffer. Cliprects are given relative to the given + * point (the point disignated by dest_{x|y}). + * + */ + +/** + * struct drm_vmw_present_arg + * @fb_id: framebuffer id to present / read back from. + * @sid: Surface id to present from. + * @dest_x: X placement coordinate for surface. + * @dest_y: Y placement coordinate for surface. + * @clips_ptr: Pointer to an array of clip rects cast to an __u64. + * @num_clips: Number of cliprects given relative to the framebuffer origin, + * in the same coordinate space as the frame buffer. + * @pad64: Unused 64-bit padding. + * + * Input argument to the DRM_VMW_PRESENT ioctl. + */ + +struct drm_vmw_present_arg { + __u32 fb_id; + __u32 sid; + __s32 dest_x; + __s32 dest_y; + __u64 clips_ptr; + __u32 num_clips; + __u32 pad64; +}; + + +/*************************************************************************/ +/** + * DRM_VMW_PRESENT_READBACK + * + * Executes an SVGA present readback from a given fb to the dma buffer + * currently bound as the fb. If there is no dma buffer bound to the fb, + * an error will be returned. + * + */ + +/** + * struct drm_vmw_present_arg + * @fb_id: fb_id to present / read back from. + * @num_clips: Number of cliprects. + * @clips_ptr: Pointer to an array of clip rects cast to an __u64. + * @fence_rep: Pointer to a struct drm_vmw_fence_rep, cast to an __u64. + * If this member is NULL, then the ioctl should not return a fence. + */ + +struct drm_vmw_present_readback_arg { + __u32 fb_id; + __u32 num_clips; + __u64 clips_ptr; + __u64 fence_rep; +}; + +/*************************************************************************/ +/** * DRM_VMW_UPDATE_LAYOUT - Update layout * - * Updates the prefered modes and connection status for connectors. The - * command conisits of one drm_vmw_update_layout_arg pointing out a array + * Updates the preferred modes and connection status for connectors. The + * command consists of one drm_vmw_update_layout_arg pointing to an array * of num_outputs drm_vmw_rect's. */ /** * struct drm_vmw_update_layout_arg * - * @num_outputs: number of active - * @rects: pointer to array of drm_vmw_rect + * @num_outputs: number of active connectors + * @rects: pointer to array of drm_vmw_rect cast to an __u64 * * Input argument to the DRM_VMW_UPDATE_LAYOUT Ioctl. */ - struct drm_vmw_update_layout_arg { - uint32_t num_outputs; - uint32_t pad64; - uint64_t rects; + __u32 num_outputs; + __u32 pad64; + __u64 rects; +}; + + +/*************************************************************************/ +/** + * DRM_VMW_CREATE_SHADER - Create shader + * + * Creates a shader and optionally binds it to a dma buffer containing + * the shader byte-code. + */ + +/** + * enum drm_vmw_shader_type - Shader types + */ +enum drm_vmw_shader_type { + drm_vmw_shader_type_vs = 0, + drm_vmw_shader_type_ps, +}; + + +/** + * struct drm_vmw_shader_create_arg + * + * @shader_type: Shader type of the shader to create. + * @size: Size of the byte-code in bytes. + * where the shader byte-code starts + * @buffer_handle: Buffer handle identifying the buffer containing the + * shader byte-code + * @shader_handle: On successful completion contains a handle that + * can be used to subsequently identify the shader. + * @offset: Offset in bytes into the buffer given by @buffer_handle, + * + * Input / Output argument to the DRM_VMW_CREATE_SHADER Ioctl. + */ +struct drm_vmw_shader_create_arg { + enum drm_vmw_shader_type shader_type; + __u32 size; + __u32 buffer_handle; + __u32 shader_handle; + __u64 offset; +}; + +/*************************************************************************/ +/** + * DRM_VMW_UNREF_SHADER - Unreferences a shader + * + * Destroys a user-space reference to a shader, optionally destroying + * it. + */ + +/** + * struct drm_vmw_shader_arg + * + * @handle: Handle identifying the shader to destroy. + * + * Input argument to the DRM_VMW_UNREF_SHADER ioctl. + */ +struct drm_vmw_shader_arg { + __u32 handle; + __u32 pad64; +}; + +/*************************************************************************/ +/** + * DRM_VMW_GB_SURFACE_CREATE - Create a host guest-backed surface. + * + * Allocates a surface handle and queues a create surface command + * for the host on the first use of the surface. The surface ID can + * be used as the surface ID in commands referencing the surface. + */ + +/** + * enum drm_vmw_surface_flags + * + * @drm_vmw_surface_flag_shareable: Whether the surface is shareable + * @drm_vmw_surface_flag_scanout: Whether the surface is a scanout + * surface. + * @drm_vmw_surface_flag_create_buffer: Create a backup buffer if none is + * given. + */ +enum drm_vmw_surface_flags { + drm_vmw_surface_flag_shareable = (1 << 0), + drm_vmw_surface_flag_scanout = (1 << 1), + drm_vmw_surface_flag_create_buffer = (1 << 2) +}; + +/** + * struct drm_vmw_gb_surface_create_req + * + * @svga3d_flags: SVGA3d surface flags for the device. + * @format: SVGA3d format. + * @mip_level: Number of mip levels for all faces. + * @drm_surface_flags Flags as described above. + * @multisample_count Future use. Set to 0. + * @autogen_filter Future use. Set to 0. + * @buffer_handle Buffer handle of backup buffer. SVGA3D_INVALID_ID + * if none. + * @base_size Size of the base mip level for all faces. + * @array_size Must be zero for non-DX hardware, and if non-zero + * svga3d_flags must have proper bind flags setup. + * + * Input argument to the DRM_VMW_GB_SURFACE_CREATE Ioctl. + * Part of output argument for the DRM_VMW_GB_SURFACE_REF Ioctl. + */ +struct drm_vmw_gb_surface_create_req { + __u32 svga3d_flags; + __u32 format; + __u32 mip_levels; + enum drm_vmw_surface_flags drm_surface_flags; + __u32 multisample_count; + __u32 autogen_filter; + __u32 buffer_handle; + __u32 array_size; + struct drm_vmw_size base_size; +}; + +/** + * struct drm_vmw_gb_surface_create_rep + * + * @handle: Surface handle. + * @backup_size: Size of backup buffers for this surface. + * @buffer_handle: Handle of backup buffer. SVGA3D_INVALID_ID if none. + * @buffer_size: Actual size of the buffer identified by + * @buffer_handle + * @buffer_map_handle: Offset into device address space for the buffer + * identified by @buffer_handle. + * + * Part of output argument for the DRM_VMW_GB_SURFACE_REF ioctl. + * Output argument for the DRM_VMW_GB_SURFACE_CREATE ioctl. + */ +struct drm_vmw_gb_surface_create_rep { + __u32 handle; + __u32 backup_size; + __u32 buffer_handle; + __u32 buffer_size; + __u64 buffer_map_handle; +}; + +/** + * union drm_vmw_gb_surface_create_arg + * + * @req: Input argument as described above. + * @rep: Output argument as described above. + * + * Argument to the DRM_VMW_GB_SURFACE_CREATE ioctl. + */ +union drm_vmw_gb_surface_create_arg { + struct drm_vmw_gb_surface_create_rep rep; + struct drm_vmw_gb_surface_create_req req; +}; + +/*************************************************************************/ +/** + * DRM_VMW_GB_SURFACE_REF - Reference a host surface. + * + * Puts a reference on a host surface with a given handle, as previously + * returned by the DRM_VMW_GB_SURFACE_CREATE ioctl. + * A reference will make sure the surface isn't destroyed while we hold + * it and will allow the calling client to use the surface handle in + * the command stream. + * + * On successful return, the Ioctl returns the surface information given + * to and returned from the DRM_VMW_GB_SURFACE_CREATE ioctl. + */ + +/** + * struct drm_vmw_gb_surface_reference_arg + * + * @creq: The data used as input when the surface was created, as described + * above at "struct drm_vmw_gb_surface_create_req" + * @crep: Additional data output when the surface was created, as described + * above at "struct drm_vmw_gb_surface_create_rep" + * + * Output Argument to the DRM_VMW_GB_SURFACE_REF ioctl. + */ +struct drm_vmw_gb_surface_ref_rep { + struct drm_vmw_gb_surface_create_req creq; + struct drm_vmw_gb_surface_create_rep crep; }; +/** + * union drm_vmw_gb_surface_reference_arg + * + * @req: Input data as described above at "struct drm_vmw_surface_arg" + * @rep: Output data as described above at "struct drm_vmw_gb_surface_ref_rep" + * + * Argument to the DRM_VMW_GB_SURFACE_REF Ioctl. + */ +union drm_vmw_gb_surface_reference_arg { + struct drm_vmw_gb_surface_ref_rep rep; + struct drm_vmw_surface_arg req; +}; + + +/*************************************************************************/ +/** + * DRM_VMW_SYNCCPU - Sync a DMA buffer / MOB for CPU access. + * + * Idles any previously submitted GPU operations on the buffer and + * by default blocks command submissions that reference the buffer. + * If the file descriptor used to grab a blocking CPU sync is closed, the + * cpu sync is released. + * The flags argument indicates how the grab / release operation should be + * performed: + */ + +/** + * enum drm_vmw_synccpu_flags - Synccpu flags: + * + * @drm_vmw_synccpu_read: Sync for read. If sync is done for read only, it's a + * hint to the kernel to allow command submissions that references the buffer + * for read-only. + * @drm_vmw_synccpu_write: Sync for write. Block all command submissions + * referencing this buffer. + * @drm_vmw_synccpu_dontblock: Dont wait for GPU idle, but rather return + * -EBUSY should the buffer be busy. + * @drm_vmw_synccpu_allow_cs: Allow command submission that touches the buffer + * while the buffer is synced for CPU. This is similar to the GEM bo idle + * behavior. + */ +enum drm_vmw_synccpu_flags { + drm_vmw_synccpu_read = (1 << 0), + drm_vmw_synccpu_write = (1 << 1), + drm_vmw_synccpu_dontblock = (1 << 2), + drm_vmw_synccpu_allow_cs = (1 << 3) +}; + +/** + * enum drm_vmw_synccpu_op - Synccpu operations: + * + * @drm_vmw_synccpu_grab: Grab the buffer for CPU operations + * @drm_vmw_synccpu_release: Release a previous grab. + */ +enum drm_vmw_synccpu_op { + drm_vmw_synccpu_grab, + drm_vmw_synccpu_release +}; + +/** + * struct drm_vmw_synccpu_arg + * + * @op: The synccpu operation as described above. + * @handle: Handle identifying the buffer object. + * @flags: Flags as described above. + */ +struct drm_vmw_synccpu_arg { + enum drm_vmw_synccpu_op op; + enum drm_vmw_synccpu_flags flags; + __u32 handle; + __u32 pad64; +}; + +/*************************************************************************/ +/** + * DRM_VMW_CREATE_EXTENDED_CONTEXT - Create a host context. + * + * Allocates a device unique context id, and queues a create context command + * for the host. Does not wait for host completion. + */ +enum drm_vmw_extended_context { + drm_vmw_context_legacy, + drm_vmw_context_dx +}; + +/** + * union drm_vmw_extended_context_arg + * + * @req: Context type. + * @rep: Context identifier. + * + * Argument to the DRM_VMW_CREATE_EXTENDED_CONTEXT Ioctl. + */ +union drm_vmw_extended_context_arg { + enum drm_vmw_extended_context req; + struct drm_vmw_context_arg rep; +}; #endif diff -Nru libdrm-2.4.67/intel/Android.mk libdrm-2.4.70/intel/Android.mk --- libdrm-2.4.67/intel/Android.mk 2015-03-29 23:45:04.000000000 +0000 +++ libdrm-2.4.70/intel/Android.mk 1970-01-01 00:00:00.000000000 +0000 @@ -1,43 +0,0 @@ -# -# Copyright © 2011 Intel Corporation -# -# Permission is hereby granted, free of charge, to any person obtaining a -# copy of this software and associated documentation files (the "Software"), -# to deal in the Software without restriction, including without limitation -# the rights to use, copy, modify, merge, publish, distribute, sublicense, -# and/or sell copies of the Software, and to permit persons to whom the -# Software is furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice (including the next -# paragraph) shall be included in all copies or substantial portions of the -# Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -# IN THE SOFTWARE. -# - -LOCAL_PATH := $(call my-dir) -include $(CLEAR_VARS) - -# Import variables LIBDRM_INTEL_FILES, LIBDRM_INTEL_H_FILES -include $(LOCAL_PATH)/Makefile.sources - -LOCAL_MODULE := libdrm_intel -LOCAL_MODULE_TAGS := optional - -LOCAL_SRC_FILES := $(LIBDRM_INTEL_FILES) -LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH) - -LOCAL_CFLAGS := \ - -DHAVE_LIBDRM_ATOMIC_PRIMITIVES=1 - -LOCAL_SHARED_LIBRARIES := \ - libdrm \ - libpciaccess - -include $(BUILD_SHARED_LIBRARY) diff -Nru libdrm-2.4.67/intel/intel_bufmgr_fake.c libdrm-2.4.70/intel/intel_bufmgr_fake.c --- libdrm-2.4.67/intel/intel_bufmgr_fake.c 2016-01-17 21:22:14.000000000 +0000 +++ libdrm-2.4.70/intel/intel_bufmgr_fake.c 2016-04-21 13:40:06.000000000 +0000 @@ -312,7 +312,7 @@ * * Assume that in userland we treat sequence numbers as ints, which * makes some of the comparisons convenient, since the sequence - * numbers are all postive signed integers. + * numbers are all positive signed integers. * * From this we get several cases we need to handle. Here's a timeline. * 0x2 0x7 0x7ffffff8 0x7ffffffd diff -Nru libdrm-2.4.67/intel/intel_bufmgr_gem.c libdrm-2.4.70/intel/intel_bufmgr_gem.c --- libdrm-2.4.67/intel/intel_bufmgr_gem.c 2016-01-17 21:22:14.000000000 +0000 +++ libdrm-2.4.70/intel/intel_bufmgr_gem.c 2016-04-21 13:40:06.000000000 +0000 @@ -3379,7 +3379,7 @@ bufmgr_gem->gtt_size > 256*1024*1024) { /* The unmappable part of gtt on gen 3 (i.e. above 256MB) can't * be used for tiled blits. To simplify the accounting, just - * substract the unmappable part (fixed to 256MB on all known + * subtract the unmappable part (fixed to 256MB on all known * gen3 devices) if the kernel advertises it. */ bufmgr_gem->gtt_size -= 256*1024*1024; } diff -Nru libdrm-2.4.67/intel/intel_chipset.h libdrm-2.4.70/intel/intel_chipset.h --- libdrm-2.4.67/intel/intel_chipset.h 2016-01-17 21:22:14.000000000 +0000 +++ libdrm-2.4.70/intel/intel_chipset.h 2016-07-20 23:42:21.000000000 +0000 @@ -168,6 +168,7 @@ #define PCI_CHIP_SKYLAKE_DT_GT1 0x1902 #define PCI_CHIP_SKYLAKE_ULT_GT1 0x1906 #define PCI_CHIP_SKYLAKE_SRV_GT1 0x190A /* Reserved */ +#define PCI_CHIP_SKYLAKE_H_GT1 0x190B #define PCI_CHIP_SKYLAKE_ULX_GT1 0x190E /* Reserved */ #define PCI_CHIP_SKYLAKE_DT_GT2 0x1912 #define PCI_CHIP_SKYLAKE_FUSED0_GT2 0x1913 /* Reserved */ @@ -179,9 +180,12 @@ #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_ULT_GT3_0 0x1923 +#define PCI_CHIP_SKYLAKE_ULT_GT3_1 0x1926 +#define PCI_CHIP_SKYLAKE_ULT_GT3_2 0x1927 #define PCI_CHIP_SKYLAKE_SRV_GT4 0x192A +#define PCI_CHIP_SKYLAKE_HALO_GT3 0x192B /* Reserved */ +#define PCI_CHIP_SKYLAKE_SRV_GT3 0x192D #define PCI_CHIP_SKYLAKE_DT_GT4 0x1932 #define PCI_CHIP_SKYLAKE_SRV_GT4X 0x193A #define PCI_CHIP_SKYLAKE_H_GT4 0x193B @@ -190,7 +194,9 @@ #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_GT3_0 0x5923 +#define PCI_CHIP_KABYLAKE_ULT_GT3_1 0x5926 +#define PCI_CHIP_KABYLAKE_ULT_GT3_2 0x5927 #define PCI_CHIP_KABYLAKE_ULT_GT2F 0x5921 #define PCI_CHIP_KABYLAKE_ULX_GT1_5 0x5915 #define PCI_CHIP_KABYLAKE_ULX_GT1 0x590E @@ -198,21 +204,19 @@ #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_HALO_GT1_0 0x5908 +#define PCI_CHIP_KABYLAKE_HALO_GT1_1 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 #define PCI_CHIP_BROXTON_2 0x5A84 +#define PCI_CHIP_BROXTON_3 0x1A85 +#define PCI_CHIP_BROXTON_4 0x5A85 #define IS_MOBILE(devid) ((devid) == PCI_CHIP_I855_GM || \ (devid) == PCI_CHIP_I915_GM || \ @@ -373,10 +377,11 @@ #define IS_GEN8(devid) (IS_BROADWELL(devid) || \ IS_CHERRYVIEW(devid)) -#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_SRV_GT1) +#define IS_SKL_GT1(devid) ((devid) == PCI_CHIP_SKYLAKE_DT_GT1 || \ + (devid) == PCI_CHIP_SKYLAKE_ULT_GT1 || \ + (devid) == PCI_CHIP_SKYLAKE_SRV_GT1 || \ + (devid) == PCI_CHIP_SKYLAKE_H_GT1 || \ + (devid) == PCI_CHIP_SKYLAKE_ULX_GT1) #define IS_SKL_GT2(devid) ((devid) == PCI_CHIP_SKYLAKE_DT_GT2 || \ (devid) == PCI_CHIP_SKYLAKE_FUSED0_GT2 || \ @@ -389,8 +394,11 @@ (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_GT3(devid) ((devid) == PCI_CHIP_SKYLAKE_ULT_GT3_0 || \ + (devid) == PCI_CHIP_SKYLAKE_ULT_GT3_1 || \ + (devid) == PCI_CHIP_SKYLAKE_ULT_GT3_2 || \ + (devid) == PCI_CHIP_SKYLAKE_HALO_GT3 || \ + (devid) == PCI_CHIP_SKYLAKE_SRV_GT3) #define IS_SKL_GT4(devid) ((devid) == PCI_CHIP_SKYLAKE_SRV_GT4 || \ (devid) == PCI_CHIP_SKYLAKE_DT_GT4 || \ @@ -404,7 +412,8 @@ (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_HALO_GT1_0 || \ + (devid) == PCI_CHIP_KABYLAKE_HALO_GT1_1 || \ (devid) == PCI_CHIP_KABYLAKE_SRV_GT1) #define IS_KBL_GT2(devid) ((devid) == PCI_CHIP_KABYLAKE_ULT_GT2 || \ @@ -415,14 +424,11 @@ (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_KBL_GT3(devid) ((devid) == PCI_CHIP_KABYLAKE_ULT_GT3_0 || \ + (devid) == PCI_CHIP_KABYLAKE_ULT_GT3_1 || \ + (devid) == PCI_CHIP_KABYLAKE_ULT_GT3_2) + +#define IS_KBL_GT4(devid) ((devid) == PCI_CHIP_KABYLAKE_HALO_GT4) #define IS_KABYLAKE(devid) (IS_KBL_GT1(devid) || \ IS_KBL_GT2(devid) || \ @@ -436,7 +442,9 @@ #define IS_BROXTON(devid) ((devid) == PCI_CHIP_BROXTON_0 || \ (devid) == PCI_CHIP_BROXTON_1 || \ - (devid) == PCI_CHIP_BROXTON_2) + (devid) == PCI_CHIP_BROXTON_2 || \ + (devid) == PCI_CHIP_BROXTON_3 || \ + (devid) == PCI_CHIP_BROXTON_4) #define IS_GEN9(devid) (IS_SKYLAKE(devid) || \ IS_BROXTON(devid) || \ diff -Nru libdrm-2.4.67/intel/intel_decode.c libdrm-2.4.70/intel/intel_decode.c --- libdrm-2.4.67/intel/intel_decode.c 2016-02-10 16:49:00.000000000 +0000 +++ libdrm-2.4.70/intel/intel_decode.c 2016-04-21 13:40:06.000000000 +0000 @@ -3598,7 +3598,7 @@ instr_out(ctx, 0, "3DSTATE_DEPTH_BUFFER\n"); if (IS_GEN5(devid) || IS_GEN6(devid)) instr_out(ctx, 1, - "%s, %s, pitch = %d bytes, %stiled, HiZ %d, Seperate Stencil %d\n", + "%s, %s, pitch = %d bytes, %stiled, HiZ %d, Separate Stencil %d\n", get_965_surfacetype(data[1] >> 29), get_965_depthformat((data[1] >> 18) & 0x7), (data[1] & 0x0001ffff) + 1, diff -Nru libdrm-2.4.67/intel/Makefile.am libdrm-2.4.70/intel/Makefile.am --- libdrm-2.4.67/intel/Makefile.am 2015-05-04 15:47:43.000000000 +0000 +++ libdrm-2.4.70/intel/Makefile.am 2016-07-23 12:53:10.000000000 +0000 @@ -66,7 +66,6 @@ $(BATCHES:.batch=.batch-ref.txt) \ $(BATCHES:.batch=.batch-ref.txt) \ tests/test-batch.sh \ - Android.mk \ $(TESTS) test_decode_LDADD = libdrm_intel.la ../libdrm.la diff -Nru libdrm-2.4.67/intel/Makefile.in libdrm-2.4.70/intel/Makefile.in --- libdrm-2.4.67/intel/Makefile.in 2016-02-15 18:24:00.000000000 +0000 +++ libdrm-2.4.70/intel/Makefile.in 2016-07-23 13:19:07.000000000 +0000 @@ -624,7 +624,6 @@ $(BATCHES:.batch=.batch-ref.txt) \ $(BATCHES:.batch=.batch-ref.txt) \ tests/test-batch.sh \ - Android.mk \ $(TESTS) test_decode_LDADD = libdrm_intel.la ../libdrm.la diff -Nru libdrm-2.4.67/intel/tests/gen5-3d.batch-ref.txt libdrm-2.4.70/intel/tests/gen5-3d.batch-ref.txt --- libdrm-2.4.67/intel/tests/gen5-3d.batch-ref.txt 2013-02-14 15:14:08.000000000 +0000 +++ libdrm-2.4.70/intel/tests/gen5-3d.batch-ref.txt 2016-04-21 13:40:06.000000000 +0000 @@ -24,7 +24,7 @@ 0x1230005c: 0x00000000: dword 3 0x12300060: 0x00000000: dword 4 0x12300064: 0x79050004: 3DSTATE_DEPTH_BUFFER -0x12300068: 0x2c0805ff: 2D, z24s8, pitch = 1536 bytes, tiled, HiZ 0, Seperate Stencil 0 +0x12300068: 0x2c0805ff: 2D, z24s8, pitch = 1536 bytes, tiled, HiZ 0, Separate Stencil 0 0x1230006c: 0x00000000: depth offset 0x12300070: 0x09584ac0: 300x300 0x12300074: 0x00000000: volume depth diff -Nru libdrm-2.4.67/intel/tests/gen6-3d.batch-ref.txt libdrm-2.4.70/intel/tests/gen6-3d.batch-ref.txt --- libdrm-2.4.67/intel/tests/gen6-3d.batch-ref.txt 2013-10-09 16:03:25.000000000 +0000 +++ libdrm-2.4.70/intel/tests/gen6-3d.batch-ref.txt 2016-04-21 13:40:06.000000000 +0000 @@ -140,7 +140,7 @@ 0x1230022c: 0x00000000: 0x12300230: 0x00000000: 0x12300234: 0x79050005: 3DSTATE_DEPTH_BUFFER -0x12300238: 0x2c6c05ff: 2D, unknown, pitch = 1536 bytes, tiled, HiZ 1, Seperate Stencil 1 +0x12300238: 0x2c6c05ff: 2D, unknown, pitch = 1536 bytes, tiled, HiZ 1, Separate Stencil 1 0x1230023c: 0x00000000: depth offset 0x12300240: 0x09584ac0: 300x300 0x12300244: 0x00000000: volume depth diff -Nru libdrm-2.4.67/libkms/Android.mk libdrm-2.4.70/libkms/Android.mk --- libdrm-2.4.67/libkms/Android.mk 2015-03-29 23:45:04.000000000 +0000 +++ libdrm-2.4.70/libkms/Android.mk 1970-01-01 00:00:00.000000000 +0000 @@ -1,51 +0,0 @@ -DRM_GPU_DRIVERS := $(strip $(filter-out swrast, $(BOARD_GPU_DRIVERS))) - -intel_drivers := i915 i965 i915g ilo -radeon_drivers := r300g r600g radeonsi -nouveau_drivers := nouveau -vmwgfx_drivers := vmwgfx - -valid_drivers := \ - $(intel_drivers) \ - $(radeon_drivers) \ - $(nouveau_drivers) \ - $(vmwgfx_drivers) - -# warn about invalid drivers -invalid_drivers := $(filter-out $(valid_drivers), $(DRM_GPU_DRIVERS)) -ifneq ($(invalid_drivers),) -$(warning invalid GPU drivers: $(invalid_drivers)) -# tidy up -DRM_GPU_DRIVERS := $(filter-out $(invalid_drivers), $(DRM_GPU_DRIVERS)) -endif - -LOCAL_PATH := $(call my-dir) - -include $(CLEAR_VARS) -include $(LOCAL_PATH)/Makefile.sources - -LOCAL_SRC_FILES := $(LIBKMS_FILES) - -ifneq ($(filter $(vmwgfx_drivers), $(DRM_GPU_DRIVERS)),) -LOCAL_SRC_FILES += $(LIBKMS_VMWGFX_FILES) -endif - -ifneq ($(filter $(intel_drivers), $(DRM_GPU_DRIVERS)),) -LOCAL_SRC_FILES += $(LIBKMS_INTEL_FILES) -endif - -ifneq ($(filter $(nouveau_drivers), $(DRM_GPU_DRIVERS)),) -LOCAL_SRC_FILES += $(LIBKMS_NOUVEAU_FILES) -endif - -ifneq ($(filter $(radeon_drivers), $(DRM_GPU_DRIVERS)),) -LOCAL_SRC_FILES += $(LIBKMS_RADEON_FILES) -endif - -LOCAL_MODULE := libkms -LOCAL_MODULE_TAGS := optional -LOCAL_SHARED_LIBRARIES := libdrm - -LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH) - -include $(BUILD_SHARED_LIBRARY) diff -Nru libdrm-2.4.67/libkms/linux.c libdrm-2.4.70/libkms/linux.c --- libdrm-2.4.67/libkms/linux.c 2015-09-09 14:06:56.000000000 +0000 +++ libdrm-2.4.70/libkms/linux.c 2016-07-20 23:42:21.000000000 +0000 @@ -41,9 +41,12 @@ #include #include #include -#ifdef HAVE_SYS_MKDEV_H +#ifdef MAJOR_IN_MKDEV #include #endif +#ifdef MAJOR_IN_SYSMACROS +#include +#endif #include "libdrm_macros.h" #include "internal.h" diff -Nru libdrm-2.4.67/libkms/Makefile.am libdrm-2.4.70/libkms/Makefile.am --- libdrm-2.4.67/libkms/Makefile.am 2015-05-04 15:47:43.000000000 +0000 +++ libdrm-2.4.70/libkms/Makefile.am 2016-07-23 12:53:10.000000000 +0000 @@ -44,4 +44,4 @@ pkgconfig_DATA = libkms.pc TESTS = kms-symbol-check -EXTRA_DIST = Android.mk $(TESTS) +EXTRA_DIST = $(TESTS) diff -Nru libdrm-2.4.67/libkms/Makefile.in libdrm-2.4.70/libkms/Makefile.in --- libdrm-2.4.67/libkms/Makefile.in 2016-02-15 18:24:00.000000000 +0000 +++ libdrm-2.4.70/libkms/Makefile.in 2016-07-23 13:19:07.000000000 +0000 @@ -599,7 +599,7 @@ libkmsinclude_HEADERS = $(LIBKMS_H_FILES) pkgconfig_DATA = libkms.pc TESTS = kms-symbol-check -EXTRA_DIST = Android.mk $(TESTS) +EXTRA_DIST = $(TESTS) all: all-am .SUFFIXES: diff -Nru libdrm-2.4.67/Makefile.am libdrm-2.4.70/Makefile.am --- libdrm-2.4.67/Makefile.am 2016-02-10 16:49:00.000000000 +0000 +++ libdrm-2.4.70/Makefile.am 2016-07-23 12:53:10.000000000 +0000 @@ -120,8 +120,6 @@ libdrmincludedir = ${includedir} libdrminclude_HEADERS = $(LIBDRM_H_FILES) -EXTRA_DIST = Android.mk - klibdrmincludedir = ${includedir}/libdrm klibdrminclude_HEADERS = $(LIBDRM_INCLUDE_H_FILES) diff -Nru libdrm-2.4.67/Makefile.in libdrm-2.4.70/Makefile.in --- libdrm-2.4.67/Makefile.in 2016-02-15 18:24:00.000000000 +0000 +++ libdrm-2.4.70/Makefile.in 2016-07-23 13:19:07.000000000 +0000 @@ -231,7 +231,7 @@ include/drm/amdgpu_drm.h 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 \ - include/drm/vmwgfx_drm.h + include/drm/virtgpu_drm.h include/drm/vmwgfx_drm.h HEADERS = $(klibdrminclude_HEADERS) $(libdrminclude_HEADERS) RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive @@ -503,7 +503,8 @@ include/drm/sis_drm.h \ include/drm/tegra_drm.h \ include/drm/vc4_drm.h \ - include/drm/via_drm.h + include/drm/via_drm.h \ + include/drm/virtgpu_drm.h LIBDRM_INCLUDE_VMWGFX_H_FILES := \ include/drm/vmwgfx_drm.h @@ -567,7 +568,6 @@ libdrm_la_SOURCES = $(LIBDRM_FILES) libdrmincludedir = ${includedir} libdrminclude_HEADERS = $(LIBDRM_H_FILES) -EXTRA_DIST = Android.mk klibdrmincludedir = ${includedir}/libdrm klibdrminclude_HEADERS = $(LIBDRM_INCLUDE_H_FILES) $(am__append_1) all: config.h diff -Nru libdrm-2.4.67/Makefile.sources libdrm-2.4.70/Makefile.sources --- libdrm-2.4.67/Makefile.sources 2016-02-10 16:49:00.000000000 +0000 +++ libdrm-2.4.70/Makefile.sources 2016-07-23 12:53:10.000000000 +0000 @@ -33,7 +33,8 @@ include/drm/sis_drm.h \ include/drm/tegra_drm.h \ include/drm/vc4_drm.h \ - include/drm/via_drm.h + include/drm/via_drm.h \ + include/drm/virtgpu_drm.h LIBDRM_INCLUDE_VMWGFX_H_FILES := \ include/drm/vmwgfx_drm.h diff -Nru libdrm-2.4.67/man/drm-kms.xml libdrm-2.4.70/man/drm-kms.xml --- libdrm-2.4.67/man/drm-kms.xml 2013-10-09 16:03:25.000000000 +0000 +++ libdrm-2.4.70/man/drm-kms.xml 2016-07-23 12:53:10.000000000 +0000 @@ -126,7 +126,7 @@ Framebuffers are abstract memory objects that provide a source of pixel data to scanout to a CRTC. - Applications explicitely request the creation of framebuffers + Applications explicitly request the creation of framebuffers and can control their behavior. Framebuffers rely on the underneath memory manager for low-level memory operations. When creating a framebuffer, applications pass a memory handle diff -Nru libdrm-2.4.67/nouveau/Android.mk libdrm-2.4.70/nouveau/Android.mk --- libdrm-2.4.67/nouveau/Android.mk 2015-03-29 23:45:04.000000000 +0000 +++ libdrm-2.4.70/nouveau/Android.mk 1970-01-01 00:00:00.000000000 +0000 @@ -1,18 +0,0 @@ -LOCAL_PATH := $(call my-dir) -include $(CLEAR_VARS) - -# Import variables LIBDRM_NOUVEAU_FILES, LIBDRM_NOUVEAU_H_FILES -include $(LOCAL_PATH)/Makefile.sources - -LOCAL_MODULE := libdrm_nouveau -LOCAL_MODULE_TAGS := optional - -LOCAL_SHARED_LIBRARIES := libdrm - -LOCAL_SRC_FILES := $(LIBDRM_NOUVEAU_FILES) -LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH) - -LOCAL_CFLAGS := \ - -DHAVE_LIBDRM_ATOMIC_PRIMITIVES=1 - -include $(BUILD_SHARED_LIBRARY) diff -Nru libdrm-2.4.67/nouveau/Makefile.am libdrm-2.4.70/nouveau/Makefile.am --- libdrm-2.4.67/nouveau/Makefile.am 2016-01-17 21:22:14.000000000 +0000 +++ libdrm-2.4.70/nouveau/Makefile.am 2016-07-23 12:53:10.000000000 +0000 @@ -30,4 +30,4 @@ pkgconfig_DATA = libdrm_nouveau.pc TESTS = nouveau-symbol-check -EXTRA_DIST = Android.mk $(TESTS) +EXTRA_DIST = $(TESTS) diff -Nru libdrm-2.4.67/nouveau/Makefile.in libdrm-2.4.70/nouveau/Makefile.in --- libdrm-2.4.67/nouveau/Makefile.in 2016-02-15 18:24:00.000000000 +0000 +++ libdrm-2.4.70/nouveau/Makefile.in 2016-07-23 13:19:07.000000000 +0000 @@ -578,7 +578,7 @@ pkgconfig_DATA = libdrm_nouveau.pc TESTS = nouveau-symbol-check -EXTRA_DIST = Android.mk $(TESTS) +EXTRA_DIST = $(TESTS) all: all-am .SUFFIXES: diff -Nru libdrm-2.4.67/radeon/Android.mk libdrm-2.4.70/radeon/Android.mk --- libdrm-2.4.67/radeon/Android.mk 2015-03-29 23:45:04.000000000 +0000 +++ libdrm-2.4.70/radeon/Android.mk 1970-01-01 00:00:00.000000000 +0000 @@ -1,18 +0,0 @@ -LOCAL_PATH := $(call my-dir) -include $(CLEAR_VARS) - -# Import variables LIBDRM_RADEON_FILES, LIBDRM_RADEON_H_FILES -include $(LOCAL_PATH)/Makefile.sources - -LOCAL_MODULE := libdrm_radeon -LOCAL_MODULE_TAGS := optional - -LOCAL_SHARED_LIBRARIES := libdrm - -LOCAL_SRC_FILES := $(LIBDRM_RADEON_FILES) -LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH) - -LOCAL_CFLAGS := \ - -DHAVE_LIBDRM_ATOMIC_PRIMITIVES=1 - -include $(BUILD_SHARED_LIBRARY) diff -Nru libdrm-2.4.67/radeon/Makefile.am libdrm-2.4.70/radeon/Makefile.am --- libdrm-2.4.67/radeon/Makefile.am 2015-05-04 15:47:43.000000000 +0000 +++ libdrm-2.4.70/radeon/Makefile.am 2016-07-23 12:53:10.000000000 +0000 @@ -43,4 +43,5 @@ pkgconfigdir = @pkgconfigdir@ pkgconfig_DATA = libdrm_radeon.pc -EXTRA_DIST = Android.mk $(LIBDRM_RADEON_BOF_FILES) $(TESTS) +TESTS = radeon-symbol-check +EXTRA_DIST = $(LIBDRM_RADEON_BOF_FILES) $(TESTS) diff -Nru libdrm-2.4.67/radeon/Makefile.in libdrm-2.4.70/radeon/Makefile.in --- libdrm-2.4.67/radeon/Makefile.in 2016-02-15 18:24:00.000000000 +0000 +++ libdrm-2.4.70/radeon/Makefile.in 2016-07-23 13:19:07.000000000 +0000 @@ -234,8 +234,186 @@ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags +am__tty_colors_dummy = \ + mgn= red= grn= lgn= blu= brg= std=; \ + am__color_tests=no +am__tty_colors = { \ + $(am__tty_colors_dummy); \ + if test "X$(AM_COLOR_TESTS)" = Xno; then \ + am__color_tests=no; \ + elif test "X$(AM_COLOR_TESTS)" = Xalways; then \ + am__color_tests=yes; \ + elif test "X$$TERM" != Xdumb && { test -t 1; } 2>/dev/null; then \ + am__color_tests=yes; \ + fi; \ + if test $$am__color_tests = yes; then \ + red=''; \ + grn=''; \ + lgn=''; \ + blu=''; \ + mgn=''; \ + brg=''; \ + std=''; \ + fi; \ +} +am__recheck_rx = ^[ ]*:recheck:[ ]* +am__global_test_result_rx = ^[ ]*:global-test-result:[ ]* +am__copy_in_global_log_rx = ^[ ]*:copy-in-global-log:[ ]* +# A command that, given a newline-separated list of test names on the +# standard input, print the name of the tests that are to be re-run +# upon "make recheck". +am__list_recheck_tests = $(AWK) '{ \ + recheck = 1; \ + while ((rc = (getline line < ($$0 ".trs"))) != 0) \ + { \ + if (rc < 0) \ + { \ + if ((getline line2 < ($$0 ".log")) < 0) \ + recheck = 0; \ + break; \ + } \ + else if (line ~ /$(am__recheck_rx)[nN][Oo]/) \ + { \ + recheck = 0; \ + break; \ + } \ + else if (line ~ /$(am__recheck_rx)[yY][eE][sS]/) \ + { \ + break; \ + } \ + }; \ + if (recheck) \ + print $$0; \ + close ($$0 ".trs"); \ + close ($$0 ".log"); \ +}' +# A command that, given a newline-separated list of test names on the +# standard input, create the global log from their .trs and .log files. +am__create_global_log = $(AWK) ' \ +function fatal(msg) \ +{ \ + print "fatal: making $@: " msg | "cat >&2"; \ + exit 1; \ +} \ +function rst_section(header) \ +{ \ + print header; \ + len = length(header); \ + for (i = 1; i <= len; i = i + 1) \ + printf "="; \ + printf "\n\n"; \ +} \ +{ \ + copy_in_global_log = 1; \ + global_test_result = "RUN"; \ + while ((rc = (getline line < ($$0 ".trs"))) != 0) \ + { \ + if (rc < 0) \ + fatal("failed to read from " $$0 ".trs"); \ + if (line ~ /$(am__global_test_result_rx)/) \ + { \ + sub("$(am__global_test_result_rx)", "", line); \ + sub("[ ]*$$", "", line); \ + global_test_result = line; \ + } \ + else if (line ~ /$(am__copy_in_global_log_rx)[nN][oO]/) \ + copy_in_global_log = 0; \ + }; \ + if (copy_in_global_log) \ + { \ + rst_section(global_test_result ": " $$0); \ + while ((rc = (getline line < ($$0 ".log"))) != 0) \ + { \ + if (rc < 0) \ + fatal("failed to read from " $$0 ".log"); \ + print line; \ + }; \ + printf "\n"; \ + }; \ + close ($$0 ".trs"); \ + close ($$0 ".log"); \ +}' +# Restructured Text title. +am__rst_title = { sed 's/.*/ & /;h;s/./=/g;p;x;s/ *$$//;p;g' && echo; } +# Solaris 10 'make', and several other traditional 'make' implementations, +# pass "-e" to $(SHELL), and POSIX 2008 even requires this. Work around it +# by disabling -e (using the XSI extension "set +e") if it's set. +am__sh_e_setup = case $$- in *e*) set +e;; esac +# Default flags passed to test drivers. +am__common_driver_flags = \ + --color-tests "$$am__color_tests" \ + --enable-hard-errors "$$am__enable_hard_errors" \ + --expect-failure "$$am__expect_failure" +# To be inserted before the command running the test. Creates the +# directory for the log if needed. Stores in $dir the directory +# containing $f, in $tst the test, in $log the log. Executes the +# developer- defined test setup AM_TESTS_ENVIRONMENT (if any), and +# passes TESTS_ENVIRONMENT. Set up options for the wrapper that +# will run the test scripts (or their associated LOG_COMPILER, if +# thy have one). +am__check_pre = \ +$(am__sh_e_setup); \ +$(am__vpath_adj_setup) $(am__vpath_adj) \ +$(am__tty_colors); \ +srcdir=$(srcdir); export srcdir; \ +case "$@" in \ + */*) am__odir=`echo "./$@" | sed 's|/[^/]*$$||'`;; \ + *) am__odir=.;; \ +esac; \ +test "x$$am__odir" = x"." || test -d "$$am__odir" \ + || $(MKDIR_P) "$$am__odir" || exit $$?; \ +if test -f "./$$f"; then dir=./; \ +elif test -f "$$f"; then dir=; \ +else dir="$(srcdir)/"; fi; \ +tst=$$dir$$f; log='$@'; \ +if test -n '$(DISABLE_HARD_ERRORS)'; then \ + am__enable_hard_errors=no; \ +else \ + am__enable_hard_errors=yes; \ +fi; \ +case " $(XFAIL_TESTS) " in \ + *[\ \ ]$$f[\ \ ]* | *[\ \ ]$$dir$$f[\ \ ]*) \ + am__expect_failure=yes;; \ + *) \ + am__expect_failure=no;; \ +esac; \ +$(AM_TESTS_ENVIRONMENT) $(TESTS_ENVIRONMENT) +# A shell command to get the names of the tests scripts with any registered +# extension removed (i.e., equivalently, the names of the test logs, with +# the '.log' extension removed). The result is saved in the shell variable +# '$bases'. This honors runtime overriding of TESTS and TEST_LOGS. Sadly, +# we cannot use something simpler, involving e.g., "$(TEST_LOGS:.log=)", +# since that might cause problem with VPATH rewrites for suffix-less tests. +# See also 'test-harness-vpath-rewrite.sh' and 'test-trs-basic.sh'. +am__set_TESTS_bases = \ + bases='$(TEST_LOGS)'; \ + bases=`for i in $$bases; do echo $$i; done | sed 's/\.log$$//'`; \ + bases=`echo $$bases` +RECHECK_LOGS = $(TEST_LOGS) +AM_RECURSIVE_TARGETS = check recheck +TEST_SUITE_LOG = test-suite.log +TEST_EXTENSIONS = @EXEEXT@ .test +LOG_DRIVER = $(SHELL) $(top_srcdir)/build-aux/test-driver +LOG_COMPILE = $(LOG_COMPILER) $(AM_LOG_FLAGS) $(LOG_FLAGS) +am__set_b = \ + case '$@' in \ + */*) \ + case '$*' in \ + */*) b='$*';; \ + *) b=`echo '$@' | sed 's/\.log$$//'`; \ + esac;; \ + *) \ + b='$*';; \ + esac +am__test_logs1 = $(TESTS:=.log) +am__test_logs2 = $(am__test_logs1:@EXEEXT@.log=.log) +TEST_LOGS = $(am__test_logs2:.test.log=.log) +TEST_LOG_DRIVER = $(SHELL) $(top_srcdir)/build-aux/test-driver +TEST_LOG_COMPILE = $(TEST_LOG_COMPILER) $(AM_TEST_LOG_FLAGS) \ + $(TEST_LOG_FLAGS) am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.sources \ - $(srcdir)/libdrm_radeon.pc.in $(top_srcdir)/build-aux/depcomp + $(srcdir)/libdrm_radeon.pc.in $(top_srcdir)/build-aux/depcomp \ + $(top_srcdir)/build-aux/test-driver DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ADMIN_MAN_DIR = @ADMIN_MAN_DIR@ @@ -424,11 +602,12 @@ libdrm_radeonincludedir = ${includedir}/libdrm libdrm_radeoninclude_HEADERS = $(LIBDRM_RADEON_H_FILES) pkgconfig_DATA = libdrm_radeon.pc -EXTRA_DIST = Android.mk $(LIBDRM_RADEON_BOF_FILES) $(TESTS) +TESTS = radeon-symbol-check +EXTRA_DIST = $(LIBDRM_RADEON_BOF_FILES) $(TESTS) all: all-am .SUFFIXES: -.SUFFIXES: .c .lo .o .obj +.SUFFIXES: .c .lo .log .o .obj .test .test$(EXEEXT) .trs $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(srcdir)/Makefile.sources $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ @@ -634,6 +813,169 @@ distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags +# Recover from deleted '.trs' file; this should ensure that +# "rm -f foo.log; make foo.trs" re-run 'foo.test', and re-create +# both 'foo.log' and 'foo.trs'. Break the recipe in two subshells +# to avoid problems with "make -n". +.log.trs: + rm -f $< $@ + $(MAKE) $(AM_MAKEFLAGS) $< + +# Leading 'am--fnord' is there to ensure the list of targets does not +# expand to empty, as could happen e.g. with make check TESTS=''. +am--fnord $(TEST_LOGS) $(TEST_LOGS:.log=.trs): $(am__force_recheck) +am--force-recheck: + @: + +$(TEST_SUITE_LOG): $(TEST_LOGS) + @$(am__set_TESTS_bases); \ + am__f_ok () { test -f "$$1" && test -r "$$1"; }; \ + redo_bases=`for i in $$bases; do \ + am__f_ok $$i.trs && am__f_ok $$i.log || echo $$i; \ + done`; \ + if test -n "$$redo_bases"; then \ + redo_logs=`for i in $$redo_bases; do echo $$i.log; done`; \ + redo_results=`for i in $$redo_bases; do echo $$i.trs; done`; \ + if $(am__make_dryrun); then :; else \ + rm -f $$redo_logs && rm -f $$redo_results || exit 1; \ + fi; \ + fi; \ + if test -n "$$am__remaking_logs"; then \ + echo "fatal: making $(TEST_SUITE_LOG): possible infinite" \ + "recursion detected" >&2; \ + elif test -n "$$redo_logs"; then \ + am__remaking_logs=yes $(MAKE) $(AM_MAKEFLAGS) $$redo_logs; \ + fi; \ + if $(am__make_dryrun); then :; else \ + st=0; \ + errmsg="fatal: making $(TEST_SUITE_LOG): failed to create"; \ + for i in $$redo_bases; do \ + test -f $$i.trs && test -r $$i.trs \ + || { echo "$$errmsg $$i.trs" >&2; st=1; }; \ + test -f $$i.log && test -r $$i.log \ + || { echo "$$errmsg $$i.log" >&2; st=1; }; \ + done; \ + test $$st -eq 0 || exit 1; \ + fi + @$(am__sh_e_setup); $(am__tty_colors); $(am__set_TESTS_bases); \ + ws='[ ]'; \ + results=`for b in $$bases; do echo $$b.trs; done`; \ + test -n "$$results" || results=/dev/null; \ + all=` grep "^$$ws*:test-result:" $$results | wc -l`; \ + pass=` grep "^$$ws*:test-result:$$ws*PASS" $$results | wc -l`; \ + fail=` grep "^$$ws*:test-result:$$ws*FAIL" $$results | wc -l`; \ + skip=` grep "^$$ws*:test-result:$$ws*SKIP" $$results | wc -l`; \ + xfail=`grep "^$$ws*:test-result:$$ws*XFAIL" $$results | wc -l`; \ + xpass=`grep "^$$ws*:test-result:$$ws*XPASS" $$results | wc -l`; \ + error=`grep "^$$ws*:test-result:$$ws*ERROR" $$results | wc -l`; \ + if test `expr $$fail + $$xpass + $$error` -eq 0; then \ + success=true; \ + else \ + success=false; \ + fi; \ + br='==================='; br=$$br$$br$$br$$br; \ + result_count () \ + { \ + if test x"$$1" = x"--maybe-color"; then \ + maybe_colorize=yes; \ + elif test x"$$1" = x"--no-color"; then \ + maybe_colorize=no; \ + else \ + echo "$@: invalid 'result_count' usage" >&2; exit 4; \ + fi; \ + shift; \ + desc=$$1 count=$$2; \ + if test $$maybe_colorize = yes && test $$count -gt 0; then \ + color_start=$$3 color_end=$$std; \ + else \ + color_start= color_end=; \ + fi; \ + echo "$${color_start}# $$desc $$count$${color_end}"; \ + }; \ + create_testsuite_report () \ + { \ + result_count $$1 "TOTAL:" $$all "$$brg"; \ + result_count $$1 "PASS: " $$pass "$$grn"; \ + result_count $$1 "SKIP: " $$skip "$$blu"; \ + result_count $$1 "XFAIL:" $$xfail "$$lgn"; \ + result_count $$1 "FAIL: " $$fail "$$red"; \ + result_count $$1 "XPASS:" $$xpass "$$red"; \ + result_count $$1 "ERROR:" $$error "$$mgn"; \ + }; \ + { \ + echo "$(PACKAGE_STRING): $(subdir)/$(TEST_SUITE_LOG)" | \ + $(am__rst_title); \ + create_testsuite_report --no-color; \ + echo; \ + echo ".. contents:: :depth: 2"; \ + echo; \ + for b in $$bases; do echo $$b; done \ + | $(am__create_global_log); \ + } >$(TEST_SUITE_LOG).tmp || exit 1; \ + mv $(TEST_SUITE_LOG).tmp $(TEST_SUITE_LOG); \ + if $$success; then \ + col="$$grn"; \ + else \ + col="$$red"; \ + test x"$$VERBOSE" = x || cat $(TEST_SUITE_LOG); \ + fi; \ + echo "$${col}$$br$${std}"; \ + echo "$${col}Testsuite summary for $(PACKAGE_STRING)$${std}"; \ + echo "$${col}$$br$${std}"; \ + create_testsuite_report --maybe-color; \ + echo "$$col$$br$$std"; \ + if $$success; then :; else \ + echo "$${col}See $(subdir)/$(TEST_SUITE_LOG)$${std}"; \ + if test -n "$(PACKAGE_BUGREPORT)"; then \ + echo "$${col}Please report to $(PACKAGE_BUGREPORT)$${std}"; \ + fi; \ + echo "$$col$$br$$std"; \ + fi; \ + $$success || exit 1 + +check-TESTS: + @list='$(RECHECK_LOGS)'; test -z "$$list" || rm -f $$list + @list='$(RECHECK_LOGS:.log=.trs)'; test -z "$$list" || rm -f $$list + @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) + @set +e; $(am__set_TESTS_bases); \ + log_list=`for i in $$bases; do echo $$i.log; done`; \ + trs_list=`for i in $$bases; do echo $$i.trs; done`; \ + log_list=`echo $$log_list`; trs_list=`echo $$trs_list`; \ + $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) TEST_LOGS="$$log_list"; \ + exit $$?; +recheck: all + @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) + @set +e; $(am__set_TESTS_bases); \ + bases=`for i in $$bases; do echo $$i; done \ + | $(am__list_recheck_tests)` || exit 1; \ + log_list=`for i in $$bases; do echo $$i.log; done`; \ + log_list=`echo $$log_list`; \ + $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) \ + am__force_recheck=am--force-recheck \ + TEST_LOGS="$$log_list"; \ + exit $$? +radeon-symbol-check.log: radeon-symbol-check + @p='radeon-symbol-check'; \ + b='radeon-symbol-check'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +.test.log: + @p='$<'; \ + $(am__set_b); \ + $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +@am__EXEEXT_TRUE@.test$(EXEEXT).log: +@am__EXEEXT_TRUE@ @p='$<'; \ +@am__EXEEXT_TRUE@ $(am__set_b); \ +@am__EXEEXT_TRUE@ $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \ +@am__EXEEXT_TRUE@ --log-file $$b.log --trs-file $$b.trs \ +@am__EXEEXT_TRUE@ $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \ +@am__EXEEXT_TRUE@ "$$tst" $(AM_TESTS_FD_REDIRECT) + distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ @@ -665,6 +1007,7 @@ fi; \ done check-am: all-am + $(MAKE) $(AM_MAKEFLAGS) check-TESTS check: check-am all-am: Makefile $(LTLIBRARIES) $(DATA) $(HEADERS) installdirs: @@ -691,6 +1034,9 @@ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: + -test -z "$(TEST_LOGS)" || rm -f $(TEST_LOGS) + -test -z "$(TEST_LOGS:.log=.trs)" || rm -f $(TEST_LOGS:.log=.trs) + -test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) clean-generic: @@ -774,23 +1120,24 @@ uninstall-am: uninstall-libdrm_radeon_laLTLIBRARIES \ uninstall-libdrm_radeonincludeHEADERS uninstall-pkgconfigDATA -.MAKE: install-am install-strip +.MAKE: check-am install-am install-strip -.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \ - clean-libdrm_radeon_laLTLIBRARIES clean-libtool 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-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_radeon_laLTLIBRARIES \ +.PHONY: CTAGS GTAGS TAGS all all-am check check-TESTS check-am clean \ + clean-generic clean-libdrm_radeon_laLTLIBRARIES clean-libtool \ + 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-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_radeon_laLTLIBRARIES \ install-libdrm_radeonincludeHEADERS 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 tags-am uninstall uninstall-am \ - uninstall-libdrm_radeon_laLTLIBRARIES \ + pdf pdf-am ps ps-am recheck tags tags-am uninstall \ + uninstall-am uninstall-libdrm_radeon_laLTLIBRARIES \ uninstall-libdrm_radeonincludeHEADERS uninstall-pkgconfigDATA .PRECIOUS: Makefile diff -Nru libdrm-2.4.67/radeon/radeon_cs_gem.c libdrm-2.4.70/radeon/radeon_cs_gem.c --- libdrm-2.4.67/radeon/radeon_cs_gem.c 2015-09-09 14:06:56.000000000 +0000 +++ libdrm-2.4.70/radeon/radeon_cs_gem.c 2016-07-23 12:53:10.000000000 +0000 @@ -323,7 +323,7 @@ return -EPIPE; } if (cs->section_ndw != cs->section_cdw) { - fprintf(stderr, "CS section size missmatch start at (%s,%s,%d) %d vs %d\n", + fprintf(stderr, "CS section size mismatch start at (%s,%s,%d) %d vs %d\n", cs->section_file, cs->section_func, cs->section_line, cs->section_ndw, cs->section_cdw); fprintf(stderr, "CS section end at (%s,%s,%d)\n", file, func, line); diff -Nru libdrm-2.4.67/radeon/radeon_surface.c libdrm-2.4.70/radeon/radeon_surface.c --- libdrm-2.4.67/radeon/radeon_surface.c 2015-11-25 16:17:44.000000000 +0000 +++ libdrm-2.4.70/radeon/radeon_surface.c 2016-07-20 23:42:21.000000000 +0000 @@ -957,8 +957,10 @@ } surf->stencil_tile_split = 64; } else { - /* tile split must be >= 256 for colorbuffer surfaces */ - surf->tile_split = MAX2(surf->nsamples * surf->bpe * 64, 256); + /* tile split must be >= 256 for colorbuffer surfaces, + * SAMPLE_SPLIT = tile_split / (bpe * 64), the optimal value is 2 + */ + surf->tile_split = MAX2(2 * surf->bpe * 64, 256); if (surf->tile_split > 4096) surf->tile_split = 4096; } diff -Nru libdrm-2.4.67/RELEASING libdrm-2.4.70/RELEASING --- libdrm-2.4.67/RELEASING 2016-08-31 20:20:36.000000000 +0000 +++ libdrm-2.4.70/RELEASING 1970-01-01 00:00:00.000000000 +0000 @@ -1,65 +0,0 @@ -The release criteria for libdrm is essentially "if you need a release, -make one". There is no designated release engineer or maintainer. -Anybody is free to make a release if there's a certain feature or bug -fix they need in a released version of libdrm. - -When new ioctl definitions are merged into drm-next, we will add -support to libdrm, at which point we typically create a new release. -However, this is up to whoever is driving the feature in question. - -Follow these steps to release a new version of libdrm: - - 1) Ensure that there are no local, uncommitted/unpushed - modifications. You're probably in a good state if both "git diff - HEAD" and "git log master..origin/master" give no output. - - 2) Bump the version number in configure.ac. We seem to have settled - for 2.4.x as the versioning scheme for libdrm, so just bump the - micro version. - - 3) Run autoconf and then re-run ./configure so the build system - picks up the new version number. - - 4) (optional step, release.sh will make distcheck for you, but it can be - heart warming to verify that make distcheck passes) - - Verify that the code passes "make distcheck". Running "make - distcheck" should result in no warnings or errors and end with a - message of the form: - - ============================================= - libdrm-X.Y.Z archives ready for distribution: - libdrm-X.Y.Z.tar.gz - libdrm-X.Y.Z.tar.bz2 - ============================================= - - Make sure that the version number reported by distcheck and in - the tarball names matches the number you bumped to in configure.ac. - - 5) Commit the configure.ac change and make an annotated tag for that - commit with the version number of the release as the name and a - message of "libdrm X.Y.Z". For example, for the 2.4.16 release - the command is: - - git tag -a 2.4.16 -m "libdrm 2.4.16" - - 6) Push the commit and tag by saying - - git push --tags origin master - - assuming the remote for the upstream libdrm repo is called origin. - - 7) Use the release.sh script from the xorg/util/modular repo to - upload the tarballs to the freedesktop.org download area and - create an announce email template. The script takes one argument: - the path to the libdrm checkout. So, if a checkout of modular is - at the same level than the libdrm repo: - - ./modular/release.sh libdrm - - This copies the two tarballs to freedesktop.org and creates - libdrm-2.4.16.announce which has a detailed summary of the - changes, links to the tarballs, MD5 and SHA1 sums and pre-filled - out email headers. Fill out the blank between the email headers - and the list of changes with a brief message of what changed or - what prompted this release. Send out the email and you're done! diff -Nru libdrm-2.4.67/tests/amdgpu/basic_tests.c libdrm-2.4.70/tests/amdgpu/basic_tests.c --- libdrm-2.4.67/tests/amdgpu/basic_tests.c 2016-02-12 23:32:22.000000000 +0000 +++ libdrm-2.4.70/tests/amdgpu/basic_tests.c 2016-06-15 21:20:31.000000000 +0000 @@ -346,6 +346,7 @@ fence_status.context = context_handle; fence_status.ip_type = AMDGPU_HW_IP_GFX; + fence_status.ip_instance = 0; fence_status.fence = ibs_request.seq_no; r = amdgpu_cs_query_fence_status(&fence_status, @@ -427,6 +428,7 @@ fence_status.context = context_handle; fence_status.ip_type = AMDGPU_HW_IP_GFX; + fence_status.ip_instance = 0; fence_status.fence = ibs_request.seq_no; r = amdgpu_cs_query_fence_status(&fence_status, @@ -445,17 +447,17 @@ CU_ASSERT_EQUAL(r, 0); } -static void amdgpu_command_submission_cp_write_data(void) +static void amdgpu_command_submission_gfx_cp_write_data(void) { amdgpu_command_submission_write_linear_helper(AMDGPU_HW_IP_GFX); } -static void amdgpu_command_submission_cp_const_fill(void) +static void amdgpu_command_submission_gfx_cp_const_fill(void) { amdgpu_command_submission_const_fill_helper(AMDGPU_HW_IP_GFX); } -static void amdgpu_command_submission_cp_copy_data(void) +static void amdgpu_command_submission_gfx_cp_copy_data(void) { amdgpu_command_submission_copy_linear_helper(AMDGPU_HW_IP_GFX); } @@ -463,11 +465,11 @@ static void amdgpu_command_submission_gfx(void) { /* write data using the CP */ - amdgpu_command_submission_cp_write_data(); + amdgpu_command_submission_gfx_cp_write_data(); /* const fill using the CP */ - amdgpu_command_submission_cp_const_fill(); + amdgpu_command_submission_gfx_cp_const_fill(); /* copy data using the CP */ - amdgpu_command_submission_cp_copy_data(); + amdgpu_command_submission_gfx_cp_copy_data(); /* separate IB buffers for multi-IB submission */ amdgpu_command_submission_gfx_separate_ibs(); /* shared IB buffer for multi-IB submission */ @@ -541,6 +543,7 @@ fence_status.context = context_handle[0]; fence_status.ip_type = AMDGPU_HW_IP_GFX; + fence_status.ip_instance = 0; fence_status.fence = ibs_request[1].seq_no; r = amdgpu_cs_query_fence_status(&fence_status, 500000000, 0, &expired); @@ -581,6 +584,7 @@ fence_status.context = context_handle[1]; fence_status.ip_type = AMDGPU_HW_IP_GFX; + fence_status.ip_instance = 0; fence_status.fence = ibs_request[1].seq_no; r = amdgpu_cs_query_fence_status(&fence_status, 500000000, 0, &expired); @@ -602,7 +606,7 @@ CU_ASSERT_EQUAL(r, 0); } -static void amdgpu_command_submission_compute(void) +static void amdgpu_command_submission_compute_nop(void) { amdgpu_context_handle context_handle; amdgpu_bo_handle ib_result_handle; @@ -653,6 +657,7 @@ fence_status.context = context_handle; fence_status.ip_type = AMDGPU_HW_IP_COMPUTE; + fence_status.ip_instance = 0; fence_status.ring = instance; fence_status.fence = ibs_request.seq_no; @@ -673,6 +678,33 @@ CU_ASSERT_EQUAL(r, 0); } +static void amdgpu_command_submission_compute_cp_write_data(void) +{ + amdgpu_command_submission_write_linear_helper(AMDGPU_HW_IP_COMPUTE); +} + +static void amdgpu_command_submission_compute_cp_const_fill(void) +{ + amdgpu_command_submission_const_fill_helper(AMDGPU_HW_IP_COMPUTE); +} + +static void amdgpu_command_submission_compute_cp_copy_data(void) +{ + amdgpu_command_submission_copy_linear_helper(AMDGPU_HW_IP_COMPUTE); +} + +static void amdgpu_command_submission_compute(void) +{ + /* write data using the CP */ + amdgpu_command_submission_compute_cp_write_data(); + /* const fill using the CP */ + amdgpu_command_submission_compute_cp_const_fill(); + /* copy data using the CP */ + amdgpu_command_submission_compute_cp_copy_data(); + /* nop test */ + amdgpu_command_submission_compute_nop(); +} + /* * caller need create/release: * pm4_src, resources, ib_info, and ibs_request @@ -739,6 +771,7 @@ CU_ASSERT_EQUAL(r, 0); fence_status.ip_type = ip_type; + fence_status.ip_instance = 0; fence_status.ring = ibs_request->ring; fence_status.context = context_handle; fence_status.fence = ibs_request->seq_no; @@ -803,7 +836,7 @@ resources[0] = bo; - /* fullfill PM4: test DMA write-linear */ + /* fulfill PM4: test DMA write-linear */ i = j = 0; if (ip_type == AMDGPU_HW_IP_DMA) { pm4[i++] = SDMA_PACKET(SDMA_OPCODE_WRITE, @@ -813,7 +846,8 @@ pm4[i++] = sdma_write_length; while(j++ < sdma_write_length) pm4[i++] = 0xdeadbeaf; - } else if (ip_type == AMDGPU_HW_IP_GFX) { + } else if ((ip_type == AMDGPU_HW_IP_GFX) || + (ip_type == AMDGPU_HW_IP_COMPUTE)) { pm4[i++] = PACKET3(PACKET3_WRITE_DATA, 2 + sdma_write_length); pm4[i++] = WRITE_DATA_DST_SEL(5) | WR_CONFIRM; pm4[i++] = 0xfffffffc & bo_mc; @@ -902,7 +936,7 @@ resources[0] = bo; - /* fullfill PM4: test DMA const fill */ + /* fulfill PM4: test DMA const fill */ i = j = 0; if (ip_type == AMDGPU_HW_IP_DMA) { pm4[i++] = SDMA_PACKET(SDMA_OPCODE_CONSTANT_FILL, 0, @@ -911,7 +945,8 @@ pm4[i++] = (0xffffffff00000000 & bo_mc) >> 32; pm4[i++] = 0xdeadbeaf; pm4[i++] = sdma_write_length; - } else if (ip_type == AMDGPU_HW_IP_GFX) { + } else if ((ip_type == AMDGPU_HW_IP_GFX) || + (ip_type == AMDGPU_HW_IP_COMPUTE)) { pm4[i++] = PACKET3(PACKET3_DMA_DATA, 5); pm4[i++] = PACKET3_DMA_DATA_ENGINE(0) | PACKET3_DMA_DATA_DST_SEL(0) | @@ -1020,7 +1055,7 @@ resources[0] = bo1; resources[1] = bo2; - /* fullfill PM4: test DMA copy linear */ + /* fulfill PM4: test DMA copy linear */ i = j = 0; if (ip_type == AMDGPU_HW_IP_DMA) { pm4[i++] = SDMA_PACKET(SDMA_OPCODE_COPY, SDMA_COPY_SUB_OPCODE_LINEAR, 0); @@ -1030,7 +1065,8 @@ pm4[i++] = (0xffffffff00000000 & bo1_mc) >> 32; pm4[i++] = 0xffffffff & bo2_mc; pm4[i++] = (0xffffffff00000000 & bo2_mc) >> 32; - } else if (ip_type == AMDGPU_HW_IP_GFX) { + } else if ((ip_type == AMDGPU_HW_IP_GFX) || + (ip_type == AMDGPU_HW_IP_COMPUTE)) { pm4[i++] = PACKET3(PACKET3_DMA_DATA, 5); pm4[i++] = PACKET3_DMA_DATA_ENGINE(0) | PACKET3_DMA_DATA_DST_SEL(0) | diff -Nru libdrm-2.4.67/tests/amdgpu/cs_tests.c libdrm-2.4.70/tests/amdgpu/cs_tests.c --- libdrm-2.4.67/tests/amdgpu/cs_tests.c 2015-09-09 14:06:56.000000000 +0000 +++ libdrm-2.4.70/tests/amdgpu/cs_tests.c 2016-05-20 21:04:33.000000000 +0000 @@ -43,6 +43,8 @@ static uint32_t major_version; static uint32_t minor_version; static uint32_t family_id; +static uint32_t chip_rev; +static uint32_t chip_id; static amdgpu_context_handle context_handle; static amdgpu_bo_handle ib_handle; @@ -78,6 +80,9 @@ return CUE_SINIT_FAILED; family_id = device_handle->info.family_id; + /* VI asic POLARIS10/11 have specific external_rev_id */ + chip_rev = device_handle->info.chip_rev; + chip_id = device_handle->info.chip_external_rev; r = amdgpu_cs_ctx_create(device_handle, &context_handle); if (r) @@ -200,8 +205,17 @@ CU_ASSERT_EQUAL(r, 0); memcpy(msg, uvd_create_msg, sizeof(uvd_create_msg)); - if (family_id >= AMDGPU_FAMILY_VI) + if (family_id >= AMDGPU_FAMILY_VI) { ((uint8_t*)msg)[0x10] = 7; + /* chip polaris 10/11 */ + if (chip_id == chip_rev+0x50 || chip_id == chip_rev+0x5A) { + /* dpb size */ + ((uint8_t*)msg)[0x28] = 0x00; + ((uint8_t*)msg)[0x29] = 0x94; + ((uint8_t*)msg)[0x2A] = 0x6B; + ((uint8_t*)msg)[0x2B] = 0x00; + } + } r = amdgpu_bo_cpu_unmap(buf_handle); CU_ASSERT_EQUAL(r, 0); @@ -230,8 +244,8 @@ static void amdgpu_cs_uvd_decode(void) { - const unsigned dpb_size = 15923584, dt_size = 737280; - uint64_t msg_addr, fb_addr, bs_addr, dpb_addr, dt_addr, it_addr; + const unsigned dpb_size = 15923584, ctx_size = 5287680, dt_size = 737280; + uint64_t msg_addr, fb_addr, bs_addr, dpb_addr, ctx_addr, dt_addr, it_addr; struct amdgpu_bo_alloc_request req = {0}; amdgpu_bo_handle buf_handle; amdgpu_va_handle va_handle; @@ -266,9 +280,25 @@ r = amdgpu_bo_cpu_map(buf_handle, (void **)&ptr); CU_ASSERT_EQUAL(r, 0); - memcpy(ptr, uvd_decode_msg, sizeof(uvd_decode_msg)); - if (family_id >= AMDGPU_FAMILY_VI) + memcpy(ptr, uvd_decode_msg, sizeof(uvd_create_msg)); + if (family_id >= AMDGPU_FAMILY_VI) { ptr[0x10] = 7; + ptr[0x98] = 0x00; + ptr[0x99] = 0x02; + /* chip polaris10/11 */ + if (chip_id == chip_rev+0x50 || chip_id == chip_rev+0x5A) { + /*dpb size */ + ptr[0x24] = 0x00; + ptr[0x25] = 0x94; + ptr[0x26] = 0x6B; + ptr[0x27] = 0x00; + /*ctx size */ + ptr[0x2C] = 0x00; + ptr[0x2D] = 0xAF; + ptr[0x2E] = 0x50; + ptr[0x2F] = 0x00; + } + } ptr += 4*1024; memset(ptr, 0, 4*1024); @@ -298,6 +328,12 @@ } else bs_addr = fb_addr + 4*1024; dpb_addr = ALIGN(bs_addr + sizeof(uvd_bitstream), 4*1024); + + if ((family_id >= AMDGPU_FAMILY_VI) && + (chip_id == chip_rev+0x50 || chip_id == chip_rev+0x5A)) { + ctx_addr = ALIGN(dpb_addr + 0x006B9400, 4*1024); + } + dt_addr = ALIGN(dpb_addr + dpb_size, 4*1024); i = 0; @@ -306,8 +342,11 @@ uvd_cmd(dt_addr, 0x2, &i); uvd_cmd(fb_addr, 0x3, &i); uvd_cmd(bs_addr, 0x100, &i); - if (family_id >= AMDGPU_FAMILY_VI) + if (family_id >= AMDGPU_FAMILY_VI) { uvd_cmd(it_addr, 0x204, &i); + if (chip_id == chip_rev+0x50 || chip_id == chip_rev+0x5A) + uvd_cmd(ctx_addr, 0x206, &i); +} ib_cpu[i++] = 0x3BC6; ib_cpu[i++] = 0x1; for (; i % 16; ++i) diff -Nru libdrm-2.4.67/tests/amdgpu/vce_tests.c libdrm-2.4.70/tests/amdgpu/vce_tests.c --- libdrm-2.4.67/tests/amdgpu/vce_tests.c 2015-08-17 14:08:11.000000000 +0000 +++ libdrm-2.4.70/tests/amdgpu/vce_tests.c 2016-03-13 16:26:22.000000000 +0000 @@ -65,6 +65,7 @@ static uint32_t major_version; static uint32_t minor_version; static uint32_t family_id; +static uint32_t vce_harvest_config; static amdgpu_context_handle context_handle; static amdgpu_bo_handle ib_handle; @@ -97,6 +98,7 @@ return CUE_SINIT_FAILED; family_id = device_handle->info.family_id; + vce_harvest_config = device_handle->info.vce_harvest_config; r = amdgpu_cs_ctx_create(device_handle, &context_handle); if (r) @@ -440,14 +442,16 @@ check_result(&enc); /* two instances */ - enc.two_instance = true; - vce_taskinfo[2] = 0x83; - vce_taskinfo[4] = 1; - amdgpu_cs_vce_encode_idr(&enc); - vce_taskinfo[2] = 0xffffffff; - vce_taskinfo[4] = 2; - amdgpu_cs_vce_encode_p(&enc); - check_result(&enc); + if (vce_harvest_config == 0) { + enc.two_instance = true; + vce_taskinfo[2] = 0x83; + vce_taskinfo[4] = 1; + amdgpu_cs_vce_encode_idr(&enc); + vce_taskinfo[2] = 0xffffffff; + vce_taskinfo[4] = 2; + amdgpu_cs_vce_encode_p(&enc); + check_result(&enc); + } } else { vce_taskinfo[3] = 3; vce_encode[16] = 0; diff -Nru libdrm-2.4.67/tests/Android.mk libdrm-2.4.70/tests/Android.mk --- libdrm-2.4.67/tests/Android.mk 2016-08-31 20:20:36.000000000 +0000 +++ libdrm-2.4.70/tests/Android.mk 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -include $(call all-subdir-makefiles) diff -Nru libdrm-2.4.67/tests/auth.c libdrm-2.4.70/tests/auth.c --- libdrm-2.4.67/tests/auth.c 2016-08-31 20:20:36.000000000 +0000 +++ libdrm-2.4.70/tests/auth.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,138 +0,0 @@ -/* - * Copyright © 2007 Intel Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. - * - * Authors: - * Eric Anholt - * - */ - -#include -#include -#include "drmtest.h" - -enum auth_event { - SERVER_READY, - CLIENT_MAGIC, - CLIENT_DONE, -}; - -int commfd[2]; - -static void wait_event(int pipe, enum auth_event expected_event) -{ - int ret; - enum auth_event event; - unsigned char in; - - ret = read(commfd[pipe], &in, 1); - if (ret == -1) - err(1, "read error"); - event = in; - - if (event != expected_event) - errx(1, "unexpected event: %d\n", event); -} - -static void -send_event(int pipe, enum auth_event send_event) -{ - int ret; - unsigned char event; - - event = send_event; - ret = write(commfd[pipe], &event, 1); - if (ret == -1) - err(1, "failed to send event %d", event); -} - -static void client() -{ - struct drm_auth auth; - int drmfd, ret; - - /* XXX: Should make sure we open the same DRM as the master */ - wait_event(0, SERVER_READY); - - drmfd = drm_open_any(); - - /* Get a client magic number and pass it to the master for auth. */ - auth.magic = 0; /* Quiet valgrind */ - ret = ioctl(drmfd, DRM_IOCTL_GET_MAGIC, &auth); - if (ret == -1) - err(1, "Couldn't get client magic"); - send_event(0, CLIENT_MAGIC); - ret = write(commfd[0], &auth.magic, sizeof(auth.magic)); - if (ret == -1) - err(1, "Couldn't write auth data"); - - /* Signal that the client is completely done. */ - send_event(0, CLIENT_DONE); -} - -static void server() -{ - int drmfd, ret; - struct drm_auth auth; - - drmfd = drm_open_any_master(); - - auth.magic = 0xd0d0d0d0; - ret = ioctl(drmfd, DRM_IOCTL_AUTH_MAGIC, &auth); - if (ret != -1 || errno != EINVAL) - errx(1, "Authenticating bad magic succeeded\n"); - - send_event(1, SERVER_READY); - - wait_event(1, CLIENT_MAGIC); - ret = read(commfd[1], &auth.magic, sizeof(auth.magic)); - if (ret == -1) - err(1, "Failure to read client magic"); - - ret = ioctl(drmfd, DRM_IOCTL_AUTH_MAGIC, &auth); - if (ret == -1) - err(1, "Failure to authenticate client magic\n"); - - wait_event(1, CLIENT_DONE); -} - -/** - * Checks DRM authentication mechanisms. - */ -int main(int argc, char **argv) -{ - int ret; - - ret = pipe(commfd); - if (ret == -1) - err(1, "Couldn't create pipe"); - - ret = fork(); - if (ret == -1) - err(1, "failure to fork client"); - if (ret == 0) - client(); - else - server(); - - return 0; -} - diff -Nru libdrm-2.4.67/tests/drmdevice.c libdrm-2.4.70/tests/drmdevice.c --- libdrm-2.4.67/tests/drmdevice.c 2015-10-23 17:58:02.000000000 +0000 +++ libdrm-2.4.70/tests/drmdevice.c 2016-07-20 23:42:21.000000000 +0000 @@ -21,8 +21,10 @@ * */ +#include #include #include +#include #include #include #include @@ -44,8 +46,8 @@ if (device->bustype == DRM_BUS_PCI) { printf("\t\tpci\n"); printf("\t\t\tdomain\t%04x\n",device->businfo.pci->domain); - printf("\t\t\tbu\t%02x\n", device->businfo.pci->bus); - printf("\t\t\tde\t%02x\n", device->businfo.pci->dev); + printf("\t\t\tbus\t%02x\n", device->businfo.pci->bus); + printf("\t\t\tdev\t%02x\n", device->businfo.pci->dev); printf("\t\t\tfunc\t%1u\n", device->businfo.pci->func); printf("\tdeviceinfo\n"); @@ -93,12 +95,15 @@ for (int j = 0; j < DRM_NODE_MAX; j++) { if (devices[i]->available_nodes & 1 << j) { + printf("Opening device %d node %s\n", i, devices[i]->nodes[j]); fd = open(devices[i]->nodes[j], O_RDONLY | O_CLOEXEC, 0); - if (fd < 0) + if (fd < 0) { + printf("Failed - %s (%d)\n", strerror(errno), errno); continue; + } if (drmGetDevice(fd, &device) == 0) { - print_device_info(device, -1); + print_device_info(device, i); drmFreeDevice(&device); } close(fd); diff -Nru libdrm-2.4.67/tests/kms/kms-steal-crtc.c libdrm-2.4.70/tests/kms/kms-steal-crtc.c --- libdrm-2.4.67/tests/kms/kms-steal-crtc.c 2016-02-10 16:49:00.000000000 +0000 +++ libdrm-2.4.70/tests/kms/kms-steal-crtc.c 2016-04-21 13:40:06.000000000 +0000 @@ -29,6 +29,7 @@ #include #include #include +#include #include #include #ifdef HAVE_SYS_SELECT_H diff -Nru libdrm-2.4.67/tests/lock.c libdrm-2.4.70/tests/lock.c --- libdrm-2.4.67/tests/lock.c 2016-08-31 20:20:36.000000000 +0000 +++ libdrm-2.4.70/tests/lock.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,264 +0,0 @@ -/* - * Copyright © 2007 Intel Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. - * - * Authors: - * Eric Anholt - * - */ - -/** @file lock.c - * Tests various potential failures of the DRM locking mechanisms - */ - -#include -#include -#include "drmtest.h" - -enum auth_event { - SERVER_READY, - CLIENT_MAGIC, - SERVER_LOCKED, - CLIENT_LOCKED, -}; - -int commfd[2]; -unsigned int lock1 = 0x00001111; -unsigned int lock2 = 0x00002222; - -/* return time in milliseconds */ -static unsigned int -get_millis() -{ - struct timeval tv; - - gettimeofday(&tv, NULL); - return tv.tv_sec * 1000 + tv.tv_usec / 1000; -} - -static void -wait_event(int pipe, enum auth_event expected_event) -{ - int ret; - enum auth_event event; - unsigned char in; - - ret = read(commfd[pipe], &in, 1); - if (ret == -1) - err(1, "read error"); - event = in; - - if (event != expected_event) - errx(1, "unexpected event: %d\n", event); -} - -static void -send_event(int pipe, enum auth_event send_event) -{ - int ret; - unsigned char event; - - event = send_event; - ret = write(commfd[pipe], &event, 1); - if (ret == -1) - err(1, "failed to send event %d", event); -} - -static void -client_auth(int drmfd) -{ - struct drm_auth auth; - int ret; - - /* Get a client magic number and pass it to the master for auth. */ - ret = ioctl(drmfd, DRM_IOCTL_GET_MAGIC, &auth); - if (ret == -1) - err(1, "Couldn't get client magic"); - send_event(0, CLIENT_MAGIC); - ret = write(commfd[0], &auth.magic, sizeof(auth.magic)); - if (ret == -1) - err(1, "Couldn't write auth data"); -} - -static void -server_auth(int drmfd) -{ - struct drm_auth auth; - int ret; - - send_event(1, SERVER_READY); - wait_event(1, CLIENT_MAGIC); - ret = read(commfd[1], &auth.magic, sizeof(auth.magic)); - if (ret == -1) - err(1, "Failure to read client magic"); - - ret = ioctl(drmfd, DRM_IOCTL_AUTH_MAGIC, &auth); - if (ret == -1) - err(1, "Failure to authenticate client magic\n"); -} - -/** Tests that locking is successful in normal conditions */ -static void -test_lock_unlock(int drmfd) -{ - int ret; - - ret = drmGetLock(drmfd, lock1, 0); - if (ret != 0) - err(1, "Locking failed"); - ret = drmUnlock(drmfd, lock1); - if (ret != 0) - err(1, "Unlocking failed"); -} - -/** Tests that unlocking the lock while it's not held works correctly */ -static void -test_unlock_unlocked(int drmfd) -{ - int ret; - - ret = drmUnlock(drmfd, lock1); - if (ret == 0) - err(1, "Unlocking unlocked lock succeeded"); -} - -/** Tests that unlocking a lock held by another context fails appropriately */ -static void -test_unlock_unowned(int drmfd) -{ - int ret; - - ret = drmGetLock(drmfd, lock1, 0); - assert(ret == 0); - ret = drmUnlock(drmfd, lock2); - if (ret == 0) - errx(1, "Unlocking other context's lock succeeded"); - ret = drmUnlock(drmfd, lock1); - assert(ret == 0); -} - -/** - * Tests that an open/close by the same process doesn't result in the lock - * being dropped. - */ -static void test_open_close_locked(drmfd) -{ - int ret, tempfd; - - ret = drmGetLock(drmfd, lock1, 0); - assert(ret == 0); - /* XXX: Need to make sure that this is the same device as drmfd */ - tempfd = drm_open_any(); - close(tempfd); - ret = drmUnlock(drmfd, lock1); - if (ret != 0) - errx(1, "lock lost during open/close by same pid"); -} - -static void client() -{ - int drmfd, ret; - unsigned int time; - - wait_event(0, SERVER_READY); - - /* XXX: Should make sure we open the same DRM as the master */ - drmfd = drm_open_any(); - - client_auth(drmfd); - - /* Wait for the server to grab the lock, then grab it ourselves (to - * contest it). Hopefully we hit it within the window of when the - * server locks. - */ - wait_event(0, SERVER_LOCKED); - ret = drmGetLock(drmfd, lock2, 0); - time = get_millis(); - if (ret != 0) - err(1, "Failed to get lock on client\n"); - drmUnlock(drmfd, lock2); - - /* Tell the server that our locking completed, and when it did */ - send_event(0, CLIENT_LOCKED); - ret = write(commfd[0], &time, sizeof(time)); - - close(drmfd); - exit(0); -} - -static void server() -{ - int drmfd, tempfd, ret; - unsigned int client_time, unlock_time; - - drmfd = drm_open_any_master(); - - test_lock_unlock(drmfd); - test_unlock_unlocked(drmfd); - test_unlock_unowned(drmfd); - test_open_close_locked(drmfd); - - /* Perform the authentication sequence with the client. */ - server_auth(drmfd); - - /* Now, test that the client attempting to lock while the server - * holds the lock works correctly. - */ - ret = drmGetLock(drmfd, lock1, 0); - assert(ret == 0); - send_event(1, SERVER_LOCKED); - /* Wait a while for the client to do its thing */ - sleep(1); - ret = drmUnlock(drmfd, lock1); - assert(ret == 0); - unlock_time = get_millis(); - - wait_event(1, CLIENT_LOCKED); - ret = read(commfd[1], &client_time, sizeof(client_time)); - if (ret == -1) - err(1, "Failure to read client magic"); - - if (client_time < unlock_time) - errx(1, "Client took lock before server released it"); - - close(drmfd); -} - -int main(int argc, char **argv) -{ - int ret; - - - ret = pipe(commfd); - if (ret == -1) - err(1, "Couldn't create pipe"); - - ret = fork(); - if (ret == -1) - err(1, "failure to fork client"); - if (ret == 0) - client(); - else - server(); - - return 0; -} - diff -Nru libdrm-2.4.67/tests/modetest/Android.mk libdrm-2.4.70/tests/modetest/Android.mk --- libdrm-2.4.67/tests/modetest/Android.mk 2016-01-17 21:22:14.000000000 +0000 +++ libdrm-2.4.70/tests/modetest/Android.mk 1970-01-01 00:00:00.000000000 +0000 @@ -1,13 +0,0 @@ -LOCAL_PATH := $(call my-dir) - -include $(CLEAR_VARS) -include $(LOCAL_PATH)/Makefile.sources - -LOCAL_SRC_FILES := $(MODETEST_FILES) - -LOCAL_MODULE := modetest - -LOCAL_SHARED_LIBRARIES := libdrm -LOCAL_STATIC_LIBRARIES := libdrm_util - -include $(BUILD_EXECUTABLE) diff -Nru libdrm-2.4.67/tests/modetest/Makefile.am libdrm-2.4.70/tests/modetest/Makefile.am --- libdrm-2.4.67/tests/modetest/Makefile.am 2016-01-17 21:22:14.000000000 +0000 +++ libdrm-2.4.70/tests/modetest/Makefile.am 2016-07-23 12:53:10.000000000 +0000 @@ -22,5 +22,3 @@ $(top_builddir)/tests/util/libutil.la \ $(CAIRO_LIBS) \ -lpthread - -EXTRA_DIST = Android.mk diff -Nru libdrm-2.4.67/tests/modetest/Makefile.in libdrm-2.4.70/tests/modetest/Makefile.in --- libdrm-2.4.67/tests/modetest/Makefile.in 2016-02-15 18:24:01.000000000 +0000 +++ libdrm-2.4.70/tests/modetest/Makefile.in 2016-07-23 13:19:08.000000000 +0000 @@ -346,7 +346,6 @@ $(CAIRO_LIBS) \ -lpthread -EXTRA_DIST = Android.mk all: all-am .SUFFIXES: diff -Nru libdrm-2.4.67/tests/modetest/modetest.c libdrm-2.4.70/tests/modetest/modetest.c --- libdrm-2.4.67/tests/modetest/modetest.c 2016-02-10 16:49:00.000000000 +0000 +++ libdrm-2.4.70/tests/modetest/modetest.c 2016-04-21 13:40:06.000000000 +0000 @@ -314,6 +314,8 @@ printf("\t\tvalue:"); if (drm_property_type_is(prop, DRM_MODE_PROP_BLOB)) dump_blob(dev, value); + else if (drm_property_type_is(prop, DRM_MODE_PROP_SIGNED_RANGE)) + printf(" %"PRId64"\n", value); else printf(" %"PRIu64"\n", value); } diff -Nru libdrm-2.4.67/tests/proptest/Android.mk libdrm-2.4.70/tests/proptest/Android.mk --- libdrm-2.4.67/tests/proptest/Android.mk 2016-08-31 20:20:36.000000000 +0000 +++ libdrm-2.4.70/tests/proptest/Android.mk 1970-01-01 00:00:00.000000000 +0000 @@ -1,13 +0,0 @@ -LOCAL_PATH := $(call my-dir) - -include $(CLEAR_VARS) -include $(LOCAL_PATH)/Makefile.sources - -LOCAL_SRC_FILES := $(PROPTEST_FILES) - -LOCAL_MODULE := proptest - -LOCAL_SHARED_LIBRARIES := libdrm -LOCAL_STATIC_LIBRARIES := libdrm_util - -include $(BUILD_EXECUTABLE) diff -Nru libdrm-2.4.67/tests/proptest/proptest.c libdrm-2.4.70/tests/proptest/proptest.c --- libdrm-2.4.67/tests/proptest/proptest.c 2016-02-10 16:49:00.000000000 +0000 +++ libdrm-2.4.70/tests/proptest/proptest.c 2016-04-21 13:40:06.000000000 +0000 @@ -151,6 +151,8 @@ printf("\t\tvalue:"); if (drm_property_type_is(prop, DRM_MODE_PROP_BLOB)) dump_blob(value); + else if (drm_property_type_is(prop, DRM_MODE_PROP_SIGNED_RANGE)) + printf(" %"PRId64"\n", value); else printf(" %"PRIu64"\n", value); diff -Nru libdrm-2.4.67/tests/util/Android.mk libdrm-2.4.70/tests/util/Android.mk --- libdrm-2.4.67/tests/util/Android.mk 2016-08-31 20:20:36.000000000 +0000 +++ libdrm-2.4.70/tests/util/Android.mk 1970-01-01 00:00:00.000000000 +0000 @@ -1,39 +0,0 @@ -# -# Copyright © 2015 NVIDIA Corporation -# -# Permission is hereby granted, free of charge, to any person obtaining a -# copy of this software and associated documentation files (the "Software"), -# to deal in the Software without restriction, including without limitation -# the rights to use, copy, modify, merge, publish, distribute, sublicense, -# and/or sell copies of the Software, and to permit persons to whom the -# Software is furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice (including the next -# paragraph) shall be included in all copies or substantial portions of the -# Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -# IN THE SOFTWARE. -# - -LOCAL_PATH := $(call my-dir) - -include $(CLEAR_VARS) -include $(LOCAL_PATH)/Makefile.sources - -LOCAL_MODULE := libdrm_util -LOCAL_MODULE_TAGS := optional - -LOCAL_SHARED_LIBRARIES := libdrm - -LOCAL_SRC_FILES := $(UTIL_FILES) - -# avoid name clashes by requiring users to include util/*.h -LOCAL_EXPORT_C_INCLUDE_DIRS := $(dir $(LOCAL_PATH)) - -include $(BUILD_STATIC_LIBRARY) diff -Nru libdrm-2.4.67/tests/util/kms.c libdrm-2.4.70/tests/util/kms.c --- libdrm-2.4.67/tests/util/kms.c 2016-02-10 16:49:00.000000000 +0000 +++ libdrm-2.4.70/tests/util/kms.c 2016-04-21 13:40:06.000000000 +0000 @@ -141,6 +141,7 @@ "atmel-hlcdc", "fsl-dcu-drm", "vc4", + "virtio_gpu", }; int util_open(const char *device, const char *module) diff -Nru libdrm-2.4.67/util_double_list.h libdrm-2.4.70/util_double_list.h --- libdrm-2.4.67/util_double_list.h 2015-08-05 22:59:54.000000000 +0000 +++ libdrm-2.4.70/util_double_list.h 2016-07-20 23:42:21.000000000 +0000 @@ -98,6 +98,12 @@ #define LIST_ENTRY(__type, __item, __field) \ ((__type *)(((char *)(__item)) - offsetof(__type, __field))) +#define LIST_FIRST_ENTRY(__ptr, __type, __field) \ + LIST_ENTRY(__type, (__ptr)->next, __field) + +#define LIST_LAST_ENTRY(__ptr, __type, __field) \ + LIST_ENTRY(__type, (__ptr)->prev, __field) + #define LIST_IS_EMPTY(__list) \ ((__list)->next == (__list)) diff -Nru libdrm-2.4.67/xf86drm.c libdrm-2.4.70/xf86drm.c --- libdrm-2.4.67/xf86drm.c 2016-02-10 16:49:00.000000000 +0000 +++ libdrm-2.4.70/xf86drm.c 2016-07-20 23:42:21.000000000 +0000 @@ -1,5 +1,5 @@ /** - * \file xf86drm.c + * \file xf86drm.c * User-level interface to DRM device * * \author Rickard E. (Rik) Faith @@ -54,8 +54,11 @@ #include #include #include -#ifdef HAVE_SYS_MKDEV_H -# include /* defines major(), minor(), and makedev() on Solaris */ +#ifdef MAJOR_IN_MKDEV +#include +#endif +#ifdef MAJOR_IN_SYSMACROS +#include #endif #include @@ -70,13 +73,13 @@ #include "util_math.h" #ifdef __OpenBSD__ -#define DRM_PRIMARY_MINOR_NAME "drm" -#define DRM_CONTROL_MINOR_NAME "drmC" -#define DRM_RENDER_MINOR_NAME "drmR" +#define DRM_PRIMARY_MINOR_NAME "drm" +#define DRM_CONTROL_MINOR_NAME "drmC" +#define DRM_RENDER_MINOR_NAME "drmR" #else -#define DRM_PRIMARY_MINOR_NAME "card" -#define DRM_CONTROL_MINOR_NAME "controlD" -#define DRM_RENDER_MINOR_NAME "renderD" +#define DRM_PRIMARY_MINOR_NAME "card" +#define DRM_CONTROL_MINOR_NAME "controlD" +#define DRM_RENDER_MINOR_NAME "renderD" #endif #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__) @@ -96,7 +99,7 @@ #endif /* __OpenBSD__ */ #ifndef DRM_MAJOR -#define DRM_MAJOR 226 /* Linux */ +#define DRM_MAJOR 226 /* Linux */ #endif #define DRM_MSG_VERBOSITY 3 @@ -128,18 +131,18 @@ void drmMsg(const char *format, ...) { - va_list ap; + va_list ap; const char *env; if (((env = getenv("LIBGL_DEBUG")) && strstr(env, "verbose")) || (drm_server_info && drm_server_info->debug_print)) { - va_start(ap, format); - if (drm_server_info) { - drm_server_info->debug_print(format,ap); - } else { - drmDebugPrint(format, ap); - } - va_end(ap); + va_start(ap, format); + if (drm_server_info) { + drm_server_info->debug_print(format,ap); + } else { + drmDebugPrint(format, ap); + } + va_end(ap); } } @@ -166,10 +169,10 @@ int drmIoctl(int fd, unsigned long request, void *arg) { - int ret; + int ret; do { - ret = ioctl(fd, request, arg); + ret = ioctl(fd, request, arg); } while (ret == -1 && (errno == EINTR || errno == EAGAIN)); return ret; } @@ -190,16 +193,16 @@ drmHashEntry *entry; if (!drmHashTable) - drmHashTable = drmHashCreate(); + drmHashTable = drmHashCreate(); if (drmHashLookup(drmHashTable, key, &value)) { - entry = drmMalloc(sizeof(*entry)); - entry->fd = fd; - entry->f = NULL; - entry->tagTable = drmHashCreate(); - drmHashInsert(drmHashTable, key, entry); + entry = drmMalloc(sizeof(*entry)); + entry->fd = fd; + entry->f = NULL; + entry->tagTable = drmHashCreate(); + drmHashInsert(drmHashTable, key, entry); } else { - entry = value; + entry = value; } return entry; } @@ -221,41 +224,41 @@ { /* First, check if the IDs are exactly the same */ if (strcasecmp(id1, id2) == 0) - return 1; + return 1; /* Try to match old/new-style PCI bus IDs. */ if (strncasecmp(id1, "pci", 3) == 0) { - unsigned int o1, b1, d1, f1; - unsigned int o2, b2, d2, f2; - int ret; - - ret = sscanf(id1, "pci:%04x:%02x:%02x.%u", &o1, &b1, &d1, &f1); - if (ret != 4) { - o1 = 0; - ret = sscanf(id1, "PCI:%u:%u:%u", &b1, &d1, &f1); - if (ret != 3) - return 0; - } - - ret = sscanf(id2, "pci:%04x:%02x:%02x.%u", &o2, &b2, &d2, &f2); - if (ret != 4) { - o2 = 0; - ret = sscanf(id2, "PCI:%u:%u:%u", &b2, &d2, &f2); - if (ret != 3) - return 0; - } - - /* If domains aren't properly supported by the kernel interface, - * just ignore them, which sucks less than picking a totally random - * card with "open by name" - */ - if (!pci_domain_ok) - o1 = o2 = 0; - - if ((o1 != o2) || (b1 != b2) || (d1 != d2) || (f1 != f2)) - return 0; - else - return 1; + unsigned int o1, b1, d1, f1; + unsigned int o2, b2, d2, f2; + int ret; + + ret = sscanf(id1, "pci:%04x:%02x:%02x.%u", &o1, &b1, &d1, &f1); + if (ret != 4) { + o1 = 0; + ret = sscanf(id1, "PCI:%u:%u:%u", &b1, &d1, &f1); + if (ret != 3) + return 0; + } + + ret = sscanf(id2, "pci:%04x:%02x:%02x.%u", &o2, &b2, &d2, &f2); + if (ret != 4) { + o2 = 0; + ret = sscanf(id2, "PCI:%u:%u:%u", &b2, &d2, &f2); + if (ret != 3) + return 0; + } + + /* If domains aren't properly supported by the kernel interface, + * just ignore them, which sucks less than picking a totally random + * card with "open by name" + */ + if (!pci_domain_ok) + o1 = o2 = 0; + + if ((o1 != o2) || (b1 != b2) || (d1 != d2) || (f1 != f2)) + return 0; + else + return 1; } return 0; } @@ -277,18 +280,18 @@ #if !defined(UDEV) static int chown_check_return(const char *path, uid_t owner, gid_t group) { - int rv; + int rv; - do { - rv = chown(path, owner, group); - } while (rv != 0 && errno == EINTR); - - if (rv == 0) - return 0; - - drmMsg("Failed to change owner or group for file %s! %d: %s\n", - path, errno, strerror(errno)); - return -1; + do { + rv = chown(path, owner, group); + } while (rv != 0 && errno == EINTR); + + if (rv == 0) + return 0; + + drmMsg("Failed to change owner or group for file %s! %d: %s\n", + path, errno, strerror(errno)); + return -1; } #endif @@ -297,7 +300,7 @@ * * \param dev major and minor numbers of the device. * \param minor minor number of the device. - * + * * \return a file descriptor on success, or a negative value on error. * * \internal @@ -321,99 +324,99 @@ switch (type) { case DRM_NODE_PRIMARY: - dev_name = DRM_DEV_NAME; - break; + dev_name = DRM_DEV_NAME; + break; case DRM_NODE_CONTROL: - dev_name = DRM_CONTROL_DEV_NAME; - break; + dev_name = DRM_CONTROL_DEV_NAME; + break; case DRM_NODE_RENDER: - dev_name = DRM_RENDER_DEV_NAME; - break; + dev_name = DRM_RENDER_DEV_NAME; + break; default: - return -EINVAL; + return -EINVAL; }; sprintf(buf, dev_name, DRM_DIR_NAME, minor); drmMsg("drmOpenDevice: node name is %s\n", buf); if (drm_server_info && drm_server_info->get_perms) { - drm_server_info->get_perms(&serv_group, &serv_mode); - devmode = serv_mode ? serv_mode : DRM_DEV_MODE; - devmode &= ~(S_IXUSR|S_IXGRP|S_IXOTH); + drm_server_info->get_perms(&serv_group, &serv_mode); + devmode = serv_mode ? serv_mode : DRM_DEV_MODE; + devmode &= ~(S_IXUSR|S_IXGRP|S_IXOTH); } #if !defined(UDEV) if (stat(DRM_DIR_NAME, &st)) { - if (!isroot) - return DRM_ERR_NOT_ROOT; - mkdir(DRM_DIR_NAME, DRM_DEV_DIRMODE); - chown_check_return(DRM_DIR_NAME, 0, 0); /* root:root */ - chmod(DRM_DIR_NAME, DRM_DEV_DIRMODE); + if (!isroot) + return DRM_ERR_NOT_ROOT; + mkdir(DRM_DIR_NAME, DRM_DEV_DIRMODE); + chown_check_return(DRM_DIR_NAME, 0, 0); /* root:root */ + chmod(DRM_DIR_NAME, DRM_DEV_DIRMODE); } /* Check if the device node exists and create it if necessary. */ if (stat(buf, &st)) { - if (!isroot) - return DRM_ERR_NOT_ROOT; - remove(buf); - mknod(buf, S_IFCHR | devmode, dev); + if (!isroot) + return DRM_ERR_NOT_ROOT; + remove(buf); + mknod(buf, S_IFCHR | devmode, dev); } if (drm_server_info && drm_server_info->get_perms) { - group = ((int)serv_group >= 0) ? serv_group : DRM_DEV_GID; - chown_check_return(buf, user, group); - chmod(buf, devmode); + group = ((int)serv_group >= 0) ? serv_group : DRM_DEV_GID; + chown_check_return(buf, user, group); + chmod(buf, devmode); } #else /* if we modprobed then wait for udev */ { - int udev_count = 0; + int udev_count = 0; wait_for_udev: if (stat(DRM_DIR_NAME, &st)) { - usleep(20); - udev_count++; + usleep(20); + udev_count++; + + if (udev_count == 50) + return -1; + goto wait_for_udev; + } - if (udev_count == 50) - return -1; - goto wait_for_udev; - } - - if (stat(buf, &st)) { - usleep(20); - udev_count++; - - if (udev_count == 50) - return -1; - goto wait_for_udev; - } + if (stat(buf, &st)) { + usleep(20); + udev_count++; + + if (udev_count == 50) + return -1; + goto wait_for_udev; + } } #endif fd = open(buf, O_RDWR, 0); drmMsg("drmOpenDevice: open result is %d, (%s)\n", - fd, fd < 0 ? strerror(errno) : "OK"); + fd, fd < 0 ? strerror(errno) : "OK"); if (fd >= 0) - return fd; + return fd; #if !defined(UDEV) /* Check if the device node is not what we expect it to be, and recreate it * and try again if so. */ if (st.st_rdev != dev) { - if (!isroot) - return DRM_ERR_NOT_ROOT; - remove(buf); - mknod(buf, S_IFCHR | devmode, dev); - if (drm_server_info && drm_server_info->get_perms) { - chown_check_return(buf, user, group); - chmod(buf, devmode); - } + if (!isroot) + return DRM_ERR_NOT_ROOT; + remove(buf); + mknod(buf, S_IFCHR | devmode, dev); + if (drm_server_info && drm_server_info->get_perms) { + chown_check_return(buf, user, group); + chmod(buf, devmode); + } } fd = open(buf, O_RDWR, 0); drmMsg("drmOpenDevice: open result is %d, (%s)\n", - fd, fd < 0 ? strerror(errno) : "OK"); + fd, fd < 0 ? strerror(errno) : "OK"); if (fd >= 0) - return fd; + return fd; drmMsg("drmOpenDevice: Open failed\n"); remove(buf); @@ -429,7 +432,7 @@ * \param create allow to create the device if set. * * \return a file descriptor on success, or a negative value on error. - * + * * \internal * Calls drmOpenDevice() if \p create is set, otherwise assembles the device * name from \p minor and opens it. @@ -439,37 +442,37 @@ int fd; char buf[64]; const char *dev_name; - + if (create) - return drmOpenDevice(makedev(DRM_MAJOR, minor), minor, type); - + return drmOpenDevice(makedev(DRM_MAJOR, minor), minor, type); + switch (type) { case DRM_NODE_PRIMARY: - dev_name = DRM_DEV_NAME; - break; + dev_name = DRM_DEV_NAME; + break; case DRM_NODE_CONTROL: - dev_name = DRM_CONTROL_DEV_NAME; - break; + dev_name = DRM_CONTROL_DEV_NAME; + break; case DRM_NODE_RENDER: - dev_name = DRM_RENDER_DEV_NAME; - break; + dev_name = DRM_RENDER_DEV_NAME; + break; default: - return -EINVAL; + return -EINVAL; }; sprintf(buf, dev_name, DRM_DIR_NAME, minor); if ((fd = open(buf, O_RDWR, 0)) >= 0) - return fd; + return fd; return -errno; } /** * Determine whether the DRM kernel driver has been loaded. - * + * * \return 1 if the DRM driver is loaded, 0 otherwise. * - * \internal + * \internal * Determine the presence of the kernel driver by attempting to open the 0 * minor and get version information. For backward compatibility with older * Linux implementations, /proc/dri is also checked. @@ -482,16 +485,16 @@ if ((fd = drmOpenMinor(0, 1, DRM_NODE_PRIMARY)) < 0) { #ifdef __linux__ - /* Try proc for backward Linux compatibility */ - if (!access("/proc/dri/0", R_OK)) - return 1; + /* Try proc for backward Linux compatibility */ + if (!access("/proc/dri/0", R_OK)) + return 1; #endif - return 0; + return 0; } - + if ((version = drmGetVersion(fd))) { - retval = 1; - drmFreeVersion(version); + retval = 1; + drmFreeVersion(version); } close(fd); @@ -570,37 +573,37 @@ drmMsg("drmOpenByBusid: Searching for BusID %s\n", busid); for (i = base; i < base + DRM_MAX_MINOR; i++) { - fd = drmOpenMinor(i, 1, type); - drmMsg("drmOpenByBusid: drmOpenMinor returns %d\n", fd); - if (fd >= 0) { - /* We need to try for 1.4 first for proper PCI domain support - * and if that fails, we know the kernel is busted - */ - sv.drm_di_major = 1; - sv.drm_di_minor = 4; - sv.drm_dd_major = -1; /* Don't care */ - sv.drm_dd_minor = -1; /* Don't care */ - if (drmSetInterfaceVersion(fd, &sv)) { + fd = drmOpenMinor(i, 1, type); + drmMsg("drmOpenByBusid: drmOpenMinor returns %d\n", fd); + if (fd >= 0) { + /* We need to try for 1.4 first for proper PCI domain support + * and if that fails, we know the kernel is busted + */ + sv.drm_di_major = 1; + sv.drm_di_minor = 4; + sv.drm_dd_major = -1; /* Don't care */ + sv.drm_dd_minor = -1; /* Don't care */ + if (drmSetInterfaceVersion(fd, &sv)) { #ifndef __alpha__ - pci_domain_ok = 0; + pci_domain_ok = 0; #endif - sv.drm_di_major = 1; - sv.drm_di_minor = 1; - sv.drm_dd_major = -1; /* Don't care */ - sv.drm_dd_minor = -1; /* Don't care */ - drmMsg("drmOpenByBusid: Interface 1.4 failed, trying 1.1\n"); - drmSetInterfaceVersion(fd, &sv); - } - buf = drmGetBusid(fd); - drmMsg("drmOpenByBusid: drmGetBusid reports %s\n", buf); - if (buf && drmMatchBusID(buf, busid, pci_domain_ok)) { - drmFreeBusid(buf); - return fd; - } - if (buf) - drmFreeBusid(buf); - close(fd); - } + sv.drm_di_major = 1; + sv.drm_di_minor = 1; + sv.drm_dd_major = -1; /* Don't care */ + sv.drm_dd_minor = -1; /* Don't care */ + drmMsg("drmOpenByBusid: Interface 1.4 failed, trying 1.1\n"); + drmSetInterfaceVersion(fd, &sv); + } + buf = drmGetBusid(fd); + drmMsg("drmOpenByBusid: drmGetBusid reports %s\n", buf); + if (buf && drmMatchBusID(buf, busid, pci_domain_ok)) { + drmFreeBusid(buf); + return fd; + } + if (buf) + drmFreeBusid(buf); + close(fd); + } } return -1; } @@ -611,14 +614,14 @@ * * \param name driver name. * \param type the device node type. - * + * * \return a file descriptor on success, or a negative value on error. - * + * * \internal * This function opens the first minor number that matches the driver name and * isn't already in use. If it's in use it then it will already have a bus ID * assigned. - * + * * \sa drmOpenMinor(), drmGetVersion() and drmGetBusid(). */ static int drmOpenByName(const char *name, int type) @@ -637,56 +640,56 @@ * already in use. If it's in use it will have a busid assigned already. */ for (i = base; i < base + DRM_MAX_MINOR; i++) { - if ((fd = drmOpenMinor(i, 1, type)) >= 0) { - if ((version = drmGetVersion(fd))) { - if (!strcmp(version->name, name)) { - drmFreeVersion(version); - id = drmGetBusid(fd); - drmMsg("drmGetBusid returned '%s'\n", id ? id : "NULL"); - if (!id || !*id) { - if (id) - drmFreeBusid(id); - return fd; - } else { - drmFreeBusid(id); - } - } else { - drmFreeVersion(version); - } - } - close(fd); - } + if ((fd = drmOpenMinor(i, 1, type)) >= 0) { + if ((version = drmGetVersion(fd))) { + if (!strcmp(version->name, name)) { + drmFreeVersion(version); + id = drmGetBusid(fd); + drmMsg("drmGetBusid returned '%s'\n", id ? id : "NULL"); + if (!id || !*id) { + if (id) + drmFreeBusid(id); + return fd; + } else { + drmFreeBusid(id); + } + } else { + drmFreeVersion(version); + } + } + close(fd); + } } #ifdef __linux__ /* Backward-compatibility /proc support */ for (i = 0; i < 8; i++) { - char proc_name[64], buf[512]; - char *driver, *pt, *devstring; - int retcode; - - sprintf(proc_name, "/proc/dri/%d/name", i); - if ((fd = open(proc_name, 0, 0)) >= 0) { - retcode = read(fd, buf, sizeof(buf)-1); - close(fd); - if (retcode) { - buf[retcode-1] = '\0'; - for (driver = pt = buf; *pt && *pt != ' '; ++pt) - ; - if (*pt) { /* Device is next */ - *pt = '\0'; - if (!strcmp(driver, name)) { /* Match */ - for (devstring = ++pt; *pt && *pt != ' '; ++pt) - ; - if (*pt) { /* Found busid */ - return drmOpenByBusid(++pt, type); - } else { /* No busid */ - return drmOpenDevice(strtol(devstring, NULL, 0),i, type); - } - } - } - } - } + char proc_name[64], buf[512]; + char *driver, *pt, *devstring; + int retcode; + + sprintf(proc_name, "/proc/dri/%d/name", i); + if ((fd = open(proc_name, 0, 0)) >= 0) { + retcode = read(fd, buf, sizeof(buf)-1); + close(fd); + if (retcode) { + buf[retcode-1] = '\0'; + for (driver = pt = buf; *pt && *pt != ' '; ++pt) + ; + if (*pt) { /* Device is next */ + *pt = '\0'; + if (!strcmp(driver, name)) { /* Match */ + for (devstring = ++pt; *pt && *pt != ' '; ++pt) + ; + if (*pt) { /* Found busid */ + return drmOpenByBusid(++pt, type); + } else { /* No busid */ + return drmOpenDevice(strtol(devstring, NULL, 0),i, type); + } + } + } + } + } } #endif @@ -702,9 +705,9 @@ * * \param name driver name. Not referenced if bus ID is supplied. * \param busid bus ID. Zero if not known. - * + * * \return a file descriptor on success, or a negative value on error. - * + * * \internal * It calls drmOpenByBusid() if \p busid is specified or drmOpenByName() * otherwise. @@ -734,21 +737,21 @@ { if (!drmAvailable() && name != NULL && drm_server_info && drm_server_info->load_module) { - /* try to load the kernel module */ - if (!drm_server_info->load_module(name)) { - drmMsg("[drm] failed to load kernel module \"%s\"\n", name); - return -1; - } + /* try to load the kernel module */ + if (!drm_server_info->load_module(name)) { + drmMsg("[drm] failed to load kernel module \"%s\"\n", name); + return -1; + } } if (busid) { - int fd = drmOpenByBusid(busid, type); - if (fd >= 0) - return fd; + int fd = drmOpenByBusid(busid, type); + if (fd >= 0) + return fd; } - + if (name) - return drmOpenByName(name, type); + return drmOpenByName(name, type); return -1; } @@ -775,7 +778,7 @@ void drmFreeVersion(drmVersionPtr v) { if (!v) - return; + return; drmFree(v->name); drmFree(v->date); drmFree(v->desc); @@ -795,7 +798,7 @@ static void drmFreeKernelVersion(drm_version_t *v) { if (!v) - return; + return; drmFree(v->name); drmFree(v->date); drmFree(v->desc); @@ -805,10 +808,10 @@ /** * Copy version information. - * + * * \param d destination pointer. * \param s source pointer. - * + * * \internal * Used by drmGetVersion() to translate the information returned by the ioctl * interface in a private structure into the public structure counterpart. @@ -831,12 +834,12 @@ * Query the driver version information. * * \param fd file descriptor. - * + * * \return pointer to a drmVersion structure which should be freed with * drmFreeVersion(). - * + * * \note Similar information is available via /proc/dri. - * + * * \internal * It gets the version information via successive DRM_IOCTL_VERSION ioctls, * first with zeros to get the string lengths, and then the actually strings. @@ -850,21 +853,21 @@ memclear(*version); if (drmIoctl(fd, DRM_IOCTL_VERSION, version)) { - drmFreeKernelVersion(version); - return NULL; + drmFreeKernelVersion(version); + return NULL; } if (version->name_len) - version->name = drmMalloc(version->name_len + 1); + version->name = drmMalloc(version->name_len + 1); if (version->date_len) - version->date = drmMalloc(version->date_len + 1); + version->date = drmMalloc(version->date_len + 1); if (version->desc_len) - version->desc = drmMalloc(version->desc_len + 1); + version->desc = drmMalloc(version->desc_len + 1); if (drmIoctl(fd, DRM_IOCTL_VERSION, version)) { - drmMsg("DRM_IOCTL_VERSION: %s\n", strerror(errno)); - drmFreeKernelVersion(version); - return NULL; + drmMsg("DRM_IOCTL_VERSION: %s\n", strerror(errno)); + drmFreeKernelVersion(version); + return NULL; } /* The results might not be null-terminated strings, so terminate them. */ @@ -881,13 +884,13 @@ /** * Get version information for the DRM user space library. - * + * * This version number is driver independent. - * + * * \param fd file descriptor. * * \return version information. - * + * * \internal * This function allocates and fills a drm_version structure with a hard coded * version number. @@ -915,29 +918,29 @@ int drmGetCap(int fd, uint64_t capability, uint64_t *value) { - struct drm_get_cap cap; - int ret; + struct drm_get_cap cap; + int ret; - memclear(cap); - cap.capability = capability; + memclear(cap); + cap.capability = capability; - ret = drmIoctl(fd, DRM_IOCTL_GET_CAP, &cap); - if (ret) - return ret; + ret = drmIoctl(fd, DRM_IOCTL_GET_CAP, &cap); + if (ret) + return ret; - *value = cap.value; - return 0; + *value = cap.value; + return 0; } int drmSetClientCap(int fd, uint64_t capability, uint64_t value) { - struct drm_set_client_cap cap; + struct drm_set_client_cap cap; - memclear(cap); - cap.capability = capability; - cap.value = value; + memclear(cap); + cap.capability = capability; + cap.value = value; - return drmIoctl(fd, DRM_IOCTL_SET_CLIENT_CAP, &cap); + return drmIoctl(fd, DRM_IOCTL_SET_CLIENT_CAP, &cap); } /** @@ -973,10 +976,10 @@ memclear(u); if (drmIoctl(fd, DRM_IOCTL_GET_UNIQUE, &u)) - return NULL; + return NULL; u.unique = drmMalloc(u.unique_len + 1); if (drmIoctl(fd, DRM_IOCTL_GET_UNIQUE, &u)) - return NULL; + return NULL; u.unique[u.unique_len] = '\0'; return u.unique; @@ -1004,7 +1007,7 @@ u.unique_len = strlen(busid); if (drmIoctl(fd, DRM_IOCTL_SET_UNIQUE, &u)) { - return -errno; + return -errno; } return 0; } @@ -1017,7 +1020,7 @@ *magic = 0; if (drmIoctl(fd, DRM_IOCTL_GET_MAGIC, &auth)) - return -errno; + return -errno; *magic = auth.magic; return 0; } @@ -1029,7 +1032,7 @@ memclear(auth); auth.magic = magic; if (drmIoctl(fd, DRM_IOCTL_AUTH_MAGIC, &auth)) - return -errno; + return -errno; return 0; } @@ -1045,7 +1048,7 @@ * \param flags combination of several flags to modify the function actions. * \param handle will be set to a value that may be used as the offset * parameter for mmap(). - * + * * \return zero on success or a negative value on error. * * \par Mapping the frame buffer @@ -1056,7 +1059,7 @@ * * \par * The area mapped will be uncached. If MTRR support is available in the - * kernel, the frame buffer area will be set to write combining. + * kernel, the frame buffer area will be set to write combining. * * \par Mapping the MMIO register area * For the MMIO register area, @@ -1064,19 +1067,19 @@ * - \p size will be the size of the register area bytes, and * - \p type will be DRM_REGISTERS. * \par - * The area mapped will be uncached. - * + * The area mapped will be uncached. + * * \par Mapping the SAREA * For the SAREA, * - \p offset will be ignored and should be set to zero, * - \p size will be the desired size of the SAREA in bytes, * - \p type will be DRM_SHM. - * + * * \par * A shared memory area of the requested size will be created and locked in * kernel memory. This area may be mapped into client-space by using the handle - * returned. - * + * returned. + * * \note May only be called by root. * * \internal @@ -1084,7 +1087,7 @@ * the arguments in a drm_map structure. */ int drmAddMap(int fd, drm_handle_t offset, drmSize size, drmMapType type, - drmMapFlags flags, drm_handle_t *handle) + drmMapFlags flags, drm_handle_t *handle) { drm_map_t map; @@ -1094,9 +1097,9 @@ map.type = type; map.flags = flags; if (drmIoctl(fd, DRM_IOCTL_ADD_MAP, &map)) - return -errno; + return -errno; if (handle) - *handle = (drm_handle_t)(uintptr_t)map.handle; + *handle = (drm_handle_t)(uintptr_t)map.handle; return 0; } @@ -1108,18 +1111,18 @@ map.handle = (void *)(uintptr_t)handle; if(drmIoctl(fd, DRM_IOCTL_RM_MAP, &map)) - return -errno; + return -errno; return 0; } /** * Make buffers available for DMA transfers. - * + * * \param fd file descriptor. * \param count number of buffers. * \param size size of each buffer. * \param flags buffer allocation flags. - * \param agp_offset offset in the AGP aperture + * \param agp_offset offset in the AGP aperture * * \return number of buffers allocated, negative on error. * @@ -1129,7 +1132,7 @@ * \sa drm_buf_desc. */ int drmAddBufs(int fd, int count, int size, drmBufDescFlags flags, - int agp_offset) + int agp_offset) { drm_buf_desc_t request; @@ -1140,7 +1143,7 @@ request.agp_start = agp_offset; if (drmIoctl(fd, DRM_IOCTL_ADD_BUFS, &request)) - return -errno; + return -errno; return request.count; } @@ -1152,28 +1155,28 @@ memclear(info); if (drmIoctl(fd, DRM_IOCTL_INFO_BUFS, &info)) - return -EINVAL; + return -EINVAL; if (!info.count) - return -EINVAL; + return -EINVAL; if (!(info.list = drmMalloc(info.count * sizeof(*info.list)))) - return -ENOMEM; + return -ENOMEM; if (drmIoctl(fd, DRM_IOCTL_INFO_BUFS, &info)) { - int retval = -errno; - drmFree(info.list); - return retval; + int retval = -errno; + drmFree(info.list); + return retval; } for (i = 0; i < info.count; i++) { - info.list[i].low_mark = low * info.list[i].count; - info.list[i].high_mark = high * info.list[i].count; - if (drmIoctl(fd, DRM_IOCTL_MARK_BUFS, &info.list[i])) { - int retval = -errno; - drmFree(info.list); - return retval; - } + info.list[i].low_mark = low * info.list[i].count; + info.list[i].high_mark = high * info.list[i].count; + if (drmIoctl(fd, DRM_IOCTL_MARK_BUFS, &info.list[i])) { + int retval = -errno; + drmFree(info.list); + return retval; + } } drmFree(info.list); @@ -1188,9 +1191,9 @@ * \param list list of buffers to be freed. * * \return zero on success, or a negative value on failure. - * + * * \note This function is primarily used for debugging. - * + * * \internal * This function is a wrapper around the DRM_IOCTL_FREE_BUFS ioctl, passing * the arguments in a drm_buf_free structure. @@ -1203,7 +1206,7 @@ request.count = count; request.list = list; if (drmIoctl(fd, DRM_IOCTL_FREE_BUFS, &request)) - return -errno; + return -errno; return 0; } @@ -1243,7 +1246,7 @@ * begins. * * \return zero on success, or a negative value on failure. - * + * * \internal * This function is a wrapper for mmap(). */ @@ -1252,16 +1255,16 @@ static unsigned long pagesize_mask = 0; if (fd < 0) - return -EINVAL; + return -EINVAL; if (!pagesize_mask) - pagesize_mask = getpagesize() - 1; + pagesize_mask = getpagesize() - 1; size = (size + pagesize_mask) & ~pagesize_mask; *address = drm_mmap(0, size, PROT_READ|PROT_WRITE, MAP_SHARED, fd, handle); if (*address == MAP_FAILED) - return -errno; + return -errno; return 0; } @@ -1271,7 +1274,7 @@ * * \param address address as given by drmMap(). * \param size size in bytes. Must match the size used by drmMap(). - * + * * \return zero on success, or a negative value on failure. * * \internal @@ -1291,28 +1294,28 @@ memclear(info); if (drmIoctl(fd, DRM_IOCTL_INFO_BUFS, &info)) - return NULL; + return NULL; if (info.count) { - if (!(info.list = drmMalloc(info.count * sizeof(*info.list)))) - return NULL; + if (!(info.list = drmMalloc(info.count * sizeof(*info.list)))) + return NULL; + + if (drmIoctl(fd, DRM_IOCTL_INFO_BUFS, &info)) { + drmFree(info.list); + return NULL; + } - if (drmIoctl(fd, DRM_IOCTL_INFO_BUFS, &info)) { - drmFree(info.list); - return NULL; - } - - retval = drmMalloc(sizeof(*retval)); - retval->count = info.count; - retval->list = drmMalloc(info.count * sizeof(*retval->list)); - for (i = 0; i < info.count; i++) { - retval->list[i].count = info.list[i].count; - retval->list[i].size = info.list[i].size; - retval->list[i].low_mark = info.list[i].low_mark; - retval->list[i].high_mark = info.list[i].high_mark; - } - drmFree(info.list); - return retval; + retval = drmMalloc(sizeof(*retval)); + retval->count = info.count; + retval->list = drmMalloc(info.count * sizeof(*retval->list)); + for (i = 0; i < info.count; i++) { + retval->list[i].count = info.list[i].count; + retval->list[i].size = info.list[i].size; + retval->list[i].low_mark = info.list[i].low_mark; + retval->list[i].high_mark = info.list[i].high_mark; + } + drmFree(info.list); + return retval; } return NULL; } @@ -1326,12 +1329,12 @@ * * \note The client may not use these buffers until obtaining buffer indices * with drmDMA(). - * + * * \internal * This function calls the DRM_IOCTL_MAP_BUFS ioctl and copies the returned * information about the buffers in a drm_buf_map structure into the * client-visible data structures. - */ + */ drmBufMapPtr drmMapBufs(int fd) { drm_buf_map_t bufs; @@ -1340,32 +1343,31 @@ memclear(bufs); if (drmIoctl(fd, DRM_IOCTL_MAP_BUFS, &bufs)) - return NULL; + return NULL; if (!bufs.count) - return NULL; + return NULL; + + if (!(bufs.list = drmMalloc(bufs.count * sizeof(*bufs.list)))) + return NULL; + + if (drmIoctl(fd, DRM_IOCTL_MAP_BUFS, &bufs)) { + drmFree(bufs.list); + return NULL; + } - if (!(bufs.list = drmMalloc(bufs.count * sizeof(*bufs.list)))) - return NULL; + retval = drmMalloc(sizeof(*retval)); + retval->count = bufs.count; + retval->list = drmMalloc(bufs.count * sizeof(*retval->list)); + for (i = 0; i < bufs.count; i++) { + retval->list[i].idx = bufs.list[i].idx; + retval->list[i].total = bufs.list[i].total; + retval->list[i].used = 0; + retval->list[i].address = bufs.list[i].address; + } - if (drmIoctl(fd, DRM_IOCTL_MAP_BUFS, &bufs)) { - drmFree(bufs.list); - return NULL; - } - - retval = drmMalloc(sizeof(*retval)); - retval->count = bufs.count; - retval->list = drmMalloc(bufs.count * sizeof(*retval->list)); - for (i = 0; i < bufs.count; i++) { - retval->list[i].idx = bufs.list[i].idx; - retval->list[i].total = bufs.list[i].total; - retval->list[i].used = 0; - retval->list[i].address = bufs.list[i].address; - } - - drmFree(bufs.list); - - return retval; + drmFree(bufs.list); + return retval; } @@ -1383,24 +1385,23 @@ int i; for (i = 0; i < bufs->count; i++) { - drm_munmap(bufs->list[i].address, bufs->list[i].total); + drm_munmap(bufs->list[i].address, bufs->list[i].total); } drmFree(bufs->list); drmFree(bufs); - return 0; } -#define DRM_DMA_RETRY 16 +#define DRM_DMA_RETRY 16 /** * Reserve DMA buffers. * * \param fd file descriptor. - * \param request - * + * \param request + * * \return zero on success, or a negative value on failure. * * \internal @@ -1424,14 +1425,14 @@ dma.granted_count = 0; do { - ret = ioctl( fd, DRM_IOCTL_DMA, &dma ); + ret = ioctl( fd, DRM_IOCTL_DMA, &dma ); } while ( ret && errno == EAGAIN && i++ < DRM_DMA_RETRY ); if ( ret == 0 ) { - request->granted_count = dma.granted_count; - return 0; + request->granted_count = dma.granted_count; + return 0; } else { - return -errno; + return -errno; } } @@ -1443,9 +1444,9 @@ * \param context context. * \param flags flags that determine the sate of the hardware when the function * returns. - * + * * \return always zero. - * + * * \internal * This function translates the arguments into a drm_lock structure and issue * the DRM_IOCTL_LOCK ioctl until the lock is successfully acquired. @@ -1465,7 +1466,7 @@ if (flags & DRM_HALT_CUR_QUEUES) lock.flags |= _DRM_HALT_CUR_QUEUES; while (drmIoctl(fd, DRM_IOCTL_LOCK, &lock)) - ; + ; return 0; } @@ -1474,9 +1475,9 @@ * * \param fd file descriptor. * \param context context. - * + * * \return zero on success, or a negative value on failure. - * + * * \internal * This function is a wrapper around the DRM_IOCTL_UNLOCK ioctl, passing the * argument in a drm_lock structure. @@ -1499,24 +1500,24 @@ memclear(res); if (drmIoctl(fd, DRM_IOCTL_RES_CTX, &res)) - return NULL; + return NULL; if (!res.count) - return NULL; + return NULL; if (!(list = drmMalloc(res.count * sizeof(*list)))) - return NULL; + return NULL; if (!(retval = drmMalloc(res.count * sizeof(*retval)))) { - drmFree(list); - return NULL; + drmFree(list); + return NULL; } res.contexts = list; if (drmIoctl(fd, DRM_IOCTL_RES_CTX, &res)) - return NULL; + return NULL; for (i = 0; i < res.count; i++) - retval[i] = list[i].handle; + retval[i] = list[i].handle; drmFree(list); *count = res.count; @@ -1537,11 +1538,11 @@ * \param fd file descriptor. * \param handle is set on success. To be used by the client when requesting DMA * dispatch with drmDMA(). - * + * * \return zero on success, or a negative value on failure. - * + * * \note May only be called by root. - * + * * \internal * This function is a wrapper around the DRM_IOCTL_ADD_CTX ioctl, passing the * argument in a drm_ctx structure. @@ -1552,7 +1553,7 @@ memclear(ctx); if (drmIoctl(fd, DRM_IOCTL_ADD_CTX, &ctx)) - return -errno; + return -errno; *handle = ctx.handle; return 0; } @@ -1564,7 +1565,7 @@ memclear(ctx); ctx.handle = context; if (drmIoctl(fd, DRM_IOCTL_SWITCH_CTX, &ctx)) - return -errno; + return -errno; return 0; } @@ -1581,11 +1582,11 @@ memclear(ctx); ctx.handle = context; if (flags & DRM_CONTEXT_PRESERVED) - ctx.flags |= _DRM_CONTEXT_PRESERVED; + ctx.flags |= _DRM_CONTEXT_PRESERVED; if (flags & DRM_CONTEXT_2DONLY) - ctx.flags |= _DRM_CONTEXT_2DONLY; + ctx.flags |= _DRM_CONTEXT_2DONLY; if (drmIoctl(fd, DRM_IOCTL_MOD_CTX, &ctx)) - return -errno; + return -errno; return 0; } @@ -1597,12 +1598,12 @@ memclear(ctx); ctx.handle = context; if (drmIoctl(fd, DRM_IOCTL_GET_CTX, &ctx)) - return -errno; + return -errno; *flags = 0; if (ctx.flags & _DRM_CONTEXT_PRESERVED) - *flags |= DRM_CONTEXT_PRESERVED; + *flags |= DRM_CONTEXT_PRESERVED; if (ctx.flags & _DRM_CONTEXT_2DONLY) - *flags |= DRM_CONTEXT_2DONLY; + *flags |= DRM_CONTEXT_2DONLY; return 0; } @@ -1611,14 +1612,14 @@ * * Free any kernel-level resources allocated with drmCreateContext() associated * with the context. - * + * * \param fd file descriptor. * \param handle handle given by drmCreateContext(). - * + * * \return zero on success, or a negative value on failure. - * + * * \note May only be called by root. - * + * * \internal * This function is a wrapper around the DRM_IOCTL_RM_CTX ioctl, passing the * argument in a drm_ctx structure. @@ -1630,7 +1631,7 @@ memclear(ctx); ctx.handle = handle; if (drmIoctl(fd, DRM_IOCTL_RM_CTX, &ctx)) - return -errno; + return -errno; return 0; } @@ -1640,7 +1641,7 @@ memclear(draw); if (drmIoctl(fd, DRM_IOCTL_ADD_DRAW, &draw)) - return -errno; + return -errno; *handle = draw.handle; return 0; } @@ -1652,13 +1653,13 @@ memclear(draw); draw.handle = handle; if (drmIoctl(fd, DRM_IOCTL_RM_DRAW, &draw)) - return -errno; + return -errno; return 0; } int drmUpdateDrawableInfo(int fd, drm_drawable_t handle, - drm_drawable_info_type_t type, unsigned int num, - void *data) + drm_drawable_info_type_t type, unsigned int num, + void *data) { drm_update_draw_t update; @@ -1669,7 +1670,7 @@ update.data = (unsigned long long)(unsigned long)data; if (drmIoctl(fd, DRM_IOCTL_UPDATE_DRAW, &update)) - return -errno; + return -errno; return 0; } @@ -1680,16 +1681,16 @@ * Must be called before any of the other AGP related calls. * * \param fd file descriptor. - * + * * \return zero on success, or a negative value on failure. - * + * * \internal * This function is a wrapper around the DRM_IOCTL_AGP_ACQUIRE ioctl. */ int drmAgpAcquire(int fd) { if (drmIoctl(fd, DRM_IOCTL_AGP_ACQUIRE, NULL)) - return -errno; + return -errno; return 0; } @@ -1698,16 +1699,16 @@ * Release the AGP device. * * \param fd file descriptor. - * + * * \return zero on success, or a negative value on failure. - * + * * \internal * This function is a wrapper around the DRM_IOCTL_AGP_RELEASE ioctl. */ int drmAgpRelease(int fd) { if (drmIoctl(fd, DRM_IOCTL_AGP_RELEASE, NULL)) - return -errno; + return -errno; return 0; } @@ -1717,9 +1718,9 @@ * * \param fd file descriptor. * \param mode AGP mode. - * + * * \return zero on success, or a negative value on failure. - * + * * \internal * This function is a wrapper around the DRM_IOCTL_AGP_ENABLE ioctl, passing the * argument in a drm_agp_mode structure. @@ -1731,7 +1732,7 @@ memclear(m); m.mode = mode; if (drmIoctl(fd, DRM_IOCTL_AGP_ENABLE, &m)) - return -errno; + return -errno; return 0; } @@ -1745,15 +1746,15 @@ * \param address if not zero, will be set to the physical address of the * allocated memory. * \param handle on success will be set to a handle of the allocated memory. - * + * * \return zero on success, or a negative value on failure. - * + * * \internal * This function is a wrapper around the DRM_IOCTL_AGP_ALLOC ioctl, passing the * arguments in a drm_agp_buffer structure. */ int drmAgpAlloc(int fd, unsigned long size, unsigned long type, - unsigned long *address, drm_handle_t *handle) + unsigned long *address, drm_handle_t *handle) { drm_agp_buffer_t b; @@ -1762,9 +1763,9 @@ b.size = size; b.type = type; if (drmIoctl(fd, DRM_IOCTL_AGP_ALLOC, &b)) - return -errno; + return -errno; if (address != 0UL) - *address = b.physical; + *address = b.physical; *handle = b.handle; return 0; } @@ -1775,9 +1776,9 @@ * * \param fd file descriptor. * \param handle handle to the allocated memory, as given by drmAgpAllocate(). - * + * * \return zero on success, or a negative value on failure. - * + * * \internal * This function is a wrapper around the DRM_IOCTL_AGP_FREE ioctl, passing the * argument in a drm_agp_buffer structure. @@ -1789,7 +1790,7 @@ memclear(b); b.handle = handle; if (drmIoctl(fd, DRM_IOCTL_AGP_FREE, &b)) - return -errno; + return -errno; return 0; } @@ -1800,9 +1801,9 @@ * \param fd file descriptor. * \param handle handle to the allocated memory, as given by drmAgpAllocate(). * \param offset offset in bytes. It will round to page boundary. - * + * * \return zero on success, or a negative value on failure. - * + * * \internal * This function is a wrapper around the DRM_IOCTL_AGP_BIND ioctl, passing the * argument in a drm_agp_binding structure. @@ -1815,7 +1816,7 @@ b.handle = handle; b.offset = offset; if (drmIoctl(fd, DRM_IOCTL_AGP_BIND, &b)) - return -errno; + return -errno; return 0; } @@ -1825,9 +1826,9 @@ * * \param fd file descriptor. * \param handle handle to the allocated memory, as given by drmAgpAllocate(). - * + * * \return zero on success, or a negative value on failure. - * + * * \internal * This function is a wrapper around the DRM_IOCTL_AGP_UNBIND ioctl, passing * the argument in a drm_agp_binding structure. @@ -1839,7 +1840,7 @@ memclear(b); b.handle = handle; if (drmIoctl(fd, DRM_IOCTL_AGP_UNBIND, &b)) - return -errno; + return -errno; return 0; } @@ -1848,9 +1849,9 @@ * Get AGP driver major version number. * * \param fd file descriptor. - * + * * \return major version number on success, or a negative value on failure.. - * + * * \internal * This function is a wrapper around the DRM_IOCTL_AGP_INFO ioctl, getting the * necessary information in a drm_agp_info structure. @@ -1862,7 +1863,7 @@ memclear(i); if (drmIoctl(fd, DRM_IOCTL_AGP_INFO, &i)) - return -errno; + return -errno; return i.agp_version_major; } @@ -1871,9 +1872,9 @@ * Get AGP driver minor version number. * * \param fd file descriptor. - * + * * \return minor version number on success, or a negative value on failure. - * + * * \internal * This function is a wrapper around the DRM_IOCTL_AGP_INFO ioctl, getting the * necessary information in a drm_agp_info structure. @@ -1885,7 +1886,7 @@ memclear(i); if (drmIoctl(fd, DRM_IOCTL_AGP_INFO, &i)) - return -errno; + return -errno; return i.agp_version_minor; } @@ -1894,9 +1895,9 @@ * Get AGP mode. * * \param fd file descriptor. - * + * * \return mode on success, or zero on failure. - * + * * \internal * This function is a wrapper around the DRM_IOCTL_AGP_INFO ioctl, getting the * necessary information in a drm_agp_info structure. @@ -1908,7 +1909,7 @@ memclear(i); if (drmIoctl(fd, DRM_IOCTL_AGP_INFO, &i)) - return 0; + return 0; return i.mode; } @@ -1917,9 +1918,9 @@ * Get AGP aperture base. * * \param fd file descriptor. - * + * * \return aperture base on success, zero on failure. - * + * * \internal * This function is a wrapper around the DRM_IOCTL_AGP_INFO ioctl, getting the * necessary information in a drm_agp_info structure. @@ -1931,7 +1932,7 @@ memclear(i); if (drmIoctl(fd, DRM_IOCTL_AGP_INFO, &i)) - return 0; + return 0; return i.aperture_base; } @@ -1940,9 +1941,9 @@ * Get AGP aperture size. * * \param fd file descriptor. - * + * * \return aperture size on success, zero on failure. - * + * * \internal * This function is a wrapper around the DRM_IOCTL_AGP_INFO ioctl, getting the * necessary information in a drm_agp_info structure. @@ -1954,7 +1955,7 @@ memclear(i); if (drmIoctl(fd, DRM_IOCTL_AGP_INFO, &i)) - return 0; + return 0; return i.aperture_size; } @@ -1963,9 +1964,9 @@ * Get used AGP memory. * * \param fd file descriptor. - * + * * \return memory used on success, or zero on failure. - * + * * \internal * This function is a wrapper around the DRM_IOCTL_AGP_INFO ioctl, getting the * necessary information in a drm_agp_info structure. @@ -1977,7 +1978,7 @@ memclear(i); if (drmIoctl(fd, DRM_IOCTL_AGP_INFO, &i)) - return 0; + return 0; return i.memory_used; } @@ -1986,9 +1987,9 @@ * Get available AGP memory. * * \param fd file descriptor. - * + * * \return memory available on success, or zero on failure. - * + * * \internal * This function is a wrapper around the DRM_IOCTL_AGP_INFO ioctl, getting the * necessary information in a drm_agp_info structure. @@ -2000,7 +2001,7 @@ memclear(i); if (drmIoctl(fd, DRM_IOCTL_AGP_INFO, &i)) - return 0; + return 0; return i.memory_allowed; } @@ -2009,9 +2010,9 @@ * Get hardware vendor ID. * * \param fd file descriptor. - * + * * \return vendor ID on success, or zero on failure. - * + * * \internal * This function is a wrapper around the DRM_IOCTL_AGP_INFO ioctl, getting the * necessary information in a drm_agp_info structure. @@ -2023,7 +2024,7 @@ memclear(i); if (drmIoctl(fd, DRM_IOCTL_AGP_INFO, &i)) - return 0; + return 0; return i.id_vendor; } @@ -2032,9 +2033,9 @@ * Get hardware device ID. * * \param fd file descriptor. - * + * * \return zero on success, or zero on failure. - * + * * \internal * This function is a wrapper around the DRM_IOCTL_AGP_INFO ioctl, getting the * necessary information in a drm_agp_info structure. @@ -2046,7 +2047,7 @@ memclear(i); if (drmIoctl(fd, DRM_IOCTL_AGP_INFO, &i)) - return 0; + return 0; return i.id_device; } @@ -2059,7 +2060,7 @@ *handle = 0; sg.size = size; if (drmIoctl(fd, DRM_IOCTL_SG_ALLOC, &sg)) - return -errno; + return -errno; *handle = sg.handle; return 0; } @@ -2071,7 +2072,7 @@ memclear(sg); sg.handle = handle; if (drmIoctl(fd, DRM_IOCTL_SG_FREE, &sg)) - return -errno; + return -errno; return 0; } @@ -2080,9 +2081,9 @@ * * \param fd file descriptor. * \param vbl pointer to a drmVBlank structure. - * + * * \return zero on success, or a negative value on failure. - * + * * \internal * This function is a wrapper around the DRM_IOCTL_WAIT_VBLANK ioctl. */ @@ -2093,8 +2094,8 @@ ret = clock_gettime(CLOCK_MONOTONIC, &timeout); if (ret < 0) { - fprintf(stderr, "clock_gettime failed: %s\n", strerror(errno)); - goto out; + fprintf(stderr, "clock_gettime failed: %s\n", strerror(errno)); + goto out; } timeout.tv_sec++; @@ -2102,15 +2103,15 @@ ret = ioctl(fd, DRM_IOCTL_WAIT_VBLANK, vbl); vbl->request.type &= ~DRM_VBLANK_RELATIVE; if (ret && errno == EINTR) { - clock_gettime(CLOCK_MONOTONIC, &cur); - /* Timeout after 1s */ - if (cur.tv_sec > timeout.tv_sec + 1 || - (cur.tv_sec == timeout.tv_sec && cur.tv_nsec >= - timeout.tv_nsec)) { - errno = EBUSY; - ret = -1; - break; - } + clock_gettime(CLOCK_MONOTONIC, &cur); + /* Timeout after 1s */ + if (cur.tv_sec > timeout.tv_sec + 1 || + (cur.tv_sec == timeout.tv_sec && cur.tv_nsec >= + timeout.tv_nsec)) { + errno = EBUSY; + ret = -1; + break; + } } } while (ret && errno == EINTR); @@ -2122,22 +2123,22 @@ { switch (err) { case DRM_ERR_NO_DEVICE: - fprintf(stderr, "%s: no device\n", label); - break; + fprintf(stderr, "%s: no device\n", label); + break; case DRM_ERR_NO_ACCESS: - fprintf(stderr, "%s: no access\n", label); - break; + fprintf(stderr, "%s: no access\n", label); + break; case DRM_ERR_NOT_ROOT: - fprintf(stderr, "%s: not root\n", label); - break; + fprintf(stderr, "%s: not root\n", label); + break; case DRM_ERR_INVALID: - fprintf(stderr, "%s: invalid args\n", label); - break; + fprintf(stderr, "%s: invalid args\n", label); + break; default: - if (err < 0) - err = -err; - fprintf( stderr, "%s: error %d (%s)\n", label, err, strerror(err) ); - break; + if (err < 0) + err = -err; + fprintf( stderr, "%s: error %d (%s)\n", label, err, strerror(err) ); + break; } return 1; @@ -2148,9 +2149,9 @@ * * \param fd file descriptor. * \param irq IRQ number. - * + * * \return zero on success, or a negative value on failure. - * + * * \internal * This function is a wrapper around the DRM_IOCTL_CONTROL ioctl, passing the * argument in a drm_control structure. @@ -2163,7 +2164,7 @@ ctl.func = DRM_INST_HANDLER; ctl.irq = irq; if (drmIoctl(fd, DRM_IOCTL_CONTROL, &ctl)) - return -errno; + return -errno; return 0; } @@ -2172,9 +2173,9 @@ * Uninstall IRQ handler. * * \param fd file descriptor. - * + * * \return zero on success, or a negative value on failure. - * + * * \internal * This function is a wrapper around the DRM_IOCTL_CONTROL ioctl, passing the * argument in a drm_control structure. @@ -2187,7 +2188,7 @@ ctl.func = DRM_UNINST_HANDLER; ctl.irq = 0; if (drmIoctl(fd, DRM_IOCTL_CONTROL, &ctl)) - return -errno; + return -errno; return 0; } @@ -2204,7 +2205,7 @@ if (flags & DRM_HALT_ALL_QUEUES) lock.flags |= _DRM_HALT_ALL_QUEUES; if (flags & DRM_HALT_CUR_QUEUES) lock.flags |= _DRM_HALT_CUR_QUEUES; if (drmIoctl(fd, DRM_IOCTL_FINISH, &lock)) - return -errno; + return -errno; return 0; } @@ -2215,9 +2216,9 @@ * \param busnum bus number. * \param devnum device number. * \param funcnum function number. - * + * * \return IRQ number on success, or a negative value on failure. - * + * * \internal * This function is a wrapper around the DRM_IOCTL_IRQ_BUSID ioctl, passing the * arguments in a drm_irq_busid structure. @@ -2231,7 +2232,7 @@ p.devnum = devnum; p.funcnum = funcnum; if (drmIoctl(fd, DRM_IOCTL_IRQ_BUSID, &p)) - return -errno; + return -errno; return p.irq; } @@ -2240,8 +2241,8 @@ drmHashEntry *entry = drmGetEntry(fd); if (drmHashInsert(entry->tagTable, context, tag)) { - drmHashDelete(entry->tagTable, context); - drmHashInsert(entry->tagTable, context, tag); + drmHashDelete(entry->tagTable, context); + drmHashInsert(entry->tagTable, context, tag); } return 0; } @@ -2259,7 +2260,7 @@ void *value; if (drmHashLookup(entry->tagTable, context, &value)) - return NULL; + return NULL; return value; } @@ -2274,7 +2275,7 @@ map.handle = (void *)(uintptr_t)handle; if (drmIoctl(fd, DRM_IOCTL_SET_SAREA_CTX, &map)) - return -errno; + return -errno; return 0; } @@ -2287,23 +2288,23 @@ map.ctx_id = ctx_id; if (drmIoctl(fd, DRM_IOCTL_GET_SAREA_CTX, &map)) - return -errno; + return -errno; if (handle) - *handle = (drm_handle_t)(uintptr_t)map.handle; + *handle = (drm_handle_t)(uintptr_t)map.handle; return 0; } int drmGetMap(int fd, int idx, drm_handle_t *offset, drmSize *size, - drmMapType *type, drmMapFlags *flags, drm_handle_t *handle, - int *mtrr) + drmMapType *type, drmMapFlags *flags, drm_handle_t *handle, + int *mtrr) { drm_map_t map; memclear(map); map.offset = idx; if (drmIoctl(fd, DRM_IOCTL_GET_MAP, &map)) - return -errno; + return -errno; *offset = map.offset; *size = map.size; *type = map.type; @@ -2314,14 +2315,14 @@ } int drmGetClient(int fd, int idx, int *auth, int *pid, int *uid, - unsigned long *magic, unsigned long *iocs) + unsigned long *magic, unsigned long *iocs) { drm_client_t client; memclear(client); client.idx = idx; if (drmIoctl(fd, DRM_IOCTL_GET_CLIENT, &client)) - return -errno; + return -errno; *auth = client.auth; *pid = client.pid; *uid = client.uid; @@ -2337,12 +2338,12 @@ memclear(s); if (drmIoctl(fd, DRM_IOCTL_GET_STATS, &s)) - return -errno; + return -errno; stats->count = 0; memset(stats, 0, sizeof(*stats)); if (s.count > sizeof(stats->data)/sizeof(stats->data[0])) - return -1; + return -1; #define SET_VALUE \ stats->data[i].long_format = "%-20.20s"; \ @@ -2369,87 +2370,87 @@ stats->count = s.count; for (i = 0; i < s.count; i++) { - stats->data[i].value = s.data[i].value; - switch (s.data[i].type) { - case _DRM_STAT_LOCK: - stats->data[i].long_name = "Lock"; - stats->data[i].rate_name = "Lock"; - SET_VALUE; - break; - case _DRM_STAT_OPENS: - stats->data[i].long_name = "Opens"; - stats->data[i].rate_name = "O"; - SET_COUNT; - stats->data[i].verbose = 1; - break; - case _DRM_STAT_CLOSES: - stats->data[i].long_name = "Closes"; - stats->data[i].rate_name = "Lock"; - SET_COUNT; - stats->data[i].verbose = 1; - break; - case _DRM_STAT_IOCTLS: - stats->data[i].long_name = "Ioctls"; - stats->data[i].rate_name = "Ioc/s"; - SET_COUNT; - break; - case _DRM_STAT_LOCKS: - stats->data[i].long_name = "Locks"; - stats->data[i].rate_name = "Lck/s"; - SET_COUNT; - break; - case _DRM_STAT_UNLOCKS: - stats->data[i].long_name = "Unlocks"; - stats->data[i].rate_name = "Unl/s"; - SET_COUNT; - break; - case _DRM_STAT_IRQ: - stats->data[i].long_name = "IRQs"; - stats->data[i].rate_name = "IRQ/s"; - SET_COUNT; - break; - case _DRM_STAT_PRIMARY: - stats->data[i].long_name = "Primary Bytes"; - stats->data[i].rate_name = "PB/s"; - SET_BYTE; - break; - case _DRM_STAT_SECONDARY: - stats->data[i].long_name = "Secondary Bytes"; - stats->data[i].rate_name = "SB/s"; - SET_BYTE; - break; - case _DRM_STAT_DMA: - stats->data[i].long_name = "DMA"; - stats->data[i].rate_name = "DMA/s"; - SET_COUNT; - break; - case _DRM_STAT_SPECIAL: - stats->data[i].long_name = "Special DMA"; - stats->data[i].rate_name = "dma/s"; - SET_COUNT; - break; - case _DRM_STAT_MISSED: - stats->data[i].long_name = "Miss"; - stats->data[i].rate_name = "Ms/s"; - SET_COUNT; - break; - case _DRM_STAT_VALUE: - stats->data[i].long_name = "Value"; - stats->data[i].rate_name = "Value"; - SET_VALUE; - break; - case _DRM_STAT_BYTE: - stats->data[i].long_name = "Bytes"; - stats->data[i].rate_name = "B/s"; - SET_BYTE; - break; - case _DRM_STAT_COUNT: - default: - stats->data[i].long_name = "Count"; - stats->data[i].rate_name = "Cnt/s"; - SET_COUNT; - break; - } + stats->data[i].value = s.data[i].value; + switch (s.data[i].type) { + case _DRM_STAT_LOCK: + stats->data[i].long_name = "Lock"; + stats->data[i].rate_name = "Lock"; + SET_VALUE; + break; + case _DRM_STAT_OPENS: + stats->data[i].long_name = "Opens"; + stats->data[i].rate_name = "O"; + SET_COUNT; + stats->data[i].verbose = 1; + break; + case _DRM_STAT_CLOSES: + stats->data[i].long_name = "Closes"; + stats->data[i].rate_name = "Lock"; + SET_COUNT; + stats->data[i].verbose = 1; + break; + case _DRM_STAT_IOCTLS: + stats->data[i].long_name = "Ioctls"; + stats->data[i].rate_name = "Ioc/s"; + SET_COUNT; + break; + case _DRM_STAT_LOCKS: + stats->data[i].long_name = "Locks"; + stats->data[i].rate_name = "Lck/s"; + SET_COUNT; + break; + case _DRM_STAT_UNLOCKS: + stats->data[i].long_name = "Unlocks"; + stats->data[i].rate_name = "Unl/s"; + SET_COUNT; + break; + case _DRM_STAT_IRQ: + stats->data[i].long_name = "IRQs"; + stats->data[i].rate_name = "IRQ/s"; + SET_COUNT; + break; + case _DRM_STAT_PRIMARY: + stats->data[i].long_name = "Primary Bytes"; + stats->data[i].rate_name = "PB/s"; + SET_BYTE; + break; + case _DRM_STAT_SECONDARY: + stats->data[i].long_name = "Secondary Bytes"; + stats->data[i].rate_name = "SB/s"; + SET_BYTE; + break; + case _DRM_STAT_DMA: + stats->data[i].long_name = "DMA"; + stats->data[i].rate_name = "DMA/s"; + SET_COUNT; + break; + case _DRM_STAT_SPECIAL: + stats->data[i].long_name = "Special DMA"; + stats->data[i].rate_name = "dma/s"; + SET_COUNT; + break; + case _DRM_STAT_MISSED: + stats->data[i].long_name = "Miss"; + stats->data[i].rate_name = "Ms/s"; + SET_COUNT; + break; + case _DRM_STAT_VALUE: + stats->data[i].long_name = "Value"; + stats->data[i].rate_name = "Value"; + SET_VALUE; + break; + case _DRM_STAT_BYTE: + stats->data[i].long_name = "Bytes"; + stats->data[i].rate_name = "B/s"; + SET_BYTE; + break; + case _DRM_STAT_COUNT: + default: + stats->data[i].long_name = "Count"; + stats->data[i].rate_name = "Cnt/s"; + SET_COUNT; + break; + } } return 0; } @@ -2458,14 +2459,14 @@ * Issue a set-version ioctl. * * \param fd file descriptor. - * \param drmCommandIndex command index + * \param drmCommandIndex command index * \param data source pointer of the data to be read and written. * \param size size of the data to be read and written. - * + * * \return zero on success, or a negative value on failure. - * + * * \internal - * It issues a read-write ioctl given by + * It issues a read-write ioctl given by * \code DRM_COMMAND_BASE + drmCommandIndex \endcode. */ int drmSetInterfaceVersion(int fd, drmSetVersion *version) @@ -2480,7 +2481,7 @@ sv.drm_dd_minor = version->drm_dd_minor; if (drmIoctl(fd, DRM_IOCTL_SET_VERSION, &sv)) { - retcode = -errno; + retcode = -errno; } version->drm_di_major = sv.drm_di_major; @@ -2495,12 +2496,12 @@ * Send a device-specific command. * * \param fd file descriptor. - * \param drmCommandIndex command index - * + * \param drmCommandIndex command index + * * \return zero on success, or a negative value on failure. - * + * * \internal - * It issues a ioctl given by + * It issues a ioctl given by * \code DRM_COMMAND_BASE + drmCommandIndex \endcode. */ int drmCommandNone(int fd, unsigned long drmCommandIndex) @@ -2510,7 +2511,7 @@ request = DRM_IO( DRM_COMMAND_BASE + drmCommandIndex); if (drmIoctl(fd, request, NULL)) { - return -errno; + return -errno; } return 0; } @@ -2520,14 +2521,14 @@ * Send a device-specific read command. * * \param fd file descriptor. - * \param drmCommandIndex command index + * \param drmCommandIndex command index * \param data destination pointer of the data to be read. * \param size size of the data to be read. - * + * * \return zero on success, or a negative value on failure. * * \internal - * It issues a read ioctl given by + * It issues a read ioctl given by * \code DRM_COMMAND_BASE + drmCommandIndex \endcode. */ int drmCommandRead(int fd, unsigned long drmCommandIndex, void *data, @@ -2535,11 +2536,11 @@ { unsigned long request; - request = DRM_IOC( DRM_IOC_READ, DRM_IOCTL_BASE, - DRM_COMMAND_BASE + drmCommandIndex, size); + request = DRM_IOC( DRM_IOC_READ, DRM_IOCTL_BASE, + DRM_COMMAND_BASE + drmCommandIndex, size); if (drmIoctl(fd, request, data)) { - return -errno; + return -errno; } return 0; } @@ -2549,14 +2550,14 @@ * Send a device-specific write command. * * \param fd file descriptor. - * \param drmCommandIndex command index + * \param drmCommandIndex command index * \param data source pointer of the data to be written. * \param size size of the data to be written. - * + * * \return zero on success, or a negative value on failure. - * + * * \internal - * It issues a write ioctl given by + * It issues a write ioctl given by * \code DRM_COMMAND_BASE + drmCommandIndex \endcode. */ int drmCommandWrite(int fd, unsigned long drmCommandIndex, void *data, @@ -2564,11 +2565,11 @@ { unsigned long request; - request = DRM_IOC( DRM_IOC_WRITE, DRM_IOCTL_BASE, - DRM_COMMAND_BASE + drmCommandIndex, size); + request = DRM_IOC( DRM_IOC_WRITE, DRM_IOCTL_BASE, + DRM_COMMAND_BASE + drmCommandIndex, size); if (drmIoctl(fd, request, data)) { - return -errno; + return -errno; } return 0; } @@ -2578,14 +2579,14 @@ * Send a device-specific read-write command. * * \param fd file descriptor. - * \param drmCommandIndex command index + * \param drmCommandIndex command index * \param data source pointer of the data to be read and written. * \param size size of the data to be read and written. - * + * * \return zero on success, or a negative value on failure. - * + * * \internal - * It issues a read-write ioctl given by + * It issues a read-write ioctl given by * \code DRM_COMMAND_BASE + drmCommandIndex \endcode. */ int drmCommandWriteRead(int fd, unsigned long drmCommandIndex, void *data, @@ -2593,11 +2594,11 @@ { unsigned long request; - request = DRM_IOC( DRM_IOC_READ|DRM_IOC_WRITE, DRM_IOCTL_BASE, - DRM_COMMAND_BASE + drmCommandIndex, size); + request = DRM_IOC( DRM_IOC_READ|DRM_IOC_WRITE, DRM_IOCTL_BASE, + DRM_COMMAND_BASE + drmCommandIndex, size); if (drmIoctl(fd, request, data)) - return -errno; + return -errno; return 0; } @@ -2611,9 +2612,9 @@ static int nr_fds = 0; -int drmOpenOnce(void *unused, - const char *BusID, - int *newlyopened) +int drmOpenOnce(void *unused, + const char *BusID, + int *newlyopened) { return drmOpenOnceWithType(BusID, newlyopened, DRM_NODE_PRIMARY); } @@ -2622,19 +2623,19 @@ { int i; int fd; - + for (i = 0; i < nr_fds; i++) - if ((strcmp(BusID, connection[i].BusID) == 0) && - (connection[i].type == type)) { - connection[i].refcount++; - *newlyopened = 0; - return connection[i].fd; - } + if ((strcmp(BusID, connection[i].BusID) == 0) && + (connection[i].type == type)) { + connection[i].refcount++; + *newlyopened = 0; + return connection[i].fd; + } fd = drmOpenWithType(NULL, BusID, type); if (fd < 0 || nr_fds == DRM_MAX_FDS) - return fd; - + return fd; + connection[nr_fds].BusID = strdup(BusID); connection[nr_fds].fd = fd; connection[nr_fds].refcount = 1; @@ -2642,9 +2643,9 @@ *newlyopened = 1; if (0) - fprintf(stderr, "saved connection %d for %s %d\n", - nr_fds, connection[nr_fds].BusID, - strcmp(BusID, connection[nr_fds].BusID)); + fprintf(stderr, "saved connection %d for %s %d\n", + nr_fds, connection[nr_fds].BusID, + strcmp(BusID, connection[nr_fds].BusID)); nr_fds++; @@ -2656,180 +2657,180 @@ int i; for (i = 0; i < nr_fds; i++) { - if (fd == connection[i].fd) { - if (--connection[i].refcount == 0) { - drmClose(connection[i].fd); - free(connection[i].BusID); - - if (i < --nr_fds) - connection[i] = connection[nr_fds]; - - return; - } - } + if (fd == connection[i].fd) { + if (--connection[i].refcount == 0) { + drmClose(connection[i].fd); + free(connection[i].BusID); + + if (i < --nr_fds) + connection[i] = connection[nr_fds]; + + return; + } + } } } int drmSetMaster(int fd) { - return drmIoctl(fd, DRM_IOCTL_SET_MASTER, NULL); + return drmIoctl(fd, DRM_IOCTL_SET_MASTER, NULL); } int drmDropMaster(int fd) { - return drmIoctl(fd, DRM_IOCTL_DROP_MASTER, NULL); + return drmIoctl(fd, DRM_IOCTL_DROP_MASTER, NULL); } char *drmGetDeviceNameFromFd(int fd) { - char name[128]; - struct stat sbuf; - dev_t d; - int i; - - /* The whole drmOpen thing is a fiasco and we need to find a way - * back to just using open(2). For now, however, lets just make - * things worse with even more ad hoc directory walking code to - * discover the device file name. */ - - fstat(fd, &sbuf); - d = sbuf.st_rdev; - - for (i = 0; i < DRM_MAX_MINOR; i++) { - snprintf(name, sizeof name, DRM_DEV_NAME, DRM_DIR_NAME, i); - if (stat(name, &sbuf) == 0 && sbuf.st_rdev == d) - break; - } - if (i == DRM_MAX_MINOR) - return NULL; + char name[128]; + struct stat sbuf; + dev_t d; + int i; + + /* The whole drmOpen thing is a fiasco and we need to find a way + * back to just using open(2). For now, however, lets just make + * things worse with even more ad hoc directory walking code to + * discover the device file name. */ + + fstat(fd, &sbuf); + d = sbuf.st_rdev; + + for (i = 0; i < DRM_MAX_MINOR; i++) { + snprintf(name, sizeof name, DRM_DEV_NAME, DRM_DIR_NAME, i); + if (stat(name, &sbuf) == 0 && sbuf.st_rdev == d) + break; + } + if (i == DRM_MAX_MINOR) + return NULL; - return strdup(name); + return strdup(name); } int drmGetNodeTypeFromFd(int fd) { - struct stat sbuf; - int maj, min, type; + struct stat sbuf; + int maj, min, type; - if (fstat(fd, &sbuf)) - return -1; + if (fstat(fd, &sbuf)) + return -1; - maj = major(sbuf.st_rdev); - min = minor(sbuf.st_rdev); + maj = major(sbuf.st_rdev); + min = minor(sbuf.st_rdev); - if (maj != DRM_MAJOR || !S_ISCHR(sbuf.st_mode)) { - errno = EINVAL; - return -1; - } - - type = drmGetMinorType(min); - if (type == -1) - errno = ENODEV; - return type; + if (maj != DRM_MAJOR || !S_ISCHR(sbuf.st_mode)) { + errno = EINVAL; + return -1; + } + + type = drmGetMinorType(min); + if (type == -1) + errno = ENODEV; + return type; } int drmPrimeHandleToFD(int fd, uint32_t handle, uint32_t flags, int *prime_fd) { - struct drm_prime_handle args; - int ret; + struct drm_prime_handle args; + int ret; - memclear(args); - args.fd = -1; - args.handle = handle; - args.flags = flags; - ret = drmIoctl(fd, DRM_IOCTL_PRIME_HANDLE_TO_FD, &args); - if (ret) - return ret; + memclear(args); + args.fd = -1; + args.handle = handle; + args.flags = flags; + ret = drmIoctl(fd, DRM_IOCTL_PRIME_HANDLE_TO_FD, &args); + if (ret) + return ret; - *prime_fd = args.fd; - return 0; + *prime_fd = args.fd; + return 0; } int drmPrimeFDToHandle(int fd, int prime_fd, uint32_t *handle) { - struct drm_prime_handle args; - int ret; + struct drm_prime_handle args; + int ret; - memclear(args); - args.fd = prime_fd; - ret = drmIoctl(fd, DRM_IOCTL_PRIME_FD_TO_HANDLE, &args); - if (ret) - return ret; + memclear(args); + args.fd = prime_fd; + ret = drmIoctl(fd, DRM_IOCTL_PRIME_FD_TO_HANDLE, &args); + if (ret) + return ret; - *handle = args.handle; - return 0; + *handle = args.handle; + return 0; } static char *drmGetMinorNameForFD(int fd, int type) { #ifdef __linux__ - DIR *sysdir; - struct dirent *pent, *ent; - struct stat sbuf; - const char *name = drmGetMinorName(type); - int len; - char dev_name[64], buf[64]; - long name_max; - int maj, min; - - if (!name) - return NULL; - - len = strlen(name); + DIR *sysdir; + struct dirent *pent, *ent; + struct stat sbuf; + const char *name = drmGetMinorName(type); + int len; + char dev_name[64], buf[64]; + long name_max; + int maj, min; - if (fstat(fd, &sbuf)) - return NULL; + if (!name) + return NULL; - maj = major(sbuf.st_rdev); - min = minor(sbuf.st_rdev); + len = strlen(name); - if (maj != DRM_MAJOR || !S_ISCHR(sbuf.st_mode)) - return NULL; + if (fstat(fd, &sbuf)) + return NULL; - snprintf(buf, sizeof(buf), "/sys/dev/char/%d:%d/device/drm", maj, min); + maj = major(sbuf.st_rdev); + min = minor(sbuf.st_rdev); - sysdir = opendir(buf); - if (!sysdir) - return NULL; + if (maj != DRM_MAJOR || !S_ISCHR(sbuf.st_mode)) + return NULL; - name_max = fpathconf(dirfd(sysdir), _PC_NAME_MAX); - if (name_max == -1) - goto out_close_dir; + snprintf(buf, sizeof(buf), "/sys/dev/char/%d:%d/device/drm", maj, min); - pent = malloc(offsetof(struct dirent, d_name) + name_max + 1); - if (pent == NULL) - goto out_close_dir; + sysdir = opendir(buf); + if (!sysdir) + return NULL; - while (readdir_r(sysdir, pent, &ent) == 0 && ent != NULL) { - if (strncmp(ent->d_name, name, len) == 0) { - snprintf(dev_name, sizeof(dev_name), DRM_DIR_NAME "/%s", - ent->d_name); + name_max = fpathconf(dirfd(sysdir), _PC_NAME_MAX); + if (name_max == -1) + goto out_close_dir; + + pent = malloc(offsetof(struct dirent, d_name) + name_max + 1); + if (pent == NULL) + goto out_close_dir; + + while (readdir_r(sysdir, pent, &ent) == 0 && ent != NULL) { + if (strncmp(ent->d_name, name, len) == 0) { + snprintf(dev_name, sizeof(dev_name), DRM_DIR_NAME "/%s", + ent->d_name); - free(pent); - closedir(sysdir); + free(pent); + closedir(sysdir); - return strdup(dev_name); - } - } + return strdup(dev_name); + } + } - free(pent); + free(pent); out_close_dir: - closedir(sysdir); + closedir(sysdir); #else #warning "Missing implementation of drmGetMinorNameForFD" #endif - return NULL; + return NULL; } char *drmGetPrimaryDeviceNameFromFd(int fd) { - return drmGetMinorNameForFD(fd, DRM_NODE_PRIMARY); + return drmGetMinorNameForFD(fd, DRM_NODE_PRIMARY); } char *drmGetRenderDeviceNameFromFd(int fd) { - return drmGetMinorNameForFD(fd, DRM_NODE_RENDER); + return drmGetMinorNameForFD(fd, DRM_NODE_RENDER); } static int drmParseSubsystemType(int maj, int min) @@ -2942,7 +2943,7 @@ MAX3(sizeof(DRM_PRIMARY_MINOR_NAME), sizeof(DRM_CONTROL_MINOR_NAME), sizeof(DRM_RENDER_MINOR_NAME)) + - 3 /* lenght of the node number */; + 3 /* length of the node number */; } static int drmParsePciDeviceInfo(const char *d_name, @@ -2992,27 +2993,28 @@ if (devices == NULL) return; - for (i = 0; i < count && devices[i] != NULL; i++) - drmFreeDevice(&devices[i]); + for (i = 0; i < count; i++) + if (devices[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(); + const int max_node_str = ALIGN(drmGetMaxNodeName(), sizeof(void *)); int ret, i; char *addr; *device = calloc(1, sizeof(drmDevice) + - (DRM_NODE_MAX * (sizeof(void *) + max_node_str)) + - sizeof(drmPciBusInfo) + - sizeof(drmPciDeviceInfo)); + (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; @@ -3049,6 +3051,11 @@ return ret; } +/* Consider devices located on the same bus as duplicate and fold the respective + * entries into a single one. + * + * Note: this leaves "gaps" in the array, while preserving the length. + */ static void drmFoldDuplicatedDevices(drmDevicePtr local_devices[], int count) { int node_type, i, j; @@ -3087,6 +3094,7 @@ int maj, min; int ret, i, node_count; int max_count = 16; + dev_t find_rdev; if (fd == -1 || device == NULL) return -EINVAL; @@ -3094,6 +3102,7 @@ if (fstat(fd, &sbuf)) return -errno; + find_rdev = sbuf.st_rdev; maj = major(sbuf.st_rdev); min = minor(sbuf.st_rdev); @@ -3154,17 +3163,21 @@ local_devices = temp; } - local_devices[i] = d; + /* store target at local_devices[0] for ease to use below */ + if (find_rdev == sbuf.st_rdev && i) { + local_devices[i] = local_devices[0]; + local_devices[0] = d; + } + else + 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]); + drmFreeDevices(&local_devices[1], node_count - 1); closedir(sysdir); free(local_devices); @@ -3263,11 +3276,13 @@ } node_count = i; - /* Fold nodes into a single device if they share the same bus info */ drmFoldDuplicatedDevices(local_devices, node_count); device_count = 0; - for (i = 0; i < node_count && local_devices[i]; i++) { + for (i = 0; i < node_count; i++) { + if (!local_devices[i]) + continue; + if ((devices != NULL) && (device_count < max_devices)) devices[device_count] = local_devices[i]; else diff -Nru libdrm-2.4.67/xf86drmMode.c libdrm-2.4.70/xf86drmMode.c --- libdrm-2.4.67/xf86drmMode.c 2016-01-17 21:22:14.000000000 +0000 +++ libdrm-2.4.70/xf86drmMode.c 2016-04-21 13:40:06.000000000 +0000 @@ -34,7 +34,7 @@ */ /* - * TODO the types we are after are defined in diffrent headers on diffrent + * TODO the types we are after are defined in different headers on different * platforms find which headers to include to get uint32_t */