pulseaudio: fix dependencies for openssl-3
[oi-userland.git] / components / x11 / xorg-server / patches / 28-sparc-multisession.patch
blob900236f091b646420ffef055ff47bb98ff498c42
1 --- a/config/hal.c Fri Feb 20 12:38:27 2015
2 +++ b/config/hal.c Fri Feb 20 12:39:43 2015
3 @@ -1,7 +1,7 @@
4 /*
5 * Copyright © 2007 Daniel Stone
6 * Copyright © 2007 Red Hat, Inc.
7 - * Copyright (c) 2013 Oracle and/or its affiliates. All Rights Reserved.
8 + * Copyright (c) 2013, 2014 Oracle and/or its affiliates. All Rights Reserved.
10 * Permission is hereby granted, free of charge, to any person obtaining a
11 * copy of this software and associated documentation files (the "Software"),
12 @@ -152,7 +152,7 @@
13 char *ptr;
14 char disppath[PATH_MAX];
16 - if ((num_session_disp_dev == num_total_disp_dev) || !disp_dev_path[0])
17 + if (((num_session_disp_dev & 0xFF) == num_total_disp_dev) || !disp_dev_path[0])
18 return FALSE;
20 if (lstat(path, &statbuf) == 0 &&
21 @@ -544,7 +544,7 @@
24 #if ((defined(__sparc__) || defined(__sparc)) && defined(SUNSOFT))
25 - if ((num_session_disp_dev < num_total_disp_dev) &&
26 + if ((num_session_disp_dev < (num_total_disp_dev & 0x0FF)) &&
27 (!strcmp(name, "keyboard") || !strcmp(name, "mouse"))) {
28 int i;
30 --- a/hw/xfree86/common/xf86AutoConfig.c Fri Feb 20 12:24:38 2015
31 +++ b/hw/xfree86/common/xf86AutoConfig.c Fri Feb 20 12:36:48 2015
32 @@ -1,6 +1,7 @@
34 * Copyright 2003 by David H. Dawes.
35 * Copyright 2003 by X-Oz Technologies.
36 + * Copyright (c) 2013, 2014 Oracle and/or its affiliates. All Rights Reserved.
37 * All rights reserved.
39 * Permission is hereby granted, free of charge, to any person obtaining a
40 @@ -50,6 +51,11 @@
41 #include <ctype.h>
42 #endif
44 +#if (defined(__sparc__) || defined(__sparc))
45 +static Bool MultiSessionConfig (void);
46 +extern int num_total_disp_dev;
47 +#endif
49 /* Sections for the default built-in configuration. */
51 #define BUILTIN_DEVICE_NAME \
52 @@ -168,6 +174,11 @@
53 char buf[1024];
54 ConfigStatus ret;
56 +#if ((defined(__sparc__) || defined(__sparc)) && defined (sun))
57 + /* Do not do MultiSessionConfig() when invoked with -isolateDevice option */
58 + if ((num_total_disp_dev & 0x1000)|| !MultiSessionConfig()) {
59 +#endif
61 listPossibleVideoDrivers(deviceList, 20);
63 for (p = deviceList; *p; p++) {
64 @@ -196,6 +207,10 @@
65 free(*p);
68 +#if ((defined(__sparc__) || defined(__sparc)) && defined (sun))
69 + }
70 +#endif
72 xf86MsgVerb(X_DEFAULT, 0,
73 "Using default built-in configuration (%d lines)\n",
74 builtinLines);
75 @@ -448,3 +403,176 @@
77 return ptr;
80 +#if ((defined(__sparc__) || defined(__sparc)) && defined (sun))
81 +#include <libdevinfo.h>
82 +#include <xorg/xf86Pci.h>
83 +#include "pciaccess.h"
84 +#include <sys/utsname.h>
86 +#define MAX_DEV 16
88 +#define IS_VGA(c) \
89 + (((c) & 0x00ffff00) \
90 + == ((PCI_CLASS_DISPLAY << 16) | (PCI_SUBCLASS_DISPLAY_VGA << 8)))
93 +#define BUILTIN_MULTI_SERVERFLAGS_OPT1 \
94 + "\tOption\t\"DefaultServerLayout\"\t\"Xsession0\"\n"
96 +#define BUILTIN_MULTI_SECTION_POST \
97 + "EndSection\n\n"
99 +#define BUILTIN_MULTI_SERVERFLAGS_OPT2 \
100 + "\tOption\t\"AutoAddDevices\"\t\"true\"\n"
102 +#define BUILTIN_MULTI_SERVERFLAGS_SECTION \
103 + "Section \"ServerFlags\"\n" \
104 + BUILTIN_MULTI_SERVERFLAGS_OPT1 \
105 + BUILTIN_MULTI_SERVERFLAGS_OPT2 \
106 + BUILTIN_MULTI_SECTION_POST
108 +#define BUILTIN_MULTI_LAYOUT_SECTION_PRE \
109 + "Section \"ServerLayout\"\n" \
110 + "\tIdentifier\t\"Xsession%d\"\n"
112 +#define BUILTIN_MULTI_LAYOUT_SECTION_LINE \
113 + "\tScreen\t\t\"Screen%d\"\n"
115 +#define BUILTIN_MULTI_SCREEN_SECTION_PRE \
116 + "Section \"Screen\"\n" \
117 + "\tIdentifier\t\"Screen%d\"\n"
119 +#define BUILTIN_MULTI_SCREEN_SECTION_LINE \
120 + "\tDevice\t\t\"Card%d\"\n"
122 +#define BUILTIN_MULTI_DEVICE_SECTION_PRE \
123 + "Section \"Device\"\n" \
124 + "\tIdentifier\t\"Card%d\"\n"
126 +#define BUILTIN_MULTI_DEVICE_SECTION_LINE \
127 + "\tBusID\t\t\"%s\"\n\tDriver\t\t\"%s\"\n"
129 +static Bool
130 +MultiSessionConfig (void)
132 + di_node_t node;
133 + struct pci_device_iterator * iter;
134 + struct pci_device * dev;
135 + typedef struct {
136 + char busid[64];
137 + char dev_path[PATH_MAX];
138 + } disp_dev_type;
139 + disp_dev_type disp_dev[MAX_DEV];
140 + int num = 0;
141 + char buf[1024];
142 + int i;
143 + struct utsname sys;
144 + struct sol_device_private {
145 + struct pci_device base;
146 + const char * device_string;
147 + };
148 +#define DEV_PATH(dev) (((struct sol_device_private *) dev)->device_string)
150 + if (uname(&sys) < 0) {
151 + xf86Msg(X_ERROR, "Error in uname call\n");
152 + return FALSE;
155 + if (strcmp(sys.machine, "sun4v"))
156 + return FALSE;
158 + iter = pci_slot_match_iterator_create( NULL );
160 + while ( (dev = pci_device_next( iter )) != NULL ) {
161 + if (IS_VGA(dev->device_class)) {
162 + if (num > MAX_DEV) {
163 + xf86Msg(X_ERROR, "Too many display devices: %d\n", num);
164 + return FALSE;
167 + memset(&disp_dev[num], 0, sizeof (disp_dev_type));
169 + snprintf(disp_dev[num].busid, sizeof(disp_dev[num].busid),
170 + "PCI:%d@%d:%d:%d", dev->bus, dev->domain,
171 + dev->dev, dev->func);
173 + strcpy(disp_dev[num].dev_path, "/devices");
174 + strncat(disp_dev[num].dev_path, DEV_PATH(dev),
175 + sizeof(disp_dev_type) - strlen("/devices"));
177 + num++;
181 + pci_iterator_destroy(iter);
183 + /* Do not do multi-session configuration if dev number is 0 or 1 */
184 + if (num <= 1)
185 + return FALSE;
187 + snprintf(buf, sizeof(buf), BUILTIN_MULTI_SERVERFLAGS_SECTION);
188 + AppendToConfig(buf);
190 + for (i = 0; i < num; i++) {
191 + char drv[32];
193 + snprintf(buf, sizeof(buf), BUILTIN_MULTI_LAYOUT_SECTION_PRE, i);
194 + AppendToConfig(buf);
195 + snprintf(buf, sizeof(buf), BUILTIN_MULTI_LAYOUT_SECTION_LINE, i);
196 + AppendToConfig(buf);
197 + snprintf(buf, sizeof(buf), BUILTIN_MULTI_SECTION_POST);
198 + AppendToConfig(buf);
200 + snprintf(buf, sizeof(buf), BUILTIN_MULTI_SCREEN_SECTION_PRE, i);
201 + AppendToConfig(buf);
202 + snprintf(buf, sizeof(buf), BUILTIN_MULTI_SCREEN_SECTION_LINE, i);
203 + AppendToConfig(buf);
204 + snprintf(buf, sizeof(buf), BUILTIN_MULTI_SECTION_POST);
205 + AppendToConfig(buf);
207 + snprintf(buf, sizeof(buf), BUILTIN_MULTI_DEVICE_SECTION_PRE, i);
208 + AppendToConfig(buf);
210 + drv[0] = 0;
211 + if (disp_dev[i].dev_path) {
212 + int iret;
213 + int fd;
216 + fd = open(disp_dev[i].dev_path, O_RDONLY);
217 + if (fd >= 0) {
218 + struct vis_identifier visid;
219 + const char *cp;
221 + SYSCALL(iret = ioctl(fd, VIS_GETIDENTIFIER, &visid));
222 + close (fd);
224 + if (iret >= 0) {
225 + if (strcmp(visid.name, "SUNWtext") != 0) {
226 + for (cp = visid.name; (*cp != '\0') && isupper((uchar_t)*cp); cp++);
227 + /* find end of all uppercase vendor section */
228 + if ((cp != visid.name) && (*cp != '\0'))
229 + strncpy (drv, cp, sizeof(drv));
235 + if (drv[0] == 0) {
236 + xf86Msg(X_ERROR, "Can't find driver for session %d\n", i);
237 + FreeConfig();
238 + return FALSE;
241 + snprintf(buf, sizeof(buf), BUILTIN_MULTI_DEVICE_SECTION_LINE,
242 + disp_dev[i].busid, drv);
243 + AppendToConfig(buf);
244 + snprintf(buf, sizeof(buf), BUILTIN_MULTI_SECTION_POST);
245 + AppendToConfig(buf);
248 + return TRUE;
250 +#endif
252 --- a/hw/xfree86/common/xf86pciBus.c Wed May 20 08:27:14 2015
253 +++ b/hw/xfree86/common/xf86pciBus.c Wed May 20 08:28:57 2015
254 @@ -1,6 +1,6 @@
256 * Copyright (c) 1997-2003 by The XFree86 Project, Inc.
257 - * Copyright (c) 2013 Oracle and/or its affiliates. All Rights Reserved.
258 + * Copyright (c) 2013, 2015 Oracle and/or its affiliates. All Rights Reserved.
260 * Permission is hereby granted, free of charge, to any person obtaining a
261 * copy of this software and associated documentation files (the "Software"),
262 @@ -131,6 +131,27 @@
264 free(iter);
266 +#if ((defined(__sparc__) || defined(__sparc)) && defined (sun))
267 + /*
268 + * num_total_disp_dev does not reflect accurate number of display
269 + * device when xf86IsolateDevice is set, redo it.
270 + */
271 + if (xf86IsolateDevice.domain != PCI_MATCH_ANY) {
272 + num_total_disp_dev = 0x1000;
274 + iter = pci_slot_match_iterator_create (NULL);
275 + while ((info = pci_device_next(iter)) != NULL) {
276 + if (PCIINFOCLASSES(info->device_class)) {
277 + pci_device_probe(info);
279 + if (IS_VGA(info->device_class))
280 + num_total_disp_dev++;
284 + free(iter);
285 +#endif
287 /* If we haven't found a primary device try a different heuristic */
288 if (primaryBus.type == BUS_NONE && num) {
289 for (i = 0; i < num; i++) {
290 @@ -1219,7 +1240,11 @@
291 #ifdef __linux__
292 driverList[idx++] = "nouveau";
293 #endif
294 +#ifdef sun
295 + driverList[idx++] = "nvidia";
296 +#else
297 driverList[idx++] = "nv";
298 +#endif
299 break;
301 case 0x1106:
302 --- a/hw/xfree86/common/xf86Xinput.c Fri Feb 20 12:34:32 2015
303 +++ b/hw/xfree86/common/xf86Xinput.c Fri Feb 20 12:37:40 2015
304 @@ -46,7 +46,7 @@
305 * authorization from the copyright holder(s) and author(s).
308 - * Copyright (c) 2013 Oracle and/or its affiliates. All Rights Reserved.
309 + * Copyright (c) 2013, 2014 Oracle and/or its affiliates. All Rights Reserved.
312 #ifdef HAVE_XORG_CONFIG_H
313 @@ -1502,7 +1502,7 @@
316 #if ((defined(__sparc__) || defined(__sparc)) && defined(sun))
317 - if (num_session_disp_dev < num_total_disp_dev) {
318 + if (num_session_disp_dev < (num_total_disp_dev & 0x0FFF)) {
319 int i;
321 for (i = 0; i < MAX_DEVICES; i++) {
322 --- a/hw/xfree86/common/xf86Bus.c Fri Feb 20 12:25:35 2015
323 +++ b/hw/xfree86/common/xf86Bus.c Fri Feb 20 12:26:02 2015
324 @@ -1,5 +1,6 @@
326 * Copyright (c) 1997-2003 by The XFree86 Project, Inc.
327 + * Copyright (c) 2013 Oracle and/or its affiliates. All Rights Reserved.
329 * Permission is hereby granted, free of charge, to any person obtaining a
330 * copy of this software and associated documentation files (the "Software"),
331 @@ -207,9 +208,6 @@
332 #ifdef XSERVER_LIBPCIACCESS
333 xf86PciProbe();
334 #endif
335 -#if (defined(__sparc__) || defined(__sparc)) && !defined(__OpenBSD__)
336 - xf86SbusProbe();
337 -#endif
338 #ifdef XSERVER_PLATFORM_BUS
339 xf86platformPrimary();
340 #endif
341 --- a/hw/xfree86/common/xf86AutoConfig.c 2017-02-01 15:25:17.530888588 -0800
342 +++ b/hw/xfree86/common/xf86AutoConfig.c 2017-02-01 15:26:39.121379814 -0800
343 @@ -253,66 +253,7 @@
344 #ifdef XSERVER_PLATFORM_BUS
345 i = xf86PlatformMatchDriver(matches, nmatches);
346 #endif
347 -#ifdef __sun
348 - /* Check for driver type based on /dev/fb type and if valid, use
349 - it instead of PCI bus probe results */
350 - if (xf86Info.consoleFd >= 0 && (i < (nmatches - 1))) {
351 - struct vis_identifier visid;
352 - const char *cp;
353 - int iret;
355 - SYSCALL(iret = ioctl(xf86Info.consoleFd, VIS_GETIDENTIFIER, &visid));
356 - if (iret < 0) {
357 - int fbfd;
359 - fbfd = open(xf86SolarisFbDev, O_RDONLY);
360 - if (fbfd >= 0) {
361 - SYSCALL(iret = ioctl(fbfd, VIS_GETIDENTIFIER, &visid));
362 - close(fbfd);
366 - if (iret < 0) {
367 - xf86Msg(X_WARNING,
368 - "could not get frame buffer identifier from %s\n",
369 - xf86SolarisFbDev);
371 - else {
372 - xf86Msg(X_PROBED, "console driver: %s\n", visid.name);
374 - /* Special case from before the general case was set */
375 - if (strcmp(visid.name, "NVDAnvda") == 0) {
376 - matches[i++] = xnfstrdup("nvidia");
379 - /* General case - split into vendor name (initial all-caps
380 - prefix) & driver name (rest of the string). */
381 - if (strcmp(visid.name, "SUNWtext") != 0) {
382 - for (cp = visid.name; (*cp != '\0') && isupper(*cp); cp++) {
383 - /* find end of all uppercase vendor section */
385 - if ((cp != visid.name) && (*cp != '\0')) {
386 - char *driverName = xnfstrdup(cp);
387 - char *vendorName = xnfstrdup(visid.name);
389 - vendorName[cp - visid.name] = '\0';
391 - matches[i++] = vendorName;
392 - matches[i++] = driverName;
397 -#endif
398 -#ifdef __sparc__
399 - if (i < (nmatches - 1))
401 - char *sbusDriver = sparcDriverName();
403 - if (sbusDriver)
404 - matches[i++] = xnfstrdup(sbusDriver);
406 -#endif
407 #ifdef XSERVER_LIBPCIACCESS
408 if (i < (nmatches - 1))
409 i += xf86PciMatchDriver(&matches[i], nmatches - i);