xorg-x11-server/0004-modesetting-set-capabilities-up-after-glamor-and-ena.patch
Hans de Goede 136c5ded48 Add switchable-graphics / prime fixes from f24 branch
- Add some more switchable-graphics / prime fixes from upstream
2016-06-17 14:35:59 +02:00

66 lines
2.3 KiB
Diff

From 2378adde6770385c06f7efcd32f270d00d49ce3f Mon Sep 17 00:00:00 2001
From: Dave Airlie <airlied@gmail.com>
Date: Fri, 29 Apr 2016 14:01:33 +1000
Subject: [PATCH 4/4] modesetting: set capabilities up after glamor and enable
offload caps.
This moves the capabilites setting to after glamor is initialised, and
enables the offload caps in cases where they work. This enables DRI2
PRIME support with modesetting.
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
---
hw/xfree86/drivers/modesetting/driver.c | 28 ++++++++++++++++------------
1 file changed, 16 insertions(+), 12 deletions(-)
diff --git a/hw/xfree86/drivers/modesetting/driver.c b/hw/xfree86/drivers/modesetting/driver.c
index abf7e1a..cd59c06 100644
--- a/hw/xfree86/drivers/modesetting/driver.c
+++ b/hw/xfree86/drivers/modesetting/driver.c
@@ -820,18 +820,6 @@ PreInit(ScrnInfoPtr pScrn, int flags)
return FALSE;
ms->drmmode.fd = ms->fd;
- pScrn->capabilities = 0;
-#ifdef DRM_CAP_PRIME
- ret = drmGetCap(ms->fd, DRM_CAP_PRIME, &value);
- if (ret == 0) {
- if (value & DRM_PRIME_CAP_IMPORT)
- pScrn->capabilities |= RR_Capability_SinkOutput;
-#if GLAMOR_HAS_GBM_LINEAR
- if (value & DRM_PRIME_CAP_EXPORT)
- pScrn->capabilities |= RR_Capability_SourceOutput;
-#endif
- }
-#endif
drmmode_get_default_bpp(pScrn, &ms->drmmode, &defaultdepth, &defaultbpp);
if (defaultdepth == 24 && defaultbpp == 24)
bppflags = SupportConvert32to24 | Support24bppFb;
@@ -907,6 +895,22 @@ PreInit(ScrnInfoPtr pScrn, int flags)
ms->drmmode.pageflip = FALSE;
}
+ pScrn->capabilities = 0;
+#ifdef DRM_CAP_PRIME
+ ret = drmGetCap(ms->fd, DRM_CAP_PRIME, &value);
+ if (ret == 0) {
+ if (value & DRM_PRIME_CAP_IMPORT) {
+ pScrn->capabilities |= RR_Capability_SinkOutput;
+ if (ms->drmmode.glamor)
+ pScrn->capabilities |= RR_Capability_SourceOffload;
+ }
+#if GLAMOR_HAS_GBM_LINEAR
+ if (value & DRM_PRIME_CAP_EXPORT && ms->drmmode.glamor)
+ pScrn->capabilities |= RR_Capability_SourceOutput | RR_Capability_SinkOffload;
+#endif
+ }
+#endif
+
if (drmmode_pre_init(pScrn, &ms->drmmode, pScrn->bitsPerPixel / 8) == FALSE) {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "KMS setup failed\n");
goto fail;
--
2.5.5