xf86-video-amdgpu: Branch 'master' - 10 commits

Michel Dänzer daenzer at kemper.freedesktop.org
Thu Nov 19 00:21:39 PST 2015


 configure.ac          |    3 ---
 man/amdgpu.man        |    7 +++----
 src/Makefile.am       |    3 ++-
 src/amdgpu_dri2.c     |    9 ++++++++-
 src/amdgpu_drv.h      |    2 +-
 src/amdgpu_kms.c      |   38 +++++++++++++++++++++++++-------------
 src/drmmode_display.c |   34 +++++++++++++++++++++++++++-------
 7 files changed, 66 insertions(+), 30 deletions(-)

New commits:
commit 49c7d2be99aaf6d040e553065bdc461ce8d4769a
Author: Michel Dänzer <michel.daenzer at amd.com>
Date:   Thu Nov 19 17:14:54 2015 +0900

    Add amdgpu_pixmap.h to src/Makefile.am's EXTRA_DIST
    
    Fixes make distcheck.

diff --git a/src/Makefile.am b/src/Makefile.am
index 4efef9e..a851b3b 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -63,6 +63,7 @@ EXTRA_DIST = \
 	amdgpu_glamor.h \
 	amdgpu_drv.h \
 	amdgpu_list.h \
+	amdgpu_pixmap.h \
 	amdgpu_probe.h \
 	amdgpu_version.h \
 	amdgpu_video.h \
commit d069ec5d27f5c8d2ab17b759b85293ef4113acf3
Author: Stephen Chandler Paul <cpaul at redhat.com>
Date:   Wed Nov 11 18:10:55 2015 +0900

    Handle failures in setting a CRTC to a DRM mode properly
    
    This fixes a bug where running the card out of PPLL's when hotplugging
    another monitor would result in all of the displays going blank and
    failing to work properly until X was restarted or the user switched to
    another VT.
    
    [Michel Dänzer: Pass errno instead of -ret to strerror()]
    
    Signed-off-by: Stephen Chandler Paul <cpaul at redhat.com>
    (ported from radeon commit 7186a8713ba004de4991f21c1a9fc4abc62aeff4)
    
    Reviewed-by: Alex Deucher <alexander.deucher at amd.com>

diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 66528f0..2761513 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -699,14 +699,15 @@ drmmode_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode,
 				amdgpu_glamor_finish(pScrn);
 			}
 		}
-		ret =
-		    drmModeSetCrtc(pAMDGPUEnt->fd,
-				   drmmode_crtc->mode_crtc->crtc_id, fb_id, x,
-				   y, output_ids, output_count, &kmode);
-		if (ret)
+		if (drmModeSetCrtc(pAMDGPUEnt->fd,
+				   drmmode_crtc->mode_crtc->crtc_id,
+				   fb_id, x, y, output_ids,
+				   output_count, &kmode) != 0) {
 			xf86DrvMsg(crtc->scrn->scrnIndex, X_ERROR,
-				   "failed to set mode: %s", strerror(-ret));
-		else
+				   "failed to set mode: %s\n", strerror(errno));
+			ret = FALSE;
+			goto done;
+		} else
 			ret = TRUE;
 
 		if (crtc->scrn->pScreen)
commit c8bddcf6c97b1338be3715f1fc5e0b17ce71c195
Author: Michel Dänzer <michel.daenzer at amd.com>
Date:   Wed Nov 11 18:09:59 2015 +0900

    Call xf86CrtcRotate from initial drmmode_set_desired_modes call
    
    Fixes various problems when rotation is specified in xorg.conf.
    
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92475
    
    (ported from radeon commit 548e97b3b7d1e94075a54ca2bb4eb683025098a7)
    
    Reviewed-by: Alex Deucher <alexander.deucher at amd.com>

diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 4d5a3a3..66528f0 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -2071,6 +2071,8 @@ Bool drmmode_set_desired_modes(ScrnInfoPtr pScrn, drmmode_ptr drmmode,
 			crtc->rotation = crtc->desiredRotation;
 			crtc->x = crtc->desiredX;
 			crtc->y = crtc->desiredY;
+			if (!xf86CrtcRotate(crtc))
+				return FALSE;
 		}
 	}
 	return TRUE;
commit 12815156f38ce3357f03901a78402db834577d11
Author: Emil Velikov <emil.l.velikov at gmail.com>
Date:   Wed Nov 11 18:04:01 2015 +0900

    Do not link amdgpu_drv.so against libpciaccess
    
    Not used directly.
    
    Signed-off-by: Emil Velikov <emil.l.velikov at gmail.com>
    (ported from radeon commit fcb32231a38f9461d12720cbf72f63502197a711)
    
    Reviewed-by: Alex Deucher <alexander.deucher at amd.com>

diff --git a/configure.ac b/configure.ac
index e350ef6..9765d0b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -186,9 +186,6 @@ AC_CHECK_HEADERS([dri3.h], [], [],
 
 CPPFLAGS="$SAVE_CPPFLAGS"
 
-PKG_CHECK_MODULES([PCIACCESS], [pciaccess >= 0.8.0])
-XORG_CFLAGS="$XORG_CFLAGS $PCIACCESS_CFLAGS"
-
 # Checks for headers/macros for byte swapping
 # Known variants:
 #	<byteswap.h> bswap_16, bswap_32, bswap_64  (glibc)
diff --git a/src/Makefile.am b/src/Makefile.am
index 6c8d1de..4efef9e 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -26,7 +26,7 @@
 # _ladir passes a dummy rpath to libtool so the thing will actually link
 # TODO: -nostdlib/-Bstatic/-lgcc platform magic, not installing the .a, etc.
 
-amdgpu_drv_la_LIBADD = $(PCIACCESS_LIBS) $(LIBDRM_AMDGPU_LIBS) $(GBM_LIBS)
+amdgpu_drv_la_LIBADD = $(LIBDRM_AMDGPU_LIBS) $(GBM_LIBS)
 
 AMDGPU_KMS_SRCS=amdgpu_bo_helper.c amdgpu_dri2.c amdgpu_dri3.c amdgpu_drm_queue.c \
 	amdgpu_kms.c amdgpu_present.c amdgpu_sync.c drmmode_display.c
commit a02982b0ae0b79d2f183a1628edc05cafed8703a
Author: Michel Dänzer <michel.daenzer at amd.com>
Date:   Wed Nov 11 17:59:14 2015 +0900

    Skip disabled CRTCs in amdgpu_scanout_(do_)update
    
    The vblank / page flip ioctls don't work as expected for a disabled CRTC.
    
    (ported from radeon commit acc11877423ecd81a6e0a7f38466f80e43efee20)
    
    Reviewed-by: Alex Deucher <alexander.deucher at amd.com>

diff --git a/src/amdgpu_kms.c b/src/amdgpu_kms.c
index 2efdbf5..3993591 100644
--- a/src/amdgpu_kms.c
+++ b/src/amdgpu_kms.c
@@ -257,7 +257,8 @@ amdgpu_scanout_do_update(xf86CrtcPtr xf86_crtc, int scanout_id)
 	GCPtr gc;
 	BoxRec extents;
 
-	if (drmmode_crtc->dpms_mode != DPMSModeOn ||
+	if (!xf86_crtc->enabled ||
+	    drmmode_crtc->dpms_mode != DPMSModeOn ||
 	    !drmmode_crtc->scanout[scanout_id].pixmap)
 		return FALSE;
 
@@ -323,7 +324,8 @@ amdgpu_scanout_update(xf86CrtcPtr xf86_crtc)
 	DrawablePtr pDraw;
 	BoxRec extents;
 
-	if (drmmode_crtc->scanout_update_pending ||
+	if (!xf86_crtc->enabled ||
+	    drmmode_crtc->scanout_update_pending ||
 	    !drmmode_crtc->scanout[0].pixmap ||
 	    drmmode_crtc->dpms_mode != DPMSModeOn)
 		return;
commit 0ddd20600d0046afd17aa47ffebe86dfd91a2215
Author: Michel Dänzer <michel.daenzer at amd.com>
Date:   Wed Nov 11 17:44:16 2015 +0900

    Prefer drmModeSetCursor2 over drmModeSetCursor
    
    The former includes information about the position of the hotspot within
    the cursor image.
    
    Copied from xf86-video-modesetting.
    
    (ported from radeon commit c9f8f642fd495937400618a4fc25ecae3f8888fc)
    
    Reviewed-by: Alex Deucher <alexander.deucher at amd.com>

diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 9632180..4d5a3a3 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -801,12 +801,29 @@ static void drmmode_show_cursor(xf86CrtcPtr crtc)
 	AMDGPUEntPtr pAMDGPUEnt = AMDGPUEntPriv(pScrn);
 	drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
 	uint32_t bo_handle;
+	static Bool use_set_cursor2 = TRUE;
 
 	if (!amdgpu_bo_get_handle(drmmode_crtc->cursor_buffer, &bo_handle)) {
 		ErrorF("failed to get BO handle for cursor\n");
 		return;
 	}
 
+	if (use_set_cursor2) {
+		xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(crtc->scrn);
+		CursorPtr cursor = xf86_config->cursor;
+		int ret;
+
+		ret = drmModeSetCursor2(pAMDGPUEnt->fd,
+					drmmode_crtc->mode_crtc->crtc_id,
+					bo_handle,
+					info->cursor_w, info->cursor_h,
+					cursor->bits->xhot, cursor->bits->yhot);
+		if (ret == -EINVAL)
+			use_set_cursor2 = FALSE;
+		else
+			return;
+	}
+
 	drmModeSetCursor(pAMDGPUEnt->fd, drmmode_crtc->mode_crtc->crtc_id, bo_handle,
 			 info->cursor_w, info->cursor_h);
 }
commit 83a47c0ebe17caa79d12a8b2f94b59cc945452f5
Author: Michel Dänzer <michel.daenzer at amd.com>
Date:   Wed Nov 11 17:37:54 2015 +0900

    PRIME: Don't advertise offload capabilities when acceleration is disabled
    
    Xorg tends to crash if the user tries to actually use the offload
    capabilities with acceleration disabled.
    
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=57200
    (ported from radeon commit c74de9fec13fac2c836bb2a07ae6f90e1d61e667)
    
    Reviewed-by: Alex Deucher <alexander.deucher at amd.com>

diff --git a/src/amdgpu_kms.c b/src/amdgpu_kms.c
index 084f625..2efdbf5 100644
--- a/src/amdgpu_kms.c
+++ b/src/amdgpu_kms.c
@@ -668,14 +668,18 @@ static void AMDGPUSetupCapabilities(ScrnInfoPtr pScrn)
 	pScrn->capabilities = 0;
 	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;
-		if (value & DRM_PRIME_CAP_IMPORT)
-			pScrn->capabilities |=
-			    RR_Capability_SourceOffload |
-			    RR_Capability_SinkOutput;
+		AMDGPUInfoPtr info = AMDGPUPTR(pScrn);
+
+		if (value & DRM_PRIME_CAP_EXPORT) {
+			pScrn->capabilities |= RR_Capability_SourceOutput;
+			if (info->use_glamor && info->dri2.available)
+				pScrn->capabilities |= RR_Capability_SinkOffload;
+		}
+		if (value & DRM_PRIME_CAP_IMPORT) {
+			pScrn->capabilities |= RR_Capability_SinkOutput;
+			if (info->use_glamor && info->dri2.available)
+				pScrn->capabilities |= RR_Capability_SourceOffload;
+		}
 	}
 #endif
 }
commit 560b7fe6dc66405762020f00e9a05918a36f3a17
Author: Michel Dänzer <michel.daenzer at amd.com>
Date:   Wed Nov 11 17:31:34 2015 +0900

    Rename Option "NoAccel" to "Accel"
    
    Removes the need for a double negation when forcing acceleration on.
    
    Note that this change is backwards compatible, as the option parser
    automagically handles the 'No' prefix.
    
    (ported from radeon commit cc615d06db0332fc6e673b55632bcc7bf957b44b)
    
    Reviewed-by: Alex Deucher <alexander.deucher at amd.com>

diff --git a/man/amdgpu.man b/man/amdgpu.man
index 3373b63..4e95ead 100644
--- a/man/amdgpu.man
+++ b/man/amdgpu.man
@@ -44,12 +44,11 @@ are supported:
 Selects software cursor.  The default is
 .B off.
 .TP
-.BI "Option \*qNoAccel\*q \*q" boolean \*q
+.BI "Option \*qAccel\*q \*q" boolean \*q
 Enables or disables all hardware acceleration.
 .br
-The default is to
-.B enable
-hardware acceleration.
+The default is
+.B on.
 
 .TP
 .BI "Option \*qZaphodHeads\*q \*q" string \*q
diff --git a/src/amdgpu_drv.h b/src/amdgpu_drv.h
index 4797693..9acd202 100644
--- a/src/amdgpu_drv.h
+++ b/src/amdgpu_drv.h
@@ -133,7 +133,7 @@ struct _SyncFence;
 #endif
 
 typedef enum {
-	OPTION_NOACCEL,
+	OPTION_ACCEL,
 	OPTION_SW_CURSOR,
 	OPTION_PAGE_FLIP,
 #ifdef RENDER
diff --git a/src/amdgpu_kms.c b/src/amdgpu_kms.c
index 054d478..084f625 100644
--- a/src/amdgpu_kms.c
+++ b/src/amdgpu_kms.c
@@ -60,7 +60,7 @@ extern SymTabRec AMDGPUChipsets[];
 static Bool amdgpu_setup_kernel_mem(ScreenPtr pScreen);
 
 const OptionInfoRec AMDGPUOptions_KMS[] = {
-	{OPTION_NOACCEL, "NoAccel", OPTV_BOOLEAN, {0}, FALSE},
+	{OPTION_ACCEL, "Accel", OPTV_BOOLEAN, {0}, FALSE},
 	{OPTION_SW_CURSOR, "SWcursor", OPTV_BOOLEAN, {0}, FALSE},
 	{OPTION_PAGE_FLIP, "EnablePageFlip", OPTV_BOOLEAN, {0}, FALSE},
 	{OPTION_SUBPIXEL_ORDER, "SubPixelOrder", OPTV_ANYSTR, {0}, FALSE},
@@ -562,7 +562,7 @@ static Bool AMDGPUPreInitAccel_KMS(ScrnInfoPtr pScrn)
 {
 	AMDGPUInfoPtr info = AMDGPUPTR(pScrn);
 
-	if (!xf86ReturnOptValBool(info->Options, OPTION_NOACCEL, false)) {
+	if (xf86ReturnOptValBool(info->Options, OPTION_ACCEL, TRUE)) {
 		AMDGPUEntPtr pAMDGPUEnt = AMDGPUEntPriv(pScrn);
 		Bool use_glamor = TRUE;
 #ifdef HAVE_GBM_BO_USE_LINEAR
commit ad77ad32c4a723447d3191d527cfa6de9f54d7ce
Author: Adam Jackson <ajax at redhat.com>
Date:   Wed Nov 11 17:20:21 2015 +0900

    Use own thunk function instead of shadowUpdatePackedWeak
    
    I plan to delete the Weak functions from a future server.
    
    Signed-off-by: Adam Jackson <ajax at redhat.com>
    (ported from radeon commit 851b2cf8714618843725f6d067915375485ade9d)
    
    Reviewed-by: Alex Deucher <alexander.deucher at amd.com>

diff --git a/src/amdgpu_kms.c b/src/amdgpu_kms.c
index fd89ba2..054d478 100644
--- a/src/amdgpu_kms.c
+++ b/src/amdgpu_kms.c
@@ -157,6 +157,12 @@ static void *amdgpuShadowWindow(ScreenPtr screen, CARD32 row, CARD32 offset,
 	return ((uint8_t *) info->front_buffer->cpu_ptr + row * stride + offset);
 }
 
+static void
+amdgpuUpdatePacked(ScreenPtr pScreen, shadowBufPtr pBuf)
+{
+	shadowUpdatePacked(pScreen, pBuf);
+}
+
 static Bool AMDGPUCreateScreenResources_KMS(ScreenPtr pScreen)
 {
 	ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
@@ -176,7 +182,7 @@ static Bool AMDGPUCreateScreenResources_KMS(ScreenPtr pScreen)
 	if (info->shadow_fb) {
 		pixmap = pScreen->GetScreenPixmap(pScreen);
 
-		if (!shadowAdd(pScreen, pixmap, shadowUpdatePackedWeak(),
+		if (!shadowAdd(pScreen, pixmap, amdgpuUpdatePacked,
 			       amdgpuShadowWindow, 0, NULL))
 			return FALSE;
 	}
commit f5ccea99c03b62acf3a25984aba617c665d80b7c
Author: Michel Dänzer <michel.daenzer at amd.com>
Date:   Wed Nov 11 17:16:58 2015 +0900

    dri2: Handle PRIME for source buffer as well in amdgpu_dri2_copy_region2
    
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=77810
    
    (ported from radeon commit c84230d686c078aac1dc98d82153f8b02521b2e1)
    
    Reviewed-by: Alex Deucher <alexander.deucher at amd.com>

diff --git a/src/amdgpu_dri2.c b/src/amdgpu_dri2.c
index 0feca59..230e8ba 100644
--- a/src/amdgpu_dri2.c
+++ b/src/amdgpu_dri2.c
@@ -333,7 +333,14 @@ amdgpu_dri2_copy_region2(ScreenPtr pScreen,
 	dst_drawable = &dst_private->pixmap->drawable;
 
 	if (src_private->attachment == DRI2BufferFrontLeft) {
-		src_drawable = drawable;
+#ifdef USE_DRI2_PRIME
+		if (drawable->pScreen != pScreen) {
+			src_drawable = DRI2UpdatePrime(drawable, src_buffer);
+			if (!src_drawable)
+				return;
+		} else
+#endif
+			src_drawable = drawable;
 	}
 	if (dst_private->attachment == DRI2BufferFrontLeft) {
 #ifdef USE_DRI2_PRIME


More information about the xorg-commit mailing list