[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

xserver-xorg-video-amdgpu: Changes to 'upstream-unstable'



Rebased ref, commits from common ancestor:
commit a00032050873fc99f3ceaa3293468dad1d94d4b1
Author: Michel Dänzer <michel.daenzer@amd.com>
Date:   Thu Nov 17 15:17:10 2016 +0900

    Bump version for 1.2.0 release

diff --git a/configure.ac b/configure.ac
index abdeb40..37eac53 100644
--- a/configure.ac
+++ b/configure.ac
@@ -23,7 +23,7 @@
 # Initialize Autoconf
 AC_PREREQ([2.60])
 AC_INIT([xf86-video-amdgpu],
-        [1.1.99],
+        [1.2.0],
         [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],
         [xf86-video-amdgpu])
 

commit a446b3af9b055056e9fb0f37069b08b979eba277
Author: Michel Dänzer <michel.daenzer@amd.com>
Date:   Thu Nov 17 15:13:59 2016 +0900

    manpage updates for the 1.2.0 release
    
    Option "TearFree" is now effective for arbitrary transforms as well.
    
    Point to the amd-gfx mailing list instead of xorg-driver-ati.

diff --git a/man/amdgpu.man b/man/amdgpu.man
index 948cd70..0e5c291 100644
--- a/man/amdgpu.man
+++ b/man/amdgpu.man
@@ -73,10 +73,8 @@ Enable DRI2 page flipping.  The default is
 .B on.
 .TP
 .BI "Option \*qTearFree\*q \*q" boolean \*q
-Enable tearing prevention using the hardware page flipping mechanism. This
-option currently doesn't have any effect for CRTCs using transforms other than
-rotation or reflection. It requires allocating two separate scanout buffers for
-each supported CRTC. Enabling this option currently disables Option
+Enable tearing prevention using the hardware page flipping mechanism. Requires allocating two
+separate scanout buffers for each CRTC. Enabling this option currently disables Option
 \*qEnablePageFlip\*q. The default is
 .B off.
 .TP
@@ -120,7 +118,7 @@ http://cgit.freedesktop.org/xorg/driver/xf86-video-amdgpu/
 .IP " 3." 4
 Mailing list:
 .RS 4
-http://lists.x.org/mailman/listinfo/xorg-driver-ati
+http://lists.freedesktop.org/mailman/listinfo/amd-gfx
 .RE
 .IP " 4." 4
 IRC channel:

commit 24e36c7044a24294d5709c0306efacc8de6df072
Author: Michel Dänzer <michel.daenzer@amd.com>
Date:   Thu Nov 10 12:30:10 2016 +0900

    Use pAMDGPUEnt to find both screens of a GPU in amdgpu_mode_hotplug
    
    Fixes misbehaviour when hotplugging DisplayPort connectors on secondary
    GPUs.
    
    Fixes: 14606e127f4b ("Handle Zaphod mode correctly in amdgpu_mode_hotplug")
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=98626
    (Ported from radeon commit 9760ef33cba5795eddeda4d5c2fcbe2dcce21689)
    Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

diff --git a/src/amdgpu_kms.c b/src/amdgpu_kms.c
index b21cd37..bf9058e 100644
--- a/src/amdgpu_kms.c
+++ b/src/amdgpu_kms.c
@@ -1313,6 +1313,11 @@ Bool AMDGPUPreInit_KMS(ScrnInfoPtr pScrn, int flags)
 		}
 	}
 
+	if (info->IsSecondary)
+		pAMDGPUEnt->secondary_scrn = pScrn;
+	else
+		pAMDGPUEnt->primary_scrn = pScrn;
+
 	info->PciInfo = xf86GetPciInfoForEntity(info->pEnt->index);
 	pScrn->monitor = pScrn->confScreen->monitor;
 
diff --git a/src/amdgpu_probe.h b/src/amdgpu_probe.h
index e6af3a2..802df12 100644
--- a/src/amdgpu_probe.h
+++ b/src/amdgpu_probe.h
@@ -93,6 +93,8 @@ typedef struct {
 	unsigned long fd_wakeup_registered;	/* server generation for which fd has been registered for wakeup handling */
 	int fd_wakeup_ref;
 	unsigned int assigned_crtcs;
+	ScrnInfoPtr primary_scrn;
+	ScrnInfoPtr secondary_scrn;
 	struct xf86_platform_device *platform_dev;
 } AMDGPUEntRec, *AMDGPUEntPtr;
 
diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 0ca78e0..a75cc5c 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -2402,7 +2402,7 @@ amdgpu_mode_hotplug(ScrnInfoPtr scrn, drmmode_ptr drmmode)
 	xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
 	AMDGPUEntPtr pAMDGPUEnt = AMDGPUEntPriv(scrn);
 	drmModeResPtr mode_res;
-	int i, j, s;
+	int i, j;
 	Bool found;
 	Bool changed = FALSE;
 	int num_dvi = 0, num_hdmi = 0;
@@ -2439,20 +2439,13 @@ restart_destroy:
 
 	/* find new output ids we don't have outputs for */
 	for (i = 0; i < mode_res->count_connectors; i++) {
-		found = FALSE;
-
-		for (s = 0; !found && s < xf86NumScreens; s++) {
-			ScrnInfoPtr loop_scrn = xf86Screens[s];
-
-			if (strcmp(loop_scrn->driverName, scrn->driverName) ||
-			    AMDGPUEntPriv(loop_scrn) != pAMDGPUEnt)
-				continue;
-
-			found = drmmode_find_output(loop_scrn,
-						    mode_res->connectors[i],
-						    &num_dvi, &num_hdmi);
-		}
-		if (found)
+		if (drmmode_find_output(pAMDGPUEnt->primary_scrn,
+					mode_res->connectors[i],
+					&num_dvi, &num_hdmi) ||
+		    (pAMDGPUEnt->secondary_scrn &&
+		     drmmode_find_output(pAMDGPUEnt->secondary_scrn,
+					 mode_res->connectors[i],
+					 &num_dvi, &num_hdmi)))
 			continue;
 
 		if (drmmode_output_init(scrn, drmmode, mode_res, i, &num_dvi,

commit 257be5b0853814a557a5337878a4311acbc89856
Author: Michel Dänzer <michel.daenzer@amd.com>
Date:   Thu Nov 10 12:28:03 2016 +0900

    Refactor amdgpu_mode_hotplug
    
    Preparation for the next change, no functional change intended.
    
    (Cherry picked from radeon commit 35bec4937d89b48a79acfcb4f814b7370cb631b2)
    Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 2d36881..0ca78e0 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -2365,6 +2365,36 @@ Bool drmmode_setup_colormap(ScreenPtr pScreen, ScrnInfoPtr pScrn)
 	return TRUE;
 }
 
+static Bool
+drmmode_find_output(ScrnInfoPtr scrn, int output_id, int *num_dvi,
+		    int *num_hdmi)
+{
+	xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
+	int i;
+
+	for (i = 0; i < config->num_output; i++) {
+		xf86OutputPtr output = config->output[i];
+		drmmode_output_private_ptr drmmode_output = output->driver_private;
+
+		if (drmmode_output->output_id == output_id) {
+			switch(drmmode_output->mode_output->connector_type) {
+			case DRM_MODE_CONNECTOR_DVII:
+			case DRM_MODE_CONNECTOR_DVID:
+			case DRM_MODE_CONNECTOR_DVIA:
+				(*num_dvi)++;
+				break;
+			case DRM_MODE_CONNECTOR_HDMIA:
+			case DRM_MODE_CONNECTOR_HDMIB:
+				(*num_hdmi)++;
+				break;
+			}
+
+			return TRUE;
+		}
+	}
+
+	return FALSE;
+}
 
 void
 amdgpu_mode_hotplug(ScrnInfoPtr scrn, drmmode_ptr drmmode)
@@ -2413,35 +2443,14 @@ restart_destroy:
 
 		for (s = 0; !found && s < xf86NumScreens; s++) {
 			ScrnInfoPtr loop_scrn = xf86Screens[s];
-			xf86CrtcConfigPtr loop_config =
-				XF86_CRTC_CONFIG_PTR(loop_scrn);
 
 			if (strcmp(loop_scrn->driverName, scrn->driverName) ||
 			    AMDGPUEntPriv(loop_scrn) != pAMDGPUEnt)
 				continue;
 
-			for (j = 0; !found && j < loop_config->num_output; j++) {
-				xf86OutputPtr output = loop_config->output[j];
-				drmmode_output_private_ptr drmmode_output;
-
-				drmmode_output = output->driver_private;
-				if (mode_res->connectors[i] ==
-				    drmmode_output->output_id) {
-					found = TRUE;
-
-					switch(drmmode_output->mode_output->connector_type) {
-					case DRM_MODE_CONNECTOR_DVII:
-					case DRM_MODE_CONNECTOR_DVID:
-					case DRM_MODE_CONNECTOR_DVIA:
-						num_dvi++;
-						break;
-					case DRM_MODE_CONNECTOR_HDMIA:
-					case DRM_MODE_CONNECTOR_HDMIB:
-						num_hdmi++;
-						break;
-					}
-				}
-			}
+			found = drmmode_find_output(loop_scrn,
+						    mode_res->connectors[i],
+						    &num_dvi, &num_hdmi);
 		}
 		if (found)
 			continue;

commit 1352a1d2f78cb0433d421ef86bfce2a5a1646807
Author: Michel Dänzer <michel.daenzer@amd.com>
Date:   Wed Nov 2 12:35:55 2016 +0900

    Check Xorg version at runtime instead of build time in two places
    
    This means that all possible paths can be handled as intended, no matter
    which Xorg version the driver happened to be compiled against.
    
    (Ported from radeon commit 350a2645a1b127227ff294c0b62d20000d0fd48a)
    Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

diff --git a/man/amdgpu.man b/man/amdgpu.man
index 93244a4..948cd70 100644
--- a/man/amdgpu.man
+++ b/man/amdgpu.man
@@ -65,7 +65,7 @@ will assign xrandr outputs LVDS and VGA-0 to this instance of the driver.
 Define the maximum level of DRI to enable. Valid values are 2 for DRI2 or 3 for DRI3.
 The default is
 .B 3 for DRI3
-if the driver was compiled for Xorg >= 1.18.3, otherwise
+if the Xorg version is >= 1.18.3, otherwise
 .B 2 for DRI2.
 .TP
 .BI "Option \*qEnablePageFlip\*q \*q" boolean \*q
diff --git a/src/amdgpu_kms.c b/src/amdgpu_kms.c
index acf3a7d..b21cd37 100644
--- a/src/amdgpu_kms.c
+++ b/src/amdgpu_kms.c
@@ -1713,11 +1713,7 @@ Bool AMDGPUScreenInit_KMS(SCREEN_INIT_ARGS_DECL)
 	}
 #endif
 
-#if XORG_VERSION_CURRENT >= XORG_VERSION_NUMERIC(1,18,3,0,0)
-	value = TRUE;
-#else
-	value = FALSE;
-#endif
+	value = xorgGetVersion() >= XORG_VERSION_NUMERIC(1,18,3,0,0);
 	from = X_DEFAULT;
 
 	if (info->use_glamor) {
diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index f514866..2d36881 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -607,10 +607,10 @@ drmmode_can_use_hw_cursor(xf86CrtcPtr crtc)
 		return FALSE;
 #endif
 
-#if defined(AMDGPU_PIXMAP_SHARING) && \
-	XORG_VERSION_CURRENT <= XORG_VERSION_NUMERIC(1,18,99,901,0)
-	/* HW cursor not supported with RandR 1.4 multihead */
-	if (!xorg_list_is_empty(&crtc->scrn->pScreen->pixmap_dirty_list))
+#if defined(AMDGPU_PIXMAP_SHARING)
+	/* HW cursor not supported with RandR 1.4 multihead up to 1.18.99.901 */
+	if (xorgGetVersion() <= XORG_VERSION_NUMERIC(1,18,99,901,0) &&
+	    !xorg_list_is_empty(&crtc->scrn->pScreen->pixmap_dirty_list))
 		return FALSE;
 #endif
 

commit 5da43c5da8adc139d57d89975a52eef91a5595e1
Author: Michel Dänzer <michel.daenzer@amd.com>
Date:   Tue Nov 1 16:01:24 2016 +0900

    Require xserver 1.10 or newer
    
    1.10.0 was released in February 2011.
    
    We've been accidentally requiring 1.10 or newer since c7d27c94cb65 ("Keep
    track of damage event related flushes per-client").
    
    (Ported from radeon commit 5df36de39952c3a26cb2fbc125f298139a9dd5bc)
    Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

diff --git a/configure.ac b/configure.ac
index b436db5..abdeb40 100644
--- a/configure.ac
+++ b/configure.ac
@@ -74,7 +74,7 @@ PKG_CHECK_MODULES(LIBDRM_AMDGPU, [libdrm_amdgpu])
 PKG_CHECK_MODULES(GBM, [gbm])
 
 # Obtain compiler/linker options for the driver dependencies
-PKG_CHECK_MODULES(XORG, [xorg-server >= 1.9 xproto fontsproto xf86driproto $REQUIRED_MODULES])
+PKG_CHECK_MODULES(XORG, [xorg-server >= 1.10 xproto fontsproto xf86driproto $REQUIRED_MODULES])
 PKG_CHECK_MODULES(XEXT, [xextproto >= 7.0.99.1],
                   HAVE_XEXTPROTO_71="yes"; AC_DEFINE(HAVE_XEXTPROTO_71, 1, [xextproto 7.1 available]),
                   HAVE_XEXTPROTO_71="no")
diff --git a/src/amdgpu_drv.h b/src/amdgpu_drv.h
index fc6a79d..0f6bbf4 100644
--- a/src/amdgpu_drv.h
+++ b/src/amdgpu_drv.h
@@ -227,9 +227,7 @@ typedef struct {
 	DisplayModePtr currentMode;
 
 	CreateScreenResourcesProcPtr CreateScreenResources;
-#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) >= 10
 	CreateWindowProcPtr CreateWindow;
-#endif
 
 	Bool IsSecondary;
 
diff --git a/src/amdgpu_kms.c b/src/amdgpu_kms.c
index 6fa63e9..acf3a7d 100644
--- a/src/amdgpu_kms.c
+++ b/src/amdgpu_kms.c
@@ -1245,8 +1245,6 @@ static void AMDGPUSetupCapabilities(ScrnInfoPtr pScrn)
 #endif
 }
 
-#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) >= 10
-
 /* When the root window is created, initialize the screen contents from
  * console if -background none was specified on the command line
  */
@@ -1271,8 +1269,6 @@ static Bool AMDGPUCreateWindow_oneshot(WindowPtr pWin)
 	return ret;
 }
 
-#endif
-
 Bool AMDGPUPreInit_KMS(ScrnInfoPtr pScrn, int flags)
 {
 	AMDGPUInfoPtr info;
@@ -1820,12 +1816,10 @@ Bool AMDGPUScreenInit_KMS(SCREEN_INIT_ARGS_DECL)
 	}
 	pScrn->pScreen = pScreen;
 
-#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) >= 10
 	if (serverGeneration == 1 && bgNoneRoot && info->use_glamor) {
 		info->CreateWindow = pScreen->CreateWindow;
 		pScreen->CreateWindow = AMDGPUCreateWindow_oneshot;
 	}
-#endif
 
 	/* Provide SaveScreen & wrap BlockHandler and CloseScreen */
 	/* Wrap CloseScreen */
diff --git a/src/amdgpu_probe.c b/src/amdgpu_probe.c
index 213d245..52e962d 100644
--- a/src/amdgpu_probe.c
+++ b/src/amdgpu_probe.c
@@ -84,13 +84,8 @@ static char *amdgpu_bus_id(ScrnInfoPtr pScrn, struct pci_device *dev)
 {
 	char *busid;
 
-#if XORG_VERSION_CURRENT >= XORG_VERSION_NUMERIC(1,9,99,901,0)
 	XNFasprintf(&busid, "pci:%04x:%02x:%02x.%d",
 		    dev->domain, dev->bus, dev->dev, dev->func);
-#else
-	busid = XNFprintf("pci:%04x:%02x:%02x.%d",
-			  dev->domain, dev->bus, dev->dev, dev->func);
-#endif
 
 	if (!busid)
 		xf86DrvMsgVerb(pScrn->scrnIndex, X_ERROR, 0,
diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index b03a8a7..f514866 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -327,8 +327,6 @@ drmmode_crtc_dpms(xf86CrtcPtr crtc, int mode)
 					    crtc->x, crtc->y);
 }
 
-#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) >= 10
-
 static PixmapPtr
 create_pixmap_for_fbcon(drmmode_ptr drmmode,
 			ScrnInfoPtr pScrn, int fbcon_id)
@@ -442,8 +440,6 @@ void drmmode_copy_fb(ScrnInfoPtr pScrn, drmmode_ptr drmmode)
 	return;
 }
 
-#endif /* GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) >= 10 */
-
 static void
 drmmode_crtc_scanout_destroy(drmmode_ptr drmmode,
 			     struct drmmode_scanout *scanout)
@@ -1981,9 +1977,6 @@ static Bool drmmode_xf86crtc_resize(ScrnInfoPtr scrn, int width, int height)
 					   width, height, -1, -1, pitch,
 					   info->fb_shadow);
 	}
-#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(1,9,99,1,0)
-	scrn->pixmapPrivate.ptr = ppix->devPrivate.ptr;
-#endif
 
 	if (!amdgpu_glamor_create_screen_resources(scrn->pScreen))
 		goto fail;
diff --git a/src/drmmode_display.h b/src/drmmode_display.h
index 4973bc2..2c4a869 100644
--- a/src/drmmode_display.h
+++ b/src/drmmode_display.h
@@ -138,9 +138,7 @@ extern void drmmode_set_cursor(ScrnInfoPtr scrn, drmmode_ptr drmmode, int id,
 void drmmode_adjust_frame(ScrnInfoPtr pScrn, drmmode_ptr drmmode, int x, int y);
 extern Bool drmmode_set_desired_modes(ScrnInfoPtr pScrn, drmmode_ptr drmmode,
 				      Bool set_hw);
-#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) >= 10
 extern void drmmode_copy_fb(ScrnInfoPtr pScrn, drmmode_ptr drmmode);
-#endif
 extern Bool drmmode_setup_colormap(ScreenPtr pScreen, ScrnInfoPtr pScrn);
 
 extern void drmmode_scanout_free(ScrnInfoPtr scrn);

commit dd4a740714e481b09312a04883aa6e0f5200ca81
Author: Michel Dänzer <michel.daenzer@amd.com>
Date:   Thu Oct 27 11:22:36 2016 +0900

    present: Check tiling info for flips
    
    The kernel driver doesn't handle flipping between buffers with
    different tiling parameters correctly.
    
    Fixes display corruption with fullscreen apps using different tiling
    modes (e.g. due to R600_DEBUG=notiling or R600_DEBUG=no2d) via DRI3.
    
    Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

diff --git a/src/amdgpu_present.c b/src/amdgpu_present.c
index e36778c..dcb18da 100644
--- a/src/amdgpu_present.c
+++ b/src/amdgpu_present.c
@@ -262,6 +262,13 @@ amdgpu_present_check_flip(RRCrtcPtr crtc, WindowPtr window, PixmapPtr pixmap,
 	if (info->drmmode.dri2_flipping)
 		return FALSE;
 
+	/* The kernel driver doesn't handle flipping between BOs with different
+	 * tiling parameters correctly yet
+	 */
+	if (amdgpu_pixmap_get_tiling_info(pixmap) !=
+	    amdgpu_pixmap_get_tiling_info(screen->GetScreenPixmap(screen)))
+		return FALSE;
+
 	return amdgpu_present_check_unflip(scrn);
 }
 

commit 3c1f4386ba7d0b6c16bdd2b2178f978f2f154ba8
Author: Michel Dänzer <michel.daenzer@amd.com>
Date:   Wed Oct 26 16:19:01 2016 +0900

    Consume all available udev events at once
    
    We get multiple udev events for actions like docking a laptop into its
    station or plugging a monitor to the station. By consuming as many
    events as we can, we reduce the number of output re-evalutions.
    
    It depends on the timing how many events can be consumed at once.
    
    (Inspired by xserver commit 363f4273dd4aec3e26cc57ecb6c20f27e6c813d8)
    (Ported from radeon commit 22b5ce9548393ba2ff73ee234ecd82eeaf0ef6c4)
    Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 9dfef40..b03a8a7 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -2479,12 +2479,15 @@ static void drmmode_handle_uevents(int fd, void *closure)
 	drmmode_ptr drmmode = closure;
 	ScrnInfoPtr scrn = drmmode->scrn;
 	struct udev_device *dev;
-	dev = udev_monitor_receive_device(drmmode->uevent_monitor);
-	if (!dev)
-		return;
+	Bool received = FALSE;
+
+	while ((dev = udev_monitor_receive_device(drmmode->uevent_monitor))) {
+		udev_device_unref(dev);
+		received = TRUE;
+	}
 
-	amdgpu_mode_hotplug(scrn, drmmode);
-	udev_device_unref(dev);
+	if (received)
+		amdgpu_mode_hotplug(scrn, drmmode);
 }
 #endif
 

commit c87dff3257e797cfd80d208c9a612b21978ff4eb
Author: Hans de Goede <hdegoede@redhat.com>
Date:   Wed Oct 26 16:17:04 2016 +0900

    PRIME: Fix swapping of provider sink / source capabilities
    
    When a card has import capability it can be an offload _sink_, not a
    source and vice versa for export capability.
    
    This went unnoticed sofar because most gpus have both import and export
    capability.
    
    Signed-off-by: Hans de Goede <hdegoede@redhat.com>
    (Ported from xserver commit 94a1c77259ce39ba59ad87615df39b570ffab435)
    (Ported from radeon commit 82d3c8f5500d2a6fb1495e217a0b79c396f1534c)
    Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

diff --git a/src/amdgpu_kms.c b/src/amdgpu_kms.c
index 4ae7995..6fa63e9 100644
--- a/src/amdgpu_kms.c
+++ b/src/amdgpu_kms.c
@@ -1235,9 +1235,9 @@ static void AMDGPUSetupCapabilities(ScrnInfoPtr pScrn)
 	ret = drmGetCap(pAMDGPUEnt->fd, DRM_CAP_PRIME, &value);
 	if (ret == 0) {
 		if (value & DRM_PRIME_CAP_EXPORT)
-			pScrn->capabilities |= RR_Capability_SourceOutput | RR_Capability_SinkOffload;
+			pScrn->capabilities |= RR_Capability_SourceOutput | RR_Capability_SourceOffload;
 		if (value & DRM_PRIME_CAP_IMPORT) {
-			pScrn->capabilities |= RR_Capability_SourceOffload;
+			pScrn->capabilities |= RR_Capability_SinkOffload;
 			if (info->drmmode.count_crtcs)
 				pScrn->capabilities |= RR_Capability_SinkOutput;
 		}

commit 9c4416422f2d07dbfa7c0b18beb1353f122fc1a1
Author: Michel Dänzer <michel.daenzer@amd.com>
Date:   Wed Oct 26 16:15:42 2016 +0900

    Always call PixmapStopDirtyTracking in drmmode_set_scanout_pixmap
    
    Otherwise, we may leak screen->pixmap_dirty_list entries if
    drmmode_set_scanout_pixmap is called repatedly with ppix != NULL, which
    can happen from RRReplaceScanoutPixmap.
    
    (Inspired by xserver commit b773a9c8126222e5fed2904d012fbf917a9f22fd)
    (Ported from radeon commit 6c940446ddadf418ee4959e46fa552b6c1cf6704)
    Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 5f0fdb0..9dfef40 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -1103,23 +1103,21 @@ static Bool drmmode_set_scanout_pixmap(xf86CrtcPtr crtc, PixmapPtr ppix)
 {
 	drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
 	AMDGPUInfoPtr info = AMDGPUPTR(crtc->scrn);
+	ScreenPtr screen = crtc->scrn->pScreen;
+	PixmapDirtyUpdatePtr dirty;
 
-	if (!ppix) {
-		ScreenPtr screen = crtc->scrn->pScreen;
-		PixmapDirtyUpdatePtr dirty;
-
-		xorg_list_for_each_entry(dirty, &screen->pixmap_dirty_list, ent) {
-			if (dirty->slave_dst !=
-			    drmmode_crtc->scanout[drmmode_crtc->scanout_id].pixmap)
-				continue;
+	xorg_list_for_each_entry(dirty, &screen->pixmap_dirty_list, ent) {
+		if (dirty->slave_dst !=
+		    drmmode_crtc->scanout[drmmode_crtc->scanout_id].pixmap)
+			continue;
 
-			PixmapStopDirtyTracking(dirty->src, dirty->slave_dst);
-			drmmode_crtc_scanout_free(drmmode_crtc);
-			break;
-		}
+		PixmapStopDirtyTracking(dirty->src, dirty->slave_dst);
+		drmmode_crtc_scanout_free(drmmode_crtc);
+		break;
+	}
 
+	if (!ppix)
 		return TRUE;
-	}
 
 	if (!drmmode_crtc_scanout_create(crtc, &drmmode_crtc->scanout[0],
 					 ppix->drawable.width,

commit 0a91f11c03400e3f92a2b048505f39e7de7e87fc
Author: Michel Dänzer <michel.daenzer@amd.com>
Date:   Wed Oct 26 16:14:45 2016 +0900

    Don't rely on randr_crtc->scanout_pixmap in drmmode_set_scanout_pixmap
    
    RRReplaceScanoutPixmap may set randr_crtc->scanout_pixmap = NULL before
    we get here.
    
    (Inspired by xserver commit f4c37eeee7953df1fe0e3196eda452acf0078e61)
    v2: Always return TRUE in the if (!ppix) block.
    (Cherry picked from radeon commit 61df12e2377cbb19a19ca9d5624df8959822da9f)
    Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index f291f6d..5f0fdb0 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -1105,10 +1105,19 @@ static Bool drmmode_set_scanout_pixmap(xf86CrtcPtr crtc, PixmapPtr ppix)
 	AMDGPUInfoPtr info = AMDGPUPTR(crtc->scrn);
 
 	if (!ppix) {
-		if (crtc->randr_crtc->scanout_pixmap)
-			PixmapStopDirtyTracking(crtc->randr_crtc->scanout_pixmap,
-						drmmode_crtc->scanout[drmmode_crtc->scanout_id].pixmap);
-		drmmode_crtc_scanout_free(drmmode_crtc);
+		ScreenPtr screen = crtc->scrn->pScreen;
+		PixmapDirtyUpdatePtr dirty;
+
+		xorg_list_for_each_entry(dirty, &screen->pixmap_dirty_list, ent) {
+			if (dirty->slave_dst !=
+			    drmmode_crtc->scanout[drmmode_crtc->scanout_id].pixmap)
+				continue;
+
+			PixmapStopDirtyTracking(dirty->src, dirty->slave_dst);
+			drmmode_crtc_scanout_free(drmmode_crtc);
+			break;
+		}
+
 		return TRUE;
 	}
 

commit b37f4774880bfd0cbe50273ac0d9c539d81995f9
Author: Michel Dänzer <michel.daenzer@amd.com>
Date:   Tue Oct 25 16:30:46 2016 +0900

    Sayōnara, AM_MAINTAINER_MODE!
    
    If --enable-maintainer-mode got lost from config.status for any reason,
    builds would fail in mysterious ways after changing between different
    Git commits.
    
    There are more reasons for dropping it in the automake manual:
    
    https://www.gnu.org/software/automake/manual/html_node/maintainer_002dmode.html
    
    I'm not aware of any reason why --disable-maintainer-mode would ever be
    useful with this project.
    
    Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
    (Cherry picked from radeon commit 49cf3b5032a7ce40afe514b7092440e3e19e05aa)

diff --git a/autogen.sh b/autogen.sh
index b47abdc..fc34bd5 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -10,5 +10,5 @@ autoreconf -v --install || exit 1
 cd $ORIGDIR || exit $?
 
 if test -z "$NOCONFIGURE"; then
-    $srcdir/configure --enable-maintainer-mode "$@"
+    $srcdir/configure "$@"
 fi
diff --git a/configure.ac b/configure.ac
index c3af085..b436db5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -36,8 +36,6 @@ AC_CONFIG_AUX_DIR(.)
 AM_INIT_AUTOMAKE([foreign dist-bzip2])
 AC_SYS_LARGEFILE
 
-AM_MAINTAINER_MODE
-
 # Require X.Org macros 1.8 or later for MAN_SUBSTS set by XORG_MANPAGE_SECTIONS
 m4_ifndef([XORG_MACROS_VERSION],
           [m4_fatal([must install xorg-macros 1.8 or later before running autoconf/autogen])])

commit c8d9ad0e188d3da3a35006a00536d61e23305830
Author: Michel Dänzer <michel.daenzer@amd.com>
Date:   Wed Oct 19 18:16:47 2016 +0900

    Order unique chipsets according to first appearance in ati_pciids.csv
    
    Instead of lexically. This makes it more likely for similar generations
    to be close to each other in the list of unique chipsets.
    
    (Ported from radeon commit 1ce1b1656acc6211deb2091ff7f28d51b6daf86b,
     plus change $numunique++ => ++$numunique to fix OLAND getting listed
     twice)
    
    Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

diff --git a/src/amdgpu_chipset_gen.h b/src/amdgpu_chipset_gen.h
index 3bfab87..1598941 100644
--- a/src/amdgpu_chipset_gen.h
+++ b/src/amdgpu_chipset_gen.h
@@ -195,22 +195,22 @@ SymTabRec AMDGPUChipsets[] = {
 };
 
 SymTabRec AMDGPUUniqueChipsets[] = {
-  { 0, "BONAIRE" },
-  { 0, "CARRIZO" },
-  { 0, "FIJI" },
+  { 0, "OLAND" },
   { 0, "HAINAN" },
-  { 0, "HAWAII" },
+  { 0, "TAHITI" },
+  { 0, "PITCAIRN" },
+  { 0, "VERDE" },
+  { 0, "BONAIRE" },
   { 0, "KABINI" },
-  { 0, "KAVERI" },
   { 0, "MULLINS" },
-  { 0, "OLAND" },
-  { 0, "PITCAIRN" },
-  { 0, "POLARIS10" },
-  { 0, "POLARIS11" },
-  { 0, "STONEY" },
-  { 0, "TAHITI" },
-  { 0, "TONGA" },
+  { 0, "KAVERI" },
+  { 0, "HAWAII" },
   { 0, "TOPAZ" },
-  { 0, "VERDE" },
+  { 0, "TONGA" },
+  { 0, "CARRIZO" },
+  { 0, "FIJI" },
+  { 0, "STONEY" },
+  { 0, "POLARIS11" },
+  { 0, "POLARIS10" },
   { -1,                 NULL }
 };
diff --git a/src/pcidb/parse_pci_ids.pl b/src/pcidb/parse_pci_ids.pl
index 9b6c6f2..1234d79 100755
--- a/src/pcidb/parse_pci_ids.pl
+++ b/src/pcidb/parse_pci_ids.pl
@@ -17,6 +17,8 @@ my $amdgpuchipsetfile = 'amdgpu_chipset_gen.h';
 my $amdgpuchipinfofile  = 'amdgpu_chipinfo_gen.h';
 
 my %uniquechipsets;
+my @uniquearray;
+my $numunique = 0;
 
 my $csv = Text::CSV_XS->new();
 
@@ -50,7 +52,10 @@ while (<CSV>) {
 	print PCIDEVICEMATCH " ATI_DEVICE_MATCH( PCI_CHIP_$columns[1], 0 ),\n";
 
 	print AMDGPUCHIPSET "  { PCI_CHIP_$columns[1], \"$columns[3]\" },\n";
-	$uniquechipsets{$columns[3]} = 1;
+	if (!$uniquechipsets{$columns[3]}) {
+	    $uniquearray[$numunique] = $columns[3];
+	    $uniquechipsets{$columns[3]} = ++$numunique;
+	}
 
 	print AMDGPUCHIPINFO " { $columns[0], CHIP_FAMILY_$columns[2] },\n";
       }
@@ -63,7 +68,7 @@ while (<CSV>) {
 
 print AMDGPUCHIPINFO "};\n";
 print AMDGPUCHIPSET "  { -1,                 NULL }\n};\n\nSymTabRec AMDGPUUniqueChipsets[] = {\n";
-foreach (sort keys %uniquechipsets) {
+foreach (@uniquearray) {
 	print AMDGPUCHIPSET "  { 0, \"$_\" },\n";
 }
 print AMDGPUCHIPSET "  { -1,                 NULL }\n};\n";

commit 7cc04035c55788261cda89a915c433c2add6cad9
Author: Michel Dänzer <michel.daenzer@amd.com>
Date:   Wed Sep 28 15:59:22 2016 +0900

    Enable HW cursor support with PRIME slave output & Xorg > 1.18.99.901
    
    Supported since Xorg 1.18.99.2, but buggy until 1.18.99.901.
    
    Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index fb41975..f291f6d 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -611,8 +611,9 @@ drmmode_can_use_hw_cursor(xf86CrtcPtr crtc)
 		return FALSE;
 #endif
 
-#ifdef AMDGPU_PIXMAP_SHARING
-	/* HW cursor not supported yet with RandR 1.4 multihead */
+#if defined(AMDGPU_PIXMAP_SHARING) && \
+	XORG_VERSION_CURRENT <= XORG_VERSION_NUMERIC(1,18,99,901,0)
+	/* HW cursor not supported with RandR 1.4 multihead */
 	if (!xorg_list_is_empty(&crtc->scrn->pScreen->pixmap_dirty_list))
 		return FALSE;
 #endif

commit d42773eb45baff5933730e26878a0b45fcf07b65
Author: Michel Dänzer <michel.daenzer@amd.com>
Date:   Wed Sep 28 18:17:53 2016 +0900

    Rotate and reflect cursor hotspot position for drmModeSetCursor2
    
    We were always passing the hotspot position in the X screen coordinate
    space, but drmModeSetCursor2 needs it in the CRTC coordinate space. The
    wrong hotspot position would cause the kernel driver to adjust the
    HW cursor position incorrectly when the hotspot position changed.
    
    Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 31aa1db..fb41975 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -1008,13 +1008,43 @@ static void drmmode_show_cursor(xf86CrtcPtr crtc)
 	if (use_set_cursor2) {
 		xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(crtc->scrn);
 		CursorPtr cursor = xf86_config->cursor;
+		int xhot = cursor->bits->xhot;
+		int yhot = cursor->bits->yhot;
 		int ret;
 
+		if (crtc->rotation != RR_Rotate_0 &&
+		    crtc->rotation != (RR_Rotate_180 | RR_Reflect_X |
+				       RR_Reflect_Y)) {
+			int t;
+
+			/* Reflect & rotate hotspot position */
+			if (crtc->rotation & RR_Reflect_X)
+				xhot = info->cursor_w - xhot - 1;
+			if (crtc->rotation & RR_Reflect_Y)
+				yhot = info->cursor_h - yhot - 1;
+
+			switch (crtc->rotation & 0xf) {
+			case RR_Rotate_90:
+				t = xhot;
+				xhot = yhot;
+				yhot = info->cursor_w - t - 1;
+				break;
+			case RR_Rotate_180:
+				xhot = info->cursor_w - xhot - 1;
+				yhot = info->cursor_h - yhot - 1;
+				break;
+			case RR_Rotate_270:
+				t = xhot;
+				xhot = info->cursor_h - yhot - 1;
+				yhot = t;
+			}
+		}
+
 		ret = drmModeSetCursor2(pAMDGPUEnt->fd,
 					drmmode_crtc->mode_crtc->crtc_id,
 					bo_handle,
 					info->cursor_w, info->cursor_h,
-					cursor->bits->xhot, cursor->bits->yhot);
+					xhot, yhot);
 		if (ret == -EINVAL)
 			use_set_cursor2 = FALSE;
 		else

commit bdee9f4dd4f21015e7696e06c4b485ab2b3a16dc
Author: Michel Dänzer <michel.daenzer@amd.com>
Date:   Wed Aug 31 16:46:56 2016 +0900

    Add support for ScreenPtr::SyncSharedPixmap
    
    This allows deferring shared pixmap updates between different drivers.
    
    (Ported from radeon commit 53be26b00e83f871f0afd39caa5a7a1d6ec4aea1)
    Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

diff --git a/src/amdgpu_kms.c b/src/amdgpu_kms.c
index a159c84..4ae7995 100644
--- a/src/amdgpu_kms.c
+++ b/src/amdgpu_kms.c
@@ -491,6 +491,35 @@ amdgpu_sync_shared_pixmap(PixmapDirtyUpdatePtr dirty)
 	}
 }
 
+
+#if HAS_SYNC_SHARED_PIXMAP
+
+static Bool
+master_has_sync_shared_pixmap(ScrnInfoPtr scrn, PixmapDirtyUpdatePtr dirty)
+{
+	ScreenPtr master_screen = dirty->src->master_pixmap->drawable.pScreen;
+
+	return master_screen->SyncSharedPixmap != NULL;
+}
+
+static Bool
+slave_has_sync_shared_pixmap(ScrnInfoPtr scrn, PixmapDirtyUpdatePtr dirty)
+{
+	ScreenPtr slave_screen = dirty->slave_dst->drawable.pScreen;
+
+	return slave_screen->SyncSharedPixmap != NULL;
+}
+
+static void
+call_sync_shared_pixmap(PixmapDirtyUpdatePtr dirty)
+{
+	ScreenPtr master_screen = dirty->src->master_pixmap->drawable.pScreen;
+
+	master_screen->SyncSharedPixmap(dirty);
+}
+
+#else /* !HAS_SYNC_SHARED_PIXMAP */
+
 static Bool
 master_has_sync_shared_pixmap(ScrnInfoPtr scrn, PixmapDirtyUpdatePtr dirty)
 {
@@ -507,6 +536,15 @@ slave_has_sync_shared_pixmap(ScrnInfoPtr scrn, PixmapDirtyUpdatePtr dirty)
 	return slave_scrn->driverName == scrn->driverName;
 }
 
+static void
+call_sync_shared_pixmap(PixmapDirtyUpdatePtr dirty)
+{
+	amdgpu_sync_shared_pixmap(dirty);
+}
+
+#endif /* HAS_SYNC_SHARED_PIXMAPS */
+
+
 static Bool
 amdgpu_prime_scanout_do_update(xf86CrtcPtr crtc, unsigned scanout_id)
 {
@@ -524,7 +562,7 @@ amdgpu_prime_scanout_do_update(xf86CrtcPtr crtc, unsigned scanout_id)
 			RegionPtr region;
 
 			if (master_has_sync_shared_pixmap(scrn, dirty))
-				amdgpu_sync_shared_pixmap(dirty);
+				call_sync_shared_pixmap(dirty);
 
 			region = dirty_region(dirty);
 			if (RegionNil(region))
@@ -1803,6 +1841,9 @@ Bool AMDGPUScreenInit_KMS(SCREEN_INIT_ARGS_DECL)
 #ifdef AMDGPU_PIXMAP_SHARING
 	pScreen->StartPixmapTracking = PixmapStartDirtyTracking;
 	pScreen->StopPixmapTracking = PixmapStopDirtyTracking;
+#if HAS_SYNC_SHARED_PIXMAP
+	pScreen->SyncSharedPixmap = amdgpu_sync_shared_pixmap;
+#endif
 #endif
 
 	if (!xf86CrtcScreenInit(pScreen))

commit 97d7386caf7ba53d2cf398b8a9bb65d0a2a4770a
Author: Michel Dänzer <michel.daenzer@amd.com>
Date:   Fri Sep 16 16:36:23 2016 +0900

    Untangle HAS_XORG_CONF_DIR / --with-xorg-conf-dir lines in configure.ac
    
    $sysconfigdir used to be part of the default --with-xorg-conf-dir value,
    but it no longer is.
    
    Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

diff --git a/configure.ac b/configure.ac
index 68e1feb..c3af085 100644
--- a/configure.ac
+++ b/configure.ac
@@ -82,18 +82,19 @@ PKG_CHECK_MODULES(XEXT, [xextproto >= 7.0.99.1],
                   HAVE_XEXTPROTO_71="no")
 AM_CONDITIONAL(HAVE_XEXTPROTO_71, [ test "$HAVE_XEXTPROTO_71" = "yes" ])
 
-# Define a configure option for an alternate X Server configuration directory
 # 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)
-AM_CONDITIONAL(HAS_XORG_CONF_DIR, [test "x$sysconfigdir" != "x"])
 
 AC_ARG_ENABLE([udev],
 		AS_HELP_STRING([--disable-udev], [Disable libudev support [default=auto]]),

commit aa8a3fa2468094cd37959179e8417ba7ba0a326c
Author: Michel Dänzer <michel.daenzer@amd.com>
Date:   Fri Sep 16 15:59:16 2016 +0900

    Fix handling of configure option --with-xorg-conf-dir
    


Reply to: