summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/libdrm/Makefile.am32
-rw-r--r--lib/libdrm/Makefile.bsd-wrapper4
-rw-r--r--lib/libdrm/Makefile.in50
-rw-r--r--lib/libdrm/Makefile.sources4
-rw-r--r--lib/libdrm/README24
-rw-r--r--lib/libdrm/aclocal.m464
-rw-r--r--lib/libdrm/amdgpu/Makefile.in11
-rw-r--r--lib/libdrm/amdgpu/amdgpu_bo.c277
-rw-r--r--lib/libdrm/amdgpu/util_hash.c387
-rw-r--r--lib/libdrm/amdgpu/util_hash.h107
-rw-r--r--lib/libdrm/amdgpu/util_hash_table.c262
-rw-r--r--lib/libdrm/amdgpu/util_hash_table.h73
-rw-r--r--lib/libdrm/config.h.in20
-rw-r--r--lib/libdrm/configure578
-rw-r--r--lib/libdrm/configure.ac56
-rw-r--r--lib/libdrm/data/Makefile.in5
-rw-r--r--lib/libdrm/freedreno/Makefile.in3
-rw-r--r--lib/libdrm/freedreno/msm/msm_drm.h226
-rw-r--r--lib/libdrm/include/drm/i915_drm.h321
-rw-r--r--lib/libdrm/intel/intel_bufmgr.c16
-rw-r--r--lib/libdrm/intel/intel_bufmgr_fake.c4
-rw-r--r--lib/libdrm/intel/intel_bufmgr_gem.c10
-rw-r--r--lib/libdrm/intel/intel_chipset.h113
-rw-r--r--lib/libdrm/intel/intel_decode.c8
-rw-r--r--lib/libdrm/intel/mm.c4
-rw-r--r--lib/libdrm/intel/mm.h4
-rw-r--r--lib/libdrm/libdrm_macros.h2
-rw-r--r--lib/libdrm/libkms/api.c4
-rw-r--r--lib/libdrm/libkms/dumb.c4
-rw-r--r--lib/libdrm/libkms/intel.c4
-rw-r--r--lib/libdrm/libkms/internal.h4
-rw-r--r--lib/libdrm/libkms/linux.c14
-rw-r--r--lib/libdrm/libkms/nouveau.c4
-rw-r--r--lib/libdrm/libkms/radeon.c4
-rw-r--r--lib/libdrm/libkms/vmwgfx.c4
-rw-r--r--lib/libdrm/radeon/radeon_bo.c3
-rw-r--r--lib/libdrm/radeon/radeon_bo_gem.c3
-rw-r--r--lib/libdrm/radeon/radeon_cs.c3
-rw-r--r--lib/libdrm/radeon/radeon_cs_gem.c3
-rw-r--r--lib/libdrm/radeon/radeon_cs_space.c3
-rw-r--r--lib/libdrm/radeon/radeon_surface.c3
-rw-r--r--lib/libdrm/tests/Makefile.in88
-rw-r--r--lib/libdrm/xf86atomic.h6
-rw-r--r--lib/libdrm/xf86drm.c358
-rw-r--r--lib/libdrm/xf86drmHash.c6
-rw-r--r--lib/libdrm/xf86drmMode.c10
46 files changed, 1310 insertions, 1883 deletions
diff --git a/lib/libdrm/Makefile.am b/lib/libdrm/Makefile.am
index 7b86214e3..faf0f7507 100644
--- a/lib/libdrm/Makefile.am
+++ b/lib/libdrm/Makefile.am
@@ -135,7 +135,37 @@ if HAVE_VMWGFX
klibdrminclude_HEADERS += $(LIBDRM_INCLUDE_VMWGFX_H_FILES)
endif
-EXTRA_DIST = include/drm/README
+EXTRA_DIST = \
+ include/drm/README \
+ amdgpu/meson.build \
+ data/meson.build \
+ etnaviv/meson.build \
+ exynos/meson.build \
+ freedreno/meson.build \
+ intel/meson.build \
+ libkms/meson.build \
+ man/meson.build \
+ nouveau/meson.build \
+ omap/meson.build \
+ radeon/meson.build \
+ tegra/meson.build \
+ tests/amdgpu/meson.build \
+ tests/etnaviv/meson.build \
+ tests/exynos/meson.build \
+ tests/kms/meson.build \
+ tests/kmstest/meson.build \
+ tests/meson.build \
+ tests/modeprint/meson.build \
+ tests/modetest/meson.build \
+ tests/nouveau/meson.build \
+ tests/proptest/meson.build \
+ tests/radeon/meson.build \
+ tests/tegra/meson.build \
+ tests/util/meson.build \
+ tests/vbltest/meson.build \
+ vc4/meson.build \
+ meson.build \
+ meson_options.txt
copy-headers :
cp -r $(kernel_source)/include/uapi/drm/*.h $(top_srcdir)/include/drm/
diff --git a/lib/libdrm/Makefile.bsd-wrapper b/lib/libdrm/Makefile.bsd-wrapper
index 200a765f2..a17060c5d 100644
--- a/lib/libdrm/Makefile.bsd-wrapper
+++ b/lib/libdrm/Makefile.bsd-wrapper
@@ -1,6 +1,6 @@
-# $OpenBSD: Makefile.bsd-wrapper,v 1.15 2018/02/21 06:01:53 jsg Exp $
+# $OpenBSD: Makefile.bsd-wrapper,v 1.16 2018/09/13 12:02:27 jsg Exp $
SHARED_LIBS= drm 7.6 drm_radeon 4.0 drm_intel 5.4 \
- drm_amdgpu 1.5 drm_nouveau 3.0
+ drm_amdgpu 1.6 drm_nouveau 3.0
.include <bsd.xorg.mk>
diff --git a/lib/libdrm/Makefile.in b/lib/libdrm/Makefile.in
index 9bf71bcf2..144394c94 100644
--- a/lib/libdrm/Makefile.in
+++ b/lib/libdrm/Makefile.in
@@ -197,12 +197,13 @@ am__klibdrminclude_HEADERS_DIST = include/drm/drm.h \
include/drm/drm_fourcc.h include/drm/drm_mode.h \
include/drm/drm_sarea.h include/drm/i915_drm.h \
include/drm/mach64_drm.h include/drm/mga_drm.h \
- include/drm/nouveau_drm.h include/drm/qxl_drm.h \
- include/drm/r128_drm.h include/drm/radeon_drm.h \
- include/drm/amdgpu_drm.h include/drm/savage_drm.h \
- include/drm/sis_drm.h include/drm/tegra_drm.h \
- include/drm/vc4_drm.h include/drm/via_drm.h \
- include/drm/virtgpu_drm.h include/drm/vmwgfx_drm.h
+ include/drm/msm_drm.h include/drm/nouveau_drm.h \
+ include/drm/qxl_drm.h include/drm/r128_drm.h \
+ include/drm/radeon_drm.h include/drm/amdgpu_drm.h \
+ include/drm/savage_drm.h include/drm/sis_drm.h \
+ include/drm/tegra_drm.h include/drm/vc4_drm.h \
+ include/drm/via_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
@@ -433,6 +434,7 @@ LIBDRM_INCLUDE_H_FILES := \
include/drm/i915_drm.h \
include/drm/mach64_drm.h \
include/drm/mga_drm.h \
+ include/drm/msm_drm.h \
include/drm/nouveau_drm.h \
include/drm/qxl_drm.h \
include/drm/r128_drm.h \
@@ -445,6 +447,9 @@ LIBDRM_INCLUDE_H_FILES := \
include/drm/via_drm.h \
include/drm/virtgpu_drm.h
+LIBDRM_INCLUDE_ANDROID_H_FILES := \
+ android/gralloc_handle.h
+
LIBDRM_INCLUDE_VMWGFX_H_FILES := \
include/drm/vmwgfx_drm.h
@@ -514,7 +519,38 @@ libdrmincludedir = ${includedir}
libdrminclude_HEADERS = $(LIBDRM_H_FILES)
klibdrmincludedir = ${includedir}/libdrm
klibdrminclude_HEADERS = $(LIBDRM_INCLUDE_H_FILES) $(am__append_1)
-EXTRA_DIST = include/drm/README
+EXTRA_DIST = \
+ include/drm/README \
+ amdgpu/meson.build \
+ data/meson.build \
+ etnaviv/meson.build \
+ exynos/meson.build \
+ freedreno/meson.build \
+ intel/meson.build \
+ libkms/meson.build \
+ man/meson.build \
+ nouveau/meson.build \
+ omap/meson.build \
+ radeon/meson.build \
+ tegra/meson.build \
+ tests/amdgpu/meson.build \
+ tests/etnaviv/meson.build \
+ tests/exynos/meson.build \
+ tests/kms/meson.build \
+ tests/kmstest/meson.build \
+ tests/meson.build \
+ tests/modeprint/meson.build \
+ tests/modetest/meson.build \
+ tests/nouveau/meson.build \
+ tests/proptest/meson.build \
+ tests/radeon/meson.build \
+ tests/tegra/meson.build \
+ tests/util/meson.build \
+ tests/vbltest/meson.build \
+ vc4/meson.build \
+ meson.build \
+ meson_options.txt
+
all: config.h
$(MAKE) $(AM_MAKEFLAGS) all-recursive
diff --git a/lib/libdrm/Makefile.sources b/lib/libdrm/Makefile.sources
index 10aa1d0f4..55290fe99 100644
--- a/lib/libdrm/Makefile.sources
+++ b/lib/libdrm/Makefile.sources
@@ -25,6 +25,7 @@ LIBDRM_INCLUDE_H_FILES := \
include/drm/i915_drm.h \
include/drm/mach64_drm.h \
include/drm/mga_drm.h \
+ include/drm/msm_drm.h \
include/drm/nouveau_drm.h \
include/drm/qxl_drm.h \
include/drm/r128_drm.h \
@@ -37,5 +38,8 @@ LIBDRM_INCLUDE_H_FILES := \
include/drm/via_drm.h \
include/drm/virtgpu_drm.h
+LIBDRM_INCLUDE_ANDROID_H_FILES := \
+ android/gralloc_handle.h
+
LIBDRM_INCLUDE_VMWGFX_H_FILES := \
include/drm/vmwgfx_drm.h
diff --git a/lib/libdrm/README b/lib/libdrm/README
index 26cab9d3e..f3df9ac19 100644
--- a/lib/libdrm/README
+++ b/lib/libdrm/README
@@ -15,9 +15,27 @@ with an older kernel.
Compiling
---------
-libdrm is a standard autotools package and follows the normal
-configure, build and install steps. The first step is to configure
-the package, which is done by running the configure shell script:
+libdrm has two build systems, a legacy autotools build system, and a newer
+meson build system. The meson build system is much faster, and offers a
+slightly different interface, but otherwise provides an equivalent feature set.
+
+To use it:
+
+ meson builddir/
+
+By default this will install into /usr/local, you can change your prefix
+with --prefix=/usr (or `meson configure builddir/ -Dprefix=/usr` after
+the initial meson setup).
+
+Then use ninja to build and install:
+
+ ninja -C builddir/ install
+
+If you are installing into a system location you will need to run install
+separately, and as root.
+
+
+Alternatively you can invoke autotools configure:
./configure
diff --git a/lib/libdrm/aclocal.m4 b/lib/libdrm/aclocal.m4
index 3501fad3e..67e6165b8 100644
--- a/lib/libdrm/aclocal.m4
+++ b/lib/libdrm/aclocal.m4
@@ -1247,7 +1247,7 @@ m4_include([m4/ltversion.m4])
m4_include([m4/lt~obsolete.m4])
dnl xorg-macros.m4. Generated from xorg-macros.m4.in xorgversion.m4 by configure.
dnl
-dnl Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
+dnl Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
dnl
dnl Permission is hereby granted, free of charge, to any person obtaining a
dnl copy of this software and associated documentation files (the "Software"),
@@ -1284,7 +1284,7 @@ dnl DEALINGS IN THE SOFTWARE.
# See the "minimum version" comment for each macro you use to see what
# version you require.
m4_defun([XORG_MACROS_VERSION],[
-m4_define([vers_have], [1.19.0])
+m4_define([vers_have], [1.19.2])
m4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
m4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
m4_if(m4_cmp(maj_have, maj_needed), 0,,
@@ -1362,6 +1362,17 @@ AC_DEFUN([XORG_MANPAGE_SECTIONS],[
AC_REQUIRE([AC_CANONICAL_HOST])
AC_REQUIRE([AC_PROG_SED])
+case $host_os in
+ solaris*)
+ # Solaris 2.0 - 11.3 use SysV man page section numbers, so we
+ # check for a man page file found in later versions that use
+ # traditional section numbers instead
+ AC_CHECK_FILE([/usr/share/man/man7/attributes.7],
+ [SYSV_MAN_SECTIONS=false], [SYSV_MAN_SECTIONS=true])
+ ;;
+ *) SYSV_MAN_SECTIONS=false ;;
+esac
+
if test x$APP_MAN_SUFFIX = x ; then
APP_MAN_SUFFIX=1
fi
@@ -1377,9 +1388,9 @@ if test x$LIB_MAN_DIR = x ; then
fi
if test x$FILE_MAN_SUFFIX = x ; then
- case $host_os in
- solaris*) FILE_MAN_SUFFIX=4 ;;
- *) FILE_MAN_SUFFIX=5 ;;
+ case $SYSV_MAN_SECTIONS in
+ true) FILE_MAN_SUFFIX=4 ;;
+ *) FILE_MAN_SUFFIX=5 ;;
esac
fi
if test x$FILE_MAN_DIR = x ; then
@@ -1387,9 +1398,9 @@ if test x$FILE_MAN_DIR = x ; then
fi
if test x$MISC_MAN_SUFFIX = x ; then
- case $host_os in
- solaris*) MISC_MAN_SUFFIX=5 ;;
- *) MISC_MAN_SUFFIX=7 ;;
+ case $SYSV_MAN_SECTIONS in
+ true) MISC_MAN_SUFFIX=5 ;;
+ *) MISC_MAN_SUFFIX=7 ;;
esac
fi
if test x$MISC_MAN_DIR = x ; then
@@ -1397,9 +1408,9 @@ if test x$MISC_MAN_DIR = x ; then
fi
if test x$DRIVER_MAN_SUFFIX = x ; then
- case $host_os in
- solaris*) DRIVER_MAN_SUFFIX=7 ;;
- *) DRIVER_MAN_SUFFIX=4 ;;
+ case $SYSV_MAN_SECTIONS in
+ true) DRIVER_MAN_SUFFIX=7 ;;
+ *) DRIVER_MAN_SUFFIX=4 ;;
esac
fi
if test x$DRIVER_MAN_DIR = x ; then
@@ -1407,9 +1418,9 @@ if test x$DRIVER_MAN_DIR = x ; then
fi
if test x$ADMIN_MAN_SUFFIX = x ; then
- case $host_os in
- solaris*) ADMIN_MAN_SUFFIX=1m ;;
- *) ADMIN_MAN_SUFFIX=8 ;;
+ case $SYSV_MAN_SECTIONS in
+ true) ADMIN_MAN_SUFFIX=1m ;;
+ *) ADMIN_MAN_SUFFIX=8 ;;
esac
fi
if test x$ADMIN_MAN_DIR = x ; then
@@ -1670,13 +1681,24 @@ m4_ifval([$1],
fi])
# Test for the ability of xmlto to generate a text target
+#
+# NOTE: xmlto 0.0.27 or higher return a non-zero return code in the
+# following test for empty XML docbook files.
+# For compatibility reasons use the following empty XML docbook file and if
+# it fails try it again with a non-empty XML file.
have_xmlto_text=no
cat > conftest.xml << "EOF"
EOF
AS_IF([test "$have_xmlto" = yes],
[AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
[have_xmlto_text=yes],
- [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])
+ [# Try it again with a non-empty XML file.
+ cat > conftest.xml << "EOF"
+<x></x>
+EOF
+ AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
+ [have_xmlto_text=yes],
+ [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])])
rm -f conftest.xml
AM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
AM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
@@ -3072,8 +3094,9 @@ AC_REQUIRE([PKG_PROG_PKG_CONFIG])
macros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
INSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
mv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
-|| (rm -f \$(top_srcdir)/.INSTALL.tmp; touch \$(top_srcdir)/INSTALL; \
-echo 'util-macros \"pkgdatadir\" from xorg-macros.pc not found: installing possibly empty INSTALL.' >&2)"
+|| (rm -f \$(top_srcdir)/.INSTALL.tmp; test -e \$(top_srcdir)/INSTALL || ( \
+touch \$(top_srcdir)/INSTALL; \
+echo 'failed to copy INSTALL from util-macros: installing empty INSTALL.' >&2))"
AC_SUBST([INSTALL_CMD])
]) # XORG_INSTALL
dnl Copyright 2005 Red Hat, Inc
@@ -3134,10 +3157,11 @@ AC_DEFUN([XORG_RELEASE_VERSION],[
#
#
AC_DEFUN([XORG_CHANGELOG], [
-CHANGELOG_CMD="(GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp && \
+CHANGELOG_CMD="((GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp) 2>/dev/null && \
mv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
-|| (rm -f \$(top_srcdir)/.changelog.tmp; touch \$(top_srcdir)/ChangeLog; \
-echo 'git directory not found: installing possibly empty changelog.' >&2)"
+|| (rm -f \$(top_srcdir)/.changelog.tmp; test -e \$(top_srcdir)/ChangeLog || ( \
+touch \$(top_srcdir)/ChangeLog; \
+echo 'git failed to create ChangeLog: installing empty ChangeLog.' >&2))"
AC_SUBST([CHANGELOG_CMD])
]) # XORG_CHANGELOG
diff --git a/lib/libdrm/amdgpu/Makefile.in b/lib/libdrm/amdgpu/Makefile.in
index 033e1b385..e927cd92b 100644
--- a/lib/libdrm/amdgpu/Makefile.in
+++ b/lib/libdrm/amdgpu/Makefile.in
@@ -125,7 +125,7 @@ LTLIBRARIES = $(libdrm_amdgpu_la_LTLIBRARIES)
libdrm_amdgpu_la_DEPENDENCIES = ../libdrm.la
am__objects_1 = amdgpu_asic_id.lo amdgpu_bo.lo amdgpu_cs.lo \
amdgpu_device.lo amdgpu_gpu_info.lo amdgpu_vamgr.lo \
- amdgpu_vm.lo util_hash.lo util_hash_table.lo
+ amdgpu_vm.lo handle_table.lo
am_libdrm_amdgpu_la_OBJECTS = $(am__objects_1)
libdrm_amdgpu_la_OBJECTS = $(am_libdrm_amdgpu_la_OBJECTS)
AM_V_lt = $(am__v_lt_@AM_V@)
@@ -345,10 +345,8 @@ LIBDRM_AMDGPU_FILES := \
amdgpu_internal.h \
amdgpu_vamgr.c \
amdgpu_vm.c \
- util_hash.c \
- util_hash.h \
- util_hash_table.c \
- util_hash_table.h
+ handle_table.c \
+ handle_table.h
LIBDRM_AMDGPU_H_FILES := \
amdgpu.h
@@ -457,8 +455,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/amdgpu_gpu_info.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/amdgpu_vamgr.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/amdgpu_vm.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/util_hash.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/util_hash_table.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/handle_table.Plo@am__quote@
.c.o:
@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
diff --git a/lib/libdrm/amdgpu/amdgpu_bo.c b/lib/libdrm/amdgpu/amdgpu_bo.c
index 3853fd03d..2f4f90f6e 100644
--- a/lib/libdrm/amdgpu/amdgpu_bo.c
+++ b/lib/libdrm/amdgpu/amdgpu_bo.c
@@ -22,10 +22,6 @@
*
*/
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
#include <stdlib.h>
#include <stdio.h>
#include <stdint.h>
@@ -41,7 +37,6 @@
#include "xf86drm.h"
#include "amdgpu_drm.h"
#include "amdgpu_internal.h"
-#include "util_hash_table.h"
#include "util_math.h"
static void amdgpu_close_kms_handle(amdgpu_device_handle dev,
@@ -53,11 +48,31 @@ static void amdgpu_close_kms_handle(amdgpu_device_handle dev,
drmIoctl(dev->fd, DRM_IOCTL_GEM_CLOSE, &args);
}
+static int amdgpu_bo_create(amdgpu_device_handle dev,
+ uint64_t size,
+ uint32_t handle,
+ amdgpu_bo_handle *buf_handle)
+{
+ struct amdgpu_bo *bo;
+
+ bo = calloc(1, sizeof(struct amdgpu_bo));
+ if (!bo)
+ return -ENOMEM;
+
+ atomic_set(&bo->refcount, 1);
+ bo->dev = dev;
+ bo->alloc_size = size;
+ bo->handle = handle;
+ pthread_mutex_init(&bo->cpu_access_mutex, NULL);
+
+ *buf_handle = bo;
+ return 0;
+}
+
int amdgpu_bo_alloc(amdgpu_device_handle dev,
struct amdgpu_bo_alloc_request *alloc_buffer,
amdgpu_bo_handle *buf_handle)
{
- struct amdgpu_bo *bo;
union drm_amdgpu_gem_create args;
unsigned heap = alloc_buffer->preferred_heap;
int r = 0;
@@ -66,14 +81,6 @@ int amdgpu_bo_alloc(amdgpu_device_handle dev,
if (!(heap & (AMDGPU_GEM_DOMAIN_GTT | AMDGPU_GEM_DOMAIN_VRAM)))
return -EINVAL;
- bo = calloc(1, sizeof(struct amdgpu_bo));
- if (!bo)
- return -ENOMEM;
-
- atomic_set(&bo->refcount, 1);
- bo->dev = dev;
- bo->alloc_size = alloc_buffer->alloc_size;
-
memset(&args, 0, sizeof(args));
args.in.bo_size = alloc_buffer->alloc_size;
args.in.alignment = alloc_buffer->phys_alignment;
@@ -85,17 +92,24 @@ int amdgpu_bo_alloc(amdgpu_device_handle dev,
/* Allocate the buffer with the preferred heap. */
r = drmCommandWriteRead(dev->fd, DRM_AMDGPU_GEM_CREATE,
&args, sizeof(args));
+ if (r)
+ goto out;
+
+ r = amdgpu_bo_create(dev, alloc_buffer->alloc_size, args.out.handle,
+ buf_handle);
if (r) {
- free(bo);
- return r;
+ amdgpu_close_kms_handle(dev, args.out.handle);
+ goto out;
}
- bo->handle = args.out.handle;
-
- pthread_mutex_init(&bo->cpu_access_mutex, NULL);
-
- *buf_handle = bo;
- return 0;
+ pthread_mutex_lock(&dev->bo_table_mutex);
+ r = handle_table_insert(&dev->bo_handles, (*buf_handle)->handle,
+ *buf_handle);
+ pthread_mutex_unlock(&dev->bo_table_mutex);
+ if (r)
+ amdgpu_bo_free(*buf_handle);
+out:
+ return r;
}
int amdgpu_bo_set_metadata(amdgpu_bo_handle bo,
@@ -172,14 +186,6 @@ int amdgpu_bo_query_info(amdgpu_bo_handle bo,
return 0;
}
-static void amdgpu_add_handle_to_table(amdgpu_bo_handle bo)
-{
- pthread_mutex_lock(&bo->dev->bo_table_mutex);
- util_hash_table_set(bo->dev->bo_handles,
- (void*)(uintptr_t)bo->handle, bo);
- pthread_mutex_unlock(&bo->dev->bo_table_mutex);
-}
-
static int amdgpu_bo_export_flink(amdgpu_bo_handle bo)
{
struct drm_gem_flink flink;
@@ -220,12 +226,10 @@ static int amdgpu_bo_export_flink(amdgpu_bo_handle bo)
}
pthread_mutex_lock(&bo->dev->bo_table_mutex);
- util_hash_table_set(bo->dev->bo_flink_names,
- (void*)(uintptr_t)bo->flink_name,
- bo);
+ r = handle_table_insert(&bo->dev->bo_flink_names, bo->flink_name, bo);
pthread_mutex_unlock(&bo->dev->bo_table_mutex);
- return 0;
+ return r;
}
int amdgpu_bo_export(amdgpu_bo_handle bo,
@@ -244,14 +248,14 @@ int amdgpu_bo_export(amdgpu_bo_handle bo,
return 0;
case amdgpu_bo_handle_type_kms:
- amdgpu_add_handle_to_table(bo);
+ case amdgpu_bo_handle_type_kms_noimport:
*shared_handle = bo->handle;
return 0;
case amdgpu_bo_handle_type_dma_buf_fd:
- amdgpu_add_handle_to_table(bo);
- return drmPrimeHandleToFD(bo->dev->fd, bo->handle, DRM_CLOEXEC,
- (int*)shared_handle);
+ return drmPrimeHandleToFD(bo->dev->fd, bo->handle,
+ DRM_CLOEXEC | DRM_RDWR,
+ (int*)shared_handle);
}
return -EINVAL;
}
@@ -262,8 +266,11 @@ int amdgpu_bo_import(amdgpu_device_handle dev,
struct amdgpu_bo_import_result *output)
{
struct drm_gem_open open_arg = {};
+ struct drm_gem_close close_arg = {};
struct amdgpu_bo *bo = NULL;
- int r;
+ uint32_t handle = 0, flink_name = 0;
+ uint64_t alloc_size = 0;
+ int r = 0;
int dma_fd;
uint64_t dma_buf_size = 0;
@@ -273,22 +280,18 @@ int amdgpu_bo_import(amdgpu_device_handle dev,
/* Convert a DMA buf handle to a KMS handle now. */
if (type == amdgpu_bo_handle_type_dma_buf_fd) {
- uint32_t handle;
off_t size;
/* Get a KMS handle. */
r = drmPrimeFDToHandle(dev->fd, shared_handle, &handle);
- if (r) {
- pthread_mutex_unlock(&dev->bo_table_mutex);
- return r;
- }
+ if (r)
+ goto unlock;
/* Query the buffer size. */
size = lseek(shared_handle, 0, SEEK_END);
if (size == (off_t)-1) {
- pthread_mutex_unlock(&dev->bo_table_mutex);
- amdgpu_close_kms_handle(dev, handle);
- return -errno;
+ r = -errno;
+ goto free_bo_handle;
}
lseek(shared_handle, 0, SEEK_SET);
@@ -299,23 +302,22 @@ int amdgpu_bo_import(amdgpu_device_handle dev,
/* If we have already created a buffer with this handle, find it. */
switch (type) {
case amdgpu_bo_handle_type_gem_flink_name:
- bo = util_hash_table_get(dev->bo_flink_names,
- (void*)(uintptr_t)shared_handle);
+ bo = handle_table_lookup(&dev->bo_flink_names, shared_handle);
break;
case amdgpu_bo_handle_type_dma_buf_fd:
- bo = util_hash_table_get(dev->bo_handles,
- (void*)(uintptr_t)shared_handle);
+ bo = handle_table_lookup(&dev->bo_handles, shared_handle);
break;
case amdgpu_bo_handle_type_kms:
+ case amdgpu_bo_handle_type_kms_noimport:
/* Importing a KMS handle in not allowed. */
- pthread_mutex_unlock(&dev->bo_table_mutex);
- return -EPERM;
+ r = -EPERM;
+ goto unlock;
default:
- pthread_mutex_unlock(&dev->bo_table_mutex);
- return -EINVAL;
+ r = -EINVAL;
+ goto unlock;
}
if (bo) {
@@ -328,70 +330,80 @@ int amdgpu_bo_import(amdgpu_device_handle dev,
return 0;
}
- bo = calloc(1, sizeof(struct amdgpu_bo));
- if (!bo) {
- pthread_mutex_unlock(&dev->bo_table_mutex);
- if (type == amdgpu_bo_handle_type_dma_buf_fd) {
- amdgpu_close_kms_handle(dev, shared_handle);
- }
- return -ENOMEM;
- }
-
/* Open the handle. */
switch (type) {
case amdgpu_bo_handle_type_gem_flink_name:
open_arg.name = shared_handle;
r = drmIoctl(dev->flink_fd, DRM_IOCTL_GEM_OPEN, &open_arg);
- if (r) {
- free(bo);
- pthread_mutex_unlock(&dev->bo_table_mutex);
- return r;
- }
+ if (r)
+ goto unlock;
- bo->handle = open_arg.handle;
+ flink_name = shared_handle;
+ handle = open_arg.handle;
+ alloc_size = open_arg.size;
if (dev->flink_fd != dev->fd) {
- r = drmPrimeHandleToFD(dev->flink_fd, bo->handle, DRM_CLOEXEC, &dma_fd);
- if (r) {
- free(bo);
- pthread_mutex_unlock(&dev->bo_table_mutex);
- return r;
- }
- r = drmPrimeFDToHandle(dev->fd, dma_fd, &bo->handle );
-
+ r = drmPrimeHandleToFD(dev->flink_fd, handle,
+ DRM_CLOEXEC, &dma_fd);
+ if (r)
+ goto free_bo_handle;
+ r = drmPrimeFDToHandle(dev->fd, dma_fd, &handle);
close(dma_fd);
-
- if (r) {
- free(bo);
- pthread_mutex_unlock(&dev->bo_table_mutex);
- return r;
- }
+ if (r)
+ goto free_bo_handle;
+ close_arg.handle = open_arg.handle;
+ r = drmIoctl(dev->flink_fd, DRM_IOCTL_GEM_CLOSE,
+ &close_arg);
+ if (r)
+ goto free_bo_handle;
}
- bo->flink_name = shared_handle;
- bo->alloc_size = open_arg.size;
- util_hash_table_set(dev->bo_flink_names,
- (void*)(uintptr_t)bo->flink_name, bo);
break;
case amdgpu_bo_handle_type_dma_buf_fd:
- bo->handle = shared_handle;
- bo->alloc_size = dma_buf_size;
+ handle = shared_handle;
+ alloc_size = dma_buf_size;
break;
case amdgpu_bo_handle_type_kms:
+ case amdgpu_bo_handle_type_kms_noimport:
assert(0); /* unreachable */
}
/* Initialize it. */
- atomic_set(&bo->refcount, 1);
- bo->dev = dev;
- pthread_mutex_init(&bo->cpu_access_mutex, NULL);
+ r = amdgpu_bo_create(dev, alloc_size, handle, &bo);
+ if (r)
+ goto free_bo_handle;
- util_hash_table_set(dev->bo_handles, (void*)(uintptr_t)bo->handle, bo);
- pthread_mutex_unlock(&dev->bo_table_mutex);
+ r = handle_table_insert(&dev->bo_handles, bo->handle, bo);
+ if (r)
+ goto free_bo_handle;
+ if (flink_name) {
+ bo->flink_name = flink_name;
+ r = handle_table_insert(&dev->bo_flink_names, flink_name,
+ bo);
+ if (r)
+ goto remove_handle;
+
+ }
output->buf_handle = bo;
output->alloc_size = bo->alloc_size;
+ pthread_mutex_unlock(&dev->bo_table_mutex);
return 0;
+
+remove_handle:
+ handle_table_remove(&dev->bo_handles, bo->handle);
+free_bo_handle:
+ if (flink_name && !close_arg.handle && open_arg.handle) {
+ close_arg.handle = open_arg.handle;
+ drmIoctl(dev->flink_fd, DRM_IOCTL_GEM_CLOSE, &close_arg);
+ }
+ if (bo)
+ amdgpu_bo_free(bo);
+ else
+ amdgpu_close_kms_handle(dev, handle);
+unlock:
+ pthread_mutex_unlock(&dev->bo_table_mutex);
+ return r;
}
int amdgpu_bo_free(amdgpu_bo_handle buf_handle)
@@ -405,13 +417,11 @@ int amdgpu_bo_free(amdgpu_bo_handle buf_handle)
if (update_references(&bo->refcount, NULL)) {
/* Remove the buffer from the hash tables. */
- util_hash_table_remove(dev->bo_handles,
- (void*)(uintptr_t)bo->handle);
+ handle_table_remove(&dev->bo_handles, bo->handle);
- if (bo->flink_name) {
- util_hash_table_remove(dev->bo_flink_names,
- (void*)(uintptr_t)bo->flink_name);
- }
+ if (bo->flink_name)
+ handle_table_remove(&dev->bo_flink_names,
+ bo->flink_name);
/* Release CPU access. */
if (bo->cpu_map_count > 0) {
@@ -533,13 +543,52 @@ int amdgpu_bo_wait_for_idle(amdgpu_bo_handle bo,
}
}
+int amdgpu_find_bo_by_cpu_mapping(amdgpu_device_handle dev,
+ void *cpu,
+ uint64_t size,
+ amdgpu_bo_handle *buf_handle,
+ uint64_t *offset_in_bo)
+{
+ uint32_t i;
+ struct amdgpu_bo *bo;
+
+ if (cpu == NULL || size == 0)
+ return -EINVAL;
+
+ /*
+ * Workaround for a buggy application which tries to import previously
+ * exposed CPU pointers. If we find a real world use case we should
+ * improve that by asking the kernel for the right handle.
+ */
+ pthread_mutex_lock(&dev->bo_table_mutex);
+ for (i = 0; i < dev->bo_handles.max_key; i++) {
+ bo = handle_table_lookup(&dev->bo_handles, i);
+ if (!bo || !bo->cpu_ptr || size > bo->alloc_size)
+ continue;
+ if (cpu >= bo->cpu_ptr &&
+ cpu < (void*)((uintptr_t)bo->cpu_ptr + bo->alloc_size))
+ break;
+ }
+
+ if (i < dev->bo_handles.max_key) {
+ atomic_inc(&bo->refcount);
+ *buf_handle = bo;
+ *offset_in_bo = (uintptr_t)cpu - (uintptr_t)bo->cpu_ptr;
+ } else {
+ *buf_handle = NULL;
+ *offset_in_bo = 0;
+ }
+ pthread_mutex_unlock(&dev->bo_table_mutex);
+
+ return 0;
+}
+
int amdgpu_create_bo_from_user_mem(amdgpu_device_handle dev,
void *cpu,
uint64_t size,
amdgpu_bo_handle *buf_handle)
{
int r;
- struct amdgpu_bo *bo;
struct drm_amdgpu_gem_userptr args;
args.addr = (uintptr_t)cpu;
@@ -549,19 +598,21 @@ int amdgpu_create_bo_from_user_mem(amdgpu_device_handle dev,
r = drmCommandWriteRead(dev->fd, DRM_AMDGPU_GEM_USERPTR,
&args, sizeof(args));
if (r)
- return r;
+ goto out;
- bo = calloc(1, sizeof(struct amdgpu_bo));
- if (!bo)
- return -ENOMEM;
-
- atomic_set(&bo->refcount, 1);
- bo->dev = dev;
- bo->alloc_size = size;
- bo->handle = args.handle;
-
- *buf_handle = bo;
+ r = amdgpu_bo_create(dev, size, args.handle, buf_handle);
+ if (r) {
+ amdgpu_close_kms_handle(dev, args.handle);
+ goto out;
+ }
+ pthread_mutex_lock(&dev->bo_table_mutex);
+ r = handle_table_insert(&dev->bo_handles, (*buf_handle)->handle,
+ *buf_handle);
+ pthread_mutex_unlock(&dev->bo_table_mutex);
+ if (r)
+ amdgpu_bo_free(*buf_handle);
+out:
return r;
}
diff --git a/lib/libdrm/amdgpu/util_hash.c b/lib/libdrm/amdgpu/util_hash.c
deleted file mode 100644
index 87cb671b6..000000000
--- a/lib/libdrm/amdgpu/util_hash.c
+++ /dev/null
@@ -1,387 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2007 VMware, Inc.
- * All Rights Reserved.
- *
- * 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, sub license, 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 NON-INFRINGEMENT.
- * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS 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:
- * Zack Rusin <zackr@vmware.com>
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "util_hash.h"
-
-#include <stdlib.h>
-#include <assert.h>
-
-#define MAX(a, b) ((a > b) ? (a) : (b))
-
-static const int MinNumBits = 4;
-
-static const unsigned char prime_deltas[] = {
- 0, 0, 1, 3, 1, 5, 3, 3, 1, 9, 7, 5, 3, 9, 25, 3,
- 1, 21, 3, 21, 7, 15, 9, 5, 3, 29, 15, 0, 0, 0, 0, 0
-};
-
-static int primeForNumBits(int numBits)
-{
- return (1 << numBits) + prime_deltas[numBits];
-}
-
-/* Returns the smallest integer n such that
- primeForNumBits(n) >= hint.
-*/
-static int countBits(int hint)
-{
- int numBits = 0;
- int bits = hint;
-
- while (bits > 1) {
- bits >>= 1;
- numBits++;
- }
-
- if (numBits >= (int)sizeof(prime_deltas)) {
- numBits = sizeof(prime_deltas) - 1;
- } else if (primeForNumBits(numBits) < hint) {
- ++numBits;
- }
- return numBits;
-}
-
-struct util_node {
- struct util_node *next;
- unsigned key;
- void *value;
-};
-
-struct util_hash_data {
- struct util_node *fakeNext;
- struct util_node **buckets;
- int size;
- int nodeSize;
- short userNumBits;
- short numBits;
- int numBuckets;
-};
-
-struct util_hash {
- union {
- struct util_hash_data *d;
- struct util_node *e;
- } data;
-};
-
-static void *util_data_allocate_node(struct util_hash_data *hash)
-{
- return malloc(hash->nodeSize);
-}
-
-static void util_free_node(struct util_node *node)
-{
- free(node);
-}
-
-static struct util_node *
-util_hash_create_node(struct util_hash *hash,
- unsigned akey, void *avalue,
- struct util_node **anextNode)
-{
- struct util_node *node = util_data_allocate_node(hash->data.d);
-
- if (!node)
- return NULL;
-
- node->key = akey;
- node->value = avalue;
-
- node->next = (struct util_node*)(*anextNode);
- *anextNode = node;
- ++hash->data.d->size;
- return node;
-}
-
-static void util_data_rehash(struct util_hash_data *hash, int hint)
-{
- if (hint < 0) {
- hint = countBits(-hint);
- if (hint < MinNumBits)
- hint = MinNumBits;
- hash->userNumBits = (short)hint;
- while (primeForNumBits(hint) < (hash->size >> 1))
- ++hint;
- } else if (hint < MinNumBits) {
- hint = MinNumBits;
- }
-
- if (hash->numBits != hint) {
- struct util_node *e = (struct util_node *)(hash);
- struct util_node **oldBuckets = hash->buckets;
- int oldNumBuckets = hash->numBuckets;
- int i = 0;
-
- hash->numBits = (short)hint;
- hash->numBuckets = primeForNumBits(hint);
- hash->buckets = malloc(sizeof(struct util_node*) * hash->numBuckets);
- for (i = 0; i < hash->numBuckets; ++i)
- hash->buckets[i] = e;
-
- for (i = 0; i < oldNumBuckets; ++i) {
- struct util_node *firstNode = oldBuckets[i];
- while (firstNode != e) {
- unsigned h = firstNode->key;
- struct util_node *lastNode = firstNode;
- struct util_node *afterLastNode;
- struct util_node **beforeFirstNode;
-
- while (lastNode->next != e && lastNode->next->key == h)
- lastNode = lastNode->next;
-
- afterLastNode = lastNode->next;
- beforeFirstNode = &hash->buckets[h % hash->numBuckets];
- while (*beforeFirstNode != e)
- beforeFirstNode = &(*beforeFirstNode)->next;
- lastNode->next = *beforeFirstNode;
- *beforeFirstNode = firstNode;
- firstNode = afterLastNode;
- }
- }
- free(oldBuckets);
- }
-}
-
-static void util_data_might_grow(struct util_hash_data *hash)
-{
- if (hash->size >= hash->numBuckets)
- util_data_rehash(hash, hash->numBits + 1);
-}
-
-static void util_data_has_shrunk(struct util_hash_data *hash)
-{
- if (hash->size <= (hash->numBuckets >> 3) &&
- hash->numBits > hash->userNumBits) {
- int max = MAX(hash->numBits-2, hash->userNumBits);
- util_data_rehash(hash, max);
- }
-}
-
-static struct util_node *util_data_first_node(struct util_hash_data *hash)
-{
- struct util_node *e = (struct util_node *)(hash);
- struct util_node **bucket = hash->buckets;
- int n = hash->numBuckets;
- while (n--) {
- if (*bucket != e)
- return *bucket;
- ++bucket;
- }
- return e;
-}
-
-static struct util_node **util_hash_find_node(struct util_hash *hash, unsigned akey)
-{
- struct util_node **node;
-
- if (hash->data.d->numBuckets) {
- node = (struct util_node **)(&hash->data.d->buckets[akey % hash->data.d->numBuckets]);
- assert(*node == hash->data.e || (*node)->next);
- while (*node != hash->data.e && (*node)->key != akey)
- node = &(*node)->next;
- } else {
- node = (struct util_node **)((const struct util_node * const *)(&hash->data.e));
- }
- return node;
-}
-
-drm_private struct util_hash_iter
-util_hash_insert(struct util_hash *hash, unsigned key, void *data)
-{
- util_data_might_grow(hash->data.d);
-
- {
- struct util_node **nextNode = util_hash_find_node(hash, key);
- struct util_node *node = util_hash_create_node(hash, key, data, nextNode);
- if (!node) {
- struct util_hash_iter null_iter = {hash, 0};
- return null_iter;
- }
-
- {
- struct util_hash_iter iter = {hash, node};
- return iter;
- }
- }
-}
-
-drm_private struct util_hash *util_hash_create(void)
-{
- struct util_hash *hash = malloc(sizeof(struct util_hash));
- if (!hash)
- return NULL;
-
- hash->data.d = malloc(sizeof(struct util_hash_data));
- if (!hash->data.d) {
- free(hash);
- return NULL;
- }
-
- hash->data.d->fakeNext = 0;
- hash->data.d->buckets = 0;
- hash->data.d->size = 0;
- hash->data.d->nodeSize = sizeof(struct util_node);
- hash->data.d->userNumBits = (short)MinNumBits;
- hash->data.d->numBits = 0;
- hash->data.d->numBuckets = 0;
-
- return hash;
-}
-
-drm_private void util_hash_delete(struct util_hash *hash)
-{
- struct util_node *e_for_x = (struct util_node *)(hash->data.d);
- struct util_node **bucket = (struct util_node **)(hash->data.d->buckets);
- int n = hash->data.d->numBuckets;
- while (n--) {
- struct util_node *cur = *bucket++;
- while (cur != e_for_x) {
- struct util_node *next = cur->next;
- util_free_node(cur);
- cur = next;
- }
- }
- free(hash->data.d->buckets);
- free(hash->data.d);
- free(hash);
-}
-
-drm_private struct util_hash_iter
-util_hash_find(struct util_hash *hash, unsigned key)
-{
- struct util_node **nextNode = util_hash_find_node(hash, key);
- struct util_hash_iter iter = {hash, *nextNode};
- return iter;
-}
-
-drm_private unsigned util_hash_iter_key(struct util_hash_iter iter)
-{
- if (!iter.node || iter.hash->data.e == iter.node)
- return 0;
- return iter.node->key;
-}
-
-drm_private void *util_hash_iter_data(struct util_hash_iter iter)
-{
- if (!iter.node || iter.hash->data.e == iter.node)
- return 0;
- return iter.node->value;
-}
-
-static struct util_node *util_hash_data_next(struct util_node *node)
-{
- union {
- struct util_node *next;
- struct util_node *e;
- struct util_hash_data *d;
- } a;
- int start;
- struct util_node **bucket;
- int n;
-
- a.next = node->next;
- if (!a.next) {
- /* iterating beyond the last element */
- return 0;
- }
- if (a.next->next)
- return a.next;
-
- start = (node->key % a.d->numBuckets) + 1;
- bucket = a.d->buckets + start;
- n = a.d->numBuckets - start;
- while (n--) {
- if (*bucket != a.e)
- return *bucket;
- ++bucket;
- }
- return a.e;
-}
-
-drm_private struct util_hash_iter
-util_hash_iter_next(struct util_hash_iter iter)
-{
- struct util_hash_iter next = {iter.hash, util_hash_data_next(iter.node)};
- return next;
-}
-
-drm_private int util_hash_iter_is_null(struct util_hash_iter iter)
-{
- if (!iter.node || iter.node == iter.hash->data.e)
- return 1;
- return 0;
-}
-
-drm_private void *util_hash_take(struct util_hash *hash, unsigned akey)
-{
- struct util_node **node = util_hash_find_node(hash, akey);
- if (*node != hash->data.e) {
- void *t = (*node)->value;
- struct util_node *next = (*node)->next;
- util_free_node(*node);
- *node = next;
- --hash->data.d->size;
- util_data_has_shrunk(hash->data.d);
- return t;
- }
- return 0;
-}
-
-drm_private struct util_hash_iter util_hash_first_node(struct util_hash *hash)
-{
- struct util_hash_iter iter = {hash, util_data_first_node(hash->data.d)};
- return iter;
-}
-
-drm_private struct util_hash_iter
-util_hash_erase(struct util_hash *hash, struct util_hash_iter iter)
-{
- struct util_hash_iter ret = iter;
- struct util_node *node = iter.node;
- struct util_node **node_ptr;
-
- if (node == hash->data.e)
- return iter;
-
- ret = util_hash_iter_next(ret);
- node_ptr = (struct util_node**)(&hash->data.d->buckets[node->key % hash->data.d->numBuckets]);
- while (*node_ptr != node)
- node_ptr = &(*node_ptr)->next;
- *node_ptr = node->next;
- util_free_node(node);
- --hash->data.d->size;
- return ret;
-}
diff --git a/lib/libdrm/amdgpu/util_hash.h b/lib/libdrm/amdgpu/util_hash.h
deleted file mode 100644
index 01a4779ba..000000000
--- a/lib/libdrm/amdgpu/util_hash.h
+++ /dev/null
@@ -1,107 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2007 VMware, Inc.
- * All Rights Reserved.
- *
- * 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, sub license, 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 NON-INFRINGEMENT.
- * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS 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.
- *
- **************************************************************************/
-
-/**
- * @file
- * Hash implementation.
- *
- * This file provides a hash implementation that is capable of dealing
- * with collisions. It stores colliding entries in linked list. All
- * functions operating on the hash return an iterator. The iterator
- * itself points to the collision list. If there wasn't any collision
- * the list will have just one entry, otherwise client code should
- * iterate over the entries to find the exact entry among ones that
- * had the same key (e.g. memcmp could be used on the data to check
- * that)
- *
- * @author Zack Rusin <zackr@vmware.com>
- */
-
-#ifndef UTIL_HASH_H
-#define UTIL_HASH_H
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <stdbool.h>
-
-#include "libdrm_macros.h"
-
-struct util_hash;
-struct util_node;
-
-struct util_hash_iter {
- struct util_hash *hash;
- struct util_node *node;
-};
-
-
-drm_private struct util_hash *util_hash_create(void);
-drm_private void util_hash_delete(struct util_hash *hash);
-
-
-/**
- * Adds a data with the given key to the hash. If entry with the given
- * key is already in the hash, this current entry is instered before it
- * in the collision list.
- * Function returns iterator pointing to the inserted item in the hash.
- */
-drm_private struct util_hash_iter
-util_hash_insert(struct util_hash *hash, unsigned key, void *data);
-
-/**
- * Removes the item pointed to by the current iterator from the hash.
- * Note that the data itself is not erased and if it was a malloc'ed pointer
- * it will have to be freed after calling this function by the callee.
- * Function returns iterator pointing to the item after the removed one in
- * the hash.
- */
-drm_private struct util_hash_iter
-util_hash_erase(struct util_hash *hash, struct util_hash_iter iter);
-
-drm_private void *util_hash_take(struct util_hash *hash, unsigned key);
-
-
-drm_private struct util_hash_iter util_hash_first_node(struct util_hash *hash);
-
-/**
- * Return an iterator pointing to the first entry in the collision list.
- */
-drm_private struct util_hash_iter
-util_hash_find(struct util_hash *hash, unsigned key);
-
-
-drm_private int util_hash_iter_is_null(struct util_hash_iter iter);
-drm_private unsigned util_hash_iter_key(struct util_hash_iter iter);
-drm_private void *util_hash_iter_data(struct util_hash_iter iter);
-
-
-drm_private struct util_hash_iter
-util_hash_iter_next(struct util_hash_iter iter);
-
-#endif
diff --git a/lib/libdrm/amdgpu/util_hash_table.c b/lib/libdrm/amdgpu/util_hash_table.c
deleted file mode 100644
index fa7f6eabb..000000000
--- a/lib/libdrm/amdgpu/util_hash_table.c
+++ /dev/null
@@ -1,262 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2008 VMware, Inc.
- * All Rights Reserved.
- *
- * 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, sub license, 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 NON-INFRINGEMENT.
- * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS 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.
- *
- **************************************************************************/
-
-/**
- * @file
- * General purpose hash table implementation.
- *
- * Just uses the util_hash for now, but it might be better switch to a linear
- * probing hash table implementation at some point -- as it is said they have
- * better lookup and cache performance and it appears to be possible to write
- * a lock-free implementation of such hash tables .
- *
- * @author José Fonseca <jfonseca@vmware.com>
- */
-
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "util_hash_table.h"
-#include "util_hash.h"
-
-#include <stdlib.h>
-#include <assert.h>
-
-struct util_hash_table
-{
- struct util_hash *head;
-
- /** Hash function */
- unsigned (*make_hash)(void *key);
-
- /** Compare two keys */
- int (*compare)(void *key1, void *key2);
-};
-
-struct util_hash_table_item
-{
- void *key;
- void *value;
-};
-
-
-static struct util_hash_table_item *
-util_hash_table_item(struct util_hash_iter iter)
-{
- return (struct util_hash_table_item *)util_hash_iter_data(iter);
-}
-
-drm_private struct util_hash_table *
-util_hash_table_create(unsigned (*hash)(void *key),
- int (*compare)(void *key1, void *key2))
-{
- struct util_hash_table *ht;
-
- ht = malloc(sizeof(struct util_hash_table));
- if(!ht)
- return NULL;
-
- ht->head = util_hash_create();
- if(!ht->head) {
- free(ht);
- return NULL;
- }
-
- ht->make_hash = hash;
- ht->compare = compare;
-
- return ht;
-}
-
-static struct util_hash_iter
-util_hash_table_find_iter(struct util_hash_table *ht,
- void *key, unsigned key_hash)
-{
- struct util_hash_iter iter;
- struct util_hash_table_item *item;
-
- iter = util_hash_find(ht->head, key_hash);
- while (!util_hash_iter_is_null(iter)) {
- item = (struct util_hash_table_item *)util_hash_iter_data(iter);
- if (!ht->compare(item->key, key))
- break;
- iter = util_hash_iter_next(iter);
- }
-
- return iter;
-}
-
-static struct util_hash_table_item *
-util_hash_table_find_item(struct util_hash_table *ht,
- void *key, unsigned key_hash)
-{
- struct util_hash_iter iter;
- struct util_hash_table_item *item;
-
- iter = util_hash_find(ht->head, key_hash);
- while (!util_hash_iter_is_null(iter)) {
- item = (struct util_hash_table_item *)util_hash_iter_data(iter);
- if (!ht->compare(item->key, key))
- return item;
- iter = util_hash_iter_next(iter);
- }
-
- return NULL;
-}
-
-drm_private void
-util_hash_table_set(struct util_hash_table *ht, void *key, void *value)
-{
- unsigned key_hash;
- struct util_hash_table_item *item;
- struct util_hash_iter iter;
-
- assert(ht);
- if (!ht)
- return;
-
- key_hash = ht->make_hash(key);
-
- item = util_hash_table_find_item(ht, key, key_hash);
- if(item) {
- /* TODO: key/value destruction? */
- item->value = value;
- return;
- }
-
- item = malloc(sizeof(struct util_hash_table_item));
- if(!item)
- return;
-
- item->key = key;
- item->value = value;
-
- iter = util_hash_insert(ht->head, key_hash, item);
- if(util_hash_iter_is_null(iter)) {
- free(item);
- return;
- }
-}
-
-drm_private void *util_hash_table_get(struct util_hash_table *ht, void *key)
-{
- unsigned key_hash;
- struct util_hash_table_item *item;
-
- assert(ht);
- if (!ht)
- return NULL;
-
- key_hash = ht->make_hash(key);
-
- item = util_hash_table_find_item(ht, key, key_hash);
- if(!item)
- return NULL;
-
- return item->value;
-}
-
-drm_private void util_hash_table_remove(struct util_hash_table *ht, void *key)
-{
- unsigned key_hash;
- struct util_hash_iter iter;
- struct util_hash_table_item *item;
-
- assert(ht);
- if (!ht)
- return;
-
- key_hash = ht->make_hash(key);
-
- iter = util_hash_table_find_iter(ht, key, key_hash);
- if(util_hash_iter_is_null(iter))
- return;
-
- item = util_hash_table_item(iter);
- assert(item);
- free(item);
-
- util_hash_erase(ht->head, iter);
-}
-
-drm_private void util_hash_table_clear(struct util_hash_table *ht)
-{
- struct util_hash_iter iter;
- struct util_hash_table_item *item;
-
- assert(ht);
- if (!ht)
- return;
-
- iter = util_hash_first_node(ht->head);
- while (!util_hash_iter_is_null(iter)) {
- item = (struct util_hash_table_item *)util_hash_take(ht->head, util_hash_iter_key(iter));
- free(item);
- iter = util_hash_first_node(ht->head);
- }
-}
-
-drm_private void util_hash_table_foreach(struct util_hash_table *ht,
- void (*callback)(void *key, void *value, void *data),
- void *data)
-{
- struct util_hash_iter iter;
- struct util_hash_table_item *item;
-
- assert(ht);
- if (!ht)
- return;
-
- iter = util_hash_first_node(ht->head);
- while (!util_hash_iter_is_null(iter)) {
- item = (struct util_hash_table_item *)util_hash_iter_data(iter);
- callback(item->key, item->value, data);
- iter = util_hash_iter_next(iter);
- }
-}
-
-drm_private void util_hash_table_destroy(struct util_hash_table *ht)
-{
- struct util_hash_iter iter;
- struct util_hash_table_item *item;
-
- assert(ht);
- if (!ht)
- return;
-
- iter = util_hash_first_node(ht->head);
- while (!util_hash_iter_is_null(iter)) {
- item = (struct util_hash_table_item *)util_hash_iter_data(iter);
- free(item);
- iter = util_hash_iter_next(iter);
- }
-
- util_hash_delete(ht->head);
- free(ht);
-}
diff --git a/lib/libdrm/amdgpu/util_hash_table.h b/lib/libdrm/amdgpu/util_hash_table.h
deleted file mode 100644
index e00012890..000000000
--- a/lib/libdrm/amdgpu/util_hash_table.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2008 VMware, Inc.
- * All Rights Reserved.
- *
- * 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, sub license, 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 NON-INFRINGEMENT.
- * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS 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.
- *
- **************************************************************************/
-
-/**
- * General purpose hash table.
- *
- * @author José Fonseca <jfonseca@vmware.com>
- */
-
-#ifndef U_HASH_TABLE_H_
-#define U_HASH_TABLE_H_
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "libdrm_macros.h"
-
-/**
- * Generic purpose hash table.
- */
-struct util_hash_table;
-
-/**
- * Create an hash table.
- *
- * @param hash hash function
- * @param compare should return 0 for two equal keys.
- */
-drm_private struct util_hash_table *
-util_hash_table_create(unsigned (*hash)(void *key),
- int (*compare)(void *key1, void *key2));
-
-drm_private void
-util_hash_table_set(struct util_hash_table *ht, void *key, void *value);
-
-drm_private void *util_hash_table_get(struct util_hash_table *ht, void *key);
-
-drm_private void util_hash_table_remove(struct util_hash_table *ht, void *key);
-
-drm_private void util_hash_table_clear(struct util_hash_table *ht);
-
-drm_private void util_hash_table_foreach(struct util_hash_table *ht,
- void (*callback)(void *key, void *value, void *data),
- void *data);
-
-drm_private void util_hash_table_destroy(struct util_hash_table *ht);
-
-#endif /* U_HASH_TABLE_H_ */
diff --git a/lib/libdrm/config.h.in b/lib/libdrm/config.h.in
index dd63b0b12..e9d529ab9 100644
--- a/lib/libdrm/config.h.in
+++ b/lib/libdrm/config.h.in
@@ -24,27 +24,15 @@
/* Define to 1 if you have the `clock_gettime' function. */
#undef HAVE_CLOCK_GETTIME
-/* Enable CUNIT Have amdgpu support */
-#undef HAVE_CUNIT
-
/* Define to 1 if you have the <dlfcn.h> header file. */
#undef HAVE_DLFCN_H
-/* Have etnaviv support */
-#undef HAVE_ETNAVIV
-
/* Have EXYNOS support */
#undef HAVE_EXYNOS
-/* Have freedreno support */
-#undef HAVE_FREEDRENO
-
/* Have freedreno support for KGSL kernel interface */
#undef HAVE_FREEDRENO_KGSL
-/* Install test programs */
-#undef HAVE_INSTALL_TESTS
-
/* Have intel support */
#undef HAVE_INTEL
@@ -63,10 +51,7 @@
/* Have nouveau (nvidia) support */
#undef HAVE_NOUVEAU
-/* Have OMAP support */
-#undef HAVE_OMAP
-
-/* Define to 1 if you have the `open_memstream' function. */
+/* Have open_memstream() */
#undef HAVE_OPEN_MEMSTREAM
/* Have radeon support */
@@ -96,9 +81,6 @@
/* Define to 1 if you have the <sys/types.h> header file. */
#undef HAVE_SYS_TYPES_H
-/* Have Tegra support */
-#undef HAVE_TEGRA
-
/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
diff --git a/lib/libdrm/configure b/lib/libdrm/configure
index dc706d63b..640a36bb5 100644
--- a/lib/libdrm/configure
+++ b/lib/libdrm/configure
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for libdrm 2.4.89.
+# Generated by GNU Autoconf 2.69 for libdrm 2.4.94.
#
# Report bugs to <https://bugs.freedesktop.org/enter_bug.cgi?product=DRI>.
#
@@ -591,8 +591,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='libdrm'
PACKAGE_TARNAME='libdrm'
-PACKAGE_VERSION='2.4.89'
-PACKAGE_STRING='libdrm 2.4.89'
+PACKAGE_VERSION='2.4.94'
+PACKAGE_STRING='libdrm 2.4.94'
PACKAGE_BUGREPORT='https://bugs.freedesktop.org/enter_bug.cgi?product=DRI'
PACKAGE_URL=''
@@ -701,9 +701,6 @@ AR
DLLTOOL
OBJDUMP
LN_S
-NM
-ac_ct_DUMPBIN
-DUMPBIN
LD
FGREP
LIBTOOL
@@ -711,6 +708,9 @@ ALLOCA
EGREP
GREP
CPP
+NM
+ac_ct_DUMPBIN
+DUMPBIN
am__fastdepCC_FALSE
am__fastdepCC_TRUE
CCDEPMODE
@@ -1423,7 +1423,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures libdrm 2.4.89 to adapt to many kinds of systems.
+\`configure' configures libdrm 2.4.94 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1493,7 +1493,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of libdrm 2.4.89:";;
+ short | recursive ) echo "Configuration of libdrm 2.4.94:";;
esac
cat <<\_ACEOF
@@ -1663,7 +1663,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-libdrm configure 2.4.89
+libdrm configure 2.4.94
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2086,7 +2086,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by libdrm $as_me 2.4.89, which was
+It was created by libdrm $as_me 2.4.94, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
@@ -2895,6 +2895,36 @@ $as_echo "$ac_cv_path_SED" >&6; }
+case $host_os in
+ solaris*)
+ # Solaris 2.0 - 11.3 use SysV man page section numbers, so we
+ # check for a man page file found in later versions that use
+ # traditional section numbers instead
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for /usr/share/man/man7/attributes.7" >&5
+$as_echo_n "checking for /usr/share/man/man7/attributes.7... " >&6; }
+if ${ac_cv_file__usr_share_man_man7_attributes_7+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ test "$cross_compiling" = yes &&
+ as_fn_error $? "cannot check for file existence when cross compiling" "$LINENO" 5
+if test -r "/usr/share/man/man7/attributes.7"; then
+ ac_cv_file__usr_share_man_man7_attributes_7=yes
+else
+ ac_cv_file__usr_share_man_man7_attributes_7=no
+fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_file__usr_share_man_man7_attributes_7" >&5
+$as_echo "$ac_cv_file__usr_share_man_man7_attributes_7" >&6; }
+if test "x$ac_cv_file__usr_share_man_man7_attributes_7" = xyes; then :
+ SYSV_MAN_SECTIONS=false
+else
+ SYSV_MAN_SECTIONS=true
+fi
+
+ ;;
+ *) SYSV_MAN_SECTIONS=false ;;
+esac
+
if test x$APP_MAN_SUFFIX = x ; then
APP_MAN_SUFFIX=1
fi
@@ -2910,9 +2940,9 @@ if test x$LIB_MAN_DIR = x ; then
fi
if test x$FILE_MAN_SUFFIX = x ; then
- case $host_os in
- solaris*) FILE_MAN_SUFFIX=4 ;;
- *) FILE_MAN_SUFFIX=5 ;;
+ case $SYSV_MAN_SECTIONS in
+ true) FILE_MAN_SUFFIX=4 ;;
+ *) FILE_MAN_SUFFIX=5 ;;
esac
fi
if test x$FILE_MAN_DIR = x ; then
@@ -2920,9 +2950,9 @@ if test x$FILE_MAN_DIR = x ; then
fi
if test x$MISC_MAN_SUFFIX = x ; then
- case $host_os in
- solaris*) MISC_MAN_SUFFIX=5 ;;
- *) MISC_MAN_SUFFIX=7 ;;
+ case $SYSV_MAN_SECTIONS in
+ true) MISC_MAN_SUFFIX=5 ;;
+ *) MISC_MAN_SUFFIX=7 ;;
esac
fi
if test x$MISC_MAN_DIR = x ; then
@@ -2930,9 +2960,9 @@ if test x$MISC_MAN_DIR = x ; then
fi
if test x$DRIVER_MAN_SUFFIX = x ; then
- case $host_os in
- solaris*) DRIVER_MAN_SUFFIX=7 ;;
- *) DRIVER_MAN_SUFFIX=4 ;;
+ case $SYSV_MAN_SECTIONS in
+ true) DRIVER_MAN_SUFFIX=7 ;;
+ *) DRIVER_MAN_SUFFIX=4 ;;
esac
fi
if test x$DRIVER_MAN_DIR = x ; then
@@ -2940,9 +2970,9 @@ if test x$DRIVER_MAN_DIR = x ; then
fi
if test x$ADMIN_MAN_SUFFIX = x ; then
- case $host_os in
- solaris*) ADMIN_MAN_SUFFIX=1m ;;
- *) ADMIN_MAN_SUFFIX=8 ;;
+ case $SYSV_MAN_SECTIONS in
+ true) ADMIN_MAN_SUFFIX=1m ;;
+ *) ADMIN_MAN_SUFFIX=8 ;;
esac
fi
if test x$ADMIN_MAN_DIR = x ; then
@@ -3429,7 +3459,7 @@ fi
# Define the identity of the package.
PACKAGE='libdrm'
- VERSION='2.4.89'
+ VERSION='2.4.94'
cat >>confdefs.h <<_ACEOF
@@ -4675,6 +4705,208 @@ if test "x$ac_cv_prog_cc_c99" != xno; then :
fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for BSD- or MS-compatible name lister (nm)" >&5
+$as_echo_n "checking for BSD- or MS-compatible name lister (nm)... " >&6; }
+if ${lt_cv_path_NM+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$NM"; then
+ # Let the user override the test.
+ lt_cv_path_NM="$NM"
+else
+ lt_nm_to_check="${ac_tool_prefix}nm"
+ if test -n "$ac_tool_prefix" && test "$build" = "$host"; then
+ lt_nm_to_check="$lt_nm_to_check nm"
+ fi
+ for lt_tmp_nm in $lt_nm_to_check; do
+ lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+ for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do
+ IFS="$lt_save_ifs"
+ test -z "$ac_dir" && ac_dir=.
+ tmp_nm="$ac_dir/$lt_tmp_nm"
+ if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then
+ # Check to see if the nm accepts a BSD-compat flag.
+ # Adding the `sed 1q' prevents false positives on HP-UX, which says:
+ # nm: unknown option "B" ignored
+ # Tru64's nm complains that /dev/null is an invalid object file
+ case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in
+ */dev/null* | *'Invalid file or object type'*)
+ lt_cv_path_NM="$tmp_nm -B"
+ break
+ ;;
+ *)
+ case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in
+ */dev/null*)
+ lt_cv_path_NM="$tmp_nm -p"
+ break
+ ;;
+ *)
+ lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but
+ continue # so that we can try to find one that supports BSD flags
+ ;;
+ esac
+ ;;
+ esac
+ fi
+ done
+ IFS="$lt_save_ifs"
+ done
+ : ${lt_cv_path_NM=no}
+fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_NM" >&5
+$as_echo "$lt_cv_path_NM" >&6; }
+if test "$lt_cv_path_NM" != "no"; then
+ NM="$lt_cv_path_NM"
+else
+ # Didn't find any BSD compatible name lister, look for dumpbin.
+ if test -n "$DUMPBIN"; then :
+ # Let the user override the test.
+ else
+ if test -n "$ac_tool_prefix"; then
+ for ac_prog in dumpbin "link -dump"
+ do
+ # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_DUMPBIN+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$DUMPBIN"; then
+ ac_cv_prog_DUMPBIN="$DUMPBIN" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_DUMPBIN="$ac_tool_prefix$ac_prog"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+DUMPBIN=$ac_cv_prog_DUMPBIN
+if test -n "$DUMPBIN"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DUMPBIN" >&5
+$as_echo "$DUMPBIN" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$DUMPBIN" && break
+ done
+fi
+if test -z "$DUMPBIN"; then
+ ac_ct_DUMPBIN=$DUMPBIN
+ for ac_prog in dumpbin "link -dump"
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_DUMPBIN+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_DUMPBIN"; then
+ ac_cv_prog_ac_ct_DUMPBIN="$ac_ct_DUMPBIN" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_DUMPBIN="$ac_prog"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_DUMPBIN=$ac_cv_prog_ac_ct_DUMPBIN
+if test -n "$ac_ct_DUMPBIN"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DUMPBIN" >&5
+$as_echo "$ac_ct_DUMPBIN" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$ac_ct_DUMPBIN" && break
+done
+
+ if test "x$ac_ct_DUMPBIN" = x; then
+ DUMPBIN=":"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ DUMPBIN=$ac_ct_DUMPBIN
+ fi
+fi
+
+ case `$DUMPBIN -symbols /dev/null 2>&1 | sed '1q'` in
+ *COFF*)
+ DUMPBIN="$DUMPBIN -symbols"
+ ;;
+ *)
+ DUMPBIN=:
+ ;;
+ esac
+ fi
+
+ if test "$DUMPBIN" != ":"; then
+ NM="$DUMPBIN"
+ fi
+fi
+test -z "$NM" && NM=nm
+
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking the name lister ($NM) interface" >&5
+$as_echo_n "checking the name lister ($NM) interface... " >&6; }
+if ${lt_cv_nm_interface+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_nm_interface="BSD nm"
+ echo "int some_variable = 0;" > conftest.$ac_ext
+ (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&5)
+ (eval "$ac_compile" 2>conftest.err)
+ cat conftest.err >&5
+ (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
+ (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
+ cat conftest.err >&5
+ (eval echo "\"\$as_me:$LINENO: output\"" >&5)
+ cat conftest.out >&5
+ if $GREP 'External.*some_variable' conftest.out > /dev/null; then
+ lt_cv_nm_interface="MS dumpbin"
+ fi
+ rm -f conftest*
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_nm_interface" >&5
+$as_echo "$lt_cv_nm_interface" >&6; }
+
if test "x$ac_cv_prog_cc_c99" = xno; then
as_fn_error $? "Building libdrm requires C99 enabled compiler" "$LINENO" 5
@@ -5981,208 +6213,6 @@ with_gnu_ld=$lt_cv_prog_gnu_ld
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for BSD- or MS-compatible name lister (nm)" >&5
-$as_echo_n "checking for BSD- or MS-compatible name lister (nm)... " >&6; }
-if ${lt_cv_path_NM+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- if test -n "$NM"; then
- # Let the user override the test.
- lt_cv_path_NM="$NM"
-else
- lt_nm_to_check="${ac_tool_prefix}nm"
- if test -n "$ac_tool_prefix" && test "$build" = "$host"; then
- lt_nm_to_check="$lt_nm_to_check nm"
- fi
- for lt_tmp_nm in $lt_nm_to_check; do
- lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
- for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do
- IFS="$lt_save_ifs"
- test -z "$ac_dir" && ac_dir=.
- tmp_nm="$ac_dir/$lt_tmp_nm"
- if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then
- # Check to see if the nm accepts a BSD-compat flag.
- # Adding the `sed 1q' prevents false positives on HP-UX, which says:
- # nm: unknown option "B" ignored
- # Tru64's nm complains that /dev/null is an invalid object file
- case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in
- */dev/null* | *'Invalid file or object type'*)
- lt_cv_path_NM="$tmp_nm -B"
- break
- ;;
- *)
- case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in
- */dev/null*)
- lt_cv_path_NM="$tmp_nm -p"
- break
- ;;
- *)
- lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but
- continue # so that we can try to find one that supports BSD flags
- ;;
- esac
- ;;
- esac
- fi
- done
- IFS="$lt_save_ifs"
- done
- : ${lt_cv_path_NM=no}
-fi
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_NM" >&5
-$as_echo "$lt_cv_path_NM" >&6; }
-if test "$lt_cv_path_NM" != "no"; then
- NM="$lt_cv_path_NM"
-else
- # Didn't find any BSD compatible name lister, look for dumpbin.
- if test -n "$DUMPBIN"; then :
- # Let the user override the test.
- else
- if test -n "$ac_tool_prefix"; then
- for ac_prog in dumpbin "link -dump"
- do
- # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
-set dummy $ac_tool_prefix$ac_prog; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_DUMPBIN+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- if test -n "$DUMPBIN"; then
- ac_cv_prog_DUMPBIN="$DUMPBIN" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- ac_cv_prog_DUMPBIN="$ac_tool_prefix$ac_prog"
- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
- done
-IFS=$as_save_IFS
-
-fi
-fi
-DUMPBIN=$ac_cv_prog_DUMPBIN
-if test -n "$DUMPBIN"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DUMPBIN" >&5
-$as_echo "$DUMPBIN" >&6; }
-else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
- test -n "$DUMPBIN" && break
- done
-fi
-if test -z "$DUMPBIN"; then
- ac_ct_DUMPBIN=$DUMPBIN
- for ac_prog in dumpbin "link -dump"
-do
- # Extract the first word of "$ac_prog", so it can be a program name with args.
-set dummy $ac_prog; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_ac_ct_DUMPBIN+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- if test -n "$ac_ct_DUMPBIN"; then
- ac_cv_prog_ac_ct_DUMPBIN="$ac_ct_DUMPBIN" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- ac_cv_prog_ac_ct_DUMPBIN="$ac_prog"
- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
- done
-IFS=$as_save_IFS
-
-fi
-fi
-ac_ct_DUMPBIN=$ac_cv_prog_ac_ct_DUMPBIN
-if test -n "$ac_ct_DUMPBIN"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DUMPBIN" >&5
-$as_echo "$ac_ct_DUMPBIN" >&6; }
-else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
- test -n "$ac_ct_DUMPBIN" && break
-done
-
- if test "x$ac_ct_DUMPBIN" = x; then
- DUMPBIN=":"
- else
- case $cross_compiling:$ac_tool_warned in
-yes:)
-{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
-$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
-ac_tool_warned=yes ;;
-esac
- DUMPBIN=$ac_ct_DUMPBIN
- fi
-fi
-
- case `$DUMPBIN -symbols /dev/null 2>&1 | sed '1q'` in
- *COFF*)
- DUMPBIN="$DUMPBIN -symbols"
- ;;
- *)
- DUMPBIN=:
- ;;
- esac
- fi
-
- if test "$DUMPBIN" != ":"; then
- NM="$DUMPBIN"
- fi
-fi
-test -z "$NM" && NM=nm
-
-
-
-
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking the name lister ($NM) interface" >&5
-$as_echo_n "checking the name lister ($NM) interface... " >&6; }
-if ${lt_cv_nm_interface+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- lt_cv_nm_interface="BSD nm"
- echo "int some_variable = 0;" > conftest.$ac_ext
- (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&5)
- (eval "$ac_compile" 2>conftest.err)
- cat conftest.err >&5
- (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
- (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
- cat conftest.err >&5
- (eval echo "\"\$as_me:$LINENO: output\"" >&5)
- cat conftest.out >&5
- if $GREP 'External.*some_variable' conftest.out > /dev/null; then
- lt_cv_nm_interface="MS dumpbin"
- fi
- rm -f conftest*
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_nm_interface" >&5
-$as_echo "$lt_cv_nm_interface" >&6; }
-
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5
$as_echo_n "checking whether ln -s works... " >&6; }
LN_S=$as_ln_s
@@ -13016,14 +13046,19 @@ if test "x$ac_cv_func_open_memstream" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_OPEN_MEMSTREAM 1
_ACEOF
- HAVE_OPEN_MEMSTREAM=yes
+
+$as_echo "#define HAVE_OPEN_MEMSTREAM 1" >>confdefs.h
+
+else
+ $as_echo "#define HAVE_OPEN_MEMSTREAM 0" >>confdefs.h
+
fi
done
-MAYBE_WARN="-Wall -Wextra \
+MAYBE_WARN="-Wall -Wextra -Werror=undef \
-Wsign-compare -Werror-implicit-function-declaration \
-Wpointer-arith -Wwrite-strings -Wstrict-prototypes \
-Wmissing-prototypes -Wmissing-declarations -Wnested-externs \
@@ -13153,11 +13188,17 @@ if test "x$drm_cv_atomic_primitives" = xIntel; then
$as_echo "#define HAVE_LIBDRM_ATOMIC_PRIMITIVES 1" >>confdefs.h
+else
+ $as_echo "#define HAVE_LIBDRM_ATOMIC_PRIMITIVES 0" >>confdefs.h
+
fi
if test "x$drm_cv_atomic_primitives" = "xlibatomic-ops"; then
$as_echo "#define HAVE_LIB_ATOMIC_OPS 1" >>confdefs.h
+else
+ $as_echo "#define HAVE_LIB_ATOMIC_OPS 0" >>confdefs.h
+
fi
@@ -13372,6 +13413,9 @@ if test "x$UDEV" = xyes; then
$as_echo "#define UDEV 1" >>confdefs.h
+else
+ $as_echo "#define UDEV 0" >>confdefs.h
+
fi
@@ -13406,6 +13450,9 @@ if test "x$INTEL" = xyes; then
$as_echo "#define HAVE_INTEL 1" >>confdefs.h
+else
+ $as_echo "#define HAVE_INTEL 0" >>confdefs.h
+
fi
if test "x$VMWGFX" = xyes; then
@@ -13420,6 +13467,9 @@ if test "x$VMWGFX" = xyes; then
$as_echo "#define HAVE_VMWGFX 1" >>confdefs.h
+else
+ $as_echo "#define HAVE_VMWGFX 0" >>confdefs.h
+
fi
if test "x$NOUVEAU" = xyes; then
@@ -13434,6 +13484,9 @@ if test "x$NOUVEAU" = xyes; then
$as_echo "#define HAVE_NOUVEAU 1" >>confdefs.h
+else
+ $as_echo "#define HAVE_NOUVEAU 0" >>confdefs.h
+
fi
if test "x$OMAP" = xyes; then
@@ -13444,11 +13497,6 @@ else
HAVE_OMAP_FALSE=
fi
-if test "x$OMAP" = xyes; then
-
-$as_echo "#define HAVE_OMAP 1" >>confdefs.h
-
-fi
if test "x$EXYNOS" = xyes; then
HAVE_EXYNOS_TRUE=
@@ -13462,6 +13510,9 @@ if test "x$EXYNOS" = xyes; then
$as_echo "#define HAVE_EXYNOS 1" >>confdefs.h
+else
+ $as_echo "#define HAVE_EXYNOS 0" >>confdefs.h
+
fi
if test "x$FREEDRENO" = xyes; then
@@ -13472,11 +13523,6 @@ else
HAVE_FREEDRENO_FALSE=
fi
-if test "x$FREEDRENO" = xyes; then
-
-$as_echo "#define HAVE_FREEDRENO 1" >>confdefs.h
-
-fi
if test "x$FREEDRENO_KGSL" = xyes; then
if test "x$FREEDRENO" != xyes; then
@@ -13495,6 +13541,9 @@ if test "x$FREEDRENO_KGSL" = xyes; then
$as_echo "#define HAVE_FREEDRENO_KGSL 1" >>confdefs.h
+else
+ $as_echo "#define HAVE_FREEDRENO_KGSL 0" >>confdefs.h
+
fi
if test "x$RADEON" = xyes; then
@@ -13509,6 +13558,9 @@ if test "x$RADEON" = xyes; then
$as_echo "#define HAVE_RADEON 1" >>confdefs.h
+else
+ $as_echo "#define HAVE_RADEON 0" >>confdefs.h
+
fi
if test "x$AMDGPU" != xno; then
@@ -13662,14 +13714,13 @@ if test "x$AMDGPU" = xyes; then
$as_echo "#define HAVE_AMDGPU 1" >>confdefs.h
-
-$as_echo "#define HAVE_CUNIT test \"x\$have_cunit\" != \"xno\"" >>confdefs.h
-
-
if test "x$have_cunit" = "xno"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Could not find cunit library. Disabling amdgpu tests" >&5
$as_echo "$as_me: WARNING: Could not find cunit library. Disabling amdgpu tests" >&2;}
fi
+else
+ $as_echo "#define HAVE_AMDGPU 0" >>confdefs.h
+
fi
if test "x$TEGRA" = xyes; then
@@ -13680,11 +13731,6 @@ else
HAVE_TEGRA_FALSE=
fi
-if test "x$TEGRA" = xyes; then
-
-$as_echo "#define HAVE_TEGRA 1" >>confdefs.h
-
-fi
if test "x$VC4" = xyes; then
HAVE_VC4_TRUE=
@@ -13698,6 +13744,9 @@ if test "x$VC4" = xyes; then
$as_echo "#define HAVE_VC4 1" >>confdefs.h
+else
+ $as_echo "#define HAVE_VC4 0" >>confdefs.h
+
fi
if test "x$ETNAVIV" = xyes; then
@@ -13708,11 +13757,6 @@ else
HAVE_ETNAVIV_FALSE=
fi
-if test "x$ETNAVIV" = xyes; then
-
-$as_echo "#define HAVE_ETNAVIV 1" >>confdefs.h
-
-fi
if test "x$INSTALL_TESTS" = xyes; then
HAVE_INSTALL_TESTS_TRUE=
@@ -13722,11 +13766,6 @@ else
HAVE_INSTALL_TESTS_FALSE=
fi
-if test "x$INSTALL_TESTS" = xyes; then
-
-$as_echo "#define HAVE_INSTALL_TESTS 1" >>confdefs.h
-
-fi
# Check whether --enable-cairo-tests was given.
if test "${enable_cairo_tests+set}" = set; then :
@@ -13820,6 +13859,9 @@ if test "x$CAIRO" = xyes; then
$as_echo "#define HAVE_CAIRO 1" >>confdefs.h
+else
+ $as_echo "#define HAVE_CAIRO 0" >>confdefs.h
+
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CAIRO" >&5
$as_echo "$CAIRO" >&6; }
@@ -13990,6 +14032,9 @@ if test "x$VALGRIND" = "xyes"; then
$as_echo "#define HAVE_VALGRIND 1" >>confdefs.h
+else
+ $as_echo "#define HAVE_VALGRIND 0" >>confdefs.h
+
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $VALGRIND" >&5
@@ -14032,8 +14077,13 @@ if test "x$HAVE_ATTRIBUTE_VISIBILITY" = xyes; then
$as_echo "#define HAVE_VISIBILITY 1" >>confdefs.h
+else
+ $as_echo "#define HAVE_VISIBILITY 0" >>confdefs.h
+
fi
+CFLAGS="$CFLAGS -include config.h"
+
ac_config_files="$ac_config_files Makefile data/Makefile libkms/Makefile libkms/libkms.pc intel/Makefile intel/libdrm_intel.pc radeon/Makefile radeon/libdrm_radeon.pc amdgpu/Makefile amdgpu/libdrm_amdgpu.pc nouveau/Makefile nouveau/libdrm_nouveau.pc omap/Makefile omap/libdrm_omap.pc exynos/Makefile exynos/libdrm_exynos.pc freedreno/Makefile freedreno/libdrm_freedreno.pc tegra/Makefile tegra/libdrm_tegra.pc vc4/Makefile vc4/libdrm_vc4.pc etnaviv/Makefile etnaviv/libdrm_etnaviv.pc tests/Makefile tests/modeprint/Makefile tests/modetest/Makefile tests/kms/Makefile tests/kmstest/Makefile tests/proptest/Makefile tests/radeon/Makefile tests/amdgpu/Makefile tests/vbltest/Makefile tests/exynos/Makefile tests/tegra/Makefile tests/nouveau/Makefile tests/etnaviv/Makefile tests/util/Makefile man/Makefile libdrm.pc"
@@ -14647,7 +14697,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by libdrm $as_me 2.4.89, which was
+This file was extended by libdrm $as_me 2.4.94, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -14713,7 +14763,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
-libdrm config.status 2.4.89
+libdrm config.status 2.4.94
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
@@ -14842,6 +14892,7 @@ AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"
sed_quote_subst='$sed_quote_subst'
double_quote_subst='$double_quote_subst'
delay_variable_subst='$delay_variable_subst'
+NM='`$ECHO "$NM" | $SED "$delay_single_quote_subst"`'
macro_version='`$ECHO "$macro_version" | $SED "$delay_single_quote_subst"`'
macro_revision='`$ECHO "$macro_revision" | $SED "$delay_single_quote_subst"`'
enable_static='`$ECHO "$enable_static" | $SED "$delay_single_quote_subst"`'
@@ -14863,7 +14914,6 @@ GREP='`$ECHO "$GREP" | $SED "$delay_single_quote_subst"`'
EGREP='`$ECHO "$EGREP" | $SED "$delay_single_quote_subst"`'
FGREP='`$ECHO "$FGREP" | $SED "$delay_single_quote_subst"`'
LD='`$ECHO "$LD" | $SED "$delay_single_quote_subst"`'
-NM='`$ECHO "$NM" | $SED "$delay_single_quote_subst"`'
LN_S='`$ECHO "$LN_S" | $SED "$delay_single_quote_subst"`'
max_cmd_len='`$ECHO "$max_cmd_len" | $SED "$delay_single_quote_subst"`'
ac_objext='`$ECHO "$ac_objext" | $SED "$delay_single_quote_subst"`'
@@ -14986,7 +15036,8 @@ _LTECHO_EOF'
}
# Quote evaled strings.
-for var in SHELL \
+for var in NM \
+SHELL \
ECHO \
PATH_SEPARATOR \
SED \
@@ -14994,7 +15045,6 @@ GREP \
EGREP \
FGREP \
LD \
-NM \
LN_S \
lt_SP2NL \
lt_NL2SP \
@@ -15904,6 +15954,9 @@ available_tags=""
# ### BEGIN LIBTOOL CONFIG
+# A BSD- or MS-compatible name lister.
+NM=$lt_NM
+
# Which release of libtool.m4 was used?
macro_version=$macro_version
macro_revision=$macro_revision
@@ -15954,9 +16007,6 @@ EGREP=$lt_EGREP
# A literal string matcher.
FGREP=$lt_FGREP
-# A BSD- or MS-compatible name lister.
-NM=$lt_NM
-
# Whether we need soft or hard links.
LN_S=$lt_LN_S
diff --git a/lib/libdrm/configure.ac b/lib/libdrm/configure.ac
index d024fcd8c..7c8093b24 100644
--- a/lib/libdrm/configure.ac
+++ b/lib/libdrm/configure.ac
@@ -20,7 +20,7 @@
AC_PREREQ([2.63])
AC_INIT([libdrm],
- [2.4.89],
+ [2.4.94],
[https://bugs.freedesktop.org/enter_bug.cgi?product=DRI],
[libdrm])
@@ -45,6 +45,7 @@ m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
# Check for programs
AC_PROG_CC
AC_PROG_CC_C99
+AC_PROG_NM
if test "x$ac_cv_prog_cc_c99" = xno; then
AC_MSG_ERROR([Building libdrm requires C99 enabled compiler])
@@ -188,7 +189,9 @@ AC_CHECK_FUNCS([clock_gettime], [CLOCK_LIB=],
[AC_MSG_ERROR([Couldn't find clock_gettime])])])
AC_SUBST([CLOCK_LIB])
-AC_CHECK_FUNCS([open_memstream], [HAVE_OPEN_MEMSTREAM=yes])
+AC_CHECK_FUNCS([open_memstream],
+ [AC_DEFINE([HAVE_OPEN_MEMSTREAM], 1, [Have open_memstream()])],
+ [AC_DEFINE([HAVE_OPEN_MEMSTREAM], 0)])
dnl Use lots of warning flags with with gcc and compatible compilers
@@ -197,7 +200,7 @@ dnl skipped and all flags rechecked. So there's no need to do anything
dnl else. If for any reason you need to force a recheck, just change
dnl MAYBE_WARN in an ignorable way (like adding whitespace)
-MAYBE_WARN="-Wall -Wextra \
+MAYBE_WARN="-Wall -Wextra -Werror=undef \
-Wsign-compare -Werror-implicit-function-declaration \
-Wpointer-arith -Wwrite-strings -Wstrict-prototypes \
-Wmissing-prototypes -Wmissing-declarations -Wnested-externs \
@@ -259,9 +262,13 @@ AC_CACHE_CHECK([for native atomic primitives], drm_cv_atomic_primitives, [
if test "x$drm_cv_atomic_primitives" = xIntel; then
AC_DEFINE(HAVE_LIBDRM_ATOMIC_PRIMITIVES, 1,
[Enable if your compiler supports the Intel __sync_* atomic primitives])
+else
+ AC_DEFINE(HAVE_LIBDRM_ATOMIC_PRIMITIVES, 0)
fi
if test "x$drm_cv_atomic_primitives" = "xlibatomic-ops"; then
AC_DEFINE(HAVE_LIB_ATOMIC_OPS, 1, [Enable if you have libatomic-ops-dev installed])
+else
+ AC_DEFINE(HAVE_LIB_ATOMIC_OPS, 0)
fi
dnl Print out the approapriate message considering the value set be the
@@ -340,6 +347,8 @@ AC_SUBST(PCIACCESS_LIBS)
if test "x$UDEV" = xyes; then
AC_DEFINE(UDEV, 1, [Have UDEV support])
+else
+ AC_DEFINE(UDEV, 0)
fi
AC_CANONICAL_HOST
@@ -358,32 +367,34 @@ AM_CONDITIONAL(HAVE_LIBKMS, [test "x$LIBKMS" = xyes])
AM_CONDITIONAL(HAVE_INTEL, [test "x$INTEL" = xyes])
if test "x$INTEL" = xyes; then
AC_DEFINE(HAVE_INTEL, 1, [Have intel support])
+else
+ AC_DEFINE(HAVE_INTEL, 0)
fi
AM_CONDITIONAL(HAVE_VMWGFX, [test "x$VMWGFX" = xyes])
if test "x$VMWGFX" = xyes; then
AC_DEFINE(HAVE_VMWGFX, 1, [Have vmwgfx kernel headers])
+else
+ AC_DEFINE(HAVE_VMWGFX, 0)
fi
AM_CONDITIONAL(HAVE_NOUVEAU, [test "x$NOUVEAU" = xyes])
if test "x$NOUVEAU" = xyes; then
AC_DEFINE(HAVE_NOUVEAU, 1, [Have nouveau (nvidia) support])
+else
+ AC_DEFINE(HAVE_NOUVEAU, 0)
fi
AM_CONDITIONAL(HAVE_OMAP, [test "x$OMAP" = xyes])
-if test "x$OMAP" = xyes; then
- AC_DEFINE(HAVE_OMAP, 1, [Have OMAP support])
-fi
AM_CONDITIONAL(HAVE_EXYNOS, [test "x$EXYNOS" = xyes])
if test "x$EXYNOS" = xyes; then
AC_DEFINE(HAVE_EXYNOS, 1, [Have EXYNOS support])
+else
+ AC_DEFINE(HAVE_EXYNOS, 0)
fi
AM_CONDITIONAL(HAVE_FREEDRENO, [test "x$FREEDRENO" = xyes])
-if test "x$FREEDRENO" = xyes; then
- AC_DEFINE(HAVE_FREEDRENO, 1, [Have freedreno support])
-fi
if test "x$FREEDRENO_KGSL" = xyes; then
if test "x$FREEDRENO" != xyes; then
@@ -393,11 +404,15 @@ fi
AM_CONDITIONAL(HAVE_FREEDRENO_KGSL, [test "x$FREEDRENO_KGSL" = xyes])
if test "x$FREEDRENO_KGSL" = xyes; then
AC_DEFINE(HAVE_FREEDRENO_KGSL, 1, [Have freedreno support for KGSL kernel interface])
+else
+ AC_DEFINE(HAVE_FREEDRENO_KGSL, 0)
fi
AM_CONDITIONAL(HAVE_RADEON, [test "x$RADEON" = xyes])
if test "x$RADEON" = xyes; then
AC_DEFINE(HAVE_RADEON, 1, [Have radeon support])
+else
+ AC_DEFINE(HAVE_RADEON, 0)
fi
if test "x$AMDGPU" != xno; then
@@ -424,32 +439,25 @@ AM_CONDITIONAL(HAVE_AMDGPU, [test "x$AMDGPU" = xyes])
if test "x$AMDGPU" = xyes; then
AC_DEFINE(HAVE_AMDGPU, 1, [Have amdgpu support])
- AC_DEFINE(HAVE_CUNIT, [test "x$have_cunit" != "xno"], [Enable CUNIT Have amdgpu support])
-
if test "x$have_cunit" = "xno"; then
AC_MSG_WARN([Could not find cunit library. Disabling amdgpu tests])
fi
+else
+ AC_DEFINE(HAVE_AMDGPU, 0)
fi
AM_CONDITIONAL(HAVE_TEGRA, [test "x$TEGRA" = xyes])
-if test "x$TEGRA" = xyes; then
- AC_DEFINE(HAVE_TEGRA, 1, [Have Tegra support])
-fi
AM_CONDITIONAL(HAVE_VC4, [test "x$VC4" = xyes])
if test "x$VC4" = xyes; then
AC_DEFINE(HAVE_VC4, 1, [Have VC4 support])
+else
+ AC_DEFINE(HAVE_VC4, 0)
fi
AM_CONDITIONAL(HAVE_ETNAVIV, [test "x$ETNAVIV" = xyes])
-if test "x$ETNAVIV" = xyes; then
- AC_DEFINE(HAVE_ETNAVIV, 1, [Have etnaviv support])
-fi
AM_CONDITIONAL(HAVE_INSTALL_TESTS, [test "x$INSTALL_TESTS" = xyes])
-if test "x$INSTALL_TESTS" = xyes; then
- AC_DEFINE(HAVE_INSTALL_TESTS, 1, [Install test programs])
-fi
AC_ARG_ENABLE([cairo-tests],
[AS_HELP_STRING([--enable-cairo-tests],
@@ -467,6 +475,8 @@ if test "x$CAIRO" = xyes; then
AC_MSG_ERROR([Cairo support required but not present])
fi
AC_DEFINE(HAVE_CAIRO, 1, [Have Cairo support])
+else
+ AC_DEFINE(HAVE_CAIRO, 0)
fi
AC_MSG_RESULT([$CAIRO])
AM_CONDITIONAL(HAVE_CAIRO, [test "x$CAIRO" = xyes])
@@ -508,6 +518,8 @@ if test "x$VALGRIND" = "xyes"; then
AC_MSG_ERROR([Valgrind support required but not present])
fi
AC_DEFINE([HAVE_VALGRIND], 1, [Use valgrind intrinsics to suppress false warnings])
+else
+ AC_DEFINE([HAVE_VALGRIND], 0)
fi
AC_MSG_RESULT([$VALGRIND])
@@ -525,8 +537,12 @@ AC_LINK_IFELSE([AC_LANG_PROGRAM([
if test "x$HAVE_ATTRIBUTE_VISIBILITY" = xyes; then
AC_DEFINE(HAVE_VISIBILITY, 1, [Compiler supports __attribute__(("hidden"))])
+else
+ AC_DEFINE(HAVE_VISIBILITY, 0)
fi
+CFLAGS="$CFLAGS -include config.h"
+
AC_SUBST(WARN_CFLAGS)
AC_CONFIG_FILES([
Makefile
diff --git a/lib/libdrm/data/Makefile.in b/lib/libdrm/data/Makefile.in
index 45b42c0b1..d7d92fc10 100644
--- a/lib/libdrm/data/Makefile.in
+++ b/lib/libdrm/data/Makefile.in
@@ -72,7 +72,7 @@ POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
subdir = data
-DIST_COMMON = $(dist_libdrmdata_DATA) $(srcdir)/Makefile.am \
+DIST_COMMON = $(am__dist_libdrmdata_DATA_DIST) $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
@@ -104,6 +104,7 @@ am__can_run_installinfo = \
n|no|NO) false;; \
*) (install-info --version) >/dev/null 2>&1;; \
esac
+am__dist_libdrmdata_DATA_DIST = amdgpu.ids
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
@@ -284,7 +285,7 @@ target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
-dist_libdrmdata_DATA = amdgpu.ids
+@HAVE_AMDGPU_TRUE@dist_libdrmdata_DATA = amdgpu.ids
all: all-am
.SUFFIXES:
diff --git a/lib/libdrm/freedreno/Makefile.in b/lib/libdrm/freedreno/Makefile.in
index 2bc8ce0bf..17dbe2335 100644
--- a/lib/libdrm/freedreno/Makefile.in
+++ b/lib/libdrm/freedreno/Makefile.in
@@ -104,7 +104,7 @@ 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 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_device.c 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
@@ -336,7 +336,6 @@ LIBDRM_FREEDRENO_FILES := \
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
diff --git a/lib/libdrm/freedreno/msm/msm_drm.h b/lib/libdrm/freedreno/msm/msm_drm.h
deleted file mode 100644
index f7474c594..000000000
--- a/lib/libdrm/freedreno/msm/msm_drm.h
+++ /dev/null
@@ -1,226 +0,0 @@
-/*
- * Copyright (C) 2013 Red Hat
- * Author: Rob Clark <robdclark@gmail.com>
- *
- * 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.
- */
-
-#ifndef __MSM_DRM_H__
-#define __MSM_DRM_H__
-
-#include <stddef.h>
-#include "drm.h"
-
-/* 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
- * user/kernel compatibility
- * 2) Keep fields aligned to their size
- * 3) Because of how drm_ioctl() works, we can add new fields at
- * the end of an ioctl if some care is taken: drm_ioctl() will
- * zero out the new fields at the tail of the ioctl, so a zero
- * value should have a backwards compatible meaning. And for
- * output params, userspace won't see the newly added output
- * fields.. so that has to be somehow ok.
- */
-
-#define MSM_PIPE_NONE 0x00
-#define MSM_PIPE_2D0 0x01
-#define MSM_PIPE_2D1 0x02
-#define MSM_PIPE_3D0 0x10
-
-/* timeouts are specified in clock-monotonic absolute times (to simplify
- * restarting interrupted ioctls). The following struct is logically the
- * same as 'struct timespec' but 32/64b ABI safe.
- */
-struct drm_msm_timespec {
- int64_t tv_sec; /* seconds */
- int64_t tv_nsec; /* nanoseconds */
-};
-
-#define MSM_PARAM_GPU_ID 0x01
-#define MSM_PARAM_GMEM_SIZE 0x02
-#define MSM_PARAM_CHIP_ID 0x03
-
-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) */
-};
-
-/*
- * GEM buffers:
- */
-
-#define MSM_BO_SCANOUT 0x00000001 /* scanout capable */
-#define MSM_BO_GPU_READONLY 0x00000002
-#define MSM_BO_CACHE_MASK 0x000f0000
-/* cache modes */
-#define MSM_BO_CACHED 0x00010000
-#define MSM_BO_WC 0x00020000
-#define MSM_BO_UNCACHED 0x00040000
-
-#define MSM_BO_FLAGS (MSM_BO_SCANOUT | \
- MSM_BO_GPU_READONLY | \
- MSM_BO_CACHED | \
- MSM_BO_WC | \
- 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 */
-};
-
-struct drm_msm_gem_info {
- uint32_t handle; /* in */
- uint32_t pad;
- uint64_t offset; /* out, offset to pass to mmap() */
-};
-
-#define MSM_PREP_READ 0x01
-#define MSM_PREP_WRITE 0x02
-#define MSM_PREP_NOSYNC 0x04
-
-#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 */
- struct drm_msm_timespec timeout; /* in */
-};
-
-struct drm_msm_gem_cpu_fini {
- uint32_t handle; /* in */
-};
-
-/*
- * Cmdstream Submission:
- */
-
-/* The value written into the cmdstream is logically:
- *
- * ((relocbuf->gpuaddr + reloc_offset) << shift) | or
- *
- * When we have GPU's w/ >32bit ptrs, it should be possible to deal
- * with this by emit'ing two reloc entries with appropriate shift
- * values. Or a new MSM_SUBMIT_CMD_x type would also be an option.
- *
- * NOTE that reloc's must be sorted by order of increasing submit_offset,
- * 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 */
-};
-
-/* submit-types:
- * BUF - this cmd buffer is executed normally.
- * IB_TARGET_BUF - this cmd buffer is an IB target. Reloc's are
- * processed normally, but the kernel does not setup an IB to
- * this buffer in the first-level ringbuffer
- * CTX_RESTORE_BUF - only executed if there has been a GPU context
- * switch since the last SUBMIT ioctl
- */
-#define MSM_SUBMIT_CMD_BUF 0x0001
-#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 */
-};
-
-/* Each buffer referenced elsewhere in the cmdstream submit (ie. the
- * cmdstream buffer(s) themselves or reloc entries) has one (and only
- * one) entry in the submit->bos[] table.
- *
- * As a optimization, the current buffer (gpu virtual address) can be
- * passed back through the 'presumed' field. If on a subsequent reloc,
- * userspace passes back a 'presumed' address that is still valid,
- * then patching the cmdstream for this entry is skipped. This can
- * avoid kernel needing to map/access the cmdstream bo in the common
- * case.
- */
-#define MSM_SUBMIT_BO_READ 0x0001
-#define MSM_SUBMIT_BO_WRITE 0x0002
-
-#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 */
-};
-
-/* Each cmdstream submit consists of a table of buffers involved, and
- * one or more cmdstream buffers. This allows for conditional execution
- * (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 */
-};
-
-/* The normal way to synchronize with the GPU is just to CPU_PREP on
- * a buffer if you need to access it from the CPU (other cmdstream
- * submission from same or other contexts, PAGE_FLIP ioctl, etc, all
- * handle the required synchronization under the hood). This ioctl
- * mainly just exists as a way to implement the gallium pipe_fence
- * APIs without requiring a dummy bo to synchronize on.
- */
-struct drm_msm_wait_fence {
- uint32_t fence; /* in */
- uint32_t pad;
- struct drm_msm_timespec timeout; /* in */
-};
-
-#define DRM_MSM_GET_PARAM 0x00
-/* placeholder:
-#define DRM_MSM_SET_PARAM 0x01
- */
-#define DRM_MSM_GEM_NEW 0x02
-#define DRM_MSM_GEM_INFO 0x03
-#define DRM_MSM_GEM_CPU_PREP 0x04
-#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_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)
-#define DRM_IOCTL_MSM_GEM_INFO DRM_IOWR(DRM_COMMAND_BASE + DRM_MSM_GEM_INFO, struct drm_msm_gem_info)
-#define DRM_IOCTL_MSM_GEM_CPU_PREP DRM_IOW (DRM_COMMAND_BASE + DRM_MSM_GEM_CPU_PREP, struct drm_msm_gem_cpu_prep)
-#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)
-
-#endif /* __MSM_DRM_H__ */
diff --git a/lib/libdrm/include/drm/i915_drm.h b/lib/libdrm/include/drm/i915_drm.h
index 5ebe0462f..16e452aa1 100644
--- a/lib/libdrm/include/drm/i915_drm.h
+++ b/lib/libdrm/include/drm/i915_drm.h
@@ -86,6 +86,62 @@ enum i915_mocs_table_index {
I915_MOCS_CACHED,
};
+/*
+ * Different engines serve different roles, and there may be more than one
+ * engine serving each role. enum drm_i915_gem_engine_class provides a
+ * classification of the role of the engine, which may be used when requesting
+ * operations to be performed on a certain subset of engines, or for providing
+ * information about that group.
+ */
+enum drm_i915_gem_engine_class {
+ I915_ENGINE_CLASS_RENDER = 0,
+ I915_ENGINE_CLASS_COPY = 1,
+ I915_ENGINE_CLASS_VIDEO = 2,
+ I915_ENGINE_CLASS_VIDEO_ENHANCE = 3,
+
+ I915_ENGINE_CLASS_INVALID = -1
+};
+
+/**
+ * DOC: perf_events exposed by i915 through /sys/bus/event_sources/drivers/i915
+ *
+ */
+
+enum drm_i915_pmu_engine_sample {
+ I915_SAMPLE_BUSY = 0,
+ I915_SAMPLE_WAIT = 1,
+ I915_SAMPLE_SEMA = 2
+};
+
+#define I915_PMU_SAMPLE_BITS (4)
+#define I915_PMU_SAMPLE_MASK (0xf)
+#define I915_PMU_SAMPLE_INSTANCE_BITS (8)
+#define I915_PMU_CLASS_SHIFT \
+ (I915_PMU_SAMPLE_BITS + I915_PMU_SAMPLE_INSTANCE_BITS)
+
+#define __I915_PMU_ENGINE(class, instance, sample) \
+ ((class) << I915_PMU_CLASS_SHIFT | \
+ (instance) << I915_PMU_SAMPLE_BITS | \
+ (sample))
+
+#define I915_PMU_ENGINE_BUSY(class, instance) \
+ __I915_PMU_ENGINE(class, instance, I915_SAMPLE_BUSY)
+
+#define I915_PMU_ENGINE_WAIT(class, instance) \
+ __I915_PMU_ENGINE(class, instance, I915_SAMPLE_WAIT)
+
+#define I915_PMU_ENGINE_SEMA(class, instance) \
+ __I915_PMU_ENGINE(class, instance, I915_SAMPLE_SEMA)
+
+#define __I915_PMU_OTHER(x) (__I915_PMU_ENGINE(0xff, 0xff, 0xf) + 1 + (x))
+
+#define I915_PMU_ACTUAL_FREQUENCY __I915_PMU_OTHER(0)
+#define I915_PMU_REQUESTED_FREQUENCY __I915_PMU_OTHER(1)
+#define I915_PMU_INTERRUPTS __I915_PMU_OTHER(2)
+#define I915_PMU_RC6_RESIDENCY __I915_PMU_OTHER(3)
+
+#define I915_PMU_LAST I915_PMU_RC6_RESIDENCY
+
/* Each region is a minimum of 16k, and there are at most 255 of them.
*/
#define I915_NR_TEX_REGIONS 255 /* table size 2k - maximum due to use
@@ -260,6 +316,9 @@ typedef struct _drm_i915_sarea {
#define DRM_I915_GEM_CONTEXT_GETPARAM 0x34
#define DRM_I915_GEM_CONTEXT_SETPARAM 0x35
#define DRM_I915_PERF_OPEN 0x36
+#define DRM_I915_PERF_ADD_CONFIG 0x37
+#define DRM_I915_PERF_REMOVE_CONFIG 0x38
+#define DRM_I915_QUERY 0x39
#define DRM_IOCTL_I915_INIT DRM_IOW( DRM_COMMAND_BASE + DRM_I915_INIT, drm_i915_init_t)
#define DRM_IOCTL_I915_FLUSH DRM_IO ( DRM_COMMAND_BASE + DRM_I915_FLUSH)
@@ -315,6 +374,9 @@ typedef struct _drm_i915_sarea {
#define DRM_IOCTL_I915_GEM_CONTEXT_GETPARAM DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_GEM_CONTEXT_GETPARAM, struct drm_i915_gem_context_param)
#define DRM_IOCTL_I915_GEM_CONTEXT_SETPARAM DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_GEM_CONTEXT_SETPARAM, struct drm_i915_gem_context_param)
#define DRM_IOCTL_I915_PERF_OPEN DRM_IOW(DRM_COMMAND_BASE + DRM_I915_PERF_OPEN, struct drm_i915_perf_open_param)
+#define DRM_IOCTL_I915_PERF_ADD_CONFIG DRM_IOW(DRM_COMMAND_BASE + DRM_I915_PERF_ADD_CONFIG, struct drm_i915_perf_oa_config)
+#define DRM_IOCTL_I915_PERF_REMOVE_CONFIG DRM_IOW(DRM_COMMAND_BASE + DRM_I915_PERF_REMOVE_CONFIG, __u64)
+#define DRM_IOCTL_I915_QUERY DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_QUERY, struct drm_i915_query)
/* Allow drivers to submit batchbuffers directly to hardware, relying
* on the security mechanisms provided by hardware.
@@ -393,10 +455,20 @@ typedef struct drm_i915_irq_wait {
#define I915_PARAM_MIN_EU_IN_POOL 39
#define I915_PARAM_MMAP_GTT_VERSION 40
-/* Query whether DRM_I915_GEM_EXECBUFFER2 supports user defined execution
+/*
+ * Query whether DRM_I915_GEM_EXECBUFFER2 supports user defined execution
* priorities and the driver will attempt to execute batches in priority order.
+ * The param returns a capability bitmask, nonzero implies that the scheduler
+ * is enabled, with different features present according to the mask.
+ *
+ * The initial priority for each batch is supplied by the context and is
+ * controlled via I915_CONTEXT_PARAM_PRIORITY.
*/
#define I915_PARAM_HAS_SCHEDULER 41
+#define I915_SCHEDULER_CAP_ENABLED (1ul << 0)
+#define I915_SCHEDULER_CAP_PRIORITY (1ul << 1)
+#define I915_SCHEDULER_CAP_PREEMPTION (1ul << 2)
+
#define I915_PARAM_HUC_STATUS 42
/* Query whether DRM_I915_GEM_EXECBUFFER2 supports the ability to opt-out of
@@ -412,6 +484,51 @@ typedef struct drm_i915_irq_wait {
*/
#define I915_PARAM_HAS_EXEC_FENCE 44
+/* Query whether DRM_I915_GEM_EXECBUFFER2 supports the ability to capture
+ * user specified bufffers for post-mortem debugging of GPU hangs. See
+ * EXEC_OBJECT_CAPTURE.
+ */
+#define I915_PARAM_HAS_EXEC_CAPTURE 45
+
+#define I915_PARAM_SLICE_MASK 46
+
+/* Assuming it's uniform for each slice, this queries the mask of subslices
+ * per-slice for this system.
+ */
+#define I915_PARAM_SUBSLICE_MASK 47
+
+/*
+ * Query whether DRM_I915_GEM_EXECBUFFER2 supports supplying the batch buffer
+ * as the first execobject as opposed to the last. See I915_EXEC_BATCH_FIRST.
+ */
+#define I915_PARAM_HAS_EXEC_BATCH_FIRST 48
+
+/* Query whether DRM_I915_GEM_EXECBUFFER2 supports supplying an array of
+ * drm_i915_gem_exec_fence structures. See I915_EXEC_FENCE_ARRAY.
+ */
+#define I915_PARAM_HAS_EXEC_FENCE_ARRAY 49
+
+/*
+ * Query whether every context (both per-file default and user created) is
+ * isolated (insofar as HW supports). If this parameter is not true, then
+ * freshly created contexts may inherit values from an existing context,
+ * rather than default HW values. If true, it also ensures (insofar as HW
+ * supports) that all state set by this context will not leak to any other
+ * context.
+ *
+ * As not every engine across every gen support contexts, the returned
+ * value reports the support of context isolation for individual engines by
+ * returning a bitmask of each engine class set to true if that class supports
+ * isolation.
+ */
+#define I915_PARAM_HAS_CONTEXT_ISOLATION 50
+
+/* Frequency of the command streamer timestamps given by the *_TIMESTAMP
+ * registers. This used to be fixed per platform but from CNL onwards, this
+ * might vary depending on the parts.
+ */
+#define I915_PARAM_CS_TIMESTAMP_FREQUENCY 51
+
typedef struct drm_i915_getparam {
__s32 param;
/*
@@ -666,6 +783,8 @@ struct drm_i915_gem_relocation_entry {
#define I915_GEM_DOMAIN_VERTEX 0x00000020
/** GTT domain - aperture and scanout */
#define I915_GEM_DOMAIN_GTT 0x00000040
+/** WC domain - uncached access */
+#define I915_GEM_DOMAIN_WC 0x00000080
/** @} */
struct drm_i915_gem_exec_object {
@@ -773,8 +892,15 @@ struct drm_i915_gem_exec_object2 {
* I915_PARAM_HAS_EXEC_FENCE to order execbufs and execute them asynchronously.
*/
#define EXEC_OBJECT_ASYNC (1<<6)
+/* Request that the contents of this execobject be copied into the error
+ * state upon a GPU hang involving this batch for post-mortem debugging.
+ * These buffers are recorded in no particular order as "user" in
+ * /sys/class/drm/cardN/error. Query I915_PARAM_HAS_EXEC_CAPTURE to see
+ * if the kernel supports this flag.
+ */
+#define EXEC_OBJECT_CAPTURE (1<<7)
/* All remaining bits are MBZ and RESERVED FOR FUTURE USE */
-#define __EXEC_OBJECT_UNKNOWN_FLAGS -(EXEC_OBJECT_ASYNC<<1)
+#define __EXEC_OBJECT_UNKNOWN_FLAGS -(EXEC_OBJECT_CAPTURE<<1)
__u64 flags;
union {
@@ -784,6 +910,18 @@ struct drm_i915_gem_exec_object2 {
__u64 rsvd2;
};
+struct drm_i915_gem_exec_fence {
+ /**
+ * User's handle for a drm_syncobj to wait on or signal.
+ */
+ __u32 handle;
+
+#define I915_EXEC_FENCE_WAIT (1<<0)
+#define I915_EXEC_FENCE_SIGNAL (1<<1)
+#define __I915_EXEC_FENCE_UNKNOWN_FLAGS (-(I915_EXEC_FENCE_SIGNAL << 1))
+ __u32 flags;
+};
+
struct drm_i915_gem_execbuffer2 {
/**
* List of gem_exec_object2 structs
@@ -798,7 +936,11 @@ struct drm_i915_gem_execbuffer2 {
__u32 DR1;
__u32 DR4;
__u32 num_cliprects;
- /** This is a struct drm_clip_rect *cliprects */
+ /**
+ * This is a struct drm_clip_rect *cliprects if I915_EXEC_FENCE_ARRAY
+ * is not set. If I915_EXEC_FENCE_ARRAY is set, then this is a
+ * struct drm_i915_gem_exec_fence *fences.
+ */
__u64 cliprects_ptr;
#define I915_EXEC_RING_MASK (7<<0)
#define I915_EXEC_DEFAULT (0<<0)
@@ -889,7 +1031,24 @@ struct drm_i915_gem_execbuffer2 {
*/
#define I915_EXEC_FENCE_OUT (1<<17)
-#define __I915_EXEC_UNKNOWN_FLAGS (-(I915_EXEC_FENCE_OUT<<1))
+/*
+ * Traditionally the execbuf ioctl has only considered the final element in
+ * the execobject[] to be the executable batch. Often though, the client
+ * will known the batch object prior to construction and being able to place
+ * it into the execobject[] array first can simplify the relocation tracking.
+ * Setting I915_EXEC_BATCH_FIRST tells execbuf to use element 0 of the
+ * execobject[] as the * batch instead (the default is to use the last
+ * element).
+ */
+#define I915_EXEC_BATCH_FIRST (1<<18)
+
+/* Setting I915_FENCE_ARRAY implies that num_cliprects and cliprects_ptr
+ * define an array of i915_gem_exec_fence structures which specify a set of
+ * dma fences to wait upon or signal.
+ */
+#define I915_EXEC_FENCE_ARRAY (1<<19)
+
+#define __I915_EXEC_UNKNOWN_FLAGS (-(I915_EXEC_FENCE_ARRAY<<1))
#define I915_EXEC_CONTEXT_ID_MASK (0xffffffff)
#define i915_execbuffer2_set_context_id(eb2, context) \
@@ -1201,7 +1360,9 @@ struct drm_intel_overlay_attrs {
* active on a given plane.
*/
-#define I915_SET_COLORKEY_NONE (1<<0) /* disable color key matching */
+#define I915_SET_COLORKEY_NONE (1<<0) /* Deprecated. Instead set
+ * flags==0 to disable colorkeying.
+ */
#define I915_SET_COLORKEY_DESTINATION (1<<1)
#define I915_SET_COLORKEY_SOURCE (1<<2)
struct drm_intel_sprite_colorkey {
@@ -1239,14 +1400,16 @@ struct drm_i915_reg_read {
* be specified
*/
__u64 offset;
+#define I915_REG_READ_8B_WA (1ul << 0)
+
__u64 val; /* Return value */
};
/* Known registers:
*
* Render engine timestamp - 0x2358 + 64bit - gen7+
* - Note this register returns an invalid value if using the default
- * single instruction 8byte read, in order to workaround that use
- * offset (0x2538 | 1) instead.
+ * single instruction 8byte read, in order to workaround that pass
+ * flag I915_REG_READ_8B_WA in offset field.
*
*/
@@ -1289,17 +1452,26 @@ struct drm_i915_gem_context_param {
#define I915_CONTEXT_PARAM_GTT_SIZE 0x3
#define I915_CONTEXT_PARAM_NO_ERROR_CAPTURE 0x4
#define I915_CONTEXT_PARAM_BANNABLE 0x5
+#define I915_CONTEXT_PARAM_PRIORITY 0x6
+#define I915_CONTEXT_MAX_USER_PRIORITY 1023 /* inclusive */
+#define I915_CONTEXT_DEFAULT_PRIORITY 0
+#define I915_CONTEXT_MIN_USER_PRIORITY -1023 /* inclusive */
__u64 value;
};
enum drm_i915_oa_format {
- I915_OA_FORMAT_A13 = 1,
- I915_OA_FORMAT_A29,
- I915_OA_FORMAT_A13_B8_C8,
- I915_OA_FORMAT_B4_C8,
- I915_OA_FORMAT_A45_B8_C8,
- I915_OA_FORMAT_B4_C8_A16,
- I915_OA_FORMAT_C4_B8,
+ I915_OA_FORMAT_A13 = 1, /* HSW only */
+ I915_OA_FORMAT_A29, /* HSW only */
+ I915_OA_FORMAT_A13_B8_C8, /* HSW only */
+ I915_OA_FORMAT_B4_C8, /* HSW only */
+ I915_OA_FORMAT_A45_B8_C8, /* HSW only */
+ I915_OA_FORMAT_B4_C8_A16, /* HSW only */
+ I915_OA_FORMAT_C4_B8, /* HSW+ */
+
+ /* Gen8+ */
+ I915_OA_FORMAT_A12,
+ I915_OA_FORMAT_A12_B8_C8,
+ I915_OA_FORMAT_A32u40_A4u32_B8_C8,
I915_OA_FORMAT_MAX /* non-ABI */
};
@@ -1424,6 +1596,127 @@ enum drm_i915_perf_record_type {
DRM_I915_PERF_RECORD_MAX /* non-ABI */
};
+/**
+ * Structure to upload perf dynamic configuration into the kernel.
+ */
+struct drm_i915_perf_oa_config {
+ /** String formatted like "%08x-%04x-%04x-%04x-%012x" */
+ char uuid[36];
+
+ __u32 n_mux_regs;
+ __u32 n_boolean_regs;
+ __u32 n_flex_regs;
+
+ /*
+ * These fields are pointers to tuples of u32 values (register address,
+ * value). For example the expected length of the buffer pointed by
+ * mux_regs_ptr is (2 * sizeof(u32) * n_mux_regs).
+ */
+ __u64 mux_regs_ptr;
+ __u64 boolean_regs_ptr;
+ __u64 flex_regs_ptr;
+};
+
+struct drm_i915_query_item {
+ __u64 query_id;
+#define DRM_I915_QUERY_TOPOLOGY_INFO 1
+
+ /*
+ * When set to zero by userspace, this is filled with the size of the
+ * data to be written at the data_ptr pointer. The kernel sets this
+ * value to a negative value to signal an error on a particular query
+ * item.
+ */
+ __s32 length;
+
+ /*
+ * Unused for now. Must be cleared to zero.
+ */
+ __u32 flags;
+
+ /*
+ * Data will be written at the location pointed by data_ptr when the
+ * value of length matches the length of the data to be written by the
+ * kernel.
+ */
+ __u64 data_ptr;
+};
+
+struct drm_i915_query {
+ __u32 num_items;
+
+ /*
+ * Unused for now. Must be cleared to zero.
+ */
+ __u32 flags;
+
+ /*
+ * This points to an array of num_items drm_i915_query_item structures.
+ */
+ __u64 items_ptr;
+};
+
+/*
+ * Data written by the kernel with query DRM_I915_QUERY_TOPOLOGY_INFO :
+ *
+ * data: contains the 3 pieces of information :
+ *
+ * - the slice mask with one bit per slice telling whether a slice is
+ * available. The availability of slice X can be queried with the following
+ * formula :
+ *
+ * (data[X / 8] >> (X % 8)) & 1
+ *
+ * - the subslice mask for each slice with one bit per subslice telling
+ * whether a subslice is available. The availability of subslice Y in slice
+ * X can be queried with the following formula :
+ *
+ * (data[subslice_offset +
+ * X * subslice_stride +
+ * Y / 8] >> (Y % 8)) & 1
+ *
+ * - the EU mask for each subslice in each slice with one bit per EU telling
+ * whether an EU is available. The availability of EU Z in subslice Y in
+ * slice X can be queried with the following formula :
+ *
+ * (data[eu_offset +
+ * (X * max_subslices + Y) * eu_stride +
+ * Z / 8] >> (Z % 8)) & 1
+ */
+struct drm_i915_query_topology_info {
+ /*
+ * Unused for now. Must be cleared to zero.
+ */
+ __u16 flags;
+
+ __u16 max_slices;
+ __u16 max_subslices;
+ __u16 max_eus_per_subslice;
+
+ /*
+ * Offset in data[] at which the subslice masks are stored.
+ */
+ __u16 subslice_offset;
+
+ /*
+ * Stride at which each of the subslice masks for each slice are
+ * stored.
+ */
+ __u16 subslice_stride;
+
+ /*
+ * Offset in data[] at which the EU masks are stored.
+ */
+ __u16 eu_offset;
+
+ /*
+ * Stride at which each of the EU masks for each subslice are stored.
+ */
+ __u16 eu_stride;
+
+ __u8 data[];
+};
+
#if defined(__cplusplus)
}
#endif
diff --git a/lib/libdrm/intel/intel_bufmgr.c b/lib/libdrm/intel/intel_bufmgr.c
index a28534003..192de093c 100644
--- a/lib/libdrm/intel/intel_bufmgr.c
+++ b/lib/libdrm/intel/intel_bufmgr.c
@@ -25,10 +25,6 @@
*
*/
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
#include <string.h>
#include <stdlib.h>
#include <stdint.h>
@@ -36,7 +32,9 @@
#include <errno.h>
#include <drm.h>
#include <i915_drm.h>
+#ifndef __ANDROID__
#include <pciaccess.h>
+#endif
#include "libdrm_macros.h"
#include "intel_bufmgr.h"
#include "intel_bufmgr_priv.h"
@@ -326,6 +324,7 @@ drm_intel_get_pipe_from_crtc_id(drm_intel_bufmgr *bufmgr, int crtc_id)
return -1;
}
+#ifndef __ANDROID__
static size_t
drm_intel_probe_agp_aperture_size(int fd)
{
@@ -351,6 +350,15 @@ err:
pci_system_cleanup ();
return size;
}
+#else
+static size_t
+drm_intel_probe_agp_aperture_size(int fd)
+{
+ /* Nothing seems to rely on this value on Android anyway... */
+ fprintf(stderr, "%s: Mappable aperture size hardcoded to 64MiB\n", __func__);
+ return 64 * 1024 * 1024;
+}
+#endif
int
drm_intel_get_aperture_sizes(int fd, size_t *mappable, size_t *total)
diff --git a/lib/libdrm/intel/intel_bufmgr_fake.c b/lib/libdrm/intel/intel_bufmgr_fake.c
index 641df6a1e..3b24b81bb 100644
--- a/lib/libdrm/intel/intel_bufmgr_fake.c
+++ b/lib/libdrm/intel/intel_bufmgr_fake.c
@@ -34,10 +34,6 @@
* the bugs in the old texture manager.
*/
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
#include <stdlib.h>
#include <string.h>
#include <assert.h>
diff --git a/lib/libdrm/intel/intel_bufmgr_gem.c b/lib/libdrm/intel/intel_bufmgr_gem.c
index 71f140f54..8c3a4b209 100644
--- a/lib/libdrm/intel/intel_bufmgr_gem.c
+++ b/lib/libdrm/intel/intel_bufmgr_gem.c
@@ -34,10 +34,6 @@
* Dave Airlie <airlied@linux.ie>
*/
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
#include <xf86drm.h>
#include <xf86atomic.h>
#include <fcntl.h>
@@ -66,7 +62,7 @@
#include "i915_drm.h"
#include "uthash.h"
-#ifdef HAVE_VALGRIND
+#if HAVE_VALGRIND
#include <valgrind.h>
#include <memcheck.h>
#define VG(x) x
@@ -1629,7 +1625,7 @@ int
drm_intel_gem_bo_map_unsynchronized(drm_intel_bo *bo)
{
drm_intel_bufmgr_gem *bufmgr_gem = (drm_intel_bufmgr_gem *) bo->bufmgr;
-#ifdef HAVE_VALGRIND
+#if HAVE_VALGRIND
drm_intel_bo_gem *bo_gem = (drm_intel_bo_gem *) bo;
#endif
int ret;
@@ -3664,6 +3660,8 @@ drm_intel_bufmgr_gem_init(int fd, int batch_size)
bufmgr_gem->gen = 9;
else if (IS_GEN10(bufmgr_gem->pci_device))
bufmgr_gem->gen = 10;
+ else if (IS_GEN11(bufmgr_gem->pci_device))
+ bufmgr_gem->gen = 11;
else {
free(bufmgr_gem);
bufmgr_gem = NULL;
diff --git a/lib/libdrm/intel/intel_chipset.h b/lib/libdrm/intel/intel_chipset.h
index d81b16466..4a34b7bed 100644
--- a/lib/libdrm/intel/intel_chipset.h
+++ b/lib/libdrm/intel/intel_chipset.h
@@ -200,7 +200,7 @@
#define PCI_CHIP_KABYLAKE_ULT_GT2F 0x5921
#define PCI_CHIP_KABYLAKE_ULX_GT1_5 0x5915
#define PCI_CHIP_KABYLAKE_ULX_GT1 0x590E
-#define PCI_CHIP_KABYLAKE_ULX_GT2 0x591E
+#define PCI_CHIP_KABYLAKE_ULX_GT2_0 0x591E
#define PCI_CHIP_KABYLAKE_DT_GT2 0x5912
#define PCI_CHIP_KABYLAKE_M_GT2 0x5917
#define PCI_CHIP_KABYLAKE_DT_GT1 0x5902
@@ -212,6 +212,9 @@
#define PCI_CHIP_KABYLAKE_SRV_GT1 0x590A
#define PCI_CHIP_KABYLAKE_WKS_GT2 0x591D
+#define PCI_CHIP_AMBERLAKE_ULX_GT2_1 0x591C
+#define PCI_CHIP_AMBERLAKE_ULX_GT2_2 0x87C0
+
#define PCI_CHIP_BROXTON_0 0x0A84
#define PCI_CHIP_BROXTON_1 0x1A84
#define PCI_CHIP_BROXTON_2 0x5A84
@@ -223,26 +226,50 @@
#define PCI_CHIP_COFFEELAKE_S_GT1_1 0x3E90
#define PCI_CHIP_COFFEELAKE_S_GT1_2 0x3E93
+#define PCI_CHIP_COFFEELAKE_S_GT1_3 0x3E99
#define PCI_CHIP_COFFEELAKE_S_GT2_1 0x3E91
#define PCI_CHIP_COFFEELAKE_S_GT2_2 0x3E92
#define PCI_CHIP_COFFEELAKE_S_GT2_3 0x3E96
+#define PCI_CHIP_COFFEELAKE_S_GT2_4 0x3E98
+#define PCI_CHIP_COFFEELAKE_S_GT2_5 0x3E9A
#define PCI_CHIP_COFFEELAKE_H_GT2_1 0x3E9B
#define PCI_CHIP_COFFEELAKE_H_GT2_2 0x3E94
+#define PCI_CHIP_COFFEELAKE_U_GT2_1 0x3EA9
#define PCI_CHIP_COFFEELAKE_U_GT3_1 0x3EA5
#define PCI_CHIP_COFFEELAKE_U_GT3_2 0x3EA6
#define PCI_CHIP_COFFEELAKE_U_GT3_3 0x3EA7
#define PCI_CHIP_COFFEELAKE_U_GT3_4 0x3EA8
-#define PCI_CHIP_CANNONLAKE_U_GT2_0 0x5A52
-#define PCI_CHIP_CANNONLAKE_U_GT2_1 0x5A5A
-#define PCI_CHIP_CANNONLAKE_U_GT2_2 0x5A42
-#define PCI_CHIP_CANNONLAKE_U_GT2_3 0x5A4A
-#define PCI_CHIP_CANNONLAKE_Y_GT2_0 0x5A51
-#define PCI_CHIP_CANNONLAKE_Y_GT2_1 0x5A59
-#define PCI_CHIP_CANNONLAKE_Y_GT2_2 0x5A41
-#define PCI_CHIP_CANNONLAKE_Y_GT2_3 0x5A49
-#define PCI_CHIP_CANNONLAKE_Y_GT2_4 0x5A71
-#define PCI_CHIP_CANNONLAKE_Y_GT2_5 0x5A79
+#define PCI_CHIP_WHISKEYLAKE_U_GT1_1 0x3EA1
+#define PCI_CHIP_WHISKEYLAKE_U_GT2_1 0x3EA0
+#define PCI_CHIP_WHISKEYLAKE_U_GT3_1 0x3EA2
+#define PCI_CHIP_WHISKEYLAKE_U_GT3_2 0x3EA3
+#define PCI_CHIP_WHISKEYLAKE_U_GT3_3 0x3EA4
+
+#define PCI_CHIP_CANNONLAKE_0 0x5A51
+#define PCI_CHIP_CANNONLAKE_1 0x5A59
+#define PCI_CHIP_CANNONLAKE_2 0x5A41
+#define PCI_CHIP_CANNONLAKE_3 0x5A49
+#define PCI_CHIP_CANNONLAKE_4 0x5A52
+#define PCI_CHIP_CANNONLAKE_5 0x5A5A
+#define PCI_CHIP_CANNONLAKE_6 0x5A42
+#define PCI_CHIP_CANNONLAKE_7 0x5A4A
+#define PCI_CHIP_CANNONLAKE_8 0x5A50
+#define PCI_CHIP_CANNONLAKE_9 0x5A40
+#define PCI_CHIP_CANNONLAKE_10 0x5A54
+#define PCI_CHIP_CANNONLAKE_11 0x5A5C
+#define PCI_CHIP_CANNONLAKE_12 0x5A44
+#define PCI_CHIP_CANNONLAKE_13 0x5A4C
+
+#define PCI_CHIP_ICELAKE_11_0 0x8A50
+#define PCI_CHIP_ICELAKE_11_1 0x8A51
+#define PCI_CHIP_ICELAKE_11_2 0x8A5C
+#define PCI_CHIP_ICELAKE_11_3 0x8A5D
+#define PCI_CHIP_ICELAKE_11_4 0x8A52
+#define PCI_CHIP_ICELAKE_11_5 0x8A5A
+#define PCI_CHIP_ICELAKE_11_6 0x8A5B
+#define PCI_CHIP_ICELAKE_11_7 0x8A71
+#define PCI_CHIP_ICELAKE_11_8 0x8A70
#define IS_MOBILE(devid) ((devid) == PCI_CHIP_I855_GM || \
(devid) == PCI_CHIP_I915_GM || \
@@ -443,12 +470,14 @@
#define IS_KBL_GT2(devid) ((devid) == PCI_CHIP_KABYLAKE_ULT_GT2 || \
(devid) == PCI_CHIP_KABYLAKE_ULT_GT2F || \
- (devid) == PCI_CHIP_KABYLAKE_ULX_GT2 || \
+ (devid) == PCI_CHIP_KABYLAKE_ULX_GT2_0 || \
(devid) == PCI_CHIP_KABYLAKE_DT_GT2 || \
(devid) == PCI_CHIP_KABYLAKE_M_GT2 || \
(devid) == PCI_CHIP_KABYLAKE_HALO_GT2 || \
(devid) == PCI_CHIP_KABYLAKE_SRV_GT2 || \
- (devid) == PCI_CHIP_KABYLAKE_WKS_GT2)
+ (devid) == PCI_CHIP_KABYLAKE_WKS_GT2 || \
+ (devid) == PCI_CHIP_AMBERLAKE_ULX_GT2_1 || \
+ (devid) == PCI_CHIP_AMBERLAKE_ULX_GT2_2)
#define IS_KBL_GT3(devid) ((devid) == PCI_CHIP_KABYLAKE_ULT_GT3_0 || \
(devid) == PCI_CHIP_KABYLAKE_ULT_GT3_1 || \
@@ -477,17 +506,26 @@
#define IS_CFL_S(devid) ((devid) == PCI_CHIP_COFFEELAKE_S_GT1_1 || \
(devid) == PCI_CHIP_COFFEELAKE_S_GT1_2 || \
+ (devid) == PCI_CHIP_COFFEELAKE_S_GT1_3 || \
(devid) == PCI_CHIP_COFFEELAKE_S_GT2_1 || \
(devid) == PCI_CHIP_COFFEELAKE_S_GT2_2 || \
- (devid) == PCI_CHIP_COFFEELAKE_S_GT2_3)
+ (devid) == PCI_CHIP_COFFEELAKE_S_GT2_3 || \
+ (devid) == PCI_CHIP_COFFEELAKE_S_GT2_4 || \
+ (devid) == PCI_CHIP_COFFEELAKE_S_GT2_5)
#define IS_CFL_H(devid) ((devid) == PCI_CHIP_COFFEELAKE_H_GT2_1 || \
(devid) == PCI_CHIP_COFFEELAKE_H_GT2_2)
-#define IS_CFL_U(devid) ((devid) == PCI_CHIP_COFFEELAKE_U_GT3_1 || \
+#define IS_CFL_U(devid) ((devid) == PCI_CHIP_COFFEELAKE_U_GT2_1 || \
+ (devid) == PCI_CHIP_COFFEELAKE_U_GT3_1 || \
(devid) == PCI_CHIP_COFFEELAKE_U_GT3_2 || \
(devid) == PCI_CHIP_COFFEELAKE_U_GT3_3 || \
- (devid) == PCI_CHIP_COFFEELAKE_U_GT3_4)
+ (devid) == PCI_CHIP_COFFEELAKE_U_GT3_4 || \
+ (devid) == PCI_CHIP_WHISKEYLAKE_U_GT1_1 || \
+ (devid) == PCI_CHIP_WHISKEYLAKE_U_GT2_1 || \
+ (devid) == PCI_CHIP_WHISKEYLAKE_U_GT3_1 || \
+ (devid) == PCI_CHIP_WHISKEYLAKE_U_GT3_2 || \
+ (devid) == PCI_CHIP_WHISKEYLAKE_U_GT3_3)
#define IS_COFFEELAKE(devid) (IS_CFL_S(devid) || \
IS_CFL_H(devid) || \
@@ -499,22 +537,36 @@
IS_GEMINILAKE(devid) || \
IS_COFFEELAKE(devid))
-#define IS_CNL_Y(devid) ((devid) == PCI_CHIP_CANNONLAKE_Y_GT2_0 || \
- (devid) == PCI_CHIP_CANNONLAKE_Y_GT2_1 || \
- (devid) == PCI_CHIP_CANNONLAKE_Y_GT2_2 || \
- (devid) == PCI_CHIP_CANNONLAKE_Y_GT2_3 || \
- (devid) == PCI_CHIP_CANNONLAKE_Y_GT2_4 || \
- (devid) == PCI_CHIP_CANNONLAKE_Y_GT2_5)
+#define IS_CANNONLAKE(devid) ((devid) == PCI_CHIP_CANNONLAKE_0 || \
+ (devid) == PCI_CHIP_CANNONLAKE_1 || \
+ (devid) == PCI_CHIP_CANNONLAKE_2 || \
+ (devid) == PCI_CHIP_CANNONLAKE_3 || \
+ (devid) == PCI_CHIP_CANNONLAKE_4 || \
+ (devid) == PCI_CHIP_CANNONLAKE_5 || \
+ (devid) == PCI_CHIP_CANNONLAKE_6 || \
+ (devid) == PCI_CHIP_CANNONLAKE_7 || \
+ (devid) == PCI_CHIP_CANNONLAKE_8 || \
+ (devid) == PCI_CHIP_CANNONLAKE_9 || \
+ (devid) == PCI_CHIP_CANNONLAKE_10 || \
+ (devid) == PCI_CHIP_CANNONLAKE_11 || \
+ (devid) == PCI_CHIP_CANNONLAKE_12 || \
+ (devid) == PCI_CHIP_CANNONLAKE_13)
+
+#define IS_GEN10(devid) (IS_CANNONLAKE(devid))
-#define IS_CNL_U(devid) ((devid) == PCI_CHIP_CANNONLAKE_U_GT2_0 || \
- (devid) == PCI_CHIP_CANNONLAKE_U_GT2_1 || \
- (devid) == PCI_CHIP_CANNONLAKE_U_GT2_2 || \
- (devid) == PCI_CHIP_CANNONLAKE_U_GT2_3)
+#define IS_ICELAKE_11(devid) ((devid) == PCI_CHIP_ICELAKE_11_0 || \
+ (devid) == PCI_CHIP_ICELAKE_11_1 || \
+ (devid) == PCI_CHIP_ICELAKE_11_2 || \
+ (devid) == PCI_CHIP_ICELAKE_11_3 || \
+ (devid) == PCI_CHIP_ICELAKE_11_4 || \
+ (devid) == PCI_CHIP_ICELAKE_11_5 || \
+ (devid) == PCI_CHIP_ICELAKE_11_6 || \
+ (devid) == PCI_CHIP_ICELAKE_11_7 || \
+ (devid) == PCI_CHIP_ICELAKE_11_8)
-#define IS_CANNONLAKE(devid) (IS_CNL_U(devid) || \
- IS_CNL_Y(devid))
+#define IS_ICELAKE(devid) (IS_ICELAKE_11(devid))
-#define IS_GEN10(devid) (IS_CANNONLAKE(devid))
+#define IS_GEN11(devid) (IS_ICELAKE_11(devid))
#define IS_9XX(dev) (IS_GEN3(dev) || \
IS_GEN4(dev) || \
@@ -523,6 +575,7 @@
IS_GEN7(dev) || \
IS_GEN8(dev) || \
IS_GEN9(dev) || \
- IS_GEN10(dev))
+ IS_GEN10(dev) || \
+ IS_GEN11(dev))
#endif /* _INTEL_CHIPSET_H */
diff --git a/lib/libdrm/intel/intel_decode.c b/lib/libdrm/intel/intel_decode.c
index 3a81500f7..b24861b16 100644
--- a/lib/libdrm/intel/intel_decode.c
+++ b/lib/libdrm/intel/intel_decode.c
@@ -21,10 +21,6 @@
* IN THE SOFTWARE.
*/
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
#include <assert.h>
#include <stdint.h>
#include <stdlib.h>
@@ -3827,7 +3823,9 @@ drm_intel_decode_context_alloc(uint32_t devid)
ctx->devid = devid;
ctx->out = stdout;
- if (IS_GEN10(devid))
+ if (IS_GEN11(devid))
+ ctx->gen = 11;
+ else if (IS_GEN10(devid))
ctx->gen = 10;
else if (IS_GEN9(devid))
ctx->gen = 9;
diff --git a/lib/libdrm/intel/mm.c b/lib/libdrm/intel/mm.c
index 954e9dcb1..79d8719db 100644
--- a/lib/libdrm/intel/mm.c
+++ b/lib/libdrm/intel/mm.c
@@ -22,10 +22,6 @@
*
*/
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
#include <stdlib.h>
#include <assert.h>
diff --git a/lib/libdrm/intel/mm.h b/lib/libdrm/intel/mm.h
index 8d83743fd..1b0f84fcc 100644
--- a/lib/libdrm/intel/mm.h
+++ b/lib/libdrm/intel/mm.h
@@ -29,10 +29,6 @@
#ifndef MM_H
#define MM_H
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
#include "libdrm_macros.h"
struct mem_block {
diff --git a/lib/libdrm/libdrm_macros.h b/lib/libdrm/libdrm_macros.h
index 639d09047..211fab219 100644
--- a/lib/libdrm/libdrm_macros.h
+++ b/lib/libdrm/libdrm_macros.h
@@ -23,7 +23,7 @@
#ifndef LIBDRM_LIBDRM_H
#define LIBDRM_LIBDRM_H
-#if defined(HAVE_VISIBILITY)
+#if HAVE_VISIBILITY
# define drm_private __attribute__((visibility("hidden")))
#else
# define drm_private
diff --git a/lib/libdrm/libkms/api.c b/lib/libdrm/libkms/api.c
index 354d8a2eb..22dd32d78 100644
--- a/lib/libdrm/libkms/api.c
+++ b/lib/libdrm/libkms/api.c
@@ -26,10 +26,6 @@
**************************************************************************/
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
#include <errno.h>
#include <stdlib.h>
#include <string.h>
diff --git a/lib/libdrm/libkms/dumb.c b/lib/libdrm/libkms/dumb.c
index b95a072c1..17efc10a9 100644
--- a/lib/libdrm/libkms/dumb.c
+++ b/lib/libdrm/libkms/dumb.c
@@ -26,10 +26,6 @@
**************************************************************************/
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
diff --git a/lib/libdrm/libkms/intel.c b/lib/libdrm/libkms/intel.c
index 3d8ca055f..859e7a0f1 100644
--- a/lib/libdrm/libkms/intel.c
+++ b/lib/libdrm/libkms/intel.c
@@ -26,10 +26,6 @@
**************************************************************************/
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
diff --git a/lib/libdrm/libkms/internal.h b/lib/libdrm/libkms/internal.h
index 905f5b170..8b386db62 100644
--- a/lib/libdrm/libkms/internal.h
+++ b/lib/libdrm/libkms/internal.h
@@ -29,10 +29,6 @@
#ifndef INTERNAL_H_
#define INTERNAL_H_
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
#include "libdrm_macros.h"
#include "libkms.h"
diff --git a/lib/libdrm/libkms/linux.c b/lib/libdrm/libkms/linux.c
index 0b50777ef..56205054e 100644
--- a/lib/libdrm/libkms/linux.c
+++ b/lib/libdrm/libkms/linux.c
@@ -29,10 +29,6 @@
* going from fd to pci id via fstat and udev.
*/
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
@@ -110,27 +106,27 @@ linux_from_sysfs(int fd, struct kms_driver **out)
if (ret)
return ret;
-#ifdef HAVE_INTEL
+#if HAVE_INTEL
if (!strcmp(name, "intel"))
ret = intel_create(fd, out);
else
#endif
-#ifdef HAVE_VMWGFX
+#if HAVE_VMWGFX
if (!strcmp(name, "vmwgfx"))
ret = vmwgfx_create(fd, out);
else
#endif
-#ifdef HAVE_NOUVEAU
+#if HAVE_NOUVEAU
if (!strcmp(name, "nouveau"))
ret = nouveau_create(fd, out);
else
#endif
-#ifdef HAVE_RADEON
+#if HAVE_RADEON
if (!strcmp(name, "radeon"))
ret = radeon_create(fd, out);
else
#endif
-#ifdef HAVE_EXYNOS
+#if HAVE_EXYNOS
if (!strcmp(name, "exynos"))
ret = exynos_create(fd, out);
else
diff --git a/lib/libdrm/libkms/nouveau.c b/lib/libdrm/libkms/nouveau.c
index d10e0fdb0..7fe23db33 100644
--- a/lib/libdrm/libkms/nouveau.c
+++ b/lib/libdrm/libkms/nouveau.c
@@ -26,10 +26,6 @@
**************************************************************************/
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
diff --git a/lib/libdrm/libkms/radeon.c b/lib/libdrm/libkms/radeon.c
index aaeeaf31d..2cb2b11fb 100644
--- a/lib/libdrm/libkms/radeon.c
+++ b/lib/libdrm/libkms/radeon.c
@@ -26,10 +26,6 @@
**************************************************************************/
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
diff --git a/lib/libdrm/libkms/vmwgfx.c b/lib/libdrm/libkms/vmwgfx.c
index 6a24fd4df..f0e40be75 100644
--- a/lib/libdrm/libkms/vmwgfx.c
+++ b/lib/libdrm/libkms/vmwgfx.c
@@ -26,10 +26,6 @@
**************************************************************************/
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
#include <errno.h>
#include <stdlib.h>
#include <string.h>
diff --git a/lib/libdrm/radeon/radeon_bo.c b/lib/libdrm/radeon/radeon_bo.c
index 447f92803..821807bcc 100644
--- a/lib/libdrm/radeon/radeon_bo.c
+++ b/lib/libdrm/radeon/radeon_bo.c
@@ -29,9 +29,6 @@
* Dave Airlie
* Jérôme Glisse <glisse@freedesktop.org>
*/
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
#include <libdrm_macros.h>
#include <radeon_bo.h>
#include <radeon_bo_int.h>
diff --git a/lib/libdrm/radeon/radeon_bo_gem.c b/lib/libdrm/radeon/radeon_bo_gem.c
index fbd453d9c..774b26e41 100644
--- a/lib/libdrm/radeon/radeon_bo_gem.c
+++ b/lib/libdrm/radeon/radeon_bo_gem.c
@@ -29,9 +29,6 @@
* Dave Airlie
* Jérôme Glisse <glisse@freedesktop.org>
*/
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
diff --git a/lib/libdrm/radeon/radeon_cs.c b/lib/libdrm/radeon/radeon_cs.c
index dffb869fa..eb7859e50 100644
--- a/lib/libdrm/radeon/radeon_cs.c
+++ b/lib/libdrm/radeon/radeon_cs.c
@@ -1,6 +1,3 @@
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
#include "libdrm_macros.h"
#include <stdio.h>
#include "radeon_cs.h"
diff --git a/lib/libdrm/radeon/radeon_cs_gem.c b/lib/libdrm/radeon/radeon_cs_gem.c
index f3dccb6c2..4d5fc13ad 100644
--- a/lib/libdrm/radeon/radeon_cs_gem.c
+++ b/lib/libdrm/radeon/radeon_cs_gem.c
@@ -29,9 +29,6 @@
* Nicolai Haehnle <prefect_@gmx.net>
* Jérôme Glisse <glisse@freedesktop.org>
*/
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
#include <assert.h>
#include <errno.h>
#include <stdlib.h>
diff --git a/lib/libdrm/radeon/radeon_cs_space.c b/lib/libdrm/radeon/radeon_cs_space.c
index 69287be5b..8531c345a 100644
--- a/lib/libdrm/radeon/radeon_cs_space.c
+++ b/lib/libdrm/radeon/radeon_cs_space.c
@@ -25,9 +25,6 @@
*/
/*
*/
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
#include <assert.h>
#include <errno.h>
#include <stdlib.h>
diff --git a/lib/libdrm/radeon/radeon_surface.c b/lib/libdrm/radeon/radeon_surface.c
index 04df77d63..3cafcfcba 100644
--- a/lib/libdrm/radeon/radeon_surface.c
+++ b/lib/libdrm/radeon/radeon_surface.c
@@ -26,9 +26,6 @@
* Authors:
* Jérôme Glisse <jglisse@redhat.com>
*/
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
#include <stdbool.h>
#include <assert.h>
#include <errno.h>
diff --git a/lib/libdrm/tests/Makefile.in b/lib/libdrm/tests/Makefile.in
index ea500ecb0..b33ccfd5a 100644
--- a/lib/libdrm/tests/Makefile.in
+++ b/lib/libdrm/tests/Makefile.in
@@ -13,6 +13,7 @@
# PARTICULAR PURPOSE.
@SET_MAKE@
+
VPATH = @srcdir@
am__make_dryrun = \
{ \
@@ -57,7 +58,9 @@ host_triplet = @host@
@HAVE_ETNAVIV_TRUE@am__append_6 = etnaviv
@HAVE_NOUVEAU_TRUE@am__append_7 = nouveau
TESTS = drmsl$(EXEEXT) hash$(EXEEXT) random$(EXEEXT)
-check_PROGRAMS = $(am__EXEEXT_1) drmdevice$(EXEEXT)
+check_PROGRAMS = $(am__EXEEXT_1) $(am__EXEEXT_2)
+@HAVE_INSTALL_TESTS_TRUE@bin_PROGRAMS = drmdevice$(EXEEXT)
+@HAVE_INSTALL_TESTS_FALSE@am__append_8 = drmdevice
subdir = tests
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
$(top_srcdir)/build-aux/depcomp
@@ -72,7 +75,10 @@ mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
+am__installdirs = "$(DESTDIR)$(bindir)"
am__EXEEXT_1 = drmsl$(EXEEXT) hash$(EXEEXT) random$(EXEEXT)
+@HAVE_INSTALL_TESTS_FALSE@am__EXEEXT_2 = drmdevice$(EXEEXT)
+PROGRAMS = $(bin_PROGRAMS)
drmdevice_SOURCES = drmdevice.c
drmdevice_OBJECTS = drmdevice.$(OBJEXT)
drmdevice_LDADD = $(LDADD)
@@ -373,6 +379,52 @@ $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):
+install-binPROGRAMS: $(bin_PROGRAMS)
+ @$(NORMAL_INSTALL)
+ @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+ if test -n "$$list"; then \
+ echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \
+ fi; \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed 's/$(EXEEXT)$$//' | \
+ while read p p1; do if test -f $$p || test -f $$p1; \
+ then echo "$$p"; echo "$$p"; else :; fi; \
+ done | \
+ sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \
+ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
+ sed 'N;N;N;s,\n, ,g' | \
+ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
+ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
+ if ($$2 == $$4) files[d] = files[d] " " $$1; \
+ else { print "f", $$3 "/" $$4, $$1; } } \
+ END { for (d in files) print "f", d, files[d] }' | \
+ while read type dir files; do \
+ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
+ test -z "$$files" || { \
+ echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \
+ $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \
+ } \
+ ; done
+
+uninstall-binPROGRAMS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+ files=`for p in $$list; do echo "$$p"; done | \
+ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
+ -e 's/$$/$(EXEEXT)/' `; \
+ test -n "$$list" || exit 0; \
+ echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
+ cd "$(DESTDIR)$(bindir)" && rm -f $$files
+
+clean-binPROGRAMS:
+ @list='$(bin_PROGRAMS)'; test -n "$$list" || exit 0; \
+ echo " rm -f" $$list; \
+ rm -f $$list || exit $$?; \
+ test -n "$(EXEEXT)" || exit 0; \
+ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
+ echo " rm -f" $$list; \
+ rm -f $$list
clean-checkPROGRAMS:
@list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \
@@ -711,9 +763,12 @@ check-am: all-am
$(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS)
$(MAKE) $(AM_MAKEFLAGS) check-TESTS
check: check-recursive
-all-am: Makefile
+all-am: Makefile $(PROGRAMS)
installdirs: installdirs-recursive
installdirs-am:
+ for dir in "$(DESTDIR)$(bindir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
install: install-recursive
install-exec: install-exec-recursive
install-data: install-data-recursive
@@ -746,8 +801,8 @@ maintainer-clean-generic:
@echo "it deletes files that may require special tools to rebuild."
clean: clean-recursive
-clean-am: clean-checkPROGRAMS clean-generic clean-libtool \
- mostlyclean-am
+clean-am: clean-binPROGRAMS clean-checkPROGRAMS clean-generic \
+ clean-libtool mostlyclean-am
distclean: distclean-recursive
-rm -rf ./$(DEPDIR)
@@ -773,7 +828,7 @@ install-dvi: install-dvi-recursive
install-dvi-am:
-install-exec-am:
+install-exec-am: install-binPROGRAMS
install-html: install-html-recursive
@@ -813,27 +868,28 @@ ps: ps-recursive
ps-am:
-uninstall-am:
+uninstall-am: uninstall-binPROGRAMS
.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) check-am \
cscopelist-recursive ctags-recursive install-am install-strip \
tags-recursive
.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
- all all-am check check-TESTS check-am clean \
+ all all-am check check-TESTS check-am clean clean-binPROGRAMS \
clean-checkPROGRAMS clean-generic clean-libtool cscopelist \
cscopelist-recursive ctags ctags-recursive 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-man \
- install-pdf install-pdf-am install-ps install-ps-am \
- install-strip installcheck installcheck-am installdirs \
- installdirs-am maintainer-clean maintainer-clean-generic \
- mostlyclean mostlyclean-compile mostlyclean-generic \
- mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \
- uninstall uninstall-am
+ install install-am install-binPROGRAMS install-data \
+ install-data-am install-dvi install-dvi-am install-exec \
+ install-exec-am install-html install-html-am install-info \
+ install-info-am install-man install-pdf install-pdf-am \
+ install-ps install-ps-am install-strip installcheck \
+ installcheck-am installdirs installdirs-am maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ tags tags-recursive uninstall uninstall-am \
+ uninstall-binPROGRAMS
# Tell versions [3.59,3.63) of GNU make to not export all variables.
diff --git a/lib/libdrm/xf86atomic.h b/lib/libdrm/xf86atomic.h
index 922b37da6..2d733bd53 100644
--- a/lib/libdrm/xf86atomic.h
+++ b/lib/libdrm/xf86atomic.h
@@ -34,10 +34,6 @@
#ifndef LIBDRM_ATOMICS_H
#define LIBDRM_ATOMICS_H
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
#if HAVE_LIBDRM_ATOMIC_PRIMITIVES
#define HAS_ATOMIC_OPS 1
@@ -101,7 +97,7 @@ typedef struct { LIBDRM_ATOMIC_TYPE atomic; } atomic_t;
#endif
-#if ! HAS_ATOMIC_OPS
+#if !defined(HAS_ATOMIC_OPS)
#error libdrm requires atomic operations, please define them for your CPU/compiler.
#endif
diff --git a/lib/libdrm/xf86drm.c b/lib/libdrm/xf86drm.c
index f9d83d2af..a7f0d3ea5 100644
--- a/lib/libdrm/xf86drm.c
+++ b/lib/libdrm/xf86drm.c
@@ -31,9 +31,6 @@
* DEALINGS IN THE SOFTWARE.
*/
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
@@ -295,7 +292,7 @@ static int drmMatchBusID(const char *id1, const char *id2, int pci_domain_ok)
* If any other failure happened then it will output error mesage using
* drmMsg() call.
*/
-#if !defined(UDEV)
+#if !UDEV
static int chown_check_return(const char *path, uid_t owner, gid_t group)
{
int rv;
@@ -346,7 +343,7 @@ static int drmOpenDevice(dev_t dev, int minor, int type)
int fd;
mode_t devmode = DRM_DEV_MODE, serv_mode;
gid_t serv_group;
-#if !defined(UDEV)
+#if !UDEV
int isroot = !geteuid();
uid_t user = DRM_DEV_UID;
gid_t group = DRM_DEV_GID;
@@ -376,7 +373,7 @@ static int drmOpenDevice(dev_t dev, int minor, int type)
}
#ifndef __OpenBSD__
-#if !defined(UDEV)
+#if !UDEV
if (stat(DRM_DIR_NAME, &st)) {
if (!isroot)
return DRM_ERR_NOT_ROOT;
@@ -425,7 +422,7 @@ wait_for_udev:
#endif /* __OpenBSD__ */
#ifndef X_PRIVSEP
- fd = open(buf, O_RDWR, 0);
+ fd = open(buf, O_RDWR | O_CLOEXEC, 0);
#else
fd = priv_open_device(buf);
#endif
@@ -434,7 +431,7 @@ wait_for_udev:
if (fd >= 0)
return fd;
-#if !defined(UDEV) && !defined(__OpenBSD__)
+#if !UDEV && !defined(__OpenBSD__)
/* Check if the device node is not what we expect it to be, and recreate it
* and try again if so.
*/
@@ -448,7 +445,7 @@ wait_for_udev:
chmod(buf, devmode);
}
}
- fd = open(buf, O_RDWR, 0);
+ fd = open(buf, O_RDWR | O_CLOEXEC, 0);
drmMsg("drmOpenDevice: open result is %d, (%s)\n",
fd, fd < 0 ? strerror(errno) : "OK");
if (fd >= 0)
@@ -498,7 +495,7 @@ static int drmOpenMinor(int minor, int create, int type)
sprintf(buf, dev_name, DRM_DIR_NAME, minor);
#ifndef X_PRIVSEP
- fd = open(buf, O_RDWR, 0);
+ fd = open(buf, O_RDWR | O_CLOEXEC, 0);
#else
fd = priv_open_device(buf);
#endif
@@ -2847,12 +2844,11 @@ static char *drmGetMinorNameForFD(int fd, int type)
{
#ifdef __linux__
DIR *sysdir;
- struct dirent *pent, *ent;
+ struct dirent *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)
@@ -2875,30 +2871,18 @@ static char *drmGetMinorNameForFD(int fd, int type)
if (!sysdir)
return NULL;
- 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) {
+ while ((ent = readdir(sysdir))) {
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);
-
return strdup(dev_name);
}
}
- free(pent);
-
-out_close_dir:
closedir(sysdir);
+ return NULL;
#else
struct stat sbuf;
char buf[PATH_MAX + 1];
@@ -2939,7 +2923,6 @@ out_close_dir:
return strdup(buf);
#endif
- return NULL;
}
char *drmGetPrimaryDeviceNameFromFd(int fd)
@@ -2996,6 +2979,9 @@ sysfs_uevent_get(const char *path, const char *fmt, ...)
}
#endif
+/* Little white lie to avoid major rework of the existing code */
+#define DRM_BUS_VIRTIO 0x10
+
static int drmParseSubsystemType(int maj, int min)
{
#ifdef __linux__
@@ -3025,6 +3011,9 @@ static int drmParseSubsystemType(int maj, int min)
if (strncmp(name, "/host1x", 7) == 0)
return DRM_BUS_HOST1X;
+ if (strncmp(name, "/virtio", 7) == 0)
+ return DRM_BUS_VIRTIO;
+
return -EINVAL;
#elif defined(__OpenBSD__)
return DRM_BUS_PCI;
@@ -3034,16 +3023,33 @@ static int drmParseSubsystemType(int maj, int min)
#endif
}
+static char *
+get_real_pci_path(int maj, int min, char *real_path)
+{
+ char path[PATH_MAX + 1], *term;
+
+ snprintf(path, sizeof(path), "/sys/dev/char/%d:%d/device", maj, min);
+ if (!realpath(path, real_path))
+ return NULL;
+
+ term = strrchr(real_path, '/');
+ if (term && strncmp(term, "/virtio", 7) == 0)
+ *term = 0;
+
+ return real_path;
+}
+
static int drmParsePciBusInfo(int maj, int min, drmPciBusInfoPtr info)
{
#ifdef __linux__
unsigned int domain, bus, dev, func;
- char path[PATH_MAX + 1], *value;
+ char real_path[PATH_MAX + 1], *value;
int num;
- snprintf(path, sizeof(path), "/sys/dev/char/%d:%d/device", maj, min);
+ if (get_real_pci_path(maj, min, real_path) == NULL)
+ return -ENOENT;
- value = sysfs_uevent_get(path, "PCI_SLOT_NAME");
+ value = sysfs_uevent_get(real_path, "PCI_SLOT_NAME");
if (!value)
return -ENOENT;
@@ -3156,14 +3162,16 @@ static int parse_separate_sysfs_files(int maj, int min,
"subsystem_vendor",
"subsystem_device",
};
- char path[PATH_MAX + 1];
+ char path[PATH_MAX + 1], real_path[PATH_MAX + 1];
unsigned int data[ARRAY_SIZE(attrs)];
FILE *fp;
int ret;
+ if (get_real_pci_path(maj, min, real_path) == NULL)
+ return -ENOENT;
+
for (unsigned i = ignore_revision ? 1 : 0; i < ARRAY_SIZE(attrs); i++) {
- snprintf(path, PATH_MAX, "/sys/dev/char/%d:%d/device/%s", maj, min,
- attrs[i]);
+ snprintf(path, PATH_MAX, "%s/%s", real_path, attrs[i]);
fp = fopen(path, "r");
if (!fp)
return -errno;
@@ -3187,11 +3195,14 @@ static int parse_separate_sysfs_files(int maj, int min,
static int parse_config_sysfs_file(int maj, int min,
drmPciDeviceInfoPtr device)
{
- char path[PATH_MAX + 1];
+ char path[PATH_MAX + 1], real_path[PATH_MAX + 1];
unsigned char config[64];
int fd, ret;
- snprintf(path, PATH_MAX, "/sys/dev/char/%d:%d/device/config", maj, min);
+ if (get_real_pci_path(maj, min, real_path) == NULL)
+ return -ENOENT;
+
+ snprintf(path, PATH_MAX, "%s/config", real_path);
fd = open(path, O_RDONLY);
if (fd < 0)
return -errno;
@@ -3718,6 +3729,53 @@ free_device:
return ret;
}
+static int
+process_device(drmDevicePtr *device, const char *d_name,
+ int req_subsystem_type,
+ bool fetch_deviceinfo, uint32_t flags)
+{
+ struct stat sbuf;
+ char node[PATH_MAX + 1];
+ int node_type, subsystem_type;
+ unsigned int maj, min;
+
+ node_type = drmGetNodeType(d_name);
+ if (node_type < 0)
+ return -1;
+
+ snprintf(node, PATH_MAX, "%s/%s", DRM_DIR_NAME, d_name);
+ if (stat(node, &sbuf))
+ return -1;
+
+ maj = major(sbuf.st_rdev);
+ min = minor(sbuf.st_rdev);
+
+ if (maj != DRM_MAJOR || !S_ISCHR(sbuf.st_mode))
+ return -1;
+
+ subsystem_type = drmParseSubsystemType(maj, min);
+ if (req_subsystem_type != -1 && req_subsystem_type != subsystem_type)
+ return -1;
+
+ switch (subsystem_type) {
+ case DRM_BUS_PCI:
+ case DRM_BUS_VIRTIO:
+ return drmProcessPciDevice(device, node, node_type, maj, min,
+ fetch_deviceinfo, flags);
+ case DRM_BUS_USB:
+ return drmProcessUsbDevice(device, node, node_type, maj, min,
+ fetch_deviceinfo, flags);
+ case DRM_BUS_PLATFORM:
+ return drmProcessPlatformDevice(device, node, node_type, maj, min,
+ fetch_deviceinfo, flags);
+ case DRM_BUS_HOST1X:
+ return drmProcessHost1xDevice(device, node, node_type, maj, min,
+ fetch_deviceinfo, flags);
+ default:
+ return -1;
+ }
+}
+
/* Consider devices located on the same bus as duplicate and fold the respective
* entries into a single one.
*
@@ -3747,6 +3805,28 @@ drm_device_validate_flags(uint32_t flags)
return (flags & ~DRM_DEVICE_GET_PCI_REVISION);
}
+static bool
+drm_device_has_rdev(drmDevicePtr device, dev_t find_rdev)
+{
+ struct stat sbuf;
+
+ for (int i = 0; i < DRM_NODE_MAX; i++) {
+ if (device->available_nodes & 1 << i) {
+ if (stat(device->nodes[i], &sbuf) == 0 &&
+ sbuf.st_rdev == find_rdev)
+ return true;
+ }
+ }
+ return false;
+}
+
+/*
+ * The kernel drm core has a number of places that assume maximum of
+ * 3x64 devices nodes. That's 64 for each of primary, control and
+ * render nodes. Rounded it up to 256 for simplicity.
+ */
+#define MAX_DRM_NODES 256
+
/**
* Get information about the opened drm device
*
@@ -3827,16 +3907,14 @@ int drmGetDevice2(int fd, uint32_t flags, drmDevicePtr *device)
return 0;
#else
- drmDevicePtr *local_devices;
+ drmDevicePtr local_devices[MAX_DRM_NODES];
drmDevicePtr d;
DIR *sysdir;
struct dirent *dent;
struct stat sbuf;
- char node[PATH_MAX + 1];
- int node_type, subsystem_type;
+ int subsystem_type;
int maj, min;
int ret, i, node_count;
- int max_count = 16;
dev_t find_rdev;
if (drm_device_validate_flags(flags))
@@ -3856,108 +3934,48 @@ int drmGetDevice2(int fd, uint32_t flags, drmDevicePtr *device)
return -EINVAL;
subsystem_type = drmParseSubsystemType(maj, min);
-
- local_devices = calloc(max_count, sizeof(drmDevicePtr));
- if (local_devices == NULL)
- return -ENOMEM;
+ if (subsystem_type < 0)
+ return subsystem_type;
sysdir = opendir(DRM_DIR_NAME);
- if (!sysdir) {
- ret = -errno;
- goto free_locals;
- }
+ if (!sysdir)
+ return -errno;
i = 0;
while ((dent = readdir(sysdir))) {
- node_type = drmGetNodeType(dent->d_name);
- if (node_type < 0)
- continue;
-
- snprintf(node, PATH_MAX, "%s/%s", DRM_DIR_NAME, dent->d_name);
- if (stat(node, &sbuf))
- continue;
-
- maj = major(sbuf.st_rdev);
- min = minor(sbuf.st_rdev);
-
- if (maj != DRM_MAJOR || !S_ISCHR(sbuf.st_mode))
- continue;
-
- if (drmParseSubsystemType(maj, min) != subsystem_type)
+ ret = process_device(&d, dent->d_name, subsystem_type, true, flags);
+ if (ret)
continue;
- switch (subsystem_type) {
- case DRM_BUS_PCI:
- ret = drmProcessPciDevice(&d, node, node_type, maj, min, true, flags);
- if (ret)
- continue;
-
- break;
-
- case DRM_BUS_USB:
- ret = drmProcessUsbDevice(&d, node, node_type, maj, min, true, flags);
- if (ret)
- continue;
-
- break;
-
- case DRM_BUS_PLATFORM:
- ret = drmProcessPlatformDevice(&d, node, node_type, maj, min, true, flags);
- if (ret)
- continue;
-
- break;
-
- case DRM_BUS_HOST1X:
- ret = drmProcessHost1xDevice(&d, node, node_type, maj, min, true, flags);
- if (ret)
- continue;
-
+ if (i >= MAX_DRM_NODES) {
+ fprintf(stderr, "More than %d drm nodes detected. "
+ "Please report a bug - that should not happen.\n"
+ "Skipping extra nodes\n", MAX_DRM_NODES);
break;
-
- default:
- continue;
- }
-
- if (i >= max_count) {
- drmDevicePtr *temp;
-
- max_count += 16;
- temp = realloc(local_devices, max_count * sizeof(drmDevicePtr));
- if (!temp)
- goto free_devices;
- local_devices = temp;
- }
-
- /* 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;
+ local_devices[i] = d;
i++;
}
node_count = i;
drmFoldDuplicatedDevices(local_devices, node_count);
- *device = local_devices[0];
- drmFreeDevices(&local_devices[1], node_count - 1);
+ *device = NULL;
+
+ for (i = 0; i < node_count; i++) {
+ if (!local_devices[i])
+ continue;
+
+ if (drm_device_has_rdev(local_devices[i], find_rdev))
+ *device = local_devices[i];
+ else
+ drmFreeDevice(&local_devices[i]);
+ }
closedir(sysdir);
- free(local_devices);
if (*device == NULL)
return -ENODEV;
return 0;
-
-free_devices:
- drmFreeDevices(local_devices, i);
- closedir(sysdir);
-
-free_locals:
- free(local_devices);
- return ret;
#endif
}
@@ -3993,98 +4011,31 @@ int drmGetDevice(int fd, drmDevicePtr *device)
*/
int drmGetDevices2(uint32_t flags, drmDevicePtr devices[], int max_devices)
{
- drmDevicePtr *local_devices;
+ drmDevicePtr local_devices[MAX_DRM_NODES];
drmDevicePtr device;
DIR *sysdir;
struct dirent *dent;
- struct stat sbuf;
- char node[PATH_MAX + 1];
- int node_type, subsystem_type;
- int maj, min;
int ret, i, node_count, device_count;
- int max_count = 16;
if (drm_device_validate_flags(flags))
return -EINVAL;
- local_devices = calloc(max_count, sizeof(drmDevicePtr));
- if (local_devices == NULL)
- return -ENOMEM;
-
sysdir = opendir(DRM_DIR_NAME);
- if (!sysdir) {
- ret = -errno;
- goto free_locals;
- }
+ if (!sysdir)
+ return -errno;
i = 0;
while ((dent = readdir(sysdir))) {
- node_type = drmGetNodeType(dent->d_name);
- if (node_type < 0)
- continue;
-
- snprintf(node, PATH_MAX, "%s/%s", DRM_DIR_NAME, dent->d_name);
- if (stat(node, &sbuf))
- continue;
-
- maj = major(sbuf.st_rdev);
- min = minor(sbuf.st_rdev);
-
- if (maj != DRM_MAJOR || !S_ISCHR(sbuf.st_mode))
- continue;
-
- subsystem_type = drmParseSubsystemType(maj, min);
-
- if (subsystem_type < 0)
+ ret = process_device(&device, dent->d_name, -1, devices != NULL, flags);
+ if (ret)
continue;
- switch (subsystem_type) {
- case DRM_BUS_PCI:
- ret = drmProcessPciDevice(&device, node, node_type,
- maj, min, devices != NULL, flags);
- if (ret)
- continue;
-
- break;
-
- case DRM_BUS_USB:
- ret = drmProcessUsbDevice(&device, node, node_type, maj, min,
- devices != NULL, flags);
- if (ret)
- continue;
-
+ if (i >= MAX_DRM_NODES) {
+ fprintf(stderr, "More than %d drm nodes detected. "
+ "Please report a bug - that should not happen.\n"
+ "Skipping extra nodes\n", MAX_DRM_NODES);
break;
-
- case DRM_BUS_PLATFORM:
- ret = drmProcessPlatformDevice(&device, node, node_type, maj, min,
- devices != NULL, flags);
- if (ret)
- continue;
-
- break;
-
- case DRM_BUS_HOST1X:
- ret = drmProcessHost1xDevice(&device, node, node_type, maj, min,
- devices != NULL, flags);
- if (ret)
- continue;
-
- break;
-
- default:
- continue;
}
-
- if (i >= max_count) {
- drmDevicePtr *temp;
-
- max_count += 16;
- temp = realloc(local_devices, max_count * sizeof(drmDevicePtr));
- if (!temp)
- goto free_devices;
- local_devices = temp;
- }
-
local_devices[i] = device;
i++;
}
@@ -4106,16 +4057,7 @@ int drmGetDevices2(uint32_t flags, drmDevicePtr devices[], int max_devices)
}
closedir(sysdir);
- free(local_devices);
return device_count;
-
-free_devices:
- drmFreeDevices(local_devices, i);
- closedir(sysdir);
-
-free_locals:
- free(local_devices);
- return ret;
}
/**
@@ -4296,14 +4238,14 @@ int drmSyncobjWait(int fd, uint32_t *handles, unsigned num_handles,
int ret;
memclear(args);
- args.handles = (intptr_t)handles;
+ args.handles = (uintptr_t)handles;
args.timeout_nsec = timeout_nsec;
args.count_handles = num_handles;
args.flags = flags;
ret = drmIoctl(fd, DRM_IOCTL_SYNCOBJ_WAIT, &args);
if (ret < 0)
- return ret;
+ return -errno;
if (first_signaled)
*first_signaled = args.first_signaled;
diff --git a/lib/libdrm/xf86drmHash.c b/lib/libdrm/xf86drmHash.c
index f287e61fb..b2fa414e5 100644
--- a/lib/libdrm/xf86drmHash.c
+++ b/lib/libdrm/xf86drmHash.c
@@ -98,9 +98,6 @@ static unsigned long HashHash(unsigned long key)
}
hash %= HASH_SIZE;
-#if DEBUG
- printf( "Hash(%lu) = %lu\n", key, hash);
-#endif
return hash;
}
@@ -201,9 +198,6 @@ int drmHashInsert(void *t, unsigned long key, void *value)
bucket->value = value;
bucket->next = table->buckets[hash];
table->buckets[hash] = bucket;
-#if DEBUG
- printf("Inserted %lu at %lu/%p\n", key, hash, bucket);
-#endif
return 0; /* Added to table */
}
diff --git a/lib/libdrm/xf86drmMode.c b/lib/libdrm/xf86drmMode.c
index 15957ffcb..9a15b5e78 100644
--- a/lib/libdrm/xf86drmMode.c
+++ b/lib/libdrm/xf86drmMode.c
@@ -38,10 +38,6 @@
* platforms find which headers to include to get uint32_t
*/
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
#include <limits.h>
#include <stdint.h>
#include <stdlib.h>
@@ -831,8 +827,7 @@ int drmCheckModesettingSupported(const char *busid)
}
#elif defined(__DragonFly__)
return 0;
-#endif
-#ifdef __OpenBSD__
+#elif defined(__OpenBSD__)
int fd;
struct drm_mode_card_res res;
drmModeResPtr r = 0;
@@ -1313,6 +1308,9 @@ int drmModeAtomicAddProperty(drmModeAtomicReqPtr req,
if (!req)
return -EINVAL;
+ if (object_id == 0 || property_id == 0)
+ return -EINVAL;
+
if (req->cursor >= req->size_items) {
drmModeAtomicReqItemPtr new;