[PATCH] modesetting: and entity setup to generic probe path.

Dave Airlie airlied at gmail.com
Mon Nov 16 16:23:37 PST 2015


From: Dave Airlie <airlied at redhat.com>

Totally untested, cross fingers hope it works.

Signed-off-by: Dave Airlie <airlied at redhat.com>
---
 hw/xfree86/drivers/modesetting/driver.c | 25 +++++++++++++++++++++----
 1 file changed, 21 insertions(+), 4 deletions(-)

diff --git a/hw/xfree86/drivers/modesetting/driver.c b/hw/xfree86/drivers/modesetting/driver.c
index 2ca65fb..49a2925 100644
--- a/hw/xfree86/drivers/modesetting/driver.c
+++ b/hw/xfree86/drivers/modesetting/driver.c
@@ -454,13 +454,12 @@ 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)) {
-            int entity;
 
-            entity = xf86ClaimFbSlot(drv, 0, devSections[i], TRUE);
-            scrn = xf86ConfigFbEntity(scrn, 0, entity, NULL, NULL, NULL, NULL);
+            entity_num = xf86ClaimFbSlot(drv, 0, devSections[i], TRUE);
+            scrn = xf86ConfigFbEntity(scrn, 0, entity_num, NULL, NULL, NULL, NULL);
         }
 
         if (scrn) {
@@ -470,6 +469,24 @@ Probe(DriverPtr drv, int flags)
 
             xf86DrvMsg(scrn->scrnIndex, X_INFO,
                        "using %s\n", dev ? dev : "default device");
+            {
+                DevUnion *pPriv;
+                EntityInfoPtr pEnt;
+
+                xf86SetEntitySharable(entity_num);
+
+                if (ms_entity_index == -1)
+                    ms_entity_index = xf86AllocateEntityPrivateIndex();
+
+                pEnt = xf86GetEntityInfo(entity_num);
+                pPriv = xf86GetEntityPrivate(pEnt->index,
+                                             ms_entity_index);
+
+                xf86SetEntityInstanceForScreen(scrn, pEnt->index, xf86GetNumEntityInstances(pEnt->index) - 1);
+
+                if (!pPriv->ptr)
+                    pPriv->ptr = xnfcalloc(sizeof(modesettingEntRec), 1);
+            }
         }
     }
 
-- 
2.4.3



More information about the xorg-devel mailing list