summaryrefslogtreecommitdiff
path: root/driver/xf86-video-amdgpu
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2021-08-03 05:35:53 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2021-08-03 05:35:53 +0000
commite3232dc97d22aafb04ba23e2b32dce46acb9fe3b (patch)
tree61e089ef0caf07d2997a69b65abe0cefbf94cf50 /driver/xf86-video-amdgpu
parent0a1e12c77356265d1771d4b89c363171de59bf89 (diff)
update to xf86-video-amdgpu 21.0.0
only change to the diff on tech@ many people tested is a version bump
Diffstat (limited to 'driver/xf86-video-amdgpu')
-rw-r--r--driver/xf86-video-amdgpu/Makefile.in1
-rw-r--r--driver/xf86-video-amdgpu/README.md2
-rw-r--r--driver/xf86-video-amdgpu/aclocal.m416
-rw-r--r--driver/xf86-video-amdgpu/conf/Makefile.in1
-rwxr-xr-xdriver/xf86-video-amdgpu/configure106
-rw-r--r--driver/xf86-video-amdgpu/configure.ac2
-rw-r--r--driver/xf86-video-amdgpu/man/Makefile.in1
-rw-r--r--driver/xf86-video-amdgpu/man/amdgpu.man2
-rw-r--r--driver/xf86-video-amdgpu/src/Makefile.in1
-rw-r--r--driver/xf86-video-amdgpu/src/amdgpu_bo_helper.c2
-rw-r--r--driver/xf86-video-amdgpu/src/amdgpu_dri3.c4
-rw-r--r--driver/xf86-video-amdgpu/src/amdgpu_drv.h12
-rw-r--r--driver/xf86-video-amdgpu/src/amdgpu_glamor.c20
-rw-r--r--driver/xf86-video-amdgpu/src/amdgpu_kms.c144
-rw-r--r--driver/xf86-video-amdgpu/src/amdgpu_probe.c258
-rw-r--r--driver/xf86-video-amdgpu/src/amdgpu_probe.h1
-rw-r--r--driver/xf86-video-amdgpu/src/compat-api.h6
-rw-r--r--driver/xf86-video-amdgpu/src/drmmode_display.c172
-rw-r--r--driver/xf86-video-amdgpu/src/drmmode_display.h30
19 files changed, 352 insertions, 429 deletions
diff --git a/driver/xf86-video-amdgpu/Makefile.in b/driver/xf86-video-amdgpu/Makefile.in
index 6b235df43..d0cd7bc42 100644
--- a/driver/xf86-video-amdgpu/Makefile.in
+++ b/driver/xf86-video-amdgpu/Makefile.in
@@ -314,6 +314,7 @@ pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
+runstatedir = @runstatedir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
diff --git a/driver/xf86-video-amdgpu/README.md b/driver/xf86-video-amdgpu/README.md
index 04af1f1e9..ac9454e8f 100644
--- a/driver/xf86-video-amdgpu/README.md
+++ b/driver/xf86-video-amdgpu/README.md
@@ -9,7 +9,7 @@ Please
to the Xorg bugzilla.
The
-[master development code repository](https://gitlab.freedesktop.org/xorg/driver/xf86-video-amdgpu)
+[main development code repository](https://gitlab.freedesktop.org/xorg/driver/xf86-video-amdgpu)
can be found at FreeDesktop Gitlab.
Please use merge requests for patch submission.
diff --git a/driver/xf86-video-amdgpu/aclocal.m4 b/driver/xf86-video-amdgpu/aclocal.m4
index f7e8099bb..218555ba8 100644
--- a/driver/xf86-video-amdgpu/aclocal.m4
+++ b/driver/xf86-video-amdgpu/aclocal.m4
@@ -19,9 +19,9 @@ You have another version of autoconf. It may work, but is not guaranteed to.
If you have problems, you may need to regenerate the build system entirely.
To do so, use the procedure documented by the package, typically 'autoreconf'.])])
-dnl pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*-
-dnl serial 11 (pkg-config-0.29.1)
-dnl
+# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*-
+# serial 12 (pkg-config-0.29.2)
+
dnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
dnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
dnl
@@ -62,7 +62,7 @@ dnl
dnl See the "Since" comment for each macro you use to see what version
dnl of the macros you require.
m4_defun([PKG_PREREQ],
-[m4_define([PKG_MACROS_VERSION], [0.29.1])
+[m4_define([PKG_MACROS_VERSION], [0.29.2])
m4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
[m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
])dnl PKG_PREREQ
@@ -163,7 +163,7 @@ AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
pkg_failed=no
-AC_MSG_CHECKING([for $1])
+AC_MSG_CHECKING([for $2])
_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
_PKG_CONFIG([$1][_LIBS], [libs], [$2])
@@ -173,11 +173,11 @@ and $1[]_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.])
if test $pkg_failed = yes; then
- AC_MSG_RESULT([no])
+ AC_MSG_RESULT([no])
_PKG_SHORT_ERRORS_SUPPORTED
if test $_pkg_short_errors_supported = yes; then
$1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
- else
+ else
$1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
fi
# Put the nasty error message in config.log where it belongs
@@ -194,7 +194,7 @@ installed software in a non-standard prefix.
_PKG_TEXT])[]dnl
])
elif test $pkg_failed = untried; then
- AC_MSG_RESULT([no])
+ AC_MSG_RESULT([no])
m4_default([$4], [AC_MSG_FAILURE(
[The pkg-config script could not be found or is too old. Make sure it
is in your PATH or set the PKG_CONFIG environment variable to the full
diff --git a/driver/xf86-video-amdgpu/conf/Makefile.in b/driver/xf86-video-amdgpu/conf/Makefile.in
index a59b2b3ad..fc83426fc 100644
--- a/driver/xf86-video-amdgpu/conf/Makefile.in
+++ b/driver/xf86-video-amdgpu/conf/Makefile.in
@@ -284,6 +284,7 @@ pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
+runstatedir = @runstatedir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
diff --git a/driver/xf86-video-amdgpu/configure b/driver/xf86-video-amdgpu/configure
index 5bc18031d..1a1098f74 100755
--- a/driver/xf86-video-amdgpu/configure
+++ b/driver/xf86-video-amdgpu/configure
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for xf86-video-amdgpu 19.1.0.
+# Generated by GNU Autoconf 2.69 for xf86-video-amdgpu 21.0.0.
#
# Report bugs to <https://bugs.freedesktop.org/enter_bug.cgi?product=xorg&component=Driver/AMDgpu>.
#
@@ -591,8 +591,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='xf86-video-amdgpu'
PACKAGE_TARNAME='xf86-video-amdgpu'
-PACKAGE_VERSION='19.1.0'
-PACKAGE_STRING='xf86-video-amdgpu 19.1.0'
+PACKAGE_VERSION='21.0.0'
+PACKAGE_STRING='xf86-video-amdgpu 21.0.0'
PACKAGE_BUGREPORT='https://bugs.freedesktop.org/enter_bug.cgi?product=xorg&component=Driver/AMDgpu'
PACKAGE_URL=''
@@ -784,6 +784,7 @@ infodir
docdir
oldincludedir
includedir
+runstatedir
localstatedir
sharedstatedir
sysconfdir
@@ -892,6 +893,7 @@ datadir='${datarootdir}'
sysconfdir='${prefix}/etc'
sharedstatedir='${prefix}/com'
localstatedir='${prefix}/var'
+runstatedir='${localstatedir}/run'
includedir='${prefix}/include'
oldincludedir='/usr/include'
docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
@@ -1144,6 +1146,15 @@ do
| -silent | --silent | --silen | --sile | --sil)
silent=yes ;;
+ -runstatedir | --runstatedir | --runstatedi | --runstated \
+ | --runstate | --runstat | --runsta | --runst | --runs \
+ | --run | --ru | --r)
+ ac_prev=runstatedir ;;
+ -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \
+ | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \
+ | --run=* | --ru=* | --r=*)
+ runstatedir=$ac_optarg ;;
+
-sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
ac_prev=sbindir ;;
-sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
@@ -1281,7 +1292,7 @@ fi
for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \
datadir sysconfdir sharedstatedir localstatedir includedir \
oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
- libdir localedir mandir
+ libdir localedir mandir runstatedir
do
eval ac_val=\$$ac_var
# Remove trailing slashes.
@@ -1394,7 +1405,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 xf86-video-amdgpu 19.1.0 to adapt to many kinds of systems.
+\`configure' configures xf86-video-amdgpu 21.0.0 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1434,6 +1445,7 @@ Fine tuning of the installation directories:
--sysconfdir=DIR read-only single-machine data [PREFIX/etc]
--sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
--localstatedir=DIR modifiable single-machine data [PREFIX/var]
+ --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run]
--libdir=DIR object code libraries [EPREFIX/lib]
--includedir=DIR C header files [PREFIX/include]
--oldincludedir=DIR C header files for non-gcc [/usr/include]
@@ -1465,7 +1477,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of xf86-video-amdgpu 19.1.0:";;
+ short | recursive ) echo "Configuration of xf86-video-amdgpu 21.0.0:";;
esac
cat <<\_ACEOF
@@ -1622,7 +1634,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-xf86-video-amdgpu configure 19.1.0
+xf86-video-amdgpu configure 21.0.0
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2037,7 +2049,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 xf86-video-amdgpu $as_me 19.1.0, which was
+It was created by xf86-video-amdgpu $as_me 21.0.0, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
@@ -2869,7 +2881,7 @@ fi
# Define the identity of the package.
PACKAGE='xf86-video-amdgpu'
- VERSION='19.1.0'
+ VERSION='21.0.0'
cat >>confdefs.h <<_ACEOF
@@ -18296,8 +18308,8 @@ $as_echo "$_EXT_CHECK" >&6; }
# Checks for libraries.
pkg_failed=no
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for LIBDRM" >&5
-$as_echo_n "checking for LIBDRM... " >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for libdrm >= 2.4.89" >&5
+$as_echo_n "checking for libdrm >= 2.4.89... " >&6; }
if test -n "$LIBDRM_CFLAGS"; then
pkg_cv_LIBDRM_CFLAGS="$LIBDRM_CFLAGS"
@@ -18337,7 +18349,7 @@ fi
if test $pkg_failed = yes; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
@@ -18364,7 +18376,7 @@ Alternatively, you may set the environment variables LIBDRM_CFLAGS
and LIBDRM_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details." "$LINENO" 5
elif test $pkg_failed = untried; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
@@ -18387,8 +18399,8 @@ $as_echo "yes" >&6; }
fi
pkg_failed=no
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for LIBDRM_AMDGPU" >&5
-$as_echo_n "checking for LIBDRM_AMDGPU... " >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for libdrm_amdgpu >= 2.4.76" >&5
+$as_echo_n "checking for libdrm_amdgpu >= 2.4.76... " >&6; }
if test -n "$LIBDRM_AMDGPU_CFLAGS"; then
pkg_cv_LIBDRM_AMDGPU_CFLAGS="$LIBDRM_AMDGPU_CFLAGS"
@@ -18428,7 +18440,7 @@ fi
if test $pkg_failed = yes; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
@@ -18455,7 +18467,7 @@ Alternatively, you may set the environment variables LIBDRM_AMDGPU_CFLAGS
and LIBDRM_AMDGPU_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details." "$LINENO" 5
elif test $pkg_failed = untried; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
@@ -18478,8 +18490,8 @@ $as_echo "yes" >&6; }
fi
pkg_failed=no
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for GBM" >&5
-$as_echo_n "checking for GBM... " >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for gbm" >&5
+$as_echo_n "checking for gbm... " >&6; }
if test -n "$GBM_CFLAGS"; then
pkg_cv_GBM_CFLAGS="$GBM_CFLAGS"
@@ -18519,7 +18531,7 @@ fi
if test $pkg_failed = yes; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
@@ -18546,7 +18558,7 @@ Alternatively, you may set the environment variables GBM_CFLAGS
and GBM_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details." "$LINENO" 5
elif test $pkg_failed = untried; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
@@ -18571,8 +18583,8 @@ fi
# Obtain compiler/linker options for the driver dependencies
pkg_failed=no
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for XORG" >&5
-$as_echo_n "checking for XORG... " >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for xorg-server >= 1.13 xproto fontsproto xf86driproto $REQUIRED_MODULES" >&5
+$as_echo_n "checking for xorg-server >= 1.13 xproto fontsproto xf86driproto $REQUIRED_MODULES... " >&6; }
if test -n "$XORG_CFLAGS"; then
pkg_cv_XORG_CFLAGS="$XORG_CFLAGS"
@@ -18612,7 +18624,7 @@ fi
if test $pkg_failed = yes; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
@@ -18639,7 +18651,7 @@ Alternatively, you may set the environment variables XORG_CFLAGS
and XORG_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details." "$LINENO" 5
elif test $pkg_failed = untried; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
@@ -18662,8 +18674,8 @@ $as_echo "yes" >&6; }
fi
pkg_failed=no
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for XEXT" >&5
-$as_echo_n "checking for XEXT... " >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for xextproto >= 7.0.99.1" >&5
+$as_echo_n "checking for xextproto >= 7.0.99.1... " >&6; }
if test -n "$XEXT_CFLAGS"; then
pkg_cv_XEXT_CFLAGS="$XEXT_CFLAGS"
@@ -18703,7 +18715,7 @@ fi
if test $pkg_failed = yes; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
@@ -18721,7 +18733,7 @@ fi
HAVE_XEXTPROTO_71="no"
elif test $pkg_failed = untried; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
HAVE_XEXTPROTO_71="no"
else
@@ -18783,8 +18795,8 @@ fi
if test "x$enable_udev" != "xno"; then
pkg_failed=no
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for LIBUDEV" >&5
-$as_echo_n "checking for LIBUDEV... " >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for libudev" >&5
+$as_echo_n "checking for libudev... " >&6; }
if test -n "$LIBUDEV_CFLAGS"; then
pkg_cv_LIBUDEV_CFLAGS="$LIBUDEV_CFLAGS"
@@ -18824,7 +18836,7 @@ fi
if test $pkg_failed = yes; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
@@ -18842,7 +18854,7 @@ fi
LIBUDEV=no
elif test $pkg_failed = untried; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
LIBUDEV=no
else
@@ -18940,8 +18952,8 @@ $as_echo "#define HAVE_GLAMOR_FINISH 1" >>confdefs.h
else
pkg_failed=no
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for LIBGL" >&5
-$as_echo_n "checking for LIBGL... " >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for gl" >&5
+$as_echo_n "checking for gl... " >&6; }
if test -n "$LIBGL_CFLAGS"; then
pkg_cv_LIBGL_CFLAGS="$LIBGL_CFLAGS"
@@ -18981,7 +18993,7 @@ fi
if test $pkg_failed = yes; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
@@ -19008,7 +19020,7 @@ Alternatively, you may set the environment variables LIBGL_CFLAGS
and LIBGL_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details." "$LINENO" 5
elif test $pkg_failed = untried; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
@@ -19036,8 +19048,8 @@ fi
if test "x$GLAMOR_XSERVER" != xyes; then
pkg_failed=no
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for LIBGLAMOR" >&5
-$as_echo_n "checking for LIBGLAMOR... " >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for glamor >= 0.6.0" >&5
+$as_echo_n "checking for glamor >= 0.6.0... " >&6; }
if test -n "$LIBGLAMOR_CFLAGS"; then
pkg_cv_LIBGLAMOR_CFLAGS="$LIBGLAMOR_CFLAGS"
@@ -19077,7 +19089,7 @@ fi
if test $pkg_failed = yes; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
@@ -19104,7 +19116,7 @@ Alternatively, you may set the environment variables LIBGLAMOR_CFLAGS
and LIBGLAMOR_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details." "$LINENO" 5
elif test $pkg_failed = untried; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
@@ -19127,8 +19139,8 @@ $as_echo "yes" >&6; }
fi
pkg_failed=no
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for LIBGLAMOR_EGL" >&5
-$as_echo_n "checking for LIBGLAMOR_EGL... " >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for glamor-egl" >&5
+$as_echo_n "checking for glamor-egl... " >&6; }
if test -n "$LIBGLAMOR_EGL_CFLAGS"; then
pkg_cv_LIBGLAMOR_EGL_CFLAGS="$LIBGLAMOR_EGL_CFLAGS"
@@ -19168,7 +19180,7 @@ fi
if test $pkg_failed = yes; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
@@ -19195,7 +19207,7 @@ Alternatively, you may set the environment variables LIBGLAMOR_EGL_CFLAGS
and LIBGLAMOR_EGL_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details." "$LINENO" 5
elif test $pkg_failed = untried; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
@@ -20012,7 +20024,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 xf86-video-amdgpu $as_me 19.1.0, which was
+This file was extended by xf86-video-amdgpu $as_me 21.0.0, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -20078,7 +20090,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="\\
-xf86-video-amdgpu config.status 19.1.0
+xf86-video-amdgpu config.status 21.0.0
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
diff --git a/driver/xf86-video-amdgpu/configure.ac b/driver/xf86-video-amdgpu/configure.ac
index 6f5cdd89e..9957f5954 100644
--- a/driver/xf86-video-amdgpu/configure.ac
+++ b/driver/xf86-video-amdgpu/configure.ac
@@ -23,7 +23,7 @@
# Initialize Autoconf
AC_PREREQ([2.60])
AC_INIT([xf86-video-amdgpu],
- [19.1.0],
+ [21.0.0],
[https://bugs.freedesktop.org/enter_bug.cgi?product=xorg&component=Driver/AMDgpu],
[xf86-video-amdgpu])
diff --git a/driver/xf86-video-amdgpu/man/Makefile.in b/driver/xf86-video-amdgpu/man/Makefile.in
index 36adb2072..1380d60d8 100644
--- a/driver/xf86-video-amdgpu/man/Makefile.in
+++ b/driver/xf86-video-amdgpu/man/Makefile.in
@@ -285,6 +285,7 @@ pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
+runstatedir = @runstatedir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
diff --git a/driver/xf86-video-amdgpu/man/amdgpu.man b/driver/xf86-video-amdgpu/man/amdgpu.man
index 2de34a3d7..36193e070 100644
--- a/driver/xf86-video-amdgpu/man/amdgpu.man
+++ b/driver/xf86-video-amdgpu/man/amdgpu.man
@@ -81,7 +81,7 @@ on. If this option is set, the default value of the property is 'on' or 'off'
accordingly. If this option isn't set, the default value of the property is
.B auto,
which means that TearFree is on for rotated outputs, outputs with RandR
-transforms applied and for RandR 1.4 slave outputs, otherwise off.
+transforms applied and for RandR 1.4 secondary outputs, otherwise off.
.TP
.BI "Option \*qVariableRefresh\*q \*q" boolean \*q
Enables support for enabling variable refresh on the Screen's CRTCs
diff --git a/driver/xf86-video-amdgpu/src/Makefile.in b/driver/xf86-video-amdgpu/src/Makefile.in
index 4afc362b7..2fd50a2a5 100644
--- a/driver/xf86-video-amdgpu/src/Makefile.in
+++ b/driver/xf86-video-amdgpu/src/Makefile.in
@@ -333,6 +333,7 @@ pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
+runstatedir = @runstatedir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
diff --git a/driver/xf86-video-amdgpu/src/amdgpu_bo_helper.c b/driver/xf86-video-amdgpu/src/amdgpu_bo_helper.c
index 3f622142d..df32f5d75 100644
--- a/driver/xf86-video-amdgpu/src/amdgpu_bo_helper.c
+++ b/driver/xf86-video-amdgpu/src/amdgpu_bo_helper.c
@@ -79,7 +79,7 @@ struct amdgpu_buffer *amdgpu_alloc_pixmap_bo(ScrnInfoPtr pScrn, int width,
}
pixmap_buffer->ref_count = 1;
- if ( bitsPerPixel == pScrn->bitsPerPixel)
+ if (usage_hint & AMDGPU_CREATE_PIXMAP_SCANOUT)
bo_use |= GBM_BO_USE_SCANOUT;
#ifdef HAVE_GBM_BO_USE_LINEAR
diff --git a/driver/xf86-video-amdgpu/src/amdgpu_dri3.c b/driver/xf86-video-amdgpu/src/amdgpu_dri3.c
index 09e21126f..298626aea 100644
--- a/driver/xf86-video-amdgpu/src/amdgpu_dri3.c
+++ b/driver/xf86-video-amdgpu/src/amdgpu_dri3.c
@@ -47,7 +47,7 @@ extern int priv_open_device(const char *);
#define priv_open_device(n) open(n,O_RDWR|O_CLOEXEC)
#endif
-static int open_master_node(ScreenPtr screen, int *out)
+static int open_card_node(ScreenPtr screen, int *out)
{
ScrnInfoPtr scrn = xf86ScreenToScrn(screen);
AMDGPUEntPtr pAMDGPUEnt = AMDGPUEntPriv(scrn);
@@ -118,7 +118,7 @@ amdgpu_dri3_open(ScreenPtr screen, RRProviderPtr provider, int *out)
ret = open_render_node(screen, out);
if (ret != Success)
- ret = open_master_node(screen, out);
+ ret = open_card_node(screen, out);
return ret;
}
diff --git a/driver/xf86-video-amdgpu/src/amdgpu_drv.h b/driver/xf86-video-amdgpu/src/amdgpu_drv.h
index 0ae171fe6..e2e162e3a 100644
--- a/driver/xf86-video-amdgpu/src/amdgpu_drv.h
+++ b/driver/xf86-video-amdgpu/src/amdgpu_drv.h
@@ -168,18 +168,18 @@ typedef enum {
} AMDGPUOpts;
static inline ScreenPtr
-amdgpu_master_screen(ScreenPtr screen)
+amdgpu_primary_screen(ScreenPtr screen)
{
- if (screen->current_master)
- return screen->current_master;
+ if (screen->current_primary)
+ return screen->current_primary;
return screen;
}
static inline ScreenPtr
-amdgpu_dirty_master(PixmapDirtyUpdatePtr dirty)
+amdgpu_dirty_primary(PixmapDirtyUpdatePtr dirty)
{
- return amdgpu_master_screen(dirty->slave_dst->drawable.pScreen);
+ return amdgpu_primary_screen(dirty->secondary_dst->drawable.pScreen);
}
static inline DrawablePtr
@@ -248,8 +248,6 @@ extern DevScreenPrivateKeyRec amdgpu_device_private_key;
typedef struct {
EntityInfoPtr pEnt;
- struct pci_device *PciInfo;
- int Chipset;
uint32_t family;
struct gbm_device *gbm;
diff --git a/driver/xf86-video-amdgpu/src/amdgpu_glamor.c b/driver/xf86-video-amdgpu/src/amdgpu_glamor.c
index 5b8d5606b..fb7a46bcb 100644
--- a/driver/xf86-video-amdgpu/src/amdgpu_glamor.c
+++ b/driver/xf86-video-amdgpu/src/amdgpu_glamor.c
@@ -201,14 +201,16 @@ amdgpu_glamor_create_pixmap(ScreenPtr screen, int w, int h, int depth,
unsigned usage)
{
ScrnInfoPtr scrn = xf86ScreenToScrn(screen);
+ PixmapFormatPtr format = xf86GetPixFormat(scrn, depth);
AMDGPUInfoPtr info = AMDGPUPTR(scrn);
struct amdgpu_pixmap *priv;
PixmapPtr pixmap, new_pixmap = NULL;
- if (!xf86GetPixFormat(scrn, depth))
+ if (!format)
return NULL;
- if (!AMDGPU_CREATE_PIXMAP_SHARED(usage)) {
+ if (!(usage & AMDGPU_CREATE_PIXMAP_SCANOUT) &&
+ !AMDGPU_CREATE_PIXMAP_SHARED(usage)) {
if (info->shadow_primary) {
if (usage != CREATE_PIXMAP_USAGE_BACKING_PIXMAP)
return fbCreatePixmap(screen, w, h, depth, usage);
@@ -216,9 +218,15 @@ amdgpu_glamor_create_pixmap(ScreenPtr screen, int w, int h, int depth,
usage |= AMDGPU_CREATE_PIXMAP_LINEAR |
AMDGPU_CREATE_PIXMAP_GTT;
} else if (usage != CREATE_PIXMAP_USAGE_BACKING_PIXMAP) {
- pixmap = glamor_create_pixmap(screen, w, h, depth, usage);
- if (pixmap)
- return pixmap;
+ if (w < scrn->virtualX || w > scrn->displayWidth ||
+ h != scrn->virtualY ||
+ format->bitsPerPixel != scrn->bitsPerPixel) {
+ pixmap = glamor_create_pixmap(screen, w, h, depth, usage);
+ if (pixmap)
+ return pixmap;
+ } else {
+ usage |= AMDGPU_CREATE_PIXMAP_SCANOUT;
+ }
}
}
@@ -342,7 +350,7 @@ amdgpu_glamor_set_pixmap_bo(DrawablePtr drawable, PixmapPtr pixmap)
static Bool
-amdgpu_glamor_share_pixmap_backing(PixmapPtr pixmap, ScreenPtr slave,
+amdgpu_glamor_share_pixmap_backing(PixmapPtr pixmap, ScreenPtr secondary,
void **handle_p)
{
ScreenPtr screen = pixmap->drawable.pScreen;
diff --git a/driver/xf86-video-amdgpu/src/amdgpu_kms.c b/driver/xf86-video-amdgpu/src/amdgpu_kms.c
index 6a60f5457..8997759be 100644
--- a/driver/xf86-video-amdgpu/src/amdgpu_kms.c
+++ b/driver/xf86-video-amdgpu/src/amdgpu_kms.c
@@ -283,6 +283,7 @@ static void AMDGPUFreeRec(ScrnInfoPtr pScrn)
amdgpu_unwrap_property_requests(pScrn);
amdgpu_device_deinitialize(pAMDGPUEnt->pDev);
amdgpu_kernel_close_fd(pAMDGPUEnt);
+ free(pAMDGPUEnt->busid);
free(pPriv->ptr);
pPriv->ptr = NULL;
}
@@ -519,8 +520,8 @@ amdgpu_sync_scanout_pixmaps(xf86CrtcPtr xf86_crtc, RegionPtr new_region,
int scanout_id)
{
drmmode_crtc_private_ptr drmmode_crtc = xf86_crtc->driver_private;
- DrawablePtr dst = &drmmode_crtc->scanout[scanout_id].pixmap->drawable;
- DrawablePtr src = &drmmode_crtc->scanout[scanout_id ^ 1].pixmap->drawable;
+ DrawablePtr dst = &drmmode_crtc->scanout[scanout_id]->drawable;
+ DrawablePtr src = &drmmode_crtc->scanout[scanout_id ^ 1]->drawable;
RegionPtr last_region = &drmmode_crtc->scanout_last_region;
ScrnInfoPtr scrn = xf86_crtc->scrn;
ScreenPtr pScreen = scrn->pScreen;
@@ -603,8 +604,8 @@ dirty_region(PixmapDirtyUpdatePtr dirty)
if (dirty->rotation != RR_Rotate_0) {
dstregion = transform_region(damageregion,
&dirty->f_inverse,
- dirty->slave_dst->drawable.width,
- dirty->slave_dst->drawable.height);
+ dirty->secondary_dst->drawable.width,
+ dirty->secondary_dst->drawable.height);
} else
#endif
{
@@ -612,7 +613,7 @@ dirty_region(PixmapDirtyUpdatePtr dirty)
dstregion = RegionDuplicate(damageregion);
RegionTranslate(dstregion, -dirty->x, -dirty->y);
- PixmapRegionInit(&pixregion, dirty->slave_dst);
+ PixmapRegionInit(&pixregion, dirty->secondary_dst);
RegionIntersect(dstregion, dstregion, &pixregion);
RegionUninit(&pixregion);
}
@@ -629,8 +630,8 @@ redisplay_dirty(PixmapDirtyUpdatePtr dirty, RegionPtr region)
if (RegionNil(region))
goto out;
- if (dirty->slave_dst->master_pixmap)
- DamageRegionAppend(&dirty->slave_dst->drawable, region);
+ if (dirty->secondary_dst->primary_pixmap)
+ DamageRegionAppend(&dirty->secondary_dst->drawable, region);
#ifdef HAS_DIRTYTRACKING_ROTATION
PixmapSyncDirtyHelper(dirty);
@@ -639,8 +640,8 @@ redisplay_dirty(PixmapDirtyUpdatePtr dirty, RegionPtr region)
#endif
amdgpu_glamor_flush(src_scrn);
- if (dirty->slave_dst->master_pixmap)
- DamageRegionProcessPending(&dirty->slave_dst->drawable);
+ if (dirty->secondary_dst->primary_pixmap)
+ DamageRegionProcessPending(&dirty->secondary_dst->drawable);
out:
DamageEmpty(dirty->damage);
@@ -657,12 +658,12 @@ amdgpu_prime_scanout_update_abort(xf86CrtcPtr crtc, void *event_data)
void
amdgpu_sync_shared_pixmap(PixmapDirtyUpdatePtr dirty)
{
- ScreenPtr master_screen = amdgpu_dirty_master(dirty);
+ ScreenPtr primary_screen = amdgpu_dirty_primary(dirty);
PixmapDirtyUpdatePtr ent;
RegionPtr region;
- xorg_list_for_each_entry(ent, &master_screen->pixmap_dirty_list, ent) {
- if (!amdgpu_dirty_src_equals(dirty, ent->slave_dst))
+ xorg_list_for_each_entry(ent, &primary_screen->pixmap_dirty_list, ent) {
+ if (!amdgpu_dirty_src_equals(dirty, ent->secondary_dst))
continue;
region = dirty_region(ent);
@@ -675,45 +676,45 @@ amdgpu_sync_shared_pixmap(PixmapDirtyUpdatePtr dirty)
#if HAS_SYNC_SHARED_PIXMAP
static Bool
-master_has_sync_shared_pixmap(ScrnInfoPtr scrn, PixmapDirtyUpdatePtr dirty)
+primary_has_sync_shared_pixmap(ScrnInfoPtr scrn, PixmapDirtyUpdatePtr dirty)
{
- ScreenPtr master_screen = amdgpu_dirty_master(dirty);
+ ScreenPtr primary_screen = amdgpu_dirty_primary(dirty);
- return master_screen->SyncSharedPixmap != NULL;
+ return primary_screen->SyncSharedPixmap != NULL;
}
static Bool
-slave_has_sync_shared_pixmap(ScrnInfoPtr scrn, PixmapDirtyUpdatePtr dirty)
+secondary_has_sync_shared_pixmap(ScrnInfoPtr scrn, PixmapDirtyUpdatePtr dirty)
{
- ScreenPtr slave_screen = dirty->slave_dst->drawable.pScreen;
+ ScreenPtr secondary_screen = dirty->secondary_dst->drawable.pScreen;
- return slave_screen->SyncSharedPixmap != NULL;
+ return secondary_screen->SyncSharedPixmap != NULL;
}
static void
call_sync_shared_pixmap(PixmapDirtyUpdatePtr dirty)
{
- ScreenPtr master_screen = amdgpu_dirty_master(dirty);
+ ScreenPtr primary_screen = amdgpu_dirty_primary(dirty);
- master_screen->SyncSharedPixmap(dirty);
+ primary_screen->SyncSharedPixmap(dirty);
}
#else /* !HAS_SYNC_SHARED_PIXMAP */
static Bool
-master_has_sync_shared_pixmap(ScrnInfoPtr scrn, PixmapDirtyUpdatePtr dirty)
+primary_has_sync_shared_pixmap(ScrnInfoPtr scrn, PixmapDirtyUpdatePtr dirty)
{
- ScrnInfoPtr master_scrn = xf86ScreenToScrn(amdgpu_dirty_master(dirty));
+ ScrnInfoPtr primary_scrn = xf86ScreenToScrn(amdgpu_dirty_primary(dirty));
- return master_scrn->driverName == scrn->driverName;
+ return primary_scrn->driverName == scrn->driverName;
}
static Bool
-slave_has_sync_shared_pixmap(ScrnInfoPtr scrn, PixmapDirtyUpdatePtr dirty)
+secondary_has_sync_shared_pixmap(ScrnInfoPtr scrn, PixmapDirtyUpdatePtr dirty)
{
- ScrnInfoPtr slave_scrn = xf86ScreenToScrn(dirty->slave_dst->drawable.pScreen);
+ ScrnInfoPtr secondary_scrn = xf86ScreenToScrn(dirty->secondary_dst->drawable.pScreen);
- return slave_scrn->driverName == scrn->driverName;
+ return secondary_scrn->driverName == scrn->driverName;
}
static void
@@ -728,12 +729,12 @@ call_sync_shared_pixmap(PixmapDirtyUpdatePtr dirty)
static xf86CrtcPtr
amdgpu_prime_dirty_to_crtc(PixmapDirtyUpdatePtr dirty)
{
- ScreenPtr screen = dirty->slave_dst->drawable.pScreen;
+ ScreenPtr screen = dirty->secondary_dst->drawable.pScreen;
ScrnInfoPtr scrn = xf86ScreenToScrn(screen);
xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
int c;
- /* Find the CRTC which is scanning out from this slave pixmap */
+ /* Find the CRTC which is scanning out from this secondary pixmap */
for (c = 0; c < xf86_config->num_crtc; c++) {
xf86CrtcPtr xf86_crtc = xf86_config->crtc[c];
drmmode_crtc_private_ptr drmmode_crtc = xf86_crtc->driver_private;
@@ -758,7 +759,7 @@ amdgpu_prime_scanout_do_update(xf86CrtcPtr crtc, unsigned scanout_id)
if (amdgpu_dirty_src_equals(dirty, drmmode_crtc->prime_scanout_pixmap)) {
RegionPtr region;
- if (master_has_sync_shared_pixmap(scrn, dirty))
+ if (primary_has_sync_shared_pixmap(scrn, dirty))
call_sync_shared_pixmap(dirty);
region = dirty_region(dirty);
@@ -771,7 +772,7 @@ amdgpu_prime_scanout_do_update(xf86CrtcPtr crtc, unsigned scanout_id)
amdgpu_glamor_flush(scrn);
RegionCopy(&drmmode_crtc->scanout_last_region, region);
RegionTranslate(region, -crtc->x, -crtc->y);
- dirty->slave_dst = drmmode_crtc->scanout[scanout_id].pixmap;
+ dirty->secondary_dst = drmmode_crtc->scanout[scanout_id];
}
redisplay_dirty(dirty, region);
@@ -798,7 +799,7 @@ amdgpu_prime_scanout_update_handler(xf86CrtcPtr crtc, uint32_t frame, uint64_t u
static void
amdgpu_prime_scanout_update(PixmapDirtyUpdatePtr dirty)
{
- ScreenPtr screen = dirty->slave_dst->drawable.pScreen;
+ ScreenPtr screen = dirty->secondary_dst->drawable.pScreen;
ScrnInfoPtr scrn = xf86ScreenToScrn(screen);
AMDGPUEntPtr pAMDGPUEnt = AMDGPUEntPriv(scrn);
xf86CrtcPtr xf86_crtc = amdgpu_prime_dirty_to_crtc(dirty);
@@ -810,7 +811,7 @@ amdgpu_prime_scanout_update(PixmapDirtyUpdatePtr dirty)
drmmode_crtc = xf86_crtc->driver_private;
if (drmmode_crtc->scanout_update_pending ||
- !drmmode_crtc->scanout[drmmode_crtc->scanout_id].pixmap ||
+ !drmmode_crtc->scanout[drmmode_crtc->scanout_id] ||
drmmode_crtc->dpms_mode != DPMSModeOn)
return;
@@ -862,7 +863,7 @@ amdgpu_prime_scanout_update(PixmapDirtyUpdatePtr dirty)
static void
amdgpu_prime_scanout_flip(PixmapDirtyUpdatePtr ent)
{
- ScreenPtr screen = ent->slave_dst->drawable.pScreen;
+ ScreenPtr screen = ent->secondary_dst->drawable.pScreen;
ScrnInfoPtr scrn = xf86ScreenToScrn(screen);
AMDGPUEntPtr pAMDGPUEnt = AMDGPUEntPriv(scrn);
xf86CrtcPtr crtc = amdgpu_prime_dirty_to_crtc(ent);
@@ -877,14 +878,14 @@ amdgpu_prime_scanout_flip(PixmapDirtyUpdatePtr ent)
drmmode_crtc = crtc->driver_private;
scanout_id = drmmode_crtc->scanout_id ^ 1;
if (drmmode_crtc->scanout_update_pending ||
- !drmmode_crtc->scanout[scanout_id].pixmap ||
+ !drmmode_crtc->scanout[scanout_id] ||
drmmode_crtc->dpms_mode != DPMSModeOn)
return;
if (!amdgpu_prime_scanout_do_update(crtc, scanout_id))
return;
- fb = amdgpu_pixmap_get_fb(drmmode_crtc->scanout[scanout_id].pixmap);
+ fb = amdgpu_pixmap_get_fb(drmmode_crtc->scanout[scanout_id]);
if (!fb) {
xf86DrvMsg(scrn->scrnIndex, X_WARNING,
"Failed to get FB for PRIME flip.\n");
@@ -937,11 +938,11 @@ amdgpu_dirty_update(ScrnInfoPtr scrn)
if (screen->isGPU) {
PixmapDirtyUpdatePtr region_ent = ent;
- if (master_has_sync_shared_pixmap(scrn, ent)) {
- ScreenPtr master_screen = amdgpu_dirty_master(ent);
+ if (primary_has_sync_shared_pixmap(scrn, ent)) {
+ ScreenPtr primary_screen = amdgpu_dirty_primary(ent);
- xorg_list_for_each_entry(region_ent, &master_screen->pixmap_dirty_list, ent) {
- if (amdgpu_dirty_src_equals(ent, region_ent->slave_dst))
+ xorg_list_for_each_entry(region_ent, &primary_screen->pixmap_dirty_list, ent) {
+ if (amdgpu_dirty_src_equals(ent, region_ent->secondary_dst))
break;
}
}
@@ -965,7 +966,7 @@ amdgpu_dirty_update(ScrnInfoPtr scrn)
RegionDestroy(region);
} else {
- if (slave_has_sync_shared_pixmap(scrn, ent))
+ if (secondary_has_sync_shared_pixmap(scrn, ent))
continue;
region = dirty_region(ent);
@@ -975,6 +976,11 @@ amdgpu_dirty_update(ScrnInfoPtr scrn)
}
}
+static void
+amdgpuSourceValidate(DrawablePtr draw, int x, int y, int w, int h,
+ unsigned int subWindowMode)
+{
+}
Bool
amdgpu_scanout_do_update(xf86CrtcPtr xf86_crtc, int scanout_id,
@@ -987,11 +993,11 @@ amdgpu_scanout_do_update(xf86CrtcPtr xf86_crtc, int scanout_id,
DrawablePtr pDraw;
if (!xf86_crtc->enabled ||
- !drmmode_crtc->scanout[scanout_id].pixmap ||
+ !drmmode_crtc->scanout[scanout_id] ||
extents.x1 >= extents.x2 || extents.y1 >= extents.y2)
return FALSE;
- pDraw = &drmmode_crtc->scanout[scanout_id].pixmap->drawable;
+ pDraw = &drmmode_crtc->scanout[scanout_id]->drawable;
if (!amdgpu_scanout_extents_intersect(xf86_crtc, &extents))
return FALSE;
@@ -1031,7 +1037,7 @@ amdgpu_scanout_do_update(xf86CrtcPtr xf86_crtc, int scanout_id,
SetPicturePictFilter(src, xf86_crtc->filter, xf86_crtc->params,
xf86_crtc->nparams);
- pScreen->SourceValidate = NULL;
+ pScreen->SourceValidate = amdgpuSourceValidate;
CompositePicture(PictOpSrc,
src, NULL, dst,
extents.x1, extents.y1, 0, 0, extents.x1,
@@ -1192,7 +1198,7 @@ amdgpu_scanout_flip(ScreenPtr pScreen, AMDGPUInfoPtr info,
amdgpu_glamor_flush(scrn);
RegionEmpty(region);
- fb = amdgpu_pixmap_get_fb(drmmode_crtc->scanout[scanout_id].pixmap);
+ fb = amdgpu_pixmap_get_fb(drmmode_crtc->scanout[scanout_id]);
if (!fb) {
xf86DrvMsg(scrn->scrnIndex, X_WARNING,
"Failed to get FB for scanout flip.\n");
@@ -1225,8 +1231,7 @@ amdgpu_scanout_flip(ScreenPtr pScreen, AMDGPUInfoPtr info,
&drmmode_crtc->scanout_last_region);
RegionEmpty(&drmmode_crtc->scanout_last_region);
amdgpu_scanout_update(xf86_crtc);
- drmmode_crtc_scanout_destroy(drmmode_crtc->drmmode,
- &drmmode_crtc->scanout[scanout_id]);
+ drmmode_crtc_scanout_destroy(&drmmode_crtc->scanout[scanout_id]);
drmmode_crtc->tear_free = FALSE;
return;
}
@@ -1252,7 +1257,7 @@ static void AMDGPUBlockHandler_KMS(BLOCKHANDLER_ARGS_DECL)
(*pScreen->BlockHandler) (BLOCKHANDLER_ARGS);
pScreen->BlockHandler = AMDGPUBlockHandler_KMS;
- if (!xf86ScreenToScrn(amdgpu_master_screen(pScreen))->vtSema)
+ if (!xf86ScreenToScrn(amdgpu_primary_screen(pScreen))->vtSema)
return;
if (!pScreen->isGPU)
@@ -1261,12 +1266,12 @@ static void AMDGPUBlockHandler_KMS(BLOCKHANDLER_ARGS_DECL)
xf86CrtcPtr crtc = xf86_config->crtc[c];
drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
- if (drmmode_crtc->rotate.pixmap)
+ if (drmmode_crtc->rotate)
continue;
if (drmmode_crtc->tear_free)
amdgpu_scanout_flip(pScreen, info, crtc);
- else if (drmmode_crtc->scanout[drmmode_crtc->scanout_id].pixmap)
+ else if (drmmode_crtc->scanout[drmmode_crtc->scanout_id])
amdgpu_scanout_update(crtc);
}
}
@@ -1415,20 +1420,13 @@ static Bool AMDGPUPreInitChipType_KMS(ScrnInfoPtr pScrn,
AMDGPUInfoPtr info = AMDGPUPTR(pScrn);
AMDGPUEntPtr pAMDGPUEnt = AMDGPUEntPriv(pScrn);
- info->Chipset = info->PciInfo->device_id;
pScrn->chipset = (char*)amdgpu_get_marketing_name(pAMDGPUEnt->pDev);
if (!pScrn->chipset)
pScrn->chipset = "Unknown AMD Radeon GPU";
- if (info->Chipset < 0) {
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
- "Chipset \"%s\" is not recognized\n",
- pScrn->chipset);
- return FALSE;
- }
xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
"Chipset: \"%s\" (ChipID = 0x%04x)\n",
- pScrn->chipset, info->Chipset);
+ pScrn->chipset, gpu_info->asic_id);
info->family = gpu_info->family_id;
@@ -1570,7 +1568,6 @@ Bool AMDGPUPreInit_KMS(ScrnInfoPtr pScrn, int flags)
xf86SetPrimInitDone(pScrn->entityList[0]);
}
- info->PciInfo = xf86GetPciInfoForEntity(info->pEnt->index);
pScrn->monitor = pScrn->confScreen->monitor;
if (!AMDGPUPreInitVisual(pScrn))
@@ -1853,7 +1850,7 @@ CARD32 cleanup_black_fb(OsTimerPtr timer, CARD32 now, pointer data)
xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
int c;
- if (xf86ScreenToScrn(amdgpu_master_screen(screen))->vtSema)
+ if (xf86ScreenToScrn(amdgpu_primary_screen(screen))->vtSema)
return 0;
/* Unreference the all-black FB created by AMDGPULeaveVT_KMS. After
@@ -2209,6 +2206,7 @@ Bool AMDGPUEnterVT_KMS(ScrnInfoPtr pScrn)
struct amdgpu_buffer *front_buffer =
amdgpu_alloc_pixmap_bo(pScrn, pScrn->virtualX,
pScrn->virtualY, pScrn->depth,
+ AMDGPU_CREATE_PIXMAP_SCANOUT |
AMDGPU_CREATE_PIXMAP_LINEAR,
pScrn->bitsPerPixel,
&pitch);
@@ -2270,7 +2268,6 @@ void AMDGPULeaveVT_KMS(ScrnInfoPtr pScrn)
if (!info->shadow_fb) {
AMDGPUEntPtr pAMDGPUEnt = AMDGPUEntPriv(pScrn);
xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
- struct drmmode_scanout black_scanout = { .pixmap = NULL, .bo = NULL };
xf86CrtcPtr crtc;
drmmode_crtc_private_ptr drmmode_crtc;
unsigned w = 0, h = 0;
@@ -2296,11 +2293,15 @@ void AMDGPULeaveVT_KMS(ScrnInfoPtr pScrn)
/* Make all active CRTCs scan out from an all-black framebuffer */
if (w > 0 && h > 0) {
- if (drmmode_crtc_scanout_create(crtc, &black_scanout, w, h)) {
+ PixmapPtr black_scanout =
+ pScreen->CreatePixmap(pScreen, w, h, pScrn->depth,
+ AMDGPU_CREATE_PIXMAP_SCANOUT);
+
+ if (black_scanout) {
struct drmmode_fb *black_fb =
- amdgpu_pixmap_get_fb(black_scanout.pixmap);
+ amdgpu_pixmap_get_fb(black_scanout);
- amdgpu_pixmap_clear(black_scanout.pixmap);
+ amdgpu_pixmap_clear(black_scanout);
amdgpu_glamor_finish(pScrn);
for (i = 0; i < xf86_config->num_crtc; i++) {
@@ -2319,20 +2320,21 @@ void AMDGPULeaveVT_KMS(ScrnInfoPtr pScrn)
}
if (pScrn->is_gpu) {
- if (drmmode_crtc->scanout[0].pixmap)
- pixmap_unref_fb(drmmode_crtc->scanout[0].pixmap);
- if (drmmode_crtc->scanout[1].pixmap)
- pixmap_unref_fb(drmmode_crtc->scanout[1].pixmap);
+ if (drmmode_crtc->scanout[0])
+ pixmap_unref_fb(drmmode_crtc->scanout[0]);
+ if (drmmode_crtc->scanout[1])
+ pixmap_unref_fb(drmmode_crtc->scanout[1]);
} else {
drmmode_crtc_scanout_free(crtc);
}
}
}
+
+ pScreen->DestroyPixmap(black_scanout);
}
}
xf86RotateFreeShadow(pScrn);
- drmmode_crtc_scanout_destroy(&info->drmmode, &black_scanout);
/* Unreference FBs of all pixmaps. After this, the only FB remaining
* should be the all-black one being scanned out by active CRTCs
@@ -2415,12 +2417,12 @@ static Bool amdgpu_setup_kernel_mem(ScreenPtr pScreen)
if (!info->front_buffer) {
int pitch;
- int hint = 0;
+ int hint = AMDGPU_CREATE_PIXMAP_SCANOUT;
if (info->shadow_primary)
- hint = AMDGPU_CREATE_PIXMAP_LINEAR | AMDGPU_CREATE_PIXMAP_GTT;
+ hint |= AMDGPU_CREATE_PIXMAP_LINEAR | AMDGPU_CREATE_PIXMAP_GTT;
else if (!info->use_glamor)
- hint = AMDGPU_CREATE_PIXMAP_LINEAR;
+ hint |= AMDGPU_CREATE_PIXMAP_LINEAR;
info->front_buffer =
amdgpu_alloc_pixmap_bo(pScrn, pScrn->virtualX,
diff --git a/driver/xf86-video-amdgpu/src/amdgpu_probe.c b/driver/xf86-video-amdgpu/src/amdgpu_probe.c
index 2dc934ff6..71304668b 100644
--- a/driver/xf86-video-amdgpu/src/amdgpu_probe.c
+++ b/driver/xf86-video-amdgpu/src/amdgpu_probe.c
@@ -33,6 +33,8 @@
#include <errno.h>
#include <string.h>
#include <stdlib.h>
+#include <sys/stat.h>
+#include <fcntl.h>
/*
* Authors:
@@ -48,12 +50,17 @@
#include "xf86.h"
#include "xf86drmMode.h"
-#include "dri.h"
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
#include <xf86_OSproc.h>
#endif
+#ifdef X_PRIVSEP
+extern int priv_open_device(const char *);
+#else
+#define priv_open_device(n) open(n,O_RDWR|O_CLOEXEC)
+#endif
+
#include <xf86platformBus.h>
_X_EXPORT int gAMDGPUEntityIndex = -1;
@@ -75,36 +82,34 @@ static void AMDGPUIdentify(int flags)
xf86PrintChipsets(AMDGPU_NAME, "Driver for AMD Radeon", AMDGPUAny);
}
-static char *amdgpu_bus_id(ScrnInfoPtr pScrn, struct pci_device *dev)
+static Bool amdgpu_device_matches(const drmDevicePtr device,
+ const struct pci_device *dev)
{
- char *busid;
-
- XNFasprintf(&busid, "pci:%04x:%02x:%02x.%d",
- dev->domain, dev->bus, dev->dev, dev->func);
-
- if (!busid)
- xf86DrvMsgVerb(pScrn->scrnIndex, X_ERROR, 0,
- "AMDGPU: Failed to generate bus ID string\n");
-
- return busid;
+ return (device->bustype == DRM_BUS_PCI &&
+ device->businfo.pci->domain == dev->domain &&
+ device->businfo.pci->bus == dev->bus &&
+ device->businfo.pci->dev == dev->dev &&
+ device->businfo.pci->func == dev->func);
}
-static Bool amdgpu_kernel_mode_enabled(ScrnInfoPtr pScrn, char *busIdString)
+static Bool amdgpu_kernel_mode_enabled(ScrnInfoPtr pScrn)
{
+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
+ AMDGPUEntPtr pAMDGPUEnt = AMDGPUEntPriv(pScrn);
+ const char *busIdString = pAMDGPUEnt->busid;
int ret = drmCheckModesettingSupported(busIdString);
-#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
if (ret) {
if (xf86LoadKernelModule("amdgpukms"))
ret = drmCheckModesettingSupported(busIdString);
}
-#endif
if (ret) {
xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 0,
"[KMS] drm report modesetting isn't supported.\n");
return FALSE;
}
+#endif
xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 0,
"[KMS] Kernel modesetting enabled.\n");
return TRUE;
@@ -112,42 +117,66 @@ static Bool amdgpu_kernel_mode_enabled(ScrnInfoPtr pScrn, char *busIdString)
static int amdgpu_kernel_open_fd(ScrnInfoPtr pScrn,
struct pci_device *pci_dev,
- struct xf86_platform_device *platform_dev)
+ struct xf86_platform_device *platform_dev,
+ AMDGPUEntPtr pAMDGPUEnt)
{
+#define MAX_DRM_DEVICES 64
+ drmDevicePtr devices[MAX_DRM_DEVICES];
struct pci_device *dev;
- char *busid;
- int fd;
+ const char *path;
+ int fd = -1, i, ret;
+
+ if (platform_dev)
+ dev = platform_dev->pdev;
+ else
+ dev = pci_dev;
+
+ XNFasprintf(&pAMDGPUEnt->busid, "pci:%04x:%02x:%02x.%u",
+ dev->domain, dev->bus, dev->dev, dev->func);
-#ifdef ODEV_ATTRIB_FD
if (platform_dev) {
+#ifdef ODEV_ATTRIB_FD
fd = xf86_get_platform_device_int_attrib(platform_dev,
ODEV_ATTRIB_FD, -1);
if (fd != -1)
return fd;
- }
#endif
- if (platform_dev)
- dev = platform_dev->pdev;
- else
- dev = pci_dev;
+#ifdef ODEV_ATTRIB_PATH
+ path = xf86_get_platform_device_attrib(platform_dev,
+ ODEV_ATTRIB_PATH);
- busid = amdgpu_bus_id(pScrn, dev);
- if (!busid)
+ fd = priv_open_device(path);
+ if (fd != -1)
+ return fd;
+#endif
+ }
+
+ if (!amdgpu_kernel_mode_enabled(pScrn))
return -1;
- if (!amdgpu_kernel_mode_enabled(pScrn, busid)) {
- free(busid);
+ ret = drmGetDevices2(0, devices, ARRAY_SIZE(devices));
+ if (ret == -1) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "[drm] Failed to retrieve DRM devices information.\n");
return -1;
}
+ for (i = 0; i < ret; i++) {
+ if (amdgpu_device_matches(devices[i], dev) &&
+ devices[i]->available_nodes & (1 << DRM_NODE_PRIMARY)) {
+ path = devices[i]->nodes[DRM_NODE_PRIMARY];
+ fd = priv_open_device(path);
+ break;
+ }
+ }
+ drmFreeDevices(devices, ret);
- fd = drmOpen(NULL, busid);
if (fd == -1)
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
"[drm] Failed to open DRM device for %s: %s\n",
- busid, strerror(errno));
- free(busid);
+ pAMDGPUEnt->busid, strerror(errno));
return fd;
+#undef MAX_DRM_DEVICES
}
void amdgpu_kernel_close_fd(AMDGPUEntPtr pAMDGPUEnt)
@@ -156,32 +185,31 @@ void amdgpu_kernel_close_fd(AMDGPUEntPtr pAMDGPUEnt)
if (!(pAMDGPUEnt->platform_dev &&
pAMDGPUEnt->platform_dev->flags & XF86_PDEV_SERVER_FD))
#endif
- drmClose(pAMDGPUEnt->fd);
+ close(pAMDGPUEnt->fd);
pAMDGPUEnt->fd = -1;
}
-static Bool amdgpu_open_drm_master(ScrnInfoPtr pScrn, AMDGPUEntPtr pAMDGPUEnt,
- struct pci_device *pci_dev)
+/* Pull a local version of the helper. It's available since 2.4.98 yet
+ * it may be too new for some distributions.
+ */
+static int local_drmIsMaster(int fd)
{
- drmSetVersion sv;
- int err;
+ return drmAuthMagic(fd, 0) != -EACCES;
+}
- pAMDGPUEnt->fd = amdgpu_kernel_open_fd(pScrn, pci_dev, NULL);
+static Bool amdgpu_open_drm_master(ScrnInfoPtr pScrn,
+ struct pci_device *pci_dev,
+ struct xf86_platform_device *platform_dev,
+ AMDGPUEntPtr pAMDGPUEnt)
+{
+ pAMDGPUEnt->fd = amdgpu_kernel_open_fd(pScrn, pci_dev, platform_dev, pAMDGPUEnt);
if (pAMDGPUEnt->fd == -1)
return FALSE;
- /* Check that what we opened was a master or a master-capable FD,
- * by setting the version of the interface we'll use to talk to it.
- * (see DRIOpenDRMMaster() in DRI1)
- */
- sv.drm_di_major = 1;
- sv.drm_di_minor = 1;
- sv.drm_dd_major = -1;
- sv.drm_dd_minor = -1;
- err = drmSetInterfaceVersion(pAMDGPUEnt->fd, &sv);
- if (err != 0) {
+ /* Check that what we opened is a master or a master-capable FD */
+ if (!local_drmIsMaster(pAMDGPUEnt->fd)) {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
- "[drm] failed to set drm interface version.\n");
+ "[drm] device is not DRM master.\n");
amdgpu_kernel_close_fd(pAMDGPUEnt);
return FALSE;
}
@@ -189,16 +217,43 @@ static Bool amdgpu_open_drm_master(ScrnInfoPtr pScrn, AMDGPUEntPtr pAMDGPUEnt,
return TRUE;
}
-static Bool amdgpu_get_scrninfo(int entity_num, struct pci_device *pci_dev)
+static Bool amdgpu_device_setup(ScrnInfoPtr pScrn,
+ struct pci_device *pci_dev,
+ struct xf86_platform_device *platform_dev,
+ AMDGPUEntPtr pAMDGPUEnt)
+{
+ uint32_t major_version;
+ uint32_t minor_version;
+
+ pAMDGPUEnt->platform_dev = platform_dev;
+ if (!amdgpu_open_drm_master(pScrn, pci_dev, platform_dev,
+ pAMDGPUEnt))
+ return FALSE;
+
+ if (amdgpu_device_initialize(pAMDGPUEnt->fd,
+ &major_version,
+ &minor_version,
+ &pAMDGPUEnt->pDev)) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "amdgpu_device_initialize failed\n");
+ goto error_amdgpu;
+ }
+
+ return TRUE;
+
+error_amdgpu:
+ amdgpu_kernel_close_fd(pAMDGPUEnt);
+ return FALSE;
+}
+
+static Bool
+amdgpu_probe(ScrnInfoPtr pScrn, int entity_num,
+ struct pci_device *pci_dev, struct xf86_platform_device *dev)
{
- ScrnInfoPtr pScrn = NULL;
EntityInfoPtr pEnt = NULL;
DevUnion *pPriv;
AMDGPUEntPtr pAMDGPUEnt;
- pScrn = xf86ConfigPciEntity(pScrn, 0, entity_num, NULL,
- NULL, NULL, NULL, NULL, NULL);
-
if (!pScrn)
return FALSE;
@@ -206,7 +261,6 @@ static Bool amdgpu_get_scrninfo(int entity_num, struct pci_device *pci_dev)
pScrn->driverName = AMDGPU_DRIVER_NAME;
pScrn->name = AMDGPU_NAME;
pScrn->Probe = NULL;
-
pScrn->PreInit = AMDGPUPreInit_KMS;
pScrn->ScreenInit = AMDGPUScreenInit_KMS;
pScrn->SwitchMode = AMDGPUSwitchMode_KMS;
@@ -229,27 +283,16 @@ static Bool amdgpu_get_scrninfo(int entity_num, struct pci_device *pci_dev)
pPriv = xf86GetEntityPrivate(pEnt->index, gAMDGPUEntityIndex);
if (!pPriv->ptr) {
- uint32_t major_version;
- uint32_t minor_version;
-
pPriv->ptr = xnfcalloc(sizeof(AMDGPUEntRec), 1);
if (!pPriv->ptr)
goto error;
pAMDGPUEnt = pPriv->ptr;
- if (!amdgpu_open_drm_master(pScrn, pAMDGPUEnt, pci_dev))
+ if (!amdgpu_device_setup(pScrn, pci_dev, dev, pAMDGPUEnt))
goto error;
pAMDGPUEnt->fd_ref = 1;
- if (amdgpu_device_initialize(pAMDGPUEnt->fd,
- &major_version,
- &minor_version,
- &pAMDGPUEnt->pDev)) {
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
- "amdgpu_device_initialize failed\n");
- goto error_amdgpu;
- }
} else {
pAMDGPUEnt = pPriv->ptr;
@@ -271,8 +314,6 @@ static Bool amdgpu_get_scrninfo(int entity_num, struct pci_device *pci_dev)
return TRUE;
-error_amdgpu:
- amdgpu_kernel_close_fd(pAMDGPUEnt);
error:
free(pEnt);
return FALSE;
@@ -282,7 +323,10 @@ static Bool
amdgpu_pci_probe(DriverPtr pDriver,
int entity_num, struct pci_device *device, intptr_t match_data)
{
- return amdgpu_get_scrninfo(entity_num, device);
+ ScrnInfoPtr pScrn = xf86ConfigPciEntity(NULL, 0, entity_num, NULL,
+ NULL, NULL, NULL, NULL, NULL);
+
+ return amdgpu_probe(pScrn, entity_num, device, NULL);
}
static Bool AMDGPUDriverFunc(ScrnInfoPtr scrn, xorgDriverFuncOp op, void *data)
@@ -311,9 +355,6 @@ amdgpu_platform_probe(DriverPtr pDriver,
{
ScrnInfoPtr pScrn;
int scr_flags = 0;
- EntityInfoPtr pEnt = NULL;
- DevUnion *pPriv;
- AMDGPUEntPtr pAMDGPUEnt;
if (!dev->pdev)
return FALSE;
@@ -326,78 +367,7 @@ amdgpu_platform_probe(DriverPtr pDriver,
xf86SetEntityShared(entity_num);
xf86AddEntityToScreen(pScrn, entity_num);
- pScrn->driverVersion = AMDGPU_VERSION_CURRENT;
- pScrn->driverName = AMDGPU_DRIVER_NAME;
- pScrn->name = AMDGPU_NAME;
- pScrn->Probe = NULL;
- pScrn->PreInit = AMDGPUPreInit_KMS;
- pScrn->ScreenInit = AMDGPUScreenInit_KMS;
- pScrn->SwitchMode = AMDGPUSwitchMode_KMS;
- pScrn->AdjustFrame = AMDGPUAdjustFrame_KMS;
- pScrn->EnterVT = AMDGPUEnterVT_KMS;
- pScrn->LeaveVT = AMDGPULeaveVT_KMS;
- pScrn->FreeScreen = AMDGPUFreeScreen_KMS;
- pScrn->ValidMode = AMDGPUValidMode;
-
- pEnt = xf86GetEntityInfo(entity_num);
-
- /* Create a AMDGPUEntity for all chips, even with old single head
- * Radeon, need to use pAMDGPUEnt for new monitor detection routines.
- */
- xf86SetEntitySharable(entity_num);
-
- if (gAMDGPUEntityIndex == -1)
- gAMDGPUEntityIndex = xf86AllocateEntityPrivateIndex();
-
- pPriv = xf86GetEntityPrivate(pEnt->index, gAMDGPUEntityIndex);
-
- if (!pPriv->ptr) {
- uint32_t major_version;
- uint32_t minor_version;
-
- pPriv->ptr = xnfcalloc(sizeof(AMDGPUEntRec), 1);
- pAMDGPUEnt = pPriv->ptr;
- pAMDGPUEnt->platform_dev = dev;
- pAMDGPUEnt->fd = amdgpu_kernel_open_fd(pScrn, NULL, dev);
- if (pAMDGPUEnt->fd < 0)
- goto error;
-
- pAMDGPUEnt->fd_ref = 1;
-
- if (amdgpu_device_initialize(pAMDGPUEnt->fd,
- &major_version,
- &minor_version,
- &pAMDGPUEnt->pDev)) {
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
- "amdgpu_device_initialize failed\n");
- goto error_amdgpu;
- }
- } else {
- pAMDGPUEnt = pPriv->ptr;
-
- if (pAMDGPUEnt->fd_ref == ARRAY_SIZE(pAMDGPUEnt->scrn)) {
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
- "Only up to %u Zaphod instances supported\n",
- (unsigned)ARRAY_SIZE(pAMDGPUEnt->scrn));
- goto error;
- }
-
- pAMDGPUEnt->fd_ref++;
- }
-
- xf86SetEntityInstanceForScreen(pScrn, pEnt->index,
- xf86GetNumEntityInstances(pEnt->
- index)
- - 1);
- free(pEnt);
-
- return TRUE;
-
-error_amdgpu:
- amdgpu_kernel_close_fd(pAMDGPUEnt);
-error:
- free(pEnt);
- return FALSE;
+ return amdgpu_probe(pScrn, entity_num, NULL, dev);
}
#endif
diff --git a/driver/xf86-video-amdgpu/src/amdgpu_probe.h b/driver/xf86-video-amdgpu/src/amdgpu_probe.h
index 306c9a521..fea4d394b 100644
--- a/driver/xf86-video-amdgpu/src/amdgpu_probe.h
+++ b/driver/xf86-video-amdgpu/src/amdgpu_probe.h
@@ -69,6 +69,7 @@ typedef struct {
ScrnInfoPtr scrn[6];
struct xf86_platform_device *platform_dev;
char *render_node;
+ char *busid;
} AMDGPUEntRec, *AMDGPUEntPtr;
extern void amdgpu_kernel_close_fd(AMDGPUEntPtr pAMDGPUEnt);
diff --git a/driver/xf86-video-amdgpu/src/compat-api.h b/driver/xf86-video-amdgpu/src/compat-api.h
index a703e5c8f..aca3b07b3 100644
--- a/driver/xf86-video-amdgpu/src/compat-api.h
+++ b/driver/xf86-video-amdgpu/src/compat-api.h
@@ -38,4 +38,10 @@
#define BLOCKHANDLER_ARGS pScreen, pTimeout, pReadmask
#endif
+#if ABI_VIDEODRV_VERSION < SET_ABI_VERSION(25, 2)
+#define current_primary current_master
+#define primary_pixmap master_pixmap
+#define secondary_dst slave_dst
+#endif
+
#endif
diff --git a/driver/xf86-video-amdgpu/src/drmmode_display.c b/driver/xf86-video-amdgpu/src/drmmode_display.c
index c410d0b97..b6cdde7e8 100644
--- a/driver/xf86-video-amdgpu/src/drmmode_display.c
+++ b/driver/xf86-video-amdgpu/src/drmmode_display.c
@@ -40,15 +40,13 @@
#include "mipointrst.h"
#include "xf86cmap.h"
#include "xf86Priv.h"
-#include "sarea.h"
+#include <xf86drm.h>
#include "drmmode_display.h"
#include "amdgpu_bo_helper.h"
#include "amdgpu_glamor.h"
#include "amdgpu_pixmap.h"
-#include <dri.h>
-
/* DPMS */
#ifdef HAVE_XEXTPROTO_71
#include <X11/extensions/dpmsconst.h>
@@ -97,42 +95,6 @@ AMDGPUZaphodStringMatches(ScrnInfoPtr pScrn, const char *s, char *output_name)
}
-static PixmapPtr drmmode_create_bo_pixmap(ScrnInfoPtr pScrn,
- int width, int height,
- int depth, int bpp,
- int pitch,
- struct amdgpu_buffer *bo)
-{
- ScreenPtr pScreen = pScrn->pScreen;
- PixmapPtr pixmap;
-
- pixmap = (*pScreen->CreatePixmap)(pScreen, 0, 0, depth,
- AMDGPU_CREATE_PIXMAP_SCANOUT);
- if (!pixmap)
- return NULL;
-
- if (!(*pScreen->ModifyPixmapHeader) (pixmap, width, height,
- depth, bpp, pitch, NULL))
- goto fail;
-
- if (!amdgpu_glamor_create_textured_pixmap(pixmap, bo))
- goto fail;
-
- if (amdgpu_set_pixmap_bo(pixmap, bo))
- return pixmap;
-
-fail:
- pScreen->DestroyPixmap(pixmap);
- return NULL;
-}
-
-static void drmmode_destroy_bo_pixmap(PixmapPtr pixmap)
-{
- ScreenPtr pScreen = pixmap->drawable.pScreen;
-
- (*pScreen->DestroyPixmap) (pixmap);
-}
-
static void
drmmode_ConvertFromKMode(ScrnInfoPtr scrn,
drmModeModeInfo * kmode, DisplayModePtr mode)
@@ -505,22 +467,6 @@ void drmmode_copy_fb(ScrnInfoPtr pScrn, drmmode_ptr drmmode)
}
void
-drmmode_crtc_scanout_destroy(drmmode_ptr drmmode,
- struct drmmode_scanout *scanout)
-{
-
- if (scanout->pixmap) {
- drmmode_destroy_bo_pixmap(scanout->pixmap);
- scanout->pixmap = NULL;
- }
-
- if (scanout->bo) {
- amdgpu_bo_unref(&scanout->bo);
- scanout->bo = NULL;
- }
-}
-
-void
drmmode_crtc_scanout_free(xf86CrtcPtr crtc)
{
drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
@@ -532,60 +478,43 @@ drmmode_crtc_scanout_free(xf86CrtcPtr crtc)
amdgpu_drm_queue_handle_deferred(crtc);
}
- drmmode_crtc_scanout_destroy(drmmode_crtc->drmmode,
- &drmmode_crtc->scanout[0]);
- drmmode_crtc_scanout_destroy(drmmode_crtc->drmmode,
- &drmmode_crtc->scanout[1]);
+ drmmode_crtc_scanout_destroy(&drmmode_crtc->scanout[0]);
+ drmmode_crtc_scanout_destroy(&drmmode_crtc->scanout[1]);
if (drmmode_crtc->scanout_damage)
DamageDestroy(drmmode_crtc->scanout_damage);
}
-PixmapPtr
-drmmode_crtc_scanout_create(xf86CrtcPtr crtc, struct drmmode_scanout *scanout,
+static Bool
+drmmode_crtc_scanout_create(xf86CrtcPtr crtc, PixmapPtr *scanout,
int width, int height)
{
ScrnInfoPtr pScrn = crtc->scrn;
- drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
- drmmode_ptr drmmode = drmmode_crtc->drmmode;
- int pitch;
+ ScreenPtr screen = pScrn->pScreen;
- if (scanout->pixmap) {
- if (scanout->width == width && scanout->height == height)
- return scanout->pixmap;
+ if (*scanout) {
+ if ((*scanout)->drawable.width == width &&
+ (*scanout)->drawable.height == height)
+ return TRUE;
- drmmode_crtc_scanout_destroy(drmmode, scanout);
+ drmmode_crtc_scanout_destroy(scanout);
}
- scanout->bo = amdgpu_alloc_pixmap_bo(pScrn, width, height,
- pScrn->depth, 0,
- pScrn->bitsPerPixel, &pitch);
- if (!scanout->bo) {
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
- "Failed to allocate scanout buffer memory\n");
- return NULL;
- }
-
- scanout->pixmap = drmmode_create_bo_pixmap(pScrn,
- width, height,
- pScrn->depth,
- pScrn->bitsPerPixel,
- pitch, scanout->bo);
- if (!scanout->pixmap) {
+ *scanout = screen->CreatePixmap(screen, width, height, pScrn->depth,
+ AMDGPU_CREATE_PIXMAP_SCANOUT);
+ if (!*scanout) {
ErrorF("failed to create CRTC scanout pixmap\n");
goto error;
}
- if (amdgpu_pixmap_get_fb(scanout->pixmap)) {
- scanout->width = width;
- scanout->height = height;
- } else {
+ if (!amdgpu_pixmap_get_fb(*scanout)) {
ErrorF("failed to create CRTC scanout FB\n");
error:
- drmmode_crtc_scanout_destroy(drmmode, scanout);
+ drmmode_crtc_scanout_destroy(scanout);
+ return FALSE;
}
- return scanout->pixmap;
+ return TRUE;
}
static void
@@ -705,8 +634,7 @@ drmmode_crtc_prime_scanout_update(xf86CrtcPtr crtc, DisplayModePtr mode,
ScreenPtr screen = scrn->pScreen;
drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
- if (drmmode_crtc->tear_free &&
- !drmmode_crtc->scanout[1].pixmap) {
+ if (drmmode_crtc->tear_free && !drmmode_crtc->scanout[1]) {
RegionPtr region;
BoxPtr box;
@@ -729,8 +657,8 @@ drmmode_crtc_prime_scanout_update(xf86CrtcPtr crtc, DisplayModePtr mode,
xorg_list_for_each_entry(dirty, &screen->pixmap_dirty_list,
ent) {
if (amdgpu_dirty_src_equals(dirty, drmmode_crtc->prime_scanout_pixmap)) {
- dirty->slave_dst =
- drmmode_crtc->scanout[scanout_id].pixmap;
+ dirty->secondary_dst =
+ drmmode_crtc->scanout[scanout_id];
break;
}
}
@@ -738,9 +666,9 @@ drmmode_crtc_prime_scanout_update(xf86CrtcPtr crtc, DisplayModePtr mode,
if (!drmmode_crtc->tear_free) {
GCPtr gc = GetScratchGC(scrn->depth, screen);
- ValidateGC(&drmmode_crtc->scanout[0].pixmap->drawable, gc);
- gc->ops->CopyArea(&drmmode_crtc->scanout[1].pixmap->drawable,
- &drmmode_crtc->scanout[0].pixmap->drawable,
+ ValidateGC(&drmmode_crtc->scanout[0]->drawable, gc);
+ gc->ops->CopyArea(&drmmode_crtc->scanout[1]->drawable,
+ &drmmode_crtc->scanout[0]->drawable,
gc, 0, 0, mode->HDisplay, mode->VDisplay,
0, 0);
FreeScratchGC(gc);
@@ -748,7 +676,7 @@ drmmode_crtc_prime_scanout_update(xf86CrtcPtr crtc, DisplayModePtr mode,
}
}
- *fb = amdgpu_pixmap_get_fb(drmmode_crtc->scanout[scanout_id].pixmap);
+ *fb = amdgpu_pixmap_get_fb(drmmode_crtc->scanout[scanout_id]);
*x = *y = 0;
drmmode_crtc->scanout_id = scanout_id;
}
@@ -771,9 +699,9 @@ drmmode_crtc_scanout_update(xf86CrtcPtr crtc, DisplayModePtr mode,
mode->HDisplay, mode->VDisplay);
}
- if (drmmode_crtc->scanout[scanout_id].pixmap &&
+ if (drmmode_crtc->scanout[scanout_id] &&
(!drmmode_crtc->tear_free ||
- drmmode_crtc->scanout[scanout_id ^ 1].pixmap)) {
+ drmmode_crtc->scanout[scanout_id ^ 1])) {
BoxRec extents = { .x1 = 0, .y1 = 0,
.x2 = scrn->virtualX, .y2 = scrn->virtualY };
@@ -787,7 +715,7 @@ drmmode_crtc_scanout_update(xf86CrtcPtr crtc, DisplayModePtr mode,
drmmode_crtc->scanout_damage);
}
- *fb = amdgpu_pixmap_get_fb(drmmode_crtc->scanout[scanout_id].pixmap);
+ *fb = amdgpu_pixmap_get_fb(drmmode_crtc->scanout[scanout_id]);
*x = *y = 0;
if (amdgpu_scanout_do_update(crtc, scanout_id,
@@ -1370,7 +1298,6 @@ drmmode_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode,
drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
Bool handle_deferred = FALSE;
unsigned scanout_id = 0;
- drmmode_ptr drmmode = drmmode_crtc->drmmode;
int saved_x, saved_y;
Rotation saved_rotation;
DisplayModeRec saved_mode;
@@ -1407,8 +1334,8 @@ drmmode_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode,
if (drmmode_crtc->prime_scanout_pixmap) {
drmmode_crtc_prime_scanout_update(crtc, mode, scanout_id,
&fb, &x, &y);
- } else if (drmmode_crtc->rotate.pixmap) {
- fb = amdgpu_pixmap_get_fb(drmmode_crtc->rotate.pixmap);
+ } else if (drmmode_crtc->rotate) {
+ fb = amdgpu_pixmap_get_fb(drmmode_crtc->rotate);
x = y = 0;
} else if (!pScreen->isGPU &&
@@ -1489,13 +1416,11 @@ done:
} else {
crtc->active = TRUE;
- if (drmmode_crtc->scanout[scanout_id].pixmap &&
- fb != amdgpu_pixmap_get_fb(drmmode_crtc->
- scanout[scanout_id].pixmap)) {
+ if (drmmode_crtc->scanout[scanout_id] &&
+ fb != amdgpu_pixmap_get_fb(drmmode_crtc->scanout[scanout_id])) {
drmmode_crtc_scanout_free(crtc);
} else if (!drmmode_crtc->tear_free) {
- drmmode_crtc_scanout_destroy(drmmode,
- &drmmode_crtc->scanout[1]);
+ drmmode_crtc_scanout_destroy(&drmmode_crtc->scanout[1]);
}
}
@@ -1784,7 +1709,7 @@ static void drmmode_show_cursor(xf86CrtcPtr crtc)
arg.hot_y = yhot;
ret = drmIoctl(pAMDGPUEnt->fd, DRM_IOCTL_MODE_CURSOR2, &arg);
- if (ret == -EINVAL)
+ if (ret == -1 && errno == EINVAL)
use_set_cursor2 = FALSE;
else
return;
@@ -1819,7 +1744,7 @@ drmmode_crtc_shadow_create(xf86CrtcPtr crtc, void *data, int width, int height)
height);
}
- return drmmode_crtc->rotate.pixmap;
+ return drmmode_crtc->rotate;
}
static void
@@ -1827,9 +1752,8 @@ drmmode_crtc_shadow_destroy(xf86CrtcPtr crtc, PixmapPtr rotate_pixmap,
void *data)
{
drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
- drmmode_ptr drmmode = drmmode_crtc->drmmode;
- drmmode_crtc_scanout_destroy(drmmode, &drmmode_crtc->rotate);
+ drmmode_crtc_scanout_destroy(&drmmode_crtc->rotate);
}
static void
@@ -1865,7 +1789,7 @@ static Bool drmmode_set_scanout_pixmap(xf86CrtcPtr crtc, PixmapPtr ppix)
xorg_list_for_each_entry(dirty, &screen->pixmap_dirty_list, ent) {
if (amdgpu_dirty_src_equals(dirty, drmmode_crtc->prime_scanout_pixmap)) {
- PixmapStopDirtyTracking(dirty->src, dirty->slave_dst);
+ PixmapStopDirtyTracking(dirty->src, dirty->secondary_dst);
break;
}
}
@@ -1893,16 +1817,16 @@ static Bool drmmode_set_scanout_pixmap(xf86CrtcPtr crtc, PixmapPtr ppix)
#ifdef HAS_DIRTYTRACKING_DRAWABLE_SRC
PixmapStartDirtyTracking(&ppix->drawable,
- drmmode_crtc->scanout[scanout_id].pixmap,
+ drmmode_crtc->scanout[scanout_id],
0, 0, 0, 0, RR_Rotate_0);
#elif defined(HAS_DIRTYTRACKING_ROTATION)
- PixmapStartDirtyTracking(ppix, drmmode_crtc->scanout[scanout_id].pixmap,
+ PixmapStartDirtyTracking(ppix, drmmode_crtc->scanout[scanout_id],
0, 0, 0, 0, RR_Rotate_0);
#elif defined(HAS_DIRTYTRACKING2)
- PixmapStartDirtyTracking2(ppix, drmmode_crtc->scanout[scanout_id].pixmap,
+ PixmapStartDirtyTracking2(ppix, drmmode_crtc->scanout[scanout_id],
0, 0, 0, 0);
#else
- PixmapStartDirtyTracking(ppix, drmmode_crtc->scanout[scanout_id].pixmap, 0, 0);
+ PixmapStartDirtyTracking(ppix, drmmode_crtc->scanout[scanout_id], 0, 0);
#endif
return TRUE;
}
@@ -2975,8 +2899,8 @@ static Bool drmmode_xf86crtc_resize(ScrnInfoPtr scrn, int width, int height)
int i, pitch, old_width, old_height, old_pitch;
int cpp = info->pixel_bytes;
PixmapPtr ppix = screen->GetScreenPixmap(screen);
+ int hint = AMDGPU_CREATE_PIXMAP_SCANOUT;
void *fb_shadow;
- int hint = 0;
if (scrn->virtualX == width && scrn->virtualY == height)
return TRUE;
@@ -2990,9 +2914,9 @@ static Bool drmmode_xf86crtc_resize(ScrnInfoPtr scrn, int width, int height)
}
if (info->shadow_primary)
- hint = AMDGPU_CREATE_PIXMAP_LINEAR | AMDGPU_CREATE_PIXMAP_GTT;
+ hint |= AMDGPU_CREATE_PIXMAP_LINEAR | AMDGPU_CREATE_PIXMAP_GTT;
else if (!info->use_glamor)
- hint = AMDGPU_CREATE_PIXMAP_LINEAR;
+ hint |= AMDGPU_CREATE_PIXMAP_LINEAR;
xf86DrvMsg(scrn->scrnIndex, X_INFO,
"Allocate new frame buffer %dx%d\n", width, height);
@@ -3432,7 +3356,7 @@ Bool drmmode_pre_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode, int cpp)
unsigned int crtcs_needed = 0;
unsigned int crtcs_got = 0;
drmModeResPtr mode_res;
- char *bus_id_string, *provider_name;
+ char *provider_name;
xf86CrtcConfigInit(pScrn, &drmmode_xf86crtc_config_funcs);
@@ -3495,9 +3419,7 @@ Bool drmmode_pre_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode, int cpp)
/* workout clones */
drmmode_clones_init(pScrn, drmmode, mode_res);
- bus_id_string = DRICreatePCIBusID(info->PciInfo);
- XNFasprintf(&provider_name, "%s @ %s", pScrn->chipset, bus_id_string);
- free(bus_id_string);
+ XNFasprintf(&provider_name, "%s @ %s", pScrn->chipset, pAMDGPUEnt->busid);
xf86ProviderSetup(pScrn, NULL, provider_name);
free(provider_name);
@@ -4127,7 +4049,7 @@ Bool amdgpu_do_pageflip(ScrnInfoPtr scrn, ClientPtr client,
}
drmmode_fb_reference(pAMDGPUEnt->fd, &flipdata->fb[crtc_id],
- amdgpu_pixmap_get_fb(drmmode_crtc->scanout[scanout_id].pixmap));
+ amdgpu_pixmap_get_fb(drmmode_crtc->scanout[scanout_id]));
if (!flipdata->fb[crtc_id]) {
ErrorF("Failed to get FB for TearFree flip\n");
goto error;
diff --git a/driver/xf86-video-amdgpu/src/drmmode_display.h b/driver/xf86-video-amdgpu/src/drmmode_display.h
index 9c0f25ac2..b7d540173 100644
--- a/driver/xf86-video-amdgpu/src/drmmode_display.h
+++ b/driver/xf86-video-amdgpu/src/drmmode_display.h
@@ -96,12 +96,6 @@ enum drmmode_scanout_status {
DRMMODE_SCANOUT_VBLANK_FAILED = 1u << 1,
};
-struct drmmode_scanout {
- struct amdgpu_buffer *bo;
- PixmapPtr pixmap;
- int width, height;
-};
-
typedef struct {
drmmode_ptr drmmode;
drmModeCrtcPtr mode_crtc;
@@ -115,8 +109,8 @@ typedef struct {
unsigned cursor_id;
struct amdgpu_buffer *cursor_buffer[2];
- struct drmmode_scanout rotate;
- struct drmmode_scanout scanout[2];
+ PixmapPtr rotate;
+ PixmapPtr scanout[2];
DamagePtr scanout_damage;
Bool ignore_damage;
RegionRec scanout_last_region;
@@ -202,9 +196,9 @@ drmmode_crtc_can_flip(xf86CrtcPtr crtc)
return crtc->enabled &&
drmmode_crtc->dpms_mode == DPMSModeOn &&
- !drmmode_crtc->rotate.bo &&
+ !drmmode_crtc->rotate &&
(drmmode_crtc->tear_free ||
- !drmmode_crtc->scanout[drmmode_crtc->scanout_id].bo);
+ !drmmode_crtc->scanout[drmmode_crtc->scanout_id]);
}
@@ -240,6 +234,17 @@ drmmode_fb_reference_loc(int drm_fd, struct drmmode_fb **old, struct drmmode_fb
drmmode_fb_reference_loc(fd, old, new, __func__, __LINE__)
+static inline void
+drmmode_crtc_scanout_destroy(PixmapPtr *scanout)
+{
+ if (!*scanout)
+ return;
+
+ (*scanout)->drawable.pScreen->DestroyPixmap(*scanout);
+ (*scanout) = NULL;
+}
+
+
extern int drmmode_page_flip_target_absolute(AMDGPUEntPtr pAMDGPUEnt,
drmmode_crtc_private_ptr drmmode_crtc,
int fb_id, uint32_t flags,
@@ -259,12 +264,7 @@ extern Bool drmmode_set_desired_modes(ScrnInfoPtr pScrn, drmmode_ptr drmmode,
extern void drmmode_copy_fb(ScrnInfoPtr pScrn, drmmode_ptr drmmode);
extern Bool drmmode_setup_colormap(ScreenPtr pScreen, ScrnInfoPtr pScrn);
-extern void drmmode_crtc_scanout_destroy(drmmode_ptr drmmode,
- struct drmmode_scanout *scanout);
void drmmode_crtc_scanout_free(xf86CrtcPtr crtc);
-PixmapPtr drmmode_crtc_scanout_create(xf86CrtcPtr crtc,
- struct drmmode_scanout *scanout,
- int width, int height);
extern void drmmode_uevent_init(ScrnInfoPtr scrn, drmmode_ptr drmmode);
extern void drmmode_uevent_fini(ScrnInfoPtr scrn, drmmode_ptr drmmode);