2003-11-14 16:54:54 +01:00
|
|
|
/*
|
2003-11-14 17:49:22 +01:00
|
|
|
* Loosely based on code bearing the following copyright:
|
2003-11-14 16:54:54 +01:00
|
|
|
*
|
2003-11-14 17:49:22 +01:00
|
|
|
* Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany.
|
2003-11-14 16:54:54 +01:00
|
|
|
*/
|
2003-11-25 20:29:01 +01:00
|
|
|
/*
|
|
|
|
* Copyright (c) 1992-2003 by The XFree86 Project, Inc.
|
|
|
|
*
|
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
|
|
|
* copy of this software and associated documentation files (the "Software"),
|
|
|
|
* to deal in the Software without restriction, including without limitation
|
|
|
|
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
|
|
* and/or sell copies of the Software, and to permit persons to whom the
|
|
|
|
* Software is furnished to do so, subject to the following conditions:
|
|
|
|
*
|
|
|
|
* The above copyright notice and this permission notice shall be included in
|
|
|
|
* all copies or substantial portions of the Software.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
|
|
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
|
|
|
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
|
|
|
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
|
|
* OTHER DEALINGS IN THE SOFTWARE.
|
|
|
|
*
|
|
|
|
* Except as contained in this notice, the name of the copyright holder(s)
|
|
|
|
* and author(s) shall not be used in advertising or otherwise to promote
|
|
|
|
* the sale, use or other dealings in this Software without prior written
|
|
|
|
* authorization from the copyright holder(s) and author(s).
|
|
|
|
*/
|
2003-11-14 16:54:54 +01:00
|
|
|
|
2005-07-03 09:02:09 +02:00
|
|
|
#ifdef HAVE_XORG_CONFIG_H
|
|
|
|
#include <xorg-config.h>
|
|
|
|
#endif
|
|
|
|
|
2003-11-14 16:54:54 +01:00
|
|
|
#include <stdlib.h>
|
2007-02-17 10:21:43 +01:00
|
|
|
#include <errno.h>
|
2003-11-14 16:54:54 +01:00
|
|
|
|
2003-11-25 20:29:01 +01:00
|
|
|
#undef HAS_UTSNAME
|
2007-06-29 00:59:05 +02:00
|
|
|
#if !defined(WIN32)
|
2003-11-25 20:29:01 +01:00
|
|
|
#define HAS_UTSNAME 1
|
|
|
|
#include <sys/utsname.h>
|
|
|
|
#endif
|
|
|
|
|
2005-04-20 14:25:48 +02:00
|
|
|
#include <X11/X.h>
|
|
|
|
#include <X11/Xmd.h>
|
|
|
|
#include <X11/Xproto.h>
|
|
|
|
#include <X11/Xatom.h>
|
2003-11-14 16:54:54 +01:00
|
|
|
#include "input.h"
|
|
|
|
#include "servermd.h"
|
2003-11-14 17:49:22 +01:00
|
|
|
#include "windowstr.h"
|
2003-11-14 16:54:54 +01:00
|
|
|
#include "scrnintstr.h"
|
2003-11-14 17:49:22 +01:00
|
|
|
#include "mi.h"
|
2013-12-04 11:10:06 +01:00
|
|
|
#include "dbus-core.h"
|
2014-01-07 12:15:12 +01:00
|
|
|
#include "systemd-logind.h"
|
2003-11-14 16:54:54 +01:00
|
|
|
|
2003-11-14 17:49:22 +01:00
|
|
|
#include "loaderProcs.h"
|
|
|
|
|
|
|
|
#define XF86_OS_PRIVS
|
2003-11-14 16:54:54 +01:00
|
|
|
#include "xf86.h"
|
2003-11-14 17:49:22 +01:00
|
|
|
#include "xf86Priv.h"
|
|
|
|
#include "xf86Config.h"
|
2003-11-14 16:54:54 +01:00
|
|
|
#include "xf86_OSlib.h"
|
2010-04-27 02:22:21 +02:00
|
|
|
#include "xf86cmap.h"
|
2004-04-23 21:54:30 +02:00
|
|
|
#include "xorgVersion.h"
|
2003-11-14 16:54:54 +01:00
|
|
|
#include "mipointer.h"
|
2005-04-20 14:25:48 +02:00
|
|
|
#include <X11/extensions/XI.h>
|
|
|
|
#include <X11/extensions/XIproto.h>
|
2016-02-10 09:34:34 +01:00
|
|
|
#include "xf86Extensions.h"
|
2003-11-14 17:49:22 +01:00
|
|
|
#include "xf86DDC.h"
|
|
|
|
#include "xf86Xinput.h"
|
|
|
|
#include "xf86InPriv.h"
|
2012-08-17 01:49:24 +02:00
|
|
|
#include "xf86Crtc.h"
|
2003-11-14 17:49:22 +01:00
|
|
|
#include "picturestr.h"
|
2018-01-24 21:40:22 +01:00
|
|
|
#include "randrstr.h"
|
2018-01-10 19:05:45 +01:00
|
|
|
#include "glxvndabi.h"
|
2010-05-02 21:34:44 +02:00
|
|
|
#include "xf86Bus.h"
|
2010-06-01 12:05:47 +02:00
|
|
|
#ifdef XSERVER_LIBPCIACCESS
|
2009-08-28 03:39:42 +02:00
|
|
|
#include "xf86VGAarbiter.h"
|
2010-06-01 12:05:47 +02:00
|
|
|
#endif
|
2003-11-14 17:49:22 +01:00
|
|
|
#include "globals.h"
|
2011-07-18 21:19:23 +02:00
|
|
|
#include "xserver-properties.h"
|
2003-11-14 16:54:54 +01:00
|
|
|
|
2004-07-30 22:56:53 +02:00
|
|
|
#ifdef DPMSExtension
|
2009-07-15 08:51:05 +02:00
|
|
|
#include <X11/extensions/dpmsconst.h>
|
2004-10-11 11:58:04 +02:00
|
|
|
#include "dpmsproc.h"
|
2004-07-30 22:56:53 +02:00
|
|
|
#endif
|
2010-01-15 06:22:02 +01:00
|
|
|
#include <hotplug.h>
|
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
void (*xf86OSPMClose) (void) = NULL;
|
2009-10-29 00:45:44 +01:00
|
|
|
static Bool xorgHWOpenConsole = FALSE;
|
2003-11-14 17:49:22 +01:00
|
|
|
|
|
|
|
/* Common pixmap formats */
|
|
|
|
|
|
|
|
static PixmapFormatRec formats[MAXFORMATS] = {
|
2012-03-21 20:55:09 +01:00
|
|
|
{1, 1, BITMAP_SCANLINE_PAD},
|
|
|
|
{4, 8, BITMAP_SCANLINE_PAD},
|
|
|
|
{8, 8, BITMAP_SCANLINE_PAD},
|
|
|
|
{15, 16, BITMAP_SCANLINE_PAD},
|
|
|
|
{16, 16, BITMAP_SCANLINE_PAD},
|
|
|
|
{24, 32, BITMAP_SCANLINE_PAD},
|
|
|
|
{32, 32, BITMAP_SCANLINE_PAD},
|
2003-11-14 17:49:22 +01:00
|
|
|
};
|
2012-03-21 20:55:09 +01:00
|
|
|
|
2003-11-14 17:49:22 +01:00
|
|
|
static int numFormats = 7;
|
|
|
|
static Bool formatsDone = FALSE;
|
|
|
|
|
2008-06-12 00:05:04 +02:00
|
|
|
#ifndef PRE_RELEASE
|
|
|
|
#define PRE_RELEASE XORG_VERSION_SNAP
|
|
|
|
#endif
|
|
|
|
|
|
|
|
static void
|
2008-10-26 13:11:41 +01:00
|
|
|
xf86PrintBanner(void)
|
2008-06-12 00:05:04 +02:00
|
|
|
{
|
|
|
|
#if PRE_RELEASE
|
2012-03-21 20:55:09 +01:00
|
|
|
xf86ErrorFVerb(0, "\n"
|
|
|
|
"This is a pre-release version of the X server from "
|
|
|
|
XVENDORNAME ".\n" "It is not supported in any way.\n"
|
|
|
|
"Bugs may be filed in the bugzilla at http://bugs.freedesktop.org/.\n"
|
|
|
|
"Select the \"xorg\" product for bugs you find in this release.\n"
|
|
|
|
"Before reporting bugs in pre-release versions please check the\n"
|
|
|
|
"latest version in the X.Org Foundation git repository.\n"
|
|
|
|
"See http://wiki.x.org/wiki/GitPage for git access instructions.\n");
|
2008-06-12 00:05:04 +02:00
|
|
|
#endif
|
2012-03-21 20:55:09 +01:00
|
|
|
xf86ErrorFVerb(0, "\nX.Org X Server %d.%d.%d",
|
|
|
|
XORG_VERSION_MAJOR, XORG_VERSION_MINOR, XORG_VERSION_PATCH);
|
2008-06-12 00:05:04 +02:00
|
|
|
#if XORG_VERSION_SNAP > 0
|
2012-03-21 20:55:09 +01:00
|
|
|
xf86ErrorFVerb(0, ".%d", XORG_VERSION_SNAP);
|
2008-06-12 00:05:04 +02:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if XORG_VERSION_SNAP >= 900
|
2012-03-21 20:55:09 +01:00
|
|
|
/* When the minor number is 99, that signifies that the we are making
|
|
|
|
* a release candidate for a major version. (X.0.0)
|
|
|
|
* When the patch number is 99, that signifies that the we are making
|
|
|
|
* a release candidate for a minor version. (X.Y.0)
|
|
|
|
* When the patch number is < 99, then we are making a release
|
|
|
|
* candidate for the next point release. (X.Y.Z)
|
|
|
|
*/
|
2008-06-12 00:05:04 +02:00
|
|
|
#if XORG_VERSION_MINOR >= 99
|
2012-03-21 20:55:09 +01:00
|
|
|
xf86ErrorFVerb(0, " (%d.0.0 RC %d)", XORG_VERSION_MAJOR + 1,
|
|
|
|
XORG_VERSION_SNAP - 900);
|
2008-06-12 00:05:04 +02:00
|
|
|
#elif XORG_VERSION_PATCH == 99
|
2012-03-21 20:55:09 +01:00
|
|
|
xf86ErrorFVerb(0, " (%d.%d.0 RC %d)", XORG_VERSION_MAJOR,
|
|
|
|
XORG_VERSION_MINOR + 1, XORG_VERSION_SNAP - 900);
|
2008-06-12 00:05:04 +02:00
|
|
|
#else
|
2012-03-21 20:55:09 +01:00
|
|
|
xf86ErrorFVerb(0, " (%d.%d.%d RC %d)", XORG_VERSION_MAJOR,
|
|
|
|
XORG_VERSION_MINOR, XORG_VERSION_PATCH + 1,
|
|
|
|
XORG_VERSION_SNAP - 900);
|
2008-06-12 00:05:04 +02:00
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XORG_CUSTOM_VERSION
|
2012-03-21 20:55:09 +01:00
|
|
|
xf86ErrorFVerb(0, " (%s)", XORG_CUSTOM_VERSION);
|
2008-06-12 00:05:04 +02:00
|
|
|
#endif
|
2018-04-03 00:04:08 +02:00
|
|
|
xf86ErrorFVerb(0, "\nX Protocol Version %d, Revision %d\n",
|
2012-03-21 20:55:09 +01:00
|
|
|
X_PROTOCOL, X_PROTOCOL_REVISION);
|
2008-06-12 00:05:04 +02:00
|
|
|
#ifdef HAS_UTSNAME
|
2012-03-21 20:55:09 +01:00
|
|
|
{
|
|
|
|
struct utsname name;
|
2008-06-12 00:05:04 +02:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
/* Linux & BSD state that 0 is success, SysV (including Solaris, HP-UX,
|
|
|
|
and Irix) and Single Unix Spec 3 just say that non-negative is success.
|
|
|
|
All agree that failure is represented by a negative number.
|
|
|
|
*/
|
|
|
|
if (uname(&name) >= 0) {
|
|
|
|
xf86ErrorFVerb(0, "Current Operating System: %s %s %s %s %s\n",
|
|
|
|
name.sysname, name.nodename, name.release,
|
|
|
|
name.version, name.machine);
|
2017-05-11 08:42:16 +02:00
|
|
|
#ifdef __linux__
|
2012-03-21 20:55:09 +01:00
|
|
|
do {
|
|
|
|
char buf[80];
|
|
|
|
int fd = open("/proc/cmdline", O_RDONLY);
|
|
|
|
|
|
|
|
if (fd != -1) {
|
|
|
|
xf86ErrorFVerb(0, "Kernel command line: ");
|
|
|
|
memset(buf, 0, 80);
|
|
|
|
while (read(fd, buf, 80) > 0) {
|
|
|
|
xf86ErrorFVerb(0, "%.80s", buf);
|
|
|
|
memset(buf, 0, 80);
|
|
|
|
}
|
|
|
|
close(fd);
|
|
|
|
}
|
|
|
|
} while (0);
|
2009-08-20 21:45:57 +02:00
|
|
|
#endif
|
2012-03-21 20:55:09 +01:00
|
|
|
}
|
2008-06-12 00:05:04 +02:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
#if defined(BUILDERSTRING)
|
2012-03-21 20:55:09 +01:00
|
|
|
xf86ErrorFVerb(0, "%s \n", BUILDERSTRING);
|
2008-06-12 00:05:04 +02:00
|
|
|
#endif
|
2012-03-21 20:55:09 +01:00
|
|
|
xf86ErrorFVerb(0, "Current version of pixman: %s\n",
|
|
|
|
pixman_version_string());
|
|
|
|
xf86ErrorFVerb(0, "\tBefore reporting problems, check "
|
|
|
|
"" __VENDORDWEBSUPPORT__ "\n"
|
|
|
|
"\tto make sure that you have the latest version.\n");
|
2008-06-12 00:05:04 +02:00
|
|
|
}
|
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
Bool
|
|
|
|
xf86PrivsElevated(void)
|
2011-12-16 19:36:51 +01:00
|
|
|
{
|
2018-03-13 22:46:34 +01:00
|
|
|
return PrivsElevated();
|
2011-12-16 19:36:51 +01:00
|
|
|
}
|
|
|
|
|
2012-08-17 01:49:24 +02:00
|
|
|
static void
|
|
|
|
xf86AutoConfigOutputDevices(void)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
if (!xf86Info.autoBindGPU)
|
|
|
|
return;
|
|
|
|
|
|
|
|
for (i = 0; i < xf86NumGPUScreens; i++)
|
|
|
|
RRProviderAutoConfigGpuScreen(xf86ScrnToScreen(xf86GPUScreens[i]),
|
|
|
|
xf86ScrnToScreen(xf86Screens[0]));
|
|
|
|
}
|
|
|
|
|
2016-01-05 22:11:42 +01:00
|
|
|
static void
|
|
|
|
AddSeatId(CallbackListPtr *pcbl, void *data, void *screen)
|
|
|
|
{
|
|
|
|
ScreenPtr pScreen = screen;
|
|
|
|
Atom SeatAtom = MakeAtom(SEAT_ATOM_NAME, sizeof(SEAT_ATOM_NAME) - 1, TRUE);
|
|
|
|
int err;
|
|
|
|
|
|
|
|
err = dixChangeWindowProperty(serverClient, pScreen->root, SeatAtom,
|
|
|
|
XA_STRING, 8, PropModeReplace,
|
|
|
|
strlen(data) + 1, data, FALSE);
|
|
|
|
|
|
|
|
if (err != Success)
|
|
|
|
xf86DrvMsg(pScreen->myNum, X_WARNING,
|
|
|
|
"Failed to register seat property\n");
|
|
|
|
}
|
|
|
|
|
2016-01-05 22:27:41 +01:00
|
|
|
static void
|
|
|
|
AddVTAtoms(CallbackListPtr *pcbl, void *data, void *screen)
|
|
|
|
{
|
|
|
|
#define VT_ATOM_NAME "XFree86_VT"
|
|
|
|
int err, HasVT = 1;
|
|
|
|
ScreenPtr pScreen = screen;
|
|
|
|
Atom VTAtom = MakeAtom(VT_ATOM_NAME, sizeof(VT_ATOM_NAME) - 1, TRUE);
|
|
|
|
Atom HasVTAtom = MakeAtom(HAS_VT_ATOM_NAME, sizeof(HAS_VT_ATOM_NAME) - 1,
|
|
|
|
TRUE);
|
|
|
|
|
|
|
|
err = dixChangeWindowProperty(serverClient, pScreen->root, VTAtom,
|
|
|
|
XA_INTEGER, 32, PropModeReplace, 1,
|
|
|
|
&xf86Info.vtno, FALSE);
|
|
|
|
|
|
|
|
err |= dixChangeWindowProperty(serverClient, pScreen->root, HasVTAtom,
|
|
|
|
XA_INTEGER, 32, PropModeReplace, 1,
|
|
|
|
&HasVT, FALSE);
|
|
|
|
|
|
|
|
if (err != Success)
|
|
|
|
xf86DrvMsg(pScreen->myNum, X_WARNING,
|
|
|
|
"Failed to register VT properties\n");
|
|
|
|
}
|
2014-03-31 11:19:16 +02:00
|
|
|
|
2016-07-30 02:45:45 +02:00
|
|
|
static Bool
|
|
|
|
xf86ScreenInit(ScreenPtr pScreen, int argc, char **argv)
|
|
|
|
{
|
|
|
|
ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
|
|
|
|
|
|
|
|
pScrn->pScreen = pScreen;
|
|
|
|
return pScrn->ScreenInit (pScreen, argc, argv);
|
|
|
|
}
|
|
|
|
|
2018-01-24 21:40:22 +01:00
|
|
|
static void
|
|
|
|
xf86EnsureRANDR(ScreenPtr pScreen)
|
|
|
|
{
|
|
|
|
#ifdef RANDR
|
|
|
|
if (!dixPrivateKeyRegistered(rrPrivKey) ||
|
|
|
|
!rrGetScrPriv(pScreen))
|
|
|
|
xf86RandRInit(pScreen);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2008-02-25 21:39:33 +01:00
|
|
|
/*
|
|
|
|
* InitOutput --
|
|
|
|
* Initialize screenInfo for all actually accessible framebuffers.
|
|
|
|
* That includes vt-manager setup, querying all possible devices and
|
|
|
|
* collecting the pixmap formats.
|
|
|
|
*/
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
void
|
2012-03-21 20:55:09 +01:00
|
|
|
InitOutput(ScreenInfo * pScreenInfo, int argc, char **argv)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
2012-06-22 06:56:25 +02:00
|
|
|
int i, j, k, scr_index;
|
2013-11-15 08:56:15 +01:00
|
|
|
const char **modulelist;
|
2013-12-15 10:05:51 +01:00
|
|
|
void **optionlist;
|
2012-03-21 20:55:09 +01:00
|
|
|
Bool autoconfig = FALSE;
|
2012-07-10 01:33:11 +02:00
|
|
|
Bool sigio_blocked = FALSE;
|
2012-06-26 20:32:31 +02:00
|
|
|
Bool want_hw_access = FALSE;
|
2012-03-21 20:55:09 +01:00
|
|
|
GDevPtr configured_device;
|
|
|
|
|
|
|
|
xf86Initialising = TRUE;
|
|
|
|
|
2012-05-06 18:13:02 +02:00
|
|
|
config_pre_init();
|
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
if (serverGeneration == 1) {
|
|
|
|
xf86PrintBanner();
|
2014-07-29 20:15:24 +02:00
|
|
|
LogPrintMarkers();
|
2012-03-21 20:55:09 +01:00
|
|
|
if (xf86LogFile) {
|
|
|
|
time_t t;
|
|
|
|
const char *ct;
|
|
|
|
|
|
|
|
t = time(NULL);
|
|
|
|
ct = ctime(&t);
|
|
|
|
xf86MsgVerb(xf86LogFileFrom, 0, "Log file: \"%s\", Time: %s",
|
|
|
|
xf86LogFile, ct);
|
|
|
|
}
|
2003-11-14 16:54:54 +01:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
/* Read and parse the config file */
|
|
|
|
if (!xf86DoConfigure && !xf86DoShowOptions) {
|
|
|
|
switch (xf86HandleConfigFile(FALSE)) {
|
|
|
|
case CONFIG_OK:
|
|
|
|
break;
|
|
|
|
case CONFIG_PARSE_ERROR:
|
|
|
|
xf86Msg(X_ERROR, "Error parsing the config file\n");
|
|
|
|
return;
|
|
|
|
case CONFIG_NOFILE:
|
|
|
|
autoconfig = TRUE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2003-11-14 17:49:22 +01:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
/* Initialise the loader */
|
|
|
|
LoaderInit();
|
2003-11-14 17:49:22 +01:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
/* Tell the loader the default module search path */
|
|
|
|
LoaderSetPath(xf86ModulePath);
|
2006-08-24 00:39:42 +02:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
if (xf86Info.ignoreABI) {
|
|
|
|
LoaderSetOptions(LDR_OPT_ABI_MISMATCH_NONFATAL);
|
|
|
|
}
|
2008-11-23 11:16:03 +01:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
if (xf86DoShowOptions)
|
|
|
|
DoShowOptions();
|
2003-11-14 17:49:22 +01:00
|
|
|
|
2013-12-04 11:10:06 +01:00
|
|
|
dbus_core_init();
|
2014-01-07 12:15:12 +01:00
|
|
|
systemd_logind_init();
|
2013-12-04 11:10:06 +01:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
/* Do a general bus probe. This will be a PCI probe for x86 platforms */
|
|
|
|
xf86BusProbe();
|
2003-11-14 17:49:22 +01:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
if (xf86DoConfigure)
|
|
|
|
DoConfigure();
|
|
|
|
|
|
|
|
if (autoconfig) {
|
|
|
|
if (!xf86AutoConfig()) {
|
|
|
|
xf86Msg(X_ERROR, "Auto configuration failed\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
2003-11-25 20:29:01 +01:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
xf86OSPMClose = xf86OSPMOpen();
|
2008-06-11 14:13:21 +02:00
|
|
|
|
2012-07-10 03:02:58 +02:00
|
|
|
xf86ExtensionInit();
|
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
/* Load all modules specified explicitly in the config file */
|
|
|
|
if ((modulelist = xf86ModulelistFromConfig(&optionlist))) {
|
|
|
|
xf86LoadModules(modulelist, optionlist);
|
|
|
|
free(modulelist);
|
|
|
|
free(optionlist);
|
|
|
|
}
|
2003-11-14 17:49:22 +01:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
/* Load all driver modules specified in the config file */
|
|
|
|
/* If there aren't any specified in the config file, autoconfig them */
|
|
|
|
/* FIXME: Does not handle multiple active screen sections, but I'm not
|
|
|
|
* sure if we really want to handle that case*/
|
|
|
|
configured_device = xf86ConfigLayout.screens->screen->device;
|
|
|
|
if ((!configured_device) || (!configured_device->driver)) {
|
|
|
|
if (!autoConfigDevice(configured_device)) {
|
|
|
|
xf86Msg(X_ERROR, "Automatic driver configuration failed\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if ((modulelist = xf86DriverlistFromConfig())) {
|
|
|
|
xf86LoadModules(modulelist, NULL);
|
|
|
|
free(modulelist);
|
2007-10-10 03:17:27 +02:00
|
|
|
}
|
2003-11-14 17:49:22 +01:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
/* Load all input driver modules specified in the config file. */
|
|
|
|
if ((modulelist = xf86InputDriverlistFromConfig())) {
|
|
|
|
xf86LoadModules(modulelist, NULL);
|
|
|
|
free(modulelist);
|
|
|
|
}
|
2003-11-14 16:54:54 +01:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
/*
|
|
|
|
* It is expected that xf86AddDriver()/xf86AddInputDriver will be
|
|
|
|
* called for each driver as it is loaded. Those functions save the
|
|
|
|
* module pointers for drivers.
|
|
|
|
* XXX Nothing keeps track of them for other modules.
|
|
|
|
*/
|
|
|
|
/* XXX What do we do if not all of these could be loaded? */
|
2003-11-14 16:54:54 +01:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
/*
|
|
|
|
* At this point, xf86DriverList[] is all filled in with entries for
|
|
|
|
* each of the drivers to try and xf86NumDrivers has the number of
|
|
|
|
* drivers. If there are none, return now.
|
|
|
|
*/
|
2003-11-14 17:49:22 +01:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
if (xf86NumDrivers == 0) {
|
|
|
|
xf86Msg(X_ERROR, "No drivers available.\n");
|
|
|
|
return;
|
|
|
|
}
|
2003-11-14 17:49:22 +01:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
/*
|
|
|
|
* Call each of the Identify functions and call the driverFunc to check
|
|
|
|
* if HW access is required. The Identify functions print out some
|
|
|
|
* identifying information, and anything else that might be
|
|
|
|
* needed at this early stage.
|
|
|
|
*/
|
2003-11-14 17:49:22 +01:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
for (i = 0; i < xf86NumDrivers; i++) {
|
2012-06-26 20:32:31 +02:00
|
|
|
xorgHWFlags flags = HW_IO;
|
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
if (xf86DriverList[i]->Identify != NULL)
|
|
|
|
xf86DriverList[i]->Identify(0);
|
2005-01-28 17:13:00 +01:00
|
|
|
|
2012-06-26 20:32:31 +02:00
|
|
|
if (xf86DriverList[i]->driverFunc)
|
|
|
|
xf86DriverList[i]->driverFunc(NULL,
|
|
|
|
GET_REQUIRED_HW_INTERFACES,
|
|
|
|
&flags);
|
2009-10-29 00:45:44 +01:00
|
|
|
|
2012-06-26 20:32:31 +02:00
|
|
|
if (NEED_IO_ENABLED(flags))
|
|
|
|
want_hw_access = TRUE;
|
2003-11-14 17:49:22 +01:00
|
|
|
|
2013-12-12 17:22:48 +01:00
|
|
|
/* Non-seat0 X servers should not open console */
|
|
|
|
if (!(flags & HW_SKIP_CONSOLE) && !ServerIsNotSeat0())
|
2012-06-26 20:32:31 +02:00
|
|
|
xorgHWOpenConsole = TRUE;
|
2012-03-21 20:55:09 +01:00
|
|
|
}
|
2003-11-14 17:49:22 +01:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
if (xorgHWOpenConsole)
|
|
|
|
xf86OpenConsole();
|
|
|
|
else
|
|
|
|
xf86Info.dontVTSwitch = TRUE;
|
2003-11-14 17:49:22 +01:00
|
|
|
|
2012-06-26 20:32:31 +02:00
|
|
|
/* Enable full I/O access */
|
|
|
|
if (want_hw_access)
|
|
|
|
xorgHWAccess = xf86EnableIO();
|
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
if (xf86BusConfig() == FALSE)
|
|
|
|
return;
|
2008-06-11 14:14:26 +02:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
xf86PostProbe();
|
2008-06-11 14:14:26 +02:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
/*
|
|
|
|
* Sort the drivers to match the requested ording. Using a slow
|
|
|
|
* bubble sort.
|
|
|
|
*/
|
|
|
|
for (j = 0; j < xf86NumScreens - 1; j++) {
|
|
|
|
for (i = 0; i < xf86NumScreens - j - 1; i++) {
|
|
|
|
if (xf86Screens[i + 1]->confScreen->screennum <
|
|
|
|
xf86Screens[i]->confScreen->screennum) {
|
|
|
|
ScrnInfoPtr tmpScrn = xf86Screens[i + 1];
|
|
|
|
|
|
|
|
xf86Screens[i + 1] = xf86Screens[i];
|
|
|
|
xf86Screens[i] = tmpScrn;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/* Fix up the indexes */
|
|
|
|
for (i = 0; i < xf86NumScreens; i++) {
|
|
|
|
xf86Screens[i]->scrnIndex = i;
|
|
|
|
}
|
2003-11-14 17:49:22 +01:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
/*
|
|
|
|
* Call the driver's PreInit()'s to complete initialisation for the first
|
|
|
|
* generation.
|
|
|
|
*/
|
2003-11-14 17:49:22 +01:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
for (i = 0; i < xf86NumScreens; i++) {
|
|
|
|
xf86VGAarbiterScrnInit(xf86Screens[i]);
|
|
|
|
xf86VGAarbiterLock(xf86Screens[i]);
|
|
|
|
if (xf86Screens[i]->PreInit &&
|
|
|
|
xf86Screens[i]->PreInit(xf86Screens[i], 0))
|
|
|
|
xf86Screens[i]->configured = TRUE;
|
|
|
|
xf86VGAarbiterUnlock(xf86Screens[i]);
|
|
|
|
}
|
|
|
|
for (i = 0; i < xf86NumScreens; i++)
|
|
|
|
if (!xf86Screens[i]->configured)
|
api: rework the X server driver API to avoid global arrays.
This is a squash merge containing all the API changes, as
well as the video ABI bump.
Its been squashed to make bisection easier.
Full patch log below:
commit b202738bbf0c5a1c1172767119c2c71f1e7f8070
Author: Aaron Plattner <aplattner@nvidia.com>
Date: Mon May 14 15:16:11 2012 -0700
xfree86: Bump video ABI to 13.0
The ABI was broken by changes to convert from screen index numbers to ScreenPtr
/ ScrnInfoPtr in various structures and function signatures.
Signed-off-by: Aaron Plattner <aplattner@nvidia.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
commit 3d5f7d9f8d408bcad3f83277d255f25d3b0edbf3
Author: Dave Airlie <airlied@redhat.com>
Date: Thu May 24 10:56:57 2012 +0100
xf86: xf86ClearEntityListForScreen should take a pScrn
When adding GPU screens this make life easier.
(also fix comment, as pointed out by Alan)
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Dave Airlie <airlied@redhat.com>
commit afee8b5ab4501597ecc1ade34124d7ca227ab055
Author: Dave Airlie <airlied@redhat.com>
Date: Thu May 24 07:07:32 2012 +0100
xf86i2c: add pscrn for drivers to use
This just adds a pScrn pointer into the struct for the drivers to use
instead of scrnIndex. Mostly scrnIndex is used for logging, but some
drivers use it to lookup xf86Screens, so let them stash a pScrn instead.
Removing the scrnIndex is a bit more involved and I'm not sure its worth
the effort. Doing i2c in the X server is legacy code as far as I'm concerned.
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
commit ea5092f1f679691d187f1eee9427e6057beec56e
Author: Dave Airlie <airlied@redhat.com>
Date: Wed May 23 19:25:20 2012 +0100
dix/gc: consolidate GC object creation in one place
The standard GC create and scratch GC create were 90% the same really,
and I have a need in the future for creating GC objects without the
other bits, so wanted to avoid a third copy.
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
commit 3d91482ea9b4883e64e496f2768168e0ffa21ba1
Author: Dave Airlie <airlied@redhat.com>
Date: Wed May 23 10:24:06 2012 +0100
xf86: add a define to denote the new non-index interfaces are being used
This can be used by drivers to provide compatible APIs.
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
commit 37c3ae3e6cd4f3dedc72f371096d6743f8f99df3
Author: Dave Airlie <airlied@redhat.com>
Date: Wed May 23 15:09:12 2012 +0100
dix: make Create/Free scratch pixmaps take a ScreenPtr
While technically an API/ABI change I doubt anyone uses it,
but it helps in splitting screens up.
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
commit 75f2062a3fe94f04764ecc7d2ff2fbbeccb9da60
Author: Dave Airlie <airlied@redhat.com>
Date: Wed May 23 14:57:55 2012 +0100
xf86/xv: remove scrnIndexfrom xf86FindXvOptions.
Move this interface to taking an ScrnInfoPtr.
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
commit f80c2374f40ea7b2ee0556e2e76cc07406f3d843
Author: Dave Airlie <airlied@redhat.com>
Date: Wed May 23 14:53:59 2012 +0100
xf86: make xf86DeleteScreen take a ScrnInfoPtr (v2)
stop passing indices into this function.
v2: drop flags argument.
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
commit 58824e414f35682435f15bfe6c4b656bd90b9235
Author: Dave Airlie <airlied@redhat.com>
Date: Wed May 23 14:48:09 2012 +0100
xf86: fix xf86IsScreenPrimary interface to take a pScrn (API/ABI)
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
commit 6b4fc1f9d391bcdf7ca288766e49bce60f4635cd
Author: Dave Airlie <airlied@gmail.com>
Date: Tue Apr 10 14:18:59 2012 +0100
xserver: convert block/wakeup handlers to passing ScreenPtr (ABI/API) (v2)
Instead of passing an index, pass the actual ScreenPtr. This allows
more moving towards not abusing xf86Screens + screenInfo.
v2: drop the blockData/wakeupData args as per ajax's suggestion.,
fix docs.
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
commit 790d003de20fb47674420a24dadd92412d78620d
Author: Dave Airlie <airlied@gmail.com>
Date: Wed Apr 11 09:53:14 2012 +0100
xf86/common: remove some more pScrn->pScreen uses
remove some more conversions that appeared after api cleanups.
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Acked-by: Aaron Plattner <aplattner@nvidia.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
commit aac85e18d1dd093f2cad6bd29375e40bd7af0b8f
Author: Dave Airlie <airlied@gmail.com>
Date: Tue Apr 10 16:34:53 2012 +0100
ddc: change API to take ScrnInfoPtr (v2)
This removes all xf86Screens usage from ddc code,
it modifies the API for some functions to avoid taking indices.
v2: address Alan's comments about dropping DDC2Init parameter.
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Acked-by: Aaron Plattner <aplattner@nvidia.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
commit fe3f57b6eaf6860a33876a54f9439f69578f03a5
Author: Dave Airlie <airlied@gmail.com>
Date: Tue Apr 10 16:31:26 2012 +0100
vbe: don't use index for VBEInterpretPanelID (API)
Remove use of xf86screens from vbe module.
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Acked-by: Aaron Plattner <aplattner@nvidia.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
commit abf1965f4ed91529036d3fdb470d6a3ce6f29675
Author: Dave Airlie <airlied@gmail.com>
Date: Tue Apr 10 16:25:11 2012 +0100
int10/vbe: don't use xf86Screens. (ABI) (v3)
Pass the ScrnInfoPtr instead of the index in the int10 struct.
This saves us using it to dereference xf86Screens.
v2: address Alan's comment to fix struct alignment.
v3: squash in all the int10 fixes, test the vm86 code builds,
after comments by Keith.
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Acked-by: Aaron Plattner <aplattner@nvidia.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
commit 23cca612b4fb5efc33683c7624b803b457387e3d
Author: Dave Airlie <airlied@gmail.com>
Date: Tue Apr 10 15:30:18 2012 +0100
xserver: drop index argument to ScreenInit (ABI/API) (v2)
This drops the index argument, its the same as pScreen->myNum,
and its the last major index abuse I can find.
v2: address Alan's review - update docs, fix xwin/xnest/darwin
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Acked-by: Aaron Plattner <aplattner@nvidia.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
commit 40d360e2d7e832407f3ed64e3a02c27ecc89a960
Author: Dave Airlie <airlied@gmail.com>
Date: Tue Apr 10 15:23:01 2012 +0100
xf86: migrate PointerMoved from index to ScrnInfoPtr (ABI/API)
This migrates PointerMoved from an index to ScrnInfoPtr.
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Acked-by: Aaron Plattner <aplattner@nvidia.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
commit aa60a2f38679d0eeb979a9c2648c9bc771409bf9
Author: Dave Airlie <airlied@gmail.com>
Date: Tue Apr 10 15:20:46 2012 +0100
xf86: migrate PMEvent to a ScrnInfoPtr (ABI/API)
This migrates the PMEvent from index to ScrnInfoPtr.
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Acked-by: Aaron Plattner <aplattner@nvidia.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
commit d3f28ef44371ed4a039ffc5dd7eb6408d1269ba2
Author: Dave Airlie <airlied@gmail.com>
Date: Tue Apr 10 15:18:30 2012 +0100
xf86: migrate SetDGAMode from index to ScrnInfoPtr (ABI/API)
This migrates the SetDGAMode callback from an index to ScrnInfoPtr.
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Acked-by: Aaron Plattner <aplattner@nvidia.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
commit baf5e4818a74f2b68c3dfdcc56f54322351039a0
Author: Dave Airlie <airlied@gmail.com>
Date: Tue Apr 10 15:14:11 2012 +0100
xf86: migrate ChangeGamma from index to ScrnInfoPtr (ABI/API) (v2)
This migrates the ChangeGamma interface to avoid passing a index.
v2: fix xf86RandR12.c + xf86cmap.c call
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Acked-by: Aaron Plattner <aplattner@nvidia.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
commit 51e5f90ada929d6b23176090badbb42fdb3fa550
Author: Dave Airlie <airlied@gmail.com>
Date: Tue Apr 10 15:11:09 2012 +0100
xf86/exa: migrate index to screen types for EnableDisableFBAccess (ABI/API)
The EXA interface migrates to ScreenPtr,
and the xf86 interface migrated to ScrnInfoPtr.
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Acked-by: Aaron Plattner <aplattner@nvidia.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
commit 94f1f21d17e86f96d4a54292a399160950087675
Author: Dave Airlie <airlied@gmail.com>
Date: Tue Apr 10 15:02:11 2012 +0100
xf86: migrate ValidMode callback to ScrnInfoPtr (ABI/API)
This migrates the ValidMode to passing a ScrnInfoPtr instead
of an index.
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Acked-by: Aaron Plattner <aplattner@nvidia.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
commit 3f8f18198fed4f39ec805b508a3482e91eea26b2
Author: Dave Airlie <airlied@gmail.com>
Date: Tue Apr 10 14:59:46 2012 +0100
xf86: migrate SwitchMode to taking ScrnInfoPtr (ABI/API) (v2)
This migrate the SwitchMode interface to take a ScrnInfoPtr
instead of an index.
v2: drop flags.
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Acked-by: Aaron Plattner <aplattner@nvidia.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
commit d06a038a5c49328ab3a8d969d24f9fcd22c63202
Author: Dave Airlie <airlied@gmail.com>
Date: Tue Apr 10 14:50:37 2012 +0100
xf86: move AdjustFrame to passing ScrnInfoPtr (ABI/API) (v2)
This converts AdjustFrame code paths to passing a ScrnInfoPtr
instead of an integer index.
v2: drop flags args.
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Acked-by: Aaron Plattner <aplattner@nvidia.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
commit 53d2f8608ffd4090d08e7d5cf2e92fb954959b90
Author: Dave Airlie <airlied@gmail.com>
Date: Tue Apr 10 14:41:27 2012 +0100
xf86: modify FreeScreen callback to take pScrn instead of index. (ABI/API) (v2)
Another index->pScrn conversion.
v2: drop flags arg.
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Acked-by: Aaron Plattner <aplattner@nvidia.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
commit 60db37c0b247052e0f5c54b1921fe58a3609c2e3
Author: Dave Airlie <airlied@gmail.com>
Date: Tue Apr 10 14:35:41 2012 +0100
xf86: change EnterVT/LeaveVT to take a ScrnInfoPtr (ABI/API break) (v2)
This modifies the EnterVT/LeaveVT interfaces to take a ScrnInfoPtr
instead of an index into xf86Screens. This allows dropping more
public dereferences of the xf86Screens and screenInfo.
v2: drop flags args as suggested by Keith, fix docs.
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Acked-by: Aaron Plattner <aplattner@nvidia.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
commit 06729dbbc804a20242e6499f446acb5d94023c3c
Author: Dave Airlie <airlied@gmail.com>
Date: Tue Apr 10 14:04:59 2012 +0100
xserver: remove index from CloseScreen (API/ABI breakage)
This drops the index from the CloseScreen callback,
its always been useless really, since the pScreen contains it.
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Acked-by: Aaron Plattner <aplattner@nvidia.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-06-05 14:22:18 +02:00
|
|
|
xf86DeleteScreen(xf86Screens[i--]);
|
2003-11-14 17:49:22 +01:00
|
|
|
|
2012-06-05 18:18:10 +02:00
|
|
|
for (i = 0; i < xf86NumGPUScreens; i++) {
|
|
|
|
xf86VGAarbiterScrnInit(xf86GPUScreens[i]);
|
|
|
|
xf86VGAarbiterLock(xf86GPUScreens[i]);
|
|
|
|
if (xf86GPUScreens[i]->PreInit &&
|
|
|
|
xf86GPUScreens[i]->PreInit(xf86GPUScreens[i], 0))
|
|
|
|
xf86GPUScreens[i]->configured = TRUE;
|
|
|
|
xf86VGAarbiterUnlock(xf86GPUScreens[i]);
|
|
|
|
}
|
|
|
|
for (i = 0; i < xf86NumGPUScreens; i++)
|
|
|
|
if (!xf86GPUScreens[i]->configured)
|
|
|
|
xf86DeleteScreen(xf86GPUScreens[i--]);
|
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
/*
|
|
|
|
* If no screens left, return now.
|
|
|
|
*/
|
2003-11-14 17:49:22 +01:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
if (xf86NumScreens == 0) {
|
|
|
|
xf86Msg(X_ERROR,
|
|
|
|
"Screen(s) found, but none have a usable configuration.\n");
|
|
|
|
return;
|
|
|
|
}
|
2003-11-14 17:49:22 +01:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
/* Remove (unload) drivers that are not required */
|
|
|
|
for (i = 0; i < xf86NumDrivers; i++)
|
|
|
|
if (xf86DriverList[i] && xf86DriverList[i]->refCount <= 0)
|
|
|
|
xf86DeleteDriver(i);
|
2003-11-14 17:49:22 +01:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
/*
|
|
|
|
* At this stage we know how many screens there are.
|
|
|
|
*/
|
|
|
|
|
|
|
|
for (i = 0; i < xf86NumScreens; i++)
|
|
|
|
xf86InitViewport(xf86Screens[i]);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Collect all pixmap formats and check for conflicts at the display
|
|
|
|
* level. Should we die here? Or just delete the offending screens?
|
|
|
|
*/
|
|
|
|
for (i = 0; i < xf86NumScreens; i++) {
|
|
|
|
if (xf86Screens[i]->imageByteOrder !=
|
|
|
|
xf86Screens[0]->imageByteOrder)
|
|
|
|
FatalError("Inconsistent display bitmapBitOrder. Exiting\n");
|
|
|
|
if (xf86Screens[i]->bitmapScanlinePad !=
|
|
|
|
xf86Screens[0]->bitmapScanlinePad)
|
|
|
|
FatalError
|
|
|
|
("Inconsistent display bitmapScanlinePad. Exiting\n");
|
|
|
|
if (xf86Screens[i]->bitmapScanlineUnit !=
|
|
|
|
xf86Screens[0]->bitmapScanlineUnit)
|
|
|
|
FatalError
|
|
|
|
("Inconsistent display bitmapScanlineUnit. Exiting\n");
|
|
|
|
if (xf86Screens[i]->bitmapBitOrder !=
|
|
|
|
xf86Screens[0]->bitmapBitOrder)
|
|
|
|
FatalError("Inconsistent display bitmapBitOrder. Exiting\n");
|
|
|
|
}
|
2011-07-18 21:19:23 +02:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
/* Collect additional formats */
|
2011-07-18 21:19:23 +02:00
|
|
|
for (i = 0; i < xf86NumScreens; i++) {
|
2012-03-21 20:55:09 +01:00
|
|
|
for (j = 0; j < xf86Screens[i]->numFormats; j++) {
|
|
|
|
for (k = 0;; k++) {
|
|
|
|
if (k >= numFormats) {
|
|
|
|
if (k >= MAXFORMATS)
|
|
|
|
FatalError("Too many pixmap formats! Exiting\n");
|
|
|
|
formats[k] = xf86Screens[i]->formats[j];
|
|
|
|
numFormats++;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (formats[k].depth == xf86Screens[i]->formats[j].depth) {
|
|
|
|
if ((formats[k].bitsPerPixel ==
|
|
|
|
xf86Screens[i]->formats[j].bitsPerPixel) &&
|
|
|
|
(formats[k].scanlinePad ==
|
|
|
|
xf86Screens[i]->formats[j].scanlinePad))
|
|
|
|
break;
|
|
|
|
FatalError("Inconsistent pixmap format for depth %d."
|
|
|
|
" Exiting\n", formats[k].depth);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
formatsDone = TRUE;
|
2011-07-18 21:19:23 +02:00
|
|
|
}
|
2012-03-21 20:55:09 +01:00
|
|
|
else {
|
|
|
|
/*
|
|
|
|
* serverGeneration != 1; some OSs have to do things here, too.
|
|
|
|
*/
|
|
|
|
if (xorgHWOpenConsole)
|
|
|
|
xf86OpenConsole();
|
2011-07-18 21:19:23 +02:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
/*
|
|
|
|
should we reopen it here? We need to deal with an already opened
|
|
|
|
device. We could leave this to the OS layer. For now we simply
|
|
|
|
close it here
|
|
|
|
*/
|
|
|
|
if (xf86OSPMClose)
|
|
|
|
xf86OSPMClose();
|
|
|
|
if ((xf86OSPMClose = xf86OSPMOpen()) != NULL)
|
|
|
|
xf86MsgVerb(X_INFO, 3, "APM registered successfully\n");
|
|
|
|
|
|
|
|
/* Make sure full I/O access is enabled */
|
|
|
|
if (xorgHWAccess)
|
|
|
|
xf86EnableIO();
|
2003-11-14 17:49:22 +01:00
|
|
|
}
|
2012-03-21 20:55:09 +01:00
|
|
|
|
2016-01-05 22:27:41 +01:00
|
|
|
if (xf86Info.vtno >= 0)
|
|
|
|
AddCallback(&RootWindowFinalizeCallback, AddVTAtoms, NULL);
|
|
|
|
|
2016-01-05 22:11:42 +01:00
|
|
|
if (SeatId)
|
|
|
|
AddCallback(&RootWindowFinalizeCallback, AddSeatId, SeatId);
|
|
|
|
|
2003-11-14 16:54:54 +01:00
|
|
|
/*
|
2012-03-21 20:55:09 +01:00
|
|
|
* Use the previously collected parts to setup pScreenInfo
|
2003-11-14 16:54:54 +01:00
|
|
|
*/
|
2003-11-14 17:49:22 +01:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
pScreenInfo->imageByteOrder = xf86Screens[0]->imageByteOrder;
|
|
|
|
pScreenInfo->bitmapScanlinePad = xf86Screens[0]->bitmapScanlinePad;
|
|
|
|
pScreenInfo->bitmapScanlineUnit = xf86Screens[0]->bitmapScanlineUnit;
|
|
|
|
pScreenInfo->bitmapBitOrder = xf86Screens[0]->bitmapBitOrder;
|
|
|
|
pScreenInfo->numPixmapFormats = numFormats;
|
|
|
|
for (i = 0; i < numFormats; i++)
|
|
|
|
pScreenInfo->formats[i] = formats[i];
|
2003-11-14 17:49:22 +01:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
/* Make sure the server's VT is active */
|
|
|
|
|
|
|
|
if (serverGeneration != 1) {
|
|
|
|
xf86Resetting = TRUE;
|
|
|
|
/* All screens are in the same state, so just check the first */
|
2013-04-10 08:32:11 +02:00
|
|
|
if (!xf86VTOwner()) {
|
2003-11-14 16:54:54 +01:00
|
|
|
#ifdef HAS_USL_VTS
|
2012-03-21 20:55:09 +01:00
|
|
|
ioctl(xf86Info.consoleFd, VT_RELDISP, VT_ACKACQ);
|
2003-11-14 16:54:54 +01:00
|
|
|
#endif
|
2015-12-08 23:39:46 +01:00
|
|
|
input_lock();
|
2012-07-10 01:33:11 +02:00
|
|
|
sigio_blocked = TRUE;
|
2012-03-21 20:55:09 +01:00
|
|
|
}
|
2008-06-11 14:14:26 +02:00
|
|
|
}
|
2012-03-21 20:55:09 +01:00
|
|
|
|
|
|
|
for (i = 0; i < xf86NumScreens; i++)
|
|
|
|
if (!xf86ColormapAllocatePrivates(xf86Screens[i]))
|
|
|
|
FatalError("Cannot register DDX private keys");
|
|
|
|
|
2016-01-06 15:09:21 +01:00
|
|
|
if (!dixRegisterPrivateKey(&xf86ScreenKeyRec, PRIVATE_SCREEN, 0))
|
2012-03-21 20:55:09 +01:00
|
|
|
FatalError("Cannot register DDX private keys");
|
|
|
|
|
2012-06-05 18:18:10 +02:00
|
|
|
for (i = 0; i < xf86NumGPUScreens; i++) {
|
|
|
|
ScrnInfoPtr pScrn = xf86GPUScreens[i];
|
|
|
|
xf86VGAarbiterLock(pScrn);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Almost everything uses these defaults, and many of those that
|
|
|
|
* don't, will wrap them.
|
|
|
|
*/
|
|
|
|
pScrn->EnableDisableFBAccess = xf86EnableDisableFBAccess;
|
|
|
|
#ifdef XFreeXDGA
|
|
|
|
pScrn->SetDGAMode = xf86SetDGAMode;
|
|
|
|
#endif
|
2016-07-30 02:45:45 +02:00
|
|
|
scr_index = AddGPUScreen(xf86ScreenInit, argc, argv);
|
2012-06-05 18:18:10 +02:00
|
|
|
xf86VGAarbiterUnlock(pScrn);
|
|
|
|
if (scr_index == i) {
|
|
|
|
dixSetPrivate(&screenInfo.gpuscreens[scr_index]->devPrivates,
|
|
|
|
xf86ScreenKey, xf86GPUScreens[i]);
|
|
|
|
pScrn->pScreen = screenInfo.gpuscreens[scr_index];
|
|
|
|
/* The driver should set this, but make sure it is set anyway */
|
|
|
|
pScrn->vtSema = TRUE;
|
|
|
|
} else {
|
|
|
|
FatalError("AddScreen/ScreenInit failed for gpu driver %d %d\n", i, scr_index);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
for (i = 0; i < xf86NumScreens; i++) {
|
|
|
|
xf86VGAarbiterLock(xf86Screens[i]);
|
|
|
|
/*
|
|
|
|
* Almost everything uses these defaults, and many of those that
|
|
|
|
* don't, will wrap them.
|
|
|
|
*/
|
|
|
|
xf86Screens[i]->EnableDisableFBAccess = xf86EnableDisableFBAccess;
|
2009-01-05 10:23:39 +01:00
|
|
|
#ifdef XFreeXDGA
|
2012-03-21 20:55:09 +01:00
|
|
|
xf86Screens[i]->SetDGAMode = xf86SetDGAMode;
|
2009-01-05 10:23:39 +01:00
|
|
|
#endif
|
2016-07-30 02:45:45 +02:00
|
|
|
scr_index = AddScreen(xf86ScreenInit, argc, argv);
|
2012-03-21 20:55:09 +01:00
|
|
|
xf86VGAarbiterUnlock(xf86Screens[i]);
|
|
|
|
if (scr_index == i) {
|
|
|
|
/*
|
|
|
|
* Hook in our ScrnInfoRec, and initialise some other pScreen
|
|
|
|
* fields.
|
|
|
|
*/
|
|
|
|
dixSetPrivate(&screenInfo.screens[scr_index]->devPrivates,
|
|
|
|
xf86ScreenKey, xf86Screens[i]);
|
|
|
|
xf86Screens[i]->pScreen = screenInfo.screens[scr_index];
|
|
|
|
/* The driver should set this, but make sure it is set anyway */
|
|
|
|
xf86Screens[i]->vtSema = TRUE;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
/* This shouldn't normally happen */
|
|
|
|
FatalError("AddScreen/ScreenInit failed for driver %d\n", i);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (PictureGetSubpixelOrder(xf86Screens[i]->pScreen) == SubPixelUnknown) {
|
|
|
|
xf86MonPtr DDC = (xf86MonPtr) (xf86Screens[i]->monitor->DDC);
|
|
|
|
|
|
|
|
PictureSetSubpixelOrder(xf86Screens[i]->pScreen,
|
|
|
|
DDC ?
|
|
|
|
(DDC->features.input_type ?
|
|
|
|
SubPixelHorizontalRGB : SubPixelNone) :
|
|
|
|
SubPixelUnknown);
|
|
|
|
}
|
2018-01-24 21:40:22 +01:00
|
|
|
|
|
|
|
/*
|
|
|
|
* If the driver hasn't set up its own RANDR support, install the
|
|
|
|
* fallback support.
|
|
|
|
*/
|
|
|
|
xf86EnsureRANDR(xf86Screens[i]->pScreen);
|
2012-03-21 20:55:09 +01:00
|
|
|
}
|
2003-11-14 16:54:54 +01:00
|
|
|
|
2012-06-13 15:32:05 +02:00
|
|
|
for (i = 0; i < xf86NumGPUScreens; i++)
|
|
|
|
AttachUnboundGPU(xf86Screens[0]->pScreen, xf86GPUScreens[i]->pScreen);
|
|
|
|
|
2012-08-17 01:49:24 +02:00
|
|
|
xf86AutoConfigOutputDevices();
|
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
xf86VGAarbiterWrapFunctions();
|
2012-07-10 01:33:11 +02:00
|
|
|
if (sigio_blocked)
|
2015-12-08 23:39:46 +01:00
|
|
|
input_unlock();
|
2003-11-14 17:49:22 +01:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
xf86InitOrigins();
|
2003-11-14 17:49:22 +01:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
xf86Resetting = FALSE;
|
|
|
|
xf86Initialising = FALSE;
|
2003-11-14 17:49:22 +01:00
|
|
|
|
2015-09-02 03:51:14 +02:00
|
|
|
RegisterBlockAndWakeupHandlers((ServerBlockHandlerProcPtr) NoopDDA, xf86Wakeup,
|
2012-03-21 20:55:09 +01:00
|
|
|
NULL);
|
2003-11-14 17:49:22 +01:00
|
|
|
}
|
|
|
|
|
2011-07-04 06:14:11 +02:00
|
|
|
/**
|
|
|
|
* Initialize all supported input devices present and referenced in the
|
|
|
|
* xorg.conf.
|
2003-11-14 16:54:54 +01:00
|
|
|
*/
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
void
|
2009-01-11 08:33:18 +01:00
|
|
|
InitInput(int argc, char **argv)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
InputInfoPtr *pInfo;
|
2008-11-21 03:02:02 +01:00
|
|
|
DeviceIntPtr dev;
|
2003-11-14 17:49:22 +01:00
|
|
|
|
|
|
|
xf86Info.vtRequestsPending = FALSE;
|
2003-11-14 16:54:54 +01:00
|
|
|
|
2015-12-08 23:53:08 +01:00
|
|
|
/* Enable threaded input */
|
|
|
|
InputThreadPreInit();
|
|
|
|
|
2008-12-08 03:12:39 +01:00
|
|
|
mieqInit();
|
|
|
|
|
2011-02-15 22:56:58 +01:00
|
|
|
/* Initialize all configured input devices */
|
2011-07-04 06:14:39 +02:00
|
|
|
for (pInfo = xf86ConfigLayout.inputs; pInfo && *pInfo; pInfo++) {
|
2012-03-21 20:55:09 +01:00
|
|
|
(*pInfo)->options =
|
|
|
|
xf86AddNewOption((*pInfo)->options, "driver", (*pInfo)->driver);
|
|
|
|
(*pInfo)->options =
|
|
|
|
xf86AddNewOption((*pInfo)->options, "identifier", (*pInfo)->name);
|
2008-11-26 05:15:04 +01:00
|
|
|
/* If one fails, the others will too */
|
2011-08-05 06:48:02 +02:00
|
|
|
if (NewInputDeviceRequest((*pInfo)->options, NULL, &dev) == BadAlloc)
|
2008-11-26 05:15:04 +01:00
|
|
|
break;
|
2003-11-14 17:49:22 +01:00
|
|
|
}
|
2010-01-15 06:22:02 +01:00
|
|
|
|
|
|
|
config_init();
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2012-03-21 20:55:09 +01:00
|
|
|
CloseInput(void)
|
2010-01-15 06:22:02 +01:00
|
|
|
{
|
|
|
|
config_fini();
|
2011-06-27 01:10:42 +02:00
|
|
|
mieqFini();
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* OsVendorInit --
|
|
|
|
* OS/Vendor-specific initialisations. Called from OsInit(), which
|
|
|
|
* is called by dix before establishing the well known sockets.
|
|
|
|
*/
|
2008-06-11 14:13:21 +02:00
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
void
|
2009-01-11 08:33:18 +01:00
|
|
|
OsVendorInit(void)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
static Bool beenHere = FALSE;
|
2003-11-14 17:49:22 +01:00
|
|
|
|
2016-06-07 21:52:11 +02:00
|
|
|
OsSignal(SIGCHLD, SIG_DFL); /* Need to wait for child processes */
|
2003-11-14 16:54:54 +01:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
if (!beenHere) {
|
|
|
|
umask(022);
|
|
|
|
xf86LogInit();
|
|
|
|
}
|
2003-11-14 16:54:54 +01:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
/* Set stderr to non-blocking. */
|
2003-11-14 17:49:22 +01:00
|
|
|
#ifndef O_NONBLOCK
|
|
|
|
#if defined(FNDELAY)
|
|
|
|
#define O_NONBLOCK FNDELAY
|
|
|
|
#elif defined(O_NDELAY)
|
|
|
|
#define O_NONBLOCK O_NDELAY
|
|
|
|
#endif
|
2003-11-14 16:54:54 +01:00
|
|
|
|
2003-11-14 17:49:22 +01:00
|
|
|
#ifdef O_NONBLOCK
|
2012-03-21 20:55:09 +01:00
|
|
|
if (!beenHere) {
|
2018-03-13 22:46:36 +01:00
|
|
|
if (PrivsElevated()) {
|
2012-03-21 20:55:09 +01:00
|
|
|
int status;
|
2003-11-14 16:54:54 +01:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
status = fcntl(fileno(stderr), F_GETFL, 0);
|
|
|
|
if (status != -1) {
|
|
|
|
fcntl(fileno(stderr), F_SETFL, status | O_NONBLOCK);
|
|
|
|
}
|
|
|
|
}
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
2003-11-14 17:49:22 +01:00
|
|
|
#endif
|
2003-11-14 16:54:54 +01:00
|
|
|
#endif
|
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
beenHere = TRUE;
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* ddxGiveUp --
|
|
|
|
* Device dependent cleanup. Called by by dix before normal server death.
|
|
|
|
* For SYSV386 we must switch the terminal back to normal mode. No error-
|
|
|
|
* checking here, since there should be restored as much as possible.
|
|
|
|
*/
|
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
void
|
2011-07-20 05:09:05 +02:00
|
|
|
ddxGiveUp(enum ExitCode error)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
2003-11-14 17:49:22 +01:00
|
|
|
int i;
|
2009-09-10 16:52:32 +02:00
|
|
|
|
2017-11-20 20:28:13 +01:00
|
|
|
if (error == EXIT_ERR_ABORT) {
|
|
|
|
input_lock();
|
|
|
|
|
|
|
|
/* try to restore the original video state */
|
|
|
|
#ifdef DPMSExtension /* Turn screens back on */
|
|
|
|
if (DPMSPowerLevel != DPMSModeOn)
|
|
|
|
DPMSSet(serverClient, DPMSModeOn);
|
|
|
|
#endif
|
|
|
|
if (xf86Screens) {
|
|
|
|
for (i = 0; i < xf86NumScreens; i++)
|
|
|
|
if (xf86Screens[i]->vtSema) {
|
|
|
|
/*
|
|
|
|
* if we are aborting before ScreenInit() has finished we
|
|
|
|
* might not have been wrapped yet. Therefore enable screen
|
|
|
|
* explicitly.
|
|
|
|
*/
|
|
|
|
xf86VGAarbiterLock(xf86Screens[i]);
|
|
|
|
(xf86Screens[i]->LeaveVT) (xf86Screens[i]);
|
|
|
|
xf86VGAarbiterUnlock(xf86Screens[i]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-09-10 16:52:32 +02:00
|
|
|
xf86VGAarbiterFini();
|
2003-11-14 17:49:22 +01:00
|
|
|
|
|
|
|
if (xf86OSPMClose)
|
2012-03-21 20:55:09 +01:00
|
|
|
xf86OSPMClose();
|
2003-11-14 17:49:22 +01:00
|
|
|
xf86OSPMClose = NULL;
|
|
|
|
|
|
|
|
for (i = 0; i < xf86NumScreens; i++) {
|
2012-03-21 20:55:09 +01:00
|
|
|
/*
|
|
|
|
* zero all access functions to
|
|
|
|
* trap calls when switched away.
|
|
|
|
*/
|
|
|
|
xf86Screens[i]->vtSema = FALSE;
|
2003-11-14 17:49:22 +01:00
|
|
|
}
|
|
|
|
|
2009-10-29 00:45:44 +01:00
|
|
|
if (xorgHWOpenConsole)
|
2012-03-21 20:55:09 +01:00
|
|
|
xf86CloseConsole();
|
2003-11-14 16:54:54 +01:00
|
|
|
|
2014-01-07 12:15:12 +01:00
|
|
|
systemd_logind_fini();
|
2013-12-04 11:10:06 +01:00
|
|
|
dbus_core_fini();
|
|
|
|
|
2011-07-20 05:09:05 +02:00
|
|
|
xf86CloseLog(error);
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
void
|
2012-02-17 21:35:02 +01:00
|
|
|
OsVendorFatalError(const char *f, va_list args)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
2004-04-23 21:54:30 +02:00
|
|
|
#ifdef VENDORSUPPORT
|
2012-04-09 18:41:38 +02:00
|
|
|
ErrorFSigSafe("\nPlease refer to your Operating System Vendor support "
|
|
|
|
"pages\nat %s for support on this crash.\n", VENDORSUPPORT);
|
2004-04-23 21:54:30 +02:00
|
|
|
#else
|
2012-04-09 18:41:38 +02:00
|
|
|
ErrorFSigSafe("\nPlease consult the " XVENDORNAME " support \n\t at "
|
|
|
|
__VENDORDWEBSUPPORT__ "\n for help. \n");
|
2004-04-23 21:54:30 +02:00
|
|
|
#endif
|
|
|
|
if (xf86LogFile && xf86LogFileWasOpened)
|
2012-04-09 18:41:38 +02:00
|
|
|
ErrorFSigSafe("Please also check the log file at \"%s\" for additional "
|
|
|
|
"information.\n", xf86LogFile);
|
|
|
|
ErrorFSigSafe("\n");
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
int
|
2003-11-25 20:29:01 +01:00
|
|
|
xf86SetVerbosity(int verb)
|
|
|
|
{
|
|
|
|
int save = xf86Verbose;
|
|
|
|
|
|
|
|
xf86Verbose = verb;
|
|
|
|
LogSetParameter(XLOG_VERBOSITY, verb);
|
|
|
|
return save;
|
|
|
|
}
|
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
int
|
2003-11-25 20:29:01 +01:00
|
|
|
xf86SetLogVerbosity(int verb)
|
|
|
|
{
|
|
|
|
int save = xf86LogVerbose;
|
|
|
|
|
|
|
|
xf86LogVerbose = verb;
|
|
|
|
LogSetParameter(XLOG_FILE_VERBOSITY, verb);
|
|
|
|
return save;
|
|
|
|
}
|
|
|
|
|
2008-06-12 00:05:04 +02:00
|
|
|
static void
|
|
|
|
xf86PrintDefaultModulePath(void)
|
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
ErrorF("%s\n", DEFAULT_MODULE_PATH);
|
2008-06-12 00:05:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
xf86PrintDefaultLibraryPath(void)
|
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
ErrorF("%s\n", DEFAULT_LIBRARY_PATH);
|
2008-06-12 00:05:04 +02:00
|
|
|
}
|
|
|
|
|
2016-05-03 00:47:20 +02:00
|
|
|
static void
|
|
|
|
xf86CheckPrivs(const char *option, const char *arg)
|
|
|
|
{
|
2018-03-13 22:46:36 +01:00
|
|
|
if (PrivsElevated() && !xf86PathIsSafe(arg)) {
|
2016-05-03 00:47:20 +02:00
|
|
|
FatalError("\nInvalid argument for %s - \"%s\"\n"
|
|
|
|
"\tWith elevated privileges %s must specify a relative path\n"
|
|
|
|
"\twithout any \"..\" elements.\n\n", option, arg, option);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-11-14 16:54:54 +01:00
|
|
|
/*
|
|
|
|
* ddxProcessArgument --
|
|
|
|
* Process device-dependent command line args. Returns 0 if argument is
|
|
|
|
* not device dependent, otherwise Count of number of elements of argv
|
|
|
|
* that are part of a device dependent commandline option.
|
2003-11-14 17:49:22 +01:00
|
|
|
*
|
2003-11-14 16:54:54 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
/* ARGSUSED */
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
int
|
2003-11-14 17:49:22 +01:00
|
|
|
ddxProcessArgument(int argc, char **argv, int i)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
/* First the options that are not allowed with elevated privileges */
|
2016-05-03 00:47:21 +02:00
|
|
|
if (!strcmp(argv[i], "-modulepath")) {
|
2018-10-23 20:28:21 +02:00
|
|
|
CHECK_FOR_REQUIRED_ARGUMENTS(1);
|
2018-10-23 21:29:08 +02:00
|
|
|
if (xf86PrivsElevated())
|
|
|
|
FatalError("\nInvalid argument -modulepath "
|
|
|
|
"with elevated privileges\n");
|
2016-05-03 00:47:22 +02:00
|
|
|
xf86ModulePath = argv[i + 1];
|
2016-05-03 00:47:21 +02:00
|
|
|
xf86ModPathFrom = X_CMDLINE;
|
|
|
|
return 2;
|
|
|
|
}
|
|
|
|
if (!strcmp(argv[i], "-logfile")) {
|
2018-10-23 20:28:21 +02:00
|
|
|
CHECK_FOR_REQUIRED_ARGUMENTS(1);
|
2018-10-23 21:29:08 +02:00
|
|
|
if (xf86PrivsElevated())
|
|
|
|
FatalError("\nInvalid argument -logfile "
|
|
|
|
"with elevated privileges\n");
|
2016-05-03 00:47:22 +02:00
|
|
|
xf86LogFile = argv[i + 1];
|
2016-05-03 00:47:21 +02:00
|
|
|
xf86LogFileFrom = X_CMDLINE;
|
|
|
|
return 2;
|
2003-11-14 17:49:22 +01:00
|
|
|
}
|
2012-03-21 20:55:09 +01:00
|
|
|
if (!strcmp(argv[i], "-config") || !strcmp(argv[i], "-xf86config")) {
|
2018-10-23 20:28:21 +02:00
|
|
|
CHECK_FOR_REQUIRED_ARGUMENTS(1);
|
2016-05-03 00:47:20 +02:00
|
|
|
xf86CheckPrivs(argv[i], argv[i + 1]);
|
2012-03-21 20:55:09 +01:00
|
|
|
xf86ConfigFile = argv[i + 1];
|
|
|
|
return 2;
|
2003-11-14 17:49:22 +01:00
|
|
|
}
|
2012-03-21 20:55:09 +01:00
|
|
|
if (!strcmp(argv[i], "-configdir")) {
|
2018-10-23 20:28:21 +02:00
|
|
|
CHECK_FOR_REQUIRED_ARGUMENTS(1);
|
2016-05-03 00:47:20 +02:00
|
|
|
xf86CheckPrivs(argv[i], argv[i + 1]);
|
2012-03-21 20:55:09 +01:00
|
|
|
xf86ConfigDir = argv[i + 1];
|
|
|
|
return 2;
|
2003-11-14 17:49:22 +01:00
|
|
|
}
|
2003-11-14 16:54:54 +01:00
|
|
|
#ifdef XF86VIDMODE
|
2012-03-21 20:55:09 +01:00
|
|
|
if (!strcmp(argv[i], "-disableVidMode")) {
|
|
|
|
xf86VidModeDisabled = TRUE;
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
if (!strcmp(argv[i], "-allowNonLocalXvidtune")) {
|
|
|
|
xf86VidModeAllowNonLocal = TRUE;
|
|
|
|
return 1;
|
|
|
|
}
|
2003-11-14 17:49:22 +01:00
|
|
|
#endif
|
2012-03-21 20:55:09 +01:00
|
|
|
if (!strcmp(argv[i], "-allowMouseOpenFail")) {
|
|
|
|
xf86AllowMouseOpenFail = TRUE;
|
|
|
|
return 1;
|
2003-11-14 17:49:22 +01:00
|
|
|
}
|
2012-03-21 20:55:09 +01:00
|
|
|
if (!strcmp(argv[i], "-ignoreABI")) {
|
|
|
|
LoaderSetOptions(LDR_OPT_ABI_MISMATCH_NONFATAL);
|
|
|
|
return 1;
|
2003-11-14 17:49:22 +01:00
|
|
|
}
|
2012-03-21 20:55:09 +01:00
|
|
|
if (!strcmp(argv[i], "-verbose")) {
|
|
|
|
if (++i < argc && argv[i]) {
|
|
|
|
char *end;
|
|
|
|
long val;
|
|
|
|
|
|
|
|
val = strtol(argv[i], &end, 0);
|
|
|
|
if (*end == '\0') {
|
|
|
|
xf86SetVerbosity(val);
|
|
|
|
return 2;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
xf86SetVerbosity(++xf86Verbose);
|
|
|
|
return 1;
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
2012-03-21 20:55:09 +01:00
|
|
|
if (!strcmp(argv[i], "-logverbose")) {
|
|
|
|
if (++i < argc && argv[i]) {
|
|
|
|
char *end;
|
|
|
|
long val;
|
|
|
|
|
|
|
|
val = strtol(argv[i], &end, 0);
|
|
|
|
if (*end == '\0') {
|
|
|
|
xf86SetLogVerbosity(val);
|
|
|
|
return 2;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
xf86SetLogVerbosity(++xf86LogVerbose);
|
|
|
|
return 1;
|
2003-11-14 17:49:22 +01:00
|
|
|
}
|
2012-03-21 20:55:09 +01:00
|
|
|
if (!strcmp(argv[i], "-quiet")) {
|
|
|
|
xf86SetVerbosity(-1);
|
|
|
|
return 1;
|
2003-11-14 17:49:22 +01:00
|
|
|
}
|
2012-03-21 20:55:09 +01:00
|
|
|
if (!strcmp(argv[i], "-showconfig") || !strcmp(argv[i], "-version")) {
|
|
|
|
xf86PrintBanner();
|
|
|
|
exit(0);
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
2012-03-21 20:55:09 +01:00
|
|
|
if (!strcmp(argv[i], "-showDefaultModulePath")) {
|
|
|
|
xf86PrintDefaultModulePath();
|
|
|
|
exit(0);
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
2012-03-21 20:55:09 +01:00
|
|
|
if (!strcmp(argv[i], "-showDefaultLibPath")) {
|
|
|
|
xf86PrintDefaultLibraryPath();
|
|
|
|
exit(0);
|
|
|
|
}
|
|
|
|
/* Notice the -fp flag, but allow it to pass to the dix layer */
|
|
|
|
if (!strcmp(argv[i], "-fp")) {
|
|
|
|
xf86fpFlag = TRUE;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
/* Notice the -bs flag, but allow it to pass to the dix layer */
|
|
|
|
if (!strcmp(argv[i], "-bs")) {
|
|
|
|
xf86bsDisableFlag = TRUE;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
/* Notice the +bs flag, but allow it to pass to the dix layer */
|
|
|
|
if (!strcmp(argv[i], "+bs")) {
|
|
|
|
xf86bsEnableFlag = TRUE;
|
|
|
|
return 0;
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
2012-03-21 20:55:09 +01:00
|
|
|
/* Notice the -s flag, but allow it to pass to the dix layer */
|
|
|
|
if (!strcmp(argv[i], "-s")) {
|
|
|
|
xf86sFlag = TRUE;
|
|
|
|
return 0;
|
|
|
|
}
|
2014-02-28 19:19:00 +01:00
|
|
|
if (!strcmp(argv[i], "-pixmap32") || !strcmp(argv[i], "-pixmap24")) {
|
|
|
|
/* silently accept */
|
2012-03-21 20:55:09 +01:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
if (!strcmp(argv[i], "-fbbpp")) {
|
|
|
|
int bpp;
|
|
|
|
|
2018-10-23 20:28:21 +02:00
|
|
|
CHECK_FOR_REQUIRED_ARGUMENTS(1);
|
2012-03-21 20:55:09 +01:00
|
|
|
if (sscanf(argv[++i], "%d", &bpp) == 1) {
|
|
|
|
xf86FbBpp = bpp;
|
|
|
|
return 2;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
ErrorF("Invalid fbbpp\n");
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!strcmp(argv[i], "-depth")) {
|
|
|
|
int depth;
|
|
|
|
|
2018-10-23 20:28:21 +02:00
|
|
|
CHECK_FOR_REQUIRED_ARGUMENTS(1);
|
2012-03-21 20:55:09 +01:00
|
|
|
if (sscanf(argv[++i], "%d", &depth) == 1) {
|
|
|
|
xf86Depth = depth;
|
|
|
|
return 2;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
ErrorF("Invalid depth\n");
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!strcmp(argv[i], "-weight")) {
|
|
|
|
int red, green, blue;
|
|
|
|
|
2018-10-23 20:28:21 +02:00
|
|
|
CHECK_FOR_REQUIRED_ARGUMENTS(1);
|
2012-03-21 20:55:09 +01:00
|
|
|
if (sscanf(argv[++i], "%1d%1d%1d", &red, &green, &blue) == 3) {
|
|
|
|
xf86Weight.red = red;
|
|
|
|
xf86Weight.green = green;
|
|
|
|
xf86Weight.blue = blue;
|
|
|
|
return 2;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
ErrorF("Invalid weighting\n");
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!strcmp(argv[i], "-gamma") || !strcmp(argv[i], "-rgamma") ||
|
|
|
|
!strcmp(argv[i], "-ggamma") || !strcmp(argv[i], "-bgamma")) {
|
|
|
|
double gamma;
|
|
|
|
|
2018-10-23 20:28:21 +02:00
|
|
|
CHECK_FOR_REQUIRED_ARGUMENTS(1);
|
2012-03-21 20:55:09 +01:00
|
|
|
if (sscanf(argv[++i], "%lf", &gamma) == 1) {
|
|
|
|
if (gamma < GAMMA_MIN || gamma > GAMMA_MAX) {
|
|
|
|
ErrorF("gamma out of range, only %.2f <= gamma_value <= %.1f"
|
|
|
|
" is valid\n", GAMMA_MIN, GAMMA_MAX);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
if (!strcmp(argv[i - 1], "-gamma"))
|
|
|
|
xf86Gamma.red = xf86Gamma.green = xf86Gamma.blue = gamma;
|
|
|
|
else if (!strcmp(argv[i - 1], "-rgamma"))
|
|
|
|
xf86Gamma.red = gamma;
|
|
|
|
else if (!strcmp(argv[i - 1], "-ggamma"))
|
|
|
|
xf86Gamma.green = gamma;
|
|
|
|
else if (!strcmp(argv[i - 1], "-bgamma"))
|
|
|
|
xf86Gamma.blue = gamma;
|
|
|
|
return 2;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!strcmp(argv[i], "-layout")) {
|
2018-10-23 20:28:21 +02:00
|
|
|
CHECK_FOR_REQUIRED_ARGUMENTS(1);
|
2012-03-21 20:55:09 +01:00
|
|
|
xf86LayoutName = argv[++i];
|
|
|
|
return 2;
|
|
|
|
}
|
|
|
|
if (!strcmp(argv[i], "-screen")) {
|
2018-10-23 20:28:21 +02:00
|
|
|
CHECK_FOR_REQUIRED_ARGUMENTS(1);
|
2012-03-21 20:55:09 +01:00
|
|
|
xf86ScreenName = argv[++i];
|
|
|
|
return 2;
|
|
|
|
}
|
|
|
|
if (!strcmp(argv[i], "-pointer")) {
|
2018-10-23 20:28:21 +02:00
|
|
|
CHECK_FOR_REQUIRED_ARGUMENTS(1);
|
2012-03-21 20:55:09 +01:00
|
|
|
xf86PointerName = argv[++i];
|
|
|
|
return 2;
|
|
|
|
}
|
|
|
|
if (!strcmp(argv[i], "-keyboard")) {
|
2018-10-23 20:28:21 +02:00
|
|
|
CHECK_FOR_REQUIRED_ARGUMENTS(1);
|
2012-03-21 20:55:09 +01:00
|
|
|
xf86KeyboardName = argv[++i];
|
|
|
|
return 2;
|
|
|
|
}
|
|
|
|
if (!strcmp(argv[i], "-nosilk")) {
|
|
|
|
xf86silkenMouseDisableFlag = TRUE;
|
|
|
|
return 1;
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
2006-05-09 20:04:29 +02:00
|
|
|
#ifdef HAVE_ACPI
|
2012-03-21 20:55:09 +01:00
|
|
|
if (!strcmp(argv[i], "-noacpi")) {
|
|
|
|
xf86acpiDisableFlag = TRUE;
|
|
|
|
return 1;
|
|
|
|
}
|
2006-05-09 20:04:29 +02:00
|
|
|
#endif
|
2012-03-21 20:55:09 +01:00
|
|
|
if (!strcmp(argv[i], "-configure")) {
|
|
|
|
if (getuid() != 0 && geteuid() == 0) {
|
|
|
|
ErrorF("The '-configure' option can only be used by root.\n");
|
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
xf86DoConfigure = TRUE;
|
|
|
|
xf86AllowMouseOpenFail = TRUE;
|
|
|
|
return 1;
|
2003-11-14 17:49:22 +01:00
|
|
|
}
|
2012-03-21 20:55:09 +01:00
|
|
|
if (!strcmp(argv[i], "-showopts")) {
|
|
|
|
if (getuid() != 0 && geteuid() == 0) {
|
|
|
|
ErrorF("The '-showopts' option can only be used by root.\n");
|
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
xf86DoShowOptions = TRUE;
|
|
|
|
return 1;
|
2008-11-23 11:16:03 +01:00
|
|
|
}
|
2010-06-01 12:05:47 +02:00
|
|
|
#ifdef XSERVER_LIBPCIACCESS
|
2012-03-21 20:55:09 +01:00
|
|
|
if (!strcmp(argv[i], "-isolateDevice")) {
|
2018-10-23 20:28:21 +02:00
|
|
|
CHECK_FOR_REQUIRED_ARGUMENTS(1);
|
2012-03-21 20:55:09 +01:00
|
|
|
if (strncmp(argv[++i], "PCI:", 4)) {
|
|
|
|
FatalError("Bus types other than PCI not yet isolable\n");
|
|
|
|
}
|
|
|
|
xf86PciIsolateDevice(argv[i]);
|
|
|
|
return 2;
|
2005-07-04 20:41:04 +02:00
|
|
|
}
|
2010-06-01 12:05:47 +02:00
|
|
|
#endif
|
2012-03-21 20:55:09 +01:00
|
|
|
/* Notice cmdline xkbdir, but pass to dix as well */
|
|
|
|
if (!strcmp(argv[i], "-xkbdir")) {
|
|
|
|
xf86xkbdirFlag = TRUE;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
if (!strcmp(argv[i], "-novtswitch")) {
|
|
|
|
xf86Info.autoVTSwitch = FALSE;
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
if (!strcmp(argv[i], "-sharevts")) {
|
|
|
|
xf86Info.ShareVTs = TRUE;
|
|
|
|
return 1;
|
|
|
|
}
|
2016-05-09 19:28:08 +02:00
|
|
|
if (!strcmp(argv[i], "-iglx") || !strcmp(argv[i], "+iglx")) {
|
|
|
|
xf86Info.iglxFrom = X_CMDLINE;
|
2016-06-01 20:27:23 +02:00
|
|
|
return 0;
|
2016-05-09 19:28:08 +02:00
|
|
|
}
|
2012-08-17 01:49:24 +02:00
|
|
|
if (!strcmp(argv[i], "-noautoBindGPU")) {
|
|
|
|
xf86AutoBindGPUDisabled = TRUE;
|
|
|
|
return 1;
|
|
|
|
}
|
2012-03-21 20:55:09 +01:00
|
|
|
|
|
|
|
/* OS-specific processing */
|
|
|
|
return xf86ProcessArgument(argc, argv, i);
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* ddxUseMsg --
|
|
|
|
* Print out correct use of device dependent commandline options.
|
|
|
|
* Maybe the user now knows what really to do ...
|
|
|
|
*/
|
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
void
|
2009-01-11 08:33:18 +01:00
|
|
|
ddxUseMsg(void)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
ErrorF("\n");
|
|
|
|
ErrorF("\n");
|
|
|
|
ErrorF("Device Dependent Usage\n");
|
2018-03-13 22:46:36 +01:00
|
|
|
if (!PrivsElevated()) {
|
2012-03-21 20:55:09 +01:00
|
|
|
ErrorF("-modulepath paths specify the module search path\n");
|
|
|
|
ErrorF("-logfile file specify a log file name\n");
|
|
|
|
ErrorF("-configure probe for devices and write an "
|
2017-04-01 02:33:52 +02:00
|
|
|
XCONFIGFILE "\n");
|
2012-03-21 20:55:09 +01:00
|
|
|
ErrorF
|
|
|
|
("-showopts print available options for all installed drivers\n");
|
|
|
|
}
|
|
|
|
ErrorF
|
|
|
|
("-config file specify a configuration file, relative to the\n");
|
2017-04-01 02:33:52 +02:00
|
|
|
ErrorF(" " XCONFIGFILE
|
2012-03-21 20:55:09 +01:00
|
|
|
" search path, only root can use absolute\n");
|
|
|
|
ErrorF
|
|
|
|
("-configdir dir specify a configuration directory, relative to the\n");
|
2017-04-01 02:33:52 +02:00
|
|
|
ErrorF(" " XCONFIGDIR
|
2012-03-21 20:55:09 +01:00
|
|
|
" search path, only root can use absolute\n");
|
|
|
|
ErrorF("-verbose [n] verbose startup messages\n");
|
|
|
|
ErrorF("-logverbose [n] verbose log messages\n");
|
|
|
|
ErrorF("-quiet minimal startup messages\n");
|
|
|
|
ErrorF("-fbbpp n set bpp for the framebuffer. Default: 8\n");
|
|
|
|
ErrorF("-depth n set colour depth. Default: 8\n");
|
|
|
|
ErrorF
|
|
|
|
("-gamma f set gamma value (0.1 < f < 10.0) Default: 1.0\n");
|
|
|
|
ErrorF("-rgamma f set gamma value for red phase\n");
|
|
|
|
ErrorF("-ggamma f set gamma value for green phase\n");
|
|
|
|
ErrorF("-bgamma f set gamma value for blue phase\n");
|
|
|
|
ErrorF
|
|
|
|
("-weight nnn set RGB weighting at 16 bpp. Default: 565\n");
|
|
|
|
ErrorF("-layout name specify the ServerLayout section name\n");
|
|
|
|
ErrorF("-screen name specify the Screen section name\n");
|
|
|
|
ErrorF
|
|
|
|
("-keyboard name specify the core keyboard InputDevice name\n");
|
|
|
|
ErrorF
|
|
|
|
("-pointer name specify the core pointer InputDevice name\n");
|
|
|
|
ErrorF("-nosilk disable Silken Mouse\n");
|
2003-11-14 16:54:54 +01:00
|
|
|
#ifdef XF86VIDMODE
|
2012-03-21 20:55:09 +01:00
|
|
|
ErrorF("-disableVidMode disable mode adjustments with xvidtune\n");
|
|
|
|
ErrorF
|
|
|
|
("-allowNonLocalXvidtune allow xvidtune to be run as a non-local client\n");
|
2003-11-14 16:54:54 +01:00
|
|
|
#endif
|
2012-03-21 20:55:09 +01:00
|
|
|
ErrorF
|
|
|
|
("-allowMouseOpenFail start server even if the mouse can't be initialized\n");
|
|
|
|
ErrorF("-ignoreABI make module ABI mismatches non-fatal\n");
|
2010-06-01 12:05:47 +02:00
|
|
|
#ifdef XSERVER_LIBPCIACCESS
|
2012-03-21 20:55:09 +01:00
|
|
|
ErrorF
|
|
|
|
("-isolateDevice bus_id restrict device resets to bus_id (PCI only)\n");
|
2010-06-01 12:05:47 +02:00
|
|
|
#endif
|
2012-03-21 20:55:09 +01:00
|
|
|
ErrorF("-version show the server version\n");
|
|
|
|
ErrorF("-showDefaultModulePath show the server default module path\n");
|
|
|
|
ErrorF("-showDefaultLibPath show the server default library path\n");
|
|
|
|
ErrorF
|
|
|
|
("-novtswitch don't automatically switch VT at reset & exit\n");
|
|
|
|
ErrorF("-sharevts share VTs with another X server\n");
|
|
|
|
/* OS-specific usage */
|
|
|
|
xf86UseMsg();
|
|
|
|
ErrorF("\n");
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
|
|
|
|
2003-11-14 17:49:22 +01:00
|
|
|
/*
|
|
|
|
* xf86LoadModules iterates over a list that is being passed in.
|
2008-06-11 14:14:26 +02:00
|
|
|
*/
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
Bool
|
2013-12-15 10:05:51 +01:00
|
|
|
xf86LoadModules(const char **list, void **optlist)
|
2003-11-14 17:49:22 +01:00
|
|
|
{
|
2016-04-14 17:45:58 +02:00
|
|
|
int errmaj;
|
2013-12-15 10:05:51 +01:00
|
|
|
void *opt;
|
2003-11-14 17:49:22 +01:00
|
|
|
int i;
|
|
|
|
char *name;
|
|
|
|
Bool failed = FALSE;
|
|
|
|
|
|
|
|
if (!list)
|
2012-03-21 20:55:09 +01:00
|
|
|
return TRUE;
|
2003-11-14 17:49:22 +01:00
|
|
|
|
|
|
|
for (i = 0; list[i] != NULL; i++) {
|
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
/* Normalise the module name */
|
|
|
|
name = xf86NormalizeName(list[i]);
|
2003-11-14 17:49:22 +01:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
/* Skip empty names */
|
|
|
|
if (name == NULL || *name == '\0') {
|
|
|
|
free(name);
|
|
|
|
continue;
|
|
|
|
}
|
2003-11-14 17:49:22 +01:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
/* Replace obsolete keyboard driver with kbd */
|
|
|
|
if (!xf86NameCmp(name, "keyboard")) {
|
|
|
|
strcpy(name, "kbd");
|
|
|
|
}
|
2007-07-13 01:36:27 +02:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
if (optlist)
|
|
|
|
opt = optlist[i];
|
|
|
|
else
|
|
|
|
opt = NULL;
|
2003-11-14 17:49:22 +01:00
|
|
|
|
2016-04-14 17:45:58 +02:00
|
|
|
if (!LoadModule(name, opt, NULL, &errmaj)) {
|
|
|
|
LoaderErrorMsg(NULL, name, errmaj, 0);
|
2012-03-21 20:55:09 +01:00
|
|
|
failed = TRUE;
|
|
|
|
}
|
|
|
|
free(name);
|
2003-11-14 17:49:22 +01:00
|
|
|
}
|
|
|
|
return !failed;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Pixmap format stuff */
|
2003-11-14 16:54:54 +01:00
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
PixmapFormatPtr
|
2003-11-14 17:49:22 +01:00
|
|
|
xf86GetPixFormat(ScrnInfoPtr pScrn, int depth)
|
|
|
|
{
|
|
|
|
int i;
|
2008-06-11 14:14:26 +02:00
|
|
|
|
2003-11-14 17:49:22 +01:00
|
|
|
for (i = 0; i < numFormats; i++)
|
2012-03-21 20:55:09 +01:00
|
|
|
if (formats[i].depth == depth)
|
|
|
|
break;
|
2003-11-14 17:49:22 +01:00
|
|
|
if (i != numFormats)
|
2012-03-21 20:55:09 +01:00
|
|
|
return &formats[i];
|
2003-11-14 17:49:22 +01:00
|
|
|
else if (!formatsDone) {
|
2012-03-21 20:55:09 +01:00
|
|
|
/* Check for screen-specified formats */
|
|
|
|
for (i = 0; i < pScrn->numFormats; i++)
|
|
|
|
if (pScrn->formats[i].depth == depth)
|
|
|
|
break;
|
|
|
|
if (i != pScrn->numFormats)
|
|
|
|
return &pScrn->formats[i];
|
2003-11-14 17:49:22 +01:00
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
int
|
2003-11-14 17:49:22 +01:00
|
|
|
xf86GetBppFromDepth(ScrnInfoPtr pScrn, int depth)
|
|
|
|
{
|
|
|
|
PixmapFormatPtr format;
|
|
|
|
|
|
|
|
format = xf86GetPixFormat(pScrn, depth);
|
|
|
|
if (format)
|
2012-03-21 20:55:09 +01:00
|
|
|
return format->bitsPerPixel;
|
2003-11-14 17:49:22 +01:00
|
|
|
else
|
2012-03-21 20:55:09 +01:00
|
|
|
return 0;
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
2012-03-29 09:21:01 +02:00
|
|
|
|
|
|
|
#ifdef DDXBEFORERESET
|
|
|
|
void
|
|
|
|
ddxBeforeReset(void)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
#endif
|
2019-02-22 00:22:57 +01:00
|
|
|
|
|
|
|
#if INPUTTHREAD
|
|
|
|
/** This function is called in Xserver/os/inputthread.c when starting
|
|
|
|
the input thread. */
|
|
|
|
void
|
|
|
|
ddxInputThreadInit(void)
|
|
|
|
{
|
2019-02-22 00:35:38 +01:00
|
|
|
xf86OSInputThreadInit();
|
2019-02-22 00:22:57 +01:00
|
|
|
}
|
|
|
|
#endif
|