[PATCH v2 xserver 11/11] modesetting: still create GPUScreen when it's capable of display

Qiang Yu Qiang.Yu at amd.com
Sat Jan 7 08:01:32 UTC 2017


Signed-off-by: Qiang Yu <Qiang.Yu at amd.com>
---
 hw/xfree86/drivers/modesetting/driver.c | 29 ++++++++++++++++++++---------
 1 file changed, 20 insertions(+), 9 deletions(-)

diff --git a/hw/xfree86/drivers/modesetting/driver.c b/hw/xfree86/drivers/modesetting/driver.c
index bce6346..a7b89cc 100644
--- a/hw/xfree86/drivers/modesetting/driver.c
+++ b/hw/xfree86/drivers/modesetting/driver.c
@@ -154,6 +154,8 @@ static XF86ModuleVersionInfo VersRec = {
 
 _X_EXPORT XF86ModuleData modesettingModuleData = { &VersRec, Setup, NULL };
 
+static Bool ms_all_in_one = FALSE;
+
 static void *
 Setup(void *module, void *opts, int *errmaj, int *errmin)
 {
@@ -240,7 +242,7 @@ check_outputs(int fd, int *count)
 }
 
 static Bool
-probe_hw(const char *dev, struct xf86_platform_device *platform_dev)
+probe_hw(const char *dev, struct xf86_platform_device *platform_dev, int *count)
 {
     int fd;
 
@@ -249,13 +251,13 @@ probe_hw(const char *dev, struct xf86_platform_device *platform_dev)
         fd = xf86_platform_device_odev_attributes(platform_dev)->fd;
         if (fd == -1)
             return FALSE;
-        return check_outputs(fd, NULL);
+        return check_outputs(fd, count);
     }
 #endif
 
     fd = open_hw(dev);
     if (fd != -1) {
-        int ret = check_outputs(fd, NULL);
+        int ret = check_outputs(fd, count);
 
         close(fd);
         return ret;
@@ -407,20 +409,31 @@ ms_platform_probe(DriverPtr driver,
 {
     ScrnInfoPtr scrn = NULL;
     const char *path = xf86_platform_device_odev_attributes(dev)->path;
-    int scr_flags = 0;
+    int scr_flags = 0, count = 0;
 
     if (flags & PLATFORM_PROBE_GPU_SCREEN)
         scr_flags = XF86_ALLOCATE_GPU_SCREEN;
 
-    if (probe_hw(path, dev)) {
+    if (probe_hw(path, dev, &count)) {
         static ScrnInfoPtr scrn_all = NULL;
         modesettingEntPtr ms_ent;
 
+        if (xf86IsEntitySharable(entity_num))
+            xf86SetEntityShared(entity_num);
+
         if (getenv("MS_ALL_IN_ONE")) {
+            ms_all_in_one = TRUE;
             if (!scrn_all) {
                 scrn_all = xf86AllocateScreen(driver, 0);
                 ms_setup_scrn_hooks(scrn_all);
             }
+            /* a display capable GPUScreen should be created */
+            if (flags & PLATFORM_PROBE_GPU_SCREEN && count) {
+                scrn = xf86AllocateScreen(driver, scr_flags);
+                ms_setup_scrn_hooks(scrn);
+                xf86AddEntityToScreen(scrn, entity_num);
+                ms_setup_entity(scrn, entity_num);
+            }
             scrn = scrn_all;
         }
         else {
@@ -428,8 +441,6 @@ ms_platform_probe(DriverPtr driver,
             ms_setup_scrn_hooks(scrn);
         }
 
-        if (xf86IsEntitySharable(entity_num))
-            xf86SetEntityShared(entity_num);
         xf86AddEntityToScreen(scrn, entity_num);
 
         xf86DrvMsg(scrn->scrnIndex, X_INFO,
@@ -471,7 +482,7 @@ Probe(DriverPtr drv, int flags)
     for (i = 0; i < numDevSections; i++) {
         int entity_num;
         dev = xf86FindOptionValue(devSections[i]->options, "kmsdev");
-        if (probe_hw(dev, NULL)) {
+        if (probe_hw(dev, NULL, NULL)) {
 
             entity_num = xf86ClaimFbSlot(drv, 0, devSections[i], TRUE);
             scrn = xf86ConfigFbEntity(scrn, 0, entity_num, NULL, NULL, NULL, NULL);
@@ -980,7 +991,7 @@ PreInit(ScrnInfoPtr pScrn, int flags)
 
     if (xf86IsEntityShared(primary_entity)) {
         if (xf86IsPrimInitDone(primary_entity))
-            ms->drmmode.is_secondary = TRUE;
+            ms->drmmode.is_secondary = !ms_all_in_one;
         else
             xf86SetPrimInitDone(primary_entity);
     }
-- 
2.7.4



More information about the xorg-devel mailing list