summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2015-03-31 16:56:42 +1000
committerDave Airlie <airlied@redhat.com>2015-04-27 13:40:40 +1000
commit69e4b8e602ecc7b69c75988a447ec5b509b22402 (patch)
tree935b6c32c3e9d12bdf26ac38fba82822c5302559
parent3b6930c5d02d8fc0d22fe7955e1ef2af61727705 (diff)
xfree86: attempt to autoconfig gpu slave devices (v3)
This allows us to skip the screen section, the first Device section will get assigned to the screen, any remaining ones will get assigned to the GPUDevice sections for the screen. v2: fix the skipping unsuitable screen logic (Aaron) v3: fix segfault if not conf file (me, 5s after sending v2) Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
-rw-r--r--hw/xfree86/common/xf86Config.c31
1 files changed, 26 insertions, 5 deletions
diff --git a/hw/xfree86/common/xf86Config.c b/hw/xfree86/common/xf86Config.c
index 88225a224..7d4ec3df3 100644
--- a/hw/xfree86/common/xf86Config.c
+++ b/hw/xfree86/common/xf86Config.c
@@ -1825,13 +1825,34 @@ configScreen(confScreenPtr screenp, XF86ConfScreenPtr conf_screen, int scrnum,
screenp->device = NULL;
}
- for (i = 0; i < conf_screen->num_gpu_devices; i++) {
- screenp->gpu_devices[i] = xnfcalloc(1, sizeof(GDevRec));
- if (configDevice(screenp->gpu_devices[i], conf_screen->scrn_gpu_devices[i], TRUE, TRUE)) {
- screenp->gpu_devices[i]->myScreenSection = screenp;
+ if (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++) {
+ if (!sdevice)
+ break;
+
+ FIND_SUITABLE (XF86ConfDevicePtr, sdevice, conf_screen->scrn_gpu_devices[i]);
+ if (!conf_screen->scrn_gpu_devices[i])
+ break;
+ screenp->gpu_devices[i] = xnfcalloc(1, sizeof(GDevRec));
+ if (configDevice(screenp->gpu_devices[i], conf_screen->scrn_gpu_devices[i], TRUE, TRUE)) {
+ screenp->gpu_devices[i]->myScreenSection = screenp;
+ }
+ sdevice = conf_screen->scrn_gpu_devices[i]->list.next;
}
+ screenp->num_gpu_devices = i;
+
+ } else {
+ for (i = 0; i < conf_screen->num_gpu_devices; i++) {
+ screenp->gpu_devices[i] = xnfcalloc(1, sizeof(GDevRec));
+ if (configDevice(screenp->gpu_devices[i], conf_screen->scrn_gpu_devices[i], TRUE, TRUE)) {
+ screenp->gpu_devices[i]->myScreenSection = screenp;
+ }
+ }
+ screenp->num_gpu_devices = conf_screen->num_gpu_devices;
}
- screenp->num_gpu_devices = conf_screen->num_gpu_devices;
+
screenp->options = conf_screen->scrn_option_lst;
/*