[PATCH 5/6] modesetting: set capabilities up after glamor and enable offload caps.

Dave Airlie airlied at gmail.com
Fri Apr 29 04:01:33 UTC 2016


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.

Signed-off-by: Dave Airlie <airlied at 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 c3e6aec..13c9a10 100644
--- a/hw/xfree86/drivers/modesetting/driver.c
+++ b/hw/xfree86/drivers/modesetting/driver.c
@@ -809,18 +809,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;
@@ -896,6 +884,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



More information about the xorg-devel mailing list