summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthieu Herrb <matthieu@herrb.eu>2017-02-18 09:49:15 +0100
committerMatthieu Herrb <matthieu@herrb.eu>2017-02-18 09:49:15 +0100
commit0ce00785ebdab96f1634a3bc46e6fab055b830dd (patch)
tree714881da478624ab389997e3405f8fb3de61a78c
parent8e6a3560efec107e9ba4a756b7e4e4204f69ba90 (diff)
parent1351e48efe7a2c28eab447e16f36a00fbd02ae48 (diff)
Merge remote-tracking branch 'origin/master' into obsd
-rw-r--r--.editorconfig3
-rw-r--r--Makefile.am2
-rwxr-xr-xautogen.sh11
-rw-r--r--conf/10-radeon.conf5
-rw-r--r--conf/Makefile.am24
-rw-r--r--configure.ac16
-rw-r--r--src/ati.c40
-rw-r--r--src/drmmode_display.c7
-rw-r--r--src/radeon_dri2.c4
-rw-r--r--src/radeon_kms.c21
10 files changed, 112 insertions, 21 deletions
diff --git a/.editorconfig b/.editorconfig
index 2131011d..91f0ff80 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -8,3 +8,6 @@ charset=utf-8
[src/{drmmode_display.c,radeon_dri3.c,radeon_glamor.c,radeon_glamor.h,radeon_glamor_wrappers.c}]
indent_size=8
+
+[src/ati.c]
+indent_style=space
diff --git a/Makefile.am b/Makefile.am
index f4f4233e..f0e2c3ce 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -18,7 +18,7 @@
# 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.
-SUBDIRS = src man
+SUBDIRS = src man conf
MAINTAINERCLEANFILES = ChangeLog INSTALL
.PHONY: ChangeLog INSTALL
diff --git a/autogen.sh b/autogen.sh
index fc34bd55..a98269f7 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -1,14 +1,17 @@
#! /bin/sh
-srcdir=`dirname $0`
+srcdir=`dirname "$0"`
test -z "$srcdir" && srcdir=.
ORIGDIR=`pwd`
-cd $srcdir
+cd "$srcdir"
autoreconf -v --install || exit 1
-cd $ORIGDIR || exit $?
+cd "$ORIGDIR" || exit $?
+
+git config --local --get format.subjectPrefix >/dev/null 2>&1 ||
+ git config --local format.subjectPrefix "PATCH xf86-video-ati"
if test -z "$NOCONFIGURE"; then
- $srcdir/configure "$@"
+ exec "$srcdir"/configure "$@"
fi
diff --git a/conf/10-radeon.conf b/conf/10-radeon.conf
new file mode 100644
index 00000000..04217f67
--- /dev/null
+++ b/conf/10-radeon.conf
@@ -0,0 +1,5 @@
+Section "OutputClass"
+ Identifier "Radeon"
+ MatchDriver "radeon"
+ Driver "radeon"
+EndSection \ No newline at end of file
diff --git a/conf/Makefile.am b/conf/Makefile.am
new file mode 100644
index 00000000..fba75dac
--- /dev/null
+++ b/conf/Makefile.am
@@ -0,0 +1,24 @@
+# Copyright 2017 Advanced Micro Devices, Inc.
+#
+# 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
+# on 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
+# ADAM JACKSON 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.
+
+
+if HAS_XORG_CONF_DIR
+dist_config_DATA = 10-radeon.conf
+endif
diff --git a/configure.ac b/configure.ac
index 48281e3a..732f7050 100644
--- a/configure.ac
+++ b/configure.ac
@@ -79,6 +79,20 @@ PKG_CHECK_MODULES(XEXT, [xextproto >= 7.0.99.1],
HAVE_XEXTPROTO_71="no")
AM_CONDITIONAL(HAVE_XEXTPROTO_71, [ test "$HAVE_XEXTPROTO_71" = "yes" ])
+# Section "OutputClass" is only supported as of xserver 1.16
+PKG_CHECK_EXISTS([xorg-server >= 1.16],
+ [sysconfigdir=`$PKG_CONFIG --variable=sysconfigdir xorg-server`],
+ [sysconfigdir=""])
+AM_CONDITIONAL(HAS_XORG_CONF_DIR, [test "x$sysconfigdir" != "x"])
+
+# Define a configure option for an alternate X Server configuration directory
+AC_ARG_WITH(xorg-conf-dir,
+ AS_HELP_STRING([--with-xorg-conf-dir=DIR],
+ [Default xorg.conf.d directory [[default=${prefix}/share/X11/xorg.conf.d]]]),
+ [configdir="$withval"],
+ [configdir='${prefix}/share/X11/xorg.conf.d'])
+AC_SUBST(configdir)
+
AC_ARG_ENABLE([udev],
AS_HELP_STRING([--disable-udev], [Disable libudev support [default=auto]]),
[enable_udev="$enableval"],
@@ -265,6 +279,7 @@ AC_CONFIG_FILES([
Makefile
src/Makefile
man/Makefile
+ conf/Makefile
])
AC_OUTPUT
@@ -276,6 +291,7 @@ echo " prefix: $prefix"
echo " exec_prefix: $exec_prefix"
echo " libdir: $libdir"
echo " includedir: $includedir"
+echo " configdir: $configdir"
echo ""
echo " CFLAGS: $CFLAGS"
diff --git a/src/ati.c b/src/ati.c
index 227665e7..6fd21567 100644
--- a/src/ati.c
+++ b/src/ati.c
@@ -58,6 +58,7 @@
#endif
#include <pciaccess.h>
+#include <xf86drm.h>
#include "atipcirename.h"
#include "ati.h"
@@ -68,6 +69,7 @@
#define MACH64_DRIVER_NAME "mach64"
#define R128_DRIVER_NAME "r128"
#define RADEON_DRIVER_NAME "radeon"
+#define AMDGPU_DRIVER_NAME "amdgpu"
enum
{
@@ -140,9 +142,9 @@ ati_device_get_indexed(int index)
void
ati_gdev_subdriver(pointer options)
{
- int nATIGDev, nMach64GDev, nR128GDev, nRadeonGDev;
+ int nATIGDev, nMach64GDev, nR128GDev, nRadeonGDev, nAmdgpuGDev;
GDevPtr *ATIGDevs;
- Bool load_mach64 = FALSE, load_r128 = FALSE, load_radeon = FALSE;
+ Bool load_mach64 = FALSE, load_r128 = FALSE, load_radeon = FALSE, load_amdgpu = FALSE;
int i;
/* let the subdrivers configure for themselves */
@@ -154,6 +156,7 @@ ati_gdev_subdriver(pointer options)
nMach64GDev = xf86MatchDevice(MACH64_DRIVER_NAME, NULL);
nR128GDev = xf86MatchDevice(R128_DRIVER_NAME, NULL);
nRadeonGDev = xf86MatchDevice(RADEON_DRIVER_NAME, NULL);
+ nAmdgpuGDev = xf86MatchDevice(AMDGPU_DRIVER_NAME, NULL);
for (i = 0; i < nATIGDev; i++) {
GDevPtr ati_gdev = ATIGDevs[i];
@@ -200,8 +203,34 @@ ati_gdev_subdriver(pointer options)
}
if (chip_family == ATI_CHIP_FAMILY_Radeon) {
- ati_gdev->driver = RADEON_DRIVER_NAME;
- load_radeon = TRUE;
+ char *busid;
+
+ XNFasprintf(&busid, "pci:%04x:%02x:%02x.%d",
+ device->domain, device->bus, device->dev,
+ device->func);
+
+ if (busid) {
+ int fd = drmOpen(NULL, busid);
+
+ if (fd >= 0) {
+ drmVersionPtr version = drmGetVersion(fd);
+
+ if (version->version_major == 3) {
+ ati_gdev->driver = AMDGPU_DRIVER_NAME;
+ load_amdgpu = TRUE;
+ }
+
+ free(version);
+ drmClose(fd);
+ }
+
+ free(busid);
+ }
+
+ if (strcmp(ati_gdev->driver, AMDGPU_DRIVER_NAME) != 0) {
+ ati_gdev->driver = RADEON_DRIVER_NAME;
+ load_radeon = TRUE;
+ }
}
}
@@ -219,6 +248,9 @@ ati_gdev_subdriver(pointer options)
if (load_radeon && (nRadeonGDev == 0))
xf86LoadOneModule(RADEON_DRIVER_NAME, options);
+
+ if (load_amdgpu && (nAmdgpuGDev == 0))
+ xf86LoadOneModule(AMDGPU_DRIVER_NAME, options);
}
/*
diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 0fb0d770..2258e7a6 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -2895,7 +2895,8 @@ flip_error:
strerror(errno));
error:
- if (flipdata && flipdata->flip_count <= 1) {
+ if (flipdata && flipdata->flip_count <= 1 &&
+ drmmode->fb_id != flipdata->old_fb_id) {
drmModeRmFB(drmmode->fd, drmmode->fb_id);
drmmode->fb_id = flipdata->old_fb_id;
}
@@ -2904,8 +2905,10 @@ error:
radeon_drm_abort_entry(drm_queue_seq);
else if (crtc)
drmmode_flip_abort(crtc, flipdata);
- else if (flipdata && flipdata->flip_count <= 1)
+ else {
+ abort(NULL, data);
free(flipdata);
+ }
xf86DrvMsg(scrn->scrnIndex, X_WARNING, "Page flip failed: %s\n",
strerror(errno));
diff --git a/src/radeon_dri2.c b/src/radeon_dri2.c
index 860ff290..d0dcf890 100644
--- a/src/radeon_dri2.c
+++ b/src/radeon_dri2.c
@@ -579,9 +579,9 @@ xf86CrtcPtr radeon_dri2_drawable_crtc(DrawablePtr pDraw, Bool consider_disabled)
static void
radeon_dri2_flip_event_abort(xf86CrtcPtr crtc, void *event_data)
{
- RADEONInfoPtr info = RADEONPTR(crtc->scrn);
+ if (crtc)
+ RADEONPTR(crtc->scrn)->drmmode.dri2_flipping = FALSE;
- info->drmmode.dri2_flipping = FALSE;
free(event_data);
}
diff --git a/src/radeon_kms.c b/src/radeon_kms.c
index 48dec967..a95b51ab 100644
--- a/src/radeon_kms.c
+++ b/src/radeon_kms.c
@@ -1741,10 +1741,12 @@ Bool RADEONPreInit_KMS(ScrnInfoPtr pScrn, int flags)
if (r600_get_tile_config(pScrn)) {
info->allowColorTiling = xf86ReturnOptValBool(info->Options,
OPTION_COLOR_TILING, colorTilingDefault);
- /* need working DFS for tiling */
- if ((info->ChipFamily == CHIP_FAMILY_PALM) &&
- (!info->accel_state->allowHWDFS))
- info->allowColorTiling = FALSE;
+ if (!info->use_glamor) {
+ /* need working DFS for tiling */
+ if (info->ChipFamily == CHIP_FAMILY_PALM &&
+ !info->accel_state->allowHWDFS)
+ info->allowColorTiling = FALSE;
+ }
} else
info->allowColorTiling = FALSE;
} else
@@ -1799,10 +1801,13 @@ Bool RADEONPreInit_KMS(ScrnInfoPtr pScrn, int flags)
}
}
- info->swapBuffersWait = xf86ReturnOptValBool(info->Options,
- OPTION_SWAPBUFFERS_WAIT, TRUE);
- xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "SwapBuffers wait for vsync: %sabled\n", info->swapBuffersWait ? "en" : "dis");
+ if (!info->use_glamor) {
+ info->swapBuffersWait =
+ xf86ReturnOptValBool(info->Options, OPTION_SWAPBUFFERS_WAIT, TRUE);
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "SwapBuffers wait for vsync: %sabled\n",
+ info->swapBuffersWait ? "en" : "dis");
+ }
if (xf86ReturnOptValBool(info->Options, OPTION_DELETE_DP12, FALSE)) {
info->drmmode.delete_dp_12_displays = TRUE;