From 5c555605386c76be2f02193d434a4617218b67be Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Thu, 11 Jun 2015 14:29:48 +1000 Subject: [PATCH] xf86: restrict when we auto add devices as gpu devices. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Michel pointed out I broke Zaphod with the initial auto add gpu devices change, Fix this, by only auto adding GPU devices if we are screen 0 and there are no other screens in the layout. Anyone who wants to assign GPU devices can specify it in the xorg.conf for this use case. Signed-off-by: Dave Airlie Tested-by: Michel Dänzer --- hw/xfree86/common/xf86Config.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/hw/xfree86/common/xf86Config.c b/hw/xfree86/common/xf86Config.c index b8ec8a0ef..2b4df0cf7 100644 --- a/hw/xfree86/common/xf86Config.c +++ b/hw/xfree86/common/xf86Config.c @@ -123,7 +123,7 @@ static ModuleDefault ModuleDefaults[] = { /* Forward declarations */ static Bool configScreen(confScreenPtr screenp, XF86ConfScreenPtr conf_screen, - int scrnum, MessageType from); + int scrnum, MessageType from, Bool auto_gpu_device); static Bool configMonitor(MonPtr monitorp, XF86ConfMonitorPtr conf_monitor); static Bool configDevice(GDevPtr devicep, XF86ConfDevicePtr conf_device, Bool active, Bool gpu); @@ -1524,7 +1524,7 @@ configLayout(serverLayoutPtr servlayoutp, XF86ConfLayoutPtr conf_layout, else scrnum = adjp->adj_scrnum; if (!configScreen(slp[count].screen, adjp->adj_screen, scrnum, - X_CONFIG)) { + X_CONFIG, (scrnum == 0 && !adjp->list.next))) { do { free(slp[count].screen); } while (count--); @@ -1574,7 +1574,7 @@ configLayout(serverLayoutPtr servlayoutp, XF86ConfLayoutPtr conf_layout, FIND_SUITABLE (XF86ConfScreenPtr, xf86configptr->conf_screen_lst, screen); slp[0].screen = xnfcalloc(1, sizeof(confScreenRec)); if (!configScreen(slp[0].screen, screen, - 0, X_CONFIG)) { + 0, X_CONFIG, TRUE)) { free(slp[0].screen); free(slp); return FALSE; @@ -1703,7 +1703,7 @@ configImpliedLayout(serverLayoutPtr servlayoutp, XF86ConfScreenPtr conf_screen, slp = xnfcalloc(1, 2 * sizeof(screenLayoutRec)); slp[0].screen = xnfcalloc(1, sizeof(confScreenRec)); slp[1].screen = NULL; - if (!configScreen(slp[0].screen, conf_screen, 0, from)) { + if (!configScreen(slp[0].screen, conf_screen, 0, from, TRUE)) { free(slp); return FALSE; } @@ -1768,7 +1768,7 @@ configXvAdaptor(confXvAdaptorPtr adaptor, XF86ConfVideoAdaptorPtr conf_adaptor) static Bool configScreen(confScreenPtr screenp, XF86ConfScreenPtr conf_screen, int scrnum, - MessageType from) + MessageType from, Bool auto_gpu_device) { int count = 0; XF86ConfDisplayPtr dispptr; @@ -1825,7 +1825,8 @@ configScreen(confScreenPtr screenp, XF86ConfScreenPtr conf_screen, int scrnum, screenp->device = NULL; } - if (conf_screen->num_gpu_devices == 0 && xf86configptr->conf_device_lst) { + if (auto_gpu_device && conf_screen->num_gpu_devices == 0 && + xf86configptr->conf_device_lst) { XF86ConfDevicePtr sdevice = xf86configptr->conf_device_lst->list.next; for (i = 0; i < MAX_GPUDEVICES; i++) {