xfree86: add autoAddGPU option (v2)

This option is to stop the X server adding non-primary devices as
gpu screens.

v2: fix per Keith's suggestion.

Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
This commit is contained in:
Dave Airlie 2012-06-05 17:45:03 +01:00
parent ef6686480a
commit 74b786f7ce
4 changed files with 30 additions and 3 deletions

View File

@ -712,7 +712,8 @@ typedef enum {
FLAG_AUTO_ENABLE_DEVICES,
FLAG_GLX_VISUALS,
FLAG_DRI2,
FLAG_USE_SIGIO
FLAG_USE_SIGIO,
FLAG_AUTO_ADD_GPU,
} FlagValues;
/**
@ -770,6 +771,8 @@ static OptionInfoRec FlagOptions[] = {
{0}, FALSE},
{FLAG_USE_SIGIO, "UseSIGIO", OPTV_BOOLEAN,
{0}, FALSE},
{FLAG_AUTO_ADD_GPU, "AutoAddGPU", OPTV_BOOLEAN,
{0}, FALSE},
{-1, NULL, OPTV_NONE,
{0}, FALSE},
};
@ -862,6 +865,16 @@ configServerFlags(XF86ConfFlagsPtr flagsconf, XF86OptionPtr layoutopts)
xf86Msg(from, "%sutomatically enabling devices\n",
xf86Info.autoEnableDevices ? "A" : "Not a");
if (xf86IsOptionSet(FlagOptions, FLAG_AUTO_ADD_GPU)) {
xf86GetOptValBool(FlagOptions, FLAG_AUTO_ADD_GPU,
&xf86Info.autoAddGPU);
from = X_CONFIG;
}
else {
from = X_DEFAULT;
}
xf86Msg(from, "%sutomatically adding GPU devices\n",
xf86Info.autoAddGPU ? "A" : "Not a");
/*
* Set things up based on the config file information. Some of these
* settings may be overridden later when the command line options are

View File

@ -126,11 +126,16 @@ xf86InfoRec xf86Info = {
#if defined(CONFIG_HAL) || defined(CONFIG_UDEV) || defined(CONFIG_WSCONS)
.forceInputDevices = FALSE,
.autoAddDevices = TRUE,
.autoEnableDevices = TRUE
.autoEnableDevices = TRUE,
#else
.forceInputDevices = TRUE,
.autoAddDevices = FALSE,
.autoEnableDevices = FALSE
.autoEnableDevices = FALSE,
#endif
#if defined(CONFIG_UDEV_KMS)
.autoAddGPU = TRUE,
#else
.autoAddGPU = FALSE,
#endif
};

View File

@ -110,6 +110,8 @@ typedef struct {
Bool dri2;
MessageType dri2From;
Bool autoAddGPU;
} xf86InfoRec, *xf86InfoPtr;
#ifdef DPMSExtension

View File

@ -373,6 +373,13 @@ xf86platformProbeDev(DriverPtr drvp)
continue;
}
/* if autoaddgpu devices is enabled then go find a few more and add them as GPU screens */
if (xf86Info.autoAddGPU && numDevs) {
for (j = 0; j < xf86_num_platform_devices; j++) {
probeSingleDevice(&xf86_platform_devices[j], drvp, devList[0], PLATFORM_PROBE_GPU_SCREEN);
}
}
return foundScreen;
}