Merge branch 'master' into mpx

Conflicts:

	dix/devices.c
	dix/events.c
This commit is contained in:
Peter Hutterer 2007-04-27 16:34:36 +09:30
commit f28eea0647
58 changed files with 4281 additions and 1713 deletions

View File

@ -46,12 +46,13 @@ libglx_la_SOURCES = \
glxdrawable.h \ glxdrawable.h \
glxext.c \ glxext.c \
glxext.h \ glxext.h \
glxvisuals.c \ glxglcore.c \
glxscreens.c \ glxscreens.c \
glxscreens.h \ glxscreens.h \
glxserver.h \ glxserver.h \
glxutil.c \ glxutil.c \
glxutil.h \ glxutil.h \
glxvisuals.c \
indirect_dispatch.c \ indirect_dispatch.c \
indirect_dispatch.h \ indirect_dispatch.h \
indirect_dispatch_swap.c \ indirect_dispatch_swap.c \

View File

@ -40,9 +40,6 @@
** **
*/ */
/* XXX: should be defined somewhere globally */
#define CAPI
#include "GL/internal/glcore.h" #include "GL/internal/glcore.h"
typedef struct __GLXtextureFromPixmap __GLXtextureFromPixmap; typedef struct __GLXtextureFromPixmap __GLXtextureFromPixmap;

View File

@ -45,7 +45,6 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <glxdrawable.h> #include <glxdrawable.h>
#include <glxcontext.h> #include <glxcontext.h>
#include <glxutil.h> #include <glxutil.h>
#include "xmesaP.h"
#include "glcontextmodes.h" #include "glcontextmodes.h"
#include "os.h" #include "os.h"
@ -259,12 +258,14 @@ __glXMesaScreenDestroy(__GLXscreen *screen)
__GLXMESAscreen *mesaScreen = (__GLXMESAscreen *) screen; __GLXMESAscreen *mesaScreen = (__GLXMESAscreen *) screen;
int i; int i;
for (i = 0; i < mesaScreen->num_vis; i++) { if (mesaScreen->xm_vis) {
if (mesaScreen->xm_vis[i]) for (i = 0; i < mesaScreen->num_vis; i++) {
XMesaDestroyVisual(mesaScreen->xm_vis[i]); if (mesaScreen->xm_vis[i])
} XMesaDestroyVisual(mesaScreen->xm_vis[i]);
}
xfree(mesaScreen->xm_vis); xfree(mesaScreen->xm_vis);
}
__glXScreenDestroy(screen); __glXScreenDestroy(screen);

View File

@ -40,9 +40,6 @@
** **
*/ */
/* XXX: should be defined somewhere globally */
#define CAPI
#include "GL/internal/glcore.h" #include "GL/internal/glcore.h"
/* /*

View File

@ -370,6 +370,7 @@ __glGetBooleanv_size(GLenum e)
case GL_PROJECTION_STACK_DEPTH: case GL_PROJECTION_STACK_DEPTH:
case GL_TEXTURE_STACK_DEPTH: case GL_TEXTURE_STACK_DEPTH:
case GL_ATTRIB_STACK_DEPTH: case GL_ATTRIB_STACK_DEPTH:
case GL_CLIENT_ATTRIB_STACK_DEPTH:
case GL_ALPHA_TEST: case GL_ALPHA_TEST:
case GL_ALPHA_TEST_FUNC: case GL_ALPHA_TEST_FUNC:
case GL_ALPHA_TEST_REF: case GL_ALPHA_TEST_REF:
@ -448,6 +449,7 @@ __glGetBooleanv_size(GLenum e)
case GL_MAX_NAME_STACK_DEPTH: case GL_MAX_NAME_STACK_DEPTH:
case GL_MAX_PROJECTION_STACK_DEPTH: case GL_MAX_PROJECTION_STACK_DEPTH:
case GL_MAX_TEXTURE_STACK_DEPTH: case GL_MAX_TEXTURE_STACK_DEPTH:
case GL_MAX_CLIENT_ATTRIB_STACK_DEPTH:
case GL_SUBPIXEL_BITS: case GL_SUBPIXEL_BITS:
case GL_INDEX_BITS: case GL_INDEX_BITS:
case GL_RED_BITS: case GL_RED_BITS:

View File

@ -22,8 +22,6 @@ AM_CFLAGS = \
-DXFree86Server \ -DXFree86Server \
@GLX_DEFINES@ @GLX_DEFINES@
libX_la_SOURCES = xf86glx.c
nodist_libX_la_SOURCES = \ nodist_libX_la_SOURCES = \
xm_api.c \ xm_api.c \
xm_buffer.c \ xm_buffer.c \

View File

@ -61,10 +61,10 @@ nodist_libmain_la_SOURCES = accum.c \
matrix.c \ matrix.c \
mipmap.c \ mipmap.c \
mm.c \ mm.c \
occlude.c \
pixel.c \ pixel.c \
points.c \ points.c \
polygon.c \ polygon.c \
queryobj.c \
rastpos.c \ rastpos.c \
rbadaptors.c \ rbadaptors.c \
renderbuffer.c \ renderbuffer.c \

View File

@ -31,6 +31,7 @@ nodist_libslang_la_SOURCES = slang_builtin.c \
slang_library_noise.c \ slang_library_noise.c \
slang_link.c \ slang_link.c \
slang_log.c \ slang_log.c \
slang_mem.c \
slang_preprocess.c \ slang_preprocess.c \
slang_print.c \ slang_print.c \
slang_simplify.c \ slang_simplify.c \

View File

@ -21,8 +21,6 @@ INCLUDES = -I@MESA_SOURCE@/include \
nodist_libtnl_la_SOURCES = t_context.c \ nodist_libtnl_la_SOURCES = t_context.c \
t_draw.c \ t_draw.c \
t_pipeline.c \ t_pipeline.c \
t_vb_arbprogram.c \
t_vb_arbprogram_sse.c \
t_vb_cull.c \ t_vb_cull.c \
t_vb_fog.c \ t_vb_fog.c \
t_vb_light.c \ t_vb_light.c \

View File

@ -382,9 +382,9 @@ AC_DEFINE_UNQUOTED(OSNAME, "$OSNAME",
DEFAULT_VENDOR_NAME="The X.Org Foundation" DEFAULT_VENDOR_NAME="The X.Org Foundation"
DEFAULT_VENDOR_NAME_SHORT="X.Org" DEFAULT_VENDOR_NAME_SHORT="X.Org"
DEFAULT_VERSION_MAJOR=7 DEFAULT_VERSION_MAJOR=7
DEFAULT_VERSION_MINOR=1 DEFAULT_VERSION_MINOR=2
DEFAULT_VERSION_PATCH=99 DEFAULT_VERSION_PATCH=0
DEFAULT_VERSION_SNAP=2 DEFAULT_VERSION_SNAP=0
DEFAULT_RELEASE_DATE="21 December 2005" DEFAULT_RELEASE_DATE="21 December 2005"
DEFAULT_VENDOR_WEB="http://wiki.x.org" DEFAULT_VENDOR_WEB="http://wiki.x.org"
@ -628,7 +628,7 @@ XEXT_LIB='$(top_builddir)/Xext/libXext.la'
XEXTXORG_LIB='$(top_builddir)/Xext/libXextbuiltin.la' XEXTXORG_LIB='$(top_builddir)/Xext/libXextbuiltin.la'
dnl Core modules for most extensions, et al. dnl Core modules for most extensions, et al.
REQUIRED_MODULES="[randrproto >= 1.2] renderproto [fixesproto >= 4.0] [damageproto >= 1.1] xcmiscproto xextproto xproto xtrans [scrnsaverproto >= 1.1] bigreqsproto resourceproto fontsproto [inputproto >= 1.4] [kbproto >= 1.0.3]" REQUIRED_MODULES="[randrproto >= 1.2] renderproto [fixesproto >= 4.0] [damageproto >= 1.1] xcmiscproto xextproto xproto xtrans [scrnsaverproto >= 1.1] bigreqsproto resourceproto fontsproto [inputproto >= 1.4.2] [kbproto >= 1.0.3]"
REQUIRED_LIBS="xfont xau fontenc" REQUIRED_LIBS="xfont xau fontenc"
if test "x$DBUS" = xauto; then if test "x$DBUS" = xauto; then
@ -986,7 +986,6 @@ else
fi fi
CWRAP_LIB='$(top_builddir)/os/libcwrapper.la' CWRAP_LIB='$(top_builddir)/os/libcwrapper.la'
MI_LIB='$(top_builddir)/mi/libmi.la' MI_LIB='$(top_builddir)/mi/libmi.la'
MINIMI_LIB='$(top_builddir)/mi/libminimi.la'
MI_EXT_LIB='$(top_builddir)/mi/libmiext.la' MI_EXT_LIB='$(top_builddir)/mi/libmiext.la'
MI_INC='-I$(top_srcdir)/mi' MI_INC='-I$(top_srcdir)/mi'
FB_LIB='$(top_builddir)/fb/libfb.la' FB_LIB='$(top_builddir)/fb/libfb.la'

View File

@ -75,6 +75,7 @@ SOFTWARE.
#include "swaprep.h" #include "swaprep.h"
#include "dixevents.h" #include "dixevents.h"
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h> #include <X11/extensions/XIproto.h>
#include "exglobals.h" #include "exglobals.h"
#include "exevents.h" #include "exevents.h"
@ -189,6 +190,8 @@ EnableDevice(DeviceIntPtr dev)
{ {
DeviceIntPtr *prev; DeviceIntPtr *prev;
int ret; int ret;
DeviceIntRec dummyDev;
devicePresenceNotify ev;
for (prev = &inputInfo.off_devices; for (prev = &inputInfo.off_devices;
*prev && (*prev != dev); *prev && (*prev != dev);
@ -215,6 +218,14 @@ EnableDevice(DeviceIntPtr dev)
*prev = dev; *prev = dev;
dev->next = NULL; dev->next = NULL;
ev.type = DevicePresenceNotify;
ev.time = currentTime.milliseconds;
ev.devchange = DeviceEnabled;
ev.deviceid = dev->id;
dummyDev.id = 0;
SendEventToAllWindows(&dummyDev, DevicePresenceNotifyMask,
(xEvent *) &ev, 1);
return TRUE; return TRUE;
} }
@ -225,6 +236,8 @@ Bool
DisableDevice(DeviceIntPtr dev) DisableDevice(DeviceIntPtr dev)
{ {
DeviceIntPtr *prev; DeviceIntPtr *prev;
DeviceIntRec dummyDev;
devicePresenceNotify ev;
for (prev = &inputInfo.devices; for (prev = &inputInfo.devices;
*prev && (*prev != dev); *prev && (*prev != dev);
@ -237,6 +250,15 @@ DisableDevice(DeviceIntPtr dev)
*prev = dev->next; *prev = dev->next;
dev->next = inputInfo.off_devices; dev->next = inputInfo.off_devices;
inputInfo.off_devices = dev; inputInfo.off_devices = dev;
ev.type = DevicePresenceNotify;
ev.time = currentTime.milliseconds;
ev.devchange = DeviceDisabled;
ev.deviceid = dev->id;
dummyDev.id = 0;
SendEventToAllWindows(&dummyDev, DevicePresenceNotifyMask,
(xEvent *) &ev, 1);
return TRUE; return TRUE;
} }
@ -266,8 +288,8 @@ ActivateDevice(DeviceIntPtr dev)
ev.type = DevicePresenceNotify; ev.type = DevicePresenceNotify;
ev.time = currentTime.milliseconds; ev.time = currentTime.milliseconds;
ev.devchange = 0; ev.devchange = DeviceAdded;
ev.deviceid = 0; ev.deviceid = dev->id;
dummyDev.id = 0; dummyDev.id = 0;
SendEventToAllWindows(&dummyDev, DevicePresenceNotifyMask, SendEventToAllWindows(&dummyDev, DevicePresenceNotifyMask,
(xEvent *) &ev, 1); (xEvent *) &ev, 1);
@ -694,6 +716,7 @@ RemoveDevice(DeviceIntPtr dev)
devicePresenceNotify ev; devicePresenceNotify ev;
DeviceIntRec dummyDev; DeviceIntRec dummyDev;
ScreenPtr screen = screenInfo.screens[0]; ScreenPtr screen = screenInfo.screens[0];
int deviceid;
DebugF("(dix) removing device %d\n", dev->id); DebugF("(dix) removing device %d\n", dev->id);
@ -702,6 +725,9 @@ RemoveDevice(DeviceIntPtr dev)
screen->UndisplayCursor(dev, screen); screen->UndisplayCursor(dev, screen);
deviceid = dev->id;
DisableDevice(dev);
prev = NULL; prev = NULL;
for (tmp = inputInfo.devices; tmp; (prev = tmp), (tmp = next)) { for (tmp = inputInfo.devices; tmp; (prev = tmp), (tmp = next)) {
next = tmp->next; next = tmp->next;
@ -736,8 +762,8 @@ RemoveDevice(DeviceIntPtr dev)
inputInfo.numDevices--; inputInfo.numDevices--;
ev.type = DevicePresenceNotify; ev.type = DevicePresenceNotify;
ev.time = currentTime.milliseconds; ev.time = currentTime.milliseconds;
ev.devchange = 0; ev.devchange = DeviceRemoved;
ev.deviceid = 0; ev.deviceid = deviceid;
dummyDev.id = 0; dummyDev.id = 0;
SendEventToAllWindows(&dummyDev, DevicePresenceNotifyMask, SendEventToAllWindows(&dummyDev, DevicePresenceNotifyMask,
(xEvent *) &ev, 1); (xEvent *) &ev, 1);
@ -1391,6 +1417,7 @@ DoSetModifierMapping(ClientPtr client, KeyCode *inputMap,
} }
else { else {
pDev->key->modifierKeyMap = NULL; pDev->key->modifierKeyMap = NULL;
pDev->key->maxKeysPerModifier = 0;
} }
} }
} }

View File

@ -113,6 +113,10 @@ of the copyright holder.
* Author: Peter Hutterer <peter@cs.unisa.edu.au> * Author: Peter Hutterer <peter@cs.unisa.edu.au>
*/ */
/** @file
* This file handles event delivery and a big part of the server-side protocol
* handling (the parts for input devices).
*/
#ifdef HAVE_DIX_CONFIG_H #ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h> #include <dix-config.h>
@ -174,7 +178,9 @@ static xEvent *xeviexE;
#include "dixevents.h" #include "dixevents.h"
#include "dixgrabs.h" #include "dixgrabs.h"
#include "dispatch.h" #include "dispatch.h"
/**
* Extension events type numbering starts at EXTENSION_EVENT_BASE.
*/
#define EXTENSION_EVENT_BASE 64 #define EXTENSION_EVENT_BASE 64
#define NoSuchEvent 0x80000000 /* so doesn't match NoEventMask */ #define NoSuchEvent 0x80000000 /* so doesn't match NoEventMask */
@ -220,6 +226,28 @@ _X_EXPORT CallbackListPtr DeviceEventCallback;
Mask DontPropagateMasks[DNPMCOUNT]; Mask DontPropagateMasks[DNPMCOUNT];
static int DontPropagateRefCnts[DNPMCOUNT]; static int DontPropagateRefCnts[DNPMCOUNT];
/**
* Main input device struct.
* inputInfo.pointer
* is the core pointer. Referred to as "virtual core pointer", "VCP",
* "core pointer" or inputInfo.pointer. There is exactly one core pointer,
* but multiple devices may send core events. If a device generates core
* events, those events will appear to originate from the core pointer.
*
* inputInfo.keyboard
* is the core keyboard ("virtual core keyboard", "VCK", "core keyboard").
* See inputInfo.pointer.
*
* inputInfo.devices
* linked list containing all devices including VCK and VCP. The VCK will
* always be the first entry, the VCP the second entry in the device list.
*
* inputInfo.off_devices
* Devices that have not been initialized and are thus turned off.
*
* inputInfo.numDevices
* Total number of devices.
*/
_X_EXPORT InputInfo inputInfo; _X_EXPORT InputInfo inputInfo;
static struct { static struct {
@ -262,7 +290,6 @@ IsKeyboardDevice(DeviceIntPtr dev)
return ((dev->key && dev->kbdfeed) || dev == inputInfo.keyboard); return ((dev->key && dev->kbdfeed) || dev == inputInfo.keyboard);
} }
#ifdef XEVIE #ifdef XEVIE
_X_EXPORT WindowPtr xeviewin; _X_EXPORT WindowPtr xeviewin;
_X_EXPORT HotSpot xeviehot; _X_EXPORT HotSpot xeviehot;
@ -281,6 +308,9 @@ static WindowPtr XYToWindow(
int y int y
); );
/**
* Max event opcode.
*/
extern int lastEvent; extern int lastEvent;
static Mask lastEventMask; static Mask lastEventMask;
@ -890,6 +920,13 @@ PointerConfinedToScreen(DeviceIntPtr pDev)
return pDev->spriteInfo->sprite->confined; return pDev->spriteInfo->sprite->confined;
} }
/**
* Update the sprite cursor to the given cursor.
*
* ChangeToCursor() will display the new cursor and free the old cursor (if
* applicable). If the provided cursor is already the updated cursor, nothing
* happens.
*/
static void static void
ChangeToCursor(DeviceIntPtr pDev, CursorPtr cursor) ChangeToCursor(DeviceIntPtr pDev, CursorPtr cursor)
{ {
@ -917,7 +954,9 @@ ChangeToCursor(DeviceIntPtr pDev, CursorPtr cursor)
} }
} }
/* returns true if b is a descendent of a */ /**
* @returns true if b is a descendent of a
*/
Bool Bool
IsParent(WindowPtr a, WindowPtr b) IsParent(WindowPtr a, WindowPtr b)
{ {
@ -926,6 +965,11 @@ IsParent(WindowPtr a, WindowPtr b)
return FALSE; return FALSE;
} }
/**
* Update the cursor displayed on the screen.
*
* Called whenever a cursor may have changed shape or position.
*/
static void static void
PostNewCursor(DeviceIntPtr pDev) PostNewCursor(DeviceIntPtr pDev)
{ {
@ -977,18 +1021,27 @@ GetCurrentRootWindow(DeviceIntPtr dev)
return RootWindow(dev); return RootWindow(dev);
} }
/**
* @return window underneath the cursor sprite.
*/
_X_EXPORT WindowPtr _X_EXPORT WindowPtr
GetSpriteWindow(DeviceIntPtr pDev) GetSpriteWindow(DeviceIntPtr pDev)
{ {
return pDev->spriteInfo->sprite->win; return pDev->spriteInfo->sprite->win;
} }
/**
* @return current sprite cursor.
*/
_X_EXPORT CursorPtr _X_EXPORT CursorPtr
GetSpriteCursor(DeviceIntPtr pDev) GetSpriteCursor(DeviceIntPtr pDev)
{ {
return pDev->spriteInfo->sprite->current; return pDev->spriteInfo->sprite->current;
} }
/**
* Set x/y current sprite position in screen coordinates.
*/
_X_EXPORT void _X_EXPORT void
GetSpritePosition(DeviceIntPtr pDev, int *px, int *py) GetSpritePosition(DeviceIntPtr pDev, int *px, int *py)
{ {
@ -1315,6 +1368,19 @@ CheckGrabForSyncs(DeviceIntPtr thisDev, Bool thisMode, Bool otherMode)
ComputeFreezes(); ComputeFreezes();
} }
/**
* Activate a pointer grab on the given device. A pointer grab will cause all
* core pointer events to be delivered to the grabbing client only. Can cause
* the cursor to change if a grab cursor is set.
*
* As a pointer grab can only be issued on the core devices, mouse is always
* inputInfo.pointer. Extension devices are set up for ActivateKeyboardGrab().
*
* @param mouse The device to grab.
* @param grab The grab structure, needs to be setup.
* @param autoGrab True if the grab was caused by a button down event and not
* explicitely by a client.
*/
void void
ActivatePointerGrab(DeviceIntPtr mouse, GrabPtr grab, ActivatePointerGrab(DeviceIntPtr mouse, GrabPtr grab,
TimeStamp time, Bool autoGrab) TimeStamp time, Bool autoGrab)
@ -1346,6 +1412,12 @@ ActivatePointerGrab(DeviceIntPtr mouse, GrabPtr grab,
CheckGrabForSyncs(mouse,(Bool)grab->pointerMode, (Bool)grab->keyboardMode); CheckGrabForSyncs(mouse,(Bool)grab->pointerMode, (Bool)grab->keyboardMode);
} }
/**
* Delete grab on given device, update the sprite.
*
* As a pointer grab can only be issued on the core devices, mouse is always
* inputInfo.pointer. Extension devices are set up for ActivateKeyboardGrab().
*/
void void
DeactivatePointerGrab(DeviceIntPtr mouse) DeactivatePointerGrab(DeviceIntPtr mouse)
{ {
@ -1371,6 +1443,11 @@ DeactivatePointerGrab(DeviceIntPtr mouse)
ComputeFreezes(); ComputeFreezes();
} }
/**
* Activate a keyboard grab on the given device.
*
* Extension devices have ActivateKeyboardGrab() set as their grabbing proc.
*/
void void
ActivateKeyboardGrab(DeviceIntPtr keybd, GrabPtr grab, TimeStamp time, Bool passive) ActivateKeyboardGrab(DeviceIntPtr keybd, GrabPtr grab, TimeStamp time, Bool passive)
{ {
@ -1397,6 +1474,9 @@ ActivateKeyboardGrab(DeviceIntPtr keybd, GrabPtr grab, TimeStamp time, Bool pass
CheckGrabForSyncs(keybd, (Bool)grab->keyboardMode, (Bool)grab->pointerMode); CheckGrabForSyncs(keybd, (Bool)grab->keyboardMode, (Bool)grab->pointerMode);
} }
/**
* Delete keyboard grab for the given device.
*/
void void
DeactivateKeyboardGrab(DeviceIntPtr keybd) DeactivateKeyboardGrab(DeviceIntPtr keybd)
{ {
@ -1550,6 +1630,11 @@ AllowSome(ClientPtr client,
} }
} }
/**
* Server-side protocol handling for AllowEvents request.
*
* Release some events from a frozen device. Only applicable for core devices.
*/
int int
ProcAllowEvents(ClientPtr client) ProcAllowEvents(ClientPtr client)
{ {
@ -1593,6 +1678,9 @@ ProcAllowEvents(ClientPtr client)
return Success; return Success;
} }
/**
* Deactivate grabs from any device that has been grabbed by the client.
*/
void void
ReleaseActiveGrabs(ClientPtr client) ReleaseActiveGrabs(ClientPtr client)
{ {
@ -1625,6 +1713,30 @@ ReleaseActiveGrabs(ClientPtr client)
* The following procedures deal with delivering events * * The following procedures deal with delivering events *
**************************************************************************/ **************************************************************************/
/**
* Deliver the given events to the given client.
*
* More than one event may be delivered at a time. This is the case with
* DeviceMotionNotifies which may be followed by DeviceValuator events.
*
* TryClientEvents() is the last station before actually writing the events to
* the socket. Anything that is not filtered here, will get delivered to the
* client.
* An event is only delivered if
* - mask and filter match up.
* - no other client has a grab on the device that caused the event.
*
*
* @param client The target client to deliver to.
* @param pEvents The events to be delivered.
* @param count Number of elements in pEvents.
* @param mask Event mask as set by the window.
* @param filter Mask based on event type.
* @param grab Possible grab on the device that caused the event.
*
* @return 1 if event was delivered, 0 if not or -1 if grab was not set by the
* client.
*/
_X_EXPORT int _X_EXPORT int
TryClientEvents (ClientPtr client, xEvent *pEvents, int count, Mask mask, TryClientEvents (ClientPtr client, xEvent *pEvents, int count, Mask mask,
Mask filter, GrabPtr grab) Mask filter, GrabPtr grab)
@ -1703,6 +1815,23 @@ TryClientEvents (ClientPtr client, xEvent *pEvents, int count, Mask mask,
} }
} }
/**
* Deliver events to a window. At this point, we do not yet know if the event
* actually needs to be delivered. May activate a grab if the event is a
* button press.
*
* More than one event may be delivered at a time. This is the case with
* DeviceMotionNotifies which may be followed by DeviceValuator events.
*
* @param pWin The window that would get the event.
* @param pEvents The events to be delivered.
* @param count Number of elements in pEvents.
* @param filter Mask based on event type.
* @param grab Possible grab on the device that caused the event.
* @param mskidx Mask index, depending on device that caused event.
*
* @return Number of events delivered to various clients.
*/
int int
DeliverEventsToWindow(DeviceIntPtr pDev, WindowPtr pWin, xEvent DeliverEventsToWindow(DeviceIntPtr pDev, WindowPtr pWin, xEvent
*pEvents, int count, Mask filter, GrabPtr grab, int mskidx) *pEvents, int count, Mask filter, GrabPtr grab, int mskidx)
@ -1838,6 +1967,15 @@ XineramaTryClientEventsResult(
} }
#endif #endif
/**
* Try to deliver events to the interested parties.
*
* @param pWin The window that would get the event.
* @param pEvents The events to be delivered.
* @param count Number of elements in pEvents.
* @param filter Mask based on event type.
* @param dontClient Don't deliver to the dontClient.
*/
int int
MaybeDeliverEventsToClient(WindowPtr pWin, xEvent *pEvents, MaybeDeliverEventsToClient(WindowPtr pWin, xEvent *pEvents,
int count, Mask filter, ClientPtr dontClient) int count, Mask filter, ClientPtr dontClient)
@ -1875,6 +2013,14 @@ MaybeDeliverEventsToClient(WindowPtr pWin, xEvent *pEvents,
return 2; return 2;
} }
/**
* Adjust event fields to comply with the window properties.
*
* @param xE Event to be modified in place
* @param pWin The window to get the information from.
* @param child Child window setting for event (if applicable)
* @param calcChild If True, calculate the child window.
*/
static void static void
FixUpEventFromWindow( FixUpEventFromWindow(
DeviceIntPtr pDev, DeviceIntPtr pDev,
@ -1932,6 +2078,22 @@ FixUpEventFromWindow(
} }
} }
/**
* Deliver events caused by input devices. Called for all core input events
* and XI events. No filtering of events happens before DeliverDeviceEvents(),
* it will be called for any event that comes out of the event queue.
*
* For all core events, dev is either inputInfo.pointer or inputInfo.keyboard.
* For all extension events, dev is the device that caused the event.
*
* @param pWin Window to deliver event to.
* @param xE Events to deliver.
* @param grab Possible grab on a device.
* @param stopAt Don't recurse up to the root window.
* @param dev The device that is responsible for the event.
* @param count number of events in xE.
*
*/
int int
DeliverDeviceEvents(WindowPtr pWin, xEvent *xE, GrabPtr grab, DeliverDeviceEvents(WindowPtr pWin, xEvent *xE, GrabPtr grab,
WindowPtr stopAt, DeviceIntPtr dev, int count) WindowPtr stopAt, DeviceIntPtr dev, int count)
@ -1995,7 +2157,19 @@ DeliverDeviceEvents(WindowPtr pWin, xEvent *xE, GrabPtr grab,
return 0; return 0;
} }
/* not useful for events that propagate up the tree or extension events */ /**
* Deliver event to a window and it's immediate parent. Used for most window
* events (CreateNotify, ConfigureNotify, etc.). Not useful for events that
* propagate up the tree or extension events
*
* In case of a ReparentNotify event, the event will be delivered to the
* otherParent as well.
*
* @param pWin Window to deliver events to.
* @param xE Events to deliver.
* @param count number of events in xE.
* @param otherParent Used for ReparentNotify events.
*/
_X_EXPORT int _X_EXPORT int
DeliverEvents(WindowPtr pWin, xEvent *xE, int count, DeliverEvents(WindowPtr pWin, xEvent *xE, int count,
WindowPtr otherParent) WindowPtr otherParent)
@ -2062,6 +2236,17 @@ PointInBorderSize(WindowPtr pWin, int x, int y)
return FALSE; return FALSE;
} }
/**
* Traversed from the root window to the window at the position x/y. While
* traversing, it sets up the traversal history in the spriteTrace array.
* After completing, the spriteTrace history is set in the following way:
* spriteTrace[0] ... root window
* spriteTrace[1] ... top level window that encloses x/y
* ...
* spriteTrace[spriteTraceGood - 1] ... window at x/y
*
* @returns the window at the given coordinates.
*/
static WindowPtr static WindowPtr
XYToWindow(DeviceIntPtr pDev, int x, int y) XYToWindow(DeviceIntPtr pDev, int x, int y)
{ {
@ -2113,6 +2298,12 @@ XYToWindow(DeviceIntPtr pDev, int x, int y)
return pSprite->spriteTrace[pSprite->spriteTraceGood-1]; return pSprite->spriteTrace[pSprite->spriteTraceGood-1];
} }
/**
* Update the sprite coordinates based on the event. Update the cursor
* position, then update the event with the new coordinates that may have been
* changed. If the window underneath the sprite has changed, change to new
* cursor and send enter/leave events.
*/
Bool Bool
CheckMotion(xEvent *xE, DeviceIntPtr pDev) CheckMotion(xEvent *xE, DeviceIntPtr pDev)
{ {
@ -2191,6 +2382,10 @@ CheckMotion(xEvent *xE, DeviceIntPtr pDev)
return TRUE; return TRUE;
} }
/**
* Windows have restructured, we need to update the sprite position and the
* sprite's cursor.
*/
_X_EXPORT void _X_EXPORT void
WindowsRestructured(void) WindowsRestructured(void)
{ {
@ -2257,6 +2452,10 @@ void ReinitializeRootWindow(WindowPtr win, int xoff, int yoff)
} }
#endif #endif
/**
* Set the given window to sane values, display the cursor in the center of
* the screen. Called from main() with the root window on the first screen.
*/
void void
DefineInitialRootWindow(WindowPtr win) DefineInitialRootWindow(WindowPtr win)
{ {
@ -2537,6 +2736,10 @@ XineramaWarpPointer(ClientPtr client)
#endif #endif
/**
* Server-side protocol handling for WarpPointer request.
* Warps the cursor position to the coordinates given in the request.
*/
int int
ProcWarpPointer(ClientPtr client) ProcWarpPointer(ClientPtr client)
{ {
@ -2648,8 +2851,15 @@ BorderSizeNotEmpty(DeviceIntPtr pDev, WindowPtr pWin)
return FALSE; return FALSE;
} }
/* "CheckPassiveGrabsOnWindow" checks to see if the event passed in causes a /**
passive grab set on the window to be activated. */ * "CheckPassiveGrabsOnWindow" checks to see if the event passed in causes a
* passive grab set on the window to be activated.
*
* @param pWin The window that may be subject to a passive grab.
* @param device Device that caused the event.
* @param xE List of events (multiple ones for DeviceMotionNotify)
* @count number of elements in xE.
*/
static Bool static Bool
CheckPassiveGrabsOnWindow( CheckPassiveGrabsOnWindow(
@ -2803,6 +3013,16 @@ CheckDeviceGrabs(DeviceIntPtr device, xEvent *xE,
return FALSE; return FALSE;
} }
/**
* Called for keyboard events to deliver event to whatever client owns the
* focus. Event is delivered to the keyboard's focus window, the root window
* or to the window owning the input focus.
*
* @param keybd The keyboard originating the event.
* @param xE The event list.
* @param window Window underneath the sprite.
* @param count number of events in xE.
*/
void void
DeliverFocusedEvent(DeviceIntPtr keybd, xEvent *xE, WindowPtr window, int count) DeliverFocusedEvent(DeviceIntPtr keybd, xEvent *xE, WindowPtr window, int count)
{ {
@ -2834,6 +3054,13 @@ DeliverFocusedEvent(DeviceIntPtr keybd, xEvent *xE, WindowPtr window, int count)
NullGrab, mskidx); NullGrab, mskidx);
} }
/**
* Deliver an event from a device that is currently grabbed. Uses
* DeliverDeviceEvents() for further delivery if a ownerEvents is set on the
* grab. If not, TryClientEvents() is used.
*
* @param deactivateGrab True if the device's grab should be deactivated.
*/
void void
DeliverGrabbedEvent(xEvent *xE, DeviceIntPtr thisDev, DeliverGrabbedEvent(xEvent *xE, DeviceIntPtr thisDev,
Bool deactivateGrab, int count) Bool deactivateGrab, int count)
@ -2930,6 +3157,17 @@ DeliverGrabbedEvent(xEvent *xE, DeviceIntPtr thisDev,
} }
} }
/**
* Main keyboard event processing function for core keyboard events.
* Updates the events fields from the current pointer state and delivers the
* event.
*
* For key events, xE will always be a single event.
*
* @param xE Event list
* @param keybd The device that caused an event.
* @param count Number of elements in xE.
*/
void void
#ifdef XKB #ifdef XKB
CoreProcessKeyboardEvent (xEvent *xE, DeviceIntPtr keybd, int count) CoreProcessKeyboardEvent (xEvent *xE, DeviceIntPtr keybd, int count)
@ -3133,6 +3371,18 @@ FixKeyState (xEvent *xE, DeviceIntPtr keybd)
} }
#endif #endif
/**
* Main pointer event processing function for core pointer events.
* For motion events: update the sprite.
* For all other events: Update the event fields based on the current sprite
* state.
*
* For core pointer events, xE will always be a single event.
*
* @param xE Event list
* @param mouse The device that caused an event.
* @param count Number of elements in xE.
*/
void void
#ifdef XKB #ifdef XKB
CoreProcessPointerEvent (xEvent *xE, DeviceIntPtr mouse, int count) CoreProcessPointerEvent (xEvent *xE, DeviceIntPtr mouse, int count)
@ -3248,6 +3498,18 @@ ProcessPointerEvent (xEvent *xE, DeviceIntPtr mouse, int count)
#define AtMostOneClient \ #define AtMostOneClient \
(SubstructureRedirectMask | ResizeRedirectMask | ButtonPressMask) (SubstructureRedirectMask | ResizeRedirectMask | ButtonPressMask)
/**
* Recalculate which events may be deliverable for the given window.
* Recalculated mask is used for quicker determination which events may be
* delivered to a window.
*
* The otherEventMasks on a WindowOptional is the combination of all event
* masks set by all clients on the window.
* deliverableEventMask is the combination of the eventMask and the
* otherEventMask.
*
* Traverses to siblings and parents of the window.
*/
void void
RecalculateDeliverableEvents(pWin) RecalculateDeliverableEvents(pWin)
WindowPtr pWin; WindowPtr pWin;
@ -3446,6 +3708,9 @@ EventSuppressForWindow(WindowPtr pWin, ClientPtr client,
return Success; return Success;
} }
/**
* @return The window that is the first ancestor of both a and b.
*/
static WindowPtr static WindowPtr
CommonAncestor( CommonAncestor(
WindowPtr a, WindowPtr a,
@ -3456,6 +3721,10 @@ CommonAncestor(
return NullWindow; return NullWindow;
} }
/**
* Assembles an EnterNotify or LeaveNotify and sends it event to the client.
* The core devices are used to fill in the event fields.
*/
static void static void
EnterLeaveEvent( EnterLeaveEvent(
DeviceIntPtr mouse, DeviceIntPtr mouse,
@ -3610,6 +3879,10 @@ EnterLeaveEvent(
} }
} }
/**
* Send enter notifies to all parent windows up to ancestor.
* This function recurses.
*/
static void static void
EnterNotifies(DeviceIntPtr pDev, EnterNotifies(DeviceIntPtr pDev,
WindowPtr ancestor, WindowPtr ancestor,
@ -3625,6 +3898,11 @@ EnterNotifies(DeviceIntPtr pDev,
EnterLeaveEvent(pDev, EnterNotify, mode, detail, parent, EnterLeaveEvent(pDev, EnterNotify, mode, detail, parent,
child->drawable.id); } child->drawable.id); }
/**
* Send leave notifies to all parent windows up to ancestor.
* This function recurses.
*/
static void static void
LeaveNotifies(DeviceIntPtr pDev, LeaveNotifies(DeviceIntPtr pDev,
WindowPtr child, WindowPtr child,
@ -3644,6 +3922,13 @@ LeaveNotifies(DeviceIntPtr pDev,
} }
} }
/**
* 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 static void
DoEnterLeaveEvents(DeviceIntPtr pDev, DoEnterLeaveEvents(DeviceIntPtr pDev,
WindowPtr fromWin, WindowPtr fromWin,
@ -3933,6 +4218,23 @@ DoFocusEvents(DeviceIntPtr dev, WindowPtr fromWin, WindowPtr toWin, int mode)
} }
} }
/**
* Set the input focus to the given window. Subsequent keyboard events will be
* delivered to the given window.
*
* Usually called from ProcSetInputFocus as result of a client request. If so,
* the device is the inputInfo.keyboard.
* If called from ProcXSetInputFocus as result of a client xinput request, the
* device is set to the device specified by the client.
*
* @param client Client that requested input focus change.
* @param dev Focus device.
* @param focusID The window to obtain the focus. Can be PointerRoot or None.
* @param revertTo Specifies where the focus reverts to when window becomes
* unviewable.
* @param ctime Specifies the time.
* @param followOK True if pointer is allowed to follow the keyboard.
*/
int int
SetInputFocus( SetInputFocus(
ClientPtr client, ClientPtr client,
@ -4023,6 +4325,11 @@ SetInputFocus(
return Success; return Success;
} }
/**
* Server-side protocol handling for SetInputFocus request.
*
* Sets the input focus for the virtual core keyboard.
*/
int int
ProcSetInputFocus(client) ProcSetInputFocus(client)
ClientPtr client; ClientPtr client;
@ -4039,6 +4346,12 @@ ProcSetInputFocus(client)
stuff->revertTo, stuff->time, FALSE); stuff->revertTo, stuff->time, FALSE);
} }
/**
* Server-side protocol handling for GetInputFocus request.
*
* Sends the current input focus for the virtual core keyboard back to the
* client.
*/
int int
ProcGetInputFocus(ClientPtr client) ProcGetInputFocus(ClientPtr client)
{ {
@ -4061,6 +4374,12 @@ ProcGetInputFocus(ClientPtr client)
return Success; return Success;
} }
/**
* Server-side protocol handling for Grabpointer request.
*
* Sets an active grab on the inputInfo.pointer and returns success status to
* client.
*/
int int
ProcGrabPointer(ClientPtr client) ProcGrabPointer(ClientPtr client)
{ {
@ -4171,6 +4490,14 @@ ProcGrabPointer(ClientPtr client)
return Success; return Success;
} }
/**
* Server-side protocol handling for ChangeActivePointerGrab request.
*
* Changes properties of the grab hold by the client. If the client does not
* hold an active grab on the device, nothing happens.
*
* Works on the core pointer only.
*/
int int
ProcChangeActivePointerGrab(ClientPtr client) ProcChangeActivePointerGrab(ClientPtr client)
{ {
@ -4217,6 +4544,11 @@ ProcChangeActivePointerGrab(ClientPtr client)
return Success; return Success;
} }
/**
* Server-side protocol handling for UngrabPointer request.
*
* Deletes the pointer grab on the core pointer device.
*/
int int
ProcUngrabPointer(ClientPtr client) ProcUngrabPointer(ClientPtr client)
{ {
@ -4236,6 +4568,24 @@ ProcUngrabPointer(ClientPtr client)
return Success; return Success;
} }
/**
* Sets a grab on the given device.
*
* Called from ProcGrabKeyboard to work on the inputInfo.keyboard.
* Called from ProcXGrabDevice to work on the device specified by the client.
*
* The parameters this_mode and other_mode represent the keyboard_mode and
* pointer_mode parameters of XGrabKeyboard().
* See man page for details on all the parameters
*
* @param client Client that owns the grab.
* @param dev The device to grab.
* @param this_mode GrabModeSync or GrabModeAsync
* @param other_mode GrabModeSync or GrabModeAsync
* @param status Return code to be returned to the caller.
*
* @returns Success or BadValue.
*/
int int
GrabDevice(ClientPtr client, DeviceIntPtr dev, GrabDevice(ClientPtr client, DeviceIntPtr dev,
unsigned this_mode, unsigned other_mode, Window grabWindow, unsigned this_mode, unsigned other_mode, Window grabWindow,
@ -4301,6 +4651,11 @@ GrabDevice(ClientPtr client, DeviceIntPtr dev,
return Success; return Success;
} }
/**
* Server-side protocol handling for GrabKeyboard request.
*
* Grabs the inputInfo.keyboad and returns success status to client.
*/
int int
ProcGrabKeyboard(ClientPtr client) ProcGrabKeyboard(ClientPtr client)
{ {
@ -4330,6 +4685,11 @@ ProcGrabKeyboard(ClientPtr client)
return Success; return Success;
} }
/**
* Server-side protocol handling for UngrabKeyboard request.
*
* Deletes a possible grab on the inputInfo.keyboard.
*/
int int
ProcUngrabKeyboard(ClientPtr client) ProcUngrabKeyboard(ClientPtr client)
{ {
@ -4349,6 +4709,11 @@ ProcUngrabKeyboard(ClientPtr client)
return Success; return Success;
} }
/**
* Server-side protocol handling for QueryPointer request.
*
* Returns the current state and position of the core pointer to the client.
*/
int int
ProcQueryPointer(ClientPtr client) ProcQueryPointer(ClientPtr client)
{ {
@ -4409,6 +4774,10 @@ ProcQueryPointer(ClientPtr client)
return(Success); return(Success);
} }
/**
* Initializes the device list and the DIX sprite to sane values. Allocates
* trace memory used for quick window traversal.
*/
void void
InitEvents(void) InitEvents(void)
{ {
@ -4457,6 +4826,11 @@ CloseDownEvents(void)
} }
/**
* Server-side protocol handling for SendEvent request.
*
* Locates the window to send the event to and forwards the event.
*/
int int
ProcSendEvent(ClientPtr client) ProcSendEvent(ClientPtr client)
{ {
@ -4545,6 +4919,12 @@ ProcSendEvent(ClientPtr client)
return Success; return Success;
} }
/**
* Server-side protocol handling for UngrabKey request.
*
* Deletes a passive grab for the given key. Only works on the
* inputInfo.keyboard.
*/
int int
ProcUngrabKey(ClientPtr client) ProcUngrabKey(ClientPtr client)
{ {
@ -4587,6 +4967,12 @@ ProcUngrabKey(ClientPtr client)
return(Success); return(Success);
} }
/**
* Server-side protocol handling for GrabKey request.
*
* Creates a grab for the inputInfo.keyboard and adds it to the list of
* passive grabs.
*/
int int
ProcGrabKey(ClientPtr client) ProcGrabKey(ClientPtr client)
{ {
@ -4642,6 +5028,12 @@ ProcGrabKey(ClientPtr client)
} }
/**
* Server-side protocol handling for GrabButton request.
*
* Creates a grab for the inputInfo.pointer and adds it as a passive grab to
* the list.
*/
int int
ProcGrabButton(ClientPtr client) ProcGrabButton(ClientPtr client)
{ {
@ -4715,6 +5107,11 @@ ProcGrabButton(ClientPtr client)
return AddPassiveGrabToList(grab); return AddPassiveGrabToList(grab);
} }
/**
* Server-side protocol handling for UngrabButton request.
*
* Deletes a passive grab on the inputInfo.pointer from the list.
*/
int int
ProcUngrabButton(ClientPtr client) ProcUngrabButton(ClientPtr client)
{ {
@ -4748,6 +5145,17 @@ ProcUngrabButton(ClientPtr client)
return(Success); return(Success);
} }
/**
* Deactivate any grab that may be on the window, remove the focus.
* Delete any XInput extension events from the window too. Does not change the
* window mask. Use just before the window is deleted.
*
* If freeResources is set, passive grabs on the window are deleted.
*
* @param pWin The window to delete events from.
* @param freeResources True if resources associated with the window should be
* deleted.
*/
void void
DeleteWindowFromAnyEvents(WindowPtr pWin, Bool freeResources) DeleteWindowFromAnyEvents(WindowPtr pWin, Bool freeResources)
{ {
@ -4859,7 +5267,9 @@ DeleteWindowFromAnyEvents(WindowPtr pWin, Bool freeResources)
} }
/** /**
* Call this whenever some window at or below pWin has changed geometry * Call this whenever some window at or below pWin has changed geometry. If
* there is a grab on the window, the cursor will be re-confined into the
* window.
*/ */
_X_EXPORT void _X_EXPORT void
CheckCursorConfinement(WindowPtr pWin) CheckCursorConfinement(WindowPtr pWin)
@ -4903,6 +5313,9 @@ EventMaskForClient(WindowPtr pWin, ClientPtr client)
return 0; return 0;
} }
/**
* Server-side protocol handling for RecolorCursor request.
*/
int int
ProcRecolorCursor(ClientPtr client) ProcRecolorCursor(ClientPtr client)
{ {
@ -4945,6 +5358,20 @@ ProcRecolorCursor(ClientPtr client)
return (Success); return (Success);
} }
/**
* Write the given events to a client, swapping the byte order if necessary.
* To swap the byte ordering, a callback is called that has to be set up for
* the given event type.
*
* In the case of DeviceMotionNotify trailed by DeviceValuators, the events
* can be more than one. Usually it's just one event.
*
* Do not modify the event structure passed in. See comment below.
*
* @param pClient Client to send events to.
* @param count Number of events.
* @param events The event list.
*/
_X_EXPORT void _X_EXPORT void
WriteEventsToClient(ClientPtr pClient, int count, xEvent *events) WriteEventsToClient(ClientPtr pClient, int count, xEvent *events)
{ {

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -82,6 +82,32 @@ void fbCompositeSrc_8888x8888mmx (CARD8 op,
INT16 yDst, INT16 yDst,
CARD16 width, CARD16 width,
CARD16 height); CARD16 height);
void
fbCompositeSolidMaskSrc_nx8x8888mmx (CARD8 op,
PicturePtr pSrc,
PicturePtr pMask,
PicturePtr pDst,
INT16 xSrc,
INT16 ySrc,
INT16 xMask,
INT16 yMask,
INT16 xDst,
INT16 yDst,
CARD16 width,
CARD16 height);
void
fbCompositeSrc_x888x8x8888mmx (CARD8 op,
PicturePtr pSrc,
PicturePtr pMask,
PicturePtr pDst,
INT16 xSrc,
INT16 ySrc,
INT16 xMask,
INT16 yMask,
INT16 xDst,
INT16 yDst,
CARD16 width,
CARD16 height);
void fbCompositeSolidMask_nx8888x8888Cmmx (CARD8 op, void fbCompositeSolidMask_nx8888x8888Cmmx (CARD8 op,
PicturePtr pSrc, PicturePtr pSrc,
PicturePtr pMask, PicturePtr pMask,
@ -106,6 +132,42 @@ void fbCompositeSolidMask_nx8x8888mmx (CARD8 op,
INT16 yDst, INT16 yDst,
CARD16 width, CARD16 width,
CARD16 height); CARD16 height);
void fbCompositeIn_nx8x8mmx (CARD8 op,
PicturePtr pSrc,
PicturePtr pMask,
PicturePtr pDst,
INT16 xSrc,
INT16 ySrc,
INT16 xMask,
INT16 yMask,
INT16 xDst,
INT16 yDst,
CARD16 width,
CARD16 height);
void fbCompositeIn_8x8mmx (CARD8 op,
PicturePtr pSrc,
PicturePtr pMask,
PicturePtr pDst,
INT16 xSrc,
INT16 ySrc,
INT16 xMask,
INT16 yMask,
INT16 xDst,
INT16 yDst,
CARD16 width,
CARD16 height);
void fbCompositeSrcAdd_8888x8x8mmx (CARD8 op,
PicturePtr pSrc,
PicturePtr pMask,
PicturePtr pDst,
INT16 xSrc,
INT16 ySrc,
INT16 xMask,
INT16 yMask,
INT16 xDst,
INT16 yDst,
CARD16 width,
CARD16 height);
void fbCompositeSrcAdd_8000x8000mmx (CARD8 op, void fbCompositeSrcAdd_8000x8000mmx (CARD8 op,
PicturePtr pSrc, PicturePtr pSrc,
PicturePtr pMask, PicturePtr pMask,

File diff suppressed because it is too large Load Diff

View File

@ -121,7 +121,15 @@ fbCanGetSolid(PicturePtr pict)
break; \ break; \
case 16: \ case 16: \
(bits) = READ((CARD16 *) __bits__); \ (bits) = READ((CARD16 *) __bits__); \
(bits) = cvt0565to8888(bits); \ (bits) = cvt0565to0888(bits); \
break; \
case 8: \
(bits) = READ((CARD8 *) __bits__); \
(bits) = (bits) << 24; \
break; \
case 1: \
(bits) = READ((CARD32 *) __bits__); \
(bits) = FbLeftStipBits((bits),1) ? 0xff000000 : 0x00000000;\
break; \ break; \
default: \ default: \
return; \ return; \
@ -153,7 +161,7 @@ fbCanGetSolid(PicturePtr pict)
#define cvt8888to0565(s) ((((s) >> 3) & 0x001f) | \ #define cvt8888to0565(s) ((((s) >> 3) & 0x001f) | \
(((s) >> 5) & 0x07e0) | \ (((s) >> 5) & 0x07e0) | \
(((s) >> 8) & 0xf800)) (((s) >> 8) & 0xf800))
#define cvt0565to8888(s) (((((s) << 3) & 0xf8) | (((s) >> 2) & 0x7)) | \ #define cvt0565to0888(s) (((((s) << 3) & 0xf8) | (((s) >> 2) & 0x7)) | \
((((s) << 5) & 0xfc00) | (((s) >> 1) & 0x300)) | \ ((((s) << 5) & 0xfc00) | (((s) >> 1) & 0x300)) | \
((((s) << 8) & 0xf80000) | (((s) << 3) & 0x70000))) ((((s) << 8) & 0xf80000) | (((s) << 3) & 0x70000)))

View File

@ -23,14 +23,20 @@ if KDRIVELINUX
LINUX_SUBDIRS = linux LINUX_SUBDIRS = linux
endif endif
SUBDIRS = \ SERVER_SUBDIRS = \
src \
$(LINUX_SUBDIRS) \
$(XSDL_SUBDIRS) \ $(XSDL_SUBDIRS) \
$(FBDEV_SUBDIRS) \ $(FBDEV_SUBDIRS) \
$(VESA_SUBDIRS) \ $(VESA_SUBDIRS) \
$(XEPHYR_SUBDIRS) \ $(XEPHYR_SUBDIRS) \
$(XFAKE_SUBDIRS) $(XFAKE_SUBDIRS)
SUBDIRS = \
src \
$(LINUX_SUBDIRS) \
$(SERVER_SUBDIRS)
DIST_SUBDIRS = vesa ati chips epson i810 mach64 mga neomagic nvidia pm2 r128 \ DIST_SUBDIRS = vesa ati chips epson i810 mach64 mga neomagic nvidia pm2 r128 \
smi via fbdev sdl ephyr src linux fake sis300 smi via fbdev sdl ephyr src linux fake sis300
relink:
@for i in $(SERVER_SUBDIRS) ; do make -C $$i relink ; done

View File

@ -62,3 +62,6 @@ Xati_LDADD = \
$(ATI_LIBS) \ $(ATI_LIBS) \
@KDRIVE_LIBS@ \ @KDRIVE_LIBS@ \
@XSERVER_LIBS@ @XSERVER_LIBS@
relink:
rm -f $(bin_PROGRAMS) && make $(bin_PROGRAMS)

View File

@ -24,3 +24,6 @@ Xchips_LDADD = \
$(CHIPS_LIBS) \ $(CHIPS_LIBS) \
@KDRIVE_LIBS@ \ @KDRIVE_LIBS@ \
@XSERVER_LIBS@ @XSERVER_LIBS@
relink:
rm -f $(bin_PROGRAMS) && make $(bin_PROGRAMS)

View File

@ -29,3 +29,6 @@ Xephyr_LDADD = \
../../../exa/libexa.la \ ../../../exa/libexa.la \
@KDRIVE_LIBS@ \ @KDRIVE_LIBS@ \
@XEPHYR_LIBS@ @XEPHYR_LIBS@
relink:
rm -f $(bin_PROGRAMS) && make $(bin_PROGRAMS)

View File

@ -24,3 +24,6 @@ Xepson_LDADD = \
$(EPSON_LIBS) \ $(EPSON_LIBS) \
@KDRIVE_LIBS@ \ @KDRIVE_LIBS@ \
@XSERVER_LIBS@ @XSERVER_LIBS@
relink:
rm -f $(bin_PROGRAMS) && make $(bin_PROGRAMS)

View File

@ -20,3 +20,6 @@ Xfake_LDADD = \
libfake.a \ libfake.a \
@KDRIVE_LIBS@ \ @KDRIVE_LIBS@ \
@XSERVER_LIBS@ @XSERVER_LIBS@
relink:
rm -f $(bin_PROGRAMS) && make $(bin_PROGRAMS)

View File

@ -18,4 +18,7 @@ Xfbdev_LDADD = \
libfbdev.a \ libfbdev.a \
@KDRIVE_LIBS@ \ @KDRIVE_LIBS@ \
@XSERVER_LIBS@ @XSERVER_LIBS@
relink:
rm -f $(bin_PROGRAMS) && make $(bin_PROGRAMS)
endif endif

View File

@ -27,3 +27,6 @@ Xi810_LDADD = \
$(I810_LIBS) \ $(I810_LIBS) \
@KDRIVE_LIBS@ \ @KDRIVE_LIBS@ \
@XSERVER_LIBS@ @XSERVER_LIBS@
relink:
rm -f $(bin_PROGRAMS) && make $(bin_PROGRAMS)

View File

@ -31,3 +31,6 @@ Xmach64_LDADD = \
$(MACH64_LIBS) \ $(MACH64_LIBS) \
@KDRIVE_LIBS@ \ @KDRIVE_LIBS@ \
@XSERVER_LIBS@ @XSERVER_LIBS@
relink:
rm -f $(bin_PROGRAMS) && make $(bin_PROGRAMS)

View File

@ -26,3 +26,6 @@ Xmga_LDADD = \
$(MGA_LIBS) \ $(MGA_LIBS) \
@KDRIVE_LIBS@ \ @KDRIVE_LIBS@ \
@XSERVER_LIBS@ @XSERVER_LIBS@
relink:
rm -f $(bin_PROGRAMS) && make $(bin_PROGRAMS)

View File

@ -38,3 +38,6 @@ Xneomagic_LDADD = \
$(NEOMAGIC_LIBS) \ $(NEOMAGIC_LIBS) \
@KDRIVE_LIBS@ \ @KDRIVE_LIBS@ \
@XSERVER_LIBS@ @XSERVER_LIBS@
relink:
rm -f $(bin_PROGRAMS) && make $(bin_PROGRAMS)

View File

@ -27,3 +27,6 @@ Xnvidia_LDADD = \
$(NVIDIA_LIBS) \ $(NVIDIA_LIBS) \
@KDRIVE_LIBS@ \ @KDRIVE_LIBS@ \
@XSERVER_LIBS@ @XSERVER_LIBS@
relink:
rm -f $(bin_PROGRAMS) && make $(bin_PROGRAMS)

View File

@ -25,3 +25,6 @@ Xpm2_LDADD = \
$(PM2_LIBS) \ $(PM2_LIBS) \
@KDRIVE_LIBS@ \ @KDRIVE_LIBS@ \
@XSERVER_LIBS@ @XSERVER_LIBS@
relink:
rm -f $(bin_PROGRAMS) && make $(bin_PROGRAMS)

View File

@ -24,3 +24,6 @@ Xr128_LDADD = \
$(R128_LIBS) \ $(R128_LIBS) \
@KDRIVE_LIBS@ \ @KDRIVE_LIBS@ \
@XSERVER_LIBS@ @XSERVER_LIBS@
relink:
rm -f $(bin_PROGRAMS) && make $(bin_PROGRAMS)

View File

@ -11,3 +11,6 @@ Xsdl_LDADD = @KDRIVE_PURE_LIBS@ \
@KDRIVE_LIBS@ \ @KDRIVE_LIBS@ \
@XSERVER_LIBS@ \ @XSERVER_LIBS@ \
@XSDL_LIBS@ @XSDL_LIBS@
relink:
rm -f $(bin_PROGRAMS) && make $(bin_PROGRAMS)

View File

@ -38,3 +38,6 @@ Xsis_LDADD = \
$(SIS_LIBS) \ $(SIS_LIBS) \
@KDRIVE_LIBS@ \ @KDRIVE_LIBS@ \
$(TSLIB_FLAG) $(TSLIB_FLAG)
relink:
rm -f $(bin_PROGRAMS) && make $(bin_PROGRAMS)

View File

@ -29,3 +29,6 @@ Xsmi_LDADD = \
$(SMI_LIBS) \ $(SMI_LIBS) \
@KDRIVE_LIBS@ \ @KDRIVE_LIBS@ \
@XSERVER_LIBS@ @XSERVER_LIBS@
relink:
rm -f $(bin_PROGRAMS) && make $(bin_PROGRAMS)

View File

@ -23,3 +23,6 @@ Xvesa_LDADD = \
libvesa.a \ libvesa.a \
@KDRIVE_LIBS@ \ @KDRIVE_LIBS@ \
@XSERVER_LIBS@ @XSERVER_LIBS@
relink:
rm -f $(bin_PROGRAMS) && make $(bin_PROGRAMS)

View File

@ -25,3 +25,6 @@ Xvia_LDADD = \
$(VIA_LIBS) \ $(VIA_LIBS) \
@KDRIVE_LIBS@ \ @KDRIVE_LIBS@ \
@XSERVER_LIBS@ @XSERVER_LIBS@
relink:
rm -f $(bin_PROGRAMS) && make $(bin_PROGRAMS)

View File

@ -807,4 +807,48 @@ xf86InitValuatorDefaults(DeviceIntPtr dev, int axnum)
} }
} }
/**
* Deactivate a device. Call this function from the driver if you receive a
* read error or something else that spoils your day.
* Device will be moved to the off_devices list, but it will still be there
* until you really clean up after it.
* Notifies the client about an inactive device.
*
* @param panic True if device is unrecoverable and needs to be removed.
*/
_X_EXPORT void
xf86DisableDevice(DeviceIntPtr dev, Bool panic)
{
devicePresenceNotify ev;
DeviceIntRec dummyDev;
if(!panic)
{
DisableDevice(dev);
} else
{
ev.type = DevicePresenceNotify;
ev.time = currentTime.milliseconds;
ev.devchange = DeviceUnrecoverable;
ev.deviceid = dev->id;
dummyDev.id = 0;
SendEventToAllWindows(&dummyDev, DevicePresenceNotifyMask,
(xEvent *) &ev, 1);
DeleteInputDeviceRequest(dev);
}
}
/**
* Reactivate a device. Call this function from the driver if you just found
* out that the read error wasn't quite that bad after all.
* Device will be re-activated, and an event sent to the client.
*/
_X_EXPORT void
xf86EnableDevice(DeviceIntPtr dev)
{
EnableDevice(dev);
}
/* end of xf86Xinput.c */ /* end of xf86Xinput.c */

View File

@ -188,6 +188,8 @@ void xf86InitValuatorAxisStruct(DeviceIntPtr dev, int axnum, int minval,
void xf86InitValuatorDefaults(DeviceIntPtr dev, int axnum); void xf86InitValuatorDefaults(DeviceIntPtr dev, int axnum);
void xf86AddEnabledDevice(InputInfoPtr pInfo); void xf86AddEnabledDevice(InputInfoPtr pInfo);
void xf86RemoveEnabledDevice(InputInfoPtr pInfo); void xf86RemoveEnabledDevice(InputInfoPtr pInfo);
void xf86DisableDevice(DeviceIntPtr dev, Bool panic);
void xf86EnableDevice(DeviceIntPtr dev);
/* xf86Helper.c */ /* xf86Helper.c */
void xf86AddInputDriver(InputDriverPtr driver, pointer module, int flags); void xf86AddInputDriver(InputDriverPtr driver, pointer module, int flags);
@ -205,6 +207,7 @@ int xf86GetMotionEvents(DeviceIntPtr dev, xTimecoord *buff,
void xf86CollectInputOptions(InputInfoPtr pInfo, const char **defaultOpts, void xf86CollectInputOptions(InputInfoPtr pInfo, const char **defaultOpts,
pointer extraOpts); pointer extraOpts);
/* Legacy hatred */ /* Legacy hatred */
#define SendCoreEvents 59 #define SendCoreEvents 59
#define DontSendCoreEvents 60 #define DontSendCoreEvents 60

View File

@ -1,361 +0,0 @@
/*
* Copyright 2006 Luc Verhaegen.
*
* 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, sub license,
* 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 NON-INFRINGEMENT. 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.
*/
#ifdef HAVE_XORG_CONFIG_H
#include <xorg-config.h>
#endif
#include "xf86.h"
#include "xf86DDC.h"
#include <X11/Xatom.h>
#include "property.h"
#include "propertyst.h"
#include "xf86DDC.h"
/*
* TODO:
* - for those with access to the VESA DMT standard; review please.
*/
#define MODEPREFIX(name) NULL, NULL, name, 0,M_T_DRIVER
#define MODESUFFIX 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,FALSE,FALSE,0,NULL,0,0.0,0.0
DisplayModeRec DDCEstablishedModes[17] = {
{ MODEPREFIX("800x600"), 40000, 800, 840, 968, 1056, 0, 600, 601, 605, 628, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX }, /* 800x600@60Hz */
{ MODEPREFIX("800x600"), 36000, 800, 824, 896, 1024, 0, 600, 601, 603, 625, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX }, /* 800x600@56Hz */
{ MODEPREFIX("640x480"), 31500, 640, 656, 720, 840, 0, 480, 481, 484, 500, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* 640x480@75Hz */
{ MODEPREFIX("640x480"), 31500, 640, 664, 704, 832, 0, 480, 489, 491, 520, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* 640x480@72Hz */
{ MODEPREFIX("640x480"), 30240, 640, 704, 768, 864, 0, 480, 483, 486, 525, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* 640x480@67Hz */
{ MODEPREFIX("640x480"), 25200, 640, 656, 752, 800, 0, 480, 490, 492, 525, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* 640x480@60Hz */
{ MODEPREFIX("720x400"), 35500, 720, 738, 846, 900, 0, 400, 421, 423, 449, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* 720x400@88Hz */
{ MODEPREFIX("720x400"), 28320, 720, 738, 846, 900, 0, 400, 412, 414, 449, 0, V_NHSYNC | V_PVSYNC, MODESUFFIX }, /* 720x400@70Hz */
{ MODEPREFIX("1280x1024"), 135000, 1280, 1296, 1440, 1688, 0, 1024, 1025, 1028, 1066, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX }, /* 1280x1024@75Hz */
{ MODEPREFIX("1024x768"), 78800, 1024, 1040, 1136, 1312, 0, 768, 769, 772, 800, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX }, /* 1024x768@75Hz */
{ MODEPREFIX("1024x768"), 75000, 1024, 1048, 1184, 1328, 0, 768, 771, 777, 806, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* 1024x768@70Hz */
{ MODEPREFIX("1024x768"), 65000, 1024, 1048, 1184, 1344, 0, 768, 771, 777, 806, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* 1024x768@60Hz */
{ MODEPREFIX("1024x768"), 44900, 1024, 1032, 1208, 1264, 0, 768, 768, 776, 817, 0, V_PHSYNC | V_PVSYNC | V_INTERLACE, MODESUFFIX }, /* 1024x768@43Hz */
{ MODEPREFIX("832x624"), 57284, 832, 864, 928, 1152, 0, 624, 625, 628, 667, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* 832x624@75Hz */
{ MODEPREFIX("800x600"), 49500, 800, 816, 896, 1056, 0, 600, 601, 604, 625, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX }, /* 800x600@75Hz */
{ MODEPREFIX("800x600"), 50000, 800, 856, 976, 1040, 0, 600, 637, 643, 666, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX }, /* 800x600@72Hz */
{ MODEPREFIX("1152x864"), 108000, 1152, 1216, 1344, 1600, 0, 864, 865, 868, 900, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX }, /* 1152x864@75Hz */
};
static DisplayModePtr
DDCModesFromEstablished(int scrnIndex, struct established_timings *timing)
{
DisplayModePtr Modes = NULL, Mode = NULL;
CARD32 bits = (timing->t1) | (timing->t2 << 8) |
((timing->t_manu & 0x80) << 9);
int i;
for (i = 0; i < 17; i++) {
if (bits & (0x01 << i)) {
Mode = xf86DuplicateMode(&DDCEstablishedModes[i]);
Modes = xf86ModesAdd(Modes, Mode);
}
}
return Modes;
}
/*
*
*/
static DisplayModePtr
DDCModesFromStandardTiming(int scrnIndex, struct std_timings *timing)
{
DisplayModePtr Modes = NULL, Mode = NULL;
int i;
for (i = 0; i < STD_TIMINGS; i++) {
if (timing[i].hsize && timing[i].vsize && timing[i].refresh) {
Mode = xf86CVTMode(timing[i].hsize, timing[i].vsize,
timing[i].refresh, FALSE, FALSE);
Mode->type = M_T_DRIVER;
Modes = xf86ModesAdd(Modes, Mode);
}
}
return Modes;
}
/*
*
*/
static DisplayModePtr
DDCModeFromDetailedTiming(int scrnIndex, struct detailed_timings *timing,
int preferred)
{
DisplayModePtr Mode;
/*
* Refuse to create modes that are insufficiently large. 64 is a random
* number, maybe the spec says something about what the minimum is. In
* particular I see this frequently with _old_ EDID, 1.0 or so, so maybe
* our parser is just being too aggresive there.
*/
if (timing->h_active < 64 || timing->v_active < 64) {
xf86DrvMsg(scrnIndex, X_INFO,
"%s: Ignoring tiny %dx%d mode\n", __func__,
timing->h_active, timing->v_active);
return NULL;
}
/* We don't do stereo */
if (timing->stereo) {
xf86DrvMsg(scrnIndex, X_INFO,
"%s: Ignoring: We don't handle stereo.\n", __func__);
return NULL;
}
/* We only do seperate sync currently */
if (timing->sync != 0x03) {
xf86DrvMsg(scrnIndex, X_INFO,
"%s: %dx%d Warning: We only handle seperate"
" sync.\n", __func__, timing->h_active, timing->v_active);
}
Mode = xnfalloc(sizeof(DisplayModeRec));
memset(Mode, 0, sizeof(DisplayModeRec));
Mode->type = M_T_DRIVER;
if (preferred)
Mode->type |= M_T_PREFERRED;
Mode->Clock = timing->clock / 1000.0;
Mode->HDisplay = timing->h_active;
Mode->HSyncStart = timing->h_active + timing->h_sync_off;
Mode->HSyncEnd = Mode->HSyncStart + timing->h_sync_width;
Mode->HTotal = timing->h_active + timing->h_blanking;
Mode->VDisplay = timing->v_active;
Mode->VSyncStart = timing->v_active + timing->v_sync_off;
Mode->VSyncEnd = Mode->VSyncStart + timing->v_sync_width;
Mode->VTotal = timing->v_active + timing->v_blanking;
xf86SetModeDefaultName(Mode);
/* We ignore h/v_size and h/v_border for now. */
if (timing->interlaced)
Mode->Flags |= V_INTERLACE;
if (timing->misc & 0x02)
Mode->Flags |= V_PHSYNC;
else
Mode->Flags |= V_NHSYNC;
if (timing->misc & 0x01)
Mode->Flags |= V_PVSYNC;
else
Mode->Flags |= V_NVSYNC;
return Mode;
}
/*
*
*/
static void
DDCGuessRangesFromModes(int scrnIndex, MonPtr Monitor, DisplayModePtr Modes)
{
DisplayModePtr Mode = Modes;
if (!Monitor || !Modes)
return;
/* set up the ranges for scanning through the modes */
Monitor->nHsync = 1;
Monitor->hsync[0].lo = 1024.0;
Monitor->hsync[0].hi = 0.0;
Monitor->nVrefresh = 1;
Monitor->vrefresh[0].lo = 1024.0;
Monitor->vrefresh[0].hi = 0.0;
while (Mode) {
if (!Mode->HSync)
Mode->HSync = ((float) Mode->Clock ) / ((float) Mode->HTotal);
if (!Mode->VRefresh)
Mode->VRefresh = (1000.0 * ((float) Mode->Clock)) /
((float) (Mode->HTotal * Mode->VTotal));
if (Mode->HSync < Monitor->hsync[0].lo)
Monitor->hsync[0].lo = Mode->HSync;
if (Mode->HSync > Monitor->hsync[0].hi)
Monitor->hsync[0].hi = Mode->HSync;
if (Mode->VRefresh < Monitor->vrefresh[0].lo)
Monitor->vrefresh[0].lo = Mode->VRefresh;
if (Mode->VRefresh > Monitor->vrefresh[0].hi)
Monitor->vrefresh[0].hi = Mode->VRefresh;
Mode = Mode->next;
}
}
DisplayModePtr
xf86DDCGetModes(int scrnIndex, xf86MonPtr DDC)
{
int preferred, i;
DisplayModePtr Modes = NULL, Mode;
preferred = PREFERRED_TIMING_MODE(DDC->features.msc);
/* Add established timings */
Mode = DDCModesFromEstablished(scrnIndex, &DDC->timings1);
Modes = xf86ModesAdd(Modes, Mode);
/* Add standard timings */
Mode = DDCModesFromStandardTiming(scrnIndex, DDC->timings2);
Modes = xf86ModesAdd(Modes, Mode);
for (i = 0; i < DET_TIMINGS; i++) {
struct detailed_monitor_section *det_mon = &DDC->det_mon[i];
switch (det_mon->type) {
case DT:
Mode = DDCModeFromDetailedTiming(scrnIndex,
&det_mon->section.d_timings,
preferred);
preferred = 0;
Modes = xf86ModesAdd(Modes, Mode);
break;
case DS_STD_TIMINGS:
Mode = DDCModesFromStandardTiming(scrnIndex,
det_mon->section.std_t);
Modes = xf86ModesAdd(Modes, Mode);
break;
default:
break;
}
}
return Modes;
}
/*
* Fill out MonPtr with xf86MonPtr information.
*/
void
xf86DDCMonitorSet(int scrnIndex, MonPtr Monitor, xf86MonPtr DDC)
{
DisplayModePtr Modes = NULL, Mode;
int i, clock;
Bool have_hsync = FALSE, have_vrefresh = FALSE;
if (!Monitor || !DDC)
return;
Monitor->DDC = DDC;
Monitor->widthmm = 10 * DDC->features.hsize;
Monitor->heightmm = 10 * DDC->features.vsize;
/* If this is a digital display, then we can use reduced blanking */
if (DDC->features.input_type)
Monitor->reducedblanking = TRUE;
/* Allow the user to also enable this through config */
Modes = xf86DDCGetModes(scrnIndex, DDC);
/* Skip EDID ranges if they were specified in the config file */
have_hsync = (Monitor->nHsync != 0);
have_vrefresh = (Monitor->nVrefresh != 0);
/* Go through the detailed monitor sections */
for (i = 0; i < DET_TIMINGS; i++) {
switch (DDC->det_mon[i].type) {
case DS_RANGES:
if (!have_hsync) {
if (!Monitor->nHsync)
xf86DrvMsg(scrnIndex, X_INFO,
"Using EDID range info for horizontal sync\n");
Monitor->hsync[Monitor->nHsync].lo =
DDC->det_mon[i].section.ranges.min_h;
Monitor->hsync[Monitor->nHsync].hi =
DDC->det_mon[i].section.ranges.max_h;
Monitor->nHsync++;
} else {
xf86DrvMsg(scrnIndex, X_INFO,
"Using hsync ranges from config file\n");
}
if (!have_vrefresh) {
if (!Monitor->nVrefresh)
xf86DrvMsg(scrnIndex, X_INFO,
"Using EDID range info for vertical refresh\n");
Monitor->vrefresh[Monitor->nVrefresh].lo =
DDC->det_mon[i].section.ranges.min_v;
Monitor->vrefresh[Monitor->nVrefresh].hi =
DDC->det_mon[i].section.ranges.max_v;
Monitor->nVrefresh++;
} else {
xf86DrvMsg(scrnIndex, X_INFO,
"Using vrefresh ranges from config file\n");
}
clock = DDC->det_mon[i].section.ranges.max_clock * 1000;
if (clock > Monitor->maxPixClock)
Monitor->maxPixClock = clock;
break;
default:
break;
}
}
if (Modes) {
/* Print Modes */
xf86DrvMsg(scrnIndex, X_INFO, "Printing DDC gathered Modelines:\n");
Mode = Modes;
while (Mode) {
xf86PrintModeline(scrnIndex, Mode);
Mode = Mode->next;
}
/* Do we still need ranges to be filled in? */
if (!Monitor->nHsync || !Monitor->nVrefresh)
DDCGuessRangesFromModes(scrnIndex, Monitor, Modes);
/* look for last Mode */
Mode = Modes;
while (Mode->next)
Mode = Mode->next;
/* add to MonPtr */
if (Monitor->Modes) {
Monitor->Last->next = Modes;
Modes->prev = Monitor->Last;
Monitor->Last = Mode;
} else {
Monitor->Modes = Modes;
Monitor->Last = Mode;
}
}
}

View File

@ -43,6 +43,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <string.h> #include <string.h>
#include <stdio.h> #include <stdio.h>
#include <sys/ioctl.h> #include <sys/ioctl.h>
#include <errno.h>
#define NEED_REPLIES #define NEED_REPLIES
#define NEED_EVENTS #define NEED_EVENTS
@ -78,6 +79,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
extern Bool noPanoramiXExtension; extern Bool noPanoramiXExtension;
#endif #endif
static int DRIEntPrivIndex = -1;
static int DRIScreenPrivIndex = -1; static int DRIScreenPrivIndex = -1;
static int DRIWindowPrivIndex = -1; static int DRIWindowPrivIndex = -1;
static unsigned long DRIGeneration = 0; static unsigned long DRIGeneration = 0;
@ -113,18 +115,203 @@ DRIDrvMsg(int scrnIndex, MessageType type, const char *format, ...)
} }
static void
DRIOpenDRMCleanup(DRIEntPrivPtr pDRIEntPriv)
{
if (pDRIEntPriv->pLSAREA != NULL) {
drmUnmap(pDRIEntPriv->pLSAREA, pDRIEntPriv->sAreaSize);
pDRIEntPriv->pLSAREA = NULL;
}
if (pDRIEntPriv->hLSAREA != 0) {
drmRmMap(pDRIEntPriv->drmFD, pDRIEntPriv->hLSAREA);
}
if (pDRIEntPriv->drmFD >= 0) {
drmClose(pDRIEntPriv->drmFD);
pDRIEntPriv->drmFD = 0;
}
}
int
DRIMasterFD(ScrnInfoPtr pScrn)
{
return DRI_ENT_PRIV(pScrn)->drmFD;
}
void *
DRIMasterSareaPointer(ScrnInfoPtr pScrn)
{
return DRI_ENT_PRIV(pScrn)->pLSAREA;
}
drm_handle_t
DRIMasterSareaHandle(ScrnInfoPtr pScrn)
{
return DRI_ENT_PRIV(pScrn)->hLSAREA;
}
Bool
DRIOpenDRMMaster(ScrnInfoPtr pScrn,
unsigned long sAreaSize,
const char *busID,
const char *drmDriverName)
{
drmSetVersion saveSv, sv;
Bool drmWasAvailable;
DRIEntPrivPtr pDRIEntPriv;
DRIEntPrivRec tmp;
drmVersionPtr drmlibv;
int drmlibmajor, drmlibminor;
const char *openBusID;
int count;
int err;
if (DRIEntPrivIndex == -1)
DRIEntPrivIndex = xf86AllocateEntityPrivateIndex();
pDRIEntPriv = DRI_ENT_PRIV(pScrn);
if (pDRIEntPriv && pDRIEntPriv->drmFD != -1)
return TRUE;
drmWasAvailable = drmAvailable();
memset(&tmp, 0, sizeof(tmp));
/* Check the DRM lib version.
* drmGetLibVersion was not supported in version 1.0, so check for
* symbol first to avoid possible crash or hang.
*/
drmlibmajor = 1;
drmlibminor = 0;
if (xf86LoaderCheckSymbol("drmGetLibVersion")) {
drmlibv = drmGetLibVersion(-1);
if (drmlibv != NULL) {
drmlibmajor = drmlibv->version_major;
drmlibminor = drmlibv->version_minor;
drmFreeVersion(drmlibv);
}
}
/* Check if the libdrm can handle falling back to loading based on name
* if a busid string is passed.
*/
openBusID = (drmlibmajor == 1 && drmlibminor >= 2) ? busID : NULL;
tmp.drmFD = -1;
sv.drm_di_major = 1;
sv.drm_di_minor = 1;
sv.drm_dd_major = -1;
saveSv = sv;
count = 10;
while (count--) {
tmp.drmFD = drmOpen(drmDriverName, openBusID);
if (tmp.drmFD < 0) {
DRIDrvMsg(-1, X_ERROR, "[drm] drmOpen failed.\n");
goto out_err;
}
err = drmSetInterfaceVersion(tmp.drmFD, &sv);
if (err != -EPERM)
break;
sv = saveSv;
drmClose(tmp.drmFD);
tmp.drmFD = -1;
usleep(100000);
}
if (tmp.drmFD <= 0) {
DRIDrvMsg(-1, X_ERROR, "[drm] DRM was busy with another master.\n");
goto out_err;
}
if (!drmWasAvailable) {
DRIDrvMsg(-1, X_INFO,
"[drm] loaded kernel module for \"%s\" driver.\n",
drmDriverName);
}
if (err != 0) {
sv.drm_di_major = 1;
sv.drm_di_minor = 0;
}
DRIDrvMsg(-1, X_INFO, "[drm] DRM interface version %d.%d\n",
sv.drm_di_major, sv.drm_di_minor);
if (sv.drm_di_major == 1 && sv.drm_di_minor >= 1)
err = 0;
else
err = drmSetBusid(tmp.drmFD, busID);
if (err) {
DRIDrvMsg(-1, X_ERROR, "[drm] Could not set DRM device bus ID.\n");
goto out_err;
}
/*
* Create a lock-containing sarea.
*/
if (drmAddMap( tmp.drmFD, 0, sAreaSize, DRM_SHM,
DRM_CONTAINS_LOCK, &tmp.hLSAREA) < 0) {
DRIDrvMsg(-1, X_INFO, "[drm] Could not create SAREA for DRM lock.\n");
tmp.hLSAREA = 0;
goto out_err;
}
if (drmMap( tmp.drmFD, tmp.hLSAREA, sAreaSize,
(drmAddressPtr)(&tmp.pLSAREA)) < 0) {
DRIDrvMsg(-1, X_INFO, "[drm] Mapping SAREA for DRM lock failed.\n");
tmp.pLSAREA = NULL;
goto out_err;
}
memset(tmp.pLSAREA, 0, sAreaSize);
/*
* Reserved contexts are handled by the first opened screen.
*/
tmp.resOwner = NULL;
if (!pDRIEntPriv)
pDRIEntPriv = xnfcalloc(sizeof(*pDRIEntPriv), 1);
if (!pDRIEntPriv) {
DRIDrvMsg(-1, X_INFO, "[drm] Failed to allocate memory for "
"DRM device.\n");
goto out_err;
}
*pDRIEntPriv = tmp;
xf86GetEntityPrivate((pScrn)->entityList[0],DRIEntPrivIndex)->ptr =
pDRIEntPriv;
DRIDrvMsg(-1, X_INFO, "[drm] DRM open master succeeded.\n");
return TRUE;
out_err:
DRIOpenDRMCleanup(&tmp);
return FALSE;
}
Bool Bool
DRIScreenInit(ScreenPtr pScreen, DRIInfoPtr pDRIInfo, int *pDRMFD) DRIScreenInit(ScreenPtr pScreen, DRIInfoPtr pDRIInfo, int *pDRMFD)
{ {
DRIScreenPrivPtr pDRIPriv; DRIScreenPrivPtr pDRIPriv;
drm_context_t * reserved; drm_context_t * reserved;
int reserved_count; int reserved_count;
int i, fd, drmWasAvailable; int i;
Bool xineramaInCore = FALSE; Bool xineramaInCore = FALSE;
int err = 0; DRIEntPrivPtr pDRIEntPriv;
char *openbusid; ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
drmVersionPtr drmlibv;
int drmlibmajor, drmlibminor, drmdimajor, drmdiminor;
if (DRIGeneration != serverGeneration) { if (DRIGeneration != serverGeneration) {
if ((DRIScreenPrivIndex = AllocateScreenPrivateIndex()) < 0) if ((DRIScreenPrivIndex = AllocateScreenPrivateIndex()) < 0)
@ -154,47 +341,12 @@ DRIScreenInit(ScreenPtr pScreen, DRIInfoPtr pDRIInfo, int *pDRMFD)
} }
} }
drmWasAvailable = drmAvailable(); if (!DRIOpenDRMMaster(pScrn, pDRIInfo->SAREASize,
pDRIInfo->busIdString,
pDRIInfo->drmDriverName))
return FALSE;
/* Check the DRM lib version. pDRIEntPriv = DRI_ENT_PRIV(pScrn);
* drmGetLibVersion was not supported in version 1.0, so check for
* symbol first to avoid possible crash or hang.
*/
drmlibmajor = 1;
drmlibminor = 0;
if (xf86LoaderCheckSymbol("drmGetLibVersion")) {
drmlibv = drmGetLibVersion(-1);
if (drmlibv != NULL) {
drmlibmajor = drmlibv->version_major;
drmlibminor = drmlibv->version_minor;
drmFreeVersion(drmlibv);
}
}
/* Check if the libdrm can handle falling back to loading based on name
* if a busid string is passed.
*/
if (drmlibmajor == 1 && drmlibminor >= 2)
openbusid = pDRIInfo->busIdString;
else
openbusid = NULL;
/* Note that drmOpen will try to load the kernel module, if needed. */
fd = drmOpen(pDRIInfo->drmDriverName, openbusid);
if (fd < 0) {
/* failed to open DRM */
pScreen->devPrivates[DRIScreenPrivIndex].ptr = NULL;
DRIDrvMsg(pScreen->myNum, X_INFO,
"[drm] drmOpen failed\n");
return FALSE;
}
if (!drmWasAvailable) {
/* drmOpen loaded the kernel module, print a message to say so */
DRIDrvMsg(pScreen->myNum, X_INFO,
"[drm] loaded kernel module for \"%s\" driver\n",
pDRIInfo->drmDriverName);
}
pDRIPriv = (DRIScreenPrivPtr) xcalloc(1, sizeof(DRIScreenPrivRec)); pDRIPriv = (DRIScreenPrivPtr) xcalloc(1, sizeof(DRIScreenPrivRec));
if (!pDRIPriv) { if (!pDRIPriv) {
@ -203,7 +355,7 @@ DRIScreenInit(ScreenPtr pScreen, DRIInfoPtr pDRIInfo, int *pDRMFD)
} }
pScreen->devPrivates[DRIScreenPrivIndex].ptr = (pointer) pDRIPriv; pScreen->devPrivates[DRIScreenPrivIndex].ptr = (pointer) pDRIPriv;
pDRIPriv->drmFD = fd; pDRIPriv->drmFD = pDRIEntPriv->drmFD;
pDRIPriv->directRenderingSupport = TRUE; pDRIPriv->directRenderingSupport = TRUE;
pDRIPriv->pDriverInfo = pDRIInfo; pDRIPriv->pDriverInfo = pDRIInfo;
pDRIPriv->nrWindows = 0; pDRIPriv->nrWindows = 0;
@ -215,89 +367,54 @@ DRIScreenInit(ScreenPtr pScreen, DRIInfoPtr pDRIInfo, int *pDRMFD)
pDRIPriv->grabbedDRILock = FALSE; pDRIPriv->grabbedDRILock = FALSE;
pDRIPriv->drmSIGIOHandlerInstalled = FALSE; pDRIPriv->drmSIGIOHandlerInstalled = FALSE;
if (drmlibmajor == 1 && drmlibminor >= 2) {
drmSetVersion sv;
/* Get the interface version, asking for 1.1. */
sv.drm_di_major = 1;
sv.drm_di_minor = 1;
sv.drm_dd_major = -1;
err = drmSetInterfaceVersion(pDRIPriv->drmFD, &sv);
if (err == 0) {
drmdimajor = sv.drm_di_major;
drmdiminor = sv.drm_di_minor;
} else {
/* failure, so set it to 1.0.0. */
drmdimajor = 1;
drmdiminor = 0;
}
}
else {
/* We can't check the DI DRM interface version, so set it to 1.0.0. */
drmdimajor = 1;
drmdiminor = 0;
}
DRIDrvMsg(pScreen->myNum, X_INFO,
"[drm] DRM interface version %d.%d\n", drmdimajor, drmdiminor);
/* If the interface minor number is 1.1, then we've opened a DRM device
* that already had the busid set through drmOpen.
*/
if (drmdimajor == 1 && drmdiminor >= 1)
err = 0;
else
err = drmSetBusid(pDRIPriv->drmFD, pDRIPriv->pDriverInfo->busIdString);
if (err < 0) {
pDRIPriv->directRenderingSupport = FALSE;
pScreen->devPrivates[DRIScreenPrivIndex].ptr = NULL;
drmClose(pDRIPriv->drmFD);
DRIDrvMsg(pScreen->myNum, X_INFO,
"[drm] drmSetBusid failed (%d, %s), %s\n",
pDRIPriv->drmFD, pDRIPriv->pDriverInfo->busIdString, strerror(-err));
return FALSE;
}
*pDRMFD = pDRIPriv->drmFD; *pDRMFD = pDRIPriv->drmFD;
DRIDrvMsg(pScreen->myNum, X_INFO,
"[drm] created \"%s\" driver at busid \"%s\"\n",
pDRIPriv->pDriverInfo->drmDriverName,
pDRIPriv->pDriverInfo->busIdString);
if (drmAddMap( pDRIPriv->drmFD, if (pDRIEntPriv->sAreaGrabbed || pDRIInfo->allocSarea) {
0,
pDRIPriv->pDriverInfo->SAREASize,
DRM_SHM,
DRM_CONTAINS_LOCK,
&pDRIPriv->hSAREA) < 0)
{
pDRIPriv->directRenderingSupport = FALSE;
pScreen->devPrivates[DRIScreenPrivIndex].ptr = NULL;
drmClose(pDRIPriv->drmFD);
DRIDrvMsg(pScreen->myNum, X_INFO,
"[drm] drmAddMap failed\n");
return FALSE;
}
DRIDrvMsg(pScreen->myNum, X_INFO,
"[drm] added %d byte SAREA at %p\n",
pDRIPriv->pDriverInfo->SAREASize, pDRIPriv->hSAREA);
if (drmMap( pDRIPriv->drmFD, if (drmAddMap( pDRIPriv->drmFD,
pDRIPriv->hSAREA, 0,
pDRIPriv->pDriverInfo->SAREASize, pDRIPriv->pDriverInfo->SAREASize,
(drmAddressPtr)(&pDRIPriv->pSAREA)) < 0) DRM_SHM,
{ 0,
pDRIPriv->directRenderingSupport = FALSE; &pDRIPriv->hSAREA) < 0)
pScreen->devPrivates[DRIScreenPrivIndex].ptr = NULL; {
drmClose(pDRIPriv->drmFD); pDRIPriv->directRenderingSupport = FALSE;
DRIDrvMsg(pScreen->myNum, X_INFO, pScreen->devPrivates[DRIScreenPrivIndex].ptr = NULL;
"[drm] drmMap failed\n"); drmClose(pDRIPriv->drmFD);
return FALSE; DRIDrvMsg(pScreen->myNum, X_INFO,
"[drm] drmAddMap failed\n");
return FALSE;
}
DRIDrvMsg(pScreen->myNum, X_INFO,
"[drm] added %d byte SAREA at %p\n",
pDRIPriv->pDriverInfo->SAREASize, pDRIPriv->hSAREA);
/* Backwards compat. */
if (drmMap( pDRIPriv->drmFD,
pDRIPriv->hSAREA,
pDRIPriv->pDriverInfo->SAREASize,
(drmAddressPtr)(&pDRIPriv->pSAREA)) < 0)
{
pDRIPriv->directRenderingSupport = FALSE;
pScreen->devPrivates[DRIScreenPrivIndex].ptr = NULL;
drmClose(pDRIPriv->drmFD);
DRIDrvMsg(pScreen->myNum, X_INFO,
"[drm] drmMap failed\n");
return FALSE;
}
DRIDrvMsg(pScreen->myNum, X_INFO, "[drm] mapped SAREA %p to %p\n",
pDRIPriv->hSAREA, pDRIPriv->pSAREA);
memset(pDRIPriv->pSAREA, 0, pDRIPriv->pDriverInfo->SAREASize);
} else {
DRIDrvMsg(pScreen->myNum, X_INFO, "[drm] Using the DRM lock "
"SAREA also for drawables.\n");
pDRIPriv->hSAREA = pDRIEntPriv->hLSAREA;
pDRIPriv->pSAREA = (XF86DRISAREAPtr) pDRIEntPriv->pLSAREA;
pDRIEntPriv->sAreaGrabbed = TRUE;
} }
memset(pDRIPriv->pSAREA, 0, pDRIPriv->pDriverInfo->SAREASize);
DRIDrvMsg(pScreen->myNum, X_INFO, "[drm] mapped SAREA %p to %p\n", pDRIPriv->hLSAREA = pDRIEntPriv->hLSAREA;
pDRIPriv->hSAREA, pDRIPriv->pSAREA); pDRIPriv->pLSAREA = pDRIEntPriv->pLSAREA;
if (drmAddMap( pDRIPriv->drmFD, if (drmAddMap( pDRIPriv->drmFD,
(drm_handle_t)pDRIPriv->pDriverInfo->frameBufferPhysicalAddress, (drm_handle_t)pDRIPriv->pDriverInfo->frameBufferPhysicalAddress,
@ -317,22 +434,26 @@ DRIScreenInit(ScreenPtr pScreen, DRIInfoPtr pDRIInfo, int *pDRMFD)
DRIDrvMsg(pScreen->myNum, X_INFO, "[drm] framebuffer handle = %p\n", DRIDrvMsg(pScreen->myNum, X_INFO, "[drm] framebuffer handle = %p\n",
pDRIPriv->hFrameBuffer); pDRIPriv->hFrameBuffer);
/* Add tags for reserved contexts */ if (pDRIEntPriv->resOwner == NULL) {
if ((reserved = drmGetReservedContextList(pDRIPriv->drmFD, pDRIEntPriv->resOwner = pScreen;
&reserved_count))) {
int i;
void *tag;
for (i = 0; i < reserved_count; i++) { /* Add tags for reserved contexts */
tag = DRICreateContextPrivFromHandle(pScreen, if ((reserved = drmGetReservedContextList(pDRIPriv->drmFD,
reserved[i], &reserved_count))) {
DRI_CONTEXT_RESERVED); int i;
drmAddContextTag(pDRIPriv->drmFD, reserved[i], tag); void *tag;
for (i = 0; i < reserved_count; i++) {
tag = DRICreateContextPrivFromHandle(pScreen,
reserved[i],
DRI_CONTEXT_RESERVED);
drmAddContextTag(pDRIPriv->drmFD, reserved[i], tag);
}
drmFreeReservedContextList(reserved);
DRIDrvMsg(pScreen->myNum, X_INFO,
"[drm] added %d reserved context%s for kernel\n",
reserved_count, reserved_count > 1 ? "s" : "");
} }
drmFreeReservedContextList(reserved);
DRIDrvMsg(pScreen->myNum, X_INFO,
"[drm] added %d reserved context%s for kernel\n",
reserved_count, reserved_count > 1 ? "s" : "");
} }
/* validate max drawable table entry set by driver */ /* validate max drawable table entry set by driver */
@ -350,6 +471,14 @@ DRIScreenInit(ScreenPtr pScreen, DRIInfoPtr pDRIInfo, int *pDRMFD)
pDRIPriv->pSAREA->drawableTable[i].flags = 0; pDRIPriv->pSAREA->drawableTable[i].flags = 0;
} }
pDRIPriv->pLockRefCount = &pDRIEntPriv->lockRefCount;
pDRIPriv->pLockingContext = &pDRIEntPriv->lockingContext;
if (!pDRIEntPriv->keepFDOpen)
pDRIEntPriv->keepFDOpen = pDRIInfo->keepFDOpen;
pDRIEntPriv->refCount++;
return TRUE; return TRUE;
} }
@ -491,6 +620,9 @@ DRICloseScreen(ScreenPtr pScreen)
DRIInfoPtr pDRIInfo; DRIInfoPtr pDRIInfo;
drm_context_t * reserved; drm_context_t * reserved;
int reserved_count; int reserved_count;
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
DRIEntPrivPtr pDRIEntPriv = DRI_ENT_PRIV(pScrn);
Bool closeMaster;
if (pDRIPriv && pDRIPriv->directRenderingSupport) { if (pDRIPriv && pDRIPriv->directRenderingSupport) {
@ -543,38 +675,55 @@ DRICloseScreen(ScreenPtr pScreen)
} }
/* Remove tags for reserved contexts */ /* Remove tags for reserved contexts */
if ((reserved = drmGetReservedContextList(pDRIPriv->drmFD, if (pDRIEntPriv->resOwner == pScreen) {
&reserved_count))) { pDRIEntPriv->resOwner = NULL;
int i;
for (i = 0; i < reserved_count; i++) { if ((reserved = drmGetReservedContextList(pDRIPriv->drmFD,
DRIDestroyContextPriv(drmGetContextTag(pDRIPriv->drmFD, &reserved_count))) {
reserved[i])); int i;
for (i = 0; i < reserved_count; i++) {
DRIDestroyContextPriv(drmGetContextTag(pDRIPriv->drmFD,
reserved[i]));
}
drmFreeReservedContextList(reserved);
DRIDrvMsg(pScreen->myNum, X_INFO,
"[drm] removed %d reserved context%s for kernel\n",
reserved_count, reserved_count > 1 ? "s" : "");
} }
drmFreeReservedContextList(reserved);
DRIDrvMsg(pScreen->myNum, X_INFO,
"[drm] removed %d reserved context%s for kernel\n",
reserved_count, reserved_count > 1 ? "s" : "");
} }
/* Make sure signals get unblocked etc. */ /* Make sure signals get unblocked etc. */
drmUnlock(pDRIPriv->drmFD, pDRIPriv->myContext); drmUnlock(pDRIPriv->drmFD, pDRIPriv->myContext);
pDRIPriv->lockRefCount = 0; pDRIPriv->pLockRefCount = NULL;
DRIDrvMsg(pScreen->myNum, X_INFO, closeMaster = (--pDRIEntPriv->refCount == 0) &&
"[drm] unmapping %d bytes of SAREA %p at %p\n", !pDRIEntPriv->keepFDOpen;
pDRIInfo->SAREASize, if (closeMaster || pDRIPriv->hSAREA != pDRIEntPriv->hLSAREA) {
pDRIPriv->hSAREA, DRIDrvMsg(pScreen->myNum, X_INFO,
pDRIPriv->pSAREA); "[drm] unmapping %d bytes of SAREA %p at %p\n",
if (drmUnmap(pDRIPriv->pSAREA, pDRIInfo->SAREASize)) {
DRIDrvMsg(pScreen->myNum, X_ERROR,
"[drm] unable to unmap %d bytes"
" of SAREA %p at %p\n",
pDRIInfo->SAREASize, pDRIInfo->SAREASize,
pDRIPriv->hSAREA, pDRIPriv->hSAREA,
pDRIPriv->pSAREA); pDRIPriv->pSAREA);
if (drmUnmap(pDRIPriv->pSAREA, pDRIInfo->SAREASize)) {
DRIDrvMsg(pScreen->myNum, X_ERROR,
"[drm] unable to unmap %d bytes"
" of SAREA %p at %p\n",
pDRIInfo->SAREASize,
pDRIPriv->hSAREA,
pDRIPriv->pSAREA);
}
} else {
pDRIEntPriv->sAreaGrabbed = FALSE;
} }
drmClose(pDRIPriv->drmFD); if (closeMaster || (pDRIEntPriv->drmFD != pDRIPriv->drmFD)) {
drmClose(pDRIPriv->drmFD);
if (pDRIEntPriv->drmFD == pDRIPriv->drmFD) {
DRIDrvMsg(pScreen->myNum, X_INFO,
"[drm] Closed DRM master.\n");
pDRIEntPriv->drmFD = -1;
}
}
xfree(pDRIPriv); xfree(pDRIPriv);
pScreen->devPrivates[DRIScreenPrivIndex].ptr = NULL; pScreen->devPrivates[DRIScreenPrivIndex].ptr = NULL;
@ -2002,28 +2151,46 @@ void
DRILock(ScreenPtr pScreen, int flags) DRILock(ScreenPtr pScreen, int flags)
{ {
DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
if(!pDRIPriv) return;
if (!pDRIPriv->lockRefCount) if(!pDRIPriv || !pDRIPriv->pLockRefCount) return;
DRM_LOCK(pDRIPriv->drmFD, pDRIPriv->pSAREA, pDRIPriv->myContext, flags);
pDRIPriv->lockRefCount++; if (!*pDRIPriv->pLockRefCount) {
DRM_LOCK(pDRIPriv->drmFD, pDRIPriv->pLSAREA, pDRIPriv->myContext, flags);
*pDRIPriv->pLockingContext = pDRIPriv->myContext;
} else if (*pDRIPriv->pLockingContext != pDRIPriv->myContext) {
DRIDrvMsg(pScreen->myNum, X_ERROR,
"[DRI] Locking deadlock.\n"
"\tAlready locked with context %d,\n"
"\ttrying to lock with context %d.\n",
pDRIPriv->pLockingContext,
pDRIPriv->myContext);
}
(*pDRIPriv->pLockRefCount)++;
} }
void void
DRIUnlock(ScreenPtr pScreen) DRIUnlock(ScreenPtr pScreen)
{ {
DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
if(!pDRIPriv) return;
if (pDRIPriv->lockRefCount > 0) { if(!pDRIPriv || !pDRIPriv->pLockRefCount) return;
pDRIPriv->lockRefCount--;
} if (*pDRIPriv->pLockRefCount > 0) {
else { if (pDRIPriv->myContext != *pDRIPriv->pLockingContext) {
ErrorF("DRIUnlock called when not locked\n"); DRIDrvMsg(pScreen->myNum, X_ERROR,
"[DRI] Unlocking inconsistency:\n"
"\tContext %d trying to unlock lock held by context %d\n",
pDRIPriv->pLockingContext,
pDRIPriv->myContext);
}
(*pDRIPriv->pLockRefCount)--;
} else {
DRIDrvMsg(pScreen->myNum, X_ERROR,
"DRIUnlock called when not locked.\n");
return; return;
} }
if (!pDRIPriv->lockRefCount) if (! *pDRIPriv->pLockRefCount)
DRM_UNLOCK(pDRIPriv->drmFD, pDRIPriv->pSAREA, pDRIPriv->myContext); DRM_UNLOCK(pDRIPriv->drmFD, pDRIPriv->pLSAREA, pDRIPriv->myContext);
} }
void * void *

View File

@ -107,7 +107,7 @@ typedef struct {
*/ */
#define DRIINFO_MAJOR_VERSION 5 #define DRIINFO_MAJOR_VERSION 5
#define DRIINFO_MINOR_VERSION 1 #define DRIINFO_MINOR_VERSION 2
#define DRIINFO_PATCH_VERSION 0 #define DRIINFO_PATCH_VERSION 0
typedef struct { typedef struct {
@ -176,9 +176,17 @@ typedef struct {
/* New with DRI version 5.1.0 */ /* New with DRI version 5.1.0 */
void (*ClipNotify)(ScreenPtr pScreen, WindowPtr *ppWin, int num); void (*ClipNotify)(ScreenPtr pScreen, WindowPtr *ppWin, int num);
/* New with DRI version 5.2.0 */
Bool allocSarea;
Bool keepFDOpen;
} DRIInfoRec, *DRIInfoPtr; } DRIInfoRec, *DRIInfoPtr;
extern Bool DRIOpenDRMMaster(ScrnInfoPtr pScrn, unsigned long sAreaSize,
const char *busID,
const char *drmDriverName);
extern Bool DRIScreenInit(ScreenPtr pScreen, extern Bool DRIScreenInit(ScreenPtr pScreen,
DRIInfoPtr pDRIInfo, DRIInfoPtr pDRIInfo,
int *pDRMFD); int *pDRMFD);
@ -344,6 +352,14 @@ extern char *DRICreatePCIBusID(pciVideoPtr PciInfo);
extern int drmInstallSIGIOHandler(int fd, void (*f)(int, void *, void *)); extern int drmInstallSIGIOHandler(int fd, void (*f)(int, void *, void *));
extern int drmRemoveSIGIOHandler(int fd); extern int drmRemoveSIGIOHandler(int fd);
extern int DRIMasterFD(ScrnInfoPtr pScrn);
extern void *DRIMasterSareaPointer(ScrnInfoPtr pScrn);
extern drm_handle_t DRIMasterSareaHandle(ScrnInfoPtr pScrn);
#define _DRI_H_ #define _DRI_H_
#endif #endif

View File

@ -73,6 +73,11 @@ struct _DRIContextPrivRec
#define DRI_SCREEN_PRIV_FROM_INDEX(screenIndex) ((DRIScreenPrivPtr) \ #define DRI_SCREEN_PRIV_FROM_INDEX(screenIndex) ((DRIScreenPrivPtr) \
(screenInfo.screens[screenIndex]->devPrivates[DRIScreenPrivIndex].ptr)) (screenInfo.screens[screenIndex]->devPrivates[DRIScreenPrivIndex].ptr))
#define DRI_ENT_PRIV(pScrn) \
((DRIEntPrivIndex < 0) ? \
NULL: \
((DRIEntPrivPtr)(xf86GetEntityPrivate((pScrn)->entityList[0], \
DRIEntPrivIndex)->ptr)))
typedef struct _DRIScreenPrivRec typedef struct _DRIScreenPrivRec
{ {
@ -103,6 +108,25 @@ typedef struct _DRIScreenPrivRec
Bool wrapped; Bool wrapped;
Bool windowsTouched; Bool windowsTouched;
int lockRefCount; int lockRefCount;
drm_handle_t hLSAREA; /* Handle to SAREA containing lock, for mapping */
XF86DRILSAREAPtr pLSAREA; /* Mapped pointer to SAREA containing lock */
int* pLockRefCount;
int* pLockingContext;
} DRIScreenPrivRec, *DRIScreenPrivPtr; } DRIScreenPrivRec, *DRIScreenPrivPtr;
typedef struct _DRIEntPrivRec {
int drmFD;
Bool drmOpened;
Bool sAreaGrabbed;
drm_handle_t hLSAREA;
XF86DRILSAREAPtr pLSAREA;
unsigned long sAreaSize;
int lockRefCount;
int lockingContext;
ScreenPtr resOwner;
Bool keepFDOpen;
int refCount;
} DRIEntPrivRec, *DRIEntPrivPtr;
#endif /* DRI_STRUCT_H */ #endif /* DRI_STRUCT_H */

View File

@ -89,4 +89,9 @@ typedef struct _XF86DRISAREA {
drm_context_t dummy_context; drm_context_t dummy_context;
} XF86DRISAREARec, *XF86DRISAREAPtr; } XF86DRISAREARec, *XF86DRISAREAPtr;
typedef struct _XF86DRILSAREA {
drmLock lock;
drmLock otherLocks[31];
} XF86DRILSAREARec, *XF86DRILSAREAPtr;
#endif #endif

View File

@ -869,7 +869,7 @@ doLoadModule(const char *module, const char *path, const char **subdirlist,
for (cim = compiled_in_modules; *cim; cim++) for (cim = compiled_in_modules; *cim; cim++)
if (!strcmp (module, *cim)) if (!strcmp (module, *cim))
{ {
xf86MsgVerb(X_INFO, 3, "Module already built-in\n"); xf86MsgVerb(X_INFO, 0, "Module already built-in\n");
return (ModuleDescPtr) 1; return (ModuleDescPtr) 1;
} }

View File

@ -414,22 +414,51 @@ xf86OutputSetMonitor (xf86OutputPtr output)
xfree (option_name); xfree (option_name);
output->conf_monitor = xf86findMonitor (monitor, output->conf_monitor = xf86findMonitor (monitor,
xf86configptr->conf_monitor_lst); xf86configptr->conf_monitor_lst);
/*
* Find the monitor section of the screen and use that
*/
if (!output->conf_monitor && output->use_screen_monitor)
output->conf_monitor = xf86findMonitor (output->scrn->monitor->id,
xf86configptr->conf_monitor_lst);
if (output->conf_monitor) if (output->conf_monitor)
{
xf86DrvMsg (output->scrn->scrnIndex, X_INFO,
"Output %s using monitor section %s\n",
output->name, output->conf_monitor->mon_identifier);
xf86ProcessOptions (output->scrn->scrnIndex, xf86ProcessOptions (output->scrn->scrnIndex,
output->conf_monitor->mon_option_lst, output->conf_monitor->mon_option_lst,
output->options); output->options);
}
else
xf86DrvMsg (output->scrn->scrnIndex, X_INFO,
"Output %s has no monitor section\n",
output->name);
} }
static Bool static Bool
xf86OutputEnabled (xf86OutputPtr output) xf86OutputEnabled (xf86OutputPtr output)
{ {
/* Check to see if this output was disabled in the config file */ Bool enable, disable;
if (xf86ReturnOptValBool (output->options, OPTION_ENABLE, TRUE) == FALSE ||
xf86ReturnOptValBool (output->options, OPTION_DISABLE, FALSE) == TRUE) /* check to see if this output was enabled in the config file */
if (xf86GetOptValBool (output->options, OPTION_ENABLE, &enable) && enable)
{ {
xf86DrvMsg (output->scrn->scrnIndex, X_INFO,
"Output %s enabled by config file\n", output->name);
return TRUE;
}
/* or if this output was disabled in the config file */
if (xf86GetOptValBool (output->options, OPTION_DISABLE, &disable) && disable)
{
xf86DrvMsg (output->scrn->scrnIndex, X_INFO,
"Output %s disabled by config file\n", output->name);
return FALSE; return FALSE;
} }
return TRUE; /* otherwise, enable if it is not disconnected */
enable = output->status != XF86OutputStatusDisconnected;
xf86DrvMsg (output->scrn->scrnIndex, X_INFO,
"Output %s %sconnected\n", output->name, enable ? "" : "dis");
return enable;
} }
static Bool static Bool
@ -463,7 +492,7 @@ xf86OutputInitialRotation (xf86OutputPtr output)
xf86OutputPtr xf86OutputPtr
xf86OutputCreate (ScrnInfoPtr scrn, xf86OutputCreate (ScrnInfoPtr scrn,
const xf86OutputFuncsRec *funcs, const xf86OutputFuncsRec *funcs,
const char *name) const char *name)
{ {
xf86OutputPtr output, *outputs; xf86OutputPtr output, *outputs;
@ -486,6 +515,10 @@ xf86OutputCreate (ScrnInfoPtr scrn,
strcpy (output->name, name); strcpy (output->name, name);
} }
output->subpixel_order = SubPixelUnknown; output->subpixel_order = SubPixelUnknown;
/*
* Use the old per-screen monitor section for the first output
*/
output->use_screen_monitor = (xf86_config->num_output == 0);
#ifdef RANDR_12_INTERFACE #ifdef RANDR_12_INTERFACE
output->randr_output = NULL; output->randr_output = NULL;
#endif #endif
@ -536,6 +569,16 @@ xf86OutputRename (xf86OutputPtr output, const char *name)
return TRUE; return TRUE;
} }
void
xf86OutputUseScreenMonitor (xf86OutputPtr output, Bool use_screen_monitor)
{
if (use_screen_monitor != output->use_screen_monitor)
{
output->use_screen_monitor = use_screen_monitor;
xf86OutputSetMonitor (output);
}
}
void void
xf86OutputDestroy (xf86OutputPtr output) xf86OutputDestroy (xf86OutputPtr output)
{ {
@ -1203,7 +1246,7 @@ xf86ProbeOutputModes (ScrnInfoPtr scrn, int maxX, int maxY)
*/ */
output->status = (*output->funcs->detect)(output); output->status = (*output->funcs->detect)(output);
if (output->status == XF86OutputStatusDisconnected) if (!xf86OutputEnabled (output))
{ {
xf86OutputSetEDID (output, NULL); xf86OutputSetEDID (output, NULL);
continue; continue;
@ -1514,8 +1557,7 @@ xf86InitialConfiguration (ScrnInfoPtr scrn, Bool canGrow)
xf86OutputPtr output = config->output[o]; xf86OutputPtr output = config->output[o];
modes[o] = NULL; modes[o] = NULL;
enabled[o] = (xf86OutputEnabled (output) && enabled[o] = xf86OutputEnabled (output);
output->status != XF86OutputStatusDisconnected);
} }
/* /*
@ -1560,8 +1602,20 @@ xf86InitialConfiguration (ScrnInfoPtr scrn, Bool canGrow)
{ {
xf86OutputPtr output = config->output[o]; xf86OutputPtr output = config->output[o];
if (enabled[o] && !modes[o]) if (enabled[o])
modes[o] = xf86ClosestMode (output, target_mode, target_rotation, width, height); {
if (!modes[o])
modes[o] = xf86ClosestMode (output, target_mode,
target_rotation, width, height);
if (!modes[o])
xf86DrvMsg (scrn->scrnIndex, X_ERROR,
"Output %s enabled but has no modes\n",
output->name);
else
xf86DrvMsg (scrn->scrnIndex, X_INFO,
"Output %s using initial mode %s\n",
output->name, modes[o]->name);
}
} }
/* /*
@ -1849,7 +1903,9 @@ xf86SetSingleMode (ScrnInfoPtr pScrn, DisplayModePtr desired, Rotation rotation)
} }
} }
xf86DisableUnusedFunctions(pScrn); xf86DisableUnusedFunctions(pScrn);
#if RANDR_12_INTERFACE
xf86RandR12TellChanged (pScrn->pScreen); xf86RandR12TellChanged (pScrn->pScreen);
#endif
return ok; return ok;
} }

View File

@ -479,6 +479,9 @@ struct _xf86Output {
/** driver private information */ /** driver private information */
void *driver_private; void *driver_private;
/** Whether to use the old per-screen Monitor config section */
Bool use_screen_monitor;
#ifdef RANDR_12_INTERFACE #ifdef RANDR_12_INTERFACE
/** /**
* RandR 1.2 output structure. * RandR 1.2 output structure.
@ -618,9 +621,12 @@ xf86CrtcInUse (xf86CrtcPtr crtc);
* Output functions * Output functions
*/ */
xf86OutputPtr xf86OutputPtr
xf86OutputCreate (ScrnInfoPtr scrn, xf86OutputCreate (ScrnInfoPtr scrn,
const xf86OutputFuncsRec *funcs, const xf86OutputFuncsRec *funcs,
const char *name); const char *name);
void
xf86OutputUseScreenMonitor (xf86OutputPtr output, Bool use_screen_monitor);
Bool Bool
xf86OutputRename (xf86OutputPtr output, const char *name); xf86OutputRename (xf86OutputPtr output, const char *name);

View File

@ -82,6 +82,16 @@ static Bool quirk_prefer_large_60 (int scrnIndex, xf86MonPtr DDC)
DDC->vendor.prod_id == 1516) DDC->vendor.prod_id == 1516)
return TRUE; return TRUE;
/* Acer AL1706 */
if (memcmp (DDC->vendor.name, "ACR", 4) == 0 &&
DDC->vendor.prod_id == 44358)
return TRUE;
/* Samsung SyncMaster 226BW */
if (memcmp (DDC->vendor.name, "SAM", 4) == 0 &&
DDC->vendor.prod_id == 638)
return TRUE;
return FALSE; return FALSE;
} }

View File

@ -338,6 +338,7 @@ xf86RandR12ScreenSetSize (ScreenPtr pScreen,
ScrnInfoPtr pScrn = XF86SCRNINFO(pScreen); ScrnInfoPtr pScrn = XF86SCRNINFO(pScreen);
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn); xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
WindowPtr pRoot = WindowTable[pScreen->myNum]; WindowPtr pRoot = WindowTable[pScreen->myNum];
PixmapPtr pScrnPix = (*pScreen->GetScreenPixmap)(pScreen);
Bool ret = FALSE; Bool ret = FALSE;
if (randrp->virtualX == -1 || randrp->virtualY == -1) if (randrp->virtualX == -1 || randrp->virtualY == -1)
@ -354,8 +355,8 @@ xf86RandR12ScreenSetSize (ScreenPtr pScreen,
ret = TRUE; ret = TRUE;
pScreen->width = width; pScreen->width = pScrnPix->drawable.width = width;
pScreen->height = height; pScreen->height = pScrnPix->drawable.height = height;
pScreen->mmWidth = mmWidth; pScreen->mmWidth = mmWidth;
pScreen->mmHeight = mmHeight; pScreen->mmHeight = mmHeight;

View File

@ -24,6 +24,9 @@
#define _XF86_RANDR_H_ #define _XF86_RANDR_H_
#include <randrstr.h> #include <randrstr.h>
#include <X11/extensions/render.h> #include <X11/extensions/render.h>
#if XF86_MODES_RENAME
#include "xf86Rename.h"
#endif
Bool xf86RandR12CreateScreenResources (ScreenPtr pScreen); Bool xf86RandR12CreateScreenResources (ScreenPtr pScreen);
Bool xf86RandR12Init(ScreenPtr pScreen); Bool xf86RandR12Init(ScreenPtr pScreen);

View File

@ -25,6 +25,12 @@
#include "local_xf86Rename.h" #include "local_xf86Rename.h"
#define xf86_cursors_fini XF86NAME(xf86_cursors_fini)
#define xf86_cursors_init XF86NAME(xf86_cursors_init)
#define xf86_hide_cursors XF86NAME(xf86_hide_cursors)
#define xf86_reload_cursors XF86NAME(xf86_reload_cursors)
#define xf86_show_cursors XF86NAME(xf86_show_cursors)
#define xf86ConnectorGetName XF86NAME(xf86ConnectorGetName)
#define xf86CrtcConfigInit XF86NAME(xf86CrtcConfigInit) #define xf86CrtcConfigInit XF86NAME(xf86CrtcConfigInit)
#define xf86CrtcConfigPrivateIndex XF86NAME(xf86CrtcConfigPrivateIndex) #define xf86CrtcConfigPrivateIndex XF86NAME(xf86CrtcConfigPrivateIndex)
#define xf86CrtcCreate XF86NAME(xf86CrtcCreate) #define xf86CrtcCreate XF86NAME(xf86CrtcCreate)
@ -35,6 +41,7 @@
#define xf86CrtcSetMode XF86NAME(xf86CrtcSetMode) #define xf86CrtcSetMode XF86NAME(xf86CrtcSetMode)
#define xf86CrtcSetSizeRange XF86NAME(xf86CrtcSetSizeRange) #define xf86CrtcSetSizeRange XF86NAME(xf86CrtcSetSizeRange)
#define xf86CVTMode XF86NAME(xf86CVTMode) #define xf86CVTMode XF86NAME(xf86CVTMode)
#define xf86DDCMonitorSet XF86NAME(xf86DDCMonitorSet)
#define xf86DisableUnusedFunctions XF86NAME(xf86DisableUnusedFunctions) #define xf86DisableUnusedFunctions XF86NAME(xf86DisableUnusedFunctions)
#define xf86DPMSSet XF86NAME(xf86DPMSSet) #define xf86DPMSSet XF86NAME(xf86DPMSSet)
#define xf86DuplicateMode XF86NAME(xf86DuplicateMode) #define xf86DuplicateMode XF86NAME(xf86DuplicateMode)
@ -52,9 +59,11 @@
#define xf86OutputGetEDIDModes XF86NAME(xf86OutputGetEDIDModes) #define xf86OutputGetEDIDModes XF86NAME(xf86OutputGetEDIDModes)
#define xf86OutputRename XF86NAME(xf86OutputRename) #define xf86OutputRename XF86NAME(xf86OutputRename)
#define xf86OutputSetEDID XF86NAME(xf86OutputSetEDID) #define xf86OutputSetEDID XF86NAME(xf86OutputSetEDID)
#define xf86OutputUseScreenMonitor XF86NAME(xf86OutputUseScreenMonitor)
#define xf86PrintModeline XF86NAME(xf86PrintModeline) #define xf86PrintModeline XF86NAME(xf86PrintModeline)
#define xf86ProbeOutputModes XF86NAME(xf86ProbeOutputModes) #define xf86ProbeOutputModes XF86NAME(xf86ProbeOutputModes)
#define xf86PruneInvalidModes XF86NAME(xf86PruneInvalidModes) #define xf86PruneInvalidModes XF86NAME(xf86PruneInvalidModes)
#define xf86RotateCloseScreen XF86NAME(xf86RotateCloseScreen)
#define xf86SetModeCrtc XF86NAME(xf86SetModeCrtc) #define xf86SetModeCrtc XF86NAME(xf86SetModeCrtc)
#define xf86SetModeDefaultName XF86NAME(xf86SetModeDefaultName) #define xf86SetModeDefaultName XF86NAME(xf86SetModeDefaultName)
#define xf86SetScrnInfoModes XF86NAME(xf86SetScrnInfoModes) #define xf86SetScrnInfoModes XF86NAME(xf86SetScrnInfoModes)

View File

@ -278,13 +278,23 @@ xf86RotateRedisplay(ScreenPtr pScreen)
region = DamageRegion(damage); region = DamageRegion(damage);
if (REGION_NOTEMPTY(pScreen, region)) if (REGION_NOTEMPTY(pScreen, region))
{ {
int c; int c;
SourceValidateProcPtr SourceValidate;
/*
* SourceValidate is used by the software cursor code
* to pull the cursor off of the screen when reading
* bits from the frame buffer. Bypassing this function
* leaves the software cursor in place
*/
SourceValidate = pScreen->SourceValidate;
pScreen->SourceValidate = NULL;
for (c = 0; c < xf86_config->num_crtc; c++) for (c = 0; c < xf86_config->num_crtc; c++)
{ {
xf86CrtcPtr crtc = xf86_config->crtc[c]; xf86CrtcPtr crtc = xf86_config->crtc[c];
if (crtc->rotation != RR_Rotate_0) if (crtc->rotation != RR_Rotate_0 && crtc->enabled)
{ {
BoxRec box; BoxRec box;
RegionRec crtc_damage; RegionRec crtc_damage;
@ -304,6 +314,7 @@ xf86RotateRedisplay(ScreenPtr pScreen)
REGION_UNINIT (pScreen, &crtc_damage); REGION_UNINIT (pScreen, &crtc_damage);
} }
} }
pScreen->SourceValidate = SourceValidate;
DamageEmpty(damage); DamageEmpty(damage);
} }
} }
@ -338,7 +349,8 @@ xf86RotateDestroy (xf86CrtcPtr crtc)
} }
for (c = 0; c < xf86_config->num_crtc; c++) for (c = 0; c < xf86_config->num_crtc; c++)
if (crtc->rotatedPixmap || crtc->rotatedData) if (xf86_config->crtc[c]->rotatedPixmap ||
xf86_config->crtc[c]->rotatedData)
return; return;
/* /*

View File

@ -232,14 +232,14 @@ _X_EXPORT int pciNumBuses = 0; /* Actual number of PCI buses */
int pciMaxBusNum = MAX_PCI_BUSES; int pciMaxBusNum = MAX_PCI_BUSES;
static Bool inProbe = FALSE; static Bool inProbe = FALSE;
static pciConfigPtr pci_devp[MAX_PCI_DEVICES + 1] = {NULL, }; static pciConfigPtr *pci_devp = NULL;
static int readPciBios( PCITAG Tag, CARD8* tmp, ADDRESS hostbase, static int readPciBios( PCITAG Tag, CARD8* tmp, ADDRESS hostbase,
unsigned char * buf, int len, PciBiosType BiosType ); unsigned char * buf, int len, PciBiosType BiosType );
static int (*pciOSHandleBIOS)(PCITAG Tag, int basereg, unsigned char *buf, int len); static int (*pciOSHandleBIOS)(PCITAG Tag, int basereg, unsigned char *buf, int len);
int xf86MaxPciDevs = MAX_PCI_DEVICES; int xf86MaxPciDevs = 0;
/* /*
* Platform specific PCI function pointers. * Platform specific PCI function pointers.
@ -272,6 +272,14 @@ pciInit()
if (pciNumBuses <= 0) if (pciNumBuses <= 0)
ARCH_PCI_OS_INIT(); ARCH_PCI_OS_INIT();
#endif #endif
if (xf86MaxPciDevs == 0) {
xf86Msg(X_WARNING,
"OS did not count PCI devices, guessing wildly\n");
xf86MaxPciDevs = MAX_PCI_DEVICES;
}
if (pci_devp)
xfree(pci_devp);
pci_devp = xnfcalloc(xf86MaxPciDevs + 1, sizeof(pciConfigPtr));
} }
void pciSetOSBIOSPtr(int (*bios_fn)(PCITAG Tag, int basereg, unsigned char * buf, int len)) void pciSetOSBIOSPtr(int (*bios_fn)(PCITAG Tag, int basereg, unsigned char * buf, int len))
@ -920,7 +928,7 @@ xf86scanpci(int flags)
* result in an endless recursion if platform/OS specific PCI * result in an endless recursion if platform/OS specific PCI
* bus probing code calls this function from with in it. * bus probing code calls this function from with in it.
*/ */
if (done || pci_devp[0]) if (done || pci_devp)
return pci_devp; return pci_devp;
done = TRUE; done = TRUE;

View File

@ -1,4 +1,4 @@
noinst_LTLIBRARIES = libminimi.la libmi.la noinst_LTLIBRARIES = libmi.la
if XORG if XORG
sdk_HEADERS = mibank.h micmap.h miline.h mipointer.h mi.h mibstore.h \ sdk_HEADERS = mibank.h micmap.h miline.h mipointer.h mi.h mibstore.h \
@ -8,8 +8,7 @@ endif
AM_CFLAGS = $(DIX_CFLAGS) AM_CFLAGS = $(DIX_CFLAGS)
# libminimi is for dmx - it has different defines for miinitext.c libmi_la_SOURCES = \
libminimi_la_SOURCES = \
cbrt.c \ cbrt.c \
mi.h \ mi.h \
miarc.c \ miarc.c \
@ -70,6 +69,4 @@ libminimi_la_SOURCES = \
mizerclip.c \ mizerclip.c \
mizerline.c mizerline.c
libmi_la_SOURCES = $(libminimi_la_SOURCES)
INCLUDES = -I$(top_srcdir)/mfb INCLUDES = -I$(top_srcdir)/mfb

View File

@ -30,6 +30,7 @@
#include "gcstruct.h" #include "gcstruct.h"
#include "pixmapstr.h" #include "pixmapstr.h"
#include "cw.h" #include "cw.h"
#include "mi.h"
#define SETUP_BACKING_DST(_pDst, _pGC) \ #define SETUP_BACKING_DST(_pDst, _pGC) \
cwGCPtr pGCPrivate = getCwGC (_pGC); \ cwGCPtr pGCPrivate = getCwGC (_pGC); \
@ -185,7 +186,7 @@ cwCopyArea(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC, int srcx, int srcy,
int w, int h, int dstx, int dsty) int w, int h, int dstx, int dsty)
{ {
int odstx, odsty; int odstx, odsty;
RegionPtr exposed = NULL; int osrcx, osrcy;
SETUP_BACKING_DST(pDst, pGC); SETUP_BACKING_DST(pDst, pGC);
SETUP_BACKING_SRC(pSrc, pGC); SETUP_BACKING_SRC(pSrc, pGC);
@ -193,19 +194,20 @@ cwCopyArea(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC, int srcx, int srcy,
odstx = dstx; odstx = dstx;
odsty = dsty; odsty = dsty;
osrcx = srcx;
osrcy = srcy;
CW_OFFSET_XY_DST(dstx, dsty); CW_OFFSET_XY_DST(dstx, dsty);
CW_OFFSET_XY_SRC(srcx, srcy); CW_OFFSET_XY_SRC(srcx, srcy);
exposed = (*pBackingGC->ops->CopyArea)(pBackingSrc, pBackingDst, (*pBackingGC->ops->CopyArea)(pBackingSrc, pBackingDst,
pBackingGC, srcx, srcy, w, h, pBackingGC, srcx, srcy, w, h,
dstx, dsty); dstx, dsty);
if (exposed != NULL)
REGION_TRANSLATE(pDst->pScreen, exposed, odstx - dstx, odsty - dsty);
EPILOGUE(pGC); EPILOGUE(pGC);
return exposed; return miHandleExposures(pSrc, pDst, pGC,
osrcx, osrcy, w, h,
odstx, odsty, 0);
} }
static RegionPtr static RegionPtr
@ -213,7 +215,7 @@ cwCopyPlane(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC, int srcx, int srcy,
int w, int h, int dstx, int dsty, unsigned long plane) int w, int h, int dstx, int dsty, unsigned long plane)
{ {
int odstx, odsty; int odstx, odsty;
RegionPtr exposed = NULL; int osrcx, osrcy;
SETUP_BACKING_DST(pDst, pGC); SETUP_BACKING_DST(pDst, pGC);
SETUP_BACKING_SRC(pSrc, pGC); SETUP_BACKING_SRC(pSrc, pGC);
@ -221,19 +223,20 @@ cwCopyPlane(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC, int srcx, int srcy,
odstx = dstx; odstx = dstx;
odsty = dsty; odsty = dsty;
osrcx = srcx;
osrcy = srcy;
CW_OFFSET_XY_DST(dstx, dsty); CW_OFFSET_XY_DST(dstx, dsty);
CW_OFFSET_XY_SRC(srcx, srcy); CW_OFFSET_XY_SRC(srcx, srcy);
exposed = (*pBackingGC->ops->CopyPlane)(pBackingSrc, pBackingDst, (*pBackingGC->ops->CopyPlane)(pBackingSrc, pBackingDst,
pBackingGC, srcx, srcy, w, h, pBackingGC, srcx, srcy, w, h,
dstx, dsty, plane); dstx, dsty, plane);
if (exposed != NULL)
REGION_TRANSLATE(pDst->pScreen, exposed, odstx - dstx, odsty - dsty);
EPILOGUE(pGC); EPILOGUE(pGC);
return exposed; return miHandleExposures(pSrc, pDst, pGC,
osrcx, osrcy, w, h,
odstx, odsty, plane);
} }
static void static void

View File

@ -518,6 +518,7 @@ ProcRRGetCrtcInfo (ClientPtr client)
RROutput *outputs; RROutput *outputs;
RROutput *possible; RROutput *possible;
int i, j, k, n; int i, j, k, n;
int width, height;
REQUEST_SIZE_MATCH(xRRGetCrtcInfoReq); REQUEST_SIZE_MATCH(xRRGetCrtcInfoReq);
crtc = LookupCrtc(client, stuff->crtc, DixReadAccess); crtc = LookupCrtc(client, stuff->crtc, DixReadAccess);
@ -540,8 +541,9 @@ ProcRRGetCrtcInfo (ClientPtr client)
rep.timestamp = pScrPriv->lastSetTime.milliseconds; rep.timestamp = pScrPriv->lastSetTime.milliseconds;
rep.x = crtc->x; rep.x = crtc->x;
rep.y = crtc->y; rep.y = crtc->y;
rep.width = mode ? mode->mode.width : 0; RRCrtcGetScanoutSize (crtc, &width, &height);
rep.height = mode ? mode->mode.height : 0; rep.width = width;
rep.height = height;
rep.mode = mode ? mode->mode.id : 0; rep.mode = mode ? mode->mode.id : 0;
rep.rotation = crtc->rotation; rep.rotation = crtc->rotation;
rep.rotations = crtc->rotations; rep.rotations = crtc->rotations;

View File

@ -428,6 +428,14 @@ RRXineramaExtensionInit(void)
return; return;
#endif #endif
/*
* Xinerama isn't capable enough to have multiple protocol screens each
* with their own output geometry. So if there's more than one protocol
* screen, just don't even try.
*/
if (screenInfo.numScreens > 1)
return;
(void) AddExtension(PANORAMIX_PROTOCOL_NAME, 0,0, (void) AddExtension(PANORAMIX_PROTOCOL_NAME, 0,0,
ProcRRXineramaDispatch, ProcRRXineramaDispatch,
SProcRRXineramaDispatch, SProcRRXineramaDispatch,

View File

@ -890,54 +890,22 @@ static unsigned int INTERPOLATE_PIXEL_256(unsigned int x, unsigned int a,
return x; return x;
} }
static void initGradientColorTable(SourcePictPtr pGradient, int *error) CARD32
PictureGradientColor (PictGradientStopPtr stop1,
PictGradientStopPtr stop2,
CARD32 x)
{ {
int begin_pos, end_pos; CARD32 current_color, next_color;
xFixed incr, dpos; int dist, idist;
int pos, current_stop;
PictGradientStopPtr stops = pGradient->linear.stops;
int nstops = pGradient->linear.nstops;
/* The position where the gradient begins and ends */ current_color = xRenderColorToCard32 (stop1->color);
begin_pos = (stops[0].x * PICT_GRADIENT_STOPTABLE_SIZE) >> 16; next_color = xRenderColorToCard32 (stop2->color);
end_pos = (stops[nstops - 1].x * PICT_GRADIENT_STOPTABLE_SIZE) >> 16;
pos = 0; /* The position in the color table. */ dist = (int) (256 * (x - stop1->x) / (stop2->x - stop1->x));
idist = 256 - dist;
/* Up to first point */ return premultiply (INTERPOLATE_PIXEL_256 (current_color, idist,
while (pos <= begin_pos) { next_color, dist));
pGradient->linear.colorTable[pos] = xRenderColorToCard32(stops[0].color);
++pos;
}
incr = (1<<16)/ PICT_GRADIENT_STOPTABLE_SIZE; /* the double increment. */
dpos = incr * pos; /* The position in terms of 0-1. */
current_stop = 0; /* We always interpolate between current and current + 1. */
/* Gradient area */
while (pos < end_pos) {
unsigned int current_color = xRenderColorToCard32(stops[current_stop].color);
unsigned int next_color = xRenderColorToCard32(stops[current_stop + 1].color);
int dist = (int)(256*(dpos - stops[current_stop].x)
/ (stops[current_stop+1].x - stops[current_stop].x));
int idist = 256 - dist;
pGradient->linear.colorTable[pos] = premultiply(INTERPOLATE_PIXEL_256(current_color, idist, next_color, dist));
++pos;
dpos += incr;
if (dpos > stops[current_stop + 1].x)
++current_stop;
}
/* After last point */
while (pos < PICT_GRADIENT_STOPTABLE_SIZE) {
pGradient->linear.colorTable[pos] = xRenderColorToCard32(stops[nstops - 1].color);
++pos;
}
} }
static void initGradient(SourcePictPtr pGradient, int stopCount, static void initGradient(SourcePictPtr pGradient, int stopCount,
@ -953,26 +921,30 @@ static void initGradient(SourcePictPtr pGradient, int stopCount,
dpos = -1; dpos = -1;
for (i = 0; i < stopCount; ++i) { for (i = 0; i < stopCount; ++i) {
if (stopPoints[i] <= dpos || stopPoints[i] > (1<<16)) { if (stopPoints[i] < dpos || stopPoints[i] > (1<<16)) {
*error = BadValue; *error = BadValue;
return; return;
} }
dpos = stopPoints[i]; dpos = stopPoints[i];
} }
pGradient->linear.stops = xalloc(stopCount*sizeof(PictGradientStop)); pGradient->gradient.stops = xalloc(stopCount*sizeof(PictGradientStop));
if (!pGradient->linear.stops) { if (!pGradient->gradient.stops) {
*error = BadAlloc; *error = BadAlloc;
return; return;
} }
pGradient->linear.nstops = stopCount; pGradient->gradient.nstops = stopCount;
for (i = 0; i < stopCount; ++i) { for (i = 0; i < stopCount; ++i) {
pGradient->linear.stops[i].x = stopPoints[i]; pGradient->gradient.stops[i].x = stopPoints[i];
pGradient->linear.stops[i].color = stopColors[i]; pGradient->gradient.stops[i].color = stopColors[i];
} }
initGradientColorTable(pGradient, error);
pGradient->gradient.class = SourcePictClassUnknown;
pGradient->gradient.stopRange = 0xffff;
pGradient->gradient.colorTable = NULL;
pGradient->gradient.colorTableSize = 0;
} }
static PicturePtr createSourcePicture(void) static PicturePtr createSourcePicture(void)
@ -980,9 +952,9 @@ static PicturePtr createSourcePicture(void)
PicturePtr pPicture; PicturePtr pPicture;
pPicture = (PicturePtr) xalloc(sizeof(PictureRec)); pPicture = (PicturePtr) xalloc(sizeof(PictureRec));
pPicture->pDrawable = 0; pPicture->pDrawable = 0;
pPicture->format = PICT_a8r8g8b8;
pPicture->pFormat = 0; pPicture->pFormat = 0;
pPicture->pNext = 0; pPicture->pNext = 0;
pPicture->format = PICT_a8r8g8b8;
pPicture->devPrivates = 0; pPicture->devPrivates = 0;
SetPictureToDefaults(pPicture); SetPictureToDefaults(pPicture);
@ -1027,10 +999,6 @@ CreateLinearGradientPicture (Picture pid, xPointFixed *p1, xPointFixed *p2,
*error = BadAlloc; *error = BadAlloc;
return 0; return 0;
} }
if (p1->x == p2->x && p1->y == p2->y) {
*error = BadValue;
return 0;
}
pPicture->id = pid; pPicture->id = pid;
pPicture->pSourcePict = (SourcePictPtr) xalloc(sizeof(PictLinearGradient)); pPicture->pSourcePict = (SourcePictPtr) xalloc(sizeof(PictLinearGradient));
@ -1072,14 +1040,6 @@ CreateRadialGradientPicture (Picture pid, xPointFixed *inner, xPointFixed *outer
*error = BadAlloc; *error = BadAlloc;
return 0; return 0;
} }
{
double dx = (double)(inner->x - outer->x);
double dy = (double)(inner->y - outer->y);
if (sqrt(dx*dx + dy*dy) + (double)(innerRadius) > (double)(outerRadius)) {
*error = BadValue;
return 0;
}
}
pPicture->id = pid; pPicture->id = pid;
pPicture->pSourcePict = (SourcePictPtr) xalloc(sizeof(PictRadialGradient)); pPicture->pSourcePict = (SourcePictPtr) xalloc(sizeof(PictRadialGradient));
@ -1091,22 +1051,19 @@ CreateRadialGradientPicture (Picture pid, xPointFixed *inner, xPointFixed *outer
radial = &pPicture->pSourcePict->radial; radial = &pPicture->pSourcePict->radial;
radial->type = SourcePictTypeRadial; radial->type = SourcePictTypeRadial;
{ radial->c1.x = inner->x;
double x = (double)innerRadius / (double)outerRadius; radial->c1.y = inner->y;
radial->dx = (outer->x - inner->x); radial->c1.radius = innerRadius;
radial->dy = (outer->y - inner->y); radial->c2.x = outer->x;
radial->fx = (inner->x) - x*radial->dx; radial->c2.y = outer->y;
radial->fy = (inner->y) - x*radial->dy; radial->c2.radius = outerRadius;
radial->m = 1./(1+x); radial->cdx = (radial->c2.x - radial->c1.x) / 65536.;
radial->b = -x*radial->m; radial->cdy = (radial->c2.y - radial->c1.y) / 65536.;
radial->dx /= 65536.; radial->dr = (radial->c2.radius - radial->c1.radius) / 65536.;
radial->dy /= 65536.; radial->A = ( radial->cdx * radial->cdx
radial->fx /= 65536.; + radial->cdy * radial->cdy
radial->fy /= 65536.; - radial->dr * radial->dr);
x = outerRadius/65536.;
radial->a = x*x - radial->dx*radial->dx - radial->dy*radial->dy;
}
initGradient(pPicture->pSourcePict, nStops, stops, colors, error); initGradient(pPicture->pSourcePict, nStops, stops, colors, error);
if (*error) { if (*error) {
xfree(pPicture); xfree(pPicture);
@ -1627,13 +1584,17 @@ FreePicture (pointer value,
{ {
if (pPicture->transform) if (pPicture->transform)
xfree (pPicture->transform); xfree (pPicture->transform);
if (!pPicture->pDrawable) {
if (pPicture->pSourcePict) { if (pPicture->pSourcePict)
if (pPicture->pSourcePict->type != SourcePictTypeSolidFill) {
xfree(pPicture->pSourcePict->linear.stops); if (pPicture->pSourcePict->type != SourcePictTypeSolidFill)
xfree(pPicture->pSourcePict); xfree(pPicture->pSourcePict->linear.stops);
}
} else { xfree(pPicture->pSourcePict);
}
if (pPicture->pDrawable)
{
ScreenPtr pScreen = pPicture->pDrawable->pScreen; ScreenPtr pScreen = pPicture->pDrawable->pScreen;
PictureScreenPtr ps = GetPictureScreen(pScreen); PictureScreenPtr ps = GetPictureScreen(pScreen);

View File

@ -68,8 +68,13 @@ typedef struct _PictTransform {
#define SourcePictTypeRadial 2 #define SourcePictTypeRadial 2
#define SourcePictTypeConical 3 #define SourcePictTypeConical 3
#define SourcePictClassUnknown 0
#define SourcePictClassHorizontal 1
#define SourcePictClassVertical 2
typedef struct _PictSolidFill { typedef struct _PictSolidFill {
unsigned int type; unsigned int type;
unsigned int class;
CARD32 color; CARD32 color;
} PictSolidFill, *PictSolidFillPtr; } PictSolidFill, *PictSolidFillPtr;
@ -80,39 +85,56 @@ typedef struct _PictGradientStop {
typedef struct _PictGradient { typedef struct _PictGradient {
unsigned int type; unsigned int type;
unsigned int class;
int nstops; int nstops;
PictGradientStopPtr stops; PictGradientStopPtr stops;
CARD32 colorTable[PICT_GRADIENT_STOPTABLE_SIZE]; int stopRange;
CARD32 *colorTable;
int colorTableSize;
} PictGradient, *PictGradientPtr; } PictGradient, *PictGradientPtr;
typedef struct _PictLinearGradient { typedef struct _PictLinearGradient {
unsigned int type; unsigned int type;
unsigned int class;
int nstops; int nstops;
PictGradientStopPtr stops; PictGradientStopPtr stops;
CARD32 colorTable[PICT_GRADIENT_STOPTABLE_SIZE]; int stopRange;
CARD32 *colorTable;
int colorTableSize;
xPointFixed p1; xPointFixed p1;
xPointFixed p2; xPointFixed p2;
} PictLinearGradient, *PictLinearGradientPtr; } PictLinearGradient, *PictLinearGradientPtr;
typedef struct _PictCircle {
xFixed x;
xFixed y;
xFixed radius;
} PictCircle, *PictCirclePtr;
typedef struct _PictRadialGradient { typedef struct _PictRadialGradient {
unsigned int type; unsigned int type;
unsigned int class;
int nstops; int nstops;
PictGradientStopPtr stops; PictGradientStopPtr stops;
CARD32 colorTable[PICT_GRADIENT_STOPTABLE_SIZE]; int stopRange;
double fx; CARD32 *colorTable;
double fy; int colorTableSize;
double dx; PictCircle c1;
double dy; PictCircle c2;
double a; double cdx;
double m; double cdy;
double b; double dr;
double A;
} PictRadialGradient, *PictRadialGradientPtr; } PictRadialGradient, *PictRadialGradientPtr;
typedef struct _PictConicalGradient { typedef struct _PictConicalGradient {
unsigned int type; unsigned int type;
unsigned int class;
int nstops; int nstops;
PictGradientStopPtr stops; PictGradientStopPtr stops;
CARD32 colorTable[PICT_GRADIENT_STOPTABLE_SIZE]; int stopRange;
CARD32 *colorTable;
int colorTableSize;
xPointFixed center; xPointFixed center;
xFixed angle; xFixed angle;
} PictConicalGradient, *PictConicalGradientPtr; } PictConicalGradient, *PictConicalGradientPtr;
@ -624,6 +646,11 @@ Bool
PictureTransformPoint3d (PictTransformPtr transform, PictureTransformPoint3d (PictTransformPtr transform,
PictVectorPtr vector); PictVectorPtr vector);
CARD32
PictureGradientColor (PictGradientStopPtr stop1,
PictGradientStopPtr stop2,
CARD32 x);
void RenderExtensionInit (void); void RenderExtensionInit (void);
Bool Bool