Merge commit 'origin/master'
This commit is contained in:
commit
4715f079b9
|
@ -472,9 +472,9 @@ SELinuxLabelClient(ClientPtr client)
|
||||||
sidput(obj->sid);
|
sidput(obj->sid);
|
||||||
|
|
||||||
/* Try to get a context from the socket */
|
/* Try to get a context from the socket */
|
||||||
if (fd < 0 || getpeercon(fd, &ctx) < 0) {
|
if (fd < 0 || getpeercon_raw(fd, &ctx) < 0) {
|
||||||
/* Otherwise, fall back to a default context */
|
/* Otherwise, fall back to a default context */
|
||||||
if (selabel_lookup(label_hnd, &ctx, NULL, SELABEL_X_CLIENT) < 0)
|
if (selabel_lookup(label_hnd, &ctx, "remote", SELABEL_X_CLIENT) < 0)
|
||||||
FatalError("SELinux: failed to look up remote-client context\n");
|
FatalError("SELinux: failed to look up remote-client context\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -537,7 +537,7 @@ SELinuxLabelInitial(void)
|
||||||
sidput(subj->sid);
|
sidput(subj->sid);
|
||||||
|
|
||||||
/* Use the context of the X server process for the serverClient */
|
/* Use the context of the X server process for the serverClient */
|
||||||
if (getcon(&ctx) < 0)
|
if (getcon_raw(&ctx) < 0)
|
||||||
FatalError("SELinux: couldn't get context of X server process\n");
|
FatalError("SELinux: couldn't get context of X server process\n");
|
||||||
|
|
||||||
/* Get a SID from the context */
|
/* Get a SID from the context */
|
||||||
|
|
11
configure.ac
11
configure.ac
|
@ -1220,7 +1220,6 @@ AC_MSG_RESULT([$XORG])
|
||||||
|
|
||||||
xorg_bus_linuxpci=no
|
xorg_bus_linuxpci=no
|
||||||
xorg_bus_bsdpci=no
|
xorg_bus_bsdpci=no
|
||||||
xorg_bus_ix86pci=no
|
|
||||||
xorg_bus_sparc=no
|
xorg_bus_sparc=no
|
||||||
|
|
||||||
if test "x$XORG" = xyes; then
|
if test "x$XORG" = xyes; then
|
||||||
|
@ -1357,15 +1356,6 @@ if test "x$XORG" = xyes; then
|
||||||
sparc*)
|
sparc*)
|
||||||
xorg_bus_sparc="yes"
|
xorg_bus_sparc="yes"
|
||||||
;;
|
;;
|
||||||
i*86|x86_64*|amd64*)
|
|
||||||
case $host_os in
|
|
||||||
*bsd*|linux*|solaris*)
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
xorg_bus_ix86pci="yes"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
;;
|
|
||||||
esac
|
esac
|
||||||
|
|
||||||
if test "x$XORG_OS_PCI" = x ; then
|
if test "x$XORG_OS_PCI" = x ; then
|
||||||
|
@ -1459,7 +1449,6 @@ fi
|
||||||
AM_CONDITIONAL([XORG], [test "x$XORG" = xyes])
|
AM_CONDITIONAL([XORG], [test "x$XORG" = xyes])
|
||||||
AM_CONDITIONAL([XORG_BUS_LINUXPCI], [test "x$xorg_bus_linuxpci" = xyes])
|
AM_CONDITIONAL([XORG_BUS_LINUXPCI], [test "x$xorg_bus_linuxpci" = xyes])
|
||||||
AM_CONDITIONAL([XORG_BUS_BSDPCI], [test "x$xorg_bus_bsdpci" = xyes])
|
AM_CONDITIONAL([XORG_BUS_BSDPCI], [test "x$xorg_bus_bsdpci" = xyes])
|
||||||
AM_CONDITIONAL([XORG_BUS_IX86PCI], [test "x$xorg_bus_ix86pci" = xyes])
|
|
||||||
AM_CONDITIONAL([XORG_BUS_SPARC], [test "x$xorg_bus_sparc" = xyes])
|
AM_CONDITIONAL([XORG_BUS_SPARC], [test "x$xorg_bus_sparc" = xyes])
|
||||||
AM_CONDITIONAL([LINUX_IA64], [test "x$linux_ia64" = xyes])
|
AM_CONDITIONAL([LINUX_IA64], [test "x$linux_ia64" = xyes])
|
||||||
AM_CONDITIONAL([LINUX_ALPHA], [test "x$linux_alpha" = xyes])
|
AM_CONDITIONAL([LINUX_ALPHA], [test "x$linux_alpha" = xyes])
|
||||||
|
|
83
dbe/dbe.c
83
dbe/dbe.c
|
@ -58,9 +58,6 @@
|
||||||
|
|
||||||
/* GLOBALS */
|
/* GLOBALS */
|
||||||
|
|
||||||
/* Per-screen initialization functions [init'ed by DbeRegisterFunction()] */
|
|
||||||
static Bool (* DbeInitFunct[MAXSCREENS])(); /* pScreen, pDbeScreenPriv */
|
|
||||||
|
|
||||||
/* These are static globals copied to DBE's screen private for use by DDX */
|
/* These are static globals copied to DBE's screen private for use by DDX */
|
||||||
static int dbeScreenPrivKeyIndex;
|
static int dbeScreenPrivKeyIndex;
|
||||||
static DevPrivateKey dbeScreenPrivKey = &dbeScreenPrivKeyIndex;
|
static DevPrivateKey dbeScreenPrivKey = &dbeScreenPrivKeyIndex;
|
||||||
|
@ -74,45 +71,6 @@ static RESTYPE dbeWindowPrivResType;
|
||||||
/* Used to generate DBE's BadBuffer error. */
|
/* Used to generate DBE's BadBuffer error. */
|
||||||
static int dbeErrorBase;
|
static int dbeErrorBase;
|
||||||
|
|
||||||
/* Used by DbeRegisterFunction() to initialize the initialization function
|
|
||||||
* table only once per server lifetime.
|
|
||||||
*/
|
|
||||||
static Bool firstRegistrationPass = TRUE;
|
|
||||||
|
|
||||||
|
|
||||||
/******************************************************************************
|
|
||||||
*
|
|
||||||
* DBE DIX Procedure: DbeRegisterFunction
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
*
|
|
||||||
* This function registers the DBE init function for the specified screen.
|
|
||||||
*
|
|
||||||
*****************************************************************************/
|
|
||||||
|
|
||||||
void
|
|
||||||
DbeRegisterFunction(ScreenPtr pScreen, Bool (*funct) (/* ??? */))
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
|
|
||||||
/* Initialize the initialization function table if it has not been
|
|
||||||
* initialized already.
|
|
||||||
*/
|
|
||||||
if (firstRegistrationPass)
|
|
||||||
{
|
|
||||||
for (i = 0; i < MAXSCREENS; i++)
|
|
||||||
{
|
|
||||||
DbeInitFunct[i] = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
firstRegistrationPass = FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
DbeInitFunct[pScreen->myNum] = funct;
|
|
||||||
|
|
||||||
} /* DbeRegisterFunction() */
|
|
||||||
|
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
*
|
*
|
||||||
* DBE DIX Procedure: DbeStubScreen
|
* DBE DIX Procedure: DbeStubScreen
|
||||||
|
@ -1498,12 +1456,6 @@ DbeResetProc(ExtensionEntry *extEntry)
|
||||||
xfree(pDbeScreenPriv);
|
xfree(pDbeScreenPriv);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* We want to init the initialization function table after every server
|
|
||||||
* reset in DbeRegisterFunction().
|
|
||||||
*/
|
|
||||||
firstRegistrationPass = TRUE;
|
|
||||||
|
|
||||||
} /* DbeResetProc() */
|
} /* DbeResetProc() */
|
||||||
|
|
||||||
|
|
||||||
|
@ -1659,39 +1611,8 @@ DbeExtensionInit(void)
|
||||||
pDbeScreenPriv->dbeScreenPrivKey = dbeScreenPrivKey;
|
pDbeScreenPriv->dbeScreenPrivKey = dbeScreenPrivKey;
|
||||||
pDbeScreenPriv->dbeWindowPrivKey = dbeWindowPrivKey;
|
pDbeScreenPriv->dbeWindowPrivKey = dbeWindowPrivKey;
|
||||||
|
|
||||||
if(DbeInitFunct[i])
|
|
||||||
{
|
{
|
||||||
/* This screen supports DBE. */
|
/* We don't have DDX support for DBE anymore */
|
||||||
|
|
||||||
/* Setup DIX. */
|
|
||||||
pDbeScreenPriv->SetupBackgroundPainter = DbeSetupBackgroundPainter;
|
|
||||||
|
|
||||||
/* Setup DDX. */
|
|
||||||
ddxInitSuccess = (*DbeInitFunct[i])(pScreen, pDbeScreenPriv);
|
|
||||||
|
|
||||||
/* DDX DBE initialization may have the side affect of
|
|
||||||
* reallocating pDbeScreenPriv, so we need to update it.
|
|
||||||
*/
|
|
||||||
pDbeScreenPriv = DBE_SCREEN_PRIV(pScreen);
|
|
||||||
|
|
||||||
if (ddxInitSuccess)
|
|
||||||
{
|
|
||||||
/* Wrap DestroyWindow. The DDX initialization function
|
|
||||||
* already wrapped PositionWindow for us.
|
|
||||||
*/
|
|
||||||
|
|
||||||
pDbeScreenPriv->DestroyWindow = pScreen->DestroyWindow;
|
|
||||||
pScreen->DestroyWindow = DbeDestroyWindow;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* DDX initialization failed. Stub the screen. */
|
|
||||||
DbeStubScreen(pDbeScreenPriv, &nStubbedScreens);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* This screen does not support DBE. */
|
|
||||||
|
|
||||||
#ifndef DISABLE_MI_DBE_BY_DEFAULT
|
#ifndef DISABLE_MI_DBE_BY_DEFAULT
|
||||||
/* Setup DIX. */
|
/* Setup DIX. */
|
||||||
|
@ -1723,7 +1644,7 @@ DbeExtensionInit(void)
|
||||||
DbeStubScreen(pDbeScreenPriv, &nStubbedScreens);
|
DbeStubScreen(pDbeScreenPriv, &nStubbedScreens);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
} /* else -- this screen does not support DBE. */
|
}
|
||||||
|
|
||||||
} /* for (i = 0; i < screenInfo.numScreens; i++) */
|
} /* for (i = 0; i < screenInfo.numScreens; i++) */
|
||||||
|
|
||||||
|
|
|
@ -74,6 +74,7 @@
|
||||||
/* Marker for free elements in the buffer ID array. */
|
/* Marker for free elements in the buffer ID array. */
|
||||||
#define DBE_FREE_ID_ELEMENT 0
|
#define DBE_FREE_ID_ELEMENT 0
|
||||||
|
|
||||||
|
extern void DbeExtensionInit (void);
|
||||||
|
|
||||||
/* TYPEDEFS */
|
/* TYPEDEFS */
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,8 @@ libdix_la_SOURCES = \
|
||||||
dispatch.h \
|
dispatch.h \
|
||||||
dixfonts.c \
|
dixfonts.c \
|
||||||
dixutils.c \
|
dixutils.c \
|
||||||
|
enterleave.c \
|
||||||
|
enterleave.h \
|
||||||
events.c \
|
events.c \
|
||||||
extension.c \
|
extension.c \
|
||||||
ffs.c \
|
ffs.c \
|
||||||
|
|
|
@ -86,6 +86,7 @@ SOFTWARE.
|
||||||
#include "exevents.h"
|
#include "exevents.h"
|
||||||
#include "listdev.h" /* for CopySwapXXXClass */
|
#include "listdev.h" /* for CopySwapXXXClass */
|
||||||
#include "xiproperty.h"
|
#include "xiproperty.h"
|
||||||
|
#include "enterleave.h" /* for EnterWindow() */
|
||||||
#include "xserver-properties.h"
|
#include "xserver-properties.h"
|
||||||
|
|
||||||
/** @file
|
/** @file
|
||||||
|
@ -284,7 +285,8 @@ EnableDevice(DeviceIntPtr dev)
|
||||||
if (dev->spriteInfo->spriteOwner)
|
if (dev->spriteInfo->spriteOwner)
|
||||||
{
|
{
|
||||||
InitializeSprite(dev, WindowTable[0]);
|
InitializeSprite(dev, WindowTable[0]);
|
||||||
ENTER_LEAVE_SEMAPHORE_SET(WindowTable[0], dev);
|
/* mode doesn't matter */
|
||||||
|
EnterWindow(dev, WindowTable[0], NotifyAncestor);
|
||||||
}
|
}
|
||||||
else if ((other = NextFreePointerDevice()) == NULL)
|
else if ((other = NextFreePointerDevice()) == NULL)
|
||||||
{
|
{
|
||||||
|
@ -604,10 +606,10 @@ InitCoreDevices(void)
|
||||||
&inputInfo.keyboard) != Success)
|
&inputInfo.keyboard) != Success)
|
||||||
FatalError("Failed to allocate core devices");
|
FatalError("Failed to allocate core devices");
|
||||||
|
|
||||||
if (inputInfo.pointer->inited && inputInfo.pointer->startup)
|
ActivateDevice(inputInfo.pointer);
|
||||||
EnableDevice(inputInfo.pointer);
|
ActivateDevice(inputInfo.keyboard);
|
||||||
if (inputInfo.keyboard->inited && inputInfo.keyboard->startup)
|
EnableDevice(inputInfo.pointer);
|
||||||
EnableDevice(inputInfo.keyboard);
|
EnableDevice(inputInfo.keyboard);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -623,7 +625,7 @@ InitCoreDevices(void)
|
||||||
*
|
*
|
||||||
* @return Success or error code on failure.
|
* @return Success or error code on failure.
|
||||||
*/
|
*/
|
||||||
void
|
int
|
||||||
InitAndStartDevices()
|
InitAndStartDevices()
|
||||||
{
|
{
|
||||||
DeviceIntPtr dev, next;
|
DeviceIntPtr dev, next;
|
||||||
|
@ -640,8 +642,10 @@ InitAndStartDevices()
|
||||||
DebugF("(dix) enabling device %d\n", dev->id);
|
DebugF("(dix) enabling device %d\n", dev->id);
|
||||||
next = dev->next;
|
next = dev->next;
|
||||||
if (dev->inited && dev->startup)
|
if (dev->inited && dev->startup)
|
||||||
EnableDevice(dev);
|
(void)EnableDevice(dev);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -0,0 +1,542 @@
|
||||||
|
/*
|
||||||
|
* Copyright © 2008 Red Hat, 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 (including the next
|
||||||
|
* paragraph) 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 AUTHORS OR COPYRIGHT HOLDERS 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.
|
||||||
|
*
|
||||||
|
* Authors: Peter Hutterer
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef HAVE_DIX_CONFIG_H
|
||||||
|
#include <dix-config.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <X11/X.h>
|
||||||
|
#include "windowstr.h"
|
||||||
|
#include "exglobals.h"
|
||||||
|
#include "enterleave.h"
|
||||||
|
|
||||||
|
/* @file This file describes the model for sending core enter/leave events in
|
||||||
|
* the case of multiple pointers.
|
||||||
|
* Since we can't send more than one Enter or Leave event per window
|
||||||
|
* to a core client without confusing it, this is a rather complicated
|
||||||
|
* approach.
|
||||||
|
*
|
||||||
|
* For a full description of the model from a window's perspective, see
|
||||||
|
* http://lists.freedesktop.org/archives/xorg/2008-August/037606.html
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* EnterNotify(Virtual, B) means EnterNotify Event, detail Virtual, child = B.
|
||||||
|
*
|
||||||
|
* Pointer moves from A to B, nonlinear (CoreEnterLeaveNonLinear):
|
||||||
|
* 1. a. if A has another pointer, goto 2.
|
||||||
|
* b. otherwise, if A has a child with a pointer in it,
|
||||||
|
* LeaveNotify(Inferior) to A
|
||||||
|
* LeaveNotify(Virtual) between A and child(A)
|
||||||
|
*
|
||||||
|
* 2. Find common ancestor X between A and B.
|
||||||
|
* 3. Find closest pointer window P between A and X.
|
||||||
|
* a. if P exists
|
||||||
|
* LeaveNotify(Ancestor) to A
|
||||||
|
* LeaveNotify(Virtual) between A and P
|
||||||
|
* b. otherwise, if P does not exist,
|
||||||
|
* LeaveNotify(NonLinear) to A
|
||||||
|
* LeaveNotify(NonLinearVirtual) between A and X.
|
||||||
|
*
|
||||||
|
* 4. If X does not have a pointer, EnterNotify(NonLinearVirtual, B) to X.
|
||||||
|
* 5. Find closest pointer window P between X and B.
|
||||||
|
* a. if P exists, EnterNotify(NonLinearVirtual) between X and P
|
||||||
|
* b. otherwise, EnterNotify(NonLinearVirtual) between X and B
|
||||||
|
*
|
||||||
|
* 5. a. if B has another pointer in it, finish.
|
||||||
|
* b. otherwise, if B has a child with a pointer in it
|
||||||
|
* LeaveNotify(Virtual) between child(B) and B.
|
||||||
|
* EnterNotify(Inferior) to B.
|
||||||
|
* c. otherwise, EnterNotify(NonLinear) to B.
|
||||||
|
*
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* Pointer moves from A to B, A is a parent of B (CoreEnterLeaveToDescendant):
|
||||||
|
* 1. a. If A has another pointer, goto 2.
|
||||||
|
* b. Otherwise, LeaveNotify(Inferior) to A.
|
||||||
|
*
|
||||||
|
* 2. Find highest window X that has a pointer child that is not a child of B.
|
||||||
|
* a. if X exists, EnterNotify(Virtual, B) between A and X,
|
||||||
|
* EnterNotify(Virtual, B) to X (if X has no pointer).
|
||||||
|
* b. otherwise, EnterNotify(Virtual, B) between A and B.
|
||||||
|
*
|
||||||
|
* 3. a. if B has another pointer, finish
|
||||||
|
* b. otherwise, if B has a child with a pointer in it,
|
||||||
|
* LeaveNotify(Virtual, child(B)) between child(B) and B.
|
||||||
|
* EnterNotify(Inferior, child(B)) to B.
|
||||||
|
* c. otherwise, EnterNotify(Ancestor) to B.
|
||||||
|
*
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* Pointer moves from A to B, A is a child of B (CoreEnterLeaveToAncestor):
|
||||||
|
* 1. a. If A has another pointer, goto 2.
|
||||||
|
* b. Otherwise, if A has a child with a pointer in it.
|
||||||
|
* LeaveNotify(Inferior, child(A)) to A.
|
||||||
|
* EnterNotify(Virtual, child(A)) between A and child(A).
|
||||||
|
* Skip to 3.
|
||||||
|
*
|
||||||
|
* 2. Find closest pointer window P between A and B.
|
||||||
|
* If P does not exist, P is B.
|
||||||
|
* LeaveNotify(Ancestor) to A.
|
||||||
|
* LeaveNotify(Virtual, A) between A and P.
|
||||||
|
* 3. a. If B has another pointer, finish.
|
||||||
|
* b. otherwise, EnterNotify(Inferior) to B.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define WID(w) ((w) ? ((w)->drawable.id) : 0)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return TRUE if @win has a pointer within its boundaries, excluding child
|
||||||
|
* window.
|
||||||
|
*/
|
||||||
|
static BOOL
|
||||||
|
HasPointer(WindowPtr win)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; i < sizeof(win->enterleave); i++)
|
||||||
|
if (win->enterleave[i])
|
||||||
|
return TRUE;
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static BOOL
|
||||||
|
HasOtherPointer(WindowPtr win, DeviceIntPtr dev)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; i < sizeof(win->enterleave); i++)
|
||||||
|
if (win->enterleave[i] &&
|
||||||
|
!(i == dev->id/8 && win->enterleave[i] == (1 << (dev->id % 8))))
|
||||||
|
{
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the presence flag for @dev to mark that it is now in @win.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
EnterWindow(DeviceIntPtr dev, WindowPtr win, int mode)
|
||||||
|
{
|
||||||
|
win->enterleave[dev->id/8] |= (1 << (dev->id % 8));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Unset the presence flag for @dev to mark that it is not in @win anymore.
|
||||||
|
*/
|
||||||
|
static void
|
||||||
|
LeaveWindow(DeviceIntPtr dev, WindowPtr win, int mode)
|
||||||
|
{
|
||||||
|
win->enterleave[dev->id/8] &= ~(1 << (dev->id % 8));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return The window that is the first ancestor of both a and b.
|
||||||
|
*/
|
||||||
|
WindowPtr
|
||||||
|
CommonAncestor(
|
||||||
|
WindowPtr a,
|
||||||
|
WindowPtr b)
|
||||||
|
{
|
||||||
|
for (b = b->parent; b; b = b->parent)
|
||||||
|
if (IsParent(b, a)) return b;
|
||||||
|
return NullWindow;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Send enter notifies to all windows between @ancestor and @child (excluding
|
||||||
|
* both). Events are sent running up the window hierarchy. This function
|
||||||
|
* recurses.
|
||||||
|
* If @core is TRUE, core events are sent, otherwise XI events will be sent.
|
||||||
|
*/
|
||||||
|
static void
|
||||||
|
EnterNotifies(DeviceIntPtr dev,
|
||||||
|
WindowPtr ancestor,
|
||||||
|
WindowPtr child,
|
||||||
|
int mode,
|
||||||
|
int detail,
|
||||||
|
BOOL core)
|
||||||
|
{
|
||||||
|
WindowPtr parent = child->parent;
|
||||||
|
|
||||||
|
if (ancestor == parent)
|
||||||
|
return;
|
||||||
|
EnterNotifies(dev, ancestor, parent, mode, detail, core);
|
||||||
|
if (core)
|
||||||
|
CoreEnterLeaveEvent(dev, EnterNotify, mode, detail, parent,
|
||||||
|
child->drawable.id);
|
||||||
|
else
|
||||||
|
DeviceEnterLeaveEvent(dev, DeviceEnterNotify, mode, detail, parent,
|
||||||
|
child->drawable.id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Send leave notifies to all windows between @child and @ancestor.
|
||||||
|
* Events are sent running up the hierarchy.
|
||||||
|
*/
|
||||||
|
static void
|
||||||
|
LeaveNotifies(DeviceIntPtr dev,
|
||||||
|
WindowPtr child,
|
||||||
|
WindowPtr ancestor,
|
||||||
|
int mode,
|
||||||
|
int detail,
|
||||||
|
BOOL core)
|
||||||
|
{
|
||||||
|
WindowPtr win;
|
||||||
|
|
||||||
|
if (ancestor == child)
|
||||||
|
return;
|
||||||
|
for (win = child->parent; win != ancestor; win = win->parent)
|
||||||
|
{
|
||||||
|
if (core)
|
||||||
|
CoreEnterLeaveEvent(dev, LeaveNotify, mode, detail, win,
|
||||||
|
child->drawable.id);
|
||||||
|
else
|
||||||
|
DeviceEnterLeaveEvent(dev, DeviceLeaveNotify, mode, detail, win,
|
||||||
|
child->drawable.id);
|
||||||
|
child = win;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Search for the first window below @win that has a pointer directly within
|
||||||
|
* it's boundaries (excluding boundaries of its own descendants).
|
||||||
|
* Windows including @exclude and its descendants are ignored.
|
||||||
|
*
|
||||||
|
* @return The child window that has the pointer within its boundaries or
|
||||||
|
* NULL.
|
||||||
|
*/
|
||||||
|
static WindowPtr
|
||||||
|
FirstPointerChild(WindowPtr win, WindowPtr exclude)
|
||||||
|
{
|
||||||
|
static WindowPtr *queue = NULL;
|
||||||
|
static int queue_size = 256; /* allocated size of queue */
|
||||||
|
|
||||||
|
WindowPtr child = NULL;
|
||||||
|
int queue_len = 0; /* no of elements in queue */
|
||||||
|
int queue_head = 0; /* pos of current element */
|
||||||
|
|
||||||
|
if (!win || win == exclude || !win->firstChild)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
if (!queue && !(queue = xcalloc(queue_size, sizeof(WindowPtr))))
|
||||||
|
FatalError("[dix] FirstPointerChild: OOM.\n");
|
||||||
|
|
||||||
|
queue[0] = win;
|
||||||
|
queue_head = 0;
|
||||||
|
queue_len = 1;
|
||||||
|
|
||||||
|
while (queue_len--)
|
||||||
|
{
|
||||||
|
if (queue[queue_head] == exclude)
|
||||||
|
{
|
||||||
|
queue_head = (queue_head + 1) % queue_size;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (queue[queue_head] != win && HasPointer(queue[queue_head]))
|
||||||
|
return queue[queue_head];
|
||||||
|
|
||||||
|
child = queue[queue_head]->firstChild;
|
||||||
|
/* pop children onto queue */
|
||||||
|
while(child)
|
||||||
|
{
|
||||||
|
queue_len++;
|
||||||
|
if (queue_len >= queue_size)
|
||||||
|
{
|
||||||
|
const int inc = 256;
|
||||||
|
|
||||||
|
queue = xrealloc(queue, (queue_size + inc) * sizeof(WindowPtr));
|
||||||
|
if (!queue)
|
||||||
|
FatalError("[dix] FirstPointerChild: OOM.\n");
|
||||||
|
|
||||||
|
/* Are we wrapped around? */
|
||||||
|
if (queue_head + queue_len > queue_size)
|
||||||
|
{
|
||||||
|
memmove(&queue[queue_head + inc], &queue[queue_head],
|
||||||
|
(queue_size - queue_head) * sizeof(WindowPtr));
|
||||||
|
queue_head += inc;
|
||||||
|
}
|
||||||
|
|
||||||
|
queue_size += inc;
|
||||||
|
}
|
||||||
|
|
||||||
|
queue[(queue_head + queue_len) % queue_size] = child;
|
||||||
|
child = child->nextSib;
|
||||||
|
}
|
||||||
|
|
||||||
|
queue_head = (queue_head + 1) % queue_size;
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Find the first parent of @win that has a pointer or has a child window with
|
||||||
|
* a pointer. Traverses up to (and including) the root window if @stopBefore
|
||||||
|
* is NULL, otherwise it stops at @stopBefore.
|
||||||
|
* Neither @win nor @win's descendants nor @stopBefore are tested for having a
|
||||||
|
* pointer.
|
||||||
|
*
|
||||||
|
* @return the window or NULL if @stopBefore was reached.
|
||||||
|
*/
|
||||||
|
static WindowPtr
|
||||||
|
FirstPointerAncestor(WindowPtr win, WindowPtr stopBefore)
|
||||||
|
{
|
||||||
|
WindowPtr parent;
|
||||||
|
|
||||||
|
parent = win->parent;
|
||||||
|
|
||||||
|
while(parent && parent != stopBefore)
|
||||||
|
{
|
||||||
|
if (HasPointer(parent) || FirstPointerChild(parent, win))
|
||||||
|
return parent;
|
||||||
|
|
||||||
|
parent = parent->parent;
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Pointer @dev moves from @A to @B and @A neither a descendant of @B nor is
|
||||||
|
* @B a descendant of @A.
|
||||||
|
*/
|
||||||
|
static void
|
||||||
|
CoreEnterLeaveNonLinear(DeviceIntPtr dev,
|
||||||
|
WindowPtr A,
|
||||||
|
WindowPtr B,
|
||||||
|
int mode)
|
||||||
|
{
|
||||||
|
WindowPtr childA, childB, X, P;
|
||||||
|
BOOL hasPointerA = HasPointer(A);
|
||||||
|
|
||||||
|
/* 2 */
|
||||||
|
X = CommonAncestor(A, B);
|
||||||
|
|
||||||
|
/* 1.a */ /* 1.b */
|
||||||
|
if (!hasPointerA && (childA = FirstPointerChild(A, None)))
|
||||||
|
{
|
||||||
|
CoreEnterLeaveEvent(dev, LeaveNotify, mode, NotifyInferior, A, WID(childA));
|
||||||
|
EnterNotifies(dev, A, childA, mode, NotifyVirtual, TRUE);
|
||||||
|
} else {
|
||||||
|
/* 3 */
|
||||||
|
P = FirstPointerAncestor(A, X);
|
||||||
|
|
||||||
|
if (P)
|
||||||
|
{
|
||||||
|
if (!hasPointerA)
|
||||||
|
CoreEnterLeaveEvent(dev, LeaveNotify, mode, NotifyAncestor, A, None);
|
||||||
|
LeaveNotifies(dev, A, P, mode, NotifyVirtual, TRUE);
|
||||||
|
/* 3.b */
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
if (!hasPointerA)
|
||||||
|
CoreEnterLeaveEvent(dev, LeaveNotify, mode, NotifyNonlinear, A, None);
|
||||||
|
LeaveNotifies(dev, A, X, mode, NotifyNonlinearVirtual, TRUE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 4. */
|
||||||
|
if (!HasPointer(X))
|
||||||
|
CoreEnterLeaveEvent(dev, EnterNotify, mode, NotifyNonlinearVirtual, X, WID(B));
|
||||||
|
|
||||||
|
/* 5. */
|
||||||
|
P = FirstPointerChild(X, B);
|
||||||
|
if (!P)
|
||||||
|
P = B; /* 4.b */
|
||||||
|
EnterNotifies(dev, X, P, mode, NotifyNonlinearVirtual, TRUE);
|
||||||
|
|
||||||
|
/* 5.a */
|
||||||
|
if (!HasOtherPointer(B, dev))
|
||||||
|
{
|
||||||
|
/* 5.b */
|
||||||
|
if ((childB = FirstPointerChild(B, None)))
|
||||||
|
{
|
||||||
|
LeaveNotifies(dev, childB, B, mode, NotifyVirtual, TRUE);
|
||||||
|
CoreEnterLeaveEvent(dev, EnterNotify, mode, NotifyInferior, B, WID(childB));
|
||||||
|
} else
|
||||||
|
/* 5.c */
|
||||||
|
CoreEnterLeaveEvent(dev, EnterNotify, mode, NotifyNonlinear, B, None);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Pointer @dev moves from @A to @B and @A is a descendant of @B.
|
||||||
|
*/
|
||||||
|
static void
|
||||||
|
CoreEnterLeaveToAncestor(DeviceIntPtr dev,
|
||||||
|
WindowPtr A,
|
||||||
|
WindowPtr B,
|
||||||
|
int mode)
|
||||||
|
{
|
||||||
|
WindowPtr childA = NULL, P;
|
||||||
|
BOOL hasPointerA = HasPointer(A);
|
||||||
|
|
||||||
|
/* 1.a */ /* 1.b */
|
||||||
|
if (!hasPointerA && (childA = FirstPointerChild(A, None)))
|
||||||
|
{
|
||||||
|
CoreEnterLeaveEvent(dev, LeaveNotify, mode, NotifyInferior, A, WID(childA));
|
||||||
|
EnterNotifies(dev, A, childA, mode, NotifyVirtual, TRUE);
|
||||||
|
} else {
|
||||||
|
/* 2 */
|
||||||
|
P = FirstPointerAncestor(A, B);
|
||||||
|
if (!P)
|
||||||
|
P = B;
|
||||||
|
|
||||||
|
if (!hasPointerA)
|
||||||
|
CoreEnterLeaveEvent(dev, LeaveNotify, mode, NotifyAncestor, A, None);
|
||||||
|
LeaveNotifies(dev, A, P, mode, NotifyVirtual, TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 3 */
|
||||||
|
if (!HasOtherPointer(B, dev))
|
||||||
|
CoreEnterLeaveEvent(dev, EnterNotify, mode, NotifyInferior, B, None);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Pointer @dev moves from @A to @B and @B is a descendant of @A.
|
||||||
|
*/
|
||||||
|
static void
|
||||||
|
CoreEnterLeaveToDescendant(DeviceIntPtr dev,
|
||||||
|
WindowPtr A,
|
||||||
|
WindowPtr B,
|
||||||
|
int mode)
|
||||||
|
{
|
||||||
|
WindowPtr X, childB, tmp;
|
||||||
|
|
||||||
|
/* 1 */
|
||||||
|
if (!HasPointer(A))
|
||||||
|
CoreEnterLeaveEvent(dev, LeaveNotify, mode, NotifyInferior, A, WID(B));
|
||||||
|
|
||||||
|
/* 2 */
|
||||||
|
X = FirstPointerAncestor(B, A);
|
||||||
|
if (X)
|
||||||
|
{
|
||||||
|
/* 2.a */
|
||||||
|
tmp = X;
|
||||||
|
while((tmp = FirstPointerAncestor(tmp, A)))
|
||||||
|
X = tmp;
|
||||||
|
} else /* 2.b */
|
||||||
|
X = B;
|
||||||
|
|
||||||
|
EnterNotifies(dev, A, X, mode, NotifyVirtual, TRUE);
|
||||||
|
|
||||||
|
if (X != B && !HasPointer(X))
|
||||||
|
CoreEnterLeaveEvent(dev, LeaveNotify, mode, NotifyVirtual, X, None);
|
||||||
|
|
||||||
|
/* 3 */
|
||||||
|
if (!HasOtherPointer(B, dev))
|
||||||
|
{
|
||||||
|
childB = FirstPointerChild(B, None);
|
||||||
|
/* 3.a */
|
||||||
|
if (childB)
|
||||||
|
{
|
||||||
|
LeaveNotifies(dev, childB, B, mode, NotifyVirtual, TRUE);
|
||||||
|
CoreEnterLeaveEvent(dev, EnterNotify, mode, NotifyInferior, B, WID(childB));
|
||||||
|
} else /* 3.c */
|
||||||
|
CoreEnterLeaveEvent(dev, EnterNotify, mode, NotifyAncestor, B, None);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
CoreEnterLeaveEvents(DeviceIntPtr dev,
|
||||||
|
WindowPtr from,
|
||||||
|
WindowPtr to,
|
||||||
|
int mode)
|
||||||
|
{
|
||||||
|
if (!dev->isMaster)
|
||||||
|
return;
|
||||||
|
|
||||||
|
LeaveWindow(dev, from, mode);
|
||||||
|
|
||||||
|
if (IsParent(from, to))
|
||||||
|
CoreEnterLeaveToDescendant(dev, from, to, mode);
|
||||||
|
else if (IsParent(to, from))
|
||||||
|
CoreEnterLeaveToAncestor(dev, from, to, mode);
|
||||||
|
else
|
||||||
|
CoreEnterLeaveNonLinear(dev, from, to, mode);
|
||||||
|
|
||||||
|
EnterWindow(dev, to, mode);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
DeviceEnterLeaveEvents(DeviceIntPtr dev,
|
||||||
|
WindowPtr from,
|
||||||
|
WindowPtr to,
|
||||||
|
int mode)
|
||||||
|
{
|
||||||
|
if (IsParent(from, to))
|
||||||
|
{
|
||||||
|
DeviceEnterLeaveEvent(dev, DeviceLeaveNotify, mode, NotifyInferior, from, None);
|
||||||
|
EnterNotifies(dev, from, to, mode, NotifyVirtual, FALSE);
|
||||||
|
DeviceEnterLeaveEvent(dev, DeviceEnterNotify, mode, NotifyAncestor, to, None);
|
||||||
|
}
|
||||||
|
else if (IsParent(to, from))
|
||||||
|
{
|
||||||
|
DeviceEnterLeaveEvent(dev, DeviceLeaveNotify, mode, NotifyAncestor, from, None);
|
||||||
|
LeaveNotifies(dev, from, to, mode, NotifyVirtual, FALSE);
|
||||||
|
DeviceEnterLeaveEvent(dev, DeviceEnterNotify, mode, NotifyInferior, to, None);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{ /* neither from nor to is descendent of the other */
|
||||||
|
WindowPtr common = CommonAncestor(to, from);
|
||||||
|
/* common == NullWindow ==> different screens */
|
||||||
|
DeviceEnterLeaveEvent(dev, DeviceLeaveNotify, mode, NotifyNonlinear, from, None);
|
||||||
|
LeaveNotifies(dev, from, common, mode, NotifyNonlinearVirtual, FALSE);
|
||||||
|
EnterNotifies(dev, common, to, mode, NotifyNonlinearVirtual, FALSE);
|
||||||
|
DeviceEnterLeaveEvent(dev, DeviceEnterNotify, mode, NotifyNonlinear, to, None);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Figure out if enter/leave events are necessary and send them to the
|
||||||
|
* appropriate windows.
|
||||||
|
*
|
||||||
|
* @param fromWin Window the sprite moved out of.
|
||||||
|
* @param toWin Window the sprite moved into.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
DoEnterLeaveEvents(DeviceIntPtr pDev,
|
||||||
|
WindowPtr fromWin,
|
||||||
|
WindowPtr toWin,
|
||||||
|
int mode)
|
||||||
|
{
|
||||||
|
if (!IsPointerDevice(pDev))
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (fromWin == toWin)
|
||||||
|
return;
|
||||||
|
|
||||||
|
CoreEnterLeaveEvents(pDev, fromWin, toWin, mode);
|
||||||
|
DeviceEnterLeaveEvents(pDev, fromWin, toWin, mode);
|
||||||
|
}
|
|
@ -0,0 +1,70 @@
|
||||||
|
/*
|
||||||
|
* Copyright © 2008 Red Hat, 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 (including the next
|
||||||
|
* paragraph) 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 AUTHORS OR COPYRIGHT HOLDERS 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.
|
||||||
|
*
|
||||||
|
* Authors: Peter Hutterer
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef HAVE_DIX_CONFIG_H
|
||||||
|
#include <dix-config.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef ENTERLEAVE_H
|
||||||
|
#define ENTERLEAVE_H
|
||||||
|
|
||||||
|
extern void DoEnterLeaveEvents(
|
||||||
|
DeviceIntPtr pDev,
|
||||||
|
WindowPtr fromWin,
|
||||||
|
WindowPtr toWin,
|
||||||
|
int mode
|
||||||
|
);
|
||||||
|
|
||||||
|
extern void EnterLeaveEvent(
|
||||||
|
DeviceIntPtr mouse,
|
||||||
|
int type,
|
||||||
|
int mode,
|
||||||
|
int detail,
|
||||||
|
WindowPtr pWin,
|
||||||
|
Window child);
|
||||||
|
|
||||||
|
extern WindowPtr CommonAncestor(
|
||||||
|
WindowPtr a,
|
||||||
|
WindowPtr b);
|
||||||
|
|
||||||
|
extern void CoreEnterLeaveEvent(DeviceIntPtr mouse,
|
||||||
|
int type,
|
||||||
|
int mode,
|
||||||
|
int detail,
|
||||||
|
WindowPtr pWin,
|
||||||
|
Window child);
|
||||||
|
extern void DeviceEnterLeaveEvent(DeviceIntPtr mouse,
|
||||||
|
int type,
|
||||||
|
int mode,
|
||||||
|
int detail,
|
||||||
|
WindowPtr pWin,
|
||||||
|
Window child);
|
||||||
|
|
||||||
|
extern void EnterWindow(DeviceIntPtr dev,
|
||||||
|
WindowPtr win,
|
||||||
|
int mode);
|
||||||
|
|
||||||
|
#endif /* _ENTERLEAVE_H_ */
|
290
dix/events.c
290
dix/events.c
|
@ -164,6 +164,8 @@ typedef const char *string;
|
||||||
#include "geext.h"
|
#include "geext.h"
|
||||||
#include "geint.h"
|
#include "geint.h"
|
||||||
|
|
||||||
|
#include "enterleave.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Extension events type numbering starts at EXTENSION_EVENT_BASE.
|
* Extension events type numbering starts at EXTENSION_EVENT_BASE.
|
||||||
*/
|
*/
|
||||||
|
@ -326,13 +328,6 @@ IsKeyboardDevice(DeviceIntPtr dev)
|
||||||
return (dev->key && dev->kbdfeed) && !IsPointerDevice(dev);
|
return (dev->key && dev->kbdfeed) && !IsPointerDevice(dev);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void DoEnterLeaveEvents(
|
|
||||||
DeviceIntPtr pDev,
|
|
||||||
WindowPtr fromWin,
|
|
||||||
WindowPtr toWin,
|
|
||||||
int mode
|
|
||||||
);
|
|
||||||
|
|
||||||
static WindowPtr XYToWindow(
|
static WindowPtr XYToWindow(
|
||||||
DeviceIntPtr pDev,
|
DeviceIntPtr pDev,
|
||||||
int x,
|
int x,
|
||||||
|
@ -4184,25 +4179,12 @@ EventSuppressForWindow(WindowPtr pWin, ClientPtr client,
|
||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return The window that is the first ancestor of both a and b.
|
|
||||||
*/
|
|
||||||
static WindowPtr
|
|
||||||
CommonAncestor(
|
|
||||||
WindowPtr a,
|
|
||||||
WindowPtr b)
|
|
||||||
{
|
|
||||||
for (b = b->parent; b; b = b->parent)
|
|
||||||
if (IsParent(b, a)) return b;
|
|
||||||
return NullWindow;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Assembles an EnterNotify or LeaveNotify and sends it event to the client.
|
* Assembles an EnterNotify or LeaveNotify and sends it event to the client.
|
||||||
* Uses the paired keyboard to get some additional information.
|
* Uses the paired keyboard to get some additional information.
|
||||||
*/
|
*/
|
||||||
static void
|
void
|
||||||
EnterLeaveEvent(
|
CoreEnterLeaveEvent(
|
||||||
DeviceIntPtr mouse,
|
DeviceIntPtr mouse,
|
||||||
int type,
|
int type,
|
||||||
int mode,
|
int mode,
|
||||||
|
@ -4215,12 +4197,6 @@ EnterLeaveEvent(
|
||||||
DeviceIntPtr keybd;
|
DeviceIntPtr keybd;
|
||||||
GrabPtr grab = mouse->deviceGrab.grab;
|
GrabPtr grab = mouse->deviceGrab.grab;
|
||||||
Mask mask;
|
Mask mask;
|
||||||
int inWindow; /* zero if no sprites are in window */
|
|
||||||
Bool sendevent = FALSE;
|
|
||||||
|
|
||||||
deviceEnterNotify *devEnterLeave;
|
|
||||||
int mskidx;
|
|
||||||
OtherInputMasks *inputMasks;
|
|
||||||
|
|
||||||
keybd = GetPairedDevice(mouse);
|
keybd = GetPairedDevice(mouse);
|
||||||
|
|
||||||
|
@ -4268,44 +4244,7 @@ EnterLeaveEvent(
|
||||||
IsParent(focus, pWin)))
|
IsParent(focus, pWin)))
|
||||||
event.u.enterLeave.flags |= ELFlagFocus;
|
event.u.enterLeave.flags |= ELFlagFocus;
|
||||||
|
|
||||||
|
if ((mask & filters[mouse->id][type]))
|
||||||
/*
|
|
||||||
* Sending multiple core enter/leave events to the same window confuse the
|
|
||||||
* client.
|
|
||||||
* We can send multiple events that have detail NotifyVirtual or
|
|
||||||
* NotifyNonlinearVirtual however. For most clients anyway.
|
|
||||||
*
|
|
||||||
* For standard events (NotifyAncestor, NotifyInferior, NotifyNonlinear)
|
|
||||||
* we only send an enter event for the first pointer to enter. A leave
|
|
||||||
* event is sent for the last pointer to leave.
|
|
||||||
*
|
|
||||||
* For events with Virtual detail, we send them only to a window that does
|
|
||||||
* not have a pointer inside.
|
|
||||||
*
|
|
||||||
* For a window tree in the form of
|
|
||||||
*
|
|
||||||
* A -> Bp -> C -> D
|
|
||||||
* \ (where B and E have pointers)
|
|
||||||
* -> Ep
|
|
||||||
*
|
|
||||||
* If the pointer moves from E into D, a LeaveNotify is sent to E, an
|
|
||||||
* EnterNotify is sent to D, an EnterNotify with detail
|
|
||||||
* NotifyNonlinearVirtual to C and nothing to B.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Clear bit for device, but don't worry about SDs. */
|
|
||||||
if (mouse->isMaster && type == LeaveNotify &&
|
|
||||||
(detail != NotifyVirtual && detail != NotifyNonlinearVirtual))
|
|
||||||
if (mode != NotifyUngrab)
|
|
||||||
ENTER_LEAVE_SEMAPHORE_UNSET(pWin, mouse);
|
|
||||||
|
|
||||||
inWindow = EnterLeaveSemaphoresIsset(pWin);
|
|
||||||
|
|
||||||
if(!inWindow || mode == NotifyGrab || mode == NotifyUngrab)
|
|
||||||
sendevent = TRUE;
|
|
||||||
|
|
||||||
|
|
||||||
if ((mask & filters[mouse->id][type]) && sendevent)
|
|
||||||
{
|
{
|
||||||
if (grab)
|
if (grab)
|
||||||
TryClientEvents(rClient(grab), mouse, &event, 1, mask,
|
TryClientEvents(rClient(grab), mouse, &event, 1, mask,
|
||||||
|
@ -4315,18 +4254,81 @@ EnterLeaveEvent(
|
||||||
filters[mouse->id][type], NullGrab, 0);
|
filters[mouse->id][type], NullGrab, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mouse->isMaster && type == EnterNotify &&
|
if ((type == EnterNotify) && (mask & KeymapStateMask))
|
||||||
(detail != NotifyVirtual && detail != NotifyNonlinearVirtual))
|
{
|
||||||
if (mode != NotifyGrab)
|
xKeymapEvent ke;
|
||||||
ENTER_LEAVE_SEMAPHORE_SET(pWin, mouse);
|
ClientPtr client = grab ? rClient(grab)
|
||||||
|
: clients[CLIENT_ID(pWin->drawable.id)];
|
||||||
|
if (XaceHook(XACE_DEVICE_ACCESS, client, keybd, DixReadAccess))
|
||||||
|
bzero((char *)&ke.map[0], 31);
|
||||||
|
else
|
||||||
|
memmove((char *)&ke.map[0], (char *)&keybd->key->down[1], 31);
|
||||||
|
|
||||||
|
ke.type = KeymapNotify;
|
||||||
|
if (grab)
|
||||||
|
TryClientEvents(rClient(grab), keybd, (xEvent *)&ke, 1,
|
||||||
|
mask, KeymapStateMask, grab);
|
||||||
|
else
|
||||||
|
DeliverEventsToWindow(mouse, pWin, (xEvent *)&ke, 1,
|
||||||
|
KeymapStateMask, NullGrab, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
DeviceEnterLeaveEvent(
|
||||||
|
DeviceIntPtr mouse,
|
||||||
|
int type,
|
||||||
|
int mode,
|
||||||
|
int detail,
|
||||||
|
WindowPtr pWin,
|
||||||
|
Window child)
|
||||||
|
{
|
||||||
|
xEvent event;
|
||||||
|
GrabPtr grab = mouse->deviceGrab.grab;
|
||||||
|
deviceEnterNotify *devEnterLeave;
|
||||||
|
int mskidx;
|
||||||
|
OtherInputMasks *inputMasks;
|
||||||
|
Mask mask;
|
||||||
|
DeviceIntPtr keybd = GetPairedDevice(mouse);
|
||||||
|
BOOL sameScreen;
|
||||||
|
|
||||||
|
if (grab) {
|
||||||
|
mask = (pWin == grab->window) ? grab->eventMask : 0;
|
||||||
|
if (grab->ownerEvents)
|
||||||
|
mask |= EventMaskForClient(pWin, rClient(grab));
|
||||||
|
} else {
|
||||||
|
mask = pWin->eventMask | wOtherEventMasks(pWin);
|
||||||
|
}
|
||||||
|
|
||||||
/* we don't have enough bytes, so we squash flags and mode into
|
/* we don't have enough bytes, so we squash flags and mode into
|
||||||
one byte, and use the last byte for the deviceid. */
|
one byte, and use the last byte for the deviceid. */
|
||||||
devEnterLeave = (deviceEnterNotify*)&event;
|
devEnterLeave = (deviceEnterNotify*)&event;
|
||||||
devEnterLeave->type = (type == EnterNotify) ? DeviceEnterNotify :
|
devEnterLeave->detail = detail;
|
||||||
DeviceLeaveNotify;
|
devEnterLeave->time = currentTime.milliseconds;
|
||||||
devEnterLeave->mode |= (event.u.enterLeave.flags << 4);
|
devEnterLeave->rootX = mouse->spriteInfo->sprite->hot.x;
|
||||||
|
devEnterLeave->rootY = mouse->spriteInfo->sprite->hot.y;
|
||||||
|
FixUpEventFromWindow(mouse, &event, pWin, None, FALSE);
|
||||||
|
sameScreen = event.u.keyButtonPointer.sameScreen;
|
||||||
|
|
||||||
|
devEnterLeave->child = child;
|
||||||
|
devEnterLeave->type = type;
|
||||||
devEnterLeave->deviceid = mouse->id;
|
devEnterLeave->deviceid = mouse->id;
|
||||||
|
devEnterLeave->mode = mode;
|
||||||
|
devEnterLeave->mode |= (sameScreen ? (ELFlagSameScreen << 4) : 0);
|
||||||
|
|
||||||
|
#ifdef XKB
|
||||||
|
if (!noXkbExtension) {
|
||||||
|
devEnterLeave->state = mouse->button->state & 0x1f00;
|
||||||
|
if (keybd)
|
||||||
|
devEnterLeave->state |=
|
||||||
|
XkbGrabStateFromRec(&keybd->key->xkbInfo->state);
|
||||||
|
} else
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
devEnterLeave->state = (keybd) ? keybd->key->state : 0;
|
||||||
|
devEnterLeave->state |= mouse->button->state;
|
||||||
|
}
|
||||||
|
|
||||||
mskidx = mouse->id;
|
mskidx = mouse->id;
|
||||||
inputMasks = wOtherInputMasks(pWin);
|
inputMasks = wOtherInputMasks(pWin);
|
||||||
if (inputMasks &&
|
if (inputMasks &&
|
||||||
|
@ -4334,126 +4336,15 @@ EnterLeaveEvent(
|
||||||
inputMasks->deliverableEvents[mskidx]))
|
inputMasks->deliverableEvents[mskidx]))
|
||||||
{
|
{
|
||||||
if (grab)
|
if (grab)
|
||||||
(void)TryClientEvents(rClient(grab), mouse,
|
TryClientEvents(rClient(grab), mouse,
|
||||||
(xEvent*)devEnterLeave, 1,
|
(xEvent*)devEnterLeave, 1, mask,
|
||||||
mask, filters[mouse->id][devEnterLeave->type],
|
filters[mouse->id][devEnterLeave->type], grab);
|
||||||
grab);
|
else
|
||||||
else
|
DeliverEventsToWindow(mouse, pWin, (xEvent*)devEnterLeave, 1,
|
||||||
(void)DeliverEventsToWindow(mouse, pWin, (xEvent*)devEnterLeave,
|
filters[mouse->id][devEnterLeave->type],
|
||||||
1, filters[mouse->id][devEnterLeave->type],
|
NullGrab, mouse->id);
|
||||||
NullGrab, mouse->id);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((type == EnterNotify) && (mask & KeymapStateMask))
|
|
||||||
{
|
|
||||||
xKeymapEvent ke;
|
|
||||||
ClientPtr client = grab ? rClient(grab)
|
|
||||||
: clients[CLIENT_ID(pWin->drawable.id)];
|
|
||||||
if (XaceHook(XACE_DEVICE_ACCESS, client, keybd, DixReadAccess))
|
|
||||||
bzero((char *)&ke.map[0], 31);
|
|
||||||
else
|
|
||||||
memmove((char *)&ke.map[0], (char *)&keybd->key->down[1], 31);
|
|
||||||
|
|
||||||
ke.type = KeymapNotify;
|
|
||||||
if (grab)
|
|
||||||
(void)TryClientEvents(rClient(grab), keybd, (xEvent *)&ke, 1,
|
|
||||||
mask, KeymapStateMask, grab);
|
|
||||||
else
|
|
||||||
(void)DeliverEventsToWindow(mouse, pWin, (xEvent *)&ke, 1,
|
|
||||||
KeymapStateMask, NullGrab, 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Send enter notifies to all parent windows up to ancestor.
|
|
||||||
* This function recurses.
|
|
||||||
*/
|
|
||||||
static void
|
|
||||||
EnterNotifies(DeviceIntPtr pDev,
|
|
||||||
WindowPtr ancestor,
|
|
||||||
WindowPtr child,
|
|
||||||
int mode,
|
|
||||||
int detail)
|
|
||||||
{
|
|
||||||
WindowPtr parent = child->parent;
|
|
||||||
|
|
||||||
if (ancestor == parent)
|
|
||||||
return;
|
|
||||||
EnterNotifies(pDev, ancestor, parent, mode, detail);
|
|
||||||
EnterLeaveEvent(pDev, EnterNotify, mode, detail, parent,
|
|
||||||
child->drawable.id);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Send leave notifies to all parent windows up to ancestor.
|
|
||||||
* This function recurses.
|
|
||||||
*/
|
|
||||||
static void
|
|
||||||
LeaveNotifies(DeviceIntPtr pDev,
|
|
||||||
WindowPtr child,
|
|
||||||
WindowPtr ancestor,
|
|
||||||
int mode,
|
|
||||||
int detail)
|
|
||||||
{
|
|
||||||
WindowPtr pWin;
|
|
||||||
|
|
||||||
if (ancestor == child)
|
|
||||||
return;
|
|
||||||
for (pWin = child->parent; pWin != ancestor; pWin = pWin->parent)
|
|
||||||
{
|
|
||||||
EnterLeaveEvent(pDev, LeaveNotify, mode, detail, pWin,
|
|
||||||
child->drawable.id);
|
|
||||||
child = pWin;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Figure out if enter/leave events are necessary and send them to the
|
|
||||||
* appropriate windows.
|
|
||||||
*
|
|
||||||
* @param fromWin Window the sprite moved out of.
|
|
||||||
* @param toWin Window the sprite moved into.
|
|
||||||
*/
|
|
||||||
static void
|
|
||||||
DoEnterLeaveEvents(DeviceIntPtr pDev,
|
|
||||||
WindowPtr fromWin,
|
|
||||||
WindowPtr toWin,
|
|
||||||
int mode)
|
|
||||||
{
|
|
||||||
if (!IsPointerDevice(pDev))
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (fromWin == toWin)
|
|
||||||
return;
|
|
||||||
if (IsParent(fromWin, toWin))
|
|
||||||
{
|
|
||||||
EnterLeaveEvent(pDev, LeaveNotify, mode, NotifyInferior, fromWin,
|
|
||||||
None);
|
|
||||||
EnterNotifies(pDev, fromWin, toWin, mode,
|
|
||||||
NotifyVirtual);
|
|
||||||
EnterLeaveEvent(pDev, EnterNotify, mode, NotifyAncestor, toWin, None);
|
|
||||||
}
|
|
||||||
else if (IsParent(toWin, fromWin))
|
|
||||||
{
|
|
||||||
EnterLeaveEvent(pDev, LeaveNotify, mode, NotifyAncestor, fromWin,
|
|
||||||
None);
|
|
||||||
LeaveNotifies(pDev, fromWin, toWin, mode, NotifyVirtual);
|
|
||||||
EnterLeaveEvent(pDev, EnterNotify, mode, NotifyInferior, toWin, None);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{ /* neither fromWin nor toWin is descendent of the other */
|
|
||||||
WindowPtr common = CommonAncestor(toWin, fromWin);
|
|
||||||
/* common == NullWindow ==> different screens */
|
|
||||||
EnterLeaveEvent(pDev, LeaveNotify, mode, NotifyNonlinear, fromWin,
|
|
||||||
None);
|
|
||||||
LeaveNotifies(pDev, fromWin, common, mode, NotifyNonlinearVirtual);
|
|
||||||
EnterNotifies(pDev, common, toWin, mode, NotifyNonlinearVirtual);
|
|
||||||
EnterLeaveEvent(pDev, EnterNotify, mode, NotifyNonlinear, toWin,
|
|
||||||
None);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -6258,21 +6149,6 @@ ExtGrabDevice(ClientPtr client,
|
||||||
return GrabSuccess;
|
return GrabSuccess;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* @return Zero if no device is currently in window, non-zero otherwise.
|
|
||||||
*/
|
|
||||||
int
|
|
||||||
EnterLeaveSemaphoresIsset(WindowPtr win)
|
|
||||||
{
|
|
||||||
int set = 0;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
for (i = 0; i < (MAXDEVICES + 7)/8; i++)
|
|
||||||
set += win->enterleave[i];
|
|
||||||
|
|
||||||
return set;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @return Zero if no devices has focus on the window, non-zero otherwise.
|
* @return Zero if no devices has focus on the window, non-zero otherwise.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -3091,6 +3091,8 @@ void
|
||||||
SendVisibilityNotify(WindowPtr pWin)
|
SendVisibilityNotify(WindowPtr pWin)
|
||||||
{
|
{
|
||||||
xEvent event;
|
xEvent event;
|
||||||
|
if (!MapUnmapEventsEnabled(pWin))
|
||||||
|
return;
|
||||||
#ifndef NO_XINERAMA_PORT
|
#ifndef NO_XINERAMA_PORT
|
||||||
unsigned int visibility = pWin->visibility;
|
unsigned int visibility = pWin->visibility;
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -578,14 +578,14 @@ hostx_get_visual_masks (EphyrScreenInfo screen,
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
hostx_calculate_color_shift(unsigned long mask,
|
hostx_calculate_color_shift(unsigned long mask)
|
||||||
int bits_per_rgb)
|
|
||||||
{
|
{
|
||||||
int shift = 0;
|
int shift = 1;
|
||||||
while(mask) {
|
/* count # of bits in mask */
|
||||||
mask = mask >> bits_per_rgb;
|
while (mask=(mask>>1)) shift++;
|
||||||
if (mask) shift += bits_per_rgb;
|
/* cmap entry is an unsigned char so adjust it by size of that */
|
||||||
}
|
shift = shift - sizeof(unsigned char) * 8;
|
||||||
|
if (shift < 0) shift = 0;
|
||||||
return shift;
|
return shift;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -601,12 +601,9 @@ hostx_set_cmap_entry(unsigned char idx,
|
||||||
static int first_time = 1;
|
static int first_time = 1;
|
||||||
if (first_time) {
|
if (first_time) {
|
||||||
first_time = 0;
|
first_time = 0;
|
||||||
rshift = hostx_calculate_color_shift(HostX.visual->red_mask,
|
rshift = hostx_calculate_color_shift(HostX.visual->red_mask);
|
||||||
HostX.visual->bits_per_rgb);
|
gshift = hostx_calculate_color_shift(HostX.visual->green_mask);
|
||||||
gshift = hostx_calculate_color_shift(HostX.visual->green_mask,
|
bshift = hostx_calculate_color_shift(HostX.visual->blue_mask);
|
||||||
HostX.visual->bits_per_rgb);
|
|
||||||
bshift = hostx_calculate_color_shift(HostX.visual->blue_mask,
|
|
||||||
HostX.visual->bits_per_rgb);
|
|
||||||
}
|
}
|
||||||
HostX.cmap[idx] = ((r << rshift) & HostX.visual->red_mask) |
|
HostX.cmap[idx] = ((r << rshift) & HostX.visual->red_mask) |
|
||||||
((g << gshift) & HostX.visual->green_mask) |
|
((g << gshift) & HostX.visual->green_mask) |
|
||||||
|
|
|
@ -14,7 +14,7 @@ XISOURCES = xf86Xinput.c xisb.c
|
||||||
XISDKINCS = xf86Xinput.h xisb.h
|
XISDKINCS = xf86Xinput.h xisb.h
|
||||||
RANDRSOURCES = xf86RandR.c
|
RANDRSOURCES = xf86RandR.c
|
||||||
|
|
||||||
BUSSOURCES = xf86isaBus.c xf86pciBus.c xf86fbBus.c xf86noBus.c $(SBUS_SOURCES)
|
BUSSOURCES = xf86pciBus.c xf86fbBus.c xf86noBus.c $(SBUS_SOURCES)
|
||||||
|
|
||||||
MODEDEFSOURCES = $(srcdir)/vesamodes $(srcdir)/extramodes
|
MODEDEFSOURCES = $(srcdir)/vesamodes $(srcdir)/extramodes
|
||||||
|
|
||||||
|
@ -27,8 +27,7 @@ BUILT_SOURCES = xf86DefModeSet.c
|
||||||
AM_LDFLAGS = -r
|
AM_LDFLAGS = -r
|
||||||
libcommon_la_SOURCES = xf86Configure.c xf86ShowOpts.c xf86Bus.c xf86Config.c \
|
libcommon_la_SOURCES = xf86Configure.c xf86ShowOpts.c xf86Bus.c xf86Config.c \
|
||||||
xf86Cursor.c xf86DGA.c xf86DPMS.c \
|
xf86Cursor.c xf86DGA.c xf86DPMS.c \
|
||||||
xf86DoProbe.c xf86Events.c \
|
xf86Events.c xf86Globals.c xf86AutoConfig.c \
|
||||||
xf86Globals.c xf86AutoConfig.c \
|
|
||||||
xf86Option.c \
|
xf86Option.c \
|
||||||
xf86VidMode.c xf86fbman.c xf86cmap.c \
|
xf86VidMode.c xf86fbman.c xf86cmap.c \
|
||||||
xf86Helper.c xf86PM.c xf86RAC.c xf86Xinput.c xisb.c \
|
xf86Helper.c xf86PM.c xf86RAC.c xf86Xinput.c xisb.c \
|
||||||
|
|
|
@ -1541,8 +1541,6 @@ extern void (*xf86WriteMmio32)(int, void *, unsigned long);
|
||||||
extern void (*xf86WriteMmioNB8)(int, void *, unsigned long);
|
extern void (*xf86WriteMmioNB8)(int, void *, unsigned long);
|
||||||
extern void (*xf86WriteMmioNB16)(int, void *, unsigned long);
|
extern void (*xf86WriteMmioNB16)(int, void *, unsigned long);
|
||||||
extern void (*xf86WriteMmioNB32)(int, void *, unsigned long);
|
extern void (*xf86WriteMmioNB32)(int, void *, unsigned long);
|
||||||
extern void xf86JensenMemToBus(char *, long, long, int);
|
|
||||||
extern void xf86JensenBusToMem(char *, char *, unsigned long, int);
|
|
||||||
extern void xf86SlowBCopyFromBus(unsigned char *, unsigned char *, int);
|
extern void xf86SlowBCopyFromBus(unsigned char *, unsigned char *, int);
|
||||||
extern void xf86SlowBCopyToBus(unsigned char *, unsigned char *, int);
|
extern void xf86SlowBCopyToBus(unsigned char *, unsigned char *, int);
|
||||||
|
|
||||||
|
@ -1556,20 +1554,13 @@ extern void xf86SlowBCopyToBus(unsigned char *, unsigned char *, int);
|
||||||
# define MMIO_IN32(base, offset) xf86ReadMmio32(base, offset)
|
# define MMIO_IN32(base, offset) xf86ReadMmio32(base, offset)
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
# if defined (JENSEN_SUPPORT)
|
# define MMIO_OUT32(base, offset, val) \
|
||||||
# define MMIO_OUT32(base, offset, val) \
|
|
||||||
(*xf86WriteMmio32)((CARD32)(val), base, offset)
|
|
||||||
# define MMIO_ONB32(base, offset, val) \
|
|
||||||
(*xf86WriteMmioNB32)((CARD32)(val), base, offset)
|
|
||||||
# else
|
|
||||||
# define MMIO_OUT32(base, offset, val) \
|
|
||||||
do { \
|
do { \
|
||||||
write_mem_barrier(); \
|
write_mem_barrier(); \
|
||||||
*(volatile CARD32 *)(void *)(((CARD8*)(base)) + (offset)) = (val); \
|
*(volatile CARD32 *)(void *)(((CARD8*)(base)) + (offset)) = (val); \
|
||||||
} while (0)
|
} while (0)
|
||||||
# define MMIO_ONB32(base, offset, val) \
|
# define MMIO_ONB32(base, offset, val) \
|
||||||
*(volatile CARD32 *)(void *)(((CARD8*)(base)) + (offset)) = (val)
|
*(volatile CARD32 *)(void *)(((CARD8*)(base)) + (offset)) = (val)
|
||||||
# endif
|
|
||||||
|
|
||||||
# define MMIO_OUT8(base, offset, val) \
|
# define MMIO_OUT8(base, offset, val) \
|
||||||
(*xf86WriteMmio8)((CARD8)(val), base, offset)
|
(*xf86WriteMmio8)((CARD8)(val), base, offset)
|
||||||
|
|
|
@ -66,7 +66,6 @@ extern ScrnInfoPtr *xf86Screens; /* List of pointers to ScrnInfoRecs */
|
||||||
extern const unsigned char byte_reversed[256];
|
extern const unsigned char byte_reversed[256];
|
||||||
extern ScrnInfoPtr xf86CurrentScreen;
|
extern ScrnInfoPtr xf86CurrentScreen;
|
||||||
extern Bool pciSlotClaimed;
|
extern Bool pciSlotClaimed;
|
||||||
extern Bool isaSlotClaimed;
|
|
||||||
extern Bool fbSlotClaimed;
|
extern Bool fbSlotClaimed;
|
||||||
#if defined(__sparc__) || defined(__sparc)
|
#if defined(__sparc__) || defined(__sparc)
|
||||||
extern Bool sbusSlotClaimed;
|
extern Bool sbusSlotClaimed;
|
||||||
|
@ -103,16 +102,12 @@ Bool xf86ParsePciBusString(const char *busID, int *bus, int *device,
|
||||||
Bool xf86ComparePciBusString(const char *busID, int bus, int device, int func);
|
Bool xf86ComparePciBusString(const char *busID, int bus, int device, int func);
|
||||||
void xf86FormatPciBusNumber(int busnum, char *buffer);
|
void xf86FormatPciBusNumber(int busnum, char *buffer);
|
||||||
resPtr xf86AddRangesToList(resPtr list, resRange *pRange, int entityIndex);
|
resPtr xf86AddRangesToList(resPtr list, resRange *pRange, int entityIndex);
|
||||||
int xf86ClaimIsaSlot(DriverPtr drvp, int chipset, GDevPtr dev, Bool active);
|
|
||||||
int xf86GetIsaInfoForScreen(int scrnIndex);
|
|
||||||
int xf86GetFbInfoForScreen(int scrnIndex);
|
int xf86GetFbInfoForScreen(int scrnIndex);
|
||||||
Bool xf86ParseIsaBusString(const char *busID);
|
|
||||||
int xf86ClaimFbSlot(DriverPtr drvp, int chipset, GDevPtr dev, Bool active);
|
int xf86ClaimFbSlot(DriverPtr drvp, int chipset, GDevPtr dev, Bool active);
|
||||||
int xf86ClaimNoSlot(DriverPtr drvp, int chipset, GDevPtr dev, Bool active);
|
int xf86ClaimNoSlot(DriverPtr drvp, int chipset, GDevPtr dev, Bool active);
|
||||||
void xf86EnableAccess(ScrnInfoPtr pScrn);
|
void xf86EnableAccess(ScrnInfoPtr pScrn);
|
||||||
void xf86SetCurrentAccess(Bool Enable, ScrnInfoPtr pScrn);
|
void xf86SetCurrentAccess(Bool Enable, ScrnInfoPtr pScrn);
|
||||||
Bool xf86IsPrimaryPci(struct pci_device * pPci);
|
Bool xf86IsPrimaryPci(struct pci_device * pPci);
|
||||||
Bool xf86IsPrimaryIsa(void);
|
|
||||||
/* new RAC */
|
/* new RAC */
|
||||||
resPtr xf86AddResToList(resPtr rlist, resRange *Range, int entityIndex);
|
resPtr xf86AddResToList(resPtr rlist, resRange *Range, int entityIndex);
|
||||||
void xf86FreeResList(resPtr rlist);
|
void xf86FreeResList(resPtr rlist);
|
||||||
|
@ -159,8 +154,6 @@ DevUnion *xf86GetEntityPrivate(int entityIndex, int privIndex);
|
||||||
/* xf86Configure.c */
|
/* xf86Configure.c */
|
||||||
GDevPtr xf86AddBusDeviceToConfigure(const char *driver, BusType bus,
|
GDevPtr xf86AddBusDeviceToConfigure(const char *driver, BusType bus,
|
||||||
void *busData, int chipset);
|
void *busData, int chipset);
|
||||||
GDevPtr xf86AddDeviceToConfigure( const char *driver,
|
|
||||||
struct pci_device * pVideo, int chipset );
|
|
||||||
|
|
||||||
/* xf86Cursor.c */
|
/* xf86Cursor.c */
|
||||||
|
|
||||||
|
@ -243,10 +236,6 @@ int xf86MatchPciInstances(const char *driverName, int vendorID,
|
||||||
SymTabPtr chipsets, PciChipsets *PCIchipsets,
|
SymTabPtr chipsets, PciChipsets *PCIchipsets,
|
||||||
GDevPtr *devList, int numDevs, DriverPtr drvp,
|
GDevPtr *devList, int numDevs, DriverPtr drvp,
|
||||||
int **foundEntities);
|
int **foundEntities);
|
||||||
int xf86MatchIsaInstances(const char *driverName, SymTabPtr chipsets,
|
|
||||||
IsaChipsets *ISAchipsets, DriverPtr drvp,
|
|
||||||
FindIsaDevProc FindIsaDevice, GDevPtr *devList,
|
|
||||||
int numDevs, int **foundEntities);
|
|
||||||
void xf86GetClocks(ScrnInfoPtr pScrn, int num,
|
void xf86GetClocks(ScrnInfoPtr pScrn, int num,
|
||||||
Bool (*ClockFunc)(ScrnInfoPtr, int),
|
Bool (*ClockFunc)(ScrnInfoPtr, int),
|
||||||
void (*ProtectRegs)(ScrnInfoPtr, Bool),
|
void (*ProtectRegs)(ScrnInfoPtr, Bool),
|
||||||
|
@ -297,11 +286,6 @@ ScrnInfoPtr xf86ConfigPciEntity(ScrnInfoPtr pScrn, int scrnFlag,
|
||||||
resList res, EntityProc init,
|
resList res, EntityProc init,
|
||||||
EntityProc enter, EntityProc leave,
|
EntityProc enter, EntityProc leave,
|
||||||
pointer private);
|
pointer private);
|
||||||
ScrnInfoPtr xf86ConfigIsaEntity(ScrnInfoPtr pScrn, int scrnFlag,
|
|
||||||
int entityIndex, IsaChipsets *i_chip,
|
|
||||||
resList res, EntityProc init,
|
|
||||||
EntityProc enter, EntityProc leave,
|
|
||||||
pointer private);
|
|
||||||
ScrnInfoPtr xf86ConfigFbEntity(ScrnInfoPtr pScrn, int scrnFlag,
|
ScrnInfoPtr xf86ConfigFbEntity(ScrnInfoPtr pScrn, int scrnFlag,
|
||||||
int entityIndex, EntityProc init,
|
int entityIndex, EntityProc init,
|
||||||
EntityProc enter, EntityProc leave,
|
EntityProc enter, EntityProc leave,
|
||||||
|
@ -313,19 +297,10 @@ Bool xf86ConfigActivePciEntity(ScrnInfoPtr pScrn,
|
||||||
EntityProc enter, EntityProc leave,
|
EntityProc enter, EntityProc leave,
|
||||||
pointer private);
|
pointer private);
|
||||||
/* Obsolete! don't use */
|
/* Obsolete! don't use */
|
||||||
Bool xf86ConfigActiveIsaEntity(ScrnInfoPtr pScrn,
|
|
||||||
int entityIndex, IsaChipsets *i_chip,
|
|
||||||
resList res, EntityProc init,
|
|
||||||
EntityProc enter, EntityProc leave,
|
|
||||||
pointer private);
|
|
||||||
void xf86ConfigPciEntityInactive(EntityInfoPtr pEnt, PciChipsets *p_chip,
|
void xf86ConfigPciEntityInactive(EntityInfoPtr pEnt, PciChipsets *p_chip,
|
||||||
resList res, EntityProc init,
|
resList res, EntityProc init,
|
||||||
EntityProc enter, EntityProc leave,
|
EntityProc enter, EntityProc leave,
|
||||||
pointer private);
|
pointer private);
|
||||||
void xf86ConfigIsaEntityInactive(EntityInfoPtr pEnt, IsaChipsets *i_chip,
|
|
||||||
resList res, EntityProc init,
|
|
||||||
EntityProc enter, EntityProc leave,
|
|
||||||
pointer private);
|
|
||||||
void xf86ConfigFbEntityInactive(EntityInfoPtr pEnt, EntityProc init,
|
void xf86ConfigFbEntityInactive(EntityInfoPtr pEnt, EntityProc init,
|
||||||
EntityProc enter, EntityProc leave,
|
EntityProc enter, EntityProc leave,
|
||||||
pointer private);
|
pointer private);
|
||||||
|
@ -369,13 +344,14 @@ void xf86PruneDriverModes(ScrnInfoPtr scrp);
|
||||||
void xf86SetCrtcForModes(ScrnInfoPtr scrp, int adjustFlags);
|
void xf86SetCrtcForModes(ScrnInfoPtr scrp, int adjustFlags);
|
||||||
void xf86PrintModes(ScrnInfoPtr scrp);
|
void xf86PrintModes(ScrnInfoPtr scrp);
|
||||||
void xf86ShowClockRanges(ScrnInfoPtr scrp, ClockRangePtr clockRanges);
|
void xf86ShowClockRanges(ScrnInfoPtr scrp, ClockRangePtr clockRanges);
|
||||||
double xf86ModeHSync(DisplayModePtr mode);
|
double xf86ModeHSync(const DisplayModeRec *mode);
|
||||||
double xf86ModeVRefresh(DisplayModePtr mode);
|
double xf86ModeVRefresh(const DisplayModeRec *mode);
|
||||||
void xf86SetModeDefaultName(DisplayModePtr mode);
|
void xf86SetModeDefaultName(DisplayModePtr mode);
|
||||||
void xf86SetModeCrtc(DisplayModePtr p, int adjustFlags);
|
void xf86SetModeCrtc(DisplayModePtr p, int adjustFlags);
|
||||||
DisplayModePtr xf86DuplicateMode(DisplayModePtr pMode);
|
DisplayModePtr xf86DuplicateMode(const DisplayModeRec *pMode);
|
||||||
DisplayModePtr xf86DuplicateModes(ScrnInfoPtr pScrn, DisplayModePtr modeList);
|
DisplayModePtr xf86DuplicateModes(ScrnInfoPtr pScrn, DisplayModePtr modeList);
|
||||||
Bool xf86ModesEqual(DisplayModePtr pMode1, DisplayModePtr pMode2);
|
Bool xf86ModesEqual(const DisplayModeRec *pMode1,
|
||||||
|
const DisplayModeRec *pMode2);
|
||||||
void xf86PrintModeline(int scrnIndex,DisplayModePtr mode);
|
void xf86PrintModeline(int scrnIndex,DisplayModePtr mode);
|
||||||
DisplayModePtr xf86ModesAdd(DisplayModePtr modes, DisplayModePtr new);
|
DisplayModePtr xf86ModesAdd(DisplayModePtr modes, DisplayModePtr new);
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,6 @@
|
||||||
* authorization from the copyright holder(s) and author(s).
|
* authorization from the copyright holder(s) and author(s).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define REDUCER
|
|
||||||
/*
|
/*
|
||||||
* This file contains the interfaces to the bus-specific code
|
* This file contains the interfaces to the bus-specific code
|
||||||
*/
|
*/
|
||||||
|
@ -71,10 +70,6 @@ BusRec primaryBus = { BUS_NONE, {{0}}};
|
||||||
|
|
||||||
static Bool xf86ResAccessEnter = FALSE;
|
static Bool xf86ResAccessEnter = FALSE;
|
||||||
|
|
||||||
#ifdef REDUCER
|
|
||||||
/* Resources that temporarily conflict with estimated resources */
|
|
||||||
static resPtr AccReducers = NULL;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* resource lists */
|
/* resource lists */
|
||||||
resPtr Acc = NULL;
|
resPtr Acc = NULL;
|
||||||
|
@ -99,10 +94,6 @@ static Bool doFramebufferMode = FALSE;
|
||||||
static StateChangeNotificationPtr StateChangeNotificationList;
|
static StateChangeNotificationPtr StateChangeNotificationList;
|
||||||
static void notifyStateChange(xf86NotifyState state);
|
static void notifyStateChange(xf86NotifyState state);
|
||||||
|
|
||||||
#undef MIN
|
|
||||||
#define MIN(x,y) ((x<y)?x:y)
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Call the bus probes relevant to the architecture.
|
* Call the bus probes relevant to the architecture.
|
||||||
*
|
*
|
||||||
|
@ -144,8 +135,6 @@ StringToBusType(const char* busID, const char **retID)
|
||||||
}
|
}
|
||||||
if (!xf86NameCmp(p, "pci") || !xf86NameCmp(p, "agp"))
|
if (!xf86NameCmp(p, "pci") || !xf86NameCmp(p, "agp"))
|
||||||
ret = BUS_PCI;
|
ret = BUS_PCI;
|
||||||
if (!xf86NameCmp(p, "isa"))
|
|
||||||
ret = BUS_ISA;
|
|
||||||
if (!xf86NameCmp(p, "sbus"))
|
if (!xf86NameCmp(p, "sbus"))
|
||||||
ret = BUS_SBUS;
|
ret = BUS_SBUS;
|
||||||
if (ret != BUS_NONE)
|
if (ret != BUS_NONE)
|
||||||
|
@ -163,8 +152,6 @@ void
|
||||||
xf86EntityInit(void)
|
xf86EntityInit(void)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
resPtr *pprev_next;
|
|
||||||
resPtr res;
|
|
||||||
xf86AccessPtr pacc;
|
xf86AccessPtr pacc;
|
||||||
|
|
||||||
for (i = 0; i < xf86NumEntities; i++)
|
for (i = 0; i < xf86NumEntities; i++)
|
||||||
|
@ -176,17 +163,6 @@ xf86EntityInit(void)
|
||||||
pacc->AccessEnable(pacc->arg);
|
pacc->AccessEnable(pacc->arg);
|
||||||
xf86Entities[i]->entityInit(i,xf86Entities[i]->private);
|
xf86Entities[i]->entityInit(i,xf86Entities[i]->private);
|
||||||
pacc->AccessDisable(pacc->arg);
|
pacc->AccessDisable(pacc->arg);
|
||||||
/* remove init resources after init is processed */
|
|
||||||
pprev_next = &Acc;
|
|
||||||
res = Acc;
|
|
||||||
while (res) {
|
|
||||||
if (res->res_type & ResInit && (res->entityIndex == i)) {
|
|
||||||
(*pprev_next) = res->next;
|
|
||||||
xfree(res);
|
|
||||||
} else
|
|
||||||
pprev_next = &(res->next);
|
|
||||||
res = (*pprev_next);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -248,8 +224,6 @@ xf86IsEntityPrimary(int entityIndex)
|
||||||
switch (pEnt->busType) {
|
switch (pEnt->busType) {
|
||||||
case BUS_PCI:
|
case BUS_PCI:
|
||||||
return (pEnt->bus.id.pci == primaryBus.id.pci);
|
return (pEnt->bus.id.pci == primaryBus.id.pci);
|
||||||
case BUS_ISA:
|
|
||||||
return TRUE;
|
|
||||||
case BUS_SBUS:
|
case BUS_SBUS:
|
||||||
return (pEnt->sbusBusId.fbNum == primaryBus.id.sbus.fbNum);
|
return (pEnt->sbusBusId.fbNum == primaryBus.id.sbus.fbNum);
|
||||||
default:
|
default:
|
||||||
|
@ -1000,10 +974,6 @@ needCheck(resPtr pRes, unsigned long type, int entityIndex, xf86State state)
|
||||||
BusType loc = BUS_NONE;
|
BusType loc = BUS_NONE;
|
||||||
BusType r_loc = BUS_NONE;
|
BusType r_loc = BUS_NONE;
|
||||||
|
|
||||||
/* Ignore overlapped ranges that have been nullified */
|
|
||||||
if ((pRes->res_type & ResOverlap) && (pRes->block_begin > pRes->block_end))
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
if ((pRes->res_type & ResTypeMask) != (type & ResTypeMask))
|
if ((pRes->res_type & ResTypeMask) != (type & ResTypeMask))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
@ -1014,10 +984,6 @@ needCheck(resPtr pRes, unsigned long type, int entityIndex, xf86State state)
|
||||||
if (pRes->res_type & type & ResBios)
|
if (pRes->res_type & type & ResBios)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
/*If requested, skip over estimated resources */
|
|
||||||
if (pRes->res_type & type & ResEstimated)
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
if (type & pRes->res_type & ResUnused)
|
if (type & pRes->res_type & ResUnused)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
@ -1039,32 +1005,9 @@ needCheck(resPtr pRes, unsigned long type, int entityIndex, xf86State state)
|
||||||
if (pRes->entityIndex > -1)
|
if (pRes->entityIndex > -1)
|
||||||
r_loc = xf86Entities[pRes->entityIndex]->busType;
|
r_loc = xf86Entities[pRes->entityIndex]->busType;
|
||||||
|
|
||||||
switch (type & ResAccMask) {
|
if ((type & ResAccMask == ResShared) &&
|
||||||
case ResExclusive:
|
(pRes->res_type & ResAccMask) == ResShared)
|
||||||
switch (pRes->res_type & ResAccMask) {
|
return FALSE;
|
||||||
case ResExclusive:
|
|
||||||
break;
|
|
||||||
case ResShared:
|
|
||||||
/* ISA buses are only locally exclusive on a PCI system */
|
|
||||||
if (loc == BUS_ISA && r_loc == BUS_PCI)
|
|
||||||
return FALSE;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case ResShared:
|
|
||||||
switch (pRes->res_type & ResAccMask) {
|
|
||||||
case ResExclusive:
|
|
||||||
/* ISA buses are only locally exclusive on a PCI system */
|
|
||||||
if (loc == BUS_PCI && r_loc == BUS_ISA)
|
|
||||||
return FALSE;
|
|
||||||
break;
|
|
||||||
case ResShared:
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case ResAny:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (pRes->entityIndex == entityIndex) return FALSE;
|
if (pRes->entityIndex == entityIndex) return FALSE;
|
||||||
|
|
||||||
|
@ -1289,10 +1232,6 @@ xf86PrintResList(int verb, resPtr list)
|
||||||
s = "[?]";
|
s = "[?]";
|
||||||
}
|
}
|
||||||
xf86ErrorFVerb(verb, "%s", s);
|
xf86ErrorFVerb(verb, "%s", s);
|
||||||
if (list->res_type & ResEstimated)
|
|
||||||
xf86ErrorFVerb(verb, "E");
|
|
||||||
if (list->res_type & ResOverlap)
|
|
||||||
xf86ErrorFVerb(verb, "O");
|
|
||||||
if (list->res_type & ResInit)
|
if (list->res_type & ResInit)
|
||||||
xf86ErrorFVerb(verb, "t");
|
xf86ErrorFVerb(verb, "t");
|
||||||
if (list->res_type & ResBios)
|
if (list->res_type & ResBios)
|
||||||
|
@ -1346,117 +1285,10 @@ xf86ResourceBrokerInit(void)
|
||||||
xf86PrintResList(3, Acc);
|
xf86PrintResList(3, Acc);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define MEM_ALIGN (1024 * 1024)
|
|
||||||
|
|
||||||
/*
|
|
||||||
* RemoveOverlaps() -- remove overlaps between resources of the
|
|
||||||
* same kind.
|
|
||||||
* Beware: This function doesn't check for access attributes.
|
|
||||||
* At resource broker initialization this is no problem as this
|
|
||||||
* only deals with exclusive resources.
|
|
||||||
*/
|
|
||||||
|
|
||||||
void
|
|
||||||
RemoveOverlaps(resPtr target, resPtr list, Bool pow2Alignment, Bool useEstimated)
|
|
||||||
{
|
|
||||||
resPtr pRes;
|
|
||||||
memType size, newsize, adjust;
|
|
||||||
|
|
||||||
if (!target)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (!(target->res_type & ResEstimated) /* Don't touch sure resources */
|
|
||||||
&& !(target->res_type & ResOverlap)) /* Unless they may overlap */
|
|
||||||
return;
|
|
||||||
|
|
||||||
for (pRes = list; pRes; pRes = pRes->next) {
|
|
||||||
if (pRes == target
|
|
||||||
|| ((pRes->res_type & ResTypeMask) !=
|
|
||||||
(target->res_type & ResTypeMask))
|
|
||||||
|| pRes->block_begin > target->block_end
|
|
||||||
|| pRes->block_end < target->block_begin)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (pRes->block_begin <= target->block_begin) {
|
|
||||||
/* Possibly ignore estimated resources */
|
|
||||||
if (!useEstimated && (pRes->res_type & ResEstimated))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
/* Special cases */
|
|
||||||
if (pRes->block_end >= target->block_end) {
|
|
||||||
/*
|
|
||||||
* If pRes fully contains target, don't do anything
|
|
||||||
* unless target can overlap.
|
|
||||||
*/
|
|
||||||
if (target->res_type & ResOverlap) {
|
|
||||||
/* Nullify range but keep its ResOverlap bit on */
|
|
||||||
target->block_end = target->block_begin - 1;
|
|
||||||
return;
|
|
||||||
} else
|
|
||||||
continue;
|
|
||||||
} else {
|
|
||||||
#if 0 /* Don't trim start address - we trust what we got */
|
|
||||||
/*
|
|
||||||
* If !pow2Alignment trim start address: !pow2Alingment
|
|
||||||
* is only set when estimated OS addresses are handled.
|
|
||||||
* In cases where the target and pRes have the same
|
|
||||||
* starting address, reduce the size of the target
|
|
||||||
* (given it's an estimate).
|
|
||||||
*/
|
|
||||||
if (!pow2Alignment)
|
|
||||||
target->block_begin = pRes->block_end + 1;
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
if (pRes->block_begin == target->block_begin)
|
|
||||||
target->block_end = pRes->block_end;
|
|
||||||
else
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
/* Trim target to remove the overlap */
|
|
||||||
target->block_end = pRes->block_begin - 1;
|
|
||||||
}
|
|
||||||
if (pow2Alignment) {
|
|
||||||
/*
|
|
||||||
* Align to a power of two. This requires finding the
|
|
||||||
* largest power of two that is smaller than the adjusted
|
|
||||||
* size.
|
|
||||||
*/
|
|
||||||
size = target->block_end - target->block_begin + 1;
|
|
||||||
newsize = 1UL << (sizeof(memType) * 8 - 1);
|
|
||||||
while (!(newsize & size))
|
|
||||||
newsize >>= 1;
|
|
||||||
target->block_end = target->block_begin + newsize - 1;
|
|
||||||
} else if (target->block_end > MEM_ALIGN) {
|
|
||||||
/* Align the end to MEM_ALIGN */
|
|
||||||
if ((adjust = (target->block_end + 1) % MEM_ALIGN))
|
|
||||||
target->block_end -= adjust;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Resource registration
|
* Resource registration
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static resList
|
|
||||||
xf86GetResourcesImplicitly(int entityIndex)
|
|
||||||
{
|
|
||||||
if (entityIndex >= xf86NumEntities) return NULL;
|
|
||||||
|
|
||||||
switch (xf86Entities[entityIndex]->bus.type) {
|
|
||||||
case BUS_ISA:
|
|
||||||
case BUS_NONE:
|
|
||||||
case BUS_SBUS:
|
|
||||||
return NULL;
|
|
||||||
case BUS_PCI:
|
|
||||||
return NULL;
|
|
||||||
case BUS_last:
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
convertRange2Host(int entityIndex, resRange *pRange)
|
convertRange2Host(int entityIndex, resRange *pRange)
|
||||||
{
|
{
|
||||||
|
@ -1465,9 +1297,6 @@ convertRange2Host(int entityIndex, resRange *pRange)
|
||||||
case BUS_PCI:
|
case BUS_PCI:
|
||||||
pciConvertRange2Host(entityIndex,pRange);
|
pciConvertRange2Host(entityIndex,pRange);
|
||||||
break;
|
break;
|
||||||
case BUS_ISA:
|
|
||||||
isaConvertRange2Host(pRange);
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1487,23 +1316,18 @@ xf86ConvertListToHost(int entityIndex, resPtr list)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* xf86RegisterResources() -- attempts to register listed resources.
|
* xf86RegisterResources() -- attempts to register listed resources.
|
||||||
* If list is NULL it tries to obtain resources implicitly. Function
|
* Returns a resPtr listing all resources not successfully registered, by
|
||||||
* returns a resPtr listing all resources not successfully registered.
|
* which we mean, NULL.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
_X_EXPORT resPtr
|
_X_EXPORT resPtr
|
||||||
xf86RegisterResources(int entityIndex, resList list, unsigned long access)
|
xf86RegisterResources(int entityIndex, resList list, unsigned long access)
|
||||||
{
|
{
|
||||||
resPtr res = NULL;
|
|
||||||
resRange range;
|
resRange range;
|
||||||
resList list_f = NULL;
|
resList list_f = NULL;
|
||||||
|
|
||||||
if (!list) {
|
if (!list)
|
||||||
list = xf86GetResourcesImplicitly(entityIndex);
|
return NULL;
|
||||||
/* these resources have to be in host address space already */
|
|
||||||
if (!list) return NULL;
|
|
||||||
list_f = list;
|
|
||||||
}
|
|
||||||
|
|
||||||
while(list->type != ResEnd) {
|
while(list->type != ResEnd) {
|
||||||
range = *list;
|
range = *list;
|
||||||
|
@ -1514,15 +1338,7 @@ xf86RegisterResources(int entityIndex, resList list, unsigned long access)
|
||||||
range.type = (range.type & ~ResAccMask) | (access & ResAccMask);
|
range.type = (range.type & ~ResAccMask) | (access & ResAccMask);
|
||||||
}
|
}
|
||||||
range.type &= ~ResEstimated; /* Not allowed for drivers */
|
range.type &= ~ResEstimated; /* Not allowed for drivers */
|
||||||
#if !((defined(__alpha__) || (defined(__ia64__))) && defined(linux))
|
Acc = xf86AddResToList(Acc,&range,entityIndex);
|
||||||
/* On Alpha Linux, do not check for conflicts, trust the kernel. */
|
|
||||||
if (checkConflict(&range, Acc, entityIndex, SETUP,TRUE))
|
|
||||||
res = xf86AddResToList(res,&range,entityIndex);
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
Acc = xf86AddResToList(Acc,&range,entityIndex);
|
|
||||||
}
|
|
||||||
list++;
|
list++;
|
||||||
}
|
}
|
||||||
if (list_f)
|
if (list_f)
|
||||||
|
@ -1532,11 +1348,7 @@ xf86RegisterResources(int entityIndex, resList list, unsigned long access)
|
||||||
xf86MsgVerb(X_INFO, 3,"Resources after driver initialization\n");
|
xf86MsgVerb(X_INFO, 3,"Resources after driver initialization\n");
|
||||||
xf86PrintResList(3, Acc);
|
xf86PrintResList(3, Acc);
|
||||||
#endif
|
#endif
|
||||||
if (res) {
|
return NULL;
|
||||||
xf86MsgVerb(X_INFO, 3, "Failed to register resources:\n");
|
|
||||||
xf86PrintResList(3, res);
|
|
||||||
}
|
|
||||||
return res;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1545,7 +1357,6 @@ busTypeSpecific(EntityPtr pEnt, xf86AccessPtr *acc_mem,
|
||||||
xf86AccessPtr *acc_io, xf86AccessPtr *acc_mem_io)
|
xf86AccessPtr *acc_io, xf86AccessPtr *acc_mem_io)
|
||||||
{
|
{
|
||||||
switch (pEnt->bus.type) {
|
switch (pEnt->bus.type) {
|
||||||
case BUS_ISA:
|
|
||||||
case BUS_SBUS:
|
case BUS_SBUS:
|
||||||
*acc_mem = *acc_io = *acc_mem_io = &AccessNULL;
|
*acc_mem = *acc_io = *acc_mem_io = &AccessNULL;
|
||||||
break;
|
break;
|
||||||
|
@ -1871,44 +1682,6 @@ xf86SetOperatingState(resList list, int entityIndex, int mask)
|
||||||
/*
|
/*
|
||||||
* Stage specific code
|
* Stage specific code
|
||||||
*/
|
*/
|
||||||
/*
|
|
||||||
* ProcessEstimatedConflicts() -- Do something about driver-registered
|
|
||||||
* resources that conflict with estimated resources. For now, just register
|
|
||||||
* them with a logged warning.
|
|
||||||
*/
|
|
||||||
#ifdef REDUCER
|
|
||||||
static void
|
|
||||||
ProcessEstimatedConflicts(void)
|
|
||||||
{
|
|
||||||
if (!AccReducers)
|
|
||||||
return;
|
|
||||||
|
|
||||||
/* Temporary */
|
|
||||||
xf86MsgVerb(X_WARNING, 3,
|
|
||||||
"Registering the following despite conflicts with estimated"
|
|
||||||
" resources:\n");
|
|
||||||
xf86PrintResList(3, AccReducers);
|
|
||||||
Acc = xf86JoinResLists(Acc, AccReducers);
|
|
||||||
AccReducers = NULL;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
|
||||||
* xf86ClaimFixedResources() -- This function gets called from the
|
|
||||||
* driver Probe() function to claim fixed resources.
|
|
||||||
*/
|
|
||||||
static void
|
|
||||||
resError(resList list)
|
|
||||||
{
|
|
||||||
FatalError("A driver tried to allocate the %s %sresource at \n"
|
|
||||||
"0x%lx:0x%lx which conflicted with another resource. Send the\n"
|
|
||||||
"output of the server to %s. Please \n"
|
|
||||||
"specify your computer hardware as closely as possible.\n",
|
|
||||||
ResIsBlock(list)?"Block":"Sparse",
|
|
||||||
ResIsMem(list)?"Mem":"Io",
|
|
||||||
ResIsBlock(list)?list->rBegin:list->rBase,
|
|
||||||
ResIsBlock(list)?list->rEnd:list->rMask,BUILDERADDR);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* xf86ClaimFixedResources() is used to allocate non-relocatable resources.
|
* xf86ClaimFixedResources() is used to allocate non-relocatable resources.
|
||||||
|
@ -1932,20 +1705,7 @@ xf86ClaimFixedResources(resList list, int entityIndex)
|
||||||
case ResExclusive:
|
case ResExclusive:
|
||||||
if (!xf86ChkConflict(&range, entityIndex)) {
|
if (!xf86ChkConflict(&range, entityIndex)) {
|
||||||
Acc = xf86AddResToList(Acc, &range, entityIndex);
|
Acc = xf86AddResToList(Acc, &range, entityIndex);
|
||||||
#ifdef REDUCER
|
} else FatalError("xf86ClaimFixedResources conflict\n");
|
||||||
} else {
|
|
||||||
range.type |= ResEstimated;
|
|
||||||
if (!xf86ChkConflict(&range, entityIndex) &&
|
|
||||||
!checkConflict(&range, AccReducers, entityIndex,
|
|
||||||
SETUP, FALSE)) {
|
|
||||||
range.type &= ~(ResEstimated | ResBios);
|
|
||||||
AccReducers =
|
|
||||||
xf86AddResToList(AccReducers, &range, entityIndex);
|
|
||||||
#endif
|
|
||||||
} else resError(&range); /* no return */
|
|
||||||
#ifdef REDUCER
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
break;
|
break;
|
||||||
case ResShared:
|
case ResShared:
|
||||||
/* at this stage the resources are just added to the
|
/* at this stage the resources are just added to the
|
||||||
|
@ -1967,9 +1727,6 @@ xf86ClaimFixedResources(resList list, int entityIndex)
|
||||||
xf86MsgVerb(X_INFO, 3,
|
xf86MsgVerb(X_INFO, 3,
|
||||||
"resource ranges after xf86ClaimFixedResources() call:\n");
|
"resource ranges after xf86ClaimFixedResources() call:\n");
|
||||||
xf86PrintResList(3,Acc);
|
xf86PrintResList(3,Acc);
|
||||||
#ifdef REDUCER
|
|
||||||
ProcessEstimatedConflicts();
|
|
||||||
#endif
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
if (ptr) {
|
if (ptr) {
|
||||||
xf86MsgVerb(X_INFO, 3, "to be registered later:\n");
|
xf86MsgVerb(X_INFO, 3, "to be registered later:\n");
|
||||||
|
@ -2065,10 +1822,10 @@ xf86PostProbe(void)
|
||||||
{
|
{
|
||||||
memType val;
|
memType val;
|
||||||
int i,j;
|
int i,j;
|
||||||
resPtr resp, acc, tmp, resp_x, *pprev_next;
|
resPtr resp, acc, tmp, resp_x;
|
||||||
|
|
||||||
if (fbSlotClaimed) {
|
if (fbSlotClaimed) {
|
||||||
if (pciSlotClaimed || isaSlotClaimed
|
if (pciSlotClaimed
|
||||||
#if (defined(__sparc__) || defined(__sparc)) && !defined(__OpenBSD__)
|
#if (defined(__sparc__) || defined(__sparc)) && !defined(__OpenBSD__)
|
||||||
|| sbusSlotClaimed
|
|| sbusSlotClaimed
|
||||||
#endif
|
#endif
|
||||||
|
@ -2085,17 +1842,7 @@ xf86PostProbe(void)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* don't compare against ResInit - remove it from clone.*/
|
|
||||||
acc = tmp = xf86DupResList(Acc);
|
acc = tmp = xf86DupResList(Acc);
|
||||||
pprev_next = &acc;
|
|
||||||
while (tmp) {
|
|
||||||
if (tmp->res_type & ResInit) {
|
|
||||||
(*pprev_next) = tmp->next;
|
|
||||||
xfree(tmp);
|
|
||||||
} else
|
|
||||||
pprev_next = &(tmp->next);
|
|
||||||
tmp = (*pprev_next);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i=0; i<xf86NumEntities; i++) {
|
for (i=0; i<xf86NumEntities; i++) {
|
||||||
resp = xf86Entities[i]->resources;
|
resp = xf86Entities[i]->resources;
|
||||||
|
@ -2108,16 +1855,6 @@ xf86PostProbe(void)
|
||||||
resp_x = resp;
|
resp_x = resp;
|
||||||
resp = resp->next;
|
resp = resp->next;
|
||||||
resp_x->next = tmp;
|
resp_x->next = tmp;
|
||||||
#ifdef REDUCER
|
|
||||||
} else {
|
|
||||||
resp->res_type |= ResEstimated;
|
|
||||||
if (!checkConflict(&resp->val, acc, i, SETUP, FALSE)) {
|
|
||||||
resp->res_type &= ~(ResEstimated | ResBios);
|
|
||||||
tmp = AccReducers;
|
|
||||||
AccReducers = resp;
|
|
||||||
resp = resp->next;
|
|
||||||
AccReducers->next = tmp;
|
|
||||||
#endif
|
|
||||||
} else {
|
} else {
|
||||||
xf86MsgVerb(X_INFO, 3, "Found conflict at: 0x%lx\n",val);
|
xf86MsgVerb(X_INFO, 3, "Found conflict at: 0x%lx\n",val);
|
||||||
resp->res_type &= ~ResEstimated;
|
resp->res_type &= ~ResEstimated;
|
||||||
|
@ -2126,14 +1863,8 @@ xf86PostProbe(void)
|
||||||
resp = resp->next;
|
resp = resp->next;
|
||||||
xf86Entities[i]->resources->next = tmp;
|
xf86Entities[i]->resources->next = tmp;
|
||||||
}
|
}
|
||||||
#ifdef REDUCER
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
xf86JoinResLists(Acc,resp_x);
|
xf86JoinResLists(Acc,resp_x);
|
||||||
#ifdef REDUCER
|
|
||||||
ProcessEstimatedConflicts();
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
xf86FreeResList(acc);
|
xf86FreeResList(acc);
|
||||||
|
|
||||||
|
@ -2630,9 +2361,6 @@ xf86ExtractTypeFromList(resPtr list, unsigned long type)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*------------------------------------------------------------*/
|
|
||||||
static void CheckGenericGA(void);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* xf86FindPrimaryDevice() - Find the display device which
|
* xf86FindPrimaryDevice() - Find the display device which
|
||||||
* was active when the server was started.
|
* was active when the server was started.
|
||||||
|
@ -2640,9 +2368,6 @@ static void CheckGenericGA(void);
|
||||||
void
|
void
|
||||||
xf86FindPrimaryDevice()
|
xf86FindPrimaryDevice()
|
||||||
{
|
{
|
||||||
/* if no VGA device is found check for primary PCI device */
|
|
||||||
if (primaryBus.type == BUS_NONE && xorgHWAccess)
|
|
||||||
CheckGenericGA();
|
|
||||||
if (primaryBus.type != BUS_NONE) {
|
if (primaryBus.type != BUS_NONE) {
|
||||||
char *bus;
|
char *bus;
|
||||||
char loc[16];
|
char loc[16];
|
||||||
|
@ -2656,10 +2381,6 @@ xf86FindPrimaryDevice()
|
||||||
primaryBus.id.pci->dev,
|
primaryBus.id.pci->dev,
|
||||||
primaryBus.id.pci->func);
|
primaryBus.id.pci->func);
|
||||||
break;
|
break;
|
||||||
case BUS_ISA:
|
|
||||||
bus = "ISA";
|
|
||||||
loc[0] = '\0';
|
|
||||||
break;
|
|
||||||
case BUS_SBUS:
|
case BUS_SBUS:
|
||||||
bus = "SBUS";
|
bus = "SBUS";
|
||||||
snprintf(loc, sizeof(loc), " %2.2x", primaryBus.id.sbus.fbNum);
|
snprintf(loc, sizeof(loc), " %2.2x", primaryBus.id.sbus.fbNum);
|
||||||
|
@ -2673,39 +2394,6 @@ xf86FindPrimaryDevice()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !defined(__sparc) && !defined(__sparc__) && !defined(__powerpc__) && !defined(__mips__) && !defined(__arm__) && !defined(__m32r__)
|
|
||||||
#include "vgaHW.h"
|
|
||||||
#include "compiler.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
|
||||||
* CheckGenericGA() - Check for presence of a VGA device.
|
|
||||||
*/
|
|
||||||
static void
|
|
||||||
CheckGenericGA()
|
|
||||||
{
|
|
||||||
/* This needs to be changed for multiple domains */
|
|
||||||
#if !defined(__sparc__) && !defined(__sparc) && !defined(__powerpc__) && !defined(__mips__) && !defined(__ia64__) && !defined(__arm__) && !defined(__s390__) && !defined(__m32r__)
|
|
||||||
IOADDRESS GenericIOBase = VGAHW_GET_IOBASE();
|
|
||||||
CARD8 CurrentValue, TestValue;
|
|
||||||
|
|
||||||
/* VGA CRTC registers are not used here, so don't bother unlocking them */
|
|
||||||
|
|
||||||
/* VGA has one more read/write attribute register than EGA */
|
|
||||||
(void) inb(GenericIOBase + VGA_IN_STAT_1_OFFSET); /* Reset flip-flop */
|
|
||||||
outb(VGA_ATTR_INDEX, 0x14 | 0x20);
|
|
||||||
CurrentValue = inb(VGA_ATTR_DATA_R);
|
|
||||||
outb(VGA_ATTR_DATA_W, CurrentValue ^ 0x0F);
|
|
||||||
outb(VGA_ATTR_INDEX, 0x14 | 0x20);
|
|
||||||
TestValue = inb(VGA_ATTR_DATA_R);
|
|
||||||
outb(VGA_ATTR_DATA_W, CurrentValue);
|
|
||||||
|
|
||||||
if ((CurrentValue ^ 0x0F) == TestValue) {
|
|
||||||
primaryBus.type = BUS_ISA;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
Bool
|
Bool
|
||||||
xf86NoSharedResources(int screenIndex,resType res)
|
xf86NoSharedResources(int screenIndex,resType res)
|
||||||
{
|
{
|
||||||
|
|
|
@ -140,7 +140,5 @@ BusType StringToBusType(const char* busID, const char **retID);
|
||||||
Bool xf86IsSubsetOf(resRange range, resPtr list);
|
Bool xf86IsSubsetOf(resRange range, resPtr list);
|
||||||
resPtr xf86ExtractTypeFromList(resPtr list, unsigned long type);
|
resPtr xf86ExtractTypeFromList(resPtr list, unsigned long type);
|
||||||
resPtr xf86FindIntersect(resRange Range, resPtr list);
|
resPtr xf86FindIntersect(resRange Range, resPtr list);
|
||||||
void RemoveOverlaps(resPtr target, resPtr list, Bool pow2Alignment,
|
|
||||||
Bool useEstimated);
|
|
||||||
|
|
||||||
#endif /* _XF86_BUS_H */
|
#endif /* _XF86_BUS_H */
|
||||||
|
|
|
@ -115,18 +115,6 @@ xf86AddBusDeviceToConfigure(const char *driver, BusType bus, void *busData, int
|
||||||
return NULL;
|
return NULL;
|
||||||
isPrimary = xf86IsPrimaryPci(pVideo);
|
isPrimary = xf86IsPrimaryPci(pVideo);
|
||||||
break;
|
break;
|
||||||
case BUS_ISA:
|
|
||||||
/*
|
|
||||||
* This needs to be revisited as it doesn't allow for non-PCI
|
|
||||||
* multihead.
|
|
||||||
*/
|
|
||||||
if (!xf86IsPrimaryIsa())
|
|
||||||
return NULL;
|
|
||||||
isPrimary = TRUE;
|
|
||||||
for (i = 0; i < nDevToConfig; i++)
|
|
||||||
if (!DevToConfig[i].pVideo)
|
|
||||||
return NULL;
|
|
||||||
break;
|
|
||||||
#if (defined(__sparc__) || defined(__sparc)) && !defined(__OpenBSD__)
|
#if (defined(__sparc__) || defined(__sparc)) && !defined(__OpenBSD__)
|
||||||
case BUS_SBUS:
|
case BUS_SBUS:
|
||||||
for (i = 0; i < nDevToConfig; i++)
|
for (i = 0; i < nDevToConfig; i++)
|
||||||
|
@ -202,10 +190,6 @@ xf86AddBusDeviceToConfigure(const char *driver, BusType bus, void *busData, int
|
||||||
chipset = (pVideo->vendor_id << 16) | pVideo->device_id;
|
chipset = (pVideo->vendor_id << 16) | pVideo->device_id;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case BUS_ISA:
|
|
||||||
NewDevice.GDev.identifier = "ISA Adapter";
|
|
||||||
NewDevice.GDev.busID = "ISA";
|
|
||||||
break;
|
|
||||||
#if (defined(__sparc__) || defined(__sparc)) && !defined(__OpenBSD__)
|
#if (defined(__sparc__) || defined(__sparc)) && !defined(__OpenBSD__)
|
||||||
case BUS_SBUS: {
|
case BUS_SBUS: {
|
||||||
char *promPath = NULL;
|
char *promPath = NULL;
|
||||||
|
@ -241,17 +225,6 @@ xf86AddBusDeviceToConfigure(const char *driver, BusType bus, void *busData, int
|
||||||
# undef NewDevice
|
# undef NewDevice
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* Backwards compatibility
|
|
||||||
*/
|
|
||||||
_X_EXPORT GDevPtr
|
|
||||||
xf86AddDeviceToConfigure(const char *driver, struct pci_device * pVideo,
|
|
||||||
int chipset)
|
|
||||||
{
|
|
||||||
return xf86AddBusDeviceToConfigure(driver, pVideo ? BUS_PCI : BUS_ISA,
|
|
||||||
pVideo, chipset);
|
|
||||||
}
|
|
||||||
|
|
||||||
static XF86ConfInputPtr
|
static XF86ConfInputPtr
|
||||||
configureInputSection (void)
|
configureInputSection (void)
|
||||||
{
|
{
|
||||||
|
@ -662,12 +635,17 @@ configureDDCMonitorSection (int screennum)
|
||||||
return ptr;
|
return ptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if !defined(PATH_MAX)
|
||||||
|
# define PATH_MAX 1024
|
||||||
|
#endif
|
||||||
|
|
||||||
void
|
void
|
||||||
DoConfigure()
|
DoConfigure(void)
|
||||||
{
|
{
|
||||||
int i,j, screennum = -1;
|
int i,j, screennum = -1;
|
||||||
char *home = NULL;
|
char *home = NULL;
|
||||||
char *filename = NULL;
|
char filename[PATH_MAX];
|
||||||
|
char *addslash = "";
|
||||||
XF86ConfigPtr xf86config = NULL;
|
XF86ConfigPtr xf86config = NULL;
|
||||||
char **vlist, **vl;
|
char **vlist, **vl;
|
||||||
int *dev2screen;
|
int *dev2screen;
|
||||||
|
@ -765,29 +743,21 @@ DoConfigure()
|
||||||
xf86config->conf_input_lst = configureInputSection();
|
xf86config->conf_input_lst = configureInputSection();
|
||||||
xf86config->conf_layout_lst = configureLayoutSection();
|
xf86config->conf_layout_lst = configureLayoutSection();
|
||||||
|
|
||||||
if (!(home = getenv("HOME")))
|
home = getenv("HOME");
|
||||||
|
if ((home == NULL) || (home[0] == '\0')) {
|
||||||
home = "/";
|
home = "/";
|
||||||
{
|
} else {
|
||||||
#if !defined(PATH_MAX)
|
/* Determine if trailing slash is present or needed */
|
||||||
#define PATH_MAX 1024
|
int l = strlen(home);
|
||||||
#endif
|
|
||||||
const char* configfile = XF86CONFIGFILE".new";
|
|
||||||
char homebuf[PATH_MAX];
|
|
||||||
/* getenv might return R/O memory, as with OS/2 */
|
|
||||||
strncpy(homebuf,home,PATH_MAX-1);
|
|
||||||
homebuf[PATH_MAX-1] = '\0';
|
|
||||||
home = homebuf;
|
|
||||||
if (!(filename =
|
|
||||||
(char *)xalloc(strlen(home) +
|
|
||||||
strlen(configfile) + 3)))
|
|
||||||
goto bail;
|
|
||||||
|
|
||||||
if (home[0] == '/' && home[1] == '\0')
|
|
||||||
home[0] = '\0';
|
|
||||||
sprintf(filename, "%s/%s", home,configfile);
|
|
||||||
|
|
||||||
|
if (home[l-1] != '/') {
|
||||||
|
addslash = "/";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
snprintf(filename, sizeof(filename), "%s%s" XF86CONFIGFILE ".new",
|
||||||
|
home, addslash);
|
||||||
|
|
||||||
xf86writeConfigFile(filename, xf86config);
|
xf86writeConfigFile(filename, xf86config);
|
||||||
|
|
||||||
xf86DoConfigurePass1 = FALSE;
|
xf86DoConfigurePass1 = FALSE;
|
||||||
|
|
|
@ -1,116 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (c) 1999-2002 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).
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* finish setting up the server
|
|
||||||
* Load the driver modules and call their probe functions.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef HAVE_XORG_CONFIG_H
|
|
||||||
#include <xorg-config.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <ctype.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <X11/X.h>
|
|
||||||
#include <X11/Xmd.h>
|
|
||||||
#include "os.h"
|
|
||||||
#include "loaderProcs.h"
|
|
||||||
#include "xf86Config.h"
|
|
||||||
#include "xf86_OSlib.h"
|
|
||||||
#include "xf86.h"
|
|
||||||
#include "xf86Priv.h"
|
|
||||||
|
|
||||||
void
|
|
||||||
DoProbe()
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
Bool probeResult;
|
|
||||||
Bool ioEnableFailed = FALSE;
|
|
||||||
|
|
||||||
/* Find the list of video driver modules. */
|
|
||||||
char **list = xf86DriverlistFromCompile();
|
|
||||||
char **l;
|
|
||||||
|
|
||||||
if (list) {
|
|
||||||
ErrorF("List of video driver modules:\n");
|
|
||||||
for (l = list; *l; l++)
|
|
||||||
ErrorF("\t%s\n", *l);
|
|
||||||
} else {
|
|
||||||
ErrorF("No video driver modules found\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Load all the drivers that were found. */
|
|
||||||
xf86LoadModules(list, NULL);
|
|
||||||
|
|
||||||
/* Disable PCI devices */
|
|
||||||
xf86AccessInit();
|
|
||||||
|
|
||||||
/* Call all of the probe functions, reporting the results. */
|
|
||||||
for (i = 0; i < xf86NumDrivers; i++) {
|
|
||||||
DriverRec * const drv = xf86DriverList[i];
|
|
||||||
|
|
||||||
if (!xorgHWAccess) {
|
|
||||||
xorgHWFlags flags;
|
|
||||||
if (!drv->driverFunc
|
|
||||||
|| !drv->driverFunc( NULL, GET_REQUIRED_HW_INTERFACES, &flags )
|
|
||||||
|| NEED_IO_ENABLED(flags)) {
|
|
||||||
if (ioEnableFailed)
|
|
||||||
continue;
|
|
||||||
if (!xf86EnableIO()) {
|
|
||||||
ioEnableFailed = TRUE;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
xorgHWAccess = TRUE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
xf86MsgVerb(X_INFO, 3, "Probing in driver %s\n", drv->driverName);
|
|
||||||
|
|
||||||
probeResult = xf86CallDriverProbe( drv, TRUE );
|
|
||||||
if (!probeResult) {
|
|
||||||
xf86ErrorF("Probe in driver `%s' returns FALSE\n",
|
|
||||||
drv->driverName);
|
|
||||||
} else {
|
|
||||||
xf86ErrorF("Probe in driver `%s' returns TRUE\n",
|
|
||||||
drv->driverName);
|
|
||||||
|
|
||||||
/* If we have a result, then call driver's Identify function */
|
|
||||||
if (drv->Identify != NULL) {
|
|
||||||
const int verbose = xf86SetVerbosity(1);
|
|
||||||
(*drv->Identify)(0);
|
|
||||||
xf86SetVerbosity(verbose);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
OsCleanup(TRUE);
|
|
||||||
AbortDDX();
|
|
||||||
fflush(stderr);
|
|
||||||
exit(0);
|
|
||||||
}
|
|
|
@ -1683,8 +1683,8 @@ xf86MatchPciInstances(const char *driverName, int vendorID,
|
||||||
if ( xf86DoConfigure && xf86DoConfigurePass1 ) {
|
if ( xf86DoConfigure && xf86DoConfigurePass1 ) {
|
||||||
if (xf86CheckPciSlot(pPci)) {
|
if (xf86CheckPciSlot(pPci)) {
|
||||||
GDevPtr pGDev =
|
GDevPtr pGDev =
|
||||||
xf86AddDeviceToConfigure(drvp->driverName,
|
xf86AddBusDeviceToConfigure(drvp->driverName,
|
||||||
pPci, -1);
|
BUS_PCI, pPci, -1);
|
||||||
if (pGDev) {
|
if (pGDev) {
|
||||||
/* After configure pass 1, chipID and chipRev
|
/* After configure pass 1, chipID and chipRev
|
||||||
* are treated as over-rides, so clobber them
|
* are treated as over-rides, so clobber them
|
||||||
|
@ -1953,108 +1953,6 @@ xf86MatchPciInstances(const char *driverName, int vendorID,
|
||||||
return numFound;
|
return numFound;
|
||||||
}
|
}
|
||||||
|
|
||||||
_X_EXPORT int
|
|
||||||
xf86MatchIsaInstances(const char *driverName, SymTabPtr chipsets,
|
|
||||||
IsaChipsets *ISAchipsets, DriverPtr drvp,
|
|
||||||
FindIsaDevProc FindIsaDevice, GDevPtr *devList,
|
|
||||||
int numDevs, int **foundEntities)
|
|
||||||
{
|
|
||||||
SymTabRec *c;
|
|
||||||
IsaChipsets *Chips;
|
|
||||||
int i;
|
|
||||||
int numFound = 0;
|
|
||||||
int foundChip = -1;
|
|
||||||
int *retEntities = NULL;
|
|
||||||
|
|
||||||
*foundEntities = NULL;
|
|
||||||
|
|
||||||
#if defined(__sparc__) || defined(__powerpc__)
|
|
||||||
FindIsaDevice = NULL; /* Temporary */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (xf86DoProbe || (xf86DoConfigure && xf86DoConfigurePass1)) {
|
|
||||||
if (FindIsaDevice &&
|
|
||||||
((foundChip = (*FindIsaDevice)(NULL)) != -1)) {
|
|
||||||
xf86AddDeviceToConfigure(drvp->driverName, NULL, foundChip);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 0; i < numDevs; i++) {
|
|
||||||
MessageType from = X_CONFIG;
|
|
||||||
GDevPtr dev = NULL;
|
|
||||||
GDevPtr devBus = NULL;
|
|
||||||
|
|
||||||
if (devList[i]->busID && *devList[i]->busID) {
|
|
||||||
if (xf86ParseIsaBusString(devList[i]->busID)) {
|
|
||||||
if (devBus) xf86MsgVerb(X_WARNING,0,
|
|
||||||
"%s: More than one matching Device "
|
|
||||||
"section for ISA-Bus found: %s\n",
|
|
||||||
driverName,devList[i]->identifier);
|
|
||||||
else devBus = devList[i];
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (xf86IsPrimaryIsa()) {
|
|
||||||
if (dev) xf86MsgVerb(X_WARNING,0,
|
|
||||||
"%s: More than one matching "
|
|
||||||
"Device section found: %s\n",
|
|
||||||
driverName,devList[i]->identifier);
|
|
||||||
else dev = devList[i];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (devBus) dev = devBus;
|
|
||||||
if (dev) {
|
|
||||||
if (dev->chipset) {
|
|
||||||
for (c = chipsets; c->token >= 0; c++) {
|
|
||||||
if (xf86NameCmp(c->name, dev->chipset) == 0)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (c->token == -1) {
|
|
||||||
xf86MsgVerb(X_WARNING, 0, "%s: Chipset \"%s\" in Device "
|
|
||||||
"section \"%s\" isn't valid for this driver\n",
|
|
||||||
driverName, dev->chipset,
|
|
||||||
dev->identifier);
|
|
||||||
} else
|
|
||||||
foundChip = c->token;
|
|
||||||
} else {
|
|
||||||
if (FindIsaDevice) foundChip = (*FindIsaDevice)(dev);
|
|
||||||
/* Probe it */
|
|
||||||
from = X_PROBED;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Check if the chip type is listed in the chipset table - for sanity*/
|
|
||||||
|
|
||||||
if (foundChip >= 0){
|
|
||||||
for (Chips = ISAchipsets; Chips->numChipset >= 0; Chips++) {
|
|
||||||
if (Chips->numChipset == foundChip)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (Chips->numChipset == -1){
|
|
||||||
foundChip = -1;
|
|
||||||
xf86MsgVerb(X_WARNING,0,
|
|
||||||
"%s: Driver detected unknown ISA-Bus Chipset\n",
|
|
||||||
driverName);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (foundChip != -1) {
|
|
||||||
numFound++;
|
|
||||||
retEntities = xnfrealloc(retEntities,numFound * sizeof(int));
|
|
||||||
retEntities[numFound - 1] =
|
|
||||||
xf86ClaimIsaSlot(drvp,foundChip,dev, dev->active ? TRUE : FALSE);
|
|
||||||
for (c = chipsets; c->token >= 0; c++) {
|
|
||||||
if (c->token == foundChip)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
xf86Msg(from, "Chipset %s found\n", c->name);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*foundEntities = retEntities;
|
|
||||||
|
|
||||||
return numFound;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* xf86GetClocks -- get the dot-clocks via a BIG BAD hack ...
|
* xf86GetClocks -- get the dot-clocks via a BIG BAD hack ...
|
||||||
*/
|
*/
|
||||||
|
@ -2094,14 +1992,6 @@ xf86GetClocks(ScrnInfoPtr pScrn, int num, Bool (*ClockFunc)(ScrnInfoPtr, int),
|
||||||
cnt = 0;
|
cnt = 0;
|
||||||
sync = 200000;
|
sync = 200000;
|
||||||
|
|
||||||
/* XXX How critical is this? */
|
|
||||||
if (!xf86DisableInterrupts())
|
|
||||||
{
|
|
||||||
(*ClockFunc)(pScrn, CLK_REG_RESTORE);
|
|
||||||
ErrorF("Failed to disable interrupts during clock probe. If\n");
|
|
||||||
ErrorF("your OS does not support disabling interrupts, then you\n");
|
|
||||||
FatalError("must specify a Clocks line in the XF86Config file.\n");
|
|
||||||
}
|
|
||||||
while ((inb(status) & maskval) == 0x00)
|
while ((inb(status) & maskval) == 0x00)
|
||||||
if (sync-- == 0) goto finish;
|
if (sync-- == 0) goto finish;
|
||||||
/* Something appears to be happening, so reset sync count */
|
/* Something appears to be happening, so reset sync count */
|
||||||
|
@ -2122,8 +2012,6 @@ xf86GetClocks(ScrnInfoPtr pScrn, int num, Bool (*ClockFunc)(ScrnInfoPtr, int),
|
||||||
}
|
}
|
||||||
|
|
||||||
finish:
|
finish:
|
||||||
xf86EnableInterrupts();
|
|
||||||
|
|
||||||
pScrn->clock[i] = cnt ? cnt : -1;
|
pScrn->clock[i] = cnt ? cnt : -1;
|
||||||
if (BlankScreen)
|
if (BlankScreen)
|
||||||
(*BlankScreen)(pScrn, TRUE);
|
(*BlankScreen)(pScrn, TRUE);
|
||||||
|
@ -2557,49 +2445,6 @@ xf86FindXvOptions(int scrnIndex, int adaptor_index, char *port_name,
|
||||||
#include "loader/os.c"
|
#include "loader/os.c"
|
||||||
|
|
||||||
/* new RAC */
|
/* new RAC */
|
||||||
/*
|
|
||||||
* xf86ConfigIsa/PciEntity() -- These helper functions assign an
|
|
||||||
* active entity to a screen, registers its fixed resources, assign
|
|
||||||
* special enter/leave functions and their private scratch area to
|
|
||||||
* this entity, take the dog for a walk...
|
|
||||||
*/
|
|
||||||
_X_EXPORT ScrnInfoPtr
|
|
||||||
xf86ConfigIsaEntity(ScrnInfoPtr pScrn, int scrnFlag, int entityIndex,
|
|
||||||
IsaChipsets *i_chip, resList res, EntityProc init,
|
|
||||||
EntityProc enter, EntityProc leave, pointer private)
|
|
||||||
{
|
|
||||||
IsaChipsets *i_id;
|
|
||||||
EntityInfoPtr pEnt = xf86GetEntityInfo(entityIndex);
|
|
||||||
if (!pEnt) return pScrn;
|
|
||||||
|
|
||||||
if (!(pEnt->location.type == BUS_ISA)) {
|
|
||||||
xfree(pEnt);
|
|
||||||
return pScrn;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!pEnt->active) {
|
|
||||||
xf86ConfigIsaEntityInactive(pEnt, i_chip, res, init, enter,
|
|
||||||
leave, private);
|
|
||||||
xfree(pEnt);
|
|
||||||
return pScrn;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!pScrn)
|
|
||||||
pScrn = xf86AllocateScreen(pEnt->driver,scrnFlag);
|
|
||||||
xf86AddEntityToScreen(pScrn,entityIndex);
|
|
||||||
|
|
||||||
if (i_chip) {
|
|
||||||
for (i_id = i_chip; i_id->numChipset != -1; i_id++) {
|
|
||||||
if (pEnt->chipset == i_id->numChipset) break;
|
|
||||||
}
|
|
||||||
xf86ClaimFixedResources(i_id->resList,entityIndex);
|
|
||||||
}
|
|
||||||
xfree(pEnt);
|
|
||||||
xf86ClaimFixedResources(res,entityIndex);
|
|
||||||
xf86SetEntityFuncs(entityIndex,init,enter,leave,private);
|
|
||||||
|
|
||||||
return pScrn;
|
|
||||||
}
|
|
||||||
|
|
||||||
_X_EXPORT ScrnInfoPtr
|
_X_EXPORT ScrnInfoPtr
|
||||||
xf86ConfigPciEntity(ScrnInfoPtr pScrn, int scrnFlag, int entityIndex,
|
xf86ConfigPciEntity(ScrnInfoPtr pScrn, int scrnFlag, int entityIndex,
|
||||||
|
@ -2675,39 +2520,9 @@ xf86ConfigFbEntity(ScrnInfoPtr pScrn, int scrnFlag, int entityIndex,
|
||||||
|
|
||||||
/*
|
/*
|
||||||
*
|
*
|
||||||
* OBSOLETE ! xf86ConfigActiveIsaEntity() and xf86ConfigActivePciEntity()
|
* OBSOLETE ! xf86ConfigActivePciEntity() is an obsolete functions.
|
||||||
* are obsolete functions. They the are likely to be removed
|
* They the are likely to be removed. Don't use!
|
||||||
* Don't use!
|
|
||||||
*/
|
*/
|
||||||
_X_EXPORT Bool
|
|
||||||
xf86ConfigActiveIsaEntity(ScrnInfoPtr pScrn, int entityIndex,
|
|
||||||
IsaChipsets *i_chip, resList res, EntityProc init,
|
|
||||||
EntityProc enter, EntityProc leave, pointer private)
|
|
||||||
{
|
|
||||||
IsaChipsets *i_id;
|
|
||||||
EntityInfoPtr pEnt = xf86GetEntityInfo(entityIndex);
|
|
||||||
if (!pEnt) return FALSE;
|
|
||||||
|
|
||||||
if (!pEnt->active || !(pEnt->location.type == BUS_ISA)) {
|
|
||||||
xfree(pEnt);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
xf86AddEntityToScreen(pScrn,entityIndex);
|
|
||||||
|
|
||||||
if (i_chip) {
|
|
||||||
for (i_id = i_chip; i_id->numChipset != -1; i_id++) {
|
|
||||||
if (pEnt->chipset == i_id->numChipset) break;
|
|
||||||
}
|
|
||||||
xf86ClaimFixedResources(i_id->resList,entityIndex);
|
|
||||||
}
|
|
||||||
xfree(pEnt);
|
|
||||||
xf86ClaimFixedResources(res,entityIndex);
|
|
||||||
if (!xf86SetEntityFuncs(entityIndex,init,enter,leave,private))
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
_X_EXPORT Bool
|
_X_EXPORT Bool
|
||||||
xf86ConfigActivePciEntity(ScrnInfoPtr pScrn, int entityIndex,
|
xf86ConfigActivePciEntity(ScrnInfoPtr pScrn, int entityIndex,
|
||||||
|
@ -2740,10 +2555,10 @@ xf86ConfigActivePciEntity(ScrnInfoPtr pScrn, int entityIndex,
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* xf86ConfigPci/IsaEntityInactive() -- These functions can be used
|
* xf86ConfigPciEntityInactive() -- This functions can be used
|
||||||
* to configure an inactive entity as well as to reconfigure an
|
* to configure an inactive entity as well as to reconfigure an
|
||||||
* previously active entity inactive. If the entity has been
|
* previously active entity inactive. If the entity has been
|
||||||
* assigned to a screen before it will be removed. If p_pci(p_isa) is
|
* assigned to a screen before it will be removed. If p_pci is
|
||||||
* non-NULL all static resources listed there will be registered.
|
* non-NULL all static resources listed there will be registered.
|
||||||
*/
|
*/
|
||||||
_X_EXPORT void
|
_X_EXPORT void
|
||||||
|
@ -2768,28 +2583,6 @@ xf86ConfigPciEntityInactive(EntityInfoPtr pEnt, PciChipsets *p_chip,
|
||||||
xf86SetEntityFuncs(pEnt->index,init,enter,leave,private);
|
xf86SetEntityFuncs(pEnt->index,init,enter,leave,private);
|
||||||
}
|
}
|
||||||
|
|
||||||
_X_EXPORT void
|
|
||||||
xf86ConfigIsaEntityInactive(EntityInfoPtr pEnt, IsaChipsets *i_chip,
|
|
||||||
resList res, EntityProc init, EntityProc enter,
|
|
||||||
EntityProc leave, pointer private)
|
|
||||||
{
|
|
||||||
IsaChipsets *i_id;
|
|
||||||
ScrnInfoPtr pScrn;
|
|
||||||
|
|
||||||
if ((pScrn = xf86FindScreenForEntity(pEnt->index)))
|
|
||||||
xf86RemoveEntityFromScreen(pScrn,pEnt->index);
|
|
||||||
else if (i_chip) {
|
|
||||||
for (i_id = i_chip; i_id->numChipset != -1; i_id++) {
|
|
||||||
if (pEnt->chipset == i_id->numChipset) break;
|
|
||||||
}
|
|
||||||
xf86ClaimFixedResources(i_id->resList,pEnt->index);
|
|
||||||
}
|
|
||||||
xf86ClaimFixedResources(res,pEnt->index);
|
|
||||||
/* shared resources are only needed when entity is active: remove */
|
|
||||||
xf86DeallocateResourcesForEntity(pEnt->index, ResShared);
|
|
||||||
xf86SetEntityFuncs(pEnt->index,init,enter,leave,private);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
xf86ConfigFbEntityInactive(EntityInfoPtr pEnt, EntityProc init,
|
xf86ConfigFbEntityInactive(EntityInfoPtr pEnt, EntityProc init,
|
||||||
EntityProc enter, EntityProc leave, pointer private)
|
EntityProc enter, EntityProc leave, pointer private)
|
||||||
|
|
|
@ -548,8 +548,8 @@ add_matching_devices_to_configure_list(DriverPtr drvp)
|
||||||
&& ((devices[j].device_class_mask & pPci->device_class)
|
&& ((devices[j].device_class_mask & pPci->device_class)
|
||||||
== devices[j].device_class) ) {
|
== devices[j].device_class) ) {
|
||||||
if (xf86CheckPciSlot(pPci)) {
|
if (xf86CheckPciSlot(pPci)) {
|
||||||
GDevPtr pGDev =
|
GDevPtr pGDev = xf86AddBusDeviceToConfigure(
|
||||||
xf86AddDeviceToConfigure(drvp->driverName, pPci, -1);
|
drvp->driverName, BUS_PCI, pPci, -1);
|
||||||
if (pGDev != NULL) {
|
if (pGDev != NULL) {
|
||||||
/* After configure pass 1, chipID and chipRev are
|
/* After configure pass 1, chipID and chipRev are
|
||||||
* treated as over-rides, so clobber them here.
|
* treated as over-rides, so clobber them here.
|
||||||
|
@ -643,6 +643,75 @@ xf86CallDriverProbe( DriverPtr drv, Bool detect_only )
|
||||||
return foundScreen;
|
return foundScreen;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
DoProbe(void)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
Bool probeResult;
|
||||||
|
Bool ioEnableFailed = FALSE;
|
||||||
|
|
||||||
|
/* Find the list of video driver modules. */
|
||||||
|
char **list = xf86DriverlistFromCompile();
|
||||||
|
char **l;
|
||||||
|
|
||||||
|
if (list) {
|
||||||
|
ErrorF("List of video driver modules:\n");
|
||||||
|
for (l = list; *l; l++)
|
||||||
|
ErrorF("\t%s\n", *l);
|
||||||
|
} else {
|
||||||
|
ErrorF("No video driver modules found\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Load all the drivers that were found. */
|
||||||
|
xf86LoadModules(list, NULL);
|
||||||
|
|
||||||
|
/* Disable PCI devices */
|
||||||
|
xf86AccessInit();
|
||||||
|
|
||||||
|
/* Call all of the probe functions, reporting the results. */
|
||||||
|
for (i = 0; i < xf86NumDrivers; i++) {
|
||||||
|
DriverRec * const drv = xf86DriverList[i];
|
||||||
|
|
||||||
|
if (!xorgHWAccess) {
|
||||||
|
xorgHWFlags flags;
|
||||||
|
if (!drv->driverFunc
|
||||||
|
|| !drv->driverFunc( NULL, GET_REQUIRED_HW_INTERFACES, &flags )
|
||||||
|
|| NEED_IO_ENABLED(flags)) {
|
||||||
|
if (ioEnableFailed)
|
||||||
|
continue;
|
||||||
|
if (!xf86EnableIO()) {
|
||||||
|
ioEnableFailed = TRUE;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
xorgHWAccess = TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
xf86MsgVerb(X_INFO, 3, "Probing in driver %s\n", drv->driverName);
|
||||||
|
|
||||||
|
probeResult = xf86CallDriverProbe( drv, TRUE );
|
||||||
|
if (!probeResult) {
|
||||||
|
xf86ErrorF("Probe in driver `%s' returns FALSE\n",
|
||||||
|
drv->driverName);
|
||||||
|
} else {
|
||||||
|
xf86ErrorF("Probe in driver `%s' returns TRUE\n",
|
||||||
|
drv->driverName);
|
||||||
|
|
||||||
|
/* If we have a result, then call driver's Identify function */
|
||||||
|
if (drv->Identify != NULL) {
|
||||||
|
const int verbose = xf86SetVerbosity(1);
|
||||||
|
(*drv->Identify)(0);
|
||||||
|
xf86SetVerbosity(verbose);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
OsCleanup(TRUE);
|
||||||
|
AbortDDX();
|
||||||
|
fflush(stderr);
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* InitOutput --
|
* InitOutput --
|
||||||
|
|
|
@ -150,9 +150,10 @@ Bool xf86PathIsSafe(const char *path);
|
||||||
extern const DisplayModeRec xf86DefaultModes[];
|
extern const DisplayModeRec xf86DefaultModes[];
|
||||||
extern const int xf86NumDefaultModes;
|
extern const int xf86NumDefaultModes;
|
||||||
|
|
||||||
/* xf86DoProbe.c */
|
/* xf86Configure.c */
|
||||||
void DoProbe(void);
|
|
||||||
void DoConfigure(void);
|
void DoConfigure(void);
|
||||||
|
|
||||||
|
/* xf86ShowOpts.c */
|
||||||
void DoShowOptions(void);
|
void DoShowOptions(void);
|
||||||
|
|
||||||
/* xf86Events.c */
|
/* xf86Events.c */
|
||||||
|
|
|
@ -1,141 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (c) 1997-2000 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).
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* This file contains the interfaces to the bus-specific code
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef HAVE_XORG_CONFIG_H
|
|
||||||
#include <xorg-config.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <ctype.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <X11/X.h>
|
|
||||||
#include "os.h"
|
|
||||||
#include "xf86.h"
|
|
||||||
#include "xf86Priv.h"
|
|
||||||
#include "xf86Resources.h"
|
|
||||||
|
|
||||||
#include "xf86Bus.h"
|
|
||||||
|
|
||||||
#define XF86_OS_PRIVS
|
|
||||||
#define NEED_OS_RAC_PROTOS
|
|
||||||
#include "xf86_OSproc.h"
|
|
||||||
|
|
||||||
#include "xf86RAC.h"
|
|
||||||
|
|
||||||
Bool isaSlotClaimed = FALSE;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* If the slot requested is already in use, return FALSE.
|
|
||||||
* Otherwise, claim the slot for the screen requesting it.
|
|
||||||
*/
|
|
||||||
|
|
||||||
_X_EXPORT int
|
|
||||||
xf86ClaimIsaSlot(DriverPtr drvp, int chipset, GDevPtr dev, Bool active)
|
|
||||||
{
|
|
||||||
EntityPtr p;
|
|
||||||
BusAccPtr pbap = xf86BusAccInfo;
|
|
||||||
int num;
|
|
||||||
|
|
||||||
num = xf86AllocateEntity();
|
|
||||||
p = xf86Entities[num];
|
|
||||||
p->driver = drvp;
|
|
||||||
p->chipset = chipset;
|
|
||||||
p->busType = BUS_ISA;
|
|
||||||
p->active = active;
|
|
||||||
p->inUse = FALSE;
|
|
||||||
xf86AddDevToEntity(num, dev);
|
|
||||||
p->access = xnfcalloc(1,sizeof(EntityAccessRec));
|
|
||||||
p->access->fallback = &AccessNULL;
|
|
||||||
p->access->pAccess = &AccessNULL;
|
|
||||||
p->busAcc = NULL;
|
|
||||||
while (pbap) {
|
|
||||||
if (pbap->type == BUS_ISA)
|
|
||||||
p->busAcc = pbap;
|
|
||||||
pbap = pbap->next;
|
|
||||||
}
|
|
||||||
isaSlotClaimed = TRUE;
|
|
||||||
return num;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Get the list of ISA "slots" claimed by a screen
|
|
||||||
*
|
|
||||||
* Note: The ISA implementation here assumes that only one ISA "slot" type
|
|
||||||
* can be claimed by any one screen. That means a return value other than
|
|
||||||
* 0 or 1 isn't useful.
|
|
||||||
*/
|
|
||||||
int
|
|
||||||
xf86GetIsaInfoForScreen(int scrnIndex)
|
|
||||||
{
|
|
||||||
int num = 0;
|
|
||||||
int i;
|
|
||||||
EntityPtr p;
|
|
||||||
|
|
||||||
for (i = 0; i < xf86Screens[scrnIndex]->numEntities; i++) {
|
|
||||||
p = xf86Entities[xf86Screens[scrnIndex]->entityList[i]];
|
|
||||||
if (p->busType == BUS_ISA) {
|
|
||||||
num++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return num;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Parse a BUS ID string, and return True if it is a ISA bus id.
|
|
||||||
*/
|
|
||||||
|
|
||||||
_X_EXPORT Bool
|
|
||||||
xf86ParseIsaBusString(const char *busID)
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
* The format assumed to be "isa" or "isa:"
|
|
||||||
*/
|
|
||||||
return (StringToBusType(busID,NULL) == BUS_ISA);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* xf86IsPrimaryIsa() -- return TRUE if primary device
|
|
||||||
* is ISA.
|
|
||||||
*/
|
|
||||||
|
|
||||||
_X_EXPORT Bool
|
|
||||||
xf86IsPrimaryIsa(void)
|
|
||||||
{
|
|
||||||
return ( primaryBus.type == BUS_ISA );
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
isaConvertRange2Host(resRange *pRange)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
|
@ -564,11 +564,6 @@ initPciBusState(void)
|
||||||
pbap->disable_f = pciBusAccessDisable;
|
pbap->disable_f = pciBusAccessDisable;
|
||||||
savePciBusState(pbap);
|
savePciBusState(pbap);
|
||||||
break;
|
break;
|
||||||
case PCI_SUBCLASS_BRIDGE_ISA:
|
|
||||||
case PCI_SUBCLASS_BRIDGE_EISA:
|
|
||||||
case PCI_SUBCLASS_BRIDGE_MC:
|
|
||||||
pbap->type = BUS_ISA;
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
pbap->next = xf86BusAccInfo;
|
pbap->next = xf86BusAccInfo;
|
||||||
xf86BusAccInfo = pbap;
|
xf86BusAccInfo = pbap;
|
||||||
|
|
|
@ -70,6 +70,5 @@ void PciBusStateEnter(void);
|
||||||
void PciStateLeave(void);
|
void PciStateLeave(void);
|
||||||
void PciBusStateLeave(void);
|
void PciBusStateLeave(void);
|
||||||
void pciConvertRange2Host(int entityIndex, resRange *pRange);
|
void pciConvertRange2Host(int entityIndex, resRange *pRange);
|
||||||
void isaConvertRange2Host(resRange *pRange);
|
|
||||||
|
|
||||||
#endif /* _XF86_PCI_BUS_H */
|
#endif /* _XF86_PCI_BUS_H */
|
||||||
|
|
|
@ -382,10 +382,6 @@ typedef enum {
|
||||||
|
|
||||||
struct pci_device;
|
struct pci_device;
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
unsigned int dummy;
|
|
||||||
} IsaBusId;
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int fbNum;
|
int fbNum;
|
||||||
} SbusBusId;
|
} SbusBusId;
|
||||||
|
@ -393,7 +389,6 @@ typedef struct {
|
||||||
typedef struct _bus {
|
typedef struct _bus {
|
||||||
BusType type;
|
BusType type;
|
||||||
union {
|
union {
|
||||||
IsaBusId isa;
|
|
||||||
struct pci_device *pci;
|
struct pci_device *pci;
|
||||||
SbusBusId sbus;
|
SbusBusId sbus;
|
||||||
} id;
|
} id;
|
||||||
|
@ -436,8 +431,6 @@ typedef struct {
|
||||||
int screen; /* For multi-CRTC cards */
|
int screen; /* For multi-CRTC cards */
|
||||||
} GDevRec, *GDevPtr;
|
} GDevRec, *GDevPtr;
|
||||||
|
|
||||||
typedef int (*FindIsaDevProc)(GDevPtr dev);
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
char * identifier;
|
char * identifier;
|
||||||
char * driver;
|
char * driver;
|
||||||
|
@ -623,9 +616,6 @@ typedef struct _CurrAccRec {
|
||||||
|
|
||||||
#define ResMem 0x0001
|
#define ResMem 0x0001
|
||||||
#define ResIo 0x0002
|
#define ResIo 0x0002
|
||||||
#define ResIrq 0x0003
|
|
||||||
#define ResDma 0x0004
|
|
||||||
#define ResPciCfg 0x000e /* PCI Configuration space */
|
|
||||||
#define ResPhysMask 0x000F
|
#define ResPhysMask 0x000F
|
||||||
|
|
||||||
#define ResExclusive 0x0010
|
#define ResExclusive 0x0010
|
||||||
|
@ -648,7 +638,6 @@ typedef struct _CurrAccRec {
|
||||||
#define ResMiscMask 0x00F000
|
#define ResMiscMask 0x00F000
|
||||||
|
|
||||||
#define ResBus 0x010000
|
#define ResBus 0x010000
|
||||||
#define ResOverlap 0x020000
|
|
||||||
|
|
||||||
#if defined(__alpha__) && defined(linux)
|
#if defined(__alpha__) && defined(linux)
|
||||||
# define ResDomain 0x1ff000000ul
|
# define ResDomain 0x1ff000000ul
|
||||||
|
@ -687,7 +676,6 @@ typedef struct _CurrAccRec {
|
||||||
#define ResIsBlock(r) (((r)->type & ResExtMask) == ResBlock)
|
#define ResIsBlock(r) (((r)->type & ResExtMask) == ResBlock)
|
||||||
#define ResIsSparse(r) (((r)->type & ResExtMask) == ResSparse)
|
#define ResIsSparse(r) (((r)->type & ResExtMask) == ResSparse)
|
||||||
#define ResIsEstimated(r) (((r)->type & ResMiscMask) == ResEstimated)
|
#define ResIsEstimated(r) (((r)->type & ResMiscMask) == ResEstimated)
|
||||||
#define ResCanOverlap(r) (ResIsEstimated(r) || ((r)->type & ResOverlap))
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
unsigned long type; /* shared, exclusive, unused etc. */
|
unsigned long type; /* shared, exclusive, unused etc. */
|
||||||
|
@ -722,11 +710,6 @@ typedef struct _resRec {
|
||||||
#define block_end val.rEnd
|
#define block_end val.rEnd
|
||||||
#define res_type val.type
|
#define res_type val.type
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
int numChipset;
|
|
||||||
resRange *resList;
|
|
||||||
} IsaChipsets;
|
|
||||||
|
|
||||||
typedef struct _PciChipsets {
|
typedef struct _PciChipsets {
|
||||||
/**
|
/**
|
||||||
* Key used to match this device with its name in an array of
|
* Key used to match this device with its name in an array of
|
||||||
|
|
|
@ -8,5 +8,5 @@
|
||||||
#include "xf86Priv.h"
|
#include "xf86Priv.h"
|
||||||
|
|
||||||
/* Dummy variables */
|
/* Dummy variables */
|
||||||
xf86InfoRec xf86Info = {NULL, };
|
xf86InfoRec xf86Info;
|
||||||
|
|
||||||
|
|
|
@ -220,19 +220,6 @@ xf86ExtendedInitInt10(int entityIndex, int Flags)
|
||||||
INTPriv(pInt)->highMemory = GET_HIGH_BASE(rom_device->rom_size);
|
INTPriv(pInt)->highMemory = GET_HIGH_BASE(rom_device->rom_size);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case BUS_ISA:
|
|
||||||
vbiosMem = (unsigned char *)sysMem + bios_location;
|
|
||||||
#if 0
|
|
||||||
memset(vbiosMem, 0, V_BIOS_SIZE);
|
|
||||||
if (xf86ReadBIOS(bios_location, 0, vbiosMem, V_BIOS_SIZE)
|
|
||||||
< V_BIOS_SIZE)
|
|
||||||
xf86DrvMsg(screen, X_WARNING,
|
|
||||||
"Unable to retrieve all of segment 0x%x.\n",bios_location);
|
|
||||||
#endif
|
|
||||||
if (!int10_check_bios(screen, bios_location >> 4, vbiosMem)) {
|
|
||||||
xf86DrvMsg(screen,X_ERROR,"Cannot read V_BIOS (4)\n");
|
|
||||||
goto error1;
|
|
||||||
}
|
|
||||||
default:
|
default:
|
||||||
goto error1;
|
goto error1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,6 +32,8 @@
|
||||||
#include "Pci.h"
|
#include "Pci.h"
|
||||||
#ifdef _X86EMU
|
#ifdef _X86EMU
|
||||||
#include "x86emu/x86emui.h"
|
#include "x86emu/x86emui.h"
|
||||||
|
#else
|
||||||
|
#define DEBUG_IO_TRACE() 0
|
||||||
#endif
|
#endif
|
||||||
#include <pciaccess.h>
|
#include <pciaccess.h>
|
||||||
|
|
||||||
|
|
|
@ -1133,24 +1133,6 @@ UnloadSubModule(ModuleDescPtr mod)
|
||||||
xfree(mod);
|
xfree(mod);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
FreeModuleDesc(ModuleDescPtr head)
|
|
||||||
{
|
|
||||||
ModuleDescPtr sibs, prev;
|
|
||||||
|
|
||||||
if (head == (ModuleDescPtr) 1)
|
|
||||||
return;
|
|
||||||
if (head->child)
|
|
||||||
FreeModuleDesc(head->child);
|
|
||||||
sibs = head;
|
|
||||||
while (sibs) {
|
|
||||||
prev = sibs;
|
|
||||||
sibs = sibs->sib;
|
|
||||||
TestFree(prev->name);
|
|
||||||
xfree(prev);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
RemoveChild(ModuleDescPtr child)
|
RemoveChild(ModuleDescPtr child)
|
||||||
{
|
{
|
||||||
|
|
|
@ -244,8 +244,6 @@ _X_HIDDEN void *xfree86LookupTab[] = {
|
||||||
SYMFUNC(xf86ReadBIOS)
|
SYMFUNC(xf86ReadBIOS)
|
||||||
SYMFUNC(xf86EnableIO)
|
SYMFUNC(xf86EnableIO)
|
||||||
SYMFUNC(xf86DisableIO)
|
SYMFUNC(xf86DisableIO)
|
||||||
SYMFUNC(xf86DisableInterrupts)
|
|
||||||
SYMFUNC(xf86EnableInterrupts)
|
|
||||||
SYMFUNC(xf86LinearVidMem)
|
SYMFUNC(xf86LinearVidMem)
|
||||||
SYMFUNC(xf86CheckMTRR)
|
SYMFUNC(xf86CheckMTRR)
|
||||||
SYMFUNC(xf86MapVidMem)
|
SYMFUNC(xf86MapVidMem)
|
||||||
|
@ -253,7 +251,6 @@ _X_HIDDEN void *xfree86LookupTab[] = {
|
||||||
SYMFUNC(xf86MapReadSideEffects)
|
SYMFUNC(xf86MapReadSideEffects)
|
||||||
SYMFUNC(xf86MapDomainMemory)
|
SYMFUNC(xf86MapDomainMemory)
|
||||||
SYMFUNC(xf86UDelay)
|
SYMFUNC(xf86UDelay)
|
||||||
SYMFUNC(xf86IODelay)
|
|
||||||
SYMFUNC(xf86SlowBcopy)
|
SYMFUNC(xf86SlowBcopy)
|
||||||
SYMFUNC(xf86SetReallySlowBcopy)
|
SYMFUNC(xf86SetReallySlowBcopy)
|
||||||
#ifdef __alpha__
|
#ifdef __alpha__
|
||||||
|
@ -296,17 +293,14 @@ _X_HIDDEN void *xfree86LookupTab[] = {
|
||||||
/* xf86Bus.c */
|
/* xf86Bus.c */
|
||||||
SYMFUNC(xf86CheckPciSlot)
|
SYMFUNC(xf86CheckPciSlot)
|
||||||
SYMFUNC(xf86ClaimPciSlot)
|
SYMFUNC(xf86ClaimPciSlot)
|
||||||
SYMFUNC(xf86ClaimIsaSlot)
|
|
||||||
SYMFUNC(xf86ClaimFbSlot)
|
SYMFUNC(xf86ClaimFbSlot)
|
||||||
SYMFUNC(xf86ClaimNoSlot)
|
SYMFUNC(xf86ClaimNoSlot)
|
||||||
SYMFUNC(xf86ParsePciBusString)
|
SYMFUNC(xf86ParsePciBusString)
|
||||||
SYMFUNC(xf86ComparePciBusString)
|
SYMFUNC(xf86ComparePciBusString)
|
||||||
SYMFUNC(xf86FormatPciBusNumber)
|
SYMFUNC(xf86FormatPciBusNumber)
|
||||||
SYMFUNC(xf86ParseIsaBusString)
|
|
||||||
SYMFUNC(xf86EnableAccess)
|
SYMFUNC(xf86EnableAccess)
|
||||||
SYMFUNC(xf86SetCurrentAccess)
|
SYMFUNC(xf86SetCurrentAccess)
|
||||||
SYMFUNC(xf86IsPrimaryPci)
|
SYMFUNC(xf86IsPrimaryPci)
|
||||||
SYMFUNC(xf86IsPrimaryIsa)
|
|
||||||
SYMFUNC(xf86FreeResList)
|
SYMFUNC(xf86FreeResList)
|
||||||
SYMFUNC(xf86ClaimFixedResources)
|
SYMFUNC(xf86ClaimFixedResources)
|
||||||
SYMFUNC(xf86AddEntityToScreen)
|
SYMFUNC(xf86AddEntityToScreen)
|
||||||
|
@ -337,9 +331,6 @@ _X_HIDDEN void *xfree86LookupTab[] = {
|
||||||
SYMFUNC(xf86AllocateEntityPrivateIndex)
|
SYMFUNC(xf86AllocateEntityPrivateIndex)
|
||||||
SYMFUNC(xf86GetEntityPrivate)
|
SYMFUNC(xf86GetEntityPrivate)
|
||||||
|
|
||||||
/* xf86Configure.c */
|
|
||||||
SYMFUNC(xf86AddDeviceToConfigure)
|
|
||||||
|
|
||||||
/* xf86Cursor.c */
|
/* xf86Cursor.c */
|
||||||
SYMFUNC(xf86GetPointerScreenFuncs)
|
SYMFUNC(xf86GetPointerScreenFuncs)
|
||||||
|
|
||||||
|
@ -414,7 +405,6 @@ _X_HIDDEN void *xfree86LookupTab[] = {
|
||||||
SYMFUNC(xf86PrintChipsets)
|
SYMFUNC(xf86PrintChipsets)
|
||||||
SYMFUNC(xf86MatchDevice)
|
SYMFUNC(xf86MatchDevice)
|
||||||
SYMFUNC(xf86MatchPciInstances)
|
SYMFUNC(xf86MatchPciInstances)
|
||||||
SYMFUNC(xf86MatchIsaInstances)
|
|
||||||
SYMFUNC(xf86GetVerbosity)
|
SYMFUNC(xf86GetVerbosity)
|
||||||
SYMFUNC(xf86GetVisualName)
|
SYMFUNC(xf86GetVisualName)
|
||||||
SYMFUNC(xf86GetPix24)
|
SYMFUNC(xf86GetPix24)
|
||||||
|
@ -454,12 +444,9 @@ _X_HIDDEN void *xfree86LookupTab[] = {
|
||||||
SYMFUNC(xf86FindXvOptions)
|
SYMFUNC(xf86FindXvOptions)
|
||||||
SYMFUNC(xf86GetOS)
|
SYMFUNC(xf86GetOS)
|
||||||
SYMFUNC(xf86ConfigPciEntity)
|
SYMFUNC(xf86ConfigPciEntity)
|
||||||
SYMFUNC(xf86ConfigIsaEntity)
|
|
||||||
SYMFUNC(xf86ConfigFbEntity)
|
SYMFUNC(xf86ConfigFbEntity)
|
||||||
SYMFUNC(xf86ConfigActivePciEntity)
|
SYMFUNC(xf86ConfigActivePciEntity)
|
||||||
SYMFUNC(xf86ConfigActiveIsaEntity)
|
|
||||||
SYMFUNC(xf86ConfigPciEntityInactive)
|
SYMFUNC(xf86ConfigPciEntityInactive)
|
||||||
SYMFUNC(xf86ConfigIsaEntityInactive)
|
|
||||||
SYMFUNC(xf86IsScreenPrimary)
|
SYMFUNC(xf86IsScreenPrimary)
|
||||||
SYMFUNC(xf86RegisterRootWindowProperty)
|
SYMFUNC(xf86RegisterRootWindowProperty)
|
||||||
SYMFUNC(xf86IsUnblank)
|
SYMFUNC(xf86IsUnblank)
|
||||||
|
@ -654,7 +641,6 @@ _X_HIDDEN void *xfree86LookupTab[] = {
|
||||||
|
|
||||||
SYMFUNC(pciTag)
|
SYMFUNC(pciTag)
|
||||||
SYMFUNC(pciBusAddrToHostAddr)
|
SYMFUNC(pciBusAddrToHostAddr)
|
||||||
SYMFUNC(xf86scanpci)
|
|
||||||
|
|
||||||
/* Loader functions */
|
/* Loader functions */
|
||||||
SYMFUNC(LoadSubModule)
|
SYMFUNC(LoadSubModule)
|
||||||
|
|
|
@ -418,7 +418,7 @@ MonitorStandardTimingLevel(xf86MonPtr DDC)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
ModeRefresh(DisplayModePtr mode)
|
ModeRefresh(const DisplayModeRec *mode)
|
||||||
{
|
{
|
||||||
return (int)(xf86ModeVRefresh(mode) + 0.5);
|
return (int)(xf86ModeVRefresh(mode) + 0.5);
|
||||||
}
|
}
|
||||||
|
@ -432,7 +432,7 @@ static DisplayModePtr
|
||||||
FindDMTMode(int hsize, int vsize, int refresh, Bool rb)
|
FindDMTMode(int hsize, int vsize, int refresh, Bool rb)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
DisplayModePtr ret;
|
const DisplayModeRec *ret;
|
||||||
|
|
||||||
for (i = 0; i < sizeof(DMTModes) / sizeof(DisplayModeRec); i++) {
|
for (i = 0; i < sizeof(DMTModes) / sizeof(DisplayModeRec); i++) {
|
||||||
ret = &DMTModes[i];
|
ret = &DMTModes[i];
|
||||||
|
|
|
@ -52,7 +52,7 @@ extern XF86ConfigPtr xf86configptr;
|
||||||
* Exact copy of xf86Mode.c's.
|
* Exact copy of xf86Mode.c's.
|
||||||
*/
|
*/
|
||||||
_X_EXPORT double
|
_X_EXPORT double
|
||||||
xf86ModeHSync(DisplayModePtr mode)
|
xf86ModeHSync(const DisplayModeRec *mode)
|
||||||
{
|
{
|
||||||
double hsync = 0.0;
|
double hsync = 0.0;
|
||||||
|
|
||||||
|
@ -70,7 +70,7 @@ xf86ModeHSync(DisplayModePtr mode)
|
||||||
* Exact copy of xf86Mode.c's.
|
* Exact copy of xf86Mode.c's.
|
||||||
*/
|
*/
|
||||||
_X_EXPORT double
|
_X_EXPORT double
|
||||||
xf86ModeVRefresh(DisplayModePtr mode)
|
xf86ModeVRefresh(const DisplayModeRec *mode)
|
||||||
{
|
{
|
||||||
double refresh = 0.0;
|
double refresh = 0.0;
|
||||||
|
|
||||||
|
@ -89,7 +89,7 @@ xf86ModeVRefresh(DisplayModePtr mode)
|
||||||
}
|
}
|
||||||
|
|
||||||
_X_EXPORT int
|
_X_EXPORT int
|
||||||
xf86ModeWidth (DisplayModePtr mode, Rotation rotation)
|
xf86ModeWidth (const DisplayModeRec *mode, Rotation rotation)
|
||||||
{
|
{
|
||||||
switch (rotation & 0xf) {
|
switch (rotation & 0xf) {
|
||||||
case RR_Rotate_0:
|
case RR_Rotate_0:
|
||||||
|
@ -104,7 +104,7 @@ xf86ModeWidth (DisplayModePtr mode, Rotation rotation)
|
||||||
}
|
}
|
||||||
|
|
||||||
_X_EXPORT int
|
_X_EXPORT int
|
||||||
xf86ModeHeight (DisplayModePtr mode, Rotation rotation)
|
xf86ModeHeight (const DisplayModeRec *mode, Rotation rotation)
|
||||||
{
|
{
|
||||||
switch (rotation & 0xf) {
|
switch (rotation & 0xf) {
|
||||||
case RR_Rotate_0:
|
case RR_Rotate_0:
|
||||||
|
@ -206,7 +206,7 @@ xf86SetModeCrtc(DisplayModePtr p, int adjustFlags)
|
||||||
* Allocates and returns a copy of pMode, including pointers within pMode.
|
* Allocates and returns a copy of pMode, including pointers within pMode.
|
||||||
*/
|
*/
|
||||||
_X_EXPORT DisplayModePtr
|
_X_EXPORT DisplayModePtr
|
||||||
xf86DuplicateMode(DisplayModePtr pMode)
|
xf86DuplicateMode(const DisplayModeRec *pMode)
|
||||||
{
|
{
|
||||||
DisplayModePtr pNew;
|
DisplayModePtr pNew;
|
||||||
|
|
||||||
|
@ -264,7 +264,7 @@ xf86DuplicateModes(ScrnInfoPtr pScrn, DisplayModePtr modeList)
|
||||||
* This isn't in xf86Modes.c, but it might deserve to be there.
|
* This isn't in xf86Modes.c, but it might deserve to be there.
|
||||||
*/
|
*/
|
||||||
_X_EXPORT Bool
|
_X_EXPORT Bool
|
||||||
xf86ModesEqual(DisplayModePtr pMode1, DisplayModePtr pMode2)
|
xf86ModesEqual(const DisplayModeRec *pMode1, const DisplayModeRec *pMode2)
|
||||||
{
|
{
|
||||||
if (pMode1->Clock == pMode2->Clock &&
|
if (pMode1->Clock == pMode2->Clock &&
|
||||||
pMode1->HDisplay == pMode2->HDisplay &&
|
pMode1->HDisplay == pMode2->HDisplay &&
|
||||||
|
@ -519,7 +519,7 @@ xf86ValidateModesBandwidth(ScrnInfoPtr pScrn, DisplayModePtr modeList,
|
||||||
}
|
}
|
||||||
|
|
||||||
Bool
|
Bool
|
||||||
xf86ModeIsReduced(DisplayModePtr mode)
|
xf86ModeIsReduced(const DisplayModeRec *mode)
|
||||||
{
|
{
|
||||||
if ((((mode->HDisplay * 5 / 4) & ~0x07) > mode->HTotal) &&
|
if ((((mode->HDisplay * 5 / 4) & ~0x07) > mode->HTotal) &&
|
||||||
((mode->HTotal - mode->HDisplay) == 160) &&
|
((mode->HTotal - mode->HDisplay) == 160) &&
|
||||||
|
@ -698,7 +698,7 @@ xf86GetDefaultModes (Bool interlaceAllowed, Bool doubleScanAllowed)
|
||||||
|
|
||||||
for (i = 0; i < xf86NumDefaultModes; i++)
|
for (i = 0; i < xf86NumDefaultModes; i++)
|
||||||
{
|
{
|
||||||
DisplayModePtr defMode = &xf86DefaultModes[i];
|
const DisplayModeRec *defMode = &xf86DefaultModes[i];
|
||||||
|
|
||||||
if (!interlaceAllowed && (defMode->Flags & V_INTERLACE))
|
if (!interlaceAllowed && (defMode->Flags & V_INTERLACE))
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -40,22 +40,23 @@
|
||||||
#include "xf86Rename.h"
|
#include "xf86Rename.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
double xf86ModeHSync(DisplayModePtr mode);
|
double xf86ModeHSync(const DisplayModeRec *mode);
|
||||||
double xf86ModeVRefresh(DisplayModePtr mode);
|
double xf86ModeVRefresh(const DisplayModeRec *mode);
|
||||||
unsigned int xf86ModeBandwidth(DisplayModePtr mode, int depth);
|
unsigned int xf86ModeBandwidth(DisplayModePtr mode, int depth);
|
||||||
|
|
||||||
int
|
int
|
||||||
xf86ModeWidth (DisplayModePtr mode, Rotation rotation);
|
xf86ModeWidth (const DisplayModeRec *mode, Rotation rotation);
|
||||||
|
|
||||||
int
|
int
|
||||||
xf86ModeHeight (DisplayModePtr mode, Rotation rotation);
|
xf86ModeHeight (const DisplayModeRec *mode, Rotation rotation);
|
||||||
|
|
||||||
DisplayModePtr xf86DuplicateMode(DisplayModePtr pMode);
|
DisplayModePtr xf86DuplicateMode(const DisplayModeRec *pMode);
|
||||||
DisplayModePtr xf86DuplicateModes(ScrnInfoPtr pScrn,
|
DisplayModePtr xf86DuplicateModes(ScrnInfoPtr pScrn,
|
||||||
DisplayModePtr modeList);
|
DisplayModePtr modeList);
|
||||||
void xf86SetModeDefaultName(DisplayModePtr mode);
|
void xf86SetModeDefaultName(DisplayModePtr mode);
|
||||||
void xf86SetModeCrtc(DisplayModePtr p, int adjustFlags);
|
void xf86SetModeCrtc(DisplayModePtr p, int adjustFlags);
|
||||||
Bool xf86ModesEqual(DisplayModePtr pMode1, DisplayModePtr pMode2);
|
Bool xf86ModesEqual(const DisplayModeRec *pMode1,
|
||||||
|
const DisplayModeRec *pMode2);
|
||||||
void xf86PrintModeline(int scrnIndex,DisplayModePtr mode);
|
void xf86PrintModeline(int scrnIndex,DisplayModePtr mode);
|
||||||
DisplayModePtr xf86ModesAdd(DisplayModePtr modes, DisplayModePtr new);
|
DisplayModePtr xf86ModesAdd(DisplayModePtr modes, DisplayModePtr new);
|
||||||
|
|
||||||
|
@ -65,7 +66,7 @@ DisplayModePtr xf86CVTMode(int HDisplay, int VDisplay, float VRefresh,
|
||||||
DisplayModePtr xf86GTFMode(int h_pixels, int v_lines, float freq, int interlaced, int margins);
|
DisplayModePtr xf86GTFMode(int h_pixels, int v_lines, float freq, int interlaced, int margins);
|
||||||
|
|
||||||
Bool
|
Bool
|
||||||
xf86ModeIsReduced(DisplayModePtr mode);
|
xf86ModeIsReduced(const DisplayModeRec *mode);
|
||||||
|
|
||||||
void
|
void
|
||||||
xf86ValidateModesFlags(ScrnInfoPtr pScrn, DisplayModePtr modeList,
|
xf86ValidateModesFlags(ScrnInfoPtr pScrn, DisplayModePtr modeList,
|
||||||
|
|
|
@ -433,24 +433,6 @@ xf86DisableIO()
|
||||||
|
|
||||||
#endif /* USE_ALPHA_PIO */
|
#endif /* USE_ALPHA_PIO */
|
||||||
|
|
||||||
/***************************************************************************/
|
|
||||||
/* Interrupt Handling section */
|
|
||||||
/***************************************************************************/
|
|
||||||
|
|
||||||
_X_EXPORT Bool
|
|
||||||
xf86DisableInterrupts()
|
|
||||||
{
|
|
||||||
|
|
||||||
return(TRUE);
|
|
||||||
}
|
|
||||||
|
|
||||||
_X_EXPORT void
|
|
||||||
xf86EnableInterrupts()
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#define vuip volatile unsigned int *
|
#define vuip volatile unsigned int *
|
||||||
|
|
||||||
static unsigned long msb_set = 0;
|
static unsigned long msb_set = 0;
|
||||||
|
|
|
@ -522,27 +522,6 @@ xf86DisableIO()
|
||||||
|
|
||||||
#endif /* USE_ARC_MMAP */
|
#endif /* USE_ARC_MMAP */
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************************/
|
|
||||||
/* Interrupt Handling section */
|
|
||||||
/***************************************************************************/
|
|
||||||
|
|
||||||
_X_EXPORT Bool
|
|
||||||
xf86DisableInterrupts()
|
|
||||||
{
|
|
||||||
|
|
||||||
return(TRUE);
|
|
||||||
}
|
|
||||||
|
|
||||||
_X_EXPORT void
|
|
||||||
xf86EnableInterrupts()
|
|
||||||
{
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
/*
|
/*
|
||||||
* XXX This is here for reference. It needs to be handled differently for the
|
* XXX This is here for reference. It needs to be handled differently for the
|
||||||
|
|
|
@ -444,38 +444,6 @@ xf86DisableIO()
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************************/
|
|
||||||
/* Interrupt Handling section */
|
|
||||||
/***************************************************************************/
|
|
||||||
|
|
||||||
_X_EXPORT Bool
|
|
||||||
xf86DisableInterrupts()
|
|
||||||
{
|
|
||||||
|
|
||||||
#ifdef __GNUC__
|
|
||||||
__asm__ __volatile__("cli");
|
|
||||||
#else
|
|
||||||
asm("cli");
|
|
||||||
#endif /* __GNUC__ */
|
|
||||||
|
|
||||||
return(TRUE);
|
|
||||||
}
|
|
||||||
|
|
||||||
_X_EXPORT void
|
|
||||||
xf86EnableInterrupts()
|
|
||||||
{
|
|
||||||
|
|
||||||
#ifdef __GNUC__
|
|
||||||
__asm__ __volatile__("sti");
|
|
||||||
#else
|
|
||||||
asm("sti");
|
|
||||||
#endif /* __GNUC__ */
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef __NetBSD__
|
#ifdef __NetBSD__
|
||||||
/***************************************************************************/
|
/***************************************************************************/
|
||||||
/* Set TV output mode */
|
/* Set TV output mode */
|
||||||
|
|
|
@ -123,24 +123,6 @@ xf86ReadBIOS(unsigned long Base, unsigned long Offset, unsigned char *Buf,
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
/***************************************************************************/
|
|
||||||
/* Interrupt Handling section */
|
|
||||||
/***************************************************************************/
|
|
||||||
|
|
||||||
_X_EXPORT Bool
|
|
||||||
xf86DisableInterrupts()
|
|
||||||
{
|
|
||||||
|
|
||||||
return(TRUE);
|
|
||||||
}
|
|
||||||
|
|
||||||
_X_EXPORT void
|
|
||||||
xf86EnableInterrupts()
|
|
||||||
{
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Bool xf86EnableIO()
|
Bool xf86EnableIO()
|
||||||
{
|
{
|
||||||
int fd = xf86Info.screenFd;
|
int fd = xf86Info.screenFd;
|
||||||
|
|
|
@ -89,21 +89,3 @@ xf86ReadBIOS(unsigned long Base, unsigned long Offset, unsigned char *Buf,
|
||||||
|
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***************************************************************************/
|
|
||||||
/* Interrupt Handling section */
|
|
||||||
/***************************************************************************/
|
|
||||||
|
|
||||||
_X_EXPORT Bool
|
|
||||||
xf86DisableInterrupts()
|
|
||||||
{
|
|
||||||
|
|
||||||
return(TRUE);
|
|
||||||
}
|
|
||||||
|
|
||||||
_X_EXPORT void
|
|
||||||
xf86EnableInterrupts()
|
|
||||||
{
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
|
@ -11,10 +11,6 @@ if XORG_BUS_BSDPCI
|
||||||
PCI_SOURCES += bsd_pci.c
|
PCI_SOURCES += bsd_pci.c
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if XORG_BUS_IX86PCI
|
|
||||||
PCI_SOURCES += ix86Pci.c
|
|
||||||
endif
|
|
||||||
|
|
||||||
if XORG_BUS_SPARC
|
if XORG_BUS_SPARC
|
||||||
PLATFORM_SOURCES = Sbus.c
|
PLATFORM_SOURCES = Sbus.c
|
||||||
sdk_HEADERS += xf86Sbus.h
|
sdk_HEADERS += xf86Sbus.h
|
||||||
|
|
|
@ -138,13 +138,13 @@
|
||||||
|
|
||||||
/* Global data */
|
/* Global data */
|
||||||
|
|
||||||
pciBusInfo_t *pciBusInfo = NULL;
|
pciBusFuncs_t *pciBusFuncs = NULL;
|
||||||
|
|
||||||
_X_EXPORT ADDRESS
|
_X_EXPORT ADDRESS
|
||||||
pciBusAddrToHostAddr(PCITAG tag, PciAddrType type, ADDRESS addr)
|
pciBusAddrToHostAddr(PCITAG tag, PciAddrType type, ADDRESS addr)
|
||||||
{
|
{
|
||||||
if (pciBusInfo->funcs->pciAddrBusToHost)
|
if (pciBusFuncs && pciBusFuncs->pciAddrBusToHost)
|
||||||
return pciBusInfo->funcs->pciAddrBusToHost(tag, type, addr);
|
return pciBusFuncs->pciAddrBusToHost(tag, type, addr);
|
||||||
else
|
else
|
||||||
return addr;
|
return addr;
|
||||||
}
|
}
|
||||||
|
@ -161,7 +161,7 @@ pciAddrNOOP(PCITAG tag, PciAddrType type, ADDRESS addr)
|
||||||
return(addr);
|
return(addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
_X_EXPORT Bool
|
Bool
|
||||||
xf86scanpci(void)
|
xf86scanpci(void)
|
||||||
{
|
{
|
||||||
Bool success = FALSE;
|
Bool success = FALSE;
|
||||||
|
|
|
@ -168,37 +168,15 @@
|
||||||
|
|
||||||
#endif /* !defined(DEBUGPCI) */
|
#endif /* !defined(DEBUGPCI) */
|
||||||
|
|
||||||
/*
|
|
||||||
* PCI Config mechanism definitions
|
|
||||||
*/
|
|
||||||
#define PCI_EN 0x80000000
|
|
||||||
|
|
||||||
#define PCI_CFGMECH1_ADDRESS_REG 0xCF8
|
|
||||||
#define PCI_CFGMECH1_DATA_REG 0xCFC
|
|
||||||
|
|
||||||
#define PCI_CFGMECH1_MAXDEV 32
|
|
||||||
|
|
||||||
#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || \
|
#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || \
|
||||||
defined(__DragonFly__) || defined(__sun)
|
defined(__DragonFly__) || defined(__sun)
|
||||||
#define ARCH_PCI_INIT bsdPciInit
|
#define ARCH_PCI_INIT bsdPciInit
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(linux)
|
#if defined(linux)
|
||||||
# define ARCH_PCI_INIT linuxPciInit
|
#define ARCH_PCI_INIT linuxPciInit
|
||||||
# if defined(__m32r__)
|
|
||||||
# define INCLUDE_XF86_MAP_PCI_MEM
|
|
||||||
# define INCLUDE_XF86_NO_DOMAIN
|
|
||||||
# endif
|
|
||||||
#endif /* defined(linux) */
|
#endif /* defined(linux) */
|
||||||
|
|
||||||
|
|
||||||
#if !defined(ARCH_PCI_INIT)
|
|
||||||
#warning You really need to port to libpciaccess.
|
|
||||||
#if defined(__i386__) || defined(__i386) || defined(__amd64__) || defined(__amd64)
|
|
||||||
#define ARCH_PCI_INIT ix86PciInit
|
|
||||||
#endif /* i386/amd64 */
|
|
||||||
#endif /* !defined(ARCH_PCI_INIT) */
|
|
||||||
|
|
||||||
#ifndef ARCH_PCI_INIT
|
#ifndef ARCH_PCI_INIT
|
||||||
#error No PCI support available for this architecture/OS combination
|
#error No PCI support available for this architecture/OS combination
|
||||||
#endif
|
#endif
|
||||||
|
@ -213,34 +191,9 @@ typedef struct pci_bus_funcs {
|
||||||
ADDRESS (*pciAddrBusToHost)(PCITAG, PciAddrType, ADDRESS);
|
ADDRESS (*pciAddrBusToHost)(PCITAG, PciAddrType, ADDRESS);
|
||||||
} pciBusFuncs_t, *pciBusFuncs_p;
|
} pciBusFuncs_t, *pciBusFuncs_p;
|
||||||
|
|
||||||
/*
|
|
||||||
* pciBusInfo_t - One structure per defined PCI bus
|
|
||||||
*/
|
|
||||||
typedef struct pci_bus_info {
|
|
||||||
unsigned char configMech; /* PCI config type to use */
|
|
||||||
unsigned char numDevices; /* Range of valid devnums */
|
|
||||||
unsigned char secondary; /* Boolean: bus is a secondary */
|
|
||||||
int primary_bus; /* Parent bus */
|
|
||||||
pciBusFuncs_p funcs; /* PCI access functions */
|
|
||||||
void *pciBusPriv; /* Implementation private data */
|
|
||||||
struct pci_device *bridge; /* bridge that opens this bus */
|
|
||||||
} pciBusInfo_t;
|
|
||||||
|
|
||||||
#define HOST_NO_BUS ((pciBusInfo_t *)(-1))
|
|
||||||
|
|
||||||
/* configMech values */
|
|
||||||
#define PCI_CFG_MECH_UNKNOWN 0 /* Not yet known */
|
|
||||||
#define PCI_CFG_MECH_1 1 /* Most machines */
|
|
||||||
#define PCI_CFG_MECH_2 2 /* Older PC's */
|
|
||||||
#define PCI_CFG_MECH_OTHER 3 /* Something else */
|
|
||||||
|
|
||||||
/* Generic PCI service functions and helpers */
|
/* Generic PCI service functions and helpers */
|
||||||
CARD32 pciCfgMech1Read(PCITAG tag, int offset);
|
|
||||||
void pciCfgMech1Write(PCITAG tag, int offset, CARD32 val);
|
|
||||||
void pciCfgMech1SetBits(PCITAG tag, int offset, CARD32 mask,
|
|
||||||
CARD32 val);
|
|
||||||
ADDRESS pciAddrNOOP(PCITAG tag, PciAddrType type, ADDRESS);
|
ADDRESS pciAddrNOOP(PCITAG tag, PciAddrType type, ADDRESS);
|
||||||
|
|
||||||
extern pciBusInfo_t *pciBusInfo;
|
extern pciBusFuncs_t *pciBusFuncs;
|
||||||
|
|
||||||
#endif /* _PCI_H */
|
#endif /* _PCI_H */
|
||||||
|
|
|
@ -48,20 +48,6 @@
|
||||||
|
|
||||||
#include "pciaccess.h"
|
#include "pciaccess.h"
|
||||||
|
|
||||||
static pciBusFuncs_t bsd_funcs = {
|
|
||||||
.pciAddrBusToHost = pciAddrNOOP,
|
|
||||||
};
|
|
||||||
|
|
||||||
static pciBusInfo_t bsd_pci = {
|
|
||||||
.configMech = PCI_CFG_MECH_OTHER,
|
|
||||||
.numDevices = 32,
|
|
||||||
.secondary = FALSE,
|
|
||||||
.primary_bus = 0,
|
|
||||||
.funcs = &bsd_funcs,
|
|
||||||
.pciBusPriv = NULL,
|
|
||||||
.bridge = NULL,
|
|
||||||
};
|
|
||||||
|
|
||||||
_X_EXPORT pointer
|
_X_EXPORT pointer
|
||||||
xf86MapDomainMemory(int ScreenNum, int Flags, struct pci_device *dev,
|
xf86MapDomainMemory(int ScreenNum, int Flags, struct pci_device *dev,
|
||||||
ADDRESS Base, unsigned long Size)
|
ADDRESS Base, unsigned long Size)
|
||||||
|
@ -79,7 +65,5 @@ xf86MapLegacyIO(struct pci_device *dev)
|
||||||
void
|
void
|
||||||
bsdPciInit(void)
|
bsdPciInit(void)
|
||||||
{
|
{
|
||||||
pciBusInfo = &bsd_pci;
|
|
||||||
|
|
||||||
xf86InitVidMem();
|
xf86InitVidMem();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,484 +0,0 @@
|
||||||
/*
|
|
||||||
* ix86Pci.c - x86 PCI driver
|
|
||||||
*
|
|
||||||
* The XFree86 server PCI access functions have been reimplemented as a
|
|
||||||
* framework that allows each supported platform/OS to have their own
|
|
||||||
* platform/OS specific PCI driver.
|
|
||||||
*
|
|
||||||
* Most of the code of these functions was simply lifted from the
|
|
||||||
* Intel architecture specifric portion of the original Xfree86
|
|
||||||
* PCI code in hw/xfree86/common_hw/xf86_PCI.C...
|
|
||||||
*
|
|
||||||
* Gary Barton
|
|
||||||
* Concurrent Computer Corporation
|
|
||||||
* garyb@gate.net
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Copyright 1998 by Concurrent Computer Corporation
|
|
||||||
*
|
|
||||||
* Permission to use, copy, modify, distribute, and sell this software
|
|
||||||
* and its documentation for any purpose is hereby granted without fee,
|
|
||||||
* provided that the above copyright notice appear in all copies and that
|
|
||||||
* both that copyright notice and this permission notice appear in
|
|
||||||
* supporting documentation, and that the name of Concurrent Computer
|
|
||||||
* Corporation not be used in advertising or publicity pertaining to
|
|
||||||
* distribution of the software without specific, written prior
|
|
||||||
* permission. Concurrent Computer Corporation makes no representations
|
|
||||||
* about the suitability of this software for any purpose. It is
|
|
||||||
* provided "as is" without express or implied warranty.
|
|
||||||
*
|
|
||||||
* CONCURRENT COMPUTER CORPORATION DISCLAIMS ALL WARRANTIES WITH REGARD
|
|
||||||
* TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
||||||
* AND FITNESS, IN NO EVENT SHALL CONCURRENT COMPUTER CORPORATION BE
|
|
||||||
* LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY
|
|
||||||
* DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
|
||||||
* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
|
|
||||||
* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
|
|
||||||
* SOFTWARE.
|
|
||||||
*
|
|
||||||
* Copyright 1998 by Metro Link Incorporated
|
|
||||||
*
|
|
||||||
* Permission to use, copy, modify, distribute, and sell this software
|
|
||||||
* and its documentation for any purpose is hereby granted without fee,
|
|
||||||
* provided that the above copyright notice appear in all copies and that
|
|
||||||
* both that copyright notice and this permission notice appear in
|
|
||||||
* supporting documentation, and that the name of Metro Link
|
|
||||||
* Incorporated not be used in advertising or publicity pertaining to
|
|
||||||
* distribution of the software without specific, written prior
|
|
||||||
* permission. Metro Link Incorporated makes no representations
|
|
||||||
* about the suitability of this software for any purpose. It is
|
|
||||||
* provided "as is" without express or implied warranty.
|
|
||||||
*
|
|
||||||
* METRO LINK INCORPORATED DISCLAIMS ALL WARRANTIES WITH REGARD
|
|
||||||
* TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
||||||
* AND FITNESS, IN NO EVENT SHALL METRO LINK INCORPORATED BE
|
|
||||||
* LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY
|
|
||||||
* DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
|
||||||
* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
|
|
||||||
* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
|
|
||||||
* SOFTWARE.
|
|
||||||
*
|
|
||||||
* This software is derived from the original XFree86 PCI code
|
|
||||||
* which includes the following copyright notices as well:
|
|
||||||
*
|
|
||||||
* Copyright 1995 by Robin Cutshaw <robin@XFree86.Org>
|
|
||||||
*
|
|
||||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
|
||||||
* documentation for any purpose is hereby granted without fee, provided that
|
|
||||||
* the above copyright notice appear in all copies and that both that
|
|
||||||
* copyright notice and this permission notice appear in supporting
|
|
||||||
* documentation, and that the names of the above listed copyright holder(s)
|
|
||||||
* not be used in advertising or publicity pertaining to distribution of
|
|
||||||
* the software without specific, written prior permission. The above listed
|
|
||||||
* copyright holder(s) make(s) no representations about the suitability of this
|
|
||||||
* software for any purpose. It is provided "as is" without express or
|
|
||||||
* implied warranty.
|
|
||||||
*
|
|
||||||
* THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM(S) ALL WARRANTIES WITH REGARD
|
|
||||||
* TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
||||||
* AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE
|
|
||||||
* LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY
|
|
||||||
* DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
|
|
||||||
* IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
|
|
||||||
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
||||||
*
|
|
||||||
* This code is also based heavily on the code in FreeBSD-current, which was
|
|
||||||
* written by Wolfgang Stanglmeier, and contains the following copyright:
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
|
||||||
* documentation and/or other materials provided with the distribution.
|
|
||||||
* 3. The name of the author may not be used to endorse or promote products
|
|
||||||
* derived from this software without specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
|
||||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|
||||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
||||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
||||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|
||||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
||||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
||||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|
||||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
|
||||||
/*
|
|
||||||
* Copyright (c) 1999-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).
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef HAVE_XORG_CONFIG_H
|
|
||||||
#include <xorg-config.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include "compiler.h"
|
|
||||||
#include "xf86.h"
|
|
||||||
#include "xf86Priv.h"
|
|
||||||
#include "xf86_OSlib.h"
|
|
||||||
#include "Pci.h"
|
|
||||||
|
|
||||||
#ifdef PC98
|
|
||||||
#define outb(port,data) _outb(port,data)
|
|
||||||
#define outl(port,data) _outl(port,data)
|
|
||||||
#define inb(port) _inb(port)
|
|
||||||
#define inl(port) _inl(port)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define PCI_CFGMECH2_ENABLE_REG 0xCF8
|
|
||||||
#ifdef PC98
|
|
||||||
#define PCI_CFGMECH2_FORWARD_REG 0xCF9
|
|
||||||
#else
|
|
||||||
#define PCI_CFGMECH2_FORWARD_REG 0xCFA
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define PCI_CFGMECH2_MAXDEV 16
|
|
||||||
|
|
||||||
#define PCI_ADDR_FROM_TAG_CFG1(tag,reg) (PCI_EN | tag | (reg & 0xfc))
|
|
||||||
#define PCI_FORWARD_FROM_TAG(tag) PCI_BUS_FROM_TAG(tag)
|
|
||||||
#define PCI_ENABLE_FROM_TAG(tag) (0xf0 | (((tag) & 0x00000700) >> 7))
|
|
||||||
#define PCI_ADDR_FROM_TAG_CFG2(tag,reg) (0xc000 | (((tag) & 0x0000f800) >> 3) \
|
|
||||||
| (reg & 0xfc))
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Intel x86 platform specific PCI access functions
|
|
||||||
*/
|
|
||||||
#if 0
|
|
||||||
static CARD32 ix86PciReadLongSetup(PCITAG tag, int off);
|
|
||||||
static void ix86PciWriteLongSetup(PCITAG, int off, CARD32 val);
|
|
||||||
static void ix86PciSetBitsLongSetup(PCITAG, int off, CARD32 mask, CARD32 val);
|
|
||||||
static CARD32 ix86PciReadLongCFG1(PCITAG tag, int off);
|
|
||||||
static void ix86PciWriteLongCFG1(PCITAG, int off, CARD32 val);
|
|
||||||
static void ix86PciSetBitsLongCFG1(PCITAG, int off, CARD32 mask, CARD32 val);
|
|
||||||
static CARD32 ix86PciReadLongCFG2(PCITAG tag, int off);
|
|
||||||
static void ix86PciWriteLongCFG2(PCITAG, int off, CARD32 val);
|
|
||||||
static void ix86PciSetBitsLongCFG2(PCITAG, int off, CARD32 mask, CARD32 val);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static pciBusFuncs_t ix86Funcs0 = {
|
|
||||||
#if 0
|
|
||||||
/* pciReadLong */ ix86PciReadLongSetup,
|
|
||||||
/* pciWriteLong */ ix86PciWriteLongSetup,
|
|
||||||
/* pciSetBitsLong */ ix86PciSetBitsLongSetup,
|
|
||||||
/* pciAddrHostToBus */ pciAddrNOOP,
|
|
||||||
#endif
|
|
||||||
/* pciAddrBusToHost */ pciAddrNOOP
|
|
||||||
};
|
|
||||||
|
|
||||||
static pciBusFuncs_t ix86Funcs1 = {
|
|
||||||
#if 0
|
|
||||||
/* pciReadLong */ ix86PciReadLongCFG1,
|
|
||||||
/* pciWriteLong */ ix86PciWriteLongCFG1,
|
|
||||||
/* pciSetBitsLong */ ix86PciSetBitsLongCFG1,
|
|
||||||
/* pciAddrHostToBus */ pciAddrNOOP,
|
|
||||||
#endif
|
|
||||||
/* pciAddrBusToHost */ pciAddrNOOP
|
|
||||||
};
|
|
||||||
|
|
||||||
static pciBusFuncs_t ix86Funcs2 = {
|
|
||||||
#if 0
|
|
||||||
/* pciReadLong */ ix86PciReadLongCFG2,
|
|
||||||
/* pciWriteLong */ ix86PciWriteLongCFG2,
|
|
||||||
/* pciSetBitsLong */ ix86PciSetBitsLongCFG2,
|
|
||||||
/* pciAddrHostToBus */ pciAddrNOOP,
|
|
||||||
#endif
|
|
||||||
/* pciAddrBusToHost */ pciAddrNOOP
|
|
||||||
};
|
|
||||||
|
|
||||||
static pciBusInfo_t ix86Pci0 = {
|
|
||||||
/* configMech */ PCI_CFG_MECH_UNKNOWN, /* Set by ix86PciInit() */
|
|
||||||
/* numDevices */ 0, /* Set by ix86PciInit() */
|
|
||||||
/* secondary */ FALSE,
|
|
||||||
/* primary_bus */ 0,
|
|
||||||
/* funcs */ &ix86Funcs0, /* Set by ix86PciInit() */
|
|
||||||
/* pciBusPriv */ NULL,
|
|
||||||
/* bridge */ NULL
|
|
||||||
};
|
|
||||||
|
|
||||||
_X_EXPORT pointer
|
|
||||||
xf86MapDomainMemory(int ScreenNum, int Flags, struct pci_device *dev,
|
|
||||||
ADDRESS Base, unsigned long Size)
|
|
||||||
{
|
|
||||||
return xf86MapVidMem(ScreenNum, Flags, Base, Size);
|
|
||||||
}
|
|
||||||
|
|
||||||
IOADDRESS
|
|
||||||
xf86MapLegacyIO(struct pci_device *dev)
|
|
||||||
{
|
|
||||||
(void)dev;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static Bool
|
|
||||||
ix86PciBusCheck(void)
|
|
||||||
{
|
|
||||||
#if 0
|
|
||||||
PCITAG tag;
|
|
||||||
CARD32 id, class;
|
|
||||||
CARD8 device;
|
|
||||||
|
|
||||||
for (device = 0; device < ix86Pci0.numDevices; device++) {
|
|
||||||
tag = PCI_MAKE_TAG(0, device, 0);
|
|
||||||
id = (*ix86Pci0.funcs->pciReadLong)(tag, PCI_ID_REG);
|
|
||||||
|
|
||||||
if ((CARD16)(id + 1U) <= (CARD16)1UL)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
/* The rest of this is inspired by the Linux kernel */
|
|
||||||
class = (*ix86Pci0.funcs->pciReadLong)(tag, PCI_CLASS_REG);
|
|
||||||
|
|
||||||
/* Ignore revision id and programming interface */
|
|
||||||
switch (class >> 16) {
|
|
||||||
case (PCI_CLASS_PREHISTORIC << 8) | PCI_SUBCLASS_PREHISTORIC_MISC:
|
|
||||||
/* Check for vendors of known buggy chipsets */
|
|
||||||
id &= 0x0000ffff;
|
|
||||||
if ((id == PCI_VENDOR_INTEL) || (id == PCI_VENDOR_COMPAQ))
|
|
||||||
return TRUE;
|
|
||||||
continue;
|
|
||||||
|
|
||||||
case (PCI_CLASS_PREHISTORIC << 8) | PCI_SUBCLASS_PREHISTORIC_VGA:
|
|
||||||
case (PCI_CLASS_DISPLAY << 8) | PCI_SUBCLASS_DISPLAY_VGA:
|
|
||||||
case (PCI_CLASS_BRIDGE << 8) | PCI_SUBCLASS_BRIDGE_HOST:
|
|
||||||
return TRUE;
|
|
||||||
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
ix86PciSelectCfgmech(void)
|
|
||||||
{
|
|
||||||
static Bool beenhere = FALSE;
|
|
||||||
CARD32 mode1Res1 = 0, mode1Res2 = 0, oldVal1 = 0;
|
|
||||||
CARD8 mode2Res1 = 0, mode2Res2 = 0, oldVal2 = 0;
|
|
||||||
int stages = 0;
|
|
||||||
|
|
||||||
if (beenhere)
|
|
||||||
return; /* Been there, done that */
|
|
||||||
|
|
||||||
beenhere = TRUE;
|
|
||||||
|
|
||||||
/* Determine if motherboard chipset supports PCI Config Mech 1 or 2 */
|
|
||||||
do {
|
|
||||||
if (!xf86EnableIO())
|
|
||||||
return;
|
|
||||||
|
|
||||||
xf86MsgVerb(X_INFO, 2,
|
|
||||||
"PCI: Probing config type using method 1\n");
|
|
||||||
oldVal1 = inl(PCI_CFGMECH1_ADDRESS_REG);
|
|
||||||
|
|
||||||
#ifdef DEBUGPCI
|
|
||||||
if (xf86Verbose > 2) {
|
|
||||||
ErrorF("Checking config type 1:\n"
|
|
||||||
"\tinitial value of MODE1_ADDR_REG is 0x%08x\n", oldVal1);
|
|
||||||
ErrorF("\tChecking that all bits in mask 0x7f000000 are clear\n");
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Assuming config type 1 to start with */
|
|
||||||
if ((oldVal1 & 0x7f000000) == 0) {
|
|
||||||
|
|
||||||
stages |= 0x01;
|
|
||||||
|
|
||||||
#ifdef DEBUGPCI
|
|
||||||
if (xf86Verbose > 2) {
|
|
||||||
ErrorF("\tValue indicates possibly config type 1\n");
|
|
||||||
ErrorF("\tWriting 32-bit value 0x%08x to MODE1_ADDR_REG\n", PCI_EN);
|
|
||||||
#if 0
|
|
||||||
ErrorF("\tWriting 8-bit value 0x00 to MODE1_ADDR_REG + 3\n");
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
ix86Pci0.configMech = PCI_CFG_MECH_1;
|
|
||||||
ix86Pci0.numDevices = PCI_CFGMECH1_MAXDEV;
|
|
||||||
ix86Pci0.funcs = &ix86Funcs1;
|
|
||||||
|
|
||||||
outl(PCI_CFGMECH1_ADDRESS_REG, PCI_EN);
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
/*
|
|
||||||
* This seems to cause some Neptune-based PCI machines to switch
|
|
||||||
* from config type 1 to config type 2
|
|
||||||
*/
|
|
||||||
outb(PCI_CFGMECH1_ADDRESS_REG + 3, 0);
|
|
||||||
#endif
|
|
||||||
mode1Res1 = inl(PCI_CFGMECH1_ADDRESS_REG);
|
|
||||||
|
|
||||||
#ifdef DEBUGPCI
|
|
||||||
if (xf86Verbose > 2) {
|
|
||||||
ErrorF("\tValue read back from MODE1_ADDR_REG is 0x%08x\n",
|
|
||||||
mode1Res1);
|
|
||||||
ErrorF("\tRestoring original contents of MODE1_ADDR_REG\n");
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
outl(PCI_CFGMECH1_ADDRESS_REG, oldVal1);
|
|
||||||
|
|
||||||
if (mode1Res1) {
|
|
||||||
|
|
||||||
stages |= 0x02;
|
|
||||||
|
|
||||||
#ifdef DEBUGPCI
|
|
||||||
if (xf86Verbose > 2) {
|
|
||||||
ErrorF("\tValue read back is non-zero, and indicates possible"
|
|
||||||
" config type 1\n");
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (ix86PciBusCheck()) {
|
|
||||||
|
|
||||||
#ifdef DEBUGPCI
|
|
||||||
if (xf86Verbose > 2)
|
|
||||||
ErrorF("\tBus check Confirms this: ");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
xf86MsgVerb(X_INFO, 2, "PCI: Config type is 1\n");
|
|
||||||
xf86MsgVerb(X_INFO, 3,
|
|
||||||
"PCI: stages = 0x%02x, oldVal1 = 0x%08lx, mode1Res1"
|
|
||||||
" = 0x%08lx\n", stages, (unsigned long)oldVal1,
|
|
||||||
(unsigned long)mode1Res1);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef DEBUGPCI
|
|
||||||
if (xf86Verbose > 2) {
|
|
||||||
ErrorF("\tBus check fails to confirm this, continuing type 1"
|
|
||||||
" check ...\n");
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
stages |= 0x04;
|
|
||||||
|
|
||||||
#ifdef DEBUGPCI
|
|
||||||
if (xf86Verbose > 2) {
|
|
||||||
ErrorF("\tWriting 0xff000001 to MODE1_ADDR_REG\n");
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
outl(PCI_CFGMECH1_ADDRESS_REG, 0xff000001);
|
|
||||||
mode1Res2 = inl(PCI_CFGMECH1_ADDRESS_REG);
|
|
||||||
|
|
||||||
#ifdef DEBUGPCI
|
|
||||||
if (xf86Verbose > 2) {
|
|
||||||
ErrorF("\tValue read back from MODE1_ADDR_REG is 0x%08x\n",
|
|
||||||
mode1Res2);
|
|
||||||
ErrorF("\tRestoring original contents of MODE1_ADDR_REG\n");
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
outl(PCI_CFGMECH1_ADDRESS_REG, oldVal1);
|
|
||||||
|
|
||||||
if ((mode1Res2 & 0x80000001) == 0x80000000) {
|
|
||||||
|
|
||||||
stages |= 0x08;
|
|
||||||
|
|
||||||
#ifdef DEBUGPCI
|
|
||||||
if (xf86Verbose > 2) {
|
|
||||||
ErrorF("\tValue read back has only the msb set\n"
|
|
||||||
"\tThis indicates possible config type 1\n");
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (ix86PciBusCheck()) {
|
|
||||||
|
|
||||||
#ifdef DEBUGPCI
|
|
||||||
if (xf86Verbose > 2)
|
|
||||||
ErrorF("\tBus check Confirms this: ");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
xf86MsgVerb(X_INFO, 2, "PCI: Config type is 1\n");
|
|
||||||
xf86MsgVerb(X_INFO, 3,
|
|
||||||
"PCI: stages = 0x%02x, oldVal1 = 0x%08lx,\n"
|
|
||||||
"\tmode1Res1 = 0x%08lx, mode1Res2 = 0x%08lx\n",
|
|
||||||
stages, (unsigned long)oldVal1,
|
|
||||||
(unsigned long)mode1Res1, (unsigned long)mode1Res2);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef DEBUGPCI
|
|
||||||
if (xf86Verbose > 2) {
|
|
||||||
ErrorF("\tBus check fails to confirm this.\n");
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
xf86MsgVerb(X_INFO, 3, "PCI: Standard check for type 1 failed.\n");
|
|
||||||
xf86MsgVerb(X_INFO, 3, "PCI: stages = 0x%02x, oldVal1 = 0x%08lx,\n"
|
|
||||||
"\tmode1Res1 = 0x%08lx, mode1Res2 = 0x%08lx\n",
|
|
||||||
stages, (unsigned long)oldVal1, (unsigned long)mode1Res1,
|
|
||||||
(unsigned long)mode1Res2);
|
|
||||||
|
|
||||||
/* Try config type 2 */
|
|
||||||
oldVal2 = inb(PCI_CFGMECH2_ENABLE_REG);
|
|
||||||
if ((oldVal2 & 0xf0) == 0) {
|
|
||||||
ix86Pci0.configMech = PCI_CFG_MECH_2;
|
|
||||||
ix86Pci0.numDevices = PCI_CFGMECH2_MAXDEV;
|
|
||||||
ix86Pci0.funcs = &ix86Funcs2;
|
|
||||||
|
|
||||||
outb(PCI_CFGMECH2_ENABLE_REG, 0x0e);
|
|
||||||
mode2Res1 = inb(PCI_CFGMECH2_ENABLE_REG);
|
|
||||||
outb(PCI_CFGMECH2_ENABLE_REG, oldVal2);
|
|
||||||
|
|
||||||
if (mode2Res1 == 0x0e) {
|
|
||||||
if (ix86PciBusCheck()) {
|
|
||||||
xf86MsgVerb(X_INFO, 2, "PCI: Config type is 2\n");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
} while (0);
|
|
||||||
|
|
||||||
/* No PCI found */
|
|
||||||
ix86Pci0.configMech = PCI_CFG_MECH_UNKNOWN;
|
|
||||||
xf86MsgVerb(X_INFO, 2, "PCI: No PCI bus found\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
ix86PciInit()
|
|
||||||
{
|
|
||||||
/* Initialize pciBusInfo */
|
|
||||||
pciBusInfo = &ix86Pci0;
|
|
||||||
|
|
||||||
/* Make sure that there is a PCI bus present. */
|
|
||||||
ix86PciSelectCfgmech();
|
|
||||||
if (ix86Pci0.configMech == PCI_CFG_MECH_UNKNOWN) {
|
|
||||||
pciBusInfo = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -79,42 +79,28 @@ static pciBusFuncs_t linuxFuncs0 = {
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
static pciBusInfo_t linuxPci0 = {
|
|
||||||
/* configMech */ PCI_CFG_MECH_OTHER,
|
|
||||||
/* numDevices */ 32,
|
|
||||||
/* secondary */ FALSE,
|
|
||||||
/* primary_bus */ 0,
|
|
||||||
/* funcs */ &linuxFuncs0,
|
|
||||||
/* pciBusPriv */ NULL,
|
|
||||||
/* bridge */ NULL
|
|
||||||
};
|
|
||||||
|
|
||||||
static const struct pci_id_match match_host_bridge = {
|
static const struct pci_id_match match_host_bridge = {
|
||||||
PCI_MATCH_ANY, PCI_MATCH_ANY, PCI_MATCH_ANY, PCI_MATCH_ANY,
|
PCI_MATCH_ANY, PCI_MATCH_ANY, PCI_MATCH_ANY, PCI_MATCH_ANY,
|
||||||
(PCI_CLASS_BRIDGE << 16) | (PCI_SUBCLASS_BRIDGE_HOST << 8),
|
(PCI_CLASS_BRIDGE << 16) | (PCI_SUBCLASS_BRIDGE_HOST << 8),
|
||||||
0x0000ffff00, 0
|
0x0000ffff00, 0
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifndef INCLUDE_XF86_NO_DOMAIN
|
|
||||||
#define MAX_DOMAINS 257
|
#define MAX_DOMAINS 257
|
||||||
static pointer DomainMmappedIO[MAX_DOMAINS];
|
static pointer DomainMmappedIO[MAX_DOMAINS];
|
||||||
#endif
|
|
||||||
|
|
||||||
void
|
void
|
||||||
linuxPciInit(void)
|
linuxPciInit(void)
|
||||||
{
|
{
|
||||||
struct stat st;
|
struct stat st;
|
||||||
|
|
||||||
#ifndef INCLUDE_XF86_NO_DOMAIN
|
|
||||||
memset(DomainMmappedIO, 0, sizeof(DomainMmappedIO));
|
memset(DomainMmappedIO, 0, sizeof(DomainMmappedIO));
|
||||||
#endif
|
|
||||||
|
|
||||||
if (-1 == stat("/proc/bus/pci", &st)) {
|
if (-1 == stat("/proc/bus/pci", &st)) {
|
||||||
/* when using this as default for all linux architectures,
|
/* when using this as default for all linux architectures,
|
||||||
we'll need a fallback for 2.0 kernels here */
|
we'll need a fallback for 2.0 kernels here */
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
pciBusInfo = &linuxPci0;
|
pciBusFuncs = &linuxFuncs0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -237,7 +223,6 @@ linuxPpcBusAddrToHostAddr(PCITAG tag, PciAddrType type, ADDRESS addr)
|
||||||
|
|
||||||
#endif /* __powerpc__ */
|
#endif /* __powerpc__ */
|
||||||
|
|
||||||
#ifndef INCLUDE_XF86_NO_DOMAIN
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Compiling the following simply requires the presence of <linux/pci.c>.
|
* Compiling the following simply requires the presence of <linux/pci.c>.
|
||||||
|
@ -601,4 +586,3 @@ xf86AccResFromOS(resPtr pRes)
|
||||||
return pRes;
|
return pRes;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* !INCLUDE_XF86_NO_DOMAIN */
|
|
||||||
|
|
|
@ -142,20 +142,6 @@ xf86DisableIO()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**************************************************************************
|
|
||||||
* Interrupt Handling section
|
|
||||||
**************************************************************************/
|
|
||||||
Bool
|
|
||||||
xf86DisableInterrupts()
|
|
||||||
{
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
void
|
|
||||||
xf86EnableInterrupts()
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
xf86MapReadSideEffects(int ScreenNum, int Flags, pointer Base,
|
xf86MapReadSideEffects(int ScreenNum, int Flags, pointer Base,
|
||||||
unsigned long Size)
|
unsigned long Size)
|
||||||
|
|
|
@ -2,7 +2,6 @@ noinst_LTLIBRARIES = liblinux.la
|
||||||
|
|
||||||
if LINUX_IA64
|
if LINUX_IA64
|
||||||
PLATFORM_PCI_SUPPORT = $(srcdir)/../shared/ia64Pci.c
|
PLATFORM_PCI_SUPPORT = $(srcdir)/../shared/ia64Pci.c
|
||||||
PLATFORM_DEFINES = -DOS_PROBE_PCI_CHIPSET=lnxProbePciChipset
|
|
||||||
PLATFORM_INCLUDES = -I$(srcdir)/../shared
|
PLATFORM_INCLUDES = -I$(srcdir)/../shared
|
||||||
endif
|
endif
|
||||||
if LINUX_ALPHA
|
if LINUX_ALPHA
|
||||||
|
|
|
@ -292,10 +292,6 @@ xf86ExtendedInitInt10(int entityIndex, int Flags)
|
||||||
pInt->BIOSseg = V_BIOS >> 4;
|
pInt->BIOSseg = V_BIOS >> 4;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case BUS_ISA:
|
|
||||||
if (!xf86int10GetBiosSegment(pInt, NULL))
|
|
||||||
goto error3;
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
goto error3;
|
goto error3;
|
||||||
}
|
}
|
||||||
|
|
|
@ -179,7 +179,6 @@ _alpha_iobase_query(unsigned flags, int hose, int bus, int devfn)
|
||||||
*/
|
*/
|
||||||
_iobase = _alpha_iobase;
|
_iobase = _alpha_iobase;
|
||||||
|
|
||||||
#ifndef INCLUDE_XF86_NO_DOMAIN
|
|
||||||
/*
|
/*
|
||||||
* Only take over the inx/outx functions if this is a dense I/O
|
* Only take over the inx/outx functions if this is a dense I/O
|
||||||
* system *and* addressing domains are being used. The dense I/O
|
* system *and* addressing domains are being used. The dense I/O
|
||||||
|
@ -191,7 +190,6 @@ _alpha_iobase_query(unsigned flags, int hose, int bus, int devfn)
|
||||||
_alpha_inb = _dense_inb;
|
_alpha_inb = _dense_inb;
|
||||||
_alpha_inw = _dense_inw;
|
_alpha_inw = _dense_inw;
|
||||||
_alpha_inl = _dense_inl;
|
_alpha_inl = _dense_inl;
|
||||||
#endif /* !INCLUDE_XF86_NO_DOMAIN */
|
|
||||||
} else _iobase = _alpha_iobase_legacy;
|
} else _iobase = _alpha_iobase_legacy;
|
||||||
|
|
||||||
return _iobase(flags, hose, bus, devfn);
|
return _iobase(flags, hose, bus, devfn);
|
||||||
|
|
|
@ -32,6 +32,7 @@
|
||||||
|
|
||||||
#include "xf86.h"
|
#include "xf86.h"
|
||||||
#include "xf86Priv.h"
|
#include "xf86Priv.h"
|
||||||
|
#include "xf86_OSproc.h"
|
||||||
|
|
||||||
_X_EXPORT void
|
_X_EXPORT void
|
||||||
xf86OSRingBell(int loudness, int pitch, int duration)
|
xf86OSRingBell(int loudness, int pitch, int duration)
|
||||||
|
|
|
@ -90,7 +90,6 @@ writeDense32(int Value, pointer Base, register unsigned long Offset)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifndef INCLUDE_XF86_NO_DOMAIN
|
|
||||||
|
|
||||||
void
|
void
|
||||||
_dense_outb(char val, unsigned long port)
|
_dense_outb(char val, unsigned long port)
|
||||||
|
@ -146,5 +145,4 @@ _dense_inl(unsigned long port)
|
||||||
return *(volatile CARD32 *)port;
|
return *(volatile CARD32 *)port;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* !INCLUDE_XF86_NO_DOMAIN */
|
|
||||||
|
|
||||||
|
|
|
@ -1,74 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright 2004, Egbert Eich
|
|
||||||
*
|
|
||||||
* 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
|
|
||||||
* EGBERT EICH BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
|
||||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CON-
|
|
||||||
* NECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
*
|
|
||||||
* Except as contained in this notice, the name of Egbert Eich shall not
|
|
||||||
* be used in advertising or otherwise to promote the sale, use or other deal-
|
|
||||||
*ings in this Software without prior written authorization from Egbert Eich.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef HAVE_XORG_CONFIG_H
|
|
||||||
#include <xorg-config.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <sys/types.h>
|
|
||||||
#include <sys/stat.h>
|
|
||||||
#include <sys/utsname.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
|
|
||||||
#include "ia64Pci.h"
|
|
||||||
#include "Pci.h"
|
|
||||||
|
|
||||||
#if defined OS_PROBE_PCI_CHIPSET
|
|
||||||
IA64Chipset OS_PROBE_PCI_CHIPSET(scanpciWrapperOpt flags)
|
|
||||||
{
|
|
||||||
struct stat unused;
|
|
||||||
struct utsname utsName;
|
|
||||||
|
|
||||||
if (!stat("/proc/bus/mckinley/zx1",&unused)
|
|
||||||
|| !stat("/proc/bus/mckinley/zx2",&unused))
|
|
||||||
return ZX1_CHIPSET;
|
|
||||||
|
|
||||||
if (!stat("/proc/sgi_sn/licenseID", &unused)) {
|
|
||||||
int major, minor, patch;
|
|
||||||
char *c;
|
|
||||||
|
|
||||||
/* We need a 2.6.11 or better kernel for Altix support */
|
|
||||||
uname(&utsName);
|
|
||||||
c = utsName.release;
|
|
||||||
|
|
||||||
major = atoi(c);
|
|
||||||
c = strstr(c, ".") + 1;
|
|
||||||
minor = atoi(c);
|
|
||||||
c = strstr(c, ".") + 1;
|
|
||||||
patch = atoi(c);
|
|
||||||
|
|
||||||
if (major < 2 || (major == 2 && minor < 6) ||
|
|
||||||
(major == 2 && minor == 6 && patch < 11)) {
|
|
||||||
ErrorF("Kernel 2.6.11 or better needed for Altix support\n");
|
|
||||||
return NONE_CHIPSET;
|
|
||||||
}
|
|
||||||
return ALTIX_CHIPSET;
|
|
||||||
}
|
|
||||||
|
|
||||||
return NONE_CHIPSET;
|
|
||||||
}
|
|
||||||
#endif
|
|
|
@ -77,8 +77,6 @@ extern int iopl(int __level);
|
||||||
|
|
||||||
extern void sethae(unsigned long hae);
|
extern void sethae(unsigned long hae);
|
||||||
|
|
||||||
# define isJensen (axpSystem == JENSEN)
|
|
||||||
|
|
||||||
# define BUS_BASE bus_base
|
# define BUS_BASE bus_base
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
@ -97,10 +95,6 @@ static void unmapVidMem(int, pointer, unsigned long);
|
||||||
static pointer mapVidMemSparse(int, unsigned long, unsigned long, int);
|
static pointer mapVidMemSparse(int, unsigned long, unsigned long, int);
|
||||||
extern axpDevice lnxGetAXP(void);
|
extern axpDevice lnxGetAXP(void);
|
||||||
static void unmapVidMemSparse(int, pointer, unsigned long);
|
static void unmapVidMemSparse(int, pointer, unsigned long);
|
||||||
# if defined(JENSEN_SUPPORT)
|
|
||||||
static pointer mapVidMemJensen(int, unsigned long, unsigned long, int);
|
|
||||||
static void unmapVidMemJensen(int, pointer, unsigned long);
|
|
||||||
# endif
|
|
||||||
static axpDevice axpSystem = -1;
|
static axpDevice axpSystem = -1;
|
||||||
static Bool needSparse;
|
static Bool needSparse;
|
||||||
static unsigned long hae_thresh;
|
static unsigned long hae_thresh;
|
||||||
|
@ -388,17 +382,7 @@ xf86OSInitVidMem(VidMemInfoPtr pVidMem)
|
||||||
}
|
}
|
||||||
bus_base = _bus_base();
|
bus_base = _bus_base();
|
||||||
}
|
}
|
||||||
if (isJensen) {
|
if (needSparse) {
|
||||||
# ifndef JENSEN_SUPPORT
|
|
||||||
FatalError("Jensen is not supported any more\n"
|
|
||||||
"If you are intereseted in fixing Jensen support\n"
|
|
||||||
"please contact xorg@lists.freedesktop.org\n");
|
|
||||||
# else
|
|
||||||
xf86Msg(X_INFO,"Machine type is Jensen\n");
|
|
||||||
pVidMem->mapMem = mapVidMemJensen;
|
|
||||||
pVidMem->unmapMem = unmapVidMemJensen;
|
|
||||||
# endif /* JENSEN_SUPPORT */
|
|
||||||
} else if (needSparse) {
|
|
||||||
xf86Msg(X_INFO,"Machine needs sparse mapping\n");
|
xf86Msg(X_INFO,"Machine needs sparse mapping\n");
|
||||||
pVidMem->mapMem = mapVidMemSparse;
|
pVidMem->mapMem = mapVidMemSparse;
|
||||||
pVidMem->unmapMem = unmapVidMemSparse;
|
pVidMem->unmapMem = unmapVidMemSparse;
|
||||||
|
@ -584,24 +568,6 @@ xf86DisableIO(void)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* Don't use these two functions. They can't possibly work. If you actually
|
|
||||||
* need interrupts off for something, you ought to be doing it in the kernel
|
|
||||||
* anyway.
|
|
||||||
*/
|
|
||||||
|
|
||||||
_X_EXPORT Bool
|
|
||||||
xf86DisableInterrupts()
|
|
||||||
{
|
|
||||||
return (TRUE);
|
|
||||||
}
|
|
||||||
|
|
||||||
_X_EXPORT void
|
|
||||||
xf86EnableInterrupts()
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
#if defined (__alpha__)
|
#if defined (__alpha__)
|
||||||
|
|
||||||
#define vuip volatile unsigned int *
|
#define vuip volatile unsigned int *
|
||||||
|
@ -922,175 +888,4 @@ _X_EXPORT int (*xf86ReadMmio16)(pointer Base, unsigned long Offset)
|
||||||
_X_EXPORT int (*xf86ReadMmio32)(pointer Base, unsigned long Offset)
|
_X_EXPORT int (*xf86ReadMmio32)(pointer Base, unsigned long Offset)
|
||||||
= readDense32;
|
= readDense32;
|
||||||
|
|
||||||
#ifdef JENSEN_SUPPORT
|
|
||||||
|
|
||||||
static int
|
|
||||||
readSparseJensen8(pointer Base, register unsigned long Offset);
|
|
||||||
static int
|
|
||||||
readSparseJensen16(pointer Base, register unsigned long Offset);
|
|
||||||
static int
|
|
||||||
readSparseJensen32(pointer Base, register unsigned long Offset);
|
|
||||||
static void
|
|
||||||
writeSparseJensen8(int Value, pointer Base, register unsigned long Offset);
|
|
||||||
static void
|
|
||||||
writeSparseJensen16(int Value, pointer Base, register unsigned long Offset);
|
|
||||||
static void
|
|
||||||
writeSparseJensen32(int Value, pointer Base, register unsigned long Offset);
|
|
||||||
static void
|
|
||||||
writeSparseJensenNB8(int Value, pointer Base, register unsigned long Offset);
|
|
||||||
static void
|
|
||||||
writeSparseJensenNB16(int Value, pointer Base, register unsigned long Offset);
|
|
||||||
static void
|
|
||||||
writeSparseJensenNB32(int Value, pointer Base, register unsigned long Offset);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The Jensen lacks dense memory, thus we have to address the bus via
|
|
||||||
* the sparse addressing scheme.
|
|
||||||
*
|
|
||||||
* Martin Ostermann (ost@comnets.rwth-aachen.de) - Apr.-Sep. 1996
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef TEST_JENSEN_CODE
|
|
||||||
#define SPARSE (5)
|
|
||||||
#else
|
|
||||||
#define SPARSE (7)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define JENSEN_SHIFT(x) ((long)x<<SPARSE)
|
|
||||||
|
|
||||||
static pointer
|
|
||||||
mapVidMemJensen(int ScreenNum, unsigned long Base, unsigned long Size, int flags)
|
|
||||||
{
|
|
||||||
pointer base;
|
|
||||||
int fd, prot;
|
|
||||||
|
|
||||||
xf86WriteMmio8 = writeSparseJensen8;
|
|
||||||
xf86WriteMmio16 = writeSparseJensen16;
|
|
||||||
xf86WriteMmio32 = writeSparseJensen32;
|
|
||||||
xf86WriteMmioNB8 = writeSparseJensenNB8;
|
|
||||||
xf86WriteMmioNB16 = writeSparseJensenNB16;
|
|
||||||
xf86WriteMmioNB32 = writeSparseJensenNB32;
|
|
||||||
xf86ReadMmio8 = readSparseJensen8;
|
|
||||||
xf86ReadMmio16 = readSparseJensen16;
|
|
||||||
xf86ReadMmio32 = readSparseJensen32;
|
|
||||||
|
|
||||||
fd = open(DEV_MEM, (flags & VIDMEM_READONLY) ? O_RDONLY : O_RDWR);
|
|
||||||
if (fd < 0) {
|
|
||||||
FatalError("xf86MapVidMem: failed to open " DEV_MEM " (%s)\n",
|
|
||||||
strerror(errno));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (flags & VIDMEM_READONLY)
|
|
||||||
prot = PROT_READ;
|
|
||||||
else
|
|
||||||
prot = PROT_READ | PROT_WRITE;
|
|
||||||
|
|
||||||
/* This requires linux-0.99.pl10 or above */
|
|
||||||
base = mmap((caddr_t)0, JENSEN_SHIFT(Size),
|
|
||||||
prot, MAP_SHARED, fd,
|
|
||||||
(off_t)(JENSEN_SHIFT((off_t)Base) + _bus_base_sparse()));
|
|
||||||
close(fd);
|
|
||||||
if (base == MAP_FAILED) {
|
|
||||||
FatalError("xf86MapVidMem: Could not mmap framebuffer"
|
|
||||||
" (0x%08x,0x%x) (%s)\n", Base, Size,
|
|
||||||
strerror(errno));
|
|
||||||
}
|
|
||||||
return base;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
unmapVidMemJensen(int ScreenNum, pointer Base, unsigned long Size)
|
|
||||||
{
|
|
||||||
munmap((caddr_t)Base, JENSEN_SHIFT(Size));
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
|
||||||
readSparseJensen8(pointer Base, register unsigned long Offset)
|
|
||||||
{
|
|
||||||
register unsigned long result, shift;
|
|
||||||
|
|
||||||
mem_barrier();
|
|
||||||
shift = (Offset & 0x3) << 3;
|
|
||||||
|
|
||||||
result = *(vuip) ((unsigned long)Base + (Offset << SPARSE));
|
|
||||||
|
|
||||||
result >>= shift;
|
|
||||||
return 0xffUL & result;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
|
||||||
readSparseJensen16(pointer Base, register unsigned long Offset)
|
|
||||||
{
|
|
||||||
register unsigned long result, shift;
|
|
||||||
|
|
||||||
mem_barrier();
|
|
||||||
shift = (Offset & 0x2) << 3;
|
|
||||||
|
|
||||||
result = *(vuip)((unsigned long)Base+(Offset<<SPARSE)+(1<<(SPARSE-2)));
|
|
||||||
|
|
||||||
result >>= shift;
|
|
||||||
return 0xffffUL & result;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
|
||||||
readSparseJensen32(pointer Base, register unsigned long Offset)
|
|
||||||
{
|
|
||||||
register unsigned long result;
|
|
||||||
|
|
||||||
mem_barrier();
|
|
||||||
result = *(vuip)((unsigned long)Base+(Offset<<SPARSE)+(3<<(SPARSE-2)));
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
writeSparseJensen8(int Value, pointer Base, register unsigned long Offset)
|
|
||||||
{
|
|
||||||
register unsigned int b = Value & 0xffU;
|
|
||||||
|
|
||||||
write_mem_barrier();
|
|
||||||
*(vuip) ((unsigned long)Base + (Offset << SPARSE)) = b * 0x01010101;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
writeSparseJensen16(int Value, pointer Base, register unsigned long Offset)
|
|
||||||
{
|
|
||||||
register unsigned int w = Value & 0xffffU;
|
|
||||||
|
|
||||||
write_mem_barrier();
|
|
||||||
*(vuip)((unsigned long)Base+(Offset<<SPARSE)+(1<<(SPARSE-2))) =
|
|
||||||
w * 0x00010001;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
writeSparseJensen32(int Value, pointer Base, register unsigned long Offset)
|
|
||||||
{
|
|
||||||
write_mem_barrier();
|
|
||||||
*(vuip)((unsigned long)Base+(Offset<<SPARSE)+(3<<(SPARSE-2))) = Value;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
writeSparseJensenNB8(int Value, pointer Base, register unsigned long Offset)
|
|
||||||
{
|
|
||||||
register unsigned int b = Value & 0xffU;
|
|
||||||
|
|
||||||
*(vuip) ((unsigned long)Base + (Offset << SPARSE)) = b * 0x01010101;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
writeSparseJensenNB16(int Value, pointer Base, register unsigned long Offset)
|
|
||||||
{
|
|
||||||
register unsigned int w = Value & 0xffffU;
|
|
||||||
|
|
||||||
*(vuip)((unsigned long)Base+(Offset<<SPARSE)+(1<<(SPARSE-2))) =
|
|
||||||
w * 0x00010001;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
writeSparseJensenNB32(int Value, pointer Base, register unsigned long Offset)
|
|
||||||
{
|
|
||||||
*(vuip)((unsigned long)Base+(Offset<<SPARSE)+(3<<(SPARSE-2))) = Value;
|
|
||||||
}
|
|
||||||
#endif /* JENSEN_SUPPORT */
|
|
||||||
|
|
||||||
#endif /* __alpha__ */
|
#endif /* __alpha__ */
|
||||||
|
|
|
@ -26,233 +26,8 @@ Thanks to Linus Torvalds for contributing this code.
|
||||||
|
|
||||||
#include "compiler.h"
|
#include "compiler.h"
|
||||||
|
|
||||||
/*
|
|
||||||
* The Jensen lacks dense memory, thus we have to address the bus via
|
|
||||||
* the sparse addressing scheme. These routines are only used in s3im.c
|
|
||||||
* Non time critical code uses SlowBCopy_{from/to} bus.
|
|
||||||
*
|
|
||||||
* Martin Ostermann (ost@comnets.rwth-aachen.de) - Apr.-Sep. 1996
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef TEST_JENSEN_CODE /* define to test the Sparse addressing on a non-Jensen */
|
|
||||||
#define LWORD_CODING (0x18)
|
|
||||||
#define SPARSE (5)
|
|
||||||
#else
|
|
||||||
#define LWORD_CODING (0x60)
|
#define LWORD_CODING (0x60)
|
||||||
#define SPARSE (7)
|
#define SPARSE (7)
|
||||||
#endif
|
|
||||||
|
|
||||||
void
|
|
||||||
xf86JensenMemToBus(char *Base, long dst, long src, int count)
|
|
||||||
{
|
|
||||||
if( ((long)src^((long)dst)) & 3) {
|
|
||||||
/* src & dst are NOT aligned to each other */
|
|
||||||
unsigned long addr;
|
|
||||||
unsigned long low_word, high_word,last_read;
|
|
||||||
long rm,loop;
|
|
||||||
unsigned long tmp,org,org2,mask,src_org,count_org;
|
|
||||||
|
|
||||||
src_org=src;
|
|
||||||
count_org=count;
|
|
||||||
|
|
||||||
/* add EISA longword coding and round off*/
|
|
||||||
addr = (long)(Base+(dst<<SPARSE) + LWORD_CODING) & ~(3<<SPARSE);
|
|
||||||
rm = (long)dst & 3;
|
|
||||||
count += rm;
|
|
||||||
|
|
||||||
count = count_org + rm;
|
|
||||||
org = *(volatile unsigned int *)addr;
|
|
||||||
__asm__("ldq_u %0,%1"
|
|
||||||
:"=r" (low_word):"m" (*(unsigned long *)(src_org)));
|
|
||||||
src = src_org - rm;
|
|
||||||
if( count > 4 ) {
|
|
||||||
last_read = src_org+count_org - 1;
|
|
||||||
__asm__("ldq_u %0,%1"
|
|
||||||
:"=r" (high_word):"m" (*(unsigned long *)(src+4)));
|
|
||||||
__asm__("extll %1,%2,%0"
|
|
||||||
:"=r" (low_word)
|
|
||||||
:"r" (low_word), "r" ((unsigned long)(src)));
|
|
||||||
__asm__("extlh %1,%2,%0"
|
|
||||||
:"=r" (tmp)
|
|
||||||
:"r" (high_word), "r" ((unsigned long)(src)));
|
|
||||||
tmp |= low_word;
|
|
||||||
src += 4;
|
|
||||||
__asm__("mskqh %1,%2,%0"
|
|
||||||
:"=r" (tmp)
|
|
||||||
:"r" (tmp), "r" (rm));
|
|
||||||
__asm__("mskql %1,%2,%0"
|
|
||||||
:"=r" (org2)
|
|
||||||
:"r" (org), "r" (rm));
|
|
||||||
tmp |= org2;
|
|
||||||
|
|
||||||
loop = (count-4) >> 2; /* loop eqv. count>=4 ; count -= 4 */
|
|
||||||
while (loop) {
|
|
||||||
/* tmp to be stored completly -- need to read next word*/
|
|
||||||
low_word = high_word;
|
|
||||||
*(volatile unsigned int *) (addr) = tmp;
|
|
||||||
__asm__("ldq_u %0,%1"
|
|
||||||
:"=r" (high_word):"m" (*(unsigned long*)(src+4)));
|
|
||||||
loop --;
|
|
||||||
__asm__("extll %1,%2,%0"
|
|
||||||
:"=r" (low_word)
|
|
||||||
:"r" (low_word), "r" ((unsigned long)src));
|
|
||||||
__asm__("extlh %1,%2,%0"
|
|
||||||
:"=r" (tmp)
|
|
||||||
:"r" (high_word), "r" ((unsigned long)src));
|
|
||||||
src += 4;
|
|
||||||
tmp |= low_word;
|
|
||||||
addr += 4<<SPARSE;
|
|
||||||
}
|
|
||||||
if ( count & 3 ) {
|
|
||||||
/* Store tmp completly, and possibly read one more word.*/
|
|
||||||
*(volatile unsigned int *) (addr) = tmp;
|
|
||||||
__asm__("ldq_u %0,%1"
|
|
||||||
:"=r" (tmp):"m" (*((unsigned long *)(last_read)) ));
|
|
||||||
addr += 4<<SPARSE;
|
|
||||||
__asm__("extll %1,%2,%0"
|
|
||||||
:"=r" (low_word)
|
|
||||||
:"r" (high_word), "r" ((unsigned long)src));
|
|
||||||
__asm__("extlh %1,%2,%0"
|
|
||||||
:"=r" (tmp)
|
|
||||||
:"r" (tmp), "r" ((unsigned long)src));
|
|
||||||
tmp |= low_word;
|
|
||||||
org = *(volatile unsigned int *)addr;
|
|
||||||
|
|
||||||
__asm__("mskql %1,%2,%0"
|
|
||||||
:"=r" (tmp)
|
|
||||||
:"r" (tmp), "r" (count&3));
|
|
||||||
__asm__("mskqh %1,%2,%0"
|
|
||||||
:"=r" (org)
|
|
||||||
:"r" (org), "r" (count&3));
|
|
||||||
|
|
||||||
tmp |= org;
|
|
||||||
}
|
|
||||||
*(volatile unsigned int *) (addr) = tmp;
|
|
||||||
return;
|
|
||||||
} else { /* count > 4 */
|
|
||||||
__asm__("ldq_u %0,%1"
|
|
||||||
:"=r" (high_word):"m" (*(unsigned long *)(src+4)));
|
|
||||||
__asm__("extll %1,%2,%0"
|
|
||||||
:"=r" (low_word)
|
|
||||||
:"r" (low_word), "r" ((unsigned long)(src)));
|
|
||||||
__asm__("extlh %1,%2,%0"
|
|
||||||
:"=r" (tmp)
|
|
||||||
:"r" (high_word), "r" ((unsigned long)(src)));
|
|
||||||
tmp |= low_word;
|
|
||||||
if( count < 4 ) {
|
|
||||||
|
|
||||||
mask = -1;
|
|
||||||
__asm__("mskqh %1,%2,%0"
|
|
||||||
:"=r" (mask)
|
|
||||||
:"r" (mask), "r" (rm));
|
|
||||||
__asm__("mskql %1,%2,%0"
|
|
||||||
:"=r" (mask)
|
|
||||||
:"r" (mask), "r" (count));
|
|
||||||
tmp = (tmp & mask) | (org & ~mask);
|
|
||||||
*(volatile unsigned int *) (addr) = tmp;
|
|
||||||
return;
|
|
||||||
} else {
|
|
||||||
__asm__("mskqh %1,%2,%0"
|
|
||||||
:"=r" (tmp)
|
|
||||||
:"r" (tmp), "r" (rm));
|
|
||||||
__asm__("mskql %1,%2,%0"
|
|
||||||
:"=r" (org2)
|
|
||||||
:"r" (org), "r" (rm));
|
|
||||||
|
|
||||||
tmp |= org2;
|
|
||||||
*(volatile unsigned int *) (addr) = tmp;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else { /* src & dst are aligned to each other */
|
|
||||||
unsigned long addr;
|
|
||||||
unsigned int tmp,org,rm;
|
|
||||||
unsigned int *src_r;
|
|
||||||
|
|
||||||
/* add EISA longword coding and round off*/
|
|
||||||
addr = (long)(Base+(dst<<SPARSE) + LWORD_CODING) & ~(3<<SPARSE);
|
|
||||||
|
|
||||||
src_r = (unsigned int*)((long)src & ~3L);
|
|
||||||
rm=(long)src & 3;
|
|
||||||
count += rm;
|
|
||||||
|
|
||||||
tmp = *src_r;
|
|
||||||
org = *(volatile unsigned int *)addr;
|
|
||||||
|
|
||||||
__asm__("mskqh %1,%2,%0"
|
|
||||||
:"=r" (tmp)
|
|
||||||
:"r" (tmp), "r" (rm));
|
|
||||||
__asm__("mskql %1,%2,%0"
|
|
||||||
:"=r" (org)
|
|
||||||
:"r" (org), "r" (rm));
|
|
||||||
|
|
||||||
tmp |= org;
|
|
||||||
|
|
||||||
while (count > 4) {
|
|
||||||
*(volatile unsigned int *) addr = tmp;
|
|
||||||
addr += 4<<SPARSE;
|
|
||||||
src_r += 1;
|
|
||||||
tmp = *src_r;
|
|
||||||
count -= 4;
|
|
||||||
}
|
|
||||||
|
|
||||||
org = *(volatile unsigned int *)addr;
|
|
||||||
__asm__("mskql %1,%2,%0"
|
|
||||||
:"=r" (tmp)
|
|
||||||
:"r" (tmp), "r" (count));
|
|
||||||
__asm__("mskqh %1,%2,%0"
|
|
||||||
:"=r" (org)
|
|
||||||
:"r" (org), "r" (count));
|
|
||||||
tmp |= org;
|
|
||||||
*(volatile unsigned int *) (addr) = tmp;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
xf86JensenBusToMem(char *Base, char *dst, unsigned long src, int count)
|
|
||||||
{
|
|
||||||
#if 0
|
|
||||||
/* Optimization of BusToMem() is left as an exercise to the reader ;-)
|
|
||||||
* Consider that ldq_u/extlh/extll won't work because of the bus being
|
|
||||||
* only 4 bytes wide!
|
|
||||||
*/
|
|
||||||
#else
|
|
||||||
unsigned long addr;
|
|
||||||
long result;
|
|
||||||
|
|
||||||
addr = (unsigned long)(Base+(src<<SPARSE)) ;
|
|
||||||
while( addr & (3<<SPARSE) ){
|
|
||||||
if(count <= 0) return;
|
|
||||||
result = *(volatile int *) addr;
|
|
||||||
result >>= ((addr>>SPARSE) & 3) * 8;
|
|
||||||
*dst++ = (char) result;
|
|
||||||
addr += 1<<SPARSE;
|
|
||||||
count--;
|
|
||||||
}
|
|
||||||
count -=4;
|
|
||||||
while(count >= 0){
|
|
||||||
int i;
|
|
||||||
|
|
||||||
result = *(volatile int *) (addr+LWORD_CODING);
|
|
||||||
for(i=4;i--;) {
|
|
||||||
*dst++ = (char) result;
|
|
||||||
result >>= 8;
|
|
||||||
}
|
|
||||||
addr += 4<<SPARSE;
|
|
||||||
count -= 4;
|
|
||||||
}
|
|
||||||
count +=4;
|
|
||||||
|
|
||||||
while( count ){
|
|
||||||
result = *(volatile int *) addr;
|
|
||||||
result >>= ((addr>>SPARSE) & 3) * 8;
|
|
||||||
*dst++ = (char) result;
|
|
||||||
addr += 1<<SPARSE;
|
|
||||||
count--;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static unsigned long __memcpy(unsigned long dest, unsigned long src, int n);
|
static unsigned long __memcpy(unsigned long dest, unsigned long src, int n);
|
||||||
|
|
||||||
|
|
|
@ -1,24 +0,0 @@
|
||||||
/*******************************************************************************
|
|
||||||
Stub for Alpha Linux
|
|
||||||
*******************************************************************************/
|
|
||||||
|
|
||||||
#ifdef HAVE_XORG_CONFIG_H
|
|
||||||
#include <xorg-config.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <X11/X.h>
|
|
||||||
#include "xf86.h"
|
|
||||||
#include "xf86Priv.h"
|
|
||||||
#include "xf86_OSlib.h"
|
|
||||||
|
|
||||||
/*
|
|
||||||
* All we really need is a delay of about 40ns for I/O recovery for just
|
|
||||||
* about any occasion, but we'll be more conservative here: On a
|
|
||||||
* 100-MHz CPU, produce at least a delay of 1,000ns.
|
|
||||||
*/
|
|
||||||
_X_EXPORT void
|
|
||||||
xf86IODelay()
|
|
||||||
{
|
|
||||||
xf86UDelay(1);
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
|
|
||||||
noinst_LTLIBRARIES = libmisc.la
|
noinst_LTLIBRARIES = libmisc.la
|
||||||
|
|
||||||
libmisc_la_SOURCES = Delay.c BUSmemcpy.c IODelay.c SlowBcopy.c
|
libmisc_la_SOURCES = Delay.c BUSmemcpy.c SlowBcopy.c
|
||||||
|
|
||||||
#AM_LDFLAGS = -r
|
#AM_LDFLAGS = -r
|
||||||
|
|
||||||
|
|
|
@ -56,29 +56,13 @@ xf86SlowBcopy(unsigned char *src, unsigned char *dst, int len)
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __alpha__
|
#ifdef __alpha__
|
||||||
/*
|
|
||||||
* The Jensen lacks dense memory, thus we have to address the bus via
|
|
||||||
* the sparse addressing scheme. Time critical code uses routines from
|
|
||||||
* BUSmemcpy.c
|
|
||||||
*
|
|
||||||
* Martin Ostermann (ost@comnets.rwth-aachen.de) - Apr.-Sep. 1996
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef linux
|
#ifdef linux
|
||||||
|
|
||||||
unsigned long _bus_base(void);
|
|
||||||
|
|
||||||
#ifdef TEST_JENSEN_CODE /* define to test the Sparse addressing on a non-Jensen */
|
|
||||||
#define SPARSE (5)
|
|
||||||
#else
|
|
||||||
#define SPARSE (7)
|
#define SPARSE (7)
|
||||||
#endif
|
|
||||||
|
|
||||||
#define isJensen() (!_bus_base())
|
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
#define isJensen() 0
|
|
||||||
#define SPARSE 0
|
#define SPARSE 0
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -86,42 +70,32 @@ unsigned long _bus_base(void);
|
||||||
_X_EXPORT void
|
_X_EXPORT void
|
||||||
xf86SlowBCopyFromBus(unsigned char *src, unsigned char *dst, int count)
|
xf86SlowBCopyFromBus(unsigned char *src, unsigned char *dst, int count)
|
||||||
{
|
{
|
||||||
if (isJensen())
|
unsigned long addr;
|
||||||
{
|
long result;
|
||||||
unsigned long addr;
|
|
||||||
long result;
|
|
||||||
|
|
||||||
addr = (unsigned long) src;
|
addr = (unsigned long) src;
|
||||||
while( count ){
|
while( count ){
|
||||||
result = *(volatile int *) addr;
|
result = *(volatile int *) addr;
|
||||||
result >>= ((addr>>SPARSE) & 3) * 8;
|
result >>= ((addr>>SPARSE) & 3) * 8;
|
||||||
*dst++ = (unsigned char) (0xffUL & result);
|
*dst++ = (unsigned char) (0xffUL & result);
|
||||||
addr += 1<<SPARSE;
|
addr += 1<<SPARSE;
|
||||||
count--;
|
count--;
|
||||||
outb(0x80, 0x00);
|
outb(0x80, 0x00);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
|
||||||
xf86SlowBcopy(src,dst,count);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_X_EXPORT void
|
_X_EXPORT void
|
||||||
xf86SlowBCopyToBus(unsigned char *src, unsigned char *dst, int count)
|
xf86SlowBCopyToBus(unsigned char *src, unsigned char *dst, int count)
|
||||||
{
|
{
|
||||||
if (isJensen())
|
unsigned long addr;
|
||||||
{
|
|
||||||
unsigned long addr;
|
|
||||||
|
|
||||||
addr = (unsigned long) dst;
|
addr = (unsigned long) dst;
|
||||||
while(count) {
|
while(count) {
|
||||||
*(volatile unsigned int *) addr = (unsigned short)(*src) * 0x01010101;
|
*(volatile unsigned int *) addr = (unsigned short)(*src) * 0x01010101;
|
||||||
src++;
|
src++;
|
||||||
addr += 1<<SPARSE;
|
addr += 1<<SPARSE;
|
||||||
count--;
|
count--;
|
||||||
outb(0x80, 0x00);
|
outb(0x80, 0x00);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
|
||||||
xf86SlowBcopy(src,dst,count);
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -88,47 +88,3 @@ xf86DisableIO(void)
|
||||||
sysi86(SI86V86, V86SC_IOPL, 0);
|
sysi86(SI86V86, V86SC_IOPL, 0);
|
||||||
IOEnabled = FALSE;
|
IOEnabled = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/***************************************************************************/
|
|
||||||
/* Interrupt Handling section */
|
|
||||||
/***************************************************************************/
|
|
||||||
|
|
||||||
_X_EXPORT Bool
|
|
||||||
xf86DisableInterrupts(void)
|
|
||||||
{
|
|
||||||
if (!IOEnabled) {
|
|
||||||
if (sysi86(SI86V86, V86SC_IOPL, PS_IOPL) < 0)
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef __GNUC__
|
|
||||||
__asm__ __volatile__("cli");
|
|
||||||
#else
|
|
||||||
asm("cli");
|
|
||||||
#endif /* __GNUC__ */
|
|
||||||
|
|
||||||
if (!IOEnabled) {
|
|
||||||
sysi86(SI86V86, V86SC_IOPL, PS_IOPL);
|
|
||||||
}
|
|
||||||
|
|
||||||
return(TRUE);
|
|
||||||
}
|
|
||||||
|
|
||||||
_X_EXPORT void
|
|
||||||
xf86EnableInterrupts(void)
|
|
||||||
{
|
|
||||||
if (!IOEnabled) {
|
|
||||||
if (sysi86(SI86V86, V86SC_IOPL, PS_IOPL) < 0)
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef __GNUC__
|
|
||||||
__asm__ __volatile__("sti");
|
|
||||||
#else
|
|
||||||
asm("sti");
|
|
||||||
#endif /* __GNUC__ */
|
|
||||||
|
|
||||||
if (!IOEnabled) {
|
|
||||||
sysi86(SI86V86, V86SC_IOPL, PS_IOPL);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -91,33 +91,15 @@ xf86ReadBIOS(unsigned long Base, unsigned long Offset, unsigned char *Buf,
|
||||||
* re: boundaries and sizes and such...
|
* re: boundaries and sizes and such...
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
|
||||||
* The Jensen lacks dense memory, thus we have to address the bus via
|
|
||||||
* the sparse addressing scheme.
|
|
||||||
*
|
|
||||||
* Martin Ostermann (ost@comnets.rwth-aachen.de) - Apr.-Sep. 1996
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef linux
|
#ifdef linux
|
||||||
|
|
||||||
#ifdef TEST_JENSEN_CODE /* define to test the Sparse addressing on a non-Jensen */
|
|
||||||
#define SPARSE (5)
|
|
||||||
#define isJensen (1)
|
|
||||||
#else
|
|
||||||
#define isJensen (!_bus_base())
|
|
||||||
#define SPARSE (7)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
extern unsigned long _bus_base(void);
|
extern unsigned long _bus_base(void);
|
||||||
extern unsigned long _bus_base_sparse(void);
|
#define BUS_BASE _bus_base()
|
||||||
#define BUS_BASE (isJensen ? _bus_base_sparse() : _bus_base())
|
|
||||||
#define JENSEN_SHIFT(x) (isJensen ? ((long)x<<SPARSE) : (long)x)
|
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
extern u_int64_t dense_base(void);
|
extern u_int64_t dense_base(void);
|
||||||
#define BUS_BASE dense_base()
|
#define BUS_BASE dense_base()
|
||||||
#define JENSEN_SHIFT(x) ((long) x)
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -141,8 +123,8 @@ xf86ReadBIOS(unsigned long Base, unsigned long Offset, unsigned char *Buf,
|
||||||
Offset += Base & (psize - 1);
|
Offset += Base & (psize - 1);
|
||||||
Base &= ~(psize - 1);
|
Base &= ~(psize - 1);
|
||||||
mlen = (Offset + Len + psize - 1) & ~(psize - 1);
|
mlen = (Offset + Len + psize - 1) & ~(psize - 1);
|
||||||
base = mmap((caddr_t)0, JENSEN_SHIFT(mlen), PROT_READ,
|
base = mmap((caddr_t)0, mlen, PROT_READ,
|
||||||
MAP_SHARED, fd, (off_t)(JENSEN_SHIFT(Base) + BUS_BASE));
|
MAP_SHARED, fd, (off_t)(Base + BUS_BASE));
|
||||||
|
|
||||||
if (base == MAP_FAILED)
|
if (base == MAP_FAILED)
|
||||||
{
|
{
|
||||||
|
@ -151,10 +133,9 @@ xf86ReadBIOS(unsigned long Base, unsigned long Offset, unsigned char *Buf,
|
||||||
return(-1);
|
return(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
xf86SlowBCopyFromBus((unsigned char *)(base+JENSEN_SHIFT(Offset)),
|
xf86SlowBCopyFromBus((unsigned char *)(base+Offset), Buf, Len);
|
||||||
Buf, Len);
|
|
||||||
|
|
||||||
munmap((caddr_t)JENSEN_SHIFT(base), JENSEN_SHIFT(mlen));
|
munmap((caddr_t)base, mlen);
|
||||||
close(fd);
|
close(fd);
|
||||||
return(Len);
|
return(Len);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,46 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright 2004, Egbert Eich
|
|
||||||
*
|
|
||||||
* 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
|
|
||||||
* EGBERT EICH BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
|
||||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CON-
|
|
||||||
* NECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
*
|
|
||||||
* Except as contained in this notice, the name of Egbert Eich shall not
|
|
||||||
* be used in advertising or otherwise to promote the sale, use or other deal-
|
|
||||||
*ings in this Software without prior written authorization from Egbert Eich.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
#ifdef HAVE_XORG_CONFIG_H
|
|
||||||
#include <xorg-config.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef _IA64_PCI_H
|
|
||||||
# define _IA64_PCI_H
|
|
||||||
|
|
||||||
#include "Pci.h"
|
|
||||||
|
|
||||||
typedef enum {
|
|
||||||
NONE_CHIPSET,
|
|
||||||
I460GX_CHIPSET,
|
|
||||||
E8870_CHIPSET,
|
|
||||||
ZX1_CHIPSET,
|
|
||||||
ALTIX_CHIPSET
|
|
||||||
} IA64Chipset;
|
|
||||||
|
|
||||||
# ifdef OS_PROBE_PCI_CHIPSET
|
|
||||||
extern IA64Chipset OS_PROBE_PCI_CHIPSET(scanpciWrapperOpt flags);
|
|
||||||
# endif
|
|
||||||
#endif
|
|
|
@ -77,9 +77,6 @@ xf86StdAccResFromOS(resPtr ret)
|
||||||
ret = xf86AddResToList(ret, &range, -1);
|
ret = xf86AddResToList(ret, &range, -1);
|
||||||
RANGE(range, 0x000f0000, 0x000fffff, ResExcMemBlock);
|
RANGE(range, 0x000f0000, 0x000fffff, ResExcMemBlock);
|
||||||
ret = xf86AddResToList(ret, &range, -1);
|
ret = xf86AddResToList(ret, &range, -1);
|
||||||
RANGE(range, 0x00100000, 0x3fffffff,
|
|
||||||
ResExcMemBlock | ResBios | ResEstimated);
|
|
||||||
ret = xf86AddResToList(ret, &range, -1);
|
|
||||||
#if 0
|
#if 0
|
||||||
RANGE(range, 0xfec00000, 0xfecfffff, ResExcMemBlock | ResBios);
|
RANGE(range, 0xfec00000, 0xfecfffff, ResExcMemBlock | ResBios);
|
||||||
ret = xf86AddResToList(ret, &range, -1);
|
ret = xf86AddResToList(ret, &range, -1);
|
||||||
|
|
|
@ -49,8 +49,9 @@ static char fb_dev[PATH_MAX] = "/dev/console";
|
||||||
void
|
void
|
||||||
xf86OpenConsole(void)
|
xf86OpenConsole(void)
|
||||||
{
|
{
|
||||||
|
int i;
|
||||||
#ifdef HAS_USL_VTS
|
#ifdef HAS_USL_VTS
|
||||||
int fd, i;
|
int fd;
|
||||||
struct vt_mode VT;
|
struct vt_mode VT;
|
||||||
struct vt_stat vtinfo;
|
struct vt_stat vtinfo;
|
||||||
int FreeVTslot;
|
int FreeVTslot;
|
||||||
|
@ -173,9 +174,14 @@ xf86OpenConsole(void)
|
||||||
if (ioctl(xf86Info.consoleFd, VT_SETMODE, &VT) < 0)
|
if (ioctl(xf86Info.consoleFd, VT_SETMODE, &VT) < 0)
|
||||||
FatalError("xf86OpenConsole: VT_SETMODE VT_PROCESS failed\n");
|
FatalError("xf86OpenConsole: VT_SETMODE VT_PROCESS failed\n");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef KDSETMODE
|
#ifdef KDSETMODE
|
||||||
if (ioctl(xf86Info.consoleFd, KDSETMODE, KD_GRAPHICS) < 0)
|
SYSCALL(i = ioctl(xf86Info.consoleFd, KDSETMODE, KD_GRAPHICS));
|
||||||
FatalError("xf86OpenConsole: KDSETMODE KD_GRAPHICS failed\n");
|
if (i < 0) {
|
||||||
|
xf86Msg(X_WARNING,
|
||||||
|
"xf86OpenConsole: KDSETMODE KD_GRAPHICS failed on %s (%s)\n",
|
||||||
|
fb_dev, strerror(errno));
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else /* serverGeneration != 1 */
|
else /* serverGeneration != 1 */
|
||||||
|
@ -257,7 +263,7 @@ xf86CloseConsole(void)
|
||||||
|
|
||||||
#ifdef KDSETMODE
|
#ifdef KDSETMODE
|
||||||
/* Reset the display back to text mode */
|
/* Reset the display back to text mode */
|
||||||
ioctl(xf86Info.consoleFd, KDSETMODE, KD_TEXT);
|
SYSCALL(ioctl(xf86Info.consoleFd, KDSETMODE, KD_TEXT));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAS_USL_VTS
|
#ifdef HAS_USL_VTS
|
||||||
|
|
|
@ -263,46 +263,3 @@ xf86DisableIO(void)
|
||||||
ExtendedEnabled = FALSE;
|
ExtendedEnabled = FALSE;
|
||||||
#endif /* i386 */
|
#endif /* i386 */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************************/
|
|
||||||
/* Interrupt Handling section */
|
|
||||||
/***************************************************************************/
|
|
||||||
|
|
||||||
_X_EXPORT Bool
|
|
||||||
xf86DisableInterrupts(void)
|
|
||||||
{
|
|
||||||
#if defined(__i386__) || defined(__i386) || defined(__x86)
|
|
||||||
if (!ExtendedEnabled && (sysi86(SI86V86, V86SC_IOPL, PS_IOPL) < 0))
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
#ifdef __GNUC__
|
|
||||||
__asm__ __volatile__("cli");
|
|
||||||
#else
|
|
||||||
asm("cli");
|
|
||||||
#endif /* __GNUC__ */
|
|
||||||
|
|
||||||
if (!ExtendedEnabled)
|
|
||||||
sysi86(SI86V86, V86SC_IOPL, 0);
|
|
||||||
#endif /* i386 */
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
_X_EXPORT void
|
|
||||||
xf86EnableInterrupts(void)
|
|
||||||
{
|
|
||||||
#if defined(__i386__) || defined(__i386) || defined(__x86)
|
|
||||||
if (!ExtendedEnabled && (sysi86(SI86V86, V86SC_IOPL, PS_IOPL) < 0))
|
|
||||||
return;
|
|
||||||
|
|
||||||
#ifdef __GNUC__
|
|
||||||
__asm__ __volatile__("sti");
|
|
||||||
#else
|
|
||||||
asm("sti");
|
|
||||||
#endif /* __GNUC__ */
|
|
||||||
|
|
||||||
if (!ExtendedEnabled)
|
|
||||||
sysi86(SI86V86, V86SC_IOPL, 0);
|
|
||||||
#endif /* i386 */
|
|
||||||
}
|
|
||||||
|
|
|
@ -313,55 +313,3 @@ xf86DisableIO()
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/***************************************************************************/
|
|
||||||
/* Interrupt Handling section */
|
|
||||||
/***************************************************************************/
|
|
||||||
|
|
||||||
_X_EXPORT Bool
|
|
||||||
xf86DisableInterrupts()
|
|
||||||
{
|
|
||||||
if (!ExtendedEnabled)
|
|
||||||
{
|
|
||||||
if (SET_IOPL() < 0)
|
|
||||||
{
|
|
||||||
return(FALSE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef __GNUC__
|
|
||||||
__asm__ __volatile__("cli");
|
|
||||||
#else
|
|
||||||
asm("cli");
|
|
||||||
#endif /* __GNUC__ */
|
|
||||||
|
|
||||||
if (!ExtendedEnabled)
|
|
||||||
{
|
|
||||||
RESET_IOPL();
|
|
||||||
}
|
|
||||||
return(TRUE);
|
|
||||||
}
|
|
||||||
|
|
||||||
_X_EXPORT void
|
|
||||||
xf86EnableInterrupts()
|
|
||||||
{
|
|
||||||
if (!ExtendedEnabled)
|
|
||||||
{
|
|
||||||
if (SET_IOPL() < 0)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef __GNUC__
|
|
||||||
__asm__ __volatile__("sti");
|
|
||||||
#else
|
|
||||||
asm("sti");
|
|
||||||
#endif /* __GNUC__ */
|
|
||||||
|
|
||||||
if (!ExtendedEnabled)
|
|
||||||
{
|
|
||||||
RESET_IOPL();
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
|
@ -146,14 +146,11 @@ extern void xf86MapReadSideEffects(int, int, pointer, unsigned long);
|
||||||
extern int xf86ReadBIOS(unsigned long, unsigned long, unsigned char *, int);
|
extern int xf86ReadBIOS(unsigned long, unsigned long, unsigned char *, int);
|
||||||
extern Bool xf86EnableIO(void);
|
extern Bool xf86EnableIO(void);
|
||||||
extern void xf86DisableIO(void);
|
extern void xf86DisableIO(void);
|
||||||
extern Bool xf86DisableInterrupts(void);
|
|
||||||
extern void xf86EnableInterrupts(void);
|
|
||||||
extern void xf86SetTVOut(int);
|
extern void xf86SetTVOut(int);
|
||||||
extern void xf86SetRGBOut(void);
|
extern void xf86SetRGBOut(void);
|
||||||
extern void xf86OSRingBell(int, int, int);
|
extern void xf86OSRingBell(int, int, int);
|
||||||
extern void xf86BusToMem(unsigned char *, unsigned char *, int);
|
extern void xf86BusToMem(unsigned char *, unsigned char *, int);
|
||||||
extern void xf86MemToBus(unsigned char *, unsigned char *, int);
|
extern void xf86MemToBus(unsigned char *, unsigned char *, int);
|
||||||
extern void xf86IODelay(void);
|
|
||||||
extern void xf86UDelay(long usec);
|
extern void xf86UDelay(long usec);
|
||||||
extern void xf86SetReallySlowBcopy(void);
|
extern void xf86SetReallySlowBcopy(void);
|
||||||
extern void xf86SlowBcopy(unsigned char *, unsigned char *, int);
|
extern void xf86SlowBcopy(unsigned char *, unsigned char *, int);
|
||||||
|
|
|
@ -1108,7 +1108,7 @@ VBEReadPanelID(vbeInfoPtr pVbe)
|
||||||
{
|
{
|
||||||
int RealOff = pVbe->real_mode_base;
|
int RealOff = pVbe->real_mode_base;
|
||||||
pointer page = pVbe->memory;
|
pointer page = pVbe->memory;
|
||||||
unsigned char *tmp = NULL;
|
void *tmp = NULL;
|
||||||
int screen = pVbe->pInt10->scrnIndex;
|
int screen = pVbe->pInt10->scrnIndex;
|
||||||
|
|
||||||
pVbe->pInt10->ax = 0x4F11;
|
pVbe->pInt10->ax = 0x4F11;
|
||||||
|
@ -1129,8 +1129,8 @@ VBEReadPanelID(vbeInfoPtr pVbe)
|
||||||
switch (pVbe->pInt10->ax & 0xff00) {
|
switch (pVbe->pInt10->ax & 0xff00) {
|
||||||
case 0x0:
|
case 0x0:
|
||||||
xf86DrvMsgVerb(screen,X_INFO,3,"VESA VBE PanelID read successfully\n");
|
xf86DrvMsgVerb(screen,X_INFO,3,"VESA VBE PanelID read successfully\n");
|
||||||
tmp = (unsigned char *)xnfalloc(32);
|
tmp = xnfalloc(32);
|
||||||
memcpy(tmp,page,32);
|
memcpy(tmp, page, 32);
|
||||||
break;
|
break;
|
||||||
case 0x100:
|
case 0x100:
|
||||||
xf86DrvMsgVerb(screen,X_INFO,3,"VESA VBE PanelID read failed\n");
|
xf86DrvMsgVerb(screen,X_INFO,3,"VESA VBE PanelID read failed\n");
|
||||||
|
|
|
@ -16,8 +16,6 @@
|
||||||
#include "xf86fbman.h"
|
#include "xf86fbman.h"
|
||||||
#include "servermd.h"
|
#include "servermd.h"
|
||||||
|
|
||||||
static const OptionInfoRec *XAAAvailableOptions(void *unused);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* XAA Config options
|
* XAA Config options
|
||||||
*/
|
*/
|
||||||
|
@ -111,13 +109,6 @@ static XF86ModuleVersionInfo xaaVersRec =
|
||||||
|
|
||||||
_X_EXPORT XF86ModuleData xaaModuleData = { &xaaVersRec, NULL, NULL };
|
_X_EXPORT XF86ModuleData xaaModuleData = { &xaaVersRec, NULL, NULL };
|
||||||
|
|
||||||
/*ARGSUSED*/
|
|
||||||
static const OptionInfoRec *
|
|
||||||
XAAAvailableOptions(void *unused)
|
|
||||||
{
|
|
||||||
return (XAAOptions);
|
|
||||||
}
|
|
||||||
|
|
||||||
Bool
|
Bool
|
||||||
XAAInitAccel(ScreenPtr pScreen, XAAInfoRecPtr infoRec)
|
XAAInitAccel(ScreenPtr pScreen, XAAInfoRecPtr infoRec)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1051,6 +1051,10 @@ StippleScanlineProcPtr *XAAGetStippleScanlineFuncMSBFirstFixedBase(void);
|
||||||
StippleScanlineProcPtr *XAAGetStippleScanlineFuncMSBFirst(void);
|
StippleScanlineProcPtr *XAAGetStippleScanlineFuncMSBFirst(void);
|
||||||
StippleScanlineProcPtr *XAAGetStippleScanlineFuncLSBFirstFixedBase(void);
|
StippleScanlineProcPtr *XAAGetStippleScanlineFuncLSBFirstFixedBase(void);
|
||||||
StippleScanlineProcPtr *XAAGetStippleScanlineFuncLSBFirst(void);
|
StippleScanlineProcPtr *XAAGetStippleScanlineFuncLSBFirst(void);
|
||||||
|
StippleScanlineProcPtr *XAAGetStippleScanlineFunc3MSBFirstFixedBase(void);
|
||||||
|
StippleScanlineProcPtr *XAAGetStippleScanlineFunc3MSBFirst(void);
|
||||||
|
StippleScanlineProcPtr *XAAGetStippleScanlineFunc3LSBFirstFixedBase(void);
|
||||||
|
StippleScanlineProcPtr *XAAGetStippleScanlineFunc3LSBFirst(void);
|
||||||
|
|
||||||
int
|
int
|
||||||
XAAPolyText8TEColorExpansion(
|
XAAPolyText8TEColorExpansion(
|
||||||
|
|
|
@ -90,7 +90,7 @@ xnestPixmapToRegion(PixmapPtr pPixmap)
|
||||||
register RegionPtr pReg, pTmpReg;
|
register RegionPtr pReg, pTmpReg;
|
||||||
register int x, y;
|
register int x, y;
|
||||||
unsigned long previousPixel, currentPixel;
|
unsigned long previousPixel, currentPixel;
|
||||||
BoxRec Box;
|
BoxRec Box = { 0, 0, 0, 0 };
|
||||||
Bool overlap;
|
Bool overlap;
|
||||||
|
|
||||||
ximage = XGetImage(xnestDisplay, xnestPixmap(pPixmap), 0, 0,
|
ximage = XGetImage(xnestDisplay, xnestPixmap(pPixmap), 0, 0,
|
||||||
|
|
|
@ -75,8 +75,6 @@ void X11ApplicationMain(int argc, char **argv, char **envp);
|
||||||
extern int X11EnableKeyEquivalents;
|
extern int X11EnableKeyEquivalents;
|
||||||
extern int quartzHasRoot, quartzEnableRootless, quartzFullscreenMenu;
|
extern int quartzHasRoot, quartzEnableRootless, quartzFullscreenMenu;
|
||||||
|
|
||||||
#define APP_PREFS "org.x.X11"
|
|
||||||
|
|
||||||
#define PREFS_APPSMENU "apps_menu"
|
#define PREFS_APPSMENU "apps_menu"
|
||||||
#define PREFS_FAKEBUTTONS "enable_fake_buttons"
|
#define PREFS_FAKEBUTTONS "enable_fake_buttons"
|
||||||
#define PREFS_SYSBEEP "enable_system_beep"
|
#define PREFS_SYSBEEP "enable_system_beep"
|
||||||
|
|
|
@ -76,6 +76,8 @@ extern int darwinFakeButtons;
|
||||||
|
|
||||||
X11Application *X11App;
|
X11Application *X11App;
|
||||||
|
|
||||||
|
CFStringRef app_prefs_domain_cfstr = NULL;
|
||||||
|
|
||||||
#define ALL_KEY_MASKS (NSShiftKeyMask | NSControlKeyMask | NSAlternateKeyMask | NSCommandKeyMask)
|
#define ALL_KEY_MASKS (NSShiftKeyMask | NSControlKeyMask | NSAlternateKeyMask | NSCommandKeyMask)
|
||||||
|
|
||||||
@interface X11Application (Private)
|
@interface X11Application (Private)
|
||||||
|
@ -466,7 +468,7 @@ static NSMutableArray * cfarray_to_nsarray (CFArrayRef in) {
|
||||||
- (CFPropertyListRef) prefs_get:(NSString *)key {
|
- (CFPropertyListRef) prefs_get:(NSString *)key {
|
||||||
CFPropertyListRef value;
|
CFPropertyListRef value;
|
||||||
|
|
||||||
value = CFPreferencesCopyAppValue ((CFStringRef) key, CFSTR (APP_PREFS));
|
value = CFPreferencesCopyAppValue ((CFStringRef) key, app_prefs_domain_cfstr);
|
||||||
|
|
||||||
if (value == NULL) {
|
if (value == NULL) {
|
||||||
static CFDictionaryRef defaults;
|
static CFDictionaryRef defaults;
|
||||||
|
@ -618,7 +620,7 @@ static NSMutableArray * cfarray_to_nsarray (CFArrayRef in) {
|
||||||
|
|
||||||
x = CFNumberCreate (NULL, kCFNumberIntType, &value);
|
x = CFNumberCreate (NULL, kCFNumberIntType, &value);
|
||||||
|
|
||||||
CFPreferencesSetValue ((CFStringRef) key, (CFTypeRef) x, CFSTR (APP_PREFS),
|
CFPreferencesSetValue ((CFStringRef) key, (CFTypeRef) x, app_prefs_domain_cfstr,
|
||||||
kCFPreferencesCurrentUser, kCFPreferencesAnyHost);
|
kCFPreferencesCurrentUser, kCFPreferencesAnyHost);
|
||||||
|
|
||||||
CFRelease (x);
|
CFRelease (x);
|
||||||
|
@ -629,7 +631,7 @@ static NSMutableArray * cfarray_to_nsarray (CFArrayRef in) {
|
||||||
|
|
||||||
x = CFNumberCreate (NULL, kCFNumberFloatType, &value);
|
x = CFNumberCreate (NULL, kCFNumberFloatType, &value);
|
||||||
|
|
||||||
CFPreferencesSetValue ((CFStringRef) key, (CFTypeRef) x, CFSTR (APP_PREFS),
|
CFPreferencesSetValue ((CFStringRef) key, (CFTypeRef) x, app_prefs_domain_cfstr,
|
||||||
kCFPreferencesCurrentUser, kCFPreferencesAnyHost);
|
kCFPreferencesCurrentUser, kCFPreferencesAnyHost);
|
||||||
|
|
||||||
CFRelease (x);
|
CFRelease (x);
|
||||||
|
@ -638,7 +640,7 @@ static NSMutableArray * cfarray_to_nsarray (CFArrayRef in) {
|
||||||
- (void) prefs_set_boolean:(NSString *)key value:(int)value {
|
- (void) prefs_set_boolean:(NSString *)key value:(int)value {
|
||||||
CFPreferencesSetValue ((CFStringRef) key,
|
CFPreferencesSetValue ((CFStringRef) key,
|
||||||
(CFTypeRef) (value ? kCFBooleanTrue
|
(CFTypeRef) (value ? kCFBooleanTrue
|
||||||
: kCFBooleanFalse), CFSTR (APP_PREFS),
|
: kCFBooleanFalse), app_prefs_domain_cfstr,
|
||||||
kCFPreferencesCurrentUser, kCFPreferencesAnyHost);
|
kCFPreferencesCurrentUser, kCFPreferencesAnyHost);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -649,14 +651,14 @@ static NSMutableArray * cfarray_to_nsarray (CFArrayRef in) {
|
||||||
cfarray = nsarray_to_cfarray (value);
|
cfarray = nsarray_to_cfarray (value);
|
||||||
CFPreferencesSetValue ((CFStringRef) key,
|
CFPreferencesSetValue ((CFStringRef) key,
|
||||||
(CFTypeRef) cfarray,
|
(CFTypeRef) cfarray,
|
||||||
CFSTR (APP_PREFS),
|
app_prefs_domain_cfstr,
|
||||||
kCFPreferencesCurrentUser, kCFPreferencesAnyHost);
|
kCFPreferencesCurrentUser, kCFPreferencesAnyHost);
|
||||||
CFRelease (cfarray);
|
CFRelease (cfarray);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) prefs_set_string:(NSString *)key value:(NSString *)value {
|
- (void) prefs_set_string:(NSString *)key value:(NSString *)value {
|
||||||
CFPreferencesSetValue ((CFStringRef) key, (CFTypeRef) value,
|
CFPreferencesSetValue ((CFStringRef) key, (CFTypeRef) value,
|
||||||
CFSTR (APP_PREFS), kCFPreferencesCurrentUser,
|
app_prefs_domain_cfstr, kCFPreferencesCurrentUser,
|
||||||
kCFPreferencesAnyHost);
|
kCFPreferencesAnyHost);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -857,6 +859,9 @@ void X11ApplicationMain (int argc, char **argv, char **envp) {
|
||||||
pool = [[NSAutoreleasePool alloc] init];
|
pool = [[NSAutoreleasePool alloc] init];
|
||||||
X11App = (X11Application *) [X11Application sharedApplication];
|
X11App = (X11Application *) [X11Application sharedApplication];
|
||||||
init_ports ();
|
init_ports ();
|
||||||
|
|
||||||
|
app_prefs_domain_cfstr = (CFStringRef)[[NSBundle mainBundle] bundleIdentifier];
|
||||||
|
|
||||||
[NSApp read_defaults];
|
[NSApp read_defaults];
|
||||||
[NSBundle loadNibNamed:@"main" owner:NSApp];
|
[NSBundle loadNibNamed:@"main" owner:NSApp];
|
||||||
[[NSNotificationCenter defaultCenter] addObserver:NSApp
|
[[NSNotificationCenter defaultCenter] addObserver:NSApp
|
||||||
|
|
|
@ -55,6 +55,8 @@
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
|
|
||||||
|
BOOL xquartz_resetenv_display = NO;
|
||||||
|
|
||||||
@implementation X11Controller
|
@implementation X11Controller
|
||||||
|
|
||||||
- (void) awakeFromNib
|
- (void) awakeFromNib
|
||||||
|
@ -356,7 +358,7 @@
|
||||||
|
|
||||||
/* Setup environment */
|
/* Setup environment */
|
||||||
temp = getenv("DISPLAY");
|
temp = getenv("DISPLAY");
|
||||||
if (temp == NULL || temp[0] == 0) {
|
if (xquartz_resetenv_display || temp == NULL || temp[0] == 0) {
|
||||||
snprintf(buf, sizeof(buf), ":%s", display);
|
snprintf(buf, sizeof(buf), ":%s", display);
|
||||||
setenv("DISPLAY", buf, TRUE);
|
setenv("DISPLAY", buf, TRUE);
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
prior written authorization. */
|
prior written authorization. */
|
||||||
|
|
||||||
#include <CoreFoundation/CoreFoundation.h>
|
#include <CoreFoundation/CoreFoundation.h>
|
||||||
|
#include <AvailabilityMacros.h>
|
||||||
|
|
||||||
#include <X11/Xlib.h>
|
#include <X11/Xlib.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
@ -56,6 +57,8 @@ void DarwinListenOnOpenFD(int fd);
|
||||||
|
|
||||||
extern int noPanoramiXExtension;
|
extern int noPanoramiXExtension;
|
||||||
|
|
||||||
|
extern int xquartz_resetenv_display;
|
||||||
|
|
||||||
#define DEFAULT_CLIENT "/usr/X11/bin/xterm"
|
#define DEFAULT_CLIENT "/usr/X11/bin/xterm"
|
||||||
#define DEFAULT_STARTX "/usr/X11/bin/startx"
|
#define DEFAULT_STARTX "/usr/X11/bin/startx"
|
||||||
#define DEFAULT_SHELL "/bin/sh"
|
#define DEFAULT_SHELL "/bin/sh"
|
||||||
|
@ -72,10 +75,9 @@ const char *__crashreporter_info__base = "X.Org X Server " XSERVER_VERSION " Bui
|
||||||
char __crashreporter_info__buf[4096];
|
char __crashreporter_info__buf[4096];
|
||||||
char *__crashreporter_info__ = __crashreporter_info__buf;
|
char *__crashreporter_info__ = __crashreporter_info__buf;
|
||||||
|
|
||||||
#define DEBUG 1
|
static char *server_bootstrap_name = "org.x.X11";
|
||||||
|
|
||||||
static int execute(const char *command);
|
#define DEBUG 1
|
||||||
static char *command_from_prefs(const char *key, const char *default_value);
|
|
||||||
|
|
||||||
/* This is in quartzStartup.c */
|
/* This is in quartzStartup.c */
|
||||||
int server_main(int argc, char **argv, char **envp);
|
int server_main(int argc, char **argv, char **envp);
|
||||||
|
@ -372,9 +374,13 @@ int startup_trigger(int argc, char **argv, char **envp) {
|
||||||
strlcpy(newenvp[i], envp[i], STRING_T_SIZE);
|
strlcpy(newenvp[i], envp[i], STRING_T_SIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
kr = bootstrap_look_up(bootstrap_port, SERVER_BOOTSTRAP_NAME, &mp);
|
kr = bootstrap_look_up(bootstrap_port, server_bootstrap_name, &mp);
|
||||||
if (kr != KERN_SUCCESS) {
|
if (kr != KERN_SUCCESS) {
|
||||||
|
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050
|
||||||
fprintf(stderr, "bootstrap_look_up(): %s\n", bootstrap_strerror(kr));
|
fprintf(stderr, "bootstrap_look_up(): %s\n", bootstrap_strerror(kr));
|
||||||
|
#else
|
||||||
|
fprintf(stderr, "bootstrap_look_up(): %ul\n", (unsigned long)kr);
|
||||||
|
#endif
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -404,6 +410,9 @@ int startup_trigger(int argc, char **argv, char **envp) {
|
||||||
if((s = getenv("DISPLAY"))) {
|
if((s = getenv("DISPLAY"))) {
|
||||||
fprintf(stderr, "X11.app: Could not connect to server (DISPLAY=\"%s\", unsetting). Starting X server.\n", s);
|
fprintf(stderr, "X11.app: Could not connect to server (DISPLAY=\"%s\", unsetting). Starting X server.\n", s);
|
||||||
unsetenv("DISPLAY");
|
unsetenv("DISPLAY");
|
||||||
|
|
||||||
|
/* This tells X11Controller to not use the environment's DISPLAY and reset it based on the server's display */
|
||||||
|
xquartz_resetenv_display = 1;
|
||||||
} else {
|
} else {
|
||||||
fprintf(stderr, "X11.app: Could not connect to server (DISPLAY is not set). Starting X server.\n");
|
fprintf(stderr, "X11.app: Could not connect to server (DISPLAY is not set). Starting X server.\n");
|
||||||
}
|
}
|
||||||
|
@ -424,6 +433,22 @@ int main(int argc, char **argv, char **envp) {
|
||||||
/* Setup the initial crasherporter info */
|
/* Setup the initial crasherporter info */
|
||||||
strlcpy(__crashreporter_info__, __crashreporter_info__base, __crashreporter_info__len);
|
strlcpy(__crashreporter_info__, __crashreporter_info__base, __crashreporter_info__len);
|
||||||
|
|
||||||
|
/* Pass on our prefs domain to startx and its inheritors (mainly for
|
||||||
|
* quartz-wm and the Xquartz stub's MachIPC)
|
||||||
|
*/
|
||||||
|
CFBundleRef bundle = CFBundleGetMainBundle();
|
||||||
|
if(bundle) {
|
||||||
|
CFStringRef pd = CFBundleGetIdentifier(bundle);
|
||||||
|
if(pd) {
|
||||||
|
const char *pds = CFStringGetCStringPtr(pd, 0);
|
||||||
|
if(pds) {
|
||||||
|
server_bootstrap_name = malloc(sizeof(char) * (strlen(pds) + 1));
|
||||||
|
strcpy(server_bootstrap_name, pds);
|
||||||
|
setenv("X11_PREFS_DOMAIN", pds, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fprintf(stderr, "X11.app: main(): argc=%d\n", argc);
|
fprintf(stderr, "X11.app: main(): argc=%d\n", argc);
|
||||||
for(i=0; i < argc; i++) {
|
for(i=0; i < argc; i++) {
|
||||||
fprintf(stderr, "\targv[%u] = %s\n", (unsigned)i, argv[i]);
|
fprintf(stderr, "\targv[%u] = %s\n", (unsigned)i, argv[i]);
|
||||||
|
@ -432,9 +457,9 @@ int main(int argc, char **argv, char **envp) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mp = checkin_or_register(SERVER_BOOTSTRAP_NAME);
|
mp = checkin_or_register(server_bootstrap_name);
|
||||||
if(mp == MACH_PORT_NULL) {
|
if(mp == MACH_PORT_NULL) {
|
||||||
fprintf(stderr, "NULL mach service: %s", SERVER_BOOTSTRAP_NAME);
|
fprintf(stderr, "NULL mach service: %s", server_bootstrap_name);
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
#ifndef _MACH_STARTUP_TYPES_H_
|
#ifndef _MACH_STARTUP_TYPES_H_
|
||||||
#define _MACH_STARTUP_TYPES_H_
|
#define _MACH_STARTUP_TYPES_H_
|
||||||
|
|
||||||
#define SERVER_BOOTSTRAP_NAME "org.x.X11"
|
|
||||||
#define STRING_T_SIZE 1024
|
#define STRING_T_SIZE 1024
|
||||||
|
|
||||||
typedef char string_t[STRING_T_SIZE];
|
typedef char string_t[STRING_T_SIZE];
|
||||||
|
|
|
@ -40,6 +40,12 @@
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#include <sys/un.h>
|
#include <sys/un.h>
|
||||||
|
|
||||||
|
static char *server_bootstrap_name = "org.x.X11";
|
||||||
|
|
||||||
|
/* The launchd startup is only designed for the primary X11.app that is
|
||||||
|
* org.x.X11... server_bootstrap_name might be differnet if we were triggered to
|
||||||
|
* start by another X11.app.
|
||||||
|
*/
|
||||||
#define kX11AppBundleId "org.x.X11"
|
#define kX11AppBundleId "org.x.X11"
|
||||||
#define kX11AppBundlePath "/Contents/MacOS/X11"
|
#define kX11AppBundlePath "/Contents/MacOS/X11"
|
||||||
|
|
||||||
|
@ -222,6 +228,9 @@ int main(int argc, char **argv, char **envp) {
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(getenv("X11_PREFS_DOMAIN"))
|
||||||
|
server_bootstrap_name = getenv("X11_PREFS_DOMAIN");
|
||||||
|
|
||||||
/* We don't have a mechanism in place to handle this interrupt driven
|
/* We don't have a mechanism in place to handle this interrupt driven
|
||||||
* server-start notification, so just send the signal now, so xinit doesn't
|
* server-start notification, so just send the signal now, so xinit doesn't
|
||||||
* time out waiting for it and will just poll for the server.
|
* time out waiting for it and will just poll for the server.
|
||||||
|
@ -238,7 +247,7 @@ int main(int argc, char **argv, char **envp) {
|
||||||
/* Get the $DISPLAY FD */
|
/* Get the $DISPLAY FD */
|
||||||
launchd_fd = launchd_display_fd();
|
launchd_fd = launchd_display_fd();
|
||||||
|
|
||||||
kr = bootstrap_look_up(bootstrap_port, SERVER_BOOTSTRAP_NAME, &mp);
|
kr = bootstrap_look_up(bootstrap_port, server_bootstrap_name, &mp);
|
||||||
if(kr != KERN_SUCCESS) {
|
if(kr != KERN_SUCCESS) {
|
||||||
set_x11_path();
|
set_x11_path();
|
||||||
|
|
||||||
|
@ -261,13 +270,17 @@ int main(int argc, char **argv, char **envp) {
|
||||||
/* Try connecting for 10 seconds */
|
/* Try connecting for 10 seconds */
|
||||||
for(i=0; i < 80; i++) {
|
for(i=0; i < 80; i++) {
|
||||||
usleep(250000);
|
usleep(250000);
|
||||||
kr = bootstrap_look_up(bootstrap_port, SERVER_BOOTSTRAP_NAME, &mp);
|
kr = bootstrap_look_up(bootstrap_port, server_bootstrap_name, &mp);
|
||||||
if(kr == KERN_SUCCESS)
|
if(kr == KERN_SUCCESS)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(kr != KERN_SUCCESS) {
|
if(kr != KERN_SUCCESS) {
|
||||||
fprintf(stderr, "Xquartz: bootstrap_look_up(): Timed out: %s\n", bootstrap_strerror(kr));
|
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050
|
||||||
|
fprintf(stderr, "Xquartz: bootstrap_look_up(): %s\n", bootstrap_strerror(kr));
|
||||||
|
#else
|
||||||
|
fprintf(stderr, "Xquartz: bootstrap_look_up(): %ul\n", (unsigned long)kr);
|
||||||
|
#endif
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,6 +34,11 @@
|
||||||
#include <unistd.h> /*for getpid*/
|
#include <unistd.h> /*for getpid*/
|
||||||
#include <Cocoa/Cocoa.h>
|
#include <Cocoa/Cocoa.h>
|
||||||
|
|
||||||
|
static const char *app_prefs_domain = "org.x.X11";
|
||||||
|
CFStringRef app_prefs_domain_cfstr;
|
||||||
|
|
||||||
|
char *display = NULL;
|
||||||
|
|
||||||
static void signal_handler (int sig) {
|
static void signal_handler (int sig) {
|
||||||
switch(sig) {
|
switch(sig) {
|
||||||
case SIGHUP:
|
case SIGHUP:
|
||||||
|
@ -51,6 +56,27 @@ int main (int argc, const char *argv[]) {
|
||||||
|
|
||||||
xpbproxy_is_standalone = YES;
|
xpbproxy_is_standalone = YES;
|
||||||
|
|
||||||
|
if((s = getenv("X11_PREFS_DOMAIN")))
|
||||||
|
app_prefs_domain = s;
|
||||||
|
|
||||||
|
for (i = 1; i < argc; i++) {
|
||||||
|
if(strcmp (argv[i], "--prefs-domain") == 0 && i+1 < argc) {
|
||||||
|
app_prefs_domain = argv[++i];
|
||||||
|
} else if (strcmp (argv[i], "--help") == 0) {
|
||||||
|
printf("usage: xpbproxy OPTIONS\n"
|
||||||
|
"Pasteboard proxying for X11.\n\n"
|
||||||
|
"--prefs-domain <domain> Change the domain used for reading preferences\n"
|
||||||
|
" (default: org.x.X11)\n");
|
||||||
|
return 0;
|
||||||
|
} else {
|
||||||
|
fprintf(stderr, "usage: xpbproxy OPTIONS...\n"
|
||||||
|
"Try 'xpbproxy --help' for more information.\n");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
app_prefs_domain_cfstr = CFStringCreateWithCString(NULL, app_prefs_domain, kCFStringEncodingUTF8);
|
||||||
|
|
||||||
if(!xpbproxy_init())
|
if(!xpbproxy_init())
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
|
|
||||||
|
|
|
@ -31,6 +31,7 @@
|
||||||
#import "x-selection.h"
|
#import "x-selection.h"
|
||||||
|
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
|
#include <unistd.h>
|
||||||
#include <X11/extensions/applewm.h>
|
#include <X11/extensions/applewm.h>
|
||||||
|
|
||||||
Display *xpbproxy_dpy;
|
Display *xpbproxy_dpy;
|
||||||
|
@ -38,6 +39,8 @@ int xpbproxy_apple_wm_event_base, xpbproxy_apple_wm_error_base;
|
||||||
int xpbproxy_xfixes_event_base, xpbproxy_xfixes_error_base;
|
int xpbproxy_xfixes_event_base, xpbproxy_xfixes_error_base;
|
||||||
BOOL xpbproxy_have_xfixes;
|
BOOL xpbproxy_have_xfixes;
|
||||||
|
|
||||||
|
extern char *display;
|
||||||
|
|
||||||
#ifdef STANDALONE_XPBPROXY
|
#ifdef STANDALONE_XPBPROXY
|
||||||
BOOL xpbproxy_is_standalone = NO;
|
BOOL xpbproxy_is_standalone = NO;
|
||||||
#endif
|
#endif
|
||||||
|
@ -67,10 +70,24 @@ static int x_error_handler (Display *dpy, XErrorEvent *errevent) {
|
||||||
|
|
||||||
BOOL xpbproxy_init (void) {
|
BOOL xpbproxy_init (void) {
|
||||||
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
||||||
|
size_t i;
|
||||||
|
|
||||||
|
for(i=0, xpbproxy_dpy=NULL; !xpbproxy_dpy && i<5; i++) {
|
||||||
|
xpbproxy_dpy = XOpenDisplay(NULL);
|
||||||
|
|
||||||
|
if(!xpbproxy_dpy && display) {
|
||||||
|
char _display[32];
|
||||||
|
snprintf(_display, sizeof(_display), ":%s", display);
|
||||||
|
setenv("DISPLAY", _display, TRUE);
|
||||||
|
|
||||||
|
xpbproxy_dpy=XOpenDisplay(_display);
|
||||||
|
}
|
||||||
|
if(!xpbproxy_dpy)
|
||||||
|
sleep(1);
|
||||||
|
}
|
||||||
|
|
||||||
xpbproxy_dpy = XOpenDisplay (NULL);
|
|
||||||
if (xpbproxy_dpy == NULL) {
|
if (xpbproxy_dpy == NULL) {
|
||||||
fprintf (stderr, "can't open default display\n");
|
fprintf (stderr, "xpbproxy: can't open default display\n");
|
||||||
[pool release];
|
[pool release];
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
@ -80,7 +97,7 @@ BOOL xpbproxy_init (void) {
|
||||||
|
|
||||||
if (!XAppleWMQueryExtension (xpbproxy_dpy, &xpbproxy_apple_wm_event_base,
|
if (!XAppleWMQueryExtension (xpbproxy_dpy, &xpbproxy_apple_wm_event_base,
|
||||||
&xpbproxy_apple_wm_error_base)) {
|
&xpbproxy_apple_wm_error_base)) {
|
||||||
fprintf (stderr, "can't open AppleWM server extension\n");
|
fprintf (stderr, "xpbproxy: can't open AppleWM server extension\n");
|
||||||
[pool release];
|
[pool release];
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -97,12 +97,13 @@ dump_prefs (FILE *fp) {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define APP_PREFS "org.x.X11"
|
extern CFStringRef app_prefs_domain_cfstr;
|
||||||
|
|
||||||
static BOOL
|
static BOOL
|
||||||
prefs_get_bool (CFStringRef key, BOOL defaultValue) {
|
prefs_get_bool (CFStringRef key, BOOL defaultValue) {
|
||||||
Boolean value, ok;
|
Boolean value, ok;
|
||||||
|
|
||||||
value = CFPreferencesGetAppBooleanValue (key, CFSTR (APP_PREFS), &ok);
|
value = CFPreferencesGetAppBooleanValue (key, app_prefs_domain_cfstr, &ok);
|
||||||
|
|
||||||
return ok ? (BOOL) value : defaultValue;
|
return ok ? (BOOL) value : defaultValue;
|
||||||
}
|
}
|
||||||
|
@ -1425,7 +1426,7 @@ get_property(Window win, Atom property, struct propdata *pdata, Bool delete, Ato
|
||||||
* It's uncertain how we could handle the synchronization failing, so cast to void.
|
* It's uncertain how we could handle the synchronization failing, so cast to void.
|
||||||
* The prefs_get_bool should fall back to defaults if the org.x.X11 plist doesn't exist or is invalid.
|
* The prefs_get_bool should fall back to defaults if the org.x.X11 plist doesn't exist or is invalid.
|
||||||
*/
|
*/
|
||||||
(void)CFPreferencesAppSynchronize(CFSTR(APP_PREFS));
|
(void)CFPreferencesAppSynchronize(app_prefs_domain_cfstr);
|
||||||
#ifdef STANDALONE_XPBPROXY
|
#ifdef STANDALONE_XPBPROXY
|
||||||
if(xpbproxy_is_standalone)
|
if(xpbproxy_is_standalone)
|
||||||
pbproxy_prefs.active = YES;
|
pbproxy_prefs.active = YES;
|
||||||
|
|
|
@ -54,20 +54,16 @@ typedef void (*InitInputProc)(int argc, char **argv);
|
||||||
* Cursor functions
|
* Cursor functions
|
||||||
*/
|
*/
|
||||||
typedef Bool (*InitCursorProc)(ScreenPtr pScreen);
|
typedef Bool (*InitCursorProc)(ScreenPtr pScreen);
|
||||||
typedef void (*CursorUpdateProc)(void);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Suspend and resume X11 activity
|
* Suspend and resume X11 activity
|
||||||
*/
|
*/
|
||||||
typedef void (*SuspendScreenProc)(ScreenPtr pScreen);
|
typedef void (*SuspendScreenProc)(ScreenPtr pScreen);
|
||||||
typedef void (*ResumeScreenProc)(ScreenPtr pScreen, int x, int y);
|
typedef void (*ResumeScreenProc)(ScreenPtr pScreen, int x, int y);
|
||||||
typedef void (*CaptureScreensProc)(void);
|
|
||||||
typedef void (*ReleaseScreensProc)(void);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Screen state change support
|
* Screen state change support
|
||||||
*/
|
*/
|
||||||
typedef void (*ScreenChangedProc)(void);
|
|
||||||
typedef void (*AddPseudoramiXScreensProc)(int *x, int *y, int *width, int *height);
|
typedef void (*AddPseudoramiXScreensProc)(int *x, int *y, int *width, int *height);
|
||||||
typedef void (*UpdateScreenProc)(ScreenPtr pScreen);
|
typedef void (*UpdateScreenProc)(ScreenPtr pScreen);
|
||||||
|
|
||||||
|
@ -101,14 +97,10 @@ typedef struct _QuartzModeProcs {
|
||||||
InitInputProc InitInput;
|
InitInputProc InitInput;
|
||||||
|
|
||||||
InitCursorProc InitCursor;
|
InitCursorProc InitCursor;
|
||||||
CursorUpdateProc CursorUpdate; // Not used if NULL
|
|
||||||
|
|
||||||
SuspendScreenProc SuspendScreen;
|
SuspendScreenProc SuspendScreen;
|
||||||
ResumeScreenProc ResumeScreen;
|
ResumeScreenProc ResumeScreen;
|
||||||
CaptureScreensProc CaptureScreens; // Only called in fullscreen
|
|
||||||
ReleaseScreensProc ReleaseScreens; // Only called in fullscreen
|
|
||||||
|
|
||||||
ScreenChangedProc ScreenChanged;
|
|
||||||
AddPseudoramiXScreensProc AddPseudoramiXScreens;
|
AddPseudoramiXScreensProc AddPseudoramiXScreens;
|
||||||
UpdateScreenProc UpdateScreen;
|
UpdateScreenProc UpdateScreen;
|
||||||
|
|
||||||
|
|
|
@ -77,143 +77,6 @@ enum {
|
||||||
|
|
||||||
#define UKEYSYM(u) ((u) | 0x01000000)
|
#define UKEYSYM(u) ((u) | 0x01000000)
|
||||||
|
|
||||||
#define AltMask Mod1Mask
|
|
||||||
#define MetaMask Mod2Mask
|
|
||||||
#define FunctionMask Mod3Mask
|
|
||||||
|
|
||||||
#define UK(a) NoSymbol // unknown symbol
|
|
||||||
|
|
||||||
static KeySym const next_to_x[256] = {
|
|
||||||
NoSymbol, NoSymbol, NoSymbol, XK_KP_Enter,
|
|
||||||
NoSymbol, NoSymbol, NoSymbol, NoSymbol,
|
|
||||||
XK_BackSpace, XK_Tab, XK_Linefeed, NoSymbol,
|
|
||||||
NoSymbol, XK_Return, NoSymbol, NoSymbol,
|
|
||||||
NoSymbol, NoSymbol, NoSymbol, NoSymbol,
|
|
||||||
NoSymbol, NoSymbol, NoSymbol, NoSymbol,
|
|
||||||
NoSymbol, NoSymbol, NoSymbol, XK_Escape,
|
|
||||||
NoSymbol, NoSymbol, NoSymbol, NoSymbol,
|
|
||||||
XK_space, XK_exclam, XK_quotedbl, XK_numbersign,
|
|
||||||
XK_dollar, XK_percent, XK_ampersand, XK_apostrophe,
|
|
||||||
XK_parenleft, XK_parenright, XK_asterisk, XK_plus,
|
|
||||||
XK_comma, XK_minus, XK_period, XK_slash,
|
|
||||||
XK_0, XK_1, XK_2, XK_3,
|
|
||||||
XK_4, XK_5, XK_6, XK_7,
|
|
||||||
XK_8, XK_9, XK_colon, XK_semicolon,
|
|
||||||
XK_less, XK_equal, XK_greater, XK_question,
|
|
||||||
XK_at, XK_A, XK_B, XK_C,
|
|
||||||
XK_D, XK_E, XK_F, XK_G,
|
|
||||||
XK_H, XK_I, XK_J, XK_K,
|
|
||||||
XK_L, XK_M, XK_N, XK_O,
|
|
||||||
XK_P, XK_Q, XK_R, XK_S,
|
|
||||||
XK_T, XK_U, XK_V, XK_W,
|
|
||||||
XK_X, XK_Y, XK_Z, XK_bracketleft,
|
|
||||||
XK_backslash, XK_bracketright,XK_asciicircum, XK_underscore,
|
|
||||||
XK_grave, XK_a, XK_b, XK_c,
|
|
||||||
XK_d, XK_e, XK_f, XK_g,
|
|
||||||
XK_h, XK_i, XK_j, XK_k,
|
|
||||||
XK_l, XK_m, XK_n, XK_o,
|
|
||||||
XK_p, XK_q, XK_r, XK_s,
|
|
||||||
XK_t, XK_u, XK_v, XK_w,
|
|
||||||
XK_x, XK_y, XK_z, XK_braceleft,
|
|
||||||
XK_bar, XK_braceright, XK_asciitilde, XK_BackSpace,
|
|
||||||
// 128
|
|
||||||
NoSymbol, XK_Agrave, XK_Aacute, XK_Acircumflex,
|
|
||||||
XK_Atilde, XK_Adiaeresis, XK_Aring, XK_Ccedilla,
|
|
||||||
XK_Egrave, XK_Eacute, XK_Ecircumflex, XK_Ediaeresis,
|
|
||||||
XK_Igrave, XK_Iacute, XK_Icircumflex, XK_Idiaeresis,
|
|
||||||
// 144
|
|
||||||
XK_ETH, XK_Ntilde, XK_Ograve, XK_Oacute,
|
|
||||||
XK_Ocircumflex, XK_Otilde, XK_Odiaeresis, XK_Ugrave,
|
|
||||||
XK_Uacute, XK_Ucircumflex, XK_Udiaeresis, XK_Yacute,
|
|
||||||
XK_THORN, XK_mu, XK_multiply, XK_division,
|
|
||||||
// 160
|
|
||||||
XK_copyright, XK_exclamdown, XK_cent, XK_sterling,
|
|
||||||
UK(fraction), XK_yen, UK(fhook), XK_section,
|
|
||||||
XK_currency, XK_rightsinglequotemark,
|
|
||||||
XK_leftdoublequotemark,
|
|
||||||
XK_guillemotleft,
|
|
||||||
XK_leftanglebracket,
|
|
||||||
XK_rightanglebracket,
|
|
||||||
UK(filigature), UK(flligature),
|
|
||||||
// 176
|
|
||||||
XK_registered, XK_endash, XK_dagger, XK_doubledagger,
|
|
||||||
XK_periodcentered,XK_brokenbar, XK_paragraph, UK(bullet),
|
|
||||||
XK_singlelowquotemark,
|
|
||||||
XK_doublelowquotemark,
|
|
||||||
XK_rightdoublequotemark,
|
|
||||||
XK_guillemotright,
|
|
||||||
XK_ellipsis, UK(permille), XK_notsign, XK_questiondown,
|
|
||||||
// 192
|
|
||||||
XK_onesuperior, XK_dead_grave, XK_dead_acute, XK_dead_circumflex,
|
|
||||||
XK_dead_tilde, XK_dead_macron, XK_dead_breve, XK_dead_abovedot,
|
|
||||||
XK_dead_diaeresis,
|
|
||||||
XK_twosuperior, XK_dead_abovering,
|
|
||||||
XK_dead_cedilla,
|
|
||||||
XK_threesuperior,
|
|
||||||
XK_dead_doubleacute,
|
|
||||||
XK_dead_ogonek, XK_dead_caron,
|
|
||||||
// 208
|
|
||||||
XK_emdash, XK_plusminus, XK_onequarter, XK_onehalf,
|
|
||||||
XK_threequarters,
|
|
||||||
XK_agrave, XK_aacute, XK_acircumflex,
|
|
||||||
XK_atilde, XK_adiaeresis, XK_aring, XK_ccedilla,
|
|
||||||
XK_egrave, XK_eacute, XK_ecircumflex, XK_ediaeresis,
|
|
||||||
// 224
|
|
||||||
XK_igrave, XK_AE, XK_iacute, XK_ordfeminine,
|
|
||||||
XK_icircumflex, XK_idiaeresis, XK_eth, XK_ntilde,
|
|
||||||
XK_Lstroke, XK_Ooblique, XK_OE, XK_masculine,
|
|
||||||
XK_ograve, XK_oacute, XK_ocircumflex, XK_otilde,
|
|
||||||
// 240
|
|
||||||
XK_odiaeresis, XK_ae, XK_ugrave, XK_uacute,
|
|
||||||
XK_ucircumflex, XK_idotless, XK_udiaeresis, XK_ygrave,
|
|
||||||
XK_lstroke, XK_ooblique, XK_oe, XK_ssharp,
|
|
||||||
XK_thorn, XK_ydiaeresis, NoSymbol, NoSymbol,
|
|
||||||
};
|
|
||||||
|
|
||||||
#define MIN_SYMBOL 0xAC
|
|
||||||
static KeySym const symbol_to_x[] = {
|
|
||||||
XK_Left, XK_Up, XK_Right, XK_Down
|
|
||||||
};
|
|
||||||
static int const NUM_SYMBOL = sizeof(symbol_to_x) / sizeof(symbol_to_x[0]);
|
|
||||||
|
|
||||||
#define MIN_FUNCKEY 0x20
|
|
||||||
static KeySym const funckey_to_x[] = {
|
|
||||||
XK_F1, XK_F2, XK_F3, XK_F4,
|
|
||||||
XK_F5, XK_F6, XK_F7, XK_F8,
|
|
||||||
XK_F9, XK_F10, XK_F11, XK_F12,
|
|
||||||
XK_Insert, XK_Delete, XK_Home, XK_End,
|
|
||||||
XK_Page_Up, XK_Page_Down, XK_F13, XK_F14,
|
|
||||||
XK_F15
|
|
||||||
};
|
|
||||||
static int const NUM_FUNCKEY = sizeof(funckey_to_x) / sizeof(funckey_to_x[0]);
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
KeySym normalSym;
|
|
||||||
KeySym keypadSym;
|
|
||||||
} darwinKeyPad_t;
|
|
||||||
|
|
||||||
static darwinKeyPad_t const normal_to_keypad[] = {
|
|
||||||
{ XK_0, XK_KP_0 },
|
|
||||||
{ XK_1, XK_KP_1 },
|
|
||||||
{ XK_2, XK_KP_2 },
|
|
||||||
{ XK_3, XK_KP_3 },
|
|
||||||
{ XK_4, XK_KP_4 },
|
|
||||||
{ XK_5, XK_KP_5 },
|
|
||||||
{ XK_6, XK_KP_6 },
|
|
||||||
{ XK_7, XK_KP_7 },
|
|
||||||
{ XK_8, XK_KP_8 },
|
|
||||||
{ XK_9, XK_KP_9 },
|
|
||||||
{ XK_equal, XK_KP_Equal },
|
|
||||||
{ XK_asterisk, XK_KP_Multiply },
|
|
||||||
{ XK_plus, XK_KP_Add },
|
|
||||||
{ XK_comma, XK_KP_Separator },
|
|
||||||
{ XK_minus, XK_KP_Subtract },
|
|
||||||
{ XK_period, XK_KP_Decimal },
|
|
||||||
{ XK_slash, XK_KP_Divide }
|
|
||||||
};
|
|
||||||
|
|
||||||
static int const NUM_KEYPAD = sizeof(normal_to_keypad) / sizeof(normal_to_keypad[0]);
|
|
||||||
|
|
||||||
/* Table of keycode->keysym mappings we use to fallback on for important
|
/* Table of keycode->keysym mappings we use to fallback on for important
|
||||||
keys that are often not in the Unicode mapping. */
|
keys that are often not in the Unicode mapping. */
|
||||||
|
|
||||||
|
@ -733,24 +596,29 @@ Bool QuartzReadSystemKeymap(darwinKeyboardInfo *info) {
|
||||||
ErrorF("X11.app: Debug Info: keyboard_type=%u, currentKeyLayoutRef=%p, currentKeyLayoutDataRef=%p, chr_data=%p\n",
|
ErrorF("X11.app: Debug Info: keyboard_type=%u, currentKeyLayoutRef=%p, currentKeyLayoutDataRef=%p, chr_data=%p\n",
|
||||||
(unsigned)keyboard_type, currentKeyLayoutRef, currentKeyLayoutDataRef, chr_data);
|
(unsigned)keyboard_type, currentKeyLayoutRef, currentKeyLayoutDataRef, chr_data);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
KLGetCurrentKeyboardLayout (&key_layout);
|
KLGetCurrentKeyboardLayout (&key_layout);
|
||||||
KLGetKeyboardLayoutProperty (key_layout, kKLuchrData, &chr_data);
|
KLGetKeyboardLayoutProperty (key_layout, kKLuchrData, &chr_data);
|
||||||
|
|
||||||
|
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050
|
||||||
if(chr_data != NULL) {
|
if(chr_data != NULL) {
|
||||||
ErrorF("X11.app: Fallback succeeded, but this is still a bug. Please report the above information.\n");
|
ErrorF("X11.app: Fallback succeeded, but this is still a bug. Please report the above information.\n");
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
if (chr_data == NULL) {
|
if (chr_data == NULL) {
|
||||||
ErrorF("X11.app: Debug Info: kKLuchrData fallback failed, trying kKLKCHRData.\n");
|
ErrorF("X11.app: Debug Info: kKLuchrData failed, trying kKLKCHRData.\n");
|
||||||
ErrorF("If you are using a 3rd party keyboard layout, please see http://xquartz.macosforge.org/trac/ticket/154\n");
|
ErrorF("If you are using a 3rd party keyboard layout, please see http://xquartz.macosforge.org/trac/ticket/154\n");
|
||||||
KLGetKeyboardLayoutProperty (key_layout, kKLKCHRData, &chr_data);
|
KLGetKeyboardLayoutProperty (key_layout, kKLKCHRData, &chr_data);
|
||||||
is_uchr = 0;
|
is_uchr = 0;
|
||||||
num_keycodes = 128;
|
num_keycodes = 128;
|
||||||
|
|
||||||
|
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050
|
||||||
if(chr_data != NULL) {
|
if(chr_data != NULL) {
|
||||||
ErrorF("X11.app: Fallback succeeded, but this is still a bug. Please report the above information.\n");
|
ErrorF("X11.app: Fallback succeeded, but this is still a bug. Please report the above information.\n");
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -423,12 +423,8 @@ static QuartzModeProcsRec xprModeProcs = {
|
||||||
xprSetupScreen,
|
xprSetupScreen,
|
||||||
xprInitInput,
|
xprInitInput,
|
||||||
QuartzInitCursor,
|
QuartzInitCursor,
|
||||||
NULL, // No need to update cursor
|
|
||||||
QuartzSuspendXCursor,
|
QuartzSuspendXCursor,
|
||||||
QuartzResumeXCursor,
|
QuartzResumeXCursor,
|
||||||
NULL, // No capture or release in rootless mode
|
|
||||||
NULL,
|
|
||||||
NULL, // Xplugin sends screen change events directly
|
|
||||||
xprAddPseudoramiXScreens,
|
xprAddPseudoramiXScreens,
|
||||||
xprUpdateScreen,
|
xprUpdateScreen,
|
||||||
xprIsX11Window,
|
xprIsX11Window,
|
||||||
|
|
|
@ -169,9 +169,7 @@ extern void SendErrorToClient(
|
||||||
extern void MarkClientException(
|
extern void MarkClientException(
|
||||||
ClientPtr /*client*/);
|
ClientPtr /*client*/);
|
||||||
|
|
||||||
#if defined(DDXBEFORERESET)
|
|
||||||
extern void ddxBeforeReset (void);
|
extern void ddxBeforeReset (void);
|
||||||
#endif
|
|
||||||
|
|
||||||
/* dixutils.c */
|
/* dixutils.c */
|
||||||
|
|
||||||
|
|
|
@ -97,12 +97,6 @@ SOFTWARE.
|
||||||
#define SEMAPHORE_FIELD_UNSET(win, dev, field) \
|
#define SEMAPHORE_FIELD_UNSET(win, dev, field) \
|
||||||
(win)->field[(dev)->id/8] &= ~(1 << ((dev)->id % 8));
|
(win)->field[(dev)->id/8] &= ~(1 << ((dev)->id % 8));
|
||||||
|
|
||||||
#define ENTER_LEAVE_SEMAPHORE_SET(win, dev) \
|
|
||||||
SEMAPHORE_FIELD_SET(win, dev, enterleave);
|
|
||||||
|
|
||||||
#define ENTER_LEAVE_SEMAPHORE_UNSET(win, dev) \
|
|
||||||
SEMAPHORE_FIELD_UNSET(win, dev, enterleave);
|
|
||||||
|
|
||||||
#define FOCUS_SEMAPHORE_SET(win, dev) \
|
#define FOCUS_SEMAPHORE_SET(win, dev) \
|
||||||
SEMAPHORE_FIELD_SET(win, dev, focusinout);
|
SEMAPHORE_FIELD_SET(win, dev, focusinout);
|
||||||
|
|
||||||
|
@ -239,7 +233,7 @@ extern Bool ActivateDevice(
|
||||||
extern Bool DisableDevice(
|
extern Bool DisableDevice(
|
||||||
DeviceIntPtr /*device*/);
|
DeviceIntPtr /*device*/);
|
||||||
|
|
||||||
extern void InitAndStartDevices(void);
|
extern int InitAndStartDevices(void);
|
||||||
|
|
||||||
extern void CloseDownDevices(void);
|
extern void CloseDownDevices(void);
|
||||||
|
|
||||||
|
@ -512,7 +506,6 @@ extern int AllocMasterDevice(ClientPtr client,
|
||||||
extern void DeepCopyDeviceClasses(DeviceIntPtr from,
|
extern void DeepCopyDeviceClasses(DeviceIntPtr from,
|
||||||
DeviceIntPtr to);
|
DeviceIntPtr to);
|
||||||
|
|
||||||
extern int EnterLeaveSemaphoresIsset(WindowPtr win);
|
|
||||||
extern int FocusSemaphoresIsset(WindowPtr win);
|
extern int FocusSemaphoresIsset(WindowPtr win);
|
||||||
|
|
||||||
/* Implemented by the DDX. */
|
/* Implemented by the DDX. */
|
||||||
|
|
|
@ -186,53 +186,61 @@ XkbDDXCompileKeymapByNames( XkbDescPtr xkb,
|
||||||
char * nameRtrn,
|
char * nameRtrn,
|
||||||
int nameRtrnLen)
|
int nameRtrnLen)
|
||||||
{
|
{
|
||||||
FILE * out;
|
FILE * out;
|
||||||
char *buf = NULL, keymap[PATH_MAX],xkm_output_dir[PATH_MAX];
|
char *buf = NULL, keymap[PATH_MAX], xkm_output_dir[PATH_MAX];
|
||||||
|
|
||||||
|
const char *emptystring = "";
|
||||||
|
const char *xkbbasedirflag = emptystring;
|
||||||
|
const char *xkbbindir = emptystring;
|
||||||
|
const char *xkbbindirsep = emptystring;
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
char tmpname[PATH_MAX];
|
/* WIN32 has no popen. The input must be stored in a file which is
|
||||||
|
used as input for xkbcomp. xkbcomp does not read from stdin. */
|
||||||
|
char tmpname[PATH_MAX];
|
||||||
|
const char *xkmfile = tmpname;
|
||||||
|
#else
|
||||||
|
const char *xkmfile = "-";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
snprintf(keymap, sizeof(keymap), "server-%s", display);
|
snprintf(keymap, sizeof(keymap), "server-%s", display);
|
||||||
|
|
||||||
XkbEnsureSafeMapName(keymap);
|
XkbEnsureSafeMapName(keymap);
|
||||||
OutputDirectory(xkm_output_dir, sizeof(xkm_output_dir));
|
OutputDirectory(xkm_output_dir, sizeof(xkm_output_dir));
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
strcpy(tmpname, Win32TempDir());
|
strcpy(tmpname, Win32TempDir());
|
||||||
strcat(tmpname, "\\xkb_XXXXXX");
|
strcat(tmpname, "\\xkb_XXXXXX");
|
||||||
(void) mktemp(tmpname);
|
(void) mktemp(tmpname);
|
||||||
#endif
|
#endif
|
||||||
if (XkbBaseDirectory!=NULL) {
|
|
||||||
#ifndef WIN32
|
|
||||||
char *xkmfile = "-";
|
|
||||||
#else
|
|
||||||
/* WIN32 has no popen. The input must be stored in a file which is used as input
|
|
||||||
for xkbcomp. xkbcomp does not read from stdin. */
|
|
||||||
char *xkmfile = tmpname;
|
|
||||||
#endif
|
|
||||||
char *xkbbasedir = XkbBaseDirectory;
|
|
||||||
char *xkbbindir = XkbBinDirectory;
|
|
||||||
|
|
||||||
buf = Xprintf(
|
if (XkbBaseDirectory != NULL) {
|
||||||
"\"%s" PATHSEPARATOR "xkbcomp\" -w %d \"-R%s\" -xkm \"%s\" -em1 %s -emp %s -eml %s \"%s%s.xkm\"",
|
xkbbasedirflag = Xprintf("\"-R%s\"", XkbBaseDirectory);
|
||||||
xkbbindir,
|
|
||||||
((xkbDebugFlags<2)?1:((xkbDebugFlags>10)?10:(int)xkbDebugFlags)),
|
|
||||||
xkbbasedir, xkmfile,
|
|
||||||
PRE_ERROR_MSG,ERROR_PREFIX,POST_ERROR_MSG1,
|
|
||||||
xkm_output_dir,keymap);
|
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
#ifndef WIN32
|
if (XkbBinDirectory != NULL) {
|
||||||
char *xkmfile = "-";
|
int ld = strlen(XkbBinDirectory);
|
||||||
#else
|
int lps = strlen(PATHSEPARATOR);
|
||||||
char *xkmfile = tmpname;
|
|
||||||
#endif
|
xkbbindir = XkbBinDirectory;
|
||||||
buf = Xprintf(
|
|
||||||
"xkbcomp -w %d -xkm \"%s\" -em1 %s -emp %s -eml %s \"%s%s.xkm\"",
|
if ((ld >= lps) &&
|
||||||
((xkbDebugFlags<2)?1:((xkbDebugFlags>10)?10:(int)xkbDebugFlags)),
|
(strcmp(xkbbindir + ld - lps, PATHSEPARATOR) != 0)) {
|
||||||
xkmfile,
|
xkbbindirsep = PATHSEPARATOR;
|
||||||
PRE_ERROR_MSG,ERROR_PREFIX,POST_ERROR_MSG1,
|
}
|
||||||
xkm_output_dir,keymap);
|
}
|
||||||
|
|
||||||
|
buf = Xprintf("\"%s%sxkbcomp\" -w %d %s -xkm \"%s\" "
|
||||||
|
"-em1 %s -emp %s -eml %s \"%s%s.xkm\"",
|
||||||
|
xkbbindir, xkbbindirsep,
|
||||||
|
( (xkbDebugFlags < 2) ? 1 :
|
||||||
|
((xkbDebugFlags > 10) ? 10 : (int)xkbDebugFlags) ),
|
||||||
|
xkbbasedirflag, xkmfile,
|
||||||
|
PRE_ERROR_MSG, ERROR_PREFIX, POST_ERROR_MSG1,
|
||||||
|
xkm_output_dir, keymap);
|
||||||
|
|
||||||
|
if (xkbbasedirflag != emptystring) {
|
||||||
|
xfree(xkbbasedirflag);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef WIN32
|
#ifndef WIN32
|
||||||
|
|
Loading…
Reference in New Issue