[PATCH xf86-video-amdgpu 4/9] PRIME: Don't advertise offload capabilities when acceleration is disabled

Michel Dänzer michel at daenzer.net
Wed Nov 11 01:30:50 PST 2015


From: Michel Dänzer <michel.daenzer at amd.com>

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)

Signed-off-by: Michel Dänzer <michel.daenzer at amd.com>
---
 src/amdgpu_kms.c | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

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
 }
-- 
2.6.2



More information about the xorg-driver-ati mailing list