1386N/Aindex cc8976f..7a43694 100644
1386N/A * Copyright 2003 by David H. Dawes.
1386N/A * Copyright 2003 by X-Oz Technologies.
1386N/A- * Copyright (c) 2013 Oracle
and/or its affiliates. All Rights Reserved.
1386N/A * Permission is hereby granted, free of charge, to any person obtaining a
1386N/A * copy of this software and associated documentation files (the "Software"),
1386N/A+#if (defined(__sparc__) || defined(__sparc))
1386N/A+static Bool MultiSessionConfig (void);
1386N/A /* Sections for the default built-in configuration. */
1386N/A@@ -169,6 +172,10 @@ xf86AutoConfig(void)
1386N/A+#if ((defined(__sparc__) || defined(__sparc)) && defined (sun))
1386N/A+ if (!MultiSessionConfig()) {
1386N/A listPossibleVideoDrivers(deviceList, 20);
1386N/A for (p = deviceList; *p; p++) {
1386N/A@@ -196,6 +203,9 @@ xf86AutoConfig(void)
1386N/A for (p = deviceList; *p; p++) {
1386N/A+#if ((defined(__sparc__) || defined(__sparc)) && defined (sun))
1386N/A "Using default built-in configuration (%d lines)\n",
1386N/A@@ -442,3 +452,173 @@ autoConfigDevice(GDevPtr preconf_device)
1386N/A+#if ((defined(__sparc__) || defined(__sparc)) && defined (sun))
1386N/A+ == ((PCI_CLASS_DISPLAY << 16) | (PCI_SUBCLASS_DISPLAY_VGA << 8)))
1386N/A+#define BUILTIN_MULTI_SERVERFLAGS_OPT1 \
1386N/A+ "\tOption\t\"DefaultServerLayout\"\t\"Xsession0\"\n"
1386N/A+#define BUILTIN_MULTI_SECTION_POST \
1386N/A+#define BUILTIN_MULTI_SERVERFLAGS_OPT2 \
1386N/A+ "\tOption\t\"AutoAddDevices\"\t\"true\"\n"
1386N/A+#define BUILTIN_MULTI_SERVERFLAGS_SECTION \
1386N/A+ "Section \"ServerFlags\"\n" \
1386N/A+ BUILTIN_MULTI_SERVERFLAGS_OPT1 \
1386N/A+ BUILTIN_MULTI_SERVERFLAGS_OPT2 \
1386N/A+ BUILTIN_MULTI_SECTION_POST
1386N/A+#define BUILTIN_MULTI_LAYOUT_SECTION_PRE \
1386N/A+ "Section \"ServerLayout\"\n" \
1386N/A+ "\tIdentifier\t\"Xsession%d\"\n"
1386N/A+#define BUILTIN_MULTI_LAYOUT_SECTION_LINE \
1386N/A+ "\tScreen\t\t\"Screen%d\"\n"
1386N/A+#define BUILTIN_MULTI_SCREEN_SECTION_PRE \
1386N/A+ "\tIdentifier\t\"Screen%d\"\n"
1386N/A+#define BUILTIN_MULTI_SCREEN_SECTION_LINE \
1386N/A+ "\tDevice\t\t\"Card%d\"\n"
1386N/A+#define BUILTIN_MULTI_DEVICE_SECTION_PRE \
1386N/A+ "\tIdentifier\t\"Card%d\"\n"
1386N/A+#define BUILTIN_MULTI_DEVICE_SECTION_LINE \
1386N/A+ "\tBusID\t\t\"%s\"\n\tDriver\t\t\"%s\"\n"
1386N/A+ struct pci_device_iterator * iter;
1386N/A+ disp_dev_type disp_dev[MAX_DEV];
1386N/A+ struct sol_device_private {
1386N/A+ const char * device_string;
1386N/A+#define DEV_PATH(dev) (((struct sol_device_private *) dev)->device_string)
1386N/A+ xf86Msg(X_ERROR, "Error in uname call\n");
1386N/A+ iter = pci_slot_match_iterator_create( NULL );
1386N/A+ while ( (dev = pci_device_next( iter )) != NULL ) {
1386N/A+ if (IS_VGA(dev->device_class)) {
1386N/A+ xf86Msg(X_ERROR, "Too many display devices: %d\n", num);
1386N/A+ memset(&disp_dev[num], 0, sizeof (disp_dev_type));
1386N/A+ snprintf(disp_dev[num].busid, sizeof(disp_dev[num].busid),
1386N/A+ "PCI:%d@%d:%d:%d", dev->bus, dev->domain,
1386N/A+ strcpy(disp_dev[num].dev_path, "/devices");
1386N/A+ strncat(disp_dev[num].dev_path, DEV_PATH(dev),
1386N/A+ sizeof(disp_dev_type) - strlen("/devices"));
1386N/A+ pci_iterator_destroy(iter);
1386N/A+ /* Do not do multi-session configuration if dev number is 0 or 1 */
1386N/A+ snprintf(buf, sizeof(buf), BUILTIN_MULTI_SERVERFLAGS_SECTION);
1386N/A+ for (i = 0; i < num; i++) {
1386N/A+ snprintf(buf, sizeof(buf), BUILTIN_MULTI_LAYOUT_SECTION_PRE, i);
1386N/A+ snprintf(buf, sizeof(buf), BUILTIN_MULTI_LAYOUT_SECTION_LINE, i);
1386N/A+ snprintf(buf, sizeof(buf), BUILTIN_MULTI_SECTION_POST);
1386N/A+ snprintf(buf, sizeof(buf), BUILTIN_MULTI_SCREEN_SECTION_PRE, i);
1386N/A+ snprintf(buf, sizeof(buf), BUILTIN_MULTI_SCREEN_SECTION_LINE, i);
1386N/A+ snprintf(buf, sizeof(buf), BUILTIN_MULTI_SECTION_POST);
1386N/A+ snprintf(buf, sizeof(buf), BUILTIN_MULTI_DEVICE_SECTION_PRE, i);
1386N/A+ if (disp_dev[i].dev_path) {
1386N/A+ fd = open(disp_dev[i].dev_path, O_RDONLY);
1386N/A+ struct vis_identifier visid;
1386N/A+ SYSCALL(iret = ioctl(fd, VIS_GETIDENTIFIER, &visid));
1386N/A+ /* find end of all uppercase vendor section */
1386N/A+ strncpy (drv, cp, sizeof(drv));
1386N/A+ xf86Msg(X_ERROR, "Can't find driver for session %d\n", i);
1386N/A+ snprintf(buf, sizeof(buf), BUILTIN_MULTI_DEVICE_SECTION_LINE,
1386N/A+ snprintf(buf, sizeof(buf), BUILTIN_MULTI_SECTION_POST);