> From: Dave Airlie <[email protected]> > Date: Wed, 18 Nov 2015 09:51:05 +1000 > > This moves the code from the platform case into > a common function, and calls that from the > other two.
Still works for me. FWIW: Reviewed-by: Mark Kettenis <[email protected]> > Reported-by: Mark Kettenis <[email protected]> > Signed-off-by: Dave Airlie <[email protected]> > --- > hw/xfree86/drivers/modesetting/driver.c | 51 > ++++++++++++++++++--------------- > 1 file changed, 28 insertions(+), 23 deletions(-) > > diff --git a/hw/xfree86/drivers/modesetting/driver.c > b/hw/xfree86/drivers/modesetting/driver.c > index 00f966c..21729df 100644 > --- a/hw/xfree86/drivers/modesetting/driver.c > +++ b/hw/xfree86/drivers/modesetting/driver.c > @@ -330,6 +330,27 @@ ms_setup_scrn_hooks(ScrnInfoPtr scrn) > scrn->ValidMode = ValidMode; > } > > +static void > +ms_setup_entity(ScrnInfoPtr scrn, int entity_num) > +{ > + DevUnion *pPriv; > + EntityInfoPtr pEnt; > + > + pEnt = xf86GetEntityInfo(entity_num); > + xf86SetEntitySharable(entity_num); > + > + if (ms_entity_index == -1) > + ms_entity_index = xf86AllocateEntityPrivateIndex(); > + > + pPriv = xf86GetEntityPrivate(pEnt->index, > + ms_entity_index); > + > + xf86SetEntityInstanceForScreen(scrn, pEnt->index, > xf86GetNumEntityInstances(pEnt->index) - 1); > + > + if (!pPriv->ptr) > + pPriv->ptr = xnfcalloc(sizeof(modesettingEntRec), 1); > +} > + > #if XSERVER_LIBPCIACCESS > static Bool > ms_pci_probe(DriverPtr driver, > @@ -353,6 +374,8 @@ ms_pci_probe(DriverPtr driver, > dev->bus, dev->domain, dev->dev, dev->func); > xf86DrvMsg(scrn->scrnIndex, X_INFO, > "using %s\n", devpath ? devpath : "default device"); > + > + ms_setup_entity(scrn, entity_num); > } > else > scrn = NULL; > @@ -385,25 +408,7 @@ ms_platform_probe(DriverPtr driver, > xf86DrvMsg(scrn->scrnIndex, X_INFO, > "using drv %s\n", path ? path : "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); > - } > - > + ms_setup_entity(scrn, entity_num); > } > > return scrn != NULL; > @@ -432,13 +437,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) { > @@ -448,6 +452,7 @@ Probe(DriverPtr drv, int flags) > > xf86DrvMsg(scrn->scrnIndex, X_INFO, > "using %s\n", dev ? dev : "default device"); > + ms_setup_entity(scrn, entity_num); > } > } > > -- > 2.4.3 > > _______________________________________________ > [email protected]: X.Org development > Archives: http://lists.x.org/archives/xorg-devel > Info: http://lists.x.org/mailman/listinfo/xorg-devel > > _______________________________________________ [email protected]: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
