From: Dave Airlie <[email protected]> This patch adds an interface to query and ask DDX if they would prefer to use modesetting/glamor for a particular hw configuration, and if so to fail probing on that hw, so that modesetting gets picked up.
It adds a new driverFunc query to see if the driver supports glamor/modesetting preference, then passes a new flag to the platform probe asking for it, if the X server is configured to ask. It adds a new serverflag that can be disabled in xorg.conf. The only ugly bit is if we do platform probing and fail and the driver supports glamor preferences we don't do pci or old school probing as they have no nice flags parameter, and really we should be using platform probing anywhere this matters. I've written -intel support for this, but -ati and -nouveau support should be fairly easy. I'll send the intel patch just for reference. Signed-off-by: Dave Airlie <[email protected]> --- hw/xfree86/common/xf86Bus.c | 7 +++++++ hw/xfree86/common/xf86Config.c | 14 ++++++++++++++ hw/xfree86/common/xf86Globals.c | 1 + hw/xfree86/common/xf86Privstr.h | 1 + hw/xfree86/common/xf86platformBus.c | 10 ++++++++-- hw/xfree86/common/xf86str.h | 2 ++ 6 files changed, 33 insertions(+), 2 deletions(-) diff --git a/hw/xfree86/common/xf86Bus.c b/hw/xfree86/common/xf86Bus.c index bd36fc5..6b80715 100644 --- a/hw/xfree86/common/xf86Bus.c +++ b/hw/xfree86/common/xf86Bus.c @@ -83,6 +83,13 @@ xf86CallDriverProbe(DriverPtr drv, Bool detect_only) } if (ServerIsNotSeat0() && foundScreen) return foundScreen; + + /* if the driver supports glamor probing, then it shouldn't need to + fallback to pci/default probing so don't bother */ + if (drv->driverFunc) { + if (drv->driverFunc(NULL, SUPPORTS_GLAMOR_PREFERRED, NULL) && xf86Info.preferGlamor) + return foundScreen; + } #endif #ifdef XSERVER_LIBPCIACCESS diff --git a/hw/xfree86/common/xf86Config.c b/hw/xfree86/common/xf86Config.c index d2c3225..95d7571 100644 --- a/hw/xfree86/common/xf86Config.c +++ b/hw/xfree86/common/xf86Config.c @@ -703,6 +703,7 @@ typedef enum { FLAG_DRI2, FLAG_USE_SIGIO, FLAG_AUTO_ADD_GPU, + FLAG_PREFER_GLAMOR, FLAG_MAX_CLIENTS, } FlagValues; @@ -765,6 +766,8 @@ static OptionInfoRec FlagOptions[] = { {0}, FALSE}, {FLAG_MAX_CLIENTS, "MaxClients", OPTV_INTEGER, {0}, FALSE }, + {FLAG_PREFER_GLAMOR, "PreferGlamor", OPTV_BOOLEAN, + {0}, FALSE}, {-1, NULL, OPTV_NONE, {0}, FALSE}, }; @@ -861,6 +864,17 @@ configServerFlags(XF86ConfFlagsPtr flagsconf, XF86OptionPtr layoutopts) } xf86Msg(from, "%sutomatically adding GPU devices\n", xf86Info.autoAddGPU ? "A" : "Not a"); + + if (xf86IsOptionSet(FlagOptions, FLAG_PREFER_GLAMOR)) { + xf86GetOptValBool(FlagOptions, FLAG_PREFER_GLAMOR, + &xf86Info.preferGlamor); + from = X_CONFIG; + } + else { + from = X_DEFAULT; + } + xf86Msg(from, "preferring to%sask driver to use glamor\n", + xf86Info.preferGlamor ? "" : " not "); /* * Set things up based on the config file information. Some of these * settings may be overridden later when the command line options are diff --git a/hw/xfree86/common/xf86Globals.c b/hw/xfree86/common/xf86Globals.c index 93a35b8..47f660b 100644 --- a/hw/xfree86/common/xf86Globals.c +++ b/hw/xfree86/common/xf86Globals.c @@ -136,6 +136,7 @@ xf86InfoRec xf86Info = { #else .autoAddGPU = FALSE, #endif + .preferGlamor = TRUE, }; const char *xf86ConfigFile = NULL; diff --git a/hw/xfree86/common/xf86Privstr.h b/hw/xfree86/common/xf86Privstr.h index cffa14d..c6c5bf6 100644 --- a/hw/xfree86/common/xf86Privstr.h +++ b/hw/xfree86/common/xf86Privstr.h @@ -104,6 +104,7 @@ typedef struct { MessageType dri2From; Bool autoAddGPU; + Bool preferGlamor; } xf86InfoRec, *xf86InfoPtr; #ifdef DPMSExtension diff --git a/hw/xfree86/common/xf86platformBus.c b/hw/xfree86/common/xf86platformBus.c index f1e9423..682c545 100644 --- a/hw/xfree86/common/xf86platformBus.c +++ b/hw/xfree86/common/xf86platformBus.c @@ -374,8 +374,14 @@ static Bool doPlatformProbe(struct xf86_platform_device *dev, DriverPtr drvp, } } if (entity != -1) { - if ((dev->flags & XF86_PDEV_SERVER_FD) && (!drvp->driverFunc || - !drvp->driverFunc(NULL, SUPPORTS_SERVER_FDS, NULL))) { + Bool server_fds = FALSE; + if (drvp->driverFunc) { + if (drvp->driverFunc(NULL, SUPPORTS_SERVER_FDS, NULL)) + server_fds = TRUE; + if (drvp->driverFunc(NULL, SUPPORTS_GLAMOR_PREFERRED, NULL) && xf86Info.preferGlamor) + flags |= PLATFORM_PROBE_PREFER_GLAMOR; + } + if ((dev->flags & XF86_PDEV_SERVER_FD) && !server_fds) { systemd_logind_release_fd(dev->attribs->major, dev->attribs->minor, dev->attribs->fd); dev->attribs->fd = -1; dev->flags &= ~XF86_PDEV_SERVER_FD; diff --git a/hw/xfree86/common/xf86str.h b/hw/xfree86/common/xf86str.h index a58fafe..f620101 100644 --- a/hw/xfree86/common/xf86str.h +++ b/hw/xfree86/common/xf86str.h @@ -258,6 +258,7 @@ typedef enum { RR_GET_MODE_MM, GET_REQUIRED_HW_INTERFACES = 10, SUPPORTS_SERVER_FDS = 11, + SUPPORTS_GLAMOR_PREFERRED = 12, } xorgDriverFuncOp; typedef Bool xorgDriverFuncProc(ScrnInfoPtr, xorgDriverFuncOp, void *); @@ -335,6 +336,7 @@ typedef struct _DriverRec { * platform probe flags */ #define PLATFORM_PROBE_GPU_SCREEN 1 +#define PLATFORM_PROBE_PREFER_GLAMOR 2 /* * AddDriver flags -- 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
