From 868fd503b7aeab31dba72046b59061008d8b7501 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Fri, 14 Nov 2008 15:18:56 +1000 Subject: [PATCH 01/62] dix: move Enter-Leave related functions into new enterleave.c Preparation for the new core enter/leave model. Signed-off-by: Peter Hutterer --- dix/Makefile.am | 2 + dix/enterleave.c | 138 +++++++++++++++++++++++++++++++++++++++++++++++ dix/enterleave.h | 53 ++++++++++++++++++ dix/events.c | 116 ++------------------------------------- 4 files changed, 196 insertions(+), 113 deletions(-) create mode 100644 dix/enterleave.c create mode 100644 dix/enterleave.h diff --git a/dix/Makefile.am b/dix/Makefile.am index a4b48c82e..4c2395d82 100644 --- a/dix/Makefile.am +++ b/dix/Makefile.am @@ -14,6 +14,8 @@ libdix_la_SOURCES = \ dispatch.h \ dixfonts.c \ dixutils.c \ + enterleave.c \ + enterleave.h \ events.c \ extension.c \ ffs.c \ diff --git a/dix/enterleave.c b/dix/enterleave.c new file mode 100644 index 000000000..941aa528a --- /dev/null +++ b/dix/enterleave.c @@ -0,0 +1,138 @@ +/* + * Copyright © 2008 Red Hat, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Authors: Peter Hutterer + * + */ + +#ifdef HAVE_DIX_CONFIG_H +#include +#endif + +#include +#include "windowstr.h" +#include "enterleave.h" + +/** + * @return The window that is the first ancestor of both a and b. + */ +WindowPtr +CommonAncestor( + WindowPtr a, + WindowPtr b) +{ + for (b = b->parent; b; b = b->parent) + if (IsParent(b, a)) return b; + return NullWindow; +} + + +/** + * Send enter notifies to all parent windows up to ancestor. + * This function recurses. + */ +static void +EnterNotifies(DeviceIntPtr pDev, + WindowPtr ancestor, + WindowPtr child, + int mode, + int detail) +{ + WindowPtr parent = child->parent; + + if (ancestor == parent) + return; + EnterNotifies(pDev, ancestor, parent, mode, detail); + EnterLeaveEvent(pDev, EnterNotify, mode, detail, parent, + child->drawable.id); +} + + +/** + * Send leave notifies to all parent windows up to ancestor. + * This function recurses. + */ +static void +LeaveNotifies(DeviceIntPtr pDev, + WindowPtr child, + WindowPtr ancestor, + int mode, + int detail) +{ + WindowPtr pWin; + + if (ancestor == child) + return; + for (pWin = child->parent; pWin != ancestor; pWin = pWin->parent) + { + EnterLeaveEvent(pDev, LeaveNotify, mode, detail, pWin, + child->drawable.id); + child = pWin; + } +} + +/** + * Figure out if enter/leave events are necessary and send them to the + * appropriate windows. + * + * @param fromWin Window the sprite moved out of. + * @param toWin Window the sprite moved into. + */ +void +DoEnterLeaveEvents(DeviceIntPtr pDev, + WindowPtr fromWin, + WindowPtr toWin, + int mode) +{ + if (!IsPointerDevice(pDev)) + return; + + if (fromWin == toWin) + return; + if (IsParent(fromWin, toWin)) + { + EnterLeaveEvent(pDev, LeaveNotify, mode, NotifyInferior, fromWin, + None); + EnterNotifies(pDev, fromWin, toWin, mode, + NotifyVirtual); + EnterLeaveEvent(pDev, EnterNotify, mode, NotifyAncestor, toWin, None); + } + else if (IsParent(toWin, fromWin)) + { + EnterLeaveEvent(pDev, LeaveNotify, mode, NotifyAncestor, fromWin, + None); + LeaveNotifies(pDev, fromWin, toWin, mode, NotifyVirtual); + EnterLeaveEvent(pDev, EnterNotify, mode, NotifyInferior, toWin, None); + } + else + { /* neither fromWin nor toWin is descendent of the other */ + WindowPtr common = CommonAncestor(toWin, fromWin); + /* common == NullWindow ==> different screens */ + EnterLeaveEvent(pDev, LeaveNotify, mode, NotifyNonlinear, fromWin, + None); + LeaveNotifies(pDev, fromWin, common, mode, NotifyNonlinearVirtual); + EnterNotifies(pDev, common, toWin, mode, NotifyNonlinearVirtual); + EnterLeaveEvent(pDev, EnterNotify, mode, NotifyNonlinear, toWin, + None); + } +} + diff --git a/dix/enterleave.h b/dix/enterleave.h new file mode 100644 index 000000000..c1bfc3ada --- /dev/null +++ b/dix/enterleave.h @@ -0,0 +1,53 @@ +/* + * Copyright © 2008 Red Hat, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Authors: Peter Hutterer + * + */ + +#ifdef HAVE_DIX_CONFIG_H +#include +#endif + +#ifndef ENTERLEAVE_H +#define ENTERLEAVE_H + +extern void DoEnterLeaveEvents( + DeviceIntPtr pDev, + WindowPtr fromWin, + WindowPtr toWin, + int mode +); + +extern void EnterLeaveEvent( + DeviceIntPtr mouse, + int type, + int mode, + int detail, + WindowPtr pWin, + Window child); + +extern WindowPtr CommonAncestor( + WindowPtr a, + WindowPtr b); + +#endif /* _ENTERLEAVE_H_ */ diff --git a/dix/events.c b/dix/events.c index 27601b7e3..77ca3d2c5 100644 --- a/dix/events.c +++ b/dix/events.c @@ -164,6 +164,8 @@ typedef const char *string; #include "geext.h" #include "geint.h" +#include "enterleave.h" + /** * Extension events type numbering starts at EXTENSION_EVENT_BASE. */ @@ -326,13 +328,6 @@ IsKeyboardDevice(DeviceIntPtr dev) return (dev->key && dev->kbdfeed) && !IsPointerDevice(dev); } -static void DoEnterLeaveEvents( - DeviceIntPtr pDev, - WindowPtr fromWin, - WindowPtr toWin, - int mode -); - static WindowPtr XYToWindow( DeviceIntPtr pDev, int x, @@ -4184,24 +4179,11 @@ EventSuppressForWindow(WindowPtr pWin, ClientPtr client, return Success; } -/** - * @return The window that is the first ancestor of both a and b. - */ -static WindowPtr -CommonAncestor( - WindowPtr a, - WindowPtr b) -{ - for (b = b->parent; b; b = b->parent) - if (IsParent(b, a)) return b; - return NullWindow; -} - /** * Assembles an EnterNotify or LeaveNotify and sends it event to the client. * Uses the paired keyboard to get some additional information. */ -static void +void EnterLeaveEvent( DeviceIntPtr mouse, int type, @@ -4364,98 +4346,6 @@ EnterLeaveEvent( } } -/** - * Send enter notifies to all parent windows up to ancestor. - * This function recurses. - */ -static void -EnterNotifies(DeviceIntPtr pDev, - WindowPtr ancestor, - WindowPtr child, - int mode, - int detail) -{ - WindowPtr parent = child->parent; - - if (ancestor == parent) - return; - EnterNotifies(pDev, ancestor, parent, mode, detail); - EnterLeaveEvent(pDev, EnterNotify, mode, detail, parent, - child->drawable.id); -} - - -/** - * Send leave notifies to all parent windows up to ancestor. - * This function recurses. - */ -static void -LeaveNotifies(DeviceIntPtr pDev, - WindowPtr child, - WindowPtr ancestor, - int mode, - int detail) -{ - WindowPtr pWin; - - if (ancestor == child) - return; - for (pWin = child->parent; pWin != ancestor; pWin = pWin->parent) - { - EnterLeaveEvent(pDev, LeaveNotify, mode, detail, pWin, - child->drawable.id); - child = pWin; - } -} - - - -/** - * Figure out if enter/leave events are necessary and send them to the - * appropriate windows. - * - * @param fromWin Window the sprite moved out of. - * @param toWin Window the sprite moved into. - */ -static void -DoEnterLeaveEvents(DeviceIntPtr pDev, - WindowPtr fromWin, - WindowPtr toWin, - int mode) -{ - if (!IsPointerDevice(pDev)) - return; - - if (fromWin == toWin) - return; - if (IsParent(fromWin, toWin)) - { - EnterLeaveEvent(pDev, LeaveNotify, mode, NotifyInferior, fromWin, - None); - EnterNotifies(pDev, fromWin, toWin, mode, - NotifyVirtual); - EnterLeaveEvent(pDev, EnterNotify, mode, NotifyAncestor, toWin, None); - } - else if (IsParent(toWin, fromWin)) - { - EnterLeaveEvent(pDev, LeaveNotify, mode, NotifyAncestor, fromWin, - None); - LeaveNotifies(pDev, fromWin, toWin, mode, NotifyVirtual); - EnterLeaveEvent(pDev, EnterNotify, mode, NotifyInferior, toWin, None); - } - else - { /* neither fromWin nor toWin is descendent of the other */ - WindowPtr common = CommonAncestor(toWin, fromWin); - /* common == NullWindow ==> different screens */ - EnterLeaveEvent(pDev, LeaveNotify, mode, NotifyNonlinear, fromWin, - None); - LeaveNotifies(pDev, fromWin, common, mode, NotifyNonlinearVirtual); - EnterNotifies(pDev, common, toWin, mode, NotifyNonlinearVirtual); - EnterLeaveEvent(pDev, EnterNotify, mode, NotifyNonlinear, toWin, - None); - } -} - static void FocusEvent(DeviceIntPtr dev, int type, int mode, int detail, WindowPtr pWin) { From 5e48f5e2dd2dec7cfd1fa40b61e25123dfca515e Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Fri, 14 Nov 2008 15:41:59 +1000 Subject: [PATCH 02/62] dix: remove unused EnterLeaveSemaphoresIsset. Signed-off-by: Peter Hutterer --- dix/events.c | 15 --------------- include/input.h | 1 - 2 files changed, 16 deletions(-) diff --git a/dix/events.c b/dix/events.c index 77ca3d2c5..0f63ca3be 100644 --- a/dix/events.c +++ b/dix/events.c @@ -6148,21 +6148,6 @@ ExtGrabDevice(ClientPtr client, return GrabSuccess; } -/* - * @return Zero if no device is currently in window, non-zero otherwise. - */ -int -EnterLeaveSemaphoresIsset(WindowPtr win) -{ - int set = 0; - int i; - - for (i = 0; i < (MAXDEVICES + 7)/8; i++) - set += win->enterleave[i]; - - return set; -} - /* * @return Zero if no devices has focus on the window, non-zero otherwise. */ diff --git a/include/input.h b/include/input.h index 30457f35f..343542c9d 100644 --- a/include/input.h +++ b/include/input.h @@ -512,7 +512,6 @@ extern int AllocMasterDevice(ClientPtr client, extern void DeepCopyDeviceClasses(DeviceIntPtr from, DeviceIntPtr to); -extern int EnterLeaveSemaphoresIsset(WindowPtr win); extern int FocusSemaphoresIsset(WindowPtr win); /* Implemented by the DDX. */ From 6bdc963cdabb4a2e77de7f00a1d062aa2b873f9b Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Fri, 14 Nov 2008 15:37:35 +1000 Subject: [PATCH 03/62] dix: split enter/leave event handling into core and device handling. Device events always need to be delivered, core events only in some cases. Let's keep them completely separate so we can adjust core event delivery. Signed-off-by: Peter Hutterer --- dix/enterleave.c | 76 ++++++++++------------ dix/enterleave.h | 13 ++++ dix/events.c | 159 ++++++++++++++++++++++++----------------------- 3 files changed, 125 insertions(+), 123 deletions(-) diff --git a/dix/enterleave.c b/dix/enterleave.c index 941aa528a..11929c6fe 100644 --- a/dix/enterleave.c +++ b/dix/enterleave.c @@ -30,6 +30,7 @@ #include #include "windowstr.h" +#include "exglobals.h" #include "enterleave.h" /** @@ -47,46 +48,57 @@ CommonAncestor( /** - * Send enter notifies to all parent windows up to ancestor. - * This function recurses. + * Send enter notifies to all windows between @ancestor and @child (excluding + * both). Events are sent running up the window hierarchy. This function + * recurses. + * If @core is TRUE, core events are sent, otherwise XI events will be sent. */ static void -EnterNotifies(DeviceIntPtr pDev, +EnterNotifies(DeviceIntPtr dev, WindowPtr ancestor, WindowPtr child, int mode, - int detail) + int detail, + BOOL core) { WindowPtr parent = child->parent; if (ancestor == parent) return; - EnterNotifies(pDev, ancestor, parent, mode, detail); - EnterLeaveEvent(pDev, EnterNotify, mode, detail, parent, - child->drawable.id); + EnterNotifies(dev, ancestor, parent, mode, detail, core); + if (core) + CoreEnterLeaveEvent(dev, EnterNotify, mode, detail, parent, + child->drawable.id); + else + DeviceEnterLeaveEvent(dev, DeviceEnterNotify, mode, detail, parent, + child->drawable.id); } - /** - * Send leave notifies to all parent windows up to ancestor. - * This function recurses. + * Send leave notifies to all windows between @child and @ancestor. + * Events are sent running up the hierarchy. */ static void -LeaveNotifies(DeviceIntPtr pDev, +LeaveNotifies(DeviceIntPtr dev, WindowPtr child, WindowPtr ancestor, int mode, - int detail) + int detail, + BOOL core) { - WindowPtr pWin; + WindowPtr win; if (ancestor == child) return; - for (pWin = child->parent; pWin != ancestor; pWin = pWin->parent) + for (win = child->parent; win != ancestor; win = win->parent) { - EnterLeaveEvent(pDev, LeaveNotify, mode, detail, pWin, - child->drawable.id); - child = pWin; + if (core) + CoreEnterLeaveEvent(dev, LeaveNotify, mode, detail, win, + child->drawable.id); + else + DeviceEnterLeaveEvent(dev, DeviceLeaveNotify, mode, detail, win, + child->drawable.id); + child = win; } } @@ -108,31 +120,7 @@ DoEnterLeaveEvents(DeviceIntPtr pDev, if (fromWin == toWin) return; - if (IsParent(fromWin, toWin)) - { - EnterLeaveEvent(pDev, LeaveNotify, mode, NotifyInferior, fromWin, - None); - EnterNotifies(pDev, fromWin, toWin, mode, - NotifyVirtual); - EnterLeaveEvent(pDev, EnterNotify, mode, NotifyAncestor, toWin, None); - } - else if (IsParent(toWin, fromWin)) - { - EnterLeaveEvent(pDev, LeaveNotify, mode, NotifyAncestor, fromWin, - None); - LeaveNotifies(pDev, fromWin, toWin, mode, NotifyVirtual); - EnterLeaveEvent(pDev, EnterNotify, mode, NotifyInferior, toWin, None); - } - else - { /* neither fromWin nor toWin is descendent of the other */ - WindowPtr common = CommonAncestor(toWin, fromWin); - /* common == NullWindow ==> different screens */ - EnterLeaveEvent(pDev, LeaveNotify, mode, NotifyNonlinear, fromWin, - None); - LeaveNotifies(pDev, fromWin, common, mode, NotifyNonlinearVirtual); - EnterNotifies(pDev, common, toWin, mode, NotifyNonlinearVirtual); - EnterLeaveEvent(pDev, EnterNotify, mode, NotifyNonlinear, toWin, - None); - } -} + CoreEnterLeaveEvents(pDev, fromWin, toWin, mode); + DeviceEnterLeaveEvents(pDev, fromWin, toWin, mode); +} diff --git a/dix/enterleave.h b/dix/enterleave.h index c1bfc3ada..6e062260e 100644 --- a/dix/enterleave.h +++ b/dix/enterleave.h @@ -50,4 +50,17 @@ extern WindowPtr CommonAncestor( WindowPtr a, WindowPtr b); +extern void CoreEnterLeaveEvent(DeviceIntPtr mouse, + int type, + int mode, + int detail, + WindowPtr pWin, + Window child); +extern void DeviceEnterLeaveEvent(DeviceIntPtr mouse, + int type, + int mode, + int detail, + WindowPtr pWin, + Window child); + #endif /* _ENTERLEAVE_H_ */ diff --git a/dix/events.c b/dix/events.c index 0f63ca3be..bfc84948d 100644 --- a/dix/events.c +++ b/dix/events.c @@ -4184,7 +4184,7 @@ EventSuppressForWindow(WindowPtr pWin, ClientPtr client, * Uses the paired keyboard to get some additional information. */ void -EnterLeaveEvent( +CoreEnterLeaveEvent( DeviceIntPtr mouse, int type, int mode, @@ -4197,12 +4197,6 @@ EnterLeaveEvent( DeviceIntPtr keybd; GrabPtr grab = mouse->deviceGrab.grab; Mask mask; - int inWindow; /* zero if no sprites are in window */ - Bool sendevent = FALSE; - - deviceEnterNotify *devEnterLeave; - int mskidx; - OtherInputMasks *inputMasks; keybd = GetPairedDevice(mouse); @@ -4250,44 +4244,7 @@ EnterLeaveEvent( IsParent(focus, pWin))) event.u.enterLeave.flags |= ELFlagFocus; - - /* - * Sending multiple core enter/leave events to the same window confuse the - * client. - * We can send multiple events that have detail NotifyVirtual or - * NotifyNonlinearVirtual however. For most clients anyway. - * - * For standard events (NotifyAncestor, NotifyInferior, NotifyNonlinear) - * we only send an enter event for the first pointer to enter. A leave - * event is sent for the last pointer to leave. - * - * For events with Virtual detail, we send them only to a window that does - * not have a pointer inside. - * - * For a window tree in the form of - * - * A -> Bp -> C -> D - * \ (where B and E have pointers) - * -> Ep - * - * If the pointer moves from E into D, a LeaveNotify is sent to E, an - * EnterNotify is sent to D, an EnterNotify with detail - * NotifyNonlinearVirtual to C and nothing to B. - */ - - /* Clear bit for device, but don't worry about SDs. */ - if (mouse->isMaster && type == LeaveNotify && - (detail != NotifyVirtual && detail != NotifyNonlinearVirtual)) - if (mode != NotifyUngrab) - ENTER_LEAVE_SEMAPHORE_UNSET(pWin, mouse); - - inWindow = EnterLeaveSemaphoresIsset(pWin); - - if(!inWindow || mode == NotifyGrab || mode == NotifyUngrab) - sendevent = TRUE; - - - if ((mask & filters[mouse->id][type]) && sendevent) + if ((mask & filters[mouse->id][type])) { if (grab) TryClientEvents(rClient(grab), mouse, &event, 1, mask, @@ -4297,18 +4254,81 @@ EnterLeaveEvent( filters[mouse->id][type], NullGrab, 0); } - if (mouse->isMaster && type == EnterNotify && - (detail != NotifyVirtual && detail != NotifyNonlinearVirtual)) - if (mode != NotifyGrab) - ENTER_LEAVE_SEMAPHORE_SET(pWin, mouse); + if ((type == EnterNotify) && (mask & KeymapStateMask)) + { + xKeymapEvent ke; + ClientPtr client = grab ? rClient(grab) + : clients[CLIENT_ID(pWin->drawable.id)]; + if (XaceHook(XACE_DEVICE_ACCESS, client, keybd, DixReadAccess)) + bzero((char *)&ke.map[0], 31); + else + memmove((char *)&ke.map[0], (char *)&keybd->key->down[1], 31); + + ke.type = KeymapNotify; + if (grab) + TryClientEvents(rClient(grab), keybd, (xEvent *)&ke, 1, + mask, KeymapStateMask, grab); + else + DeliverEventsToWindow(mouse, pWin, (xEvent *)&ke, 1, + KeymapStateMask, NullGrab, 0); + } +} + +void +DeviceEnterLeaveEvent( + DeviceIntPtr mouse, + int type, + int mode, + int detail, + WindowPtr pWin, + Window child) +{ + xEvent event; + GrabPtr grab = mouse->deviceGrab.grab; + deviceEnterNotify *devEnterLeave; + int mskidx; + OtherInputMasks *inputMasks; + Mask mask; + DeviceIntPtr keybd = GetPairedDevice(mouse); + BOOL sameScreen; + + if (grab) { + mask = (pWin == grab->window) ? grab->eventMask : 0; + if (grab->ownerEvents) + mask |= EventMaskForClient(pWin, rClient(grab)); + } else { + mask = pWin->eventMask | wOtherEventMasks(pWin); + } /* we don't have enough bytes, so we squash flags and mode into one byte, and use the last byte for the deviceid. */ - devEnterLeave = (deviceEnterNotify*)&event; - devEnterLeave->type = (type == EnterNotify) ? DeviceEnterNotify : - DeviceLeaveNotify; - devEnterLeave->mode |= (event.u.enterLeave.flags << 4); + devEnterLeave = (deviceEnterNotify*)&event; + devEnterLeave->detail = detail; + devEnterLeave->time = currentTime.milliseconds; + devEnterLeave->rootX = mouse->spriteInfo->sprite->hot.x; + devEnterLeave->rootY = mouse->spriteInfo->sprite->hot.y; + FixUpEventFromWindow(mouse, &event, pWin, None, FALSE); + sameScreen = event.u.keyButtonPointer.sameScreen; + + devEnterLeave->child = child; + devEnterLeave->type = type; devEnterLeave->deviceid = mouse->id; + devEnterLeave->mode = mode; + devEnterLeave->mode |= (sameScreen ? (ELFlagSameScreen << 4) : 0); + +#ifdef XKB + if (!noXkbExtension) { + devEnterLeave->state = mouse->button->state & 0x1f00; + if (keybd) + devEnterLeave->state |= + XkbGrabStateFromRec(&keybd->key->xkbInfo->state); + } else +#endif + { + devEnterLeave->state = (keybd) ? keybd->key->state : 0; + devEnterLeave->state |= mouse->button->state; + } + mskidx = mouse->id; inputMasks = wOtherInputMasks(pWin); if (inputMasks && @@ -4316,34 +4336,15 @@ EnterLeaveEvent( inputMasks->deliverableEvents[mskidx])) { if (grab) - (void)TryClientEvents(rClient(grab), mouse, - (xEvent*)devEnterLeave, 1, - mask, filters[mouse->id][devEnterLeave->type], - grab); - else - (void)DeliverEventsToWindow(mouse, pWin, (xEvent*)devEnterLeave, - 1, filters[mouse->id][devEnterLeave->type], - NullGrab, mouse->id); + TryClientEvents(rClient(grab), mouse, + (xEvent*)devEnterLeave, 1, mask, + filters[mouse->id][devEnterLeave->type], grab); + else + DeliverEventsToWindow(mouse, pWin, (xEvent*)devEnterLeave, 1, + filters[mouse->id][devEnterLeave->type], + NullGrab, mouse->id); } - if ((type == EnterNotify) && (mask & KeymapStateMask)) - { - xKeymapEvent ke; - ClientPtr client = grab ? rClient(grab) - : clients[CLIENT_ID(pWin->drawable.id)]; - if (XaceHook(XACE_DEVICE_ACCESS, client, keybd, DixReadAccess)) - bzero((char *)&ke.map[0], 31); - else - memmove((char *)&ke.map[0], (char *)&keybd->key->down[1], 31); - - ke.type = KeymapNotify; - if (grab) - (void)TryClientEvents(rClient(grab), keybd, (xEvent *)&ke, 1, - mask, KeymapStateMask, grab); - else - (void)DeliverEventsToWindow(mouse, pWin, (xEvent *)&ke, 1, - KeymapStateMask, NullGrab, 0); - } } static void From 7d3e595f93dcd3d334e766a9dea602c05affdbaf Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Fri, 14 Nov 2008 15:27:19 +1000 Subject: [PATCH 04/62] dix: Add EnterWindow, LeaveWindow, HasPointer auxiliary functions. These replace the ENTER_LEAVE_SEMAPHORE_* macros. Unused currently. Signed-off-by: Peter Hutterer --- dix/enterleave.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/dix/enterleave.c b/dix/enterleave.c index 11929c6fe..57d1f1e09 100644 --- a/dix/enterleave.c +++ b/dix/enterleave.c @@ -33,6 +33,56 @@ #include "exglobals.h" #include "enterleave.h" +/** + * Return TRUE if @win has a pointer within its boundaries, excluding child + * window. + */ +static BOOL +HasPointer(WindowPtr win) +{ + int i; + + for (i = 0; i < sizeof(win->enterleave); i++) + if (win->enterleave[i]) + return TRUE; + + return FALSE; +} + +static BOOL +HasOtherPointer(WindowPtr win, DeviceIntPtr dev) +{ + int i; + + for (i = 0; i < sizeof(win->enterleave); i++) + if (win->enterleave[i] && + !(i == dev->id/8 && win->enterleave[i] == (1 << (dev->id % 8)))) + { + return TRUE; + } + + return FALSE; +} + +/** + * Set the presence flag for @dev to mark that it is now in @win. + */ +static void +EnterWindow(DeviceIntPtr dev, WindowPtr win, int mode) +{ + win->enterleave[dev->id/8] |= (1 << (dev->id % 8)); +} + +/** + * Unset the presence flag for @dev to mark that it is not in @win anymore. + */ +static void +LeaveWindow(DeviceIntPtr dev, WindowPtr win, int mode) +{ + win->enterleave[dev->id/8] &= ~(1 << (dev->id % 8)); +} + + /** * @return The window that is the first ancestor of both a and b. */ From 724f83b87bb16472d4c328e35d2a477384b29f84 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Fri, 14 Nov 2008 15:29:01 +1000 Subject: [PATCH 05/62] dix: add FirstPointerChild, FirstPointerAncestor auxiliary functions. FirstPointerChild: Return the first child that has a pointer within its boundaries. FirstPointerAncestor: return the first ancestor with a child within its boundaries. These are required for the updated enter/leave model. Signed-off-by: Peter Hutterer --- dix/enterleave.c | 100 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 100 insertions(+) diff --git a/dix/enterleave.c b/dix/enterleave.c index 57d1f1e09..0f3b12f6a 100644 --- a/dix/enterleave.c +++ b/dix/enterleave.c @@ -152,6 +152,106 @@ LeaveNotifies(DeviceIntPtr dev, } } +/** + * Search for the first window below @win that has a pointer directly within + * it's boundaries (excluding boundaries of its own descendants). + * Windows including @exclude and its descendants are ignored. + * + * @return The child window that has the pointer within its boundaries or + * NULL. + */ +static WindowPtr +FirstPointerChild(WindowPtr win, WindowPtr exclude) +{ + static WindowPtr *queue = NULL; + static int queue_size = 256; /* allocated size of queue */ + + WindowPtr child = NULL; + int queue_len = 0; /* no of elements in queue */ + int queue_head = 0; /* pos of current element */ + + if (!win || win == exclude || !win->firstChild) + return NULL; + + if (!queue && !(queue = xcalloc(queue_size, sizeof(WindowPtr)))) + FatalError("[dix] FirstPointerChild: OOM.\n"); + + queue[0] = win; + queue_head = 0; + queue_len = 1; + + while (queue_len--) + { + if (queue[queue_head] == exclude) + { + queue_head = (queue_head + 1) % queue_size; + continue; + } + + if (queue[queue_head] != win && HasPointer(queue[queue_head])) + return queue[queue_head]; + + child = queue[queue_head]->firstChild; + /* pop children onto queue */ + while(child) + { + queue_len++; + if (queue_len >= queue_size) + { + const int inc = 256; + + queue = xrealloc(queue, (queue_size + inc) * sizeof(WindowPtr)); + if (!queue) + FatalError("[dix] FirstPointerChild: OOM.\n"); + + /* Are we wrapped around? */ + if (queue_head + queue_len > queue_size) + { + memmove(&queue[queue_head + inc], &queue[queue_head], + (queue_size - queue_head) * sizeof(WindowPtr)); + queue_head += inc; + } + + queue_size += inc; + } + + queue[(queue_head + queue_len) % queue_size] = child; + child = child->nextSib; + } + + queue_head = (queue_head + 1) % queue_size; + } + + return NULL; +} + +/** + * Find the first parent of @win that has a pointer or has a child window with + * a pointer. Traverses up to (and including) the root window if @stopBefore + * is NULL, otherwise it stops at @stopBefore. + * Neither @win nor @win's descendants nor @stopBefore are tested for having a + * pointer. + * + * @return the window or NULL if @stopBefore was reached. + */ +static WindowPtr +FirstPointerAncestor(WindowPtr win, WindowPtr stopBefore) +{ + WindowPtr parent; + + parent = win->parent; + + while(parent && parent != stopBefore) + { + if (HasPointer(parent) || FirstPointerChild(parent, win)) + return parent; + + parent = parent->parent; + } + + return NULL; +} + /** * Figure out if enter/leave events are necessary and send them to the * appropriate windows. From b292a7a2d7e259177e1cc37346c2bee27a018630 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Fri, 14 Nov 2008 15:44:29 +1000 Subject: [PATCH 06/62] dix: updated enter/leave core event model. As proposed by Owen Taylor [1], the enter-leave event model needs to adjust the events sent to each window depending on the presence of pointers in a window, or in a subwindow. The new model can be summarised as: - if the pointer moves into or out of a window that has a pointer in a child window, the events are modified to appear as if the pointer was moved out of or into this child window. - if the pointer moves into or out of a window that has a pointer in a parent window, the events are modified to appear as if the pointer was moved out of or into this parent window. Note that this model requires CoreEnterLeaveEvent and DeviceEnterLeaveEvent to be split and treated separately. [1] http://lists.freedesktop.org/archives/xorg/2008-August/037606.html Signed-off-by: Peter Hutterer --- dix/devices.c | 4 +- dix/enterleave.c | 268 ++++++++++++++++++++++++++++++++++++++++++++++- dix/enterleave.h | 4 + 3 files changed, 274 insertions(+), 2 deletions(-) diff --git a/dix/devices.c b/dix/devices.c index 33b723a4f..583ecc016 100644 --- a/dix/devices.c +++ b/dix/devices.c @@ -86,6 +86,7 @@ SOFTWARE. #include "exevents.h" #include "listdev.h" /* for CopySwapXXXClass */ #include "xiproperty.h" +#include "enterleave.h" /* for EnterWindow() */ #include "xserver-properties.h" /** @file @@ -284,7 +285,8 @@ EnableDevice(DeviceIntPtr dev) if (dev->spriteInfo->spriteOwner) { InitializeSprite(dev, WindowTable[0]); - ENTER_LEAVE_SEMAPHORE_SET(WindowTable[0], dev); + /* mode doesn't matter */ + EnterWindow(dev, WindowTable[0], NotifyAncestor); } else if ((other = NextFreePointerDevice()) == NULL) { diff --git a/dix/enterleave.c b/dix/enterleave.c index 0f3b12f6a..8176f9618 100644 --- a/dix/enterleave.c +++ b/dix/enterleave.c @@ -33,6 +33,80 @@ #include "exglobals.h" #include "enterleave.h" +/* @file This file describes the model for sending core enter/leave events in + * the case of multiple pointers. + * Since we can't send more than one Enter or Leave event per window + * to a core client without confusing it, this is a rather complicated + * approach. + * + * For a full description of the model from a window's perspective, see + * http://lists.freedesktop.org/archives/xorg/2008-August/037606.html + * + * + * EnterNotify(Virtual, B) means EnterNotify Event, detail Virtual, child = B. + * + * Pointer moves from A to B, nonlinear (CoreEnterLeaveNonLinear): + * 1. a. if A has another pointer, goto 2. + * b. otherwise, if A has a child with a pointer in it, + * LeaveNotify(Inferior) to A + * LeaveNotify(Virtual) between A and child(A) + * + * 2. Find common ancestor X between A and B. + * 3. Find closest pointer window P between A and X. + * a. if P exists + * LeaveNotify(Ancestor) to A + * LeaveNotify(Virtual) between A and P + * b. otherwise, if P does not exist, + * LeaveNotify(NonLinear) to A + * LeaveNotify(NonLinearVirtual) between A and X. + * + * 4. If X does not have a pointer, EnterNotify(NonLinearVirtual, B) to X. + * 5. Find closest pointer window P between X and B. + * a. if P exists, EnterNotify(NonLinearVirtual) between X and P + * b. otherwise, EnterNotify(NonLinearVirtual) between X and B + * + * 5. a. if B has another pointer in it, finish. + * b. otherwise, if B has a child with a pointer in it + * LeaveNotify(Virtual) between child(B) and B. + * EnterNotify(Inferior) to B. + * c. otherwise, EnterNotify(NonLinear) to B. + * + * -------------------------------------------------------------------------- + * + * Pointer moves from A to B, A is a parent of B (CoreEnterLeaveToDescendant): + * 1. a. If A has another pointer, goto 2. + * b. Otherwise, LeaveNotify(Inferior) to A. + * + * 2. Find highest window X that has a pointer child that is not a child of B. + * a. if X exists, EnterNotify(Virtual, B) between A and X, + * EnterNotify(Virtual, B) to X (if X has no pointer). + * b. otherwise, EnterNotify(Virtual, B) between A and B. + * + * 3. a. if B has another pointer, finish + * b. otherwise, if B has a child with a pointer in it, + * LeaveNotify(Virtual, child(B)) between child(B) and B. + * EnterNotify(Inferior, child(B)) to B. + * c. otherwise, EnterNotify(Ancestor) to B. + * + * -------------------------------------------------------------------------- + * + * Pointer moves from A to B, A is a child of B (CoreEnterLeaveToAncestor): + * 1. a. If A has another pointer, goto 2. + * b. Otherwise, if A has a child with a pointer in it. + * LeaveNotify(Inferior, child(A)) to A. + * EnterNotify(Virtual, child(A)) between A and child(A). + * Skip to 3. + * + * 2. Find closest pointer window P between A and B. + * If P does not exist, P is B. + * LeaveNotify(Ancestor) to A. + * LeaveNotify(Virtual, A) between A and P. + * 3. a. If B has another pointer, finish. + * b. otherwise, EnterNotify(Inferior) to B. + */ + +#define WID(w) ((w) ? ((w)->drawable.id) : 0) + /** * Return TRUE if @win has a pointer within its boundaries, excluding child * window. @@ -67,7 +141,7 @@ HasOtherPointer(WindowPtr win, DeviceIntPtr dev) /** * Set the presence flag for @dev to mark that it is now in @win. */ -static void +void EnterWindow(DeviceIntPtr dev, WindowPtr win, int mode) { win->enterleave[dev->id/8] |= (1 << (dev->id % 8)); @@ -252,6 +326,198 @@ FirstPointerAncestor(WindowPtr win, WindowPtr stopBefore) return NULL; } +/** + * Pointer @dev moves from @A to @B and @A neither a descendant of @B nor is + * @B a descendant of @A. + */ +static void +CoreEnterLeaveNonLinear(DeviceIntPtr dev, + WindowPtr A, + WindowPtr B, + int mode) +{ + WindowPtr childA, childB, X, P; + BOOL hasPointerA = HasPointer(A); + + /* 2 */ + X = CommonAncestor(A, B); + + /* 1.a */ /* 1.b */ + if (!hasPointerA && (childA = FirstPointerChild(A, None))) + { + CoreEnterLeaveEvent(dev, LeaveNotify, mode, NotifyInferior, A, WID(childA)); + EnterNotifies(dev, A, childA, mode, NotifyVirtual, TRUE); + } else { + /* 3 */ + P = FirstPointerAncestor(A, X); + + if (P) + { + if (!hasPointerA) + CoreEnterLeaveEvent(dev, LeaveNotify, mode, NotifyAncestor, A, None); + LeaveNotifies(dev, A, P, mode, NotifyVirtual, TRUE); + /* 3.b */ + } else + { + if (!hasPointerA) + CoreEnterLeaveEvent(dev, LeaveNotify, mode, NotifyNonlinear, A, None); + LeaveNotifies(dev, A, X, mode, NotifyNonlinearVirtual, TRUE); + } + } + + /* 4. */ + if (!HasPointer(X)) + CoreEnterLeaveEvent(dev, EnterNotify, mode, NotifyNonlinearVirtual, X, WID(B)); + + /* 5. */ + P = FirstPointerChild(X, B); + if (!P) + P = B; /* 4.b */ + EnterNotifies(dev, X, P, mode, NotifyNonlinearVirtual, TRUE); + + /* 5.a */ + if (!HasOtherPointer(B, dev)) + { + /* 5.b */ + if ((childB = FirstPointerChild(B, None))) + { + LeaveNotifies(dev, childB, B, mode, NotifyVirtual, TRUE); + CoreEnterLeaveEvent(dev, EnterNotify, mode, NotifyInferior, B, WID(childB)); + } else + /* 5.c */ + CoreEnterLeaveEvent(dev, EnterNotify, mode, NotifyNonlinear, B, None); + } +} + +/** + * Pointer @dev moves from @A to @B and @A is a descendant of @B. + */ +static void +CoreEnterLeaveToAncestor(DeviceIntPtr dev, + WindowPtr A, + WindowPtr B, + int mode) +{ + WindowPtr childA = NULL, P; + BOOL hasPointerA = HasPointer(A); + + /* 1.a */ /* 1.b */ + if (!hasPointerA && (childA = FirstPointerChild(A, None))) + { + CoreEnterLeaveEvent(dev, LeaveNotify, mode, NotifyInferior, A, WID(childA)); + EnterNotifies(dev, A, childA, mode, NotifyVirtual, TRUE); + } else { + /* 2 */ + P = FirstPointerAncestor(A, B); + if (!P) + P = B; + + if (!hasPointerA) + CoreEnterLeaveEvent(dev, LeaveNotify, mode, NotifyAncestor, A, None); + LeaveNotifies(dev, A, P, mode, NotifyVirtual, TRUE); + } + + /* 3 */ + if (!HasOtherPointer(B, dev)) + CoreEnterLeaveEvent(dev, EnterNotify, mode, NotifyInferior, B, None); + +} + +/** + * Pointer @dev moves from @A to @B and @B is a descendant of @A. + */ +static void +CoreEnterLeaveToDescendant(DeviceIntPtr dev, + WindowPtr A, + WindowPtr B, + int mode) +{ + WindowPtr X, childB, tmp; + + /* 1 */ + if (!HasPointer(A)) + CoreEnterLeaveEvent(dev, LeaveNotify, mode, NotifyInferior, A, WID(B)); + + /* 2 */ + X = FirstPointerAncestor(B, A); + if (X) + { + /* 2.a */ + tmp = X; + while((tmp = FirstPointerAncestor(tmp, A))) + X = tmp; + } else /* 2.b */ + X = B; + + EnterNotifies(dev, A, X, mode, NotifyVirtual, TRUE); + + if (X != B && !HasPointer(X)) + CoreEnterLeaveEvent(dev, LeaveNotify, mode, NotifyVirtual, X, None); + + /* 3 */ + if (!HasOtherPointer(B, dev)) + { + childB = FirstPointerChild(B, None); + /* 3.a */ + if (childB) + { + LeaveNotifies(dev, childB, B, mode, NotifyVirtual, TRUE); + CoreEnterLeaveEvent(dev, EnterNotify, mode, NotifyInferior, B, WID(childB)); + } else /* 3.c */ + CoreEnterLeaveEvent(dev, EnterNotify, mode, NotifyAncestor, B, None); + } +} + +static void +CoreEnterLeaveEvents(DeviceIntPtr dev, + WindowPtr from, + WindowPtr to, + int mode) +{ + if (!dev->isMaster) + return; + + LeaveWindow(dev, from, mode); + + if (IsParent(from, to)) + CoreEnterLeaveToDescendant(dev, from, to, mode); + else if (IsParent(to, from)) + CoreEnterLeaveToAncestor(dev, from, to, mode); + else + CoreEnterLeaveNonLinear(dev, from, to, mode); + + EnterWindow(dev, to, mode); +} + +static void +DeviceEnterLeaveEvents(DeviceIntPtr dev, + WindowPtr from, + WindowPtr to, + int mode) +{ + if (IsParent(from, to)) + { + DeviceEnterLeaveEvent(dev, DeviceLeaveNotify, mode, NotifyInferior, from, None); + EnterNotifies(dev, from, to, mode, NotifyVirtual, FALSE); + DeviceEnterLeaveEvent(dev, DeviceEnterNotify, mode, NotifyAncestor, to, None); + } + else if (IsParent(to, from)) + { + DeviceEnterLeaveEvent(dev, DeviceLeaveNotify, mode, NotifyAncestor, from, None); + LeaveNotifies(dev, from, to, mode, NotifyVirtual, FALSE); + DeviceEnterLeaveEvent(dev, DeviceEnterNotify, mode, NotifyInferior, to, None); + } + else + { /* neither from nor to is descendent of the other */ + WindowPtr common = CommonAncestor(to, from); + /* common == NullWindow ==> different screens */ + DeviceEnterLeaveEvent(dev, DeviceLeaveNotify, mode, NotifyNonlinear, from, None); + LeaveNotifies(dev, from, common, mode, NotifyNonlinearVirtual, FALSE); + EnterNotifies(dev, common, to, mode, NotifyNonlinearVirtual, FALSE); + DeviceEnterLeaveEvent(dev, DeviceEnterNotify, mode, NotifyNonlinear, to, None); + } +} + /** * Figure out if enter/leave events are necessary and send them to the * appropriate windows. diff --git a/dix/enterleave.h b/dix/enterleave.h index 6e062260e..99e2e46c9 100644 --- a/dix/enterleave.h +++ b/dix/enterleave.h @@ -63,4 +63,8 @@ extern void DeviceEnterLeaveEvent(DeviceIntPtr mouse, WindowPtr pWin, Window child); +extern void EnterWindow(DeviceIntPtr dev, + WindowPtr win, + int mode); + #endif /* _ENTERLEAVE_H_ */ From 3e6da1636093d7dc98baac40544c0b0fb7fd8aec Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Fri, 14 Nov 2008 15:55:57 +1000 Subject: [PATCH 07/62] include: remove ENTER_LEAVE_SEMAPHORE macros. --- include/input.h | 6 ------ 1 file changed, 6 deletions(-) diff --git a/include/input.h b/include/input.h index 343542c9d..62f54491c 100644 --- a/include/input.h +++ b/include/input.h @@ -97,12 +97,6 @@ SOFTWARE. #define SEMAPHORE_FIELD_UNSET(win, dev, field) \ (win)->field[(dev)->id/8] &= ~(1 << ((dev)->id % 8)); -#define ENTER_LEAVE_SEMAPHORE_SET(win, dev) \ - SEMAPHORE_FIELD_SET(win, dev, enterleave); - -#define ENTER_LEAVE_SEMAPHORE_UNSET(win, dev) \ - SEMAPHORE_FIELD_UNSET(win, dev, enterleave); - #define FOCUS_SEMAPHORE_SET(win, dev) \ SEMAPHORE_FIELD_SET(win, dev, focusinout); From 75784e1e53ad78e21518696dd9d297bc08c17d54 Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Mon, 24 Nov 2008 20:32:20 -0800 Subject: [PATCH 08/62] Solaris: Make KDSETMODE failure non fatal, and retry it on interrupts --- hw/xfree86/os-support/solaris/sun_init.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/hw/xfree86/os-support/solaris/sun_init.c b/hw/xfree86/os-support/solaris/sun_init.c index b79814d8a..795b0c13c 100644 --- a/hw/xfree86/os-support/solaris/sun_init.c +++ b/hw/xfree86/os-support/solaris/sun_init.c @@ -49,8 +49,9 @@ static char fb_dev[PATH_MAX] = "/dev/console"; void xf86OpenConsole(void) { + int i; #ifdef HAS_USL_VTS - int fd, i; + int fd; struct vt_mode VT; struct vt_stat vtinfo; int FreeVTslot; @@ -173,9 +174,14 @@ xf86OpenConsole(void) if (ioctl(xf86Info.consoleFd, VT_SETMODE, &VT) < 0) FatalError("xf86OpenConsole: VT_SETMODE VT_PROCESS failed\n"); #endif + #ifdef KDSETMODE - if (ioctl(xf86Info.consoleFd, KDSETMODE, KD_GRAPHICS) < 0) - FatalError("xf86OpenConsole: KDSETMODE KD_GRAPHICS failed\n"); + SYSCALL(i = ioctl(xf86Info.consoleFd, KDSETMODE, KD_GRAPHICS)); + if (i < 0) { + xf86Msg(X_WARNING, + "xf86OpenConsole: KDSETMODE KD_GRAPHICS failed on %s (%s)\n", + fb_dev, strerror(errno)); + } #endif } else /* serverGeneration != 1 */ @@ -257,7 +263,7 @@ xf86CloseConsole(void) #ifdef KDSETMODE /* Reset the display back to text mode */ - ioctl(xf86Info.consoleFd, KDSETMODE, KD_TEXT); + SYSCALL(ioctl(xf86Info.consoleFd, KDSETMODE, KD_TEXT)); #endif #ifdef HAS_USL_VTS From 5bf2c88d2317230b95b2904cb975167d03ee13a2 Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Mon, 24 Nov 2008 20:34:46 -0800 Subject: [PATCH 09/62] Simplify filename generation code for Xorg -configure --- hw/xfree86/common/xf86Configure.c | 39 ++++++++++++++----------------- 1 file changed, 18 insertions(+), 21 deletions(-) diff --git a/hw/xfree86/common/xf86Configure.c b/hw/xfree86/common/xf86Configure.c index 6680a618e..777806043 100644 --- a/hw/xfree86/common/xf86Configure.c +++ b/hw/xfree86/common/xf86Configure.c @@ -662,12 +662,17 @@ configureDDCMonitorSection (int screennum) return ptr; } +#if !defined(PATH_MAX) +# define PATH_MAX 1024 +#endif + void -DoConfigure() +DoConfigure(void) { int i,j, screennum = -1; char *home = NULL; - char *filename = NULL; + char filename[PATH_MAX]; + char *addslash = ""; XF86ConfigPtr xf86config = NULL; char **vlist, **vl; int *dev2screen; @@ -765,29 +770,21 @@ DoConfigure() xf86config->conf_input_lst = configureInputSection(); xf86config->conf_layout_lst = configureLayoutSection(); - if (!(home = getenv("HOME"))) + home = getenv("HOME"); + if ((home == NULL) || (home[0] = '\0')) { home = "/"; - { -#if !defined(PATH_MAX) -#define PATH_MAX 1024 -#endif - const char* configfile = XF86CONFIGFILE".new"; - char homebuf[PATH_MAX]; - /* getenv might return R/O memory, as with OS/2 */ - strncpy(homebuf,home,PATH_MAX-1); - homebuf[PATH_MAX-1] = '\0'; - home = homebuf; - if (!(filename = - (char *)xalloc(strlen(home) + - strlen(configfile) + 3))) - goto bail; + } else { + /* Determine if trailing slash is present or needed */ + int l = strlen(home); - if (home[0] == '/' && home[1] == '\0') - home[0] = '\0'; - sprintf(filename, "%s/%s", home,configfile); - + if (home[l-1] != '/') { + addslash = "/"; + } } + snprintf(filename, sizeof(filename), "%s%s" XF86CONFIGFILE ".new", + home, addslash); + xf86writeConfigFile(filename, xf86config); xf86DoConfigurePass1 = FALSE; From 599a0f3f1e3ae92676e3648471576c0001cfd9ae Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Mon, 24 Nov 2008 20:37:58 -0800 Subject: [PATCH 10/62] Fix typo in 5bf2c88d2317230b95b2904cb975167d03ee13a2 Amazing how these things hide until you see the diff come back from the commit list. --- hw/xfree86/common/xf86Configure.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/xfree86/common/xf86Configure.c b/hw/xfree86/common/xf86Configure.c index 777806043..b4ec7295f 100644 --- a/hw/xfree86/common/xf86Configure.c +++ b/hw/xfree86/common/xf86Configure.c @@ -771,7 +771,7 @@ DoConfigure(void) xf86config->conf_layout_lst = configureLayoutSection(); home = getenv("HOME"); - if ((home == NULL) || (home[0] = '\0')) { + if ((home == NULL) || (home[0] == '\0')) { home = "/"; } else { /* Determine if trailing slash is present or needed */ From 51e105ccc3d0ac8c0fe74efd029ffbddb80b140e Mon Sep 17 00:00:00 2001 From: Adam Jackson Date: Wed, 8 Oct 2008 23:12:31 -0400 Subject: [PATCH 11/62] Remove xf86GetResourcesImplicitly --- hw/xfree86/common/xf86Bus.c | 31 ++++--------------------------- 1 file changed, 4 insertions(+), 27 deletions(-) diff --git a/hw/xfree86/common/xf86Bus.c b/hw/xfree86/common/xf86Bus.c index 758560d14..dcc5c3eac 100644 --- a/hw/xfree86/common/xf86Bus.c +++ b/hw/xfree86/common/xf86Bus.c @@ -1439,24 +1439,6 @@ RemoveOverlaps(resPtr target, resPtr list, Bool pow2Alignment, Bool useEstimated * Resource registration */ -static resList -xf86GetResourcesImplicitly(int entityIndex) -{ - if (entityIndex >= xf86NumEntities) return NULL; - - switch (xf86Entities[entityIndex]->bus.type) { - case BUS_ISA: - case BUS_NONE: - case BUS_SBUS: - return NULL; - case BUS_PCI: - return NULL; - case BUS_last: - return NULL; - } - return NULL; -} - static void convertRange2Host(int entityIndex, resRange *pRange) { @@ -1487,8 +1469,7 @@ xf86ConvertListToHost(int entityIndex, resPtr list) /* * xf86RegisterResources() -- attempts to register listed resources. - * If list is NULL it tries to obtain resources implicitly. Function - * returns a resPtr listing all resources not successfully registered. + * Returns a resPtr listing all resources not successfully registered. */ _X_EXPORT resPtr @@ -1498,13 +1479,9 @@ xf86RegisterResources(int entityIndex, resList list, unsigned long access) resRange range; resList list_f = NULL; - if (!list) { - list = xf86GetResourcesImplicitly(entityIndex); - /* these resources have to be in host address space already */ - if (!list) return NULL; - list_f = list; - } - + if (!list) + return NULL; + while(list->type != ResEnd) { range = *list; From a67360e79fa7e17c3d907771694009c57c1cd195 Mon Sep 17 00:00:00 2001 From: Adam Jackson Date: Wed, 8 Oct 2008 23:31:38 -0400 Subject: [PATCH 12/62] PCI: Always build domain support. --- hw/xfree86/os-support/bus/Pci.h | 7 +------ hw/xfree86/os-support/bus/linuxPci.c | 6 ------ hw/xfree86/os-support/linux/lnx_axp.c | 2 -- hw/xfree86/os-support/linux/lnx_ev56.c | 2 -- 4 files changed, 1 insertion(+), 16 deletions(-) diff --git a/hw/xfree86/os-support/bus/Pci.h b/hw/xfree86/os-support/bus/Pci.h index 2eb1745a7..adac6b6ee 100644 --- a/hw/xfree86/os-support/bus/Pci.h +++ b/hw/xfree86/os-support/bus/Pci.h @@ -184,14 +184,9 @@ #endif #if defined(linux) -# define ARCH_PCI_INIT linuxPciInit -# if defined(__m32r__) -# define INCLUDE_XF86_MAP_PCI_MEM -# define INCLUDE_XF86_NO_DOMAIN -# endif +#define ARCH_PCI_INIT linuxPciInit #endif /* defined(linux) */ - #if !defined(ARCH_PCI_INIT) #warning You really need to port to libpciaccess. #if defined(__i386__) || defined(__i386) || defined(__amd64__) || defined(__amd64) diff --git a/hw/xfree86/os-support/bus/linuxPci.c b/hw/xfree86/os-support/bus/linuxPci.c index 8b0a820fa..2a03119fa 100644 --- a/hw/xfree86/os-support/bus/linuxPci.c +++ b/hw/xfree86/os-support/bus/linuxPci.c @@ -95,19 +95,15 @@ static const struct pci_id_match match_host_bridge = { 0x0000ffff00, 0 }; -#ifndef INCLUDE_XF86_NO_DOMAIN #define MAX_DOMAINS 257 static pointer DomainMmappedIO[MAX_DOMAINS]; -#endif void linuxPciInit(void) { struct stat st; -#ifndef INCLUDE_XF86_NO_DOMAIN memset(DomainMmappedIO, 0, sizeof(DomainMmappedIO)); -#endif if (-1 == stat("/proc/bus/pci", &st)) { /* when using this as default for all linux architectures, @@ -237,7 +233,6 @@ linuxPpcBusAddrToHostAddr(PCITAG tag, PciAddrType type, ADDRESS addr) #endif /* __powerpc__ */ -#ifndef INCLUDE_XF86_NO_DOMAIN /* * Compiling the following simply requires the presence of . @@ -601,4 +596,3 @@ xf86AccResFromOS(resPtr pRes) return pRes; } -#endif /* !INCLUDE_XF86_NO_DOMAIN */ diff --git a/hw/xfree86/os-support/linux/lnx_axp.c b/hw/xfree86/os-support/linux/lnx_axp.c index a8ad161b6..e8b6d4749 100644 --- a/hw/xfree86/os-support/linux/lnx_axp.c +++ b/hw/xfree86/os-support/linux/lnx_axp.c @@ -179,7 +179,6 @@ _alpha_iobase_query(unsigned flags, int hose, int bus, int devfn) */ _iobase = _alpha_iobase; -#ifndef INCLUDE_XF86_NO_DOMAIN /* * Only take over the inx/outx functions if this is a dense I/O * system *and* addressing domains are being used. The dense I/O @@ -191,7 +190,6 @@ _alpha_iobase_query(unsigned flags, int hose, int bus, int devfn) _alpha_inb = _dense_inb; _alpha_inw = _dense_inw; _alpha_inl = _dense_inl; -#endif /* !INCLUDE_XF86_NO_DOMAIN */ } else _iobase = _alpha_iobase_legacy; return _iobase(flags, hose, bus, devfn); diff --git a/hw/xfree86/os-support/linux/lnx_ev56.c b/hw/xfree86/os-support/linux/lnx_ev56.c index 11c45e538..e751da2d0 100644 --- a/hw/xfree86/os-support/linux/lnx_ev56.c +++ b/hw/xfree86/os-support/linux/lnx_ev56.c @@ -90,7 +90,6 @@ writeDense32(int Value, pointer Base, register unsigned long Offset) } -#ifndef INCLUDE_XF86_NO_DOMAIN void _dense_outb(char val, unsigned long port) @@ -146,5 +145,4 @@ _dense_inl(unsigned long port) return *(volatile CARD32 *)port; } -#endif /* !INCLUDE_XF86_NO_DOMAIN */ From 5bb86bafd6fda296011cbcd5d15a85a6d770ae29 Mon Sep 17 00:00:00 2001 From: Adam Jackson Date: Wed, 8 Oct 2008 23:34:41 -0400 Subject: [PATCH 13/62] PCI: Remove non-pciaccess path for x86. --- configure.ac | 11 - hw/xfree86/os-support/bus/Makefile.am | 4 - hw/xfree86/os-support/bus/Pci.h | 7 - hw/xfree86/os-support/bus/ix86Pci.c | 484 -------------------------- 4 files changed, 506 deletions(-) delete mode 100644 hw/xfree86/os-support/bus/ix86Pci.c diff --git a/configure.ac b/configure.ac index 6286a6c16..662fcbd63 100644 --- a/configure.ac +++ b/configure.ac @@ -1220,7 +1220,6 @@ AC_MSG_RESULT([$XORG]) xorg_bus_linuxpci=no xorg_bus_bsdpci=no -xorg_bus_ix86pci=no xorg_bus_sparc=no if test "x$XORG" = xyes; then @@ -1357,15 +1356,6 @@ if test "x$XORG" = xyes; then sparc*) xorg_bus_sparc="yes" ;; - i*86|x86_64*|amd64*) - case $host_os in - *bsd*|linux*|solaris*) - ;; - *) - xorg_bus_ix86pci="yes" - ;; - esac - ;; esac if test "x$XORG_OS_PCI" = x ; then @@ -1459,7 +1449,6 @@ fi AM_CONDITIONAL([XORG], [test "x$XORG" = xyes]) AM_CONDITIONAL([XORG_BUS_LINUXPCI], [test "x$xorg_bus_linuxpci" = xyes]) AM_CONDITIONAL([XORG_BUS_BSDPCI], [test "x$xorg_bus_bsdpci" = xyes]) -AM_CONDITIONAL([XORG_BUS_IX86PCI], [test "x$xorg_bus_ix86pci" = xyes]) AM_CONDITIONAL([XORG_BUS_SPARC], [test "x$xorg_bus_sparc" = xyes]) AM_CONDITIONAL([LINUX_IA64], [test "x$linux_ia64" = xyes]) AM_CONDITIONAL([LINUX_ALPHA], [test "x$linux_alpha" = xyes]) diff --git a/hw/xfree86/os-support/bus/Makefile.am b/hw/xfree86/os-support/bus/Makefile.am index 5199340fc..92a519bcc 100644 --- a/hw/xfree86/os-support/bus/Makefile.am +++ b/hw/xfree86/os-support/bus/Makefile.am @@ -11,10 +11,6 @@ if XORG_BUS_BSDPCI PCI_SOURCES += bsd_pci.c endif -if XORG_BUS_IX86PCI -PCI_SOURCES += ix86Pci.c -endif - if XORG_BUS_SPARC PLATFORM_SOURCES = Sbus.c sdk_HEADERS += xf86Sbus.h diff --git a/hw/xfree86/os-support/bus/Pci.h b/hw/xfree86/os-support/bus/Pci.h index adac6b6ee..574a21e3e 100644 --- a/hw/xfree86/os-support/bus/Pci.h +++ b/hw/xfree86/os-support/bus/Pci.h @@ -187,13 +187,6 @@ #define ARCH_PCI_INIT linuxPciInit #endif /* defined(linux) */ -#if !defined(ARCH_PCI_INIT) -#warning You really need to port to libpciaccess. -#if defined(__i386__) || defined(__i386) || defined(__amd64__) || defined(__amd64) -#define ARCH_PCI_INIT ix86PciInit -#endif /* i386/amd64 */ -#endif /* !defined(ARCH_PCI_INIT) */ - #ifndef ARCH_PCI_INIT #error No PCI support available for this architecture/OS combination #endif diff --git a/hw/xfree86/os-support/bus/ix86Pci.c b/hw/xfree86/os-support/bus/ix86Pci.c deleted file mode 100644 index a279363d9..000000000 --- a/hw/xfree86/os-support/bus/ix86Pci.c +++ /dev/null @@ -1,484 +0,0 @@ -/* - * ix86Pci.c - x86 PCI driver - * - * The XFree86 server PCI access functions have been reimplemented as a - * framework that allows each supported platform/OS to have their own - * platform/OS specific PCI driver. - * - * Most of the code of these functions was simply lifted from the - * Intel architecture specifric portion of the original Xfree86 - * PCI code in hw/xfree86/common_hw/xf86_PCI.C... - * - * Gary Barton - * Concurrent Computer Corporation - * garyb@gate.net - */ - -/* - * Copyright 1998 by Concurrent Computer Corporation - * - * Permission to use, copy, modify, distribute, and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and that - * both that copyright notice and this permission notice appear in - * supporting documentation, and that the name of Concurrent Computer - * Corporation not be used in advertising or publicity pertaining to - * distribution of the software without specific, written prior - * permission. Concurrent Computer Corporation makes no representations - * about the suitability of this software for any purpose. It is - * provided "as is" without express or implied warranty. - * - * CONCURRENT COMPUTER CORPORATION DISCLAIMS ALL WARRANTIES WITH REGARD - * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS, IN NO EVENT SHALL CONCURRENT COMPUTER CORPORATION BE - * LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY - * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, - * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS - * SOFTWARE. - * - * Copyright 1998 by Metro Link Incorporated - * - * Permission to use, copy, modify, distribute, and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and that - * both that copyright notice and this permission notice appear in - * supporting documentation, and that the name of Metro Link - * Incorporated not be used in advertising or publicity pertaining to - * distribution of the software without specific, written prior - * permission. Metro Link Incorporated makes no representations - * about the suitability of this software for any purpose. It is - * provided "as is" without express or implied warranty. - * - * METRO LINK INCORPORATED DISCLAIMS ALL WARRANTIES WITH REGARD - * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS, IN NO EVENT SHALL METRO LINK INCORPORATED BE - * LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY - * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, - * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS - * SOFTWARE. - * - * This software is derived from the original XFree86 PCI code - * which includes the following copyright notices as well: - * - * Copyright 1995 by Robin Cutshaw - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the names of the above listed copyright holder(s) - * not be used in advertising or publicity pertaining to distribution of - * the software without specific, written prior permission. The above listed - * copyright holder(s) make(s) no representations about the suitability of this - * software for any purpose. It is provided "as is" without express or - * implied warranty. - * - * THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM(S) ALL WARRANTIES WITH REGARD - * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE - * LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY - * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER - * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING - * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - * This code is also based heavily on the code in FreeBSD-current, which was - * written by Wolfgang Stanglmeier, and contains the following copyright: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/* - * Copyright (c) 1999-2003 by The XFree86 Project, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name of the copyright holder(s) - * and author(s) shall not be used in advertising or otherwise to promote - * the sale, use or other dealings in this Software without prior written - * authorization from the copyright holder(s) and author(s). - */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include -#include "compiler.h" -#include "xf86.h" -#include "xf86Priv.h" -#include "xf86_OSlib.h" -#include "Pci.h" - -#ifdef PC98 -#define outb(port,data) _outb(port,data) -#define outl(port,data) _outl(port,data) -#define inb(port) _inb(port) -#define inl(port) _inl(port) -#endif - -#define PCI_CFGMECH2_ENABLE_REG 0xCF8 -#ifdef PC98 -#define PCI_CFGMECH2_FORWARD_REG 0xCF9 -#else -#define PCI_CFGMECH2_FORWARD_REG 0xCFA -#endif - -#define PCI_CFGMECH2_MAXDEV 16 - -#define PCI_ADDR_FROM_TAG_CFG1(tag,reg) (PCI_EN | tag | (reg & 0xfc)) -#define PCI_FORWARD_FROM_TAG(tag) PCI_BUS_FROM_TAG(tag) -#define PCI_ENABLE_FROM_TAG(tag) (0xf0 | (((tag) & 0x00000700) >> 7)) -#define PCI_ADDR_FROM_TAG_CFG2(tag,reg) (0xc000 | (((tag) & 0x0000f800) >> 3) \ - | (reg & 0xfc)) - -/* - * Intel x86 platform specific PCI access functions - */ -#if 0 -static CARD32 ix86PciReadLongSetup(PCITAG tag, int off); -static void ix86PciWriteLongSetup(PCITAG, int off, CARD32 val); -static void ix86PciSetBitsLongSetup(PCITAG, int off, CARD32 mask, CARD32 val); -static CARD32 ix86PciReadLongCFG1(PCITAG tag, int off); -static void ix86PciWriteLongCFG1(PCITAG, int off, CARD32 val); -static void ix86PciSetBitsLongCFG1(PCITAG, int off, CARD32 mask, CARD32 val); -static CARD32 ix86PciReadLongCFG2(PCITAG tag, int off); -static void ix86PciWriteLongCFG2(PCITAG, int off, CARD32 val); -static void ix86PciSetBitsLongCFG2(PCITAG, int off, CARD32 mask, CARD32 val); -#endif - -static pciBusFuncs_t ix86Funcs0 = { -#if 0 -/* pciReadLong */ ix86PciReadLongSetup, -/* pciWriteLong */ ix86PciWriteLongSetup, -/* pciSetBitsLong */ ix86PciSetBitsLongSetup, -/* pciAddrHostToBus */ pciAddrNOOP, -#endif -/* pciAddrBusToHost */ pciAddrNOOP -}; - -static pciBusFuncs_t ix86Funcs1 = { -#if 0 -/* pciReadLong */ ix86PciReadLongCFG1, -/* pciWriteLong */ ix86PciWriteLongCFG1, -/* pciSetBitsLong */ ix86PciSetBitsLongCFG1, -/* pciAddrHostToBus */ pciAddrNOOP, -#endif -/* pciAddrBusToHost */ pciAddrNOOP -}; - -static pciBusFuncs_t ix86Funcs2 = { -#if 0 -/* pciReadLong */ ix86PciReadLongCFG2, -/* pciWriteLong */ ix86PciWriteLongCFG2, -/* pciSetBitsLong */ ix86PciSetBitsLongCFG2, -/* pciAddrHostToBus */ pciAddrNOOP, -#endif -/* pciAddrBusToHost */ pciAddrNOOP -}; - -static pciBusInfo_t ix86Pci0 = { -/* configMech */ PCI_CFG_MECH_UNKNOWN, /* Set by ix86PciInit() */ -/* numDevices */ 0, /* Set by ix86PciInit() */ -/* secondary */ FALSE, -/* primary_bus */ 0, -/* funcs */ &ix86Funcs0, /* Set by ix86PciInit() */ -/* pciBusPriv */ NULL, -/* bridge */ NULL -}; - -_X_EXPORT pointer -xf86MapDomainMemory(int ScreenNum, int Flags, struct pci_device *dev, - ADDRESS Base, unsigned long Size) -{ - return xf86MapVidMem(ScreenNum, Flags, Base, Size); -} - -IOADDRESS -xf86MapLegacyIO(struct pci_device *dev) -{ - (void)dev; - return 0; -} - -static Bool -ix86PciBusCheck(void) -{ -#if 0 - PCITAG tag; - CARD32 id, class; - CARD8 device; - - for (device = 0; device < ix86Pci0.numDevices; device++) { - tag = PCI_MAKE_TAG(0, device, 0); - id = (*ix86Pci0.funcs->pciReadLong)(tag, PCI_ID_REG); - - if ((CARD16)(id + 1U) <= (CARD16)1UL) - continue; - - /* The rest of this is inspired by the Linux kernel */ - class = (*ix86Pci0.funcs->pciReadLong)(tag, PCI_CLASS_REG); - - /* Ignore revision id and programming interface */ - switch (class >> 16) { - case (PCI_CLASS_PREHISTORIC << 8) | PCI_SUBCLASS_PREHISTORIC_MISC: - /* Check for vendors of known buggy chipsets */ - id &= 0x0000ffff; - if ((id == PCI_VENDOR_INTEL) || (id == PCI_VENDOR_COMPAQ)) - return TRUE; - continue; - - case (PCI_CLASS_PREHISTORIC << 8) | PCI_SUBCLASS_PREHISTORIC_VGA: - case (PCI_CLASS_DISPLAY << 8) | PCI_SUBCLASS_DISPLAY_VGA: - case (PCI_CLASS_BRIDGE << 8) | PCI_SUBCLASS_BRIDGE_HOST: - return TRUE; - - default: - break; - } - } -#endif - return FALSE; -} - -static void -ix86PciSelectCfgmech(void) -{ - static Bool beenhere = FALSE; - CARD32 mode1Res1 = 0, mode1Res2 = 0, oldVal1 = 0; - CARD8 mode2Res1 = 0, mode2Res2 = 0, oldVal2 = 0; - int stages = 0; - - if (beenhere) - return; /* Been there, done that */ - - beenhere = TRUE; - - /* Determine if motherboard chipset supports PCI Config Mech 1 or 2 */ - do { - if (!xf86EnableIO()) - return; - - xf86MsgVerb(X_INFO, 2, - "PCI: Probing config type using method 1\n"); - oldVal1 = inl(PCI_CFGMECH1_ADDRESS_REG); - -#ifdef DEBUGPCI - if (xf86Verbose > 2) { - ErrorF("Checking config type 1:\n" - "\tinitial value of MODE1_ADDR_REG is 0x%08x\n", oldVal1); - ErrorF("\tChecking that all bits in mask 0x7f000000 are clear\n"); - } -#endif - - /* Assuming config type 1 to start with */ - if ((oldVal1 & 0x7f000000) == 0) { - - stages |= 0x01; - -#ifdef DEBUGPCI - if (xf86Verbose > 2) { - ErrorF("\tValue indicates possibly config type 1\n"); - ErrorF("\tWriting 32-bit value 0x%08x to MODE1_ADDR_REG\n", PCI_EN); -#if 0 - ErrorF("\tWriting 8-bit value 0x00 to MODE1_ADDR_REG + 3\n"); -#endif - } -#endif - - ix86Pci0.configMech = PCI_CFG_MECH_1; - ix86Pci0.numDevices = PCI_CFGMECH1_MAXDEV; - ix86Pci0.funcs = &ix86Funcs1; - - outl(PCI_CFGMECH1_ADDRESS_REG, PCI_EN); - -#if 0 - /* - * This seems to cause some Neptune-based PCI machines to switch - * from config type 1 to config type 2 - */ - outb(PCI_CFGMECH1_ADDRESS_REG + 3, 0); -#endif - mode1Res1 = inl(PCI_CFGMECH1_ADDRESS_REG); - -#ifdef DEBUGPCI - if (xf86Verbose > 2) { - ErrorF("\tValue read back from MODE1_ADDR_REG is 0x%08x\n", - mode1Res1); - ErrorF("\tRestoring original contents of MODE1_ADDR_REG\n"); - } -#endif - - outl(PCI_CFGMECH1_ADDRESS_REG, oldVal1); - - if (mode1Res1) { - - stages |= 0x02; - -#ifdef DEBUGPCI - if (xf86Verbose > 2) { - ErrorF("\tValue read back is non-zero, and indicates possible" - " config type 1\n"); - } -#endif - - if (ix86PciBusCheck()) { - -#ifdef DEBUGPCI - if (xf86Verbose > 2) - ErrorF("\tBus check Confirms this: "); -#endif - - xf86MsgVerb(X_INFO, 2, "PCI: Config type is 1\n"); - xf86MsgVerb(X_INFO, 3, - "PCI: stages = 0x%02x, oldVal1 = 0x%08lx, mode1Res1" - " = 0x%08lx\n", stages, (unsigned long)oldVal1, - (unsigned long)mode1Res1); - return; - } - -#ifdef DEBUGPCI - if (xf86Verbose > 2) { - ErrorF("\tBus check fails to confirm this, continuing type 1" - " check ...\n"); - } -#endif - - } - - stages |= 0x04; - -#ifdef DEBUGPCI - if (xf86Verbose > 2) { - ErrorF("\tWriting 0xff000001 to MODE1_ADDR_REG\n"); - } -#endif - outl(PCI_CFGMECH1_ADDRESS_REG, 0xff000001); - mode1Res2 = inl(PCI_CFGMECH1_ADDRESS_REG); - -#ifdef DEBUGPCI - if (xf86Verbose > 2) { - ErrorF("\tValue read back from MODE1_ADDR_REG is 0x%08x\n", - mode1Res2); - ErrorF("\tRestoring original contents of MODE1_ADDR_REG\n"); - } -#endif - - outl(PCI_CFGMECH1_ADDRESS_REG, oldVal1); - - if ((mode1Res2 & 0x80000001) == 0x80000000) { - - stages |= 0x08; - -#ifdef DEBUGPCI - if (xf86Verbose > 2) { - ErrorF("\tValue read back has only the msb set\n" - "\tThis indicates possible config type 1\n"); - } -#endif - - if (ix86PciBusCheck()) { - -#ifdef DEBUGPCI - if (xf86Verbose > 2) - ErrorF("\tBus check Confirms this: "); -#endif - - xf86MsgVerb(X_INFO, 2, "PCI: Config type is 1\n"); - xf86MsgVerb(X_INFO, 3, - "PCI: stages = 0x%02x, oldVal1 = 0x%08lx,\n" - "\tmode1Res1 = 0x%08lx, mode1Res2 = 0x%08lx\n", - stages, (unsigned long)oldVal1, - (unsigned long)mode1Res1, (unsigned long)mode1Res2); - return; - } - -#ifdef DEBUGPCI - if (xf86Verbose > 2) { - ErrorF("\tBus check fails to confirm this.\n"); - } -#endif - - } - } - - xf86MsgVerb(X_INFO, 3, "PCI: Standard check for type 1 failed.\n"); - xf86MsgVerb(X_INFO, 3, "PCI: stages = 0x%02x, oldVal1 = 0x%08lx,\n" - "\tmode1Res1 = 0x%08lx, mode1Res2 = 0x%08lx\n", - stages, (unsigned long)oldVal1, (unsigned long)mode1Res1, - (unsigned long)mode1Res2); - - /* Try config type 2 */ - oldVal2 = inb(PCI_CFGMECH2_ENABLE_REG); - if ((oldVal2 & 0xf0) == 0) { - ix86Pci0.configMech = PCI_CFG_MECH_2; - ix86Pci0.numDevices = PCI_CFGMECH2_MAXDEV; - ix86Pci0.funcs = &ix86Funcs2; - - outb(PCI_CFGMECH2_ENABLE_REG, 0x0e); - mode2Res1 = inb(PCI_CFGMECH2_ENABLE_REG); - outb(PCI_CFGMECH2_ENABLE_REG, oldVal2); - - if (mode2Res1 == 0x0e) { - if (ix86PciBusCheck()) { - xf86MsgVerb(X_INFO, 2, "PCI: Config type is 2\n"); - return; - } - } - } - break; - } while (0); - - /* No PCI found */ - ix86Pci0.configMech = PCI_CFG_MECH_UNKNOWN; - xf86MsgVerb(X_INFO, 2, "PCI: No PCI bus found\n"); -} - -void -ix86PciInit() -{ - /* Initialize pciBusInfo */ - pciBusInfo = &ix86Pci0; - - /* Make sure that there is a PCI bus present. */ - ix86PciSelectCfgmech(); - if (ix86Pci0.configMech == PCI_CFG_MECH_UNKNOWN) { - pciBusInfo = NULL; - } -} From 2d427b9cb1594f8f2f66b463033fff5b459962fd Mon Sep 17 00:00:00 2001 From: Adam Jackson Date: Wed, 8 Oct 2008 23:38:23 -0400 Subject: [PATCH 14/62] PCI: Remove config mechanism details. pciaccess handles this for us now, no need to remember PC arcana. --- hw/xfree86/os-support/bus/Pci.h | 21 --------------------- hw/xfree86/os-support/bus/bsd_pci.c | 1 - hw/xfree86/os-support/bus/linuxPci.c | 1 - 3 files changed, 23 deletions(-) diff --git a/hw/xfree86/os-support/bus/Pci.h b/hw/xfree86/os-support/bus/Pci.h index 574a21e3e..285c7a558 100644 --- a/hw/xfree86/os-support/bus/Pci.h +++ b/hw/xfree86/os-support/bus/Pci.h @@ -168,16 +168,6 @@ #endif /* !defined(DEBUGPCI) */ -/* - * PCI Config mechanism definitions - */ -#define PCI_EN 0x80000000 - -#define PCI_CFGMECH1_ADDRESS_REG 0xCF8 -#define PCI_CFGMECH1_DATA_REG 0xCFC - -#define PCI_CFGMECH1_MAXDEV 32 - #if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || \ defined(__DragonFly__) || defined(__sun) #define ARCH_PCI_INIT bsdPciInit @@ -205,7 +195,6 @@ typedef struct pci_bus_funcs { * pciBusInfo_t - One structure per defined PCI bus */ typedef struct pci_bus_info { - unsigned char configMech; /* PCI config type to use */ unsigned char numDevices; /* Range of valid devnums */ unsigned char secondary; /* Boolean: bus is a secondary */ int primary_bus; /* Parent bus */ @@ -216,17 +205,7 @@ typedef struct pci_bus_info { #define HOST_NO_BUS ((pciBusInfo_t *)(-1)) -/* configMech values */ -#define PCI_CFG_MECH_UNKNOWN 0 /* Not yet known */ -#define PCI_CFG_MECH_1 1 /* Most machines */ -#define PCI_CFG_MECH_2 2 /* Older PC's */ -#define PCI_CFG_MECH_OTHER 3 /* Something else */ - /* Generic PCI service functions and helpers */ -CARD32 pciCfgMech1Read(PCITAG tag, int offset); -void pciCfgMech1Write(PCITAG tag, int offset, CARD32 val); -void pciCfgMech1SetBits(PCITAG tag, int offset, CARD32 mask, - CARD32 val); ADDRESS pciAddrNOOP(PCITAG tag, PciAddrType type, ADDRESS); extern pciBusInfo_t *pciBusInfo; diff --git a/hw/xfree86/os-support/bus/bsd_pci.c b/hw/xfree86/os-support/bus/bsd_pci.c index 7becc0a17..cfdd98641 100644 --- a/hw/xfree86/os-support/bus/bsd_pci.c +++ b/hw/xfree86/os-support/bus/bsd_pci.c @@ -53,7 +53,6 @@ static pciBusFuncs_t bsd_funcs = { }; static pciBusInfo_t bsd_pci = { - .configMech = PCI_CFG_MECH_OTHER, .numDevices = 32, .secondary = FALSE, .primary_bus = 0, diff --git a/hw/xfree86/os-support/bus/linuxPci.c b/hw/xfree86/os-support/bus/linuxPci.c index 2a03119fa..28b0aec95 100644 --- a/hw/xfree86/os-support/bus/linuxPci.c +++ b/hw/xfree86/os-support/bus/linuxPci.c @@ -80,7 +80,6 @@ static pciBusFuncs_t linuxFuncs0 = { }; static pciBusInfo_t linuxPci0 = { -/* configMech */ PCI_CFG_MECH_OTHER, /* numDevices */ 32, /* secondary */ FALSE, /* primary_bus */ 0, From 86cfe0ee236bfd3613e5f9ba589211db42d009eb Mon Sep 17 00:00:00 2001 From: Adam Jackson Date: Wed, 8 Oct 2008 23:45:40 -0400 Subject: [PATCH 15/62] PCI: Simplify OS PCI function registration a bit. --- hw/xfree86/os-support/bus/Pci.c | 6 +++--- hw/xfree86/os-support/bus/Pci.h | 16 +--------------- hw/xfree86/os-support/bus/bsd_pci.c | 15 --------------- hw/xfree86/os-support/bus/linuxPci.c | 11 +---------- 4 files changed, 5 insertions(+), 43 deletions(-) diff --git a/hw/xfree86/os-support/bus/Pci.c b/hw/xfree86/os-support/bus/Pci.c index 5dccd39dc..888a9e36d 100644 --- a/hw/xfree86/os-support/bus/Pci.c +++ b/hw/xfree86/os-support/bus/Pci.c @@ -138,13 +138,13 @@ /* Global data */ -pciBusInfo_t *pciBusInfo = NULL; +pciBusFuncs_t *pciBusFuncs = NULL; _X_EXPORT ADDRESS pciBusAddrToHostAddr(PCITAG tag, PciAddrType type, ADDRESS addr) { - if (pciBusInfo->funcs->pciAddrBusToHost) - return pciBusInfo->funcs->pciAddrBusToHost(tag, type, addr); + if (pciBusFuncs && pciBusFuncs->pciAddrBusToHost) + return pciBusFuncs->pciAddrBusToHost(tag, type, addr); else return addr; } diff --git a/hw/xfree86/os-support/bus/Pci.h b/hw/xfree86/os-support/bus/Pci.h index 285c7a558..5feb73349 100644 --- a/hw/xfree86/os-support/bus/Pci.h +++ b/hw/xfree86/os-support/bus/Pci.h @@ -191,23 +191,9 @@ typedef struct pci_bus_funcs { ADDRESS (*pciAddrBusToHost)(PCITAG, PciAddrType, ADDRESS); } pciBusFuncs_t, *pciBusFuncs_p; -/* - * pciBusInfo_t - One structure per defined PCI bus - */ -typedef struct pci_bus_info { - unsigned char numDevices; /* Range of valid devnums */ - unsigned char secondary; /* Boolean: bus is a secondary */ - int primary_bus; /* Parent bus */ - pciBusFuncs_p funcs; /* PCI access functions */ - void *pciBusPriv; /* Implementation private data */ - struct pci_device *bridge; /* bridge that opens this bus */ -} pciBusInfo_t; - -#define HOST_NO_BUS ((pciBusInfo_t *)(-1)) - /* Generic PCI service functions and helpers */ ADDRESS pciAddrNOOP(PCITAG tag, PciAddrType type, ADDRESS); -extern pciBusInfo_t *pciBusInfo; +extern pciBusFuncs_t *pciBusFuncs; #endif /* _PCI_H */ diff --git a/hw/xfree86/os-support/bus/bsd_pci.c b/hw/xfree86/os-support/bus/bsd_pci.c index cfdd98641..9b55d3a44 100644 --- a/hw/xfree86/os-support/bus/bsd_pci.c +++ b/hw/xfree86/os-support/bus/bsd_pci.c @@ -48,19 +48,6 @@ #include "pciaccess.h" -static pciBusFuncs_t bsd_funcs = { - .pciAddrBusToHost = pciAddrNOOP, -}; - -static pciBusInfo_t bsd_pci = { - .numDevices = 32, - .secondary = FALSE, - .primary_bus = 0, - .funcs = &bsd_funcs, - .pciBusPriv = NULL, - .bridge = NULL, -}; - _X_EXPORT pointer xf86MapDomainMemory(int ScreenNum, int Flags, struct pci_device *dev, ADDRESS Base, unsigned long Size) @@ -78,7 +65,5 @@ xf86MapLegacyIO(struct pci_device *dev) void bsdPciInit(void) { - pciBusInfo = &bsd_pci; - xf86InitVidMem(); } diff --git a/hw/xfree86/os-support/bus/linuxPci.c b/hw/xfree86/os-support/bus/linuxPci.c index 28b0aec95..263fd8ff1 100644 --- a/hw/xfree86/os-support/bus/linuxPci.c +++ b/hw/xfree86/os-support/bus/linuxPci.c @@ -79,15 +79,6 @@ static pciBusFuncs_t linuxFuncs0 = { #endif }; -static pciBusInfo_t linuxPci0 = { -/* numDevices */ 32, -/* secondary */ FALSE, -/* primary_bus */ 0, -/* funcs */ &linuxFuncs0, -/* pciBusPriv */ NULL, -/* bridge */ NULL -}; - static const struct pci_id_match match_host_bridge = { PCI_MATCH_ANY, PCI_MATCH_ANY, PCI_MATCH_ANY, PCI_MATCH_ANY, (PCI_CLASS_BRIDGE << 16) | (PCI_SUBCLASS_BRIDGE_HOST << 8), @@ -109,7 +100,7 @@ linuxPciInit(void) we'll need a fallback for 2.0 kernels here */ return; } - pciBusInfo = &linuxPci0; + pciBusFuncs = &linuxFuncs0; } /** From 4457e31710af90f9ac295bb686c841e9473fb767 Mon Sep 17 00:00:00 2001 From: Adam Jackson Date: Thu, 9 Oct 2008 00:14:54 -0400 Subject: [PATCH 16/62] PCI: Remove unused ia64 platform code. --- hw/xfree86/os-support/linux/Makefile.am | 1 - hw/xfree86/os-support/linux/lnx_ia64.c | 74 ------------------------- hw/xfree86/os-support/shared/ia64Pci.h | 46 --------------- 3 files changed, 121 deletions(-) delete mode 100644 hw/xfree86/os-support/linux/lnx_ia64.c delete mode 100644 hw/xfree86/os-support/shared/ia64Pci.h diff --git a/hw/xfree86/os-support/linux/Makefile.am b/hw/xfree86/os-support/linux/Makefile.am index f12dfb05c..da1dcf690 100644 --- a/hw/xfree86/os-support/linux/Makefile.am +++ b/hw/xfree86/os-support/linux/Makefile.am @@ -2,7 +2,6 @@ noinst_LTLIBRARIES = liblinux.la if LINUX_IA64 PLATFORM_PCI_SUPPORT = $(srcdir)/../shared/ia64Pci.c -PLATFORM_DEFINES = -DOS_PROBE_PCI_CHIPSET=lnxProbePciChipset PLATFORM_INCLUDES = -I$(srcdir)/../shared endif if LINUX_ALPHA diff --git a/hw/xfree86/os-support/linux/lnx_ia64.c b/hw/xfree86/os-support/linux/lnx_ia64.c deleted file mode 100644 index 5f742d01f..000000000 --- a/hw/xfree86/os-support/linux/lnx_ia64.c +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright 2004, Egbert Eich - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * EGBERT EICH BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER - * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CON- - * NECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name of Egbert Eich shall not - * be used in advertising or otherwise to promote the sale, use or other deal- - *ings in this Software without prior written authorization from Egbert Eich. - * - */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include -#include -#include -#include -#include - -#include "ia64Pci.h" -#include "Pci.h" - -#if defined OS_PROBE_PCI_CHIPSET -IA64Chipset OS_PROBE_PCI_CHIPSET(scanpciWrapperOpt flags) -{ - struct stat unused; - struct utsname utsName; - - if (!stat("/proc/bus/mckinley/zx1",&unused) - || !stat("/proc/bus/mckinley/zx2",&unused)) - return ZX1_CHIPSET; - - if (!stat("/proc/sgi_sn/licenseID", &unused)) { - int major, minor, patch; - char *c; - - /* We need a 2.6.11 or better kernel for Altix support */ - uname(&utsName); - c = utsName.release; - - major = atoi(c); - c = strstr(c, ".") + 1; - minor = atoi(c); - c = strstr(c, ".") + 1; - patch = atoi(c); - - if (major < 2 || (major == 2 && minor < 6) || - (major == 2 && minor == 6 && patch < 11)) { - ErrorF("Kernel 2.6.11 or better needed for Altix support\n"); - return NONE_CHIPSET; - } - return ALTIX_CHIPSET; - } - - return NONE_CHIPSET; -} -#endif diff --git a/hw/xfree86/os-support/shared/ia64Pci.h b/hw/xfree86/os-support/shared/ia64Pci.h deleted file mode 100644 index 978c9ff0e..000000000 --- a/hw/xfree86/os-support/shared/ia64Pci.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright 2004, Egbert Eich - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * EGBERT EICH BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER - * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CON- - * NECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name of Egbert Eich shall not - * be used in advertising or otherwise to promote the sale, use or other deal- - *ings in this Software without prior written authorization from Egbert Eich. - * - */ -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#ifndef _IA64_PCI_H -# define _IA64_PCI_H - -#include "Pci.h" - -typedef enum { - NONE_CHIPSET, - I460GX_CHIPSET, - E8870_CHIPSET, - ZX1_CHIPSET, - ALTIX_CHIPSET -} IA64Chipset; - -# ifdef OS_PROBE_PCI_CHIPSET -extern IA64Chipset OS_PROBE_PCI_CHIPSET(scanpciWrapperOpt flags); -# endif -#endif From 095ba1435501776c8c8a34e767b89f89e5dc949a Mon Sep 17 00:00:00 2001 From: Adam Jackson Date: Thu, 9 Oct 2008 00:27:33 -0400 Subject: [PATCH 17/62] Bus: remove the "reducer" This code effectively didn't do anything anymore. --- hw/xfree86/common/xf86Bus.c | 53 ------------------------------------- 1 file changed, 53 deletions(-) diff --git a/hw/xfree86/common/xf86Bus.c b/hw/xfree86/common/xf86Bus.c index dcc5c3eac..27626a0be 100644 --- a/hw/xfree86/common/xf86Bus.c +++ b/hw/xfree86/common/xf86Bus.c @@ -25,7 +25,6 @@ * authorization from the copyright holder(s) and author(s). */ -#define REDUCER /* * This file contains the interfaces to the bus-specific code */ @@ -71,10 +70,6 @@ BusRec primaryBus = { BUS_NONE, {{0}}}; static Bool xf86ResAccessEnter = FALSE; -#ifdef REDUCER -/* Resources that temporarily conflict with estimated resources */ -static resPtr AccReducers = NULL; -#endif /* resource lists */ resPtr Acc = NULL; @@ -1853,22 +1848,6 @@ xf86SetOperatingState(resList list, int entityIndex, int mask) * resources that conflict with estimated resources. For now, just register * them with a logged warning. */ -#ifdef REDUCER -static void -ProcessEstimatedConflicts(void) -{ - if (!AccReducers) - return; - - /* Temporary */ - xf86MsgVerb(X_WARNING, 3, - "Registering the following despite conflicts with estimated" - " resources:\n"); - xf86PrintResList(3, AccReducers); - Acc = xf86JoinResLists(Acc, AccReducers); - AccReducers = NULL; -} -#endif /* * xf86ClaimFixedResources() -- This function gets called from the @@ -1909,20 +1888,7 @@ xf86ClaimFixedResources(resList list, int entityIndex) case ResExclusive: if (!xf86ChkConflict(&range, entityIndex)) { Acc = xf86AddResToList(Acc, &range, entityIndex); -#ifdef REDUCER - } else { - range.type |= ResEstimated; - if (!xf86ChkConflict(&range, entityIndex) && - !checkConflict(&range, AccReducers, entityIndex, - SETUP, FALSE)) { - range.type &= ~(ResEstimated | ResBios); - AccReducers = - xf86AddResToList(AccReducers, &range, entityIndex); -#endif } else resError(&range); /* no return */ -#ifdef REDUCER - } -#endif break; case ResShared: /* at this stage the resources are just added to the @@ -1944,9 +1910,6 @@ xf86ClaimFixedResources(resList list, int entityIndex) xf86MsgVerb(X_INFO, 3, "resource ranges after xf86ClaimFixedResources() call:\n"); xf86PrintResList(3,Acc); -#ifdef REDUCER - ProcessEstimatedConflicts(); -#endif #ifdef DEBUG if (ptr) { xf86MsgVerb(X_INFO, 3, "to be registered later:\n"); @@ -2085,16 +2048,6 @@ xf86PostProbe(void) resp_x = resp; resp = resp->next; resp_x->next = tmp; -#ifdef REDUCER - } else { - resp->res_type |= ResEstimated; - if (!checkConflict(&resp->val, acc, i, SETUP, FALSE)) { - resp->res_type &= ~(ResEstimated | ResBios); - tmp = AccReducers; - AccReducers = resp; - resp = resp->next; - AccReducers->next = tmp; -#endif } else { xf86MsgVerb(X_INFO, 3, "Found conflict at: 0x%lx\n",val); resp->res_type &= ~ResEstimated; @@ -2103,14 +2056,8 @@ xf86PostProbe(void) resp = resp->next; xf86Entities[i]->resources->next = tmp; } -#ifdef REDUCER - } -#endif } xf86JoinResLists(Acc,resp_x); -#ifdef REDUCER - ProcessEstimatedConflicts(); -#endif } xf86FreeResList(acc); From 41be6b3f0dc0baa1c6ae8d2b41a6be73ca0e7268 Mon Sep 17 00:00:00 2001 From: Adam Jackson Date: Thu, 9 Oct 2008 00:33:28 -0400 Subject: [PATCH 18/62] Bus: Remove the notion of estimated resources. --- hw/xfree86/common/xf86Bus.c | 12 +----------- hw/xfree86/os-support/shared/stdResource.c | 3 --- 2 files changed, 1 insertion(+), 14 deletions(-) diff --git a/hw/xfree86/common/xf86Bus.c b/hw/xfree86/common/xf86Bus.c index 27626a0be..8d3d9bbe3 100644 --- a/hw/xfree86/common/xf86Bus.c +++ b/hw/xfree86/common/xf86Bus.c @@ -1009,10 +1009,6 @@ needCheck(resPtr pRes, unsigned long type, int entityIndex, xf86State state) if (pRes->res_type & type & ResBios) return FALSE; - /*If requested, skip over estimated resources */ - if (pRes->res_type & type & ResEstimated) - return FALSE; - if (type & pRes->res_type & ResUnused) return FALSE; @@ -1284,8 +1280,6 @@ xf86PrintResList(int verb, resPtr list) s = "[?]"; } xf86ErrorFVerb(verb, "%s", s); - if (list->res_type & ResEstimated) - xf86ErrorFVerb(verb, "E"); if (list->res_type & ResOverlap) xf86ErrorFVerb(verb, "O"); if (list->res_type & ResInit) @@ -1360,8 +1354,7 @@ RemoveOverlaps(resPtr target, resPtr list, Bool pow2Alignment, Bool useEstimated if (!target) return; - if (!(target->res_type & ResEstimated) /* Don't touch sure resources */ - && !(target->res_type & ResOverlap)) /* Unless they may overlap */ + if (!(target->res_type & ResOverlap)) /* only touch overlaps */ return; for (pRes = list; pRes; pRes = pRes->next) { @@ -1373,9 +1366,6 @@ RemoveOverlaps(resPtr target, resPtr list, Bool pow2Alignment, Bool useEstimated continue; if (pRes->block_begin <= target->block_begin) { - /* Possibly ignore estimated resources */ - if (!useEstimated && (pRes->res_type & ResEstimated)) - continue; /* Special cases */ if (pRes->block_end >= target->block_end) { diff --git a/hw/xfree86/os-support/shared/stdResource.c b/hw/xfree86/os-support/shared/stdResource.c index c144211f0..8cb101488 100644 --- a/hw/xfree86/os-support/shared/stdResource.c +++ b/hw/xfree86/os-support/shared/stdResource.c @@ -77,9 +77,6 @@ xf86StdAccResFromOS(resPtr ret) ret = xf86AddResToList(ret, &range, -1); RANGE(range, 0x000f0000, 0x000fffff, ResExcMemBlock); ret = xf86AddResToList(ret, &range, -1); - RANGE(range, 0x00100000, 0x3fffffff, - ResExcMemBlock | ResBios | ResEstimated); - ret = xf86AddResToList(ret, &range, -1); #if 0 RANGE(range, 0xfec00000, 0xfecfffff, ResExcMemBlock | ResBios); ret = xf86AddResToList(ret, &range, -1); From b21311a99d58997cd1fc68726d0848242e9c34fc Mon Sep 17 00:00:00 2001 From: Adam Jackson Date: Thu, 9 Oct 2008 00:34:42 -0400 Subject: [PATCH 19/62] Bus: Remove unused RemoveOverlaps --- hw/xfree86/common/xf86Bus.c | 85 ------------------------------------- hw/xfree86/common/xf86Bus.h | 2 - 2 files changed, 87 deletions(-) diff --git a/hw/xfree86/common/xf86Bus.c b/hw/xfree86/common/xf86Bus.c index 8d3d9bbe3..7aab953f5 100644 --- a/hw/xfree86/common/xf86Bus.c +++ b/hw/xfree86/common/xf86Bus.c @@ -1335,91 +1335,6 @@ xf86ResourceBrokerInit(void) xf86PrintResList(3, Acc); } -#define MEM_ALIGN (1024 * 1024) - -/* - * RemoveOverlaps() -- remove overlaps between resources of the - * same kind. - * Beware: This function doesn't check for access attributes. - * At resource broker initialization this is no problem as this - * only deals with exclusive resources. - */ - -void -RemoveOverlaps(resPtr target, resPtr list, Bool pow2Alignment, Bool useEstimated) -{ - resPtr pRes; - memType size, newsize, adjust; - - if (!target) - return; - - if (!(target->res_type & ResOverlap)) /* only touch overlaps */ - return; - - for (pRes = list; pRes; pRes = pRes->next) { - if (pRes == target - || ((pRes->res_type & ResTypeMask) != - (target->res_type & ResTypeMask)) - || pRes->block_begin > target->block_end - || pRes->block_end < target->block_begin) - continue; - - if (pRes->block_begin <= target->block_begin) { - - /* Special cases */ - if (pRes->block_end >= target->block_end) { - /* - * If pRes fully contains target, don't do anything - * unless target can overlap. - */ - if (target->res_type & ResOverlap) { - /* Nullify range but keep its ResOverlap bit on */ - target->block_end = target->block_begin - 1; - return; - } else - continue; - } else { -#if 0 /* Don't trim start address - we trust what we got */ - /* - * If !pow2Alignment trim start address: !pow2Alingment - * is only set when estimated OS addresses are handled. - * In cases where the target and pRes have the same - * starting address, reduce the size of the target - * (given it's an estimate). - */ - if (!pow2Alignment) - target->block_begin = pRes->block_end + 1; - else -#endif - if (pRes->block_begin == target->block_begin) - target->block_end = pRes->block_end; - else - continue; - } - } else { - /* Trim target to remove the overlap */ - target->block_end = pRes->block_begin - 1; - } - if (pow2Alignment) { - /* - * Align to a power of two. This requires finding the - * largest power of two that is smaller than the adjusted - * size. - */ - size = target->block_end - target->block_begin + 1; - newsize = 1UL << (sizeof(memType) * 8 - 1); - while (!(newsize & size)) - newsize >>= 1; - target->block_end = target->block_begin + newsize - 1; - } else if (target->block_end > MEM_ALIGN) { - /* Align the end to MEM_ALIGN */ - if ((adjust = (target->block_end + 1) % MEM_ALIGN)) - target->block_end -= adjust; - } - } -} - /* * Resource registration */ diff --git a/hw/xfree86/common/xf86Bus.h b/hw/xfree86/common/xf86Bus.h index c5f5dcce7..c2d5bb7d4 100644 --- a/hw/xfree86/common/xf86Bus.h +++ b/hw/xfree86/common/xf86Bus.h @@ -140,7 +140,5 @@ BusType StringToBusType(const char* busID, const char **retID); Bool xf86IsSubsetOf(resRange range, resPtr list); resPtr xf86ExtractTypeFromList(resPtr list, unsigned long type); resPtr xf86FindIntersect(resRange Range, resPtr list); -void RemoveOverlaps(resPtr target, resPtr list, Bool pow2Alignment, - Bool useEstimated); #endif /* _XF86_BUS_H */ From a96db74c2a95bb1dce132cf47ea720ae939dfad7 Mon Sep 17 00:00:00 2001 From: Adam Jackson Date: Thu, 9 Oct 2008 00:43:26 -0400 Subject: [PATCH 20/62] Bus: Don't try to find an ISA bus just for fun. --- hw/xfree86/common/xf86Bus.c | 39 ------------------------------------- 1 file changed, 39 deletions(-) diff --git a/hw/xfree86/common/xf86Bus.c b/hw/xfree86/common/xf86Bus.c index 7aab953f5..73d581585 100644 --- a/hw/xfree86/common/xf86Bus.c +++ b/hw/xfree86/common/xf86Bus.c @@ -2459,9 +2459,6 @@ xf86ExtractTypeFromList(resPtr list, unsigned long type) return ret; } -/*------------------------------------------------------------*/ -static void CheckGenericGA(void); - /* * xf86FindPrimaryDevice() - Find the display device which * was active when the server was started. @@ -2469,9 +2466,6 @@ static void CheckGenericGA(void); void xf86FindPrimaryDevice() { - /* if no VGA device is found check for primary PCI device */ - if (primaryBus.type == BUS_NONE && xorgHWAccess) - CheckGenericGA(); if (primaryBus.type != BUS_NONE) { char *bus; char loc[16]; @@ -2502,39 +2496,6 @@ xf86FindPrimaryDevice() } } -#if !defined(__sparc) && !defined(__sparc__) && !defined(__powerpc__) && !defined(__mips__) && !defined(__arm__) && !defined(__m32r__) -#include "vgaHW.h" -#include "compiler.h" -#endif - -/* - * CheckGenericGA() - Check for presence of a VGA device. - */ -static void -CheckGenericGA() -{ -/* This needs to be changed for multiple domains */ -#if !defined(__sparc__) && !defined(__sparc) && !defined(__powerpc__) && !defined(__mips__) && !defined(__ia64__) && !defined(__arm__) && !defined(__s390__) && !defined(__m32r__) - IOADDRESS GenericIOBase = VGAHW_GET_IOBASE(); - CARD8 CurrentValue, TestValue; - - /* VGA CRTC registers are not used here, so don't bother unlocking them */ - - /* VGA has one more read/write attribute register than EGA */ - (void) inb(GenericIOBase + VGA_IN_STAT_1_OFFSET); /* Reset flip-flop */ - outb(VGA_ATTR_INDEX, 0x14 | 0x20); - CurrentValue = inb(VGA_ATTR_DATA_R); - outb(VGA_ATTR_DATA_W, CurrentValue ^ 0x0F); - outb(VGA_ATTR_INDEX, 0x14 | 0x20); - TestValue = inb(VGA_ATTR_DATA_R); - outb(VGA_ATTR_DATA_W, CurrentValue); - - if ((CurrentValue ^ 0x0F) == TestValue) { - primaryBus.type = BUS_ISA; - } -#endif -} - Bool xf86NoSharedResources(int screenIndex,resType res) { From 6b198daa46f2f609aff7900761cf82cc2fb4e0b4 Mon Sep 17 00:00:00 2001 From: Adam Jackson Date: Sat, 11 Oct 2008 20:51:39 -0400 Subject: [PATCH 21/62] Bus: remove useless isaConvertRange2Host --- hw/xfree86/common/xf86Bus.c | 3 --- hw/xfree86/common/xf86isaBus.c | 6 ------ hw/xfree86/common/xf86pciBus.h | 1 - 3 files changed, 10 deletions(-) diff --git a/hw/xfree86/common/xf86Bus.c b/hw/xfree86/common/xf86Bus.c index 73d581585..72b21dc92 100644 --- a/hw/xfree86/common/xf86Bus.c +++ b/hw/xfree86/common/xf86Bus.c @@ -1347,9 +1347,6 @@ convertRange2Host(int entityIndex, resRange *pRange) case BUS_PCI: pciConvertRange2Host(entityIndex,pRange); break; - case BUS_ISA: - isaConvertRange2Host(pRange); - break; default: break; } diff --git a/hw/xfree86/common/xf86isaBus.c b/hw/xfree86/common/xf86isaBus.c index 3abad38ef..cc94de45f 100644 --- a/hw/xfree86/common/xf86isaBus.c +++ b/hw/xfree86/common/xf86isaBus.c @@ -133,9 +133,3 @@ xf86IsPrimaryIsa(void) { return ( primaryBus.type == BUS_ISA ); } - -void -isaConvertRange2Host(resRange *pRange) -{ - return; -} diff --git a/hw/xfree86/common/xf86pciBus.h b/hw/xfree86/common/xf86pciBus.h index 7d08502fc..1cbfa38ea 100644 --- a/hw/xfree86/common/xf86pciBus.h +++ b/hw/xfree86/common/xf86pciBus.h @@ -70,6 +70,5 @@ void PciBusStateEnter(void); void PciStateLeave(void); void PciBusStateLeave(void); void pciConvertRange2Host(int entityIndex, resRange *pRange); -void isaConvertRange2Host(resRange *pRange); #endif /* _XF86_PCI_BUS_H */ From 3e5281af17841cf50d0e52a728b12c6ab56e61df Mon Sep 17 00:00:00 2001 From: Adam Jackson Date: Sat, 11 Oct 2008 21:16:45 -0400 Subject: [PATCH 22/62] PCI: Unexport xf86scanpci --- hw/xfree86/loader/xf86sym.c | 1 - hw/xfree86/os-support/bus/Pci.c | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/hw/xfree86/loader/xf86sym.c b/hw/xfree86/loader/xf86sym.c index f2b7e93ec..2d646bcb4 100644 --- a/hw/xfree86/loader/xf86sym.c +++ b/hw/xfree86/loader/xf86sym.c @@ -654,7 +654,6 @@ _X_HIDDEN void *xfree86LookupTab[] = { SYMFUNC(pciTag) SYMFUNC(pciBusAddrToHostAddr) - SYMFUNC(xf86scanpci) /* Loader functions */ SYMFUNC(LoadSubModule) diff --git a/hw/xfree86/os-support/bus/Pci.c b/hw/xfree86/os-support/bus/Pci.c index 888a9e36d..8ca2f1f9b 100644 --- a/hw/xfree86/os-support/bus/Pci.c +++ b/hw/xfree86/os-support/bus/Pci.c @@ -161,7 +161,7 @@ pciAddrNOOP(PCITAG tag, PciAddrType type, ADDRESS addr) return(addr); } -_X_EXPORT Bool +Bool xf86scanpci(void) { Bool success = FALSE; From c251c0baae59714a6ac83b69cd106c08baa3613e Mon Sep 17 00:00:00 2001 From: Adam Jackson Date: Sat, 11 Oct 2008 21:34:27 -0400 Subject: [PATCH 23/62] Bus: remove special handling for init-only resources This isn't used by any driver, nor has it ever been as far as I can tell. --- hw/xfree86/common/xf86Bus.c | 25 +------------------------ 1 file changed, 1 insertion(+), 24 deletions(-) diff --git a/hw/xfree86/common/xf86Bus.c b/hw/xfree86/common/xf86Bus.c index 72b21dc92..fe035f4f8 100644 --- a/hw/xfree86/common/xf86Bus.c +++ b/hw/xfree86/common/xf86Bus.c @@ -158,8 +158,6 @@ void xf86EntityInit(void) { int i; - resPtr *pprev_next; - resPtr res; xf86AccessPtr pacc; for (i = 0; i < xf86NumEntities; i++) @@ -171,17 +169,6 @@ xf86EntityInit(void) pacc->AccessEnable(pacc->arg); xf86Entities[i]->entityInit(i,xf86Entities[i]->private); pacc->AccessDisable(pacc->arg); - /* remove init resources after init is processed */ - pprev_next = &Acc; - res = Acc; - while (res) { - if (res->res_type & ResInit && (res->entityIndex == i)) { - (*pprev_next) = res->next; - xfree(res); - } else - pprev_next = &(res->next); - res = (*pprev_next); - } } } @@ -1907,7 +1894,7 @@ xf86PostProbe(void) { memType val; int i,j; - resPtr resp, acc, tmp, resp_x, *pprev_next; + resPtr resp, acc, tmp, resp_x; if (fbSlotClaimed) { if (pciSlotClaimed || isaSlotClaimed @@ -1927,17 +1914,7 @@ xf86PostProbe(void) return; } } - /* don't compare against ResInit - remove it from clone.*/ acc = tmp = xf86DupResList(Acc); - pprev_next = &acc; - while (tmp) { - if (tmp->res_type & ResInit) { - (*pprev_next) = tmp->next; - xfree(tmp); - } else - pprev_next = &(tmp->next); - tmp = (*pprev_next); - } for (i=0; iresources; From 8397df89456558e3c85b05e0acfccb9f6af6b695 Mon Sep 17 00:00:00 2001 From: Adam Jackson Date: Sat, 11 Oct 2008 21:36:14 -0400 Subject: [PATCH 24/62] Remove unused MIN macro --- hw/xfree86/common/xf86Bus.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/hw/xfree86/common/xf86Bus.c b/hw/xfree86/common/xf86Bus.c index fe035f4f8..d7abfc997 100644 --- a/hw/xfree86/common/xf86Bus.c +++ b/hw/xfree86/common/xf86Bus.c @@ -94,10 +94,6 @@ static Bool doFramebufferMode = FALSE; static StateChangeNotificationPtr StateChangeNotificationList; static void notifyStateChange(xf86NotifyState state); -#undef MIN -#define MIN(x,y) ((x Date: Sat, 11 Oct 2008 21:41:47 -0400 Subject: [PATCH 25/62] Bus: Trust the kernel when registering driver resources ... everywhere, not just (linux && (ia64 || alpha)). --- hw/xfree86/common/xf86Bus.c | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/hw/xfree86/common/xf86Bus.c b/hw/xfree86/common/xf86Bus.c index d7abfc997..1316dec29 100644 --- a/hw/xfree86/common/xf86Bus.c +++ b/hw/xfree86/common/xf86Bus.c @@ -1349,13 +1349,13 @@ xf86ConvertListToHost(int entityIndex, resPtr list) /* * xf86RegisterResources() -- attempts to register listed resources. - * Returns a resPtr listing all resources not successfully registered. + * Returns a resPtr listing all resources not successfully registered, by + * which we mean, NULL. */ _X_EXPORT resPtr xf86RegisterResources(int entityIndex, resList list, unsigned long access) { - resPtr res = NULL; resRange range; resList list_f = NULL; @@ -1371,15 +1371,7 @@ xf86RegisterResources(int entityIndex, resList list, unsigned long access) range.type = (range.type & ~ResAccMask) | (access & ResAccMask); } range.type &= ~ResEstimated; /* Not allowed for drivers */ -#if !((defined(__alpha__) || (defined(__ia64__))) && defined(linux)) - /* On Alpha Linux, do not check for conflicts, trust the kernel. */ - if (checkConflict(&range, Acc, entityIndex, SETUP,TRUE)) - res = xf86AddResToList(res,&range,entityIndex); - else -#endif - { - Acc = xf86AddResToList(Acc,&range,entityIndex); - } + Acc = xf86AddResToList(Acc,&range,entityIndex); list++; } if (list_f) @@ -1389,11 +1381,7 @@ xf86RegisterResources(int entityIndex, resList list, unsigned long access) xf86MsgVerb(X_INFO, 3,"Resources after driver initialization\n"); xf86PrintResList(3, Acc); #endif - if (res) { - xf86MsgVerb(X_INFO, 3, "Failed to register resources:\n"); - xf86PrintResList(3, res); - } - return res; + return NULL; } From eb5ae45127fa9f08f0badec7e21f8c26c9c7c969 Mon Sep 17 00:00:00 2001 From: Adam Jackson Date: Sat, 11 Oct 2008 21:44:16 -0400 Subject: [PATCH 26/62] Bus: Simplify a failure case (that pretty much never happens) --- hw/xfree86/common/xf86Bus.c | 24 +----------------------- 1 file changed, 1 insertion(+), 23 deletions(-) diff --git a/hw/xfree86/common/xf86Bus.c b/hw/xfree86/common/xf86Bus.c index 1316dec29..7730a41bd 100644 --- a/hw/xfree86/common/xf86Bus.c +++ b/hw/xfree86/common/xf86Bus.c @@ -1716,28 +1716,6 @@ xf86SetOperatingState(resList list, int entityIndex, int mask) /* * Stage specific code */ - /* - * ProcessEstimatedConflicts() -- Do something about driver-registered - * resources that conflict with estimated resources. For now, just register - * them with a logged warning. - */ - -/* - * xf86ClaimFixedResources() -- This function gets called from the - * driver Probe() function to claim fixed resources. - */ -static void -resError(resList list) -{ - FatalError("A driver tried to allocate the %s %sresource at \n" - "0x%lx:0x%lx which conflicted with another resource. Send the\n" - "output of the server to %s. Please \n" - "specify your computer hardware as closely as possible.\n", - ResIsBlock(list)?"Block":"Sparse", - ResIsMem(list)?"Mem":"Io", - ResIsBlock(list)?list->rBegin:list->rBase, - ResIsBlock(list)?list->rEnd:list->rMask,BUILDERADDR); -} /* * xf86ClaimFixedResources() is used to allocate non-relocatable resources. @@ -1761,7 +1739,7 @@ xf86ClaimFixedResources(resList list, int entityIndex) case ResExclusive: if (!xf86ChkConflict(&range, entityIndex)) { Acc = xf86AddResToList(Acc, &range, entityIndex); - } else resError(&range); /* no return */ + } else FatalError("xf86ClaimFixedResources conflict\n"); break; case ResShared: /* at this stage the resources are just added to the From 994b7c034fc20d76651cf7f6a285526d9aff8770 Mon Sep 17 00:00:00 2001 From: Adam Jackson Date: Sat, 11 Oct 2008 22:11:12 -0400 Subject: [PATCH 27/62] Bus: Don't pretend to care about IRQs, DMA, or PCI config space --- hw/xfree86/common/xf86str.h | 3 --- 1 file changed, 3 deletions(-) diff --git a/hw/xfree86/common/xf86str.h b/hw/xfree86/common/xf86str.h index 8c211234b..3e0f8dce1 100644 --- a/hw/xfree86/common/xf86str.h +++ b/hw/xfree86/common/xf86str.h @@ -623,9 +623,6 @@ typedef struct _CurrAccRec { #define ResMem 0x0001 #define ResIo 0x0002 -#define ResIrq 0x0003 -#define ResDma 0x0004 -#define ResPciCfg 0x000e /* PCI Configuration space */ #define ResPhysMask 0x000F #define ResExclusive 0x0010 From a8bcab2d3b224e4d4d5b6a097ea530beee920213 Mon Sep 17 00:00:00 2001 From: Adam Jackson Date: Sat, 11 Oct 2008 22:14:23 -0400 Subject: [PATCH 28/62] Bus: Remove yet more unused overlap processing. --- hw/xfree86/common/xf86Bus.c | 6 ------ hw/xfree86/common/xf86str.h | 2 -- 2 files changed, 8 deletions(-) diff --git a/hw/xfree86/common/xf86Bus.c b/hw/xfree86/common/xf86Bus.c index 7730a41bd..e297d1e0a 100644 --- a/hw/xfree86/common/xf86Bus.c +++ b/hw/xfree86/common/xf86Bus.c @@ -978,10 +978,6 @@ needCheck(resPtr pRes, unsigned long type, int entityIndex, xf86State state) BusType loc = BUS_NONE; BusType r_loc = BUS_NONE; - /* Ignore overlapped ranges that have been nullified */ - if ((pRes->res_type & ResOverlap) && (pRes->block_begin > pRes->block_end)) - return FALSE; - if ((pRes->res_type & ResTypeMask) != (type & ResTypeMask)) return FALSE; @@ -1263,8 +1259,6 @@ xf86PrintResList(int verb, resPtr list) s = "[?]"; } xf86ErrorFVerb(verb, "%s", s); - if (list->res_type & ResOverlap) - xf86ErrorFVerb(verb, "O"); if (list->res_type & ResInit) xf86ErrorFVerb(verb, "t"); if (list->res_type & ResBios) diff --git a/hw/xfree86/common/xf86str.h b/hw/xfree86/common/xf86str.h index 3e0f8dce1..32e0d955c 100644 --- a/hw/xfree86/common/xf86str.h +++ b/hw/xfree86/common/xf86str.h @@ -645,7 +645,6 @@ typedef struct _CurrAccRec { #define ResMiscMask 0x00F000 #define ResBus 0x010000 -#define ResOverlap 0x020000 #if defined(__alpha__) && defined(linux) # define ResDomain 0x1ff000000ul @@ -684,7 +683,6 @@ typedef struct _CurrAccRec { #define ResIsBlock(r) (((r)->type & ResExtMask) == ResBlock) #define ResIsSparse(r) (((r)->type & ResExtMask) == ResSparse) #define ResIsEstimated(r) (((r)->type & ResMiscMask) == ResEstimated) -#define ResCanOverlap(r) (ResIsEstimated(r) || ((r)->type & ResOverlap)) typedef struct { unsigned long type; /* shared, exclusive, unused etc. */ From df14682a31b92751091571ed82f6095f55f19cca Mon Sep 17 00:00:00 2001 From: Adam Jackson Date: Sat, 11 Oct 2008 22:48:51 -0400 Subject: [PATCH 29/62] Bus: Remove ISA support. No, really. PCI is old enough to drive now. If you want this, get the kernel to expose a framebuffer device. --- hw/xfree86/common/Makefile.am | 2 +- hw/xfree86/common/xf86.h | 25 --- hw/xfree86/common/xf86Bus.c | 42 +---- hw/xfree86/common/xf86Configure.c | 27 --- hw/xfree86/common/xf86Helper.c | 209 +--------------------- hw/xfree86/common/xf86Init.c | 4 +- hw/xfree86/common/xf86isaBus.c | 135 -------------- hw/xfree86/common/xf86pciBus.c | 5 - hw/xfree86/common/xf86str.h | 12 -- hw/xfree86/int10/generic.c | 13 -- hw/xfree86/loader/xf86sym.c | 10 -- hw/xfree86/os-support/linux/int10/linux.c | 4 - 12 files changed, 14 insertions(+), 474 deletions(-) delete mode 100644 hw/xfree86/common/xf86isaBus.c diff --git a/hw/xfree86/common/Makefile.am b/hw/xfree86/common/Makefile.am index 06d53c14b..d3202bcfc 100644 --- a/hw/xfree86/common/Makefile.am +++ b/hw/xfree86/common/Makefile.am @@ -14,7 +14,7 @@ XISOURCES = xf86Xinput.c xisb.c XISDKINCS = xf86Xinput.h xisb.h RANDRSOURCES = xf86RandR.c -BUSSOURCES = xf86isaBus.c xf86pciBus.c xf86fbBus.c xf86noBus.c $(SBUS_SOURCES) +BUSSOURCES = xf86pciBus.c xf86fbBus.c xf86noBus.c $(SBUS_SOURCES) MODEDEFSOURCES = $(srcdir)/vesamodes $(srcdir)/extramodes diff --git a/hw/xfree86/common/xf86.h b/hw/xfree86/common/xf86.h index 4432c551b..e1f1b7051 100644 --- a/hw/xfree86/common/xf86.h +++ b/hw/xfree86/common/xf86.h @@ -66,7 +66,6 @@ extern ScrnInfoPtr *xf86Screens; /* List of pointers to ScrnInfoRecs */ extern const unsigned char byte_reversed[256]; extern ScrnInfoPtr xf86CurrentScreen; extern Bool pciSlotClaimed; -extern Bool isaSlotClaimed; extern Bool fbSlotClaimed; #if defined(__sparc__) || defined(__sparc) extern Bool sbusSlotClaimed; @@ -103,16 +102,12 @@ Bool xf86ParsePciBusString(const char *busID, int *bus, int *device, Bool xf86ComparePciBusString(const char *busID, int bus, int device, int func); void xf86FormatPciBusNumber(int busnum, char *buffer); resPtr xf86AddRangesToList(resPtr list, resRange *pRange, int entityIndex); -int xf86ClaimIsaSlot(DriverPtr drvp, int chipset, GDevPtr dev, Bool active); -int xf86GetIsaInfoForScreen(int scrnIndex); int xf86GetFbInfoForScreen(int scrnIndex); -Bool xf86ParseIsaBusString(const char *busID); int xf86ClaimFbSlot(DriverPtr drvp, int chipset, GDevPtr dev, Bool active); int xf86ClaimNoSlot(DriverPtr drvp, int chipset, GDevPtr dev, Bool active); void xf86EnableAccess(ScrnInfoPtr pScrn); void xf86SetCurrentAccess(Bool Enable, ScrnInfoPtr pScrn); Bool xf86IsPrimaryPci(struct pci_device * pPci); -Bool xf86IsPrimaryIsa(void); /* new RAC */ resPtr xf86AddResToList(resPtr rlist, resRange *Range, int entityIndex); void xf86FreeResList(resPtr rlist); @@ -159,8 +154,6 @@ DevUnion *xf86GetEntityPrivate(int entityIndex, int privIndex); /* xf86Configure.c */ GDevPtr xf86AddBusDeviceToConfigure(const char *driver, BusType bus, void *busData, int chipset); -GDevPtr xf86AddDeviceToConfigure( const char *driver, - struct pci_device * pVideo, int chipset ); /* xf86Cursor.c */ @@ -243,10 +236,6 @@ int xf86MatchPciInstances(const char *driverName, int vendorID, SymTabPtr chipsets, PciChipsets *PCIchipsets, GDevPtr *devList, int numDevs, DriverPtr drvp, int **foundEntities); -int xf86MatchIsaInstances(const char *driverName, SymTabPtr chipsets, - IsaChipsets *ISAchipsets, DriverPtr drvp, - FindIsaDevProc FindIsaDevice, GDevPtr *devList, - int numDevs, int **foundEntities); void xf86GetClocks(ScrnInfoPtr pScrn, int num, Bool (*ClockFunc)(ScrnInfoPtr, int), void (*ProtectRegs)(ScrnInfoPtr, Bool), @@ -297,11 +286,6 @@ ScrnInfoPtr xf86ConfigPciEntity(ScrnInfoPtr pScrn, int scrnFlag, resList res, EntityProc init, EntityProc enter, EntityProc leave, pointer private); -ScrnInfoPtr xf86ConfigIsaEntity(ScrnInfoPtr pScrn, int scrnFlag, - int entityIndex, IsaChipsets *i_chip, - resList res, EntityProc init, - EntityProc enter, EntityProc leave, - pointer private); ScrnInfoPtr xf86ConfigFbEntity(ScrnInfoPtr pScrn, int scrnFlag, int entityIndex, EntityProc init, EntityProc enter, EntityProc leave, @@ -313,19 +297,10 @@ Bool xf86ConfigActivePciEntity(ScrnInfoPtr pScrn, EntityProc enter, EntityProc leave, pointer private); /* Obsolete! don't use */ -Bool xf86ConfigActiveIsaEntity(ScrnInfoPtr pScrn, - int entityIndex, IsaChipsets *i_chip, - resList res, EntityProc init, - EntityProc enter, EntityProc leave, - pointer private); void xf86ConfigPciEntityInactive(EntityInfoPtr pEnt, PciChipsets *p_chip, resList res, EntityProc init, EntityProc enter, EntityProc leave, pointer private); -void xf86ConfigIsaEntityInactive(EntityInfoPtr pEnt, IsaChipsets *i_chip, - resList res, EntityProc init, - EntityProc enter, EntityProc leave, - pointer private); void xf86ConfigFbEntityInactive(EntityInfoPtr pEnt, EntityProc init, EntityProc enter, EntityProc leave, pointer private); diff --git a/hw/xfree86/common/xf86Bus.c b/hw/xfree86/common/xf86Bus.c index e297d1e0a..3236b5a4f 100644 --- a/hw/xfree86/common/xf86Bus.c +++ b/hw/xfree86/common/xf86Bus.c @@ -135,8 +135,6 @@ StringToBusType(const char* busID, const char **retID) } if (!xf86NameCmp(p, "pci") || !xf86NameCmp(p, "agp")) ret = BUS_PCI; - if (!xf86NameCmp(p, "isa")) - ret = BUS_ISA; if (!xf86NameCmp(p, "sbus")) ret = BUS_SBUS; if (ret != BUS_NONE) @@ -226,8 +224,6 @@ xf86IsEntityPrimary(int entityIndex) switch (pEnt->busType) { case BUS_PCI: return (pEnt->bus.id.pci == primaryBus.id.pci); - case BUS_ISA: - return TRUE; case BUS_SBUS: return (pEnt->sbusBusId.fbNum == primaryBus.id.sbus.fbNum); default: @@ -1009,33 +1005,10 @@ needCheck(resPtr pRes, unsigned long type, int entityIndex, xf86State state) if (pRes->entityIndex > -1) r_loc = xf86Entities[pRes->entityIndex]->busType; - switch (type & ResAccMask) { - case ResExclusive: - switch (pRes->res_type & ResAccMask) { - case ResExclusive: - break; - case ResShared: - /* ISA buses are only locally exclusive on a PCI system */ - if (loc == BUS_ISA && r_loc == BUS_PCI) - return FALSE; - break; - } - break; - case ResShared: - switch (pRes->res_type & ResAccMask) { - case ResExclusive: - /* ISA buses are only locally exclusive on a PCI system */ - if (loc == BUS_PCI && r_loc == BUS_ISA) - return FALSE; - break; - case ResShared: - return FALSE; - } - break; - case ResAny: - break; - } - + if ((type & ResAccMask == ResShared) && + (pRes->res_type & ResAccMask) == ResShared) + return FALSE; + if (pRes->entityIndex == entityIndex) return FALSE; if (pRes->entityIndex > -1 && @@ -1384,7 +1357,6 @@ busTypeSpecific(EntityPtr pEnt, xf86AccessPtr *acc_mem, xf86AccessPtr *acc_io, xf86AccessPtr *acc_mem_io) { switch (pEnt->bus.type) { - case BUS_ISA: case BUS_SBUS: *acc_mem = *acc_io = *acc_mem_io = &AccessNULL; break; @@ -1853,7 +1825,7 @@ xf86PostProbe(void) resPtr resp, acc, tmp, resp_x; if (fbSlotClaimed) { - if (pciSlotClaimed || isaSlotClaimed + if (pciSlotClaimed #if (defined(__sparc__) || defined(__sparc)) && !defined(__OpenBSD__) || sbusSlotClaimed #endif @@ -2409,10 +2381,6 @@ xf86FindPrimaryDevice() primaryBus.id.pci->dev, primaryBus.id.pci->func); break; - case BUS_ISA: - bus = "ISA"; - loc[0] = '\0'; - break; case BUS_SBUS: bus = "SBUS"; snprintf(loc, sizeof(loc), " %2.2x", primaryBus.id.sbus.fbNum); diff --git a/hw/xfree86/common/xf86Configure.c b/hw/xfree86/common/xf86Configure.c index b4ec7295f..87004966a 100644 --- a/hw/xfree86/common/xf86Configure.c +++ b/hw/xfree86/common/xf86Configure.c @@ -115,18 +115,6 @@ xf86AddBusDeviceToConfigure(const char *driver, BusType bus, void *busData, int return NULL; isPrimary = xf86IsPrimaryPci(pVideo); break; - case BUS_ISA: - /* - * This needs to be revisited as it doesn't allow for non-PCI - * multihead. - */ - if (!xf86IsPrimaryIsa()) - return NULL; - isPrimary = TRUE; - for (i = 0; i < nDevToConfig; i++) - if (!DevToConfig[i].pVideo) - return NULL; - break; #if (defined(__sparc__) || defined(__sparc)) && !defined(__OpenBSD__) case BUS_SBUS: for (i = 0; i < nDevToConfig; i++) @@ -202,10 +190,6 @@ xf86AddBusDeviceToConfigure(const char *driver, BusType bus, void *busData, int chipset = (pVideo->vendor_id << 16) | pVideo->device_id; } break; - case BUS_ISA: - NewDevice.GDev.identifier = "ISA Adapter"; - NewDevice.GDev.busID = "ISA"; - break; #if (defined(__sparc__) || defined(__sparc)) && !defined(__OpenBSD__) case BUS_SBUS: { char *promPath = NULL; @@ -241,17 +225,6 @@ xf86AddBusDeviceToConfigure(const char *driver, BusType bus, void *busData, int # undef NewDevice } -/* - * Backwards compatibility - */ -_X_EXPORT GDevPtr -xf86AddDeviceToConfigure(const char *driver, struct pci_device * pVideo, - int chipset) -{ - return xf86AddBusDeviceToConfigure(driver, pVideo ? BUS_PCI : BUS_ISA, - pVideo, chipset); -} - static XF86ConfInputPtr configureInputSection (void) { diff --git a/hw/xfree86/common/xf86Helper.c b/hw/xfree86/common/xf86Helper.c index 3e2316408..e0c941571 100644 --- a/hw/xfree86/common/xf86Helper.c +++ b/hw/xfree86/common/xf86Helper.c @@ -1683,8 +1683,8 @@ xf86MatchPciInstances(const char *driverName, int vendorID, if ( xf86DoConfigure && xf86DoConfigurePass1 ) { if (xf86CheckPciSlot(pPci)) { GDevPtr pGDev = - xf86AddDeviceToConfigure(drvp->driverName, - pPci, -1); + xf86AddBusDeviceToConfigure(drvp->driverName, + BUS_PCI, pPci, -1); if (pGDev) { /* After configure pass 1, chipID and chipRev * are treated as over-rides, so clobber them @@ -1953,108 +1953,6 @@ xf86MatchPciInstances(const char *driverName, int vendorID, return numFound; } -_X_EXPORT int -xf86MatchIsaInstances(const char *driverName, SymTabPtr chipsets, - IsaChipsets *ISAchipsets, DriverPtr drvp, - FindIsaDevProc FindIsaDevice, GDevPtr *devList, - int numDevs, int **foundEntities) -{ - SymTabRec *c; - IsaChipsets *Chips; - int i; - int numFound = 0; - int foundChip = -1; - int *retEntities = NULL; - - *foundEntities = NULL; - -#if defined(__sparc__) || defined(__powerpc__) - FindIsaDevice = NULL; /* Temporary */ -#endif - - if (xf86DoProbe || (xf86DoConfigure && xf86DoConfigurePass1)) { - if (FindIsaDevice && - ((foundChip = (*FindIsaDevice)(NULL)) != -1)) { - xf86AddDeviceToConfigure(drvp->driverName, NULL, foundChip); - return 1; - } - return 0; - } - - for (i = 0; i < numDevs; i++) { - MessageType from = X_CONFIG; - GDevPtr dev = NULL; - GDevPtr devBus = NULL; - - if (devList[i]->busID && *devList[i]->busID) { - if (xf86ParseIsaBusString(devList[i]->busID)) { - if (devBus) xf86MsgVerb(X_WARNING,0, - "%s: More than one matching Device " - "section for ISA-Bus found: %s\n", - driverName,devList[i]->identifier); - else devBus = devList[i]; - } - } else { - if (xf86IsPrimaryIsa()) { - if (dev) xf86MsgVerb(X_WARNING,0, - "%s: More than one matching " - "Device section found: %s\n", - driverName,devList[i]->identifier); - else dev = devList[i]; - } - } - if (devBus) dev = devBus; - if (dev) { - if (dev->chipset) { - for (c = chipsets; c->token >= 0; c++) { - if (xf86NameCmp(c->name, dev->chipset) == 0) - break; - } - if (c->token == -1) { - xf86MsgVerb(X_WARNING, 0, "%s: Chipset \"%s\" in Device " - "section \"%s\" isn't valid for this driver\n", - driverName, dev->chipset, - dev->identifier); - } else - foundChip = c->token; - } else { - if (FindIsaDevice) foundChip = (*FindIsaDevice)(dev); - /* Probe it */ - from = X_PROBED; - } - } - - /* Check if the chip type is listed in the chipset table - for sanity*/ - - if (foundChip >= 0){ - for (Chips = ISAchipsets; Chips->numChipset >= 0; Chips++) { - if (Chips->numChipset == foundChip) - break; - } - if (Chips->numChipset == -1){ - foundChip = -1; - xf86MsgVerb(X_WARNING,0, - "%s: Driver detected unknown ISA-Bus Chipset\n", - driverName); - } - } - if (foundChip != -1) { - numFound++; - retEntities = xnfrealloc(retEntities,numFound * sizeof(int)); - retEntities[numFound - 1] = - xf86ClaimIsaSlot(drvp,foundChip,dev, dev->active ? TRUE : FALSE); - for (c = chipsets; c->token >= 0; c++) { - if (c->token == foundChip) - break; - } - xf86Msg(from, "Chipset %s found\n", c->name); - } - } - *foundEntities = retEntities; - - return numFound; -} - /* * xf86GetClocks -- get the dot-clocks via a BIG BAD hack ... */ @@ -2557,49 +2455,6 @@ xf86FindXvOptions(int scrnIndex, int adaptor_index, char *port_name, #include "loader/os.c" /* new RAC */ -/* - * xf86ConfigIsa/PciEntity() -- These helper functions assign an - * active entity to a screen, registers its fixed resources, assign - * special enter/leave functions and their private scratch area to - * this entity, take the dog for a walk... - */ -_X_EXPORT ScrnInfoPtr -xf86ConfigIsaEntity(ScrnInfoPtr pScrn, int scrnFlag, int entityIndex, - IsaChipsets *i_chip, resList res, EntityProc init, - EntityProc enter, EntityProc leave, pointer private) -{ - IsaChipsets *i_id; - EntityInfoPtr pEnt = xf86GetEntityInfo(entityIndex); - if (!pEnt) return pScrn; - - if (!(pEnt->location.type == BUS_ISA)) { - xfree(pEnt); - return pScrn; - } - - if (!pEnt->active) { - xf86ConfigIsaEntityInactive(pEnt, i_chip, res, init, enter, - leave, private); - xfree(pEnt); - return pScrn; - } - - if (!pScrn) - pScrn = xf86AllocateScreen(pEnt->driver,scrnFlag); - xf86AddEntityToScreen(pScrn,entityIndex); - - if (i_chip) { - for (i_id = i_chip; i_id->numChipset != -1; i_id++) { - if (pEnt->chipset == i_id->numChipset) break; - } - xf86ClaimFixedResources(i_id->resList,entityIndex); - } - xfree(pEnt); - xf86ClaimFixedResources(res,entityIndex); - xf86SetEntityFuncs(entityIndex,init,enter,leave,private); - - return pScrn; -} _X_EXPORT ScrnInfoPtr xf86ConfigPciEntity(ScrnInfoPtr pScrn, int scrnFlag, int entityIndex, @@ -2675,39 +2530,9 @@ xf86ConfigFbEntity(ScrnInfoPtr pScrn, int scrnFlag, int entityIndex, /* * - * OBSOLETE ! xf86ConfigActiveIsaEntity() and xf86ConfigActivePciEntity() - * are obsolete functions. They the are likely to be removed - * Don't use! + * OBSOLETE ! xf86ConfigActivePciEntity() is an obsolete functions. + * They the are likely to be removed. Don't use! */ -_X_EXPORT Bool -xf86ConfigActiveIsaEntity(ScrnInfoPtr pScrn, int entityIndex, - IsaChipsets *i_chip, resList res, EntityProc init, - EntityProc enter, EntityProc leave, pointer private) -{ - IsaChipsets *i_id; - EntityInfoPtr pEnt = xf86GetEntityInfo(entityIndex); - if (!pEnt) return FALSE; - - if (!pEnt->active || !(pEnt->location.type == BUS_ISA)) { - xfree(pEnt); - return FALSE; - } - - xf86AddEntityToScreen(pScrn,entityIndex); - - if (i_chip) { - for (i_id = i_chip; i_id->numChipset != -1; i_id++) { - if (pEnt->chipset == i_id->numChipset) break; - } - xf86ClaimFixedResources(i_id->resList,entityIndex); - } - xfree(pEnt); - xf86ClaimFixedResources(res,entityIndex); - if (!xf86SetEntityFuncs(entityIndex,init,enter,leave,private)) - return FALSE; - - return TRUE; -} _X_EXPORT Bool xf86ConfigActivePciEntity(ScrnInfoPtr pScrn, int entityIndex, @@ -2740,10 +2565,10 @@ xf86ConfigActivePciEntity(ScrnInfoPtr pScrn, int entityIndex, } /* - * xf86ConfigPci/IsaEntityInactive() -- These functions can be used + * xf86ConfigPciEntityInactive() -- This functions can be used * to configure an inactive entity as well as to reconfigure an * previously active entity inactive. If the entity has been - * assigned to a screen before it will be removed. If p_pci(p_isa) is + * assigned to a screen before it will be removed. If p_pci is * non-NULL all static resources listed there will be registered. */ _X_EXPORT void @@ -2768,28 +2593,6 @@ xf86ConfigPciEntityInactive(EntityInfoPtr pEnt, PciChipsets *p_chip, xf86SetEntityFuncs(pEnt->index,init,enter,leave,private); } -_X_EXPORT void -xf86ConfigIsaEntityInactive(EntityInfoPtr pEnt, IsaChipsets *i_chip, - resList res, EntityProc init, EntityProc enter, - EntityProc leave, pointer private) -{ - IsaChipsets *i_id; - ScrnInfoPtr pScrn; - - if ((pScrn = xf86FindScreenForEntity(pEnt->index))) - xf86RemoveEntityFromScreen(pScrn,pEnt->index); - else if (i_chip) { - for (i_id = i_chip; i_id->numChipset != -1; i_id++) { - if (pEnt->chipset == i_id->numChipset) break; - } - xf86ClaimFixedResources(i_id->resList,pEnt->index); - } - xf86ClaimFixedResources(res,pEnt->index); - /* shared resources are only needed when entity is active: remove */ - xf86DeallocateResourcesForEntity(pEnt->index, ResShared); - xf86SetEntityFuncs(pEnt->index,init,enter,leave,private); -} - void xf86ConfigFbEntityInactive(EntityInfoPtr pEnt, EntityProc init, EntityProc enter, EntityProc leave, pointer private) diff --git a/hw/xfree86/common/xf86Init.c b/hw/xfree86/common/xf86Init.c index c35cb2c38..a052247c8 100644 --- a/hw/xfree86/common/xf86Init.c +++ b/hw/xfree86/common/xf86Init.c @@ -548,8 +548,8 @@ add_matching_devices_to_configure_list(DriverPtr drvp) && ((devices[j].device_class_mask & pPci->device_class) == devices[j].device_class) ) { if (xf86CheckPciSlot(pPci)) { - GDevPtr pGDev = - xf86AddDeviceToConfigure(drvp->driverName, pPci, -1); + GDevPtr pGDev = xf86AddBusDeviceToConfigure( + drvp->driverName, BUS_PCI, pPci, -1); if (pGDev != NULL) { /* After configure pass 1, chipID and chipRev are * treated as over-rides, so clobber them here. diff --git a/hw/xfree86/common/xf86isaBus.c b/hw/xfree86/common/xf86isaBus.c deleted file mode 100644 index cc94de45f..000000000 --- a/hw/xfree86/common/xf86isaBus.c +++ /dev/null @@ -1,135 +0,0 @@ -/* - * Copyright (c) 1997-2000 by The XFree86 Project, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name of the copyright holder(s) - * and author(s) shall not be used in advertising or otherwise to promote - * the sale, use or other dealings in this Software without prior written - * authorization from the copyright holder(s) and author(s). - */ - - -/* - * This file contains the interfaces to the bus-specific code - */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include -#include -#include -#include -#include "os.h" -#include "xf86.h" -#include "xf86Priv.h" -#include "xf86Resources.h" - -#include "xf86Bus.h" - -#define XF86_OS_PRIVS -#define NEED_OS_RAC_PROTOS -#include "xf86_OSproc.h" - -#include "xf86RAC.h" - -Bool isaSlotClaimed = FALSE; - -/* - * If the slot requested is already in use, return FALSE. - * Otherwise, claim the slot for the screen requesting it. - */ - -_X_EXPORT int -xf86ClaimIsaSlot(DriverPtr drvp, int chipset, GDevPtr dev, Bool active) -{ - EntityPtr p; - BusAccPtr pbap = xf86BusAccInfo; - int num; - - num = xf86AllocateEntity(); - p = xf86Entities[num]; - p->driver = drvp; - p->chipset = chipset; - p->busType = BUS_ISA; - p->active = active; - p->inUse = FALSE; - xf86AddDevToEntity(num, dev); - p->access = xnfcalloc(1,sizeof(EntityAccessRec)); - p->access->fallback = &AccessNULL; - p->access->pAccess = &AccessNULL; - p->busAcc = NULL; - while (pbap) { - if (pbap->type == BUS_ISA) - p->busAcc = pbap; - pbap = pbap->next; - } - isaSlotClaimed = TRUE; - return num; -} - -/* - * Get the list of ISA "slots" claimed by a screen - * - * Note: The ISA implementation here assumes that only one ISA "slot" type - * can be claimed by any one screen. That means a return value other than - * 0 or 1 isn't useful. - */ -int -xf86GetIsaInfoForScreen(int scrnIndex) -{ - int num = 0; - int i; - EntityPtr p; - - for (i = 0; i < xf86Screens[scrnIndex]->numEntities; i++) { - p = xf86Entities[xf86Screens[scrnIndex]->entityList[i]]; - if (p->busType == BUS_ISA) { - num++; - } - } - return num; -} - -/* - * Parse a BUS ID string, and return True if it is a ISA bus id. - */ - -_X_EXPORT Bool -xf86ParseIsaBusString(const char *busID) -{ - /* - * The format assumed to be "isa" or "isa:" - */ - return (StringToBusType(busID,NULL) == BUS_ISA); -} - - -/* - * xf86IsPrimaryIsa() -- return TRUE if primary device - * is ISA. - */ - -_X_EXPORT Bool -xf86IsPrimaryIsa(void) -{ - return ( primaryBus.type == BUS_ISA ); -} diff --git a/hw/xfree86/common/xf86pciBus.c b/hw/xfree86/common/xf86pciBus.c index d5ae75b3a..b6ec4adbb 100644 --- a/hw/xfree86/common/xf86pciBus.c +++ b/hw/xfree86/common/xf86pciBus.c @@ -564,11 +564,6 @@ initPciBusState(void) pbap->disable_f = pciBusAccessDisable; savePciBusState(pbap); break; - case PCI_SUBCLASS_BRIDGE_ISA: - case PCI_SUBCLASS_BRIDGE_EISA: - case PCI_SUBCLASS_BRIDGE_MC: - pbap->type = BUS_ISA; - break; } pbap->next = xf86BusAccInfo; xf86BusAccInfo = pbap; diff --git a/hw/xfree86/common/xf86str.h b/hw/xfree86/common/xf86str.h index 32e0d955c..904c369a6 100644 --- a/hw/xfree86/common/xf86str.h +++ b/hw/xfree86/common/xf86str.h @@ -382,10 +382,6 @@ typedef enum { struct pci_device; -typedef struct { - unsigned int dummy; -} IsaBusId; - typedef struct { int fbNum; } SbusBusId; @@ -393,7 +389,6 @@ typedef struct { typedef struct _bus { BusType type; union { - IsaBusId isa; struct pci_device *pci; SbusBusId sbus; } id; @@ -436,8 +431,6 @@ typedef struct { int screen; /* For multi-CRTC cards */ } GDevRec, *GDevPtr; -typedef int (*FindIsaDevProc)(GDevPtr dev); - typedef struct { char * identifier; char * driver; @@ -717,11 +710,6 @@ typedef struct _resRec { #define block_end val.rEnd #define res_type val.type -typedef struct { - int numChipset; - resRange *resList; -} IsaChipsets; - typedef struct _PciChipsets { /** * Key used to match this device with its name in an array of diff --git a/hw/xfree86/int10/generic.c b/hw/xfree86/int10/generic.c index d04d0a25e..0af7c1baa 100644 --- a/hw/xfree86/int10/generic.c +++ b/hw/xfree86/int10/generic.c @@ -220,19 +220,6 @@ xf86ExtendedInitInt10(int entityIndex, int Flags) INTPriv(pInt)->highMemory = GET_HIGH_BASE(rom_device->rom_size); break; } - case BUS_ISA: - vbiosMem = (unsigned char *)sysMem + bios_location; -#if 0 - memset(vbiosMem, 0, V_BIOS_SIZE); - if (xf86ReadBIOS(bios_location, 0, vbiosMem, V_BIOS_SIZE) - < V_BIOS_SIZE) - xf86DrvMsg(screen, X_WARNING, - "Unable to retrieve all of segment 0x%x.\n",bios_location); -#endif - if (!int10_check_bios(screen, bios_location >> 4, vbiosMem)) { - xf86DrvMsg(screen,X_ERROR,"Cannot read V_BIOS (4)\n"); - goto error1; - } default: goto error1; } diff --git a/hw/xfree86/loader/xf86sym.c b/hw/xfree86/loader/xf86sym.c index 2d646bcb4..88b26aa26 100644 --- a/hw/xfree86/loader/xf86sym.c +++ b/hw/xfree86/loader/xf86sym.c @@ -296,17 +296,14 @@ _X_HIDDEN void *xfree86LookupTab[] = { /* xf86Bus.c */ SYMFUNC(xf86CheckPciSlot) SYMFUNC(xf86ClaimPciSlot) - SYMFUNC(xf86ClaimIsaSlot) SYMFUNC(xf86ClaimFbSlot) SYMFUNC(xf86ClaimNoSlot) SYMFUNC(xf86ParsePciBusString) SYMFUNC(xf86ComparePciBusString) SYMFUNC(xf86FormatPciBusNumber) - SYMFUNC(xf86ParseIsaBusString) SYMFUNC(xf86EnableAccess) SYMFUNC(xf86SetCurrentAccess) SYMFUNC(xf86IsPrimaryPci) - SYMFUNC(xf86IsPrimaryIsa) SYMFUNC(xf86FreeResList) SYMFUNC(xf86ClaimFixedResources) SYMFUNC(xf86AddEntityToScreen) @@ -337,9 +334,6 @@ _X_HIDDEN void *xfree86LookupTab[] = { SYMFUNC(xf86AllocateEntityPrivateIndex) SYMFUNC(xf86GetEntityPrivate) - /* xf86Configure.c */ - SYMFUNC(xf86AddDeviceToConfigure) - /* xf86Cursor.c */ SYMFUNC(xf86GetPointerScreenFuncs) @@ -414,7 +408,6 @@ _X_HIDDEN void *xfree86LookupTab[] = { SYMFUNC(xf86PrintChipsets) SYMFUNC(xf86MatchDevice) SYMFUNC(xf86MatchPciInstances) - SYMFUNC(xf86MatchIsaInstances) SYMFUNC(xf86GetVerbosity) SYMFUNC(xf86GetVisualName) SYMFUNC(xf86GetPix24) @@ -454,12 +447,9 @@ _X_HIDDEN void *xfree86LookupTab[] = { SYMFUNC(xf86FindXvOptions) SYMFUNC(xf86GetOS) SYMFUNC(xf86ConfigPciEntity) - SYMFUNC(xf86ConfigIsaEntity) SYMFUNC(xf86ConfigFbEntity) SYMFUNC(xf86ConfigActivePciEntity) - SYMFUNC(xf86ConfigActiveIsaEntity) SYMFUNC(xf86ConfigPciEntityInactive) - SYMFUNC(xf86ConfigIsaEntityInactive) SYMFUNC(xf86IsScreenPrimary) SYMFUNC(xf86RegisterRootWindowProperty) SYMFUNC(xf86IsUnblank) diff --git a/hw/xfree86/os-support/linux/int10/linux.c b/hw/xfree86/os-support/linux/int10/linux.c index b15f7fdc4..06f42f8af 100644 --- a/hw/xfree86/os-support/linux/int10/linux.c +++ b/hw/xfree86/os-support/linux/int10/linux.c @@ -292,10 +292,6 @@ xf86ExtendedInitInt10(int entityIndex, int Flags) pInt->BIOSseg = V_BIOS >> 4; break; } - case BUS_ISA: - if (!xf86int10GetBiosSegment(pInt, NULL)) - goto error3; - break; default: goto error3; } From c7680befe5aebd0f4277d11ff3984d8a7deb9d5b Mon Sep 17 00:00:00 2001 From: Adam Jackson Date: Sat, 11 Oct 2008 23:35:24 -0400 Subject: [PATCH 30/62] Remove the remnants of Jensen support As being an EISA-only machine, and as ISA support is gone now... --- hw/xfree86/common/compiler.h | 13 +- hw/xfree86/os-support/linux/lnx_video.c | 189 +------------------ hw/xfree86/os-support/misc/BUSmemcpy.c | 225 ----------------------- hw/xfree86/os-support/misc/SlowBcopy.c | 62 ++----- hw/xfree86/os-support/shared/bios_mmap.c | 29 +-- 5 files changed, 26 insertions(+), 492 deletions(-) diff --git a/hw/xfree86/common/compiler.h b/hw/xfree86/common/compiler.h index f55219b9b..285d9a3f6 100644 --- a/hw/xfree86/common/compiler.h +++ b/hw/xfree86/common/compiler.h @@ -1541,8 +1541,6 @@ extern void (*xf86WriteMmio32)(int, void *, unsigned long); extern void (*xf86WriteMmioNB8)(int, void *, unsigned long); extern void (*xf86WriteMmioNB16)(int, void *, unsigned long); extern void (*xf86WriteMmioNB32)(int, void *, unsigned long); -extern void xf86JensenMemToBus(char *, long, long, int); -extern void xf86JensenBusToMem(char *, char *, unsigned long, int); extern void xf86SlowBCopyFromBus(unsigned char *, unsigned char *, int); extern void xf86SlowBCopyToBus(unsigned char *, unsigned char *, int); @@ -1556,20 +1554,13 @@ extern void xf86SlowBCopyToBus(unsigned char *, unsigned char *, int); # define MMIO_IN32(base, offset) xf86ReadMmio32(base, offset) # endif -# if defined (JENSEN_SUPPORT) -# define MMIO_OUT32(base, offset, val) \ - (*xf86WriteMmio32)((CARD32)(val), base, offset) -# define MMIO_ONB32(base, offset, val) \ - (*xf86WriteMmioNB32)((CARD32)(val), base, offset) -# else -# define MMIO_OUT32(base, offset, val) \ +# define MMIO_OUT32(base, offset, val) \ do { \ write_mem_barrier(); \ *(volatile CARD32 *)(void *)(((CARD8*)(base)) + (offset)) = (val); \ } while (0) -# define MMIO_ONB32(base, offset, val) \ +# define MMIO_ONB32(base, offset, val) \ *(volatile CARD32 *)(void *)(((CARD8*)(base)) + (offset)) = (val) -# endif # define MMIO_OUT8(base, offset, val) \ (*xf86WriteMmio8)((CARD8)(val), base, offset) diff --git a/hw/xfree86/os-support/linux/lnx_video.c b/hw/xfree86/os-support/linux/lnx_video.c index 4c64fa447..aa62514df 100644 --- a/hw/xfree86/os-support/linux/lnx_video.c +++ b/hw/xfree86/os-support/linux/lnx_video.c @@ -77,8 +77,6 @@ extern int iopl(int __level); extern void sethae(unsigned long hae); -# define isJensen (axpSystem == JENSEN) - # define BUS_BASE bus_base #else @@ -97,10 +95,6 @@ static void unmapVidMem(int, pointer, unsigned long); static pointer mapVidMemSparse(int, unsigned long, unsigned long, int); extern axpDevice lnxGetAXP(void); static void unmapVidMemSparse(int, pointer, unsigned long); -# if defined(JENSEN_SUPPORT) -static pointer mapVidMemJensen(int, unsigned long, unsigned long, int); -static void unmapVidMemJensen(int, pointer, unsigned long); -# endif static axpDevice axpSystem = -1; static Bool needSparse; static unsigned long hae_thresh; @@ -388,17 +382,7 @@ xf86OSInitVidMem(VidMemInfoPtr pVidMem) } bus_base = _bus_base(); } - if (isJensen) { -# ifndef JENSEN_SUPPORT - FatalError("Jensen is not supported any more\n" - "If you are intereseted in fixing Jensen support\n" - "please contact xorg@lists.freedesktop.org\n"); -# else - xf86Msg(X_INFO,"Machine type is Jensen\n"); - pVidMem->mapMem = mapVidMemJensen; - pVidMem->unmapMem = unmapVidMemJensen; -# endif /* JENSEN_SUPPORT */ - } else if (needSparse) { + if (needSparse) { xf86Msg(X_INFO,"Machine needs sparse mapping\n"); pVidMem->mapMem = mapVidMemSparse; pVidMem->unmapMem = unmapVidMemSparse; @@ -922,175 +906,4 @@ _X_EXPORT int (*xf86ReadMmio16)(pointer Base, unsigned long Offset) _X_EXPORT int (*xf86ReadMmio32)(pointer Base, unsigned long Offset) = readDense32; -#ifdef JENSEN_SUPPORT - -static int -readSparseJensen8(pointer Base, register unsigned long Offset); -static int -readSparseJensen16(pointer Base, register unsigned long Offset); -static int -readSparseJensen32(pointer Base, register unsigned long Offset); -static void -writeSparseJensen8(int Value, pointer Base, register unsigned long Offset); -static void -writeSparseJensen16(int Value, pointer Base, register unsigned long Offset); -static void -writeSparseJensen32(int Value, pointer Base, register unsigned long Offset); -static void -writeSparseJensenNB8(int Value, pointer Base, register unsigned long Offset); -static void -writeSparseJensenNB16(int Value, pointer Base, register unsigned long Offset); -static void -writeSparseJensenNB32(int Value, pointer Base, register unsigned long Offset); - -/* - * The Jensen lacks dense memory, thus we have to address the bus via - * the sparse addressing scheme. - * - * Martin Ostermann (ost@comnets.rwth-aachen.de) - Apr.-Sep. 1996 - */ - -#ifdef TEST_JENSEN_CODE -#define SPARSE (5) -#else -#define SPARSE (7) -#endif - -#define JENSEN_SHIFT(x) ((long)x<>= shift; - return 0xffUL & result; -} - -static int -readSparseJensen16(pointer Base, register unsigned long Offset) -{ - register unsigned long result, shift; - - mem_barrier(); - shift = (Offset & 0x2) << 3; - - result = *(vuip)((unsigned long)Base+(Offset<>= shift; - return 0xffffUL & result; -} - -static int -readSparseJensen32(pointer Base, register unsigned long Offset) -{ - register unsigned long result; - - mem_barrier(); - result = *(vuip)((unsigned long)Base+(Offset< 4 ) { - last_read = src_org+count_org - 1; - __asm__("ldq_u %0,%1" - :"=r" (high_word):"m" (*(unsigned long *)(src+4))); - __asm__("extll %1,%2,%0" - :"=r" (low_word) - :"r" (low_word), "r" ((unsigned long)(src))); - __asm__("extlh %1,%2,%0" - :"=r" (tmp) - :"r" (high_word), "r" ((unsigned long)(src))); - tmp |= low_word; - src += 4; - __asm__("mskqh %1,%2,%0" - :"=r" (tmp) - :"r" (tmp), "r" (rm)); - __asm__("mskql %1,%2,%0" - :"=r" (org2) - :"r" (org), "r" (rm)); - tmp |= org2; - - loop = (count-4) >> 2; /* loop eqv. count>=4 ; count -= 4 */ - while (loop) { - /* tmp to be stored completly -- need to read next word*/ - low_word = high_word; - *(volatile unsigned int *) (addr) = tmp; - __asm__("ldq_u %0,%1" - :"=r" (high_word):"m" (*(unsigned long*)(src+4))); - loop --; - __asm__("extll %1,%2,%0" - :"=r" (low_word) - :"r" (low_word), "r" ((unsigned long)src)); - __asm__("extlh %1,%2,%0" - :"=r" (tmp) - :"r" (high_word), "r" ((unsigned long)src)); - src += 4; - tmp |= low_word; - addr += 4< 4 */ - __asm__("ldq_u %0,%1" - :"=r" (high_word):"m" (*(unsigned long *)(src+4))); - __asm__("extll %1,%2,%0" - :"=r" (low_word) - :"r" (low_word), "r" ((unsigned long)(src))); - __asm__("extlh %1,%2,%0" - :"=r" (tmp) - :"r" (high_word), "r" ((unsigned long)(src))); - tmp |= low_word; - if( count < 4 ) { - - mask = -1; - __asm__("mskqh %1,%2,%0" - :"=r" (mask) - :"r" (mask), "r" (rm)); - __asm__("mskql %1,%2,%0" - :"=r" (mask) - :"r" (mask), "r" (count)); - tmp = (tmp & mask) | (org & ~mask); - *(volatile unsigned int *) (addr) = tmp; - return; - } else { - __asm__("mskqh %1,%2,%0" - :"=r" (tmp) - :"r" (tmp), "r" (rm)); - __asm__("mskql %1,%2,%0" - :"=r" (org2) - :"r" (org), "r" (rm)); - - tmp |= org2; - *(volatile unsigned int *) (addr) = tmp; - return; - } - } - } else { /* src & dst are aligned to each other */ - unsigned long addr; - unsigned int tmp,org,rm; - unsigned int *src_r; - - /* add EISA longword coding and round off*/ - addr = (long)(Base+(dst< 4) { - *(volatile unsigned int *) addr = tmp; - addr += 4<>= ((addr>>SPARSE) & 3) * 8; - *dst++ = (char) result; - addr += 1<= 0){ - int i; - - result = *(volatile int *) (addr+LWORD_CODING); - for(i=4;i--;) { - *dst++ = (char) result; - result >>= 8; - } - addr += 4<>= ((addr>>SPARSE) & 3) * 8; - *dst++ = (char) result; - addr += 1<>= ((addr>>SPARSE) & 3) * 8; - *dst++ = (unsigned char) (0xffUL & result); - addr += 1<>= ((addr>>SPARSE) & 3) * 8; + *dst++ = (unsigned char) (0xffUL & result); + addr += 1< Date: Sat, 11 Oct 2008 23:59:24 -0400 Subject: [PATCH 31/62] Remove xf86{En,Dis}ableInterrupts entirely --- hw/xfree86/common/xf86Helper.c | 10 ----- hw/xfree86/loader/xf86sym.c | 2 - hw/xfree86/os-support/bsd/alpha_video.c | 18 -------- hw/xfree86/os-support/bsd/arm_video.c | 21 --------- hw/xfree86/os-support/bsd/i386_video.c | 32 -------------- hw/xfree86/os-support/bsd/ppc_video.c | 18 -------- hw/xfree86/os-support/bsd/sparc64_video.c | 18 -------- hw/xfree86/os-support/hurd/hurd_video.c | 14 ------ hw/xfree86/os-support/linux/lnx_video.c | 18 -------- hw/xfree86/os-support/sco/sco_iop.c | 44 ------------------- hw/xfree86/os-support/solaris/sun_vid.c | 43 ------------------- hw/xfree86/os-support/sysv/sysv_video.c | 52 ----------------------- hw/xfree86/os-support/xf86_OSproc.h | 2 - 13 files changed, 292 deletions(-) diff --git a/hw/xfree86/common/xf86Helper.c b/hw/xfree86/common/xf86Helper.c index e0c941571..00df10574 100644 --- a/hw/xfree86/common/xf86Helper.c +++ b/hw/xfree86/common/xf86Helper.c @@ -1992,14 +1992,6 @@ xf86GetClocks(ScrnInfoPtr pScrn, int num, Bool (*ClockFunc)(ScrnInfoPtr, int), cnt = 0; sync = 200000; - /* XXX How critical is this? */ - if (!xf86DisableInterrupts()) - { - (*ClockFunc)(pScrn, CLK_REG_RESTORE); - ErrorF("Failed to disable interrupts during clock probe. If\n"); - ErrorF("your OS does not support disabling interrupts, then you\n"); - FatalError("must specify a Clocks line in the XF86Config file.\n"); - } while ((inb(status) & maskval) == 0x00) if (sync-- == 0) goto finish; /* Something appears to be happening, so reset sync count */ @@ -2020,8 +2012,6 @@ xf86GetClocks(ScrnInfoPtr pScrn, int num, Bool (*ClockFunc)(ScrnInfoPtr, int), } finish: - xf86EnableInterrupts(); - pScrn->clock[i] = cnt ? cnt : -1; if (BlankScreen) (*BlankScreen)(pScrn, TRUE); diff --git a/hw/xfree86/loader/xf86sym.c b/hw/xfree86/loader/xf86sym.c index 88b26aa26..708af85fc 100644 --- a/hw/xfree86/loader/xf86sym.c +++ b/hw/xfree86/loader/xf86sym.c @@ -244,8 +244,6 @@ _X_HIDDEN void *xfree86LookupTab[] = { SYMFUNC(xf86ReadBIOS) SYMFUNC(xf86EnableIO) SYMFUNC(xf86DisableIO) - SYMFUNC(xf86DisableInterrupts) - SYMFUNC(xf86EnableInterrupts) SYMFUNC(xf86LinearVidMem) SYMFUNC(xf86CheckMTRR) SYMFUNC(xf86MapVidMem) diff --git a/hw/xfree86/os-support/bsd/alpha_video.c b/hw/xfree86/os-support/bsd/alpha_video.c index 523c4488e..9de25f66b 100644 --- a/hw/xfree86/os-support/bsd/alpha_video.c +++ b/hw/xfree86/os-support/bsd/alpha_video.c @@ -433,24 +433,6 @@ xf86DisableIO() #endif /* USE_ALPHA_PIO */ -/***************************************************************************/ -/* Interrupt Handling section */ -/***************************************************************************/ - -_X_EXPORT Bool -xf86DisableInterrupts() -{ - - return(TRUE); -} - -_X_EXPORT void -xf86EnableInterrupts() -{ - return; -} - - #define vuip volatile unsigned int * static unsigned long msb_set = 0; diff --git a/hw/xfree86/os-support/bsd/arm_video.c b/hw/xfree86/os-support/bsd/arm_video.c index 23948b5d6..a0ebdf2e6 100644 --- a/hw/xfree86/os-support/bsd/arm_video.c +++ b/hw/xfree86/os-support/bsd/arm_video.c @@ -522,27 +522,6 @@ xf86DisableIO() #endif /* USE_ARC_MMAP */ - -/***************************************************************************/ -/* Interrupt Handling section */ -/***************************************************************************/ - -_X_EXPORT Bool -xf86DisableInterrupts() -{ - - return(TRUE); -} - -_X_EXPORT void -xf86EnableInterrupts() -{ - - return; -} - - - #if 0 /* * XXX This is here for reference. It needs to be handled differently for the diff --git a/hw/xfree86/os-support/bsd/i386_video.c b/hw/xfree86/os-support/bsd/i386_video.c index 9a28611ca..83dabc9c6 100644 --- a/hw/xfree86/os-support/bsd/i386_video.c +++ b/hw/xfree86/os-support/bsd/i386_video.c @@ -444,38 +444,6 @@ xf86DisableIO() #endif - -/***************************************************************************/ -/* Interrupt Handling section */ -/***************************************************************************/ - -_X_EXPORT Bool -xf86DisableInterrupts() -{ - -#ifdef __GNUC__ - __asm__ __volatile__("cli"); -#else - asm("cli"); -#endif /* __GNUC__ */ - - return(TRUE); -} - -_X_EXPORT void -xf86EnableInterrupts() -{ - -#ifdef __GNUC__ - __asm__ __volatile__("sti"); -#else - asm("sti"); -#endif /* __GNUC__ */ - - return; -} - - #ifdef __NetBSD__ /***************************************************************************/ /* Set TV output mode */ diff --git a/hw/xfree86/os-support/bsd/ppc_video.c b/hw/xfree86/os-support/bsd/ppc_video.c index 06be654e1..f1ff64c2a 100644 --- a/hw/xfree86/os-support/bsd/ppc_video.c +++ b/hw/xfree86/os-support/bsd/ppc_video.c @@ -123,24 +123,6 @@ xf86ReadBIOS(unsigned long Base, unsigned long Offset, unsigned char *Buf, return rv; } -/***************************************************************************/ -/* Interrupt Handling section */ -/***************************************************************************/ - -_X_EXPORT Bool -xf86DisableInterrupts() -{ - - return(TRUE); -} - -_X_EXPORT void -xf86EnableInterrupts() -{ - - return; -} - Bool xf86EnableIO() { int fd = xf86Info.screenFd; diff --git a/hw/xfree86/os-support/bsd/sparc64_video.c b/hw/xfree86/os-support/bsd/sparc64_video.c index fb5e8529b..fe3b5e7f2 100644 --- a/hw/xfree86/os-support/bsd/sparc64_video.c +++ b/hw/xfree86/os-support/bsd/sparc64_video.c @@ -89,21 +89,3 @@ xf86ReadBIOS(unsigned long Base, unsigned long Offset, unsigned char *Buf, return (0); } - -/***************************************************************************/ -/* Interrupt Handling section */ -/***************************************************************************/ - -_X_EXPORT Bool -xf86DisableInterrupts() -{ - - return(TRUE); -} - -_X_EXPORT void -xf86EnableInterrupts() -{ - - return; -} diff --git a/hw/xfree86/os-support/hurd/hurd_video.c b/hw/xfree86/os-support/hurd/hurd_video.c index 04763ada7..b814072cb 100644 --- a/hw/xfree86/os-support/hurd/hurd_video.c +++ b/hw/xfree86/os-support/hurd/hurd_video.c @@ -142,20 +142,6 @@ xf86DisableIO() return; } -/************************************************************************** - * Interrupt Handling section - **************************************************************************/ -Bool -xf86DisableInterrupts() -{ - return TRUE; -} -void -xf86EnableInterrupts() -{ - return; -} - void xf86MapReadSideEffects(int ScreenNum, int Flags, pointer Base, unsigned long Size) diff --git a/hw/xfree86/os-support/linux/lnx_video.c b/hw/xfree86/os-support/linux/lnx_video.c index aa62514df..688106af4 100644 --- a/hw/xfree86/os-support/linux/lnx_video.c +++ b/hw/xfree86/os-support/linux/lnx_video.c @@ -568,24 +568,6 @@ xf86DisableIO(void) return; } -/* - * Don't use these two functions. They can't possibly work. If you actually - * need interrupts off for something, you ought to be doing it in the kernel - * anyway. - */ - -_X_EXPORT Bool -xf86DisableInterrupts() -{ - return (TRUE); -} - -_X_EXPORT void -xf86EnableInterrupts() -{ - return; -} - #if defined (__alpha__) #define vuip volatile unsigned int * diff --git a/hw/xfree86/os-support/sco/sco_iop.c b/hw/xfree86/os-support/sco/sco_iop.c index bb8d06d2e..86210d71a 100644 --- a/hw/xfree86/os-support/sco/sco_iop.c +++ b/hw/xfree86/os-support/sco/sco_iop.c @@ -88,47 +88,3 @@ xf86DisableIO(void) sysi86(SI86V86, V86SC_IOPL, 0); IOEnabled = FALSE; } - -/***************************************************************************/ -/* Interrupt Handling section */ -/***************************************************************************/ - -_X_EXPORT Bool -xf86DisableInterrupts(void) -{ - if (!IOEnabled) { - if (sysi86(SI86V86, V86SC_IOPL, PS_IOPL) < 0) - return FALSE; - } - -#ifdef __GNUC__ - __asm__ __volatile__("cli"); -#else - asm("cli"); -#endif /* __GNUC__ */ - - if (!IOEnabled) { - sysi86(SI86V86, V86SC_IOPL, PS_IOPL); - } - - return(TRUE); -} - -_X_EXPORT void -xf86EnableInterrupts(void) -{ - if (!IOEnabled) { - if (sysi86(SI86V86, V86SC_IOPL, PS_IOPL) < 0) - return; - } - -#ifdef __GNUC__ - __asm__ __volatile__("sti"); -#else - asm("sti"); -#endif /* __GNUC__ */ - - if (!IOEnabled) { - sysi86(SI86V86, V86SC_IOPL, PS_IOPL); - } -} diff --git a/hw/xfree86/os-support/solaris/sun_vid.c b/hw/xfree86/os-support/solaris/sun_vid.c index 2b50dd619..3982f631f 100644 --- a/hw/xfree86/os-support/solaris/sun_vid.c +++ b/hw/xfree86/os-support/solaris/sun_vid.c @@ -263,46 +263,3 @@ xf86DisableIO(void) ExtendedEnabled = FALSE; #endif /* i386 */ } - - -/***************************************************************************/ -/* Interrupt Handling section */ -/***************************************************************************/ - -_X_EXPORT Bool -xf86DisableInterrupts(void) -{ -#if defined(__i386__) || defined(__i386) || defined(__x86) - if (!ExtendedEnabled && (sysi86(SI86V86, V86SC_IOPL, PS_IOPL) < 0)) - return FALSE; - -#ifdef __GNUC__ - __asm__ __volatile__("cli"); -#else - asm("cli"); -#endif /* __GNUC__ */ - - if (!ExtendedEnabled) - sysi86(SI86V86, V86SC_IOPL, 0); -#endif /* i386 */ - - return TRUE; -} - -_X_EXPORT void -xf86EnableInterrupts(void) -{ -#if defined(__i386__) || defined(__i386) || defined(__x86) - if (!ExtendedEnabled && (sysi86(SI86V86, V86SC_IOPL, PS_IOPL) < 0)) - return; - -#ifdef __GNUC__ - __asm__ __volatile__("sti"); -#else - asm("sti"); -#endif /* __GNUC__ */ - - if (!ExtendedEnabled) - sysi86(SI86V86, V86SC_IOPL, 0); -#endif /* i386 */ -} diff --git a/hw/xfree86/os-support/sysv/sysv_video.c b/hw/xfree86/os-support/sysv/sysv_video.c index 9972bcaa4..a9bbd6580 100644 --- a/hw/xfree86/os-support/sysv/sysv_video.c +++ b/hw/xfree86/os-support/sysv/sysv_video.c @@ -313,55 +313,3 @@ xf86DisableIO() return; } - -/***************************************************************************/ -/* Interrupt Handling section */ -/***************************************************************************/ - -_X_EXPORT Bool -xf86DisableInterrupts() -{ - if (!ExtendedEnabled) - { - if (SET_IOPL() < 0) - { - return(FALSE); - } - } - -#ifdef __GNUC__ - __asm__ __volatile__("cli"); -#else - asm("cli"); -#endif /* __GNUC__ */ - - if (!ExtendedEnabled) - { - RESET_IOPL(); - } - return(TRUE); -} - -_X_EXPORT void -xf86EnableInterrupts() -{ - if (!ExtendedEnabled) - { - if (SET_IOPL() < 0) - { - return; - } - } - -#ifdef __GNUC__ - __asm__ __volatile__("sti"); -#else - asm("sti"); -#endif /* __GNUC__ */ - - if (!ExtendedEnabled) - { - RESET_IOPL(); - } - return; -} diff --git a/hw/xfree86/os-support/xf86_OSproc.h b/hw/xfree86/os-support/xf86_OSproc.h index 74c2dc0f2..d44fceede 100644 --- a/hw/xfree86/os-support/xf86_OSproc.h +++ b/hw/xfree86/os-support/xf86_OSproc.h @@ -146,8 +146,6 @@ extern void xf86MapReadSideEffects(int, int, pointer, unsigned long); extern int xf86ReadBIOS(unsigned long, unsigned long, unsigned char *, int); extern Bool xf86EnableIO(void); extern void xf86DisableIO(void); -extern Bool xf86DisableInterrupts(void); -extern void xf86EnableInterrupts(void); extern void xf86SetTVOut(int); extern void xf86SetRGBOut(void); extern void xf86OSRingBell(int, int, int); From 208f091bfc657e9ee57b988f035d3aac7e9e173a Mon Sep 17 00:00:00 2001 From: Adam Jackson Date: Sun, 12 Oct 2008 00:07:56 -0400 Subject: [PATCH 32/62] Remove xf86IODelay --- hw/xfree86/loader/xf86sym.c | 1 - hw/xfree86/os-support/misc/IODelay.c | 24 ------------------------ hw/xfree86/os-support/misc/Makefile.am | 2 +- hw/xfree86/os-support/xf86_OSproc.h | 1 - 4 files changed, 1 insertion(+), 27 deletions(-) delete mode 100644 hw/xfree86/os-support/misc/IODelay.c diff --git a/hw/xfree86/loader/xf86sym.c b/hw/xfree86/loader/xf86sym.c index 708af85fc..87dcb928e 100644 --- a/hw/xfree86/loader/xf86sym.c +++ b/hw/xfree86/loader/xf86sym.c @@ -251,7 +251,6 @@ _X_HIDDEN void *xfree86LookupTab[] = { SYMFUNC(xf86MapReadSideEffects) SYMFUNC(xf86MapDomainMemory) SYMFUNC(xf86UDelay) - SYMFUNC(xf86IODelay) SYMFUNC(xf86SlowBcopy) SYMFUNC(xf86SetReallySlowBcopy) #ifdef __alpha__ diff --git a/hw/xfree86/os-support/misc/IODelay.c b/hw/xfree86/os-support/misc/IODelay.c deleted file mode 100644 index e4422f234..000000000 --- a/hw/xfree86/os-support/misc/IODelay.c +++ /dev/null @@ -1,24 +0,0 @@ -/******************************************************************************* - Stub for Alpha Linux -*******************************************************************************/ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include -#include "xf86.h" -#include "xf86Priv.h" -#include "xf86_OSlib.h" - -/* - * All we really need is a delay of about 40ns for I/O recovery for just - * about any occasion, but we'll be more conservative here: On a - * 100-MHz CPU, produce at least a delay of 1,000ns. - */ -_X_EXPORT void -xf86IODelay() -{ - xf86UDelay(1); -} - diff --git a/hw/xfree86/os-support/misc/Makefile.am b/hw/xfree86/os-support/misc/Makefile.am index 39066ecb0..3d4b8ff0e 100644 --- a/hw/xfree86/os-support/misc/Makefile.am +++ b/hw/xfree86/os-support/misc/Makefile.am @@ -1,7 +1,7 @@ noinst_LTLIBRARIES = libmisc.la -libmisc_la_SOURCES = Delay.c BUSmemcpy.c IODelay.c SlowBcopy.c +libmisc_la_SOURCES = Delay.c BUSmemcpy.c SlowBcopy.c #AM_LDFLAGS = -r diff --git a/hw/xfree86/os-support/xf86_OSproc.h b/hw/xfree86/os-support/xf86_OSproc.h index d44fceede..b4513d65f 100644 --- a/hw/xfree86/os-support/xf86_OSproc.h +++ b/hw/xfree86/os-support/xf86_OSproc.h @@ -151,7 +151,6 @@ extern void xf86SetRGBOut(void); extern void xf86OSRingBell(int, int, int); extern void xf86BusToMem(unsigned char *, unsigned char *, int); extern void xf86MemToBus(unsigned char *, unsigned char *, int); -extern void xf86IODelay(void); extern void xf86UDelay(long usec); extern void xf86SetReallySlowBcopy(void); extern void xf86SlowBcopy(unsigned char *, unsigned char *, int); From ab12c7516207908f3e063a78904d68e2db14208e Mon Sep 17 00:00:00 2001 From: Jeremy Huddleston Date: Sat, 22 Nov 2008 15:47:14 -0800 Subject: [PATCH 33/62] XQuartz: More Tiger cleanup: bootstrap_strerror (cherry picked from commit 37f535aff3e9a7a02711daa98152cdff97745622) --- hw/xquartz/mach-startup/bundle-main.c | 5 +++++ hw/xquartz/mach-startup/stub.c | 6 +++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/hw/xquartz/mach-startup/bundle-main.c b/hw/xquartz/mach-startup/bundle-main.c index a49013e0d..d9c895ec3 100644 --- a/hw/xquartz/mach-startup/bundle-main.c +++ b/hw/xquartz/mach-startup/bundle-main.c @@ -29,6 +29,7 @@ prior written authorization. */ #include +#include #include #include @@ -374,7 +375,11 @@ int startup_trigger(int argc, char **argv, char **envp) { kr = bootstrap_look_up(bootstrap_port, SERVER_BOOTSTRAP_NAME, &mp); if (kr != KERN_SUCCESS) { +#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050 fprintf(stderr, "bootstrap_look_up(): %s\n", bootstrap_strerror(kr)); +#else + fprintf(stderr, "bootstrap_look_up(): %ul\n", (unsigned long)kr); +#endif exit(EXIT_FAILURE); } diff --git a/hw/xquartz/mach-startup/stub.c b/hw/xquartz/mach-startup/stub.c index bc4f7eca0..aa0505a32 100644 --- a/hw/xquartz/mach-startup/stub.c +++ b/hw/xquartz/mach-startup/stub.c @@ -267,7 +267,11 @@ int main(int argc, char **argv, char **envp) { } if(kr != KERN_SUCCESS) { - fprintf(stderr, "Xquartz: bootstrap_look_up(): Timed out: %s\n", bootstrap_strerror(kr)); +#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050 + fprintf(stderr, "Xquartz: bootstrap_look_up(): %s\n", bootstrap_strerror(kr)); +#else + fprintf(stderr, "Xquartz: bootstrap_look_up(): %ul\n", (unsigned long)kr); +#endif return EXIT_FAILURE; } } From 09c3f6e04c273ffafcb547c252137fb17c8ce016 Mon Sep 17 00:00:00 2001 From: Jeremy Huddleston Date: Sat, 22 Nov 2008 20:23:46 -0800 Subject: [PATCH 34/62] XQuartz: Dead code removal (cherry picked from commit 46c077d9b4a883fc809c32077ce40f33a70d268b) --- hw/xquartz/quartz.h | 8 -------- hw/xquartz/xpr/xprScreen.c | 4 ---- 2 files changed, 12 deletions(-) diff --git a/hw/xquartz/quartz.h b/hw/xquartz/quartz.h index 8b04b798e..c5da4c510 100644 --- a/hw/xquartz/quartz.h +++ b/hw/xquartz/quartz.h @@ -54,20 +54,16 @@ typedef void (*InitInputProc)(int argc, char **argv); * Cursor functions */ typedef Bool (*InitCursorProc)(ScreenPtr pScreen); -typedef void (*CursorUpdateProc)(void); /* * Suspend and resume X11 activity */ typedef void (*SuspendScreenProc)(ScreenPtr pScreen); typedef void (*ResumeScreenProc)(ScreenPtr pScreen, int x, int y); -typedef void (*CaptureScreensProc)(void); -typedef void (*ReleaseScreensProc)(void); /* * Screen state change support */ -typedef void (*ScreenChangedProc)(void); typedef void (*AddPseudoramiXScreensProc)(int *x, int *y, int *width, int *height); typedef void (*UpdateScreenProc)(ScreenPtr pScreen); @@ -101,14 +97,10 @@ typedef struct _QuartzModeProcs { InitInputProc InitInput; InitCursorProc InitCursor; - CursorUpdateProc CursorUpdate; // Not used if NULL SuspendScreenProc SuspendScreen; ResumeScreenProc ResumeScreen; - CaptureScreensProc CaptureScreens; // Only called in fullscreen - ReleaseScreensProc ReleaseScreens; // Only called in fullscreen - ScreenChangedProc ScreenChanged; AddPseudoramiXScreensProc AddPseudoramiXScreens; UpdateScreenProc UpdateScreen; diff --git a/hw/xquartz/xpr/xprScreen.c b/hw/xquartz/xpr/xprScreen.c index a4ee30351..18406b89c 100644 --- a/hw/xquartz/xpr/xprScreen.c +++ b/hw/xquartz/xpr/xprScreen.c @@ -423,12 +423,8 @@ static QuartzModeProcsRec xprModeProcs = { xprSetupScreen, xprInitInput, QuartzInitCursor, - NULL, // No need to update cursor QuartzSuspendXCursor, QuartzResumeXCursor, - NULL, // No capture or release in rootless mode - NULL, - NULL, // Xplugin sends screen change events directly xprAddPseudoramiXScreens, xprUpdateScreen, xprIsX11Window, From 41fbdf72f2154a3fca8cf484a611501e3c174fbe Mon Sep 17 00:00:00 2001 From: Jeremy Huddleston Date: Mon, 24 Nov 2008 12:33:20 -0800 Subject: [PATCH 35/62] XQuartz: Disable some error spew on Tiger (where it wouldn't be an error) (cherry picked from commit 73ec6d3dfe0086d352f4eca25f1df5ae1884bb18) --- hw/xquartz/quartzKeyboard.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/hw/xquartz/quartzKeyboard.c b/hw/xquartz/quartzKeyboard.c index 8aaa57025..d8a429321 100644 --- a/hw/xquartz/quartzKeyboard.c +++ b/hw/xquartz/quartzKeyboard.c @@ -733,24 +733,29 @@ Bool QuartzReadSystemKeymap(darwinKeyboardInfo *info) { ErrorF("X11.app: Debug Info: keyboard_type=%u, currentKeyLayoutRef=%p, currentKeyLayoutDataRef=%p, chr_data=%p\n", (unsigned)keyboard_type, currentKeyLayoutRef, currentKeyLayoutDataRef, chr_data); #endif + KLGetCurrentKeyboardLayout (&key_layout); KLGetKeyboardLayoutProperty (key_layout, kKLuchrData, &chr_data); +#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050 if(chr_data != NULL) { ErrorF("X11.app: Fallback succeeded, but this is still a bug. Please report the above information.\n"); } +#endif } if (chr_data == NULL) { - ErrorF("X11.app: Debug Info: kKLuchrData fallback failed, trying kKLKCHRData.\n"); + ErrorF("X11.app: Debug Info: kKLuchrData failed, trying kKLKCHRData.\n"); ErrorF("If you are using a 3rd party keyboard layout, please see http://xquartz.macosforge.org/trac/ticket/154\n"); KLGetKeyboardLayoutProperty (key_layout, kKLKCHRData, &chr_data); is_uchr = 0; num_keycodes = 128; +#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050 if(chr_data != NULL) { ErrorF("X11.app: Fallback succeeded, but this is still a bug. Please report the above information.\n"); } +#endif } #endif From d508a3dcca2f160021aced872715e1ded23cef97 Mon Sep 17 00:00:00 2001 From: Jeremy Huddleston Date: Mon, 24 Nov 2008 23:33:54 -0800 Subject: [PATCH 36/62] XQuartz: More dead code removal (cherry picked from commit dcb0f6a2e62823a671051874d14a33ce59505892) --- hw/xquartz/quartzKeyboard.c | 137 ------------------------------------ 1 file changed, 137 deletions(-) diff --git a/hw/xquartz/quartzKeyboard.c b/hw/xquartz/quartzKeyboard.c index d8a429321..1ee2382aa 100644 --- a/hw/xquartz/quartzKeyboard.c +++ b/hw/xquartz/quartzKeyboard.c @@ -77,143 +77,6 @@ enum { #define UKEYSYM(u) ((u) | 0x01000000) -#define AltMask Mod1Mask -#define MetaMask Mod2Mask -#define FunctionMask Mod3Mask - -#define UK(a) NoSymbol // unknown symbol - -static KeySym const next_to_x[256] = { - NoSymbol, NoSymbol, NoSymbol, XK_KP_Enter, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - XK_BackSpace, XK_Tab, XK_Linefeed, NoSymbol, - NoSymbol, XK_Return, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, XK_Escape, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - XK_space, XK_exclam, XK_quotedbl, XK_numbersign, - XK_dollar, XK_percent, XK_ampersand, XK_apostrophe, - XK_parenleft, XK_parenright, XK_asterisk, XK_plus, - XK_comma, XK_minus, XK_period, XK_slash, - XK_0, XK_1, XK_2, XK_3, - XK_4, XK_5, XK_6, XK_7, - XK_8, XK_9, XK_colon, XK_semicolon, - XK_less, XK_equal, XK_greater, XK_question, - XK_at, XK_A, XK_B, XK_C, - XK_D, XK_E, XK_F, XK_G, - XK_H, XK_I, XK_J, XK_K, - XK_L, XK_M, XK_N, XK_O, - XK_P, XK_Q, XK_R, XK_S, - XK_T, XK_U, XK_V, XK_W, - XK_X, XK_Y, XK_Z, XK_bracketleft, - XK_backslash, XK_bracketright,XK_asciicircum, XK_underscore, - XK_grave, XK_a, XK_b, XK_c, - XK_d, XK_e, XK_f, XK_g, - XK_h, XK_i, XK_j, XK_k, - XK_l, XK_m, XK_n, XK_o, - XK_p, XK_q, XK_r, XK_s, - XK_t, XK_u, XK_v, XK_w, - XK_x, XK_y, XK_z, XK_braceleft, - XK_bar, XK_braceright, XK_asciitilde, XK_BackSpace, -// 128 - NoSymbol, XK_Agrave, XK_Aacute, XK_Acircumflex, - XK_Atilde, XK_Adiaeresis, XK_Aring, XK_Ccedilla, - XK_Egrave, XK_Eacute, XK_Ecircumflex, XK_Ediaeresis, - XK_Igrave, XK_Iacute, XK_Icircumflex, XK_Idiaeresis, -// 144 - XK_ETH, XK_Ntilde, XK_Ograve, XK_Oacute, - XK_Ocircumflex, XK_Otilde, XK_Odiaeresis, XK_Ugrave, - XK_Uacute, XK_Ucircumflex, XK_Udiaeresis, XK_Yacute, - XK_THORN, XK_mu, XK_multiply, XK_division, -// 160 - XK_copyright, XK_exclamdown, XK_cent, XK_sterling, - UK(fraction), XK_yen, UK(fhook), XK_section, - XK_currency, XK_rightsinglequotemark, - XK_leftdoublequotemark, - XK_guillemotleft, - XK_leftanglebracket, - XK_rightanglebracket, - UK(filigature), UK(flligature), -// 176 - XK_registered, XK_endash, XK_dagger, XK_doubledagger, - XK_periodcentered,XK_brokenbar, XK_paragraph, UK(bullet), - XK_singlelowquotemark, - XK_doublelowquotemark, - XK_rightdoublequotemark, - XK_guillemotright, - XK_ellipsis, UK(permille), XK_notsign, XK_questiondown, -// 192 - XK_onesuperior, XK_dead_grave, XK_dead_acute, XK_dead_circumflex, - XK_dead_tilde, XK_dead_macron, XK_dead_breve, XK_dead_abovedot, - XK_dead_diaeresis, - XK_twosuperior, XK_dead_abovering, - XK_dead_cedilla, - XK_threesuperior, - XK_dead_doubleacute, - XK_dead_ogonek, XK_dead_caron, -// 208 - XK_emdash, XK_plusminus, XK_onequarter, XK_onehalf, - XK_threequarters, - XK_agrave, XK_aacute, XK_acircumflex, - XK_atilde, XK_adiaeresis, XK_aring, XK_ccedilla, - XK_egrave, XK_eacute, XK_ecircumflex, XK_ediaeresis, -// 224 - XK_igrave, XK_AE, XK_iacute, XK_ordfeminine, - XK_icircumflex, XK_idiaeresis, XK_eth, XK_ntilde, - XK_Lstroke, XK_Ooblique, XK_OE, XK_masculine, - XK_ograve, XK_oacute, XK_ocircumflex, XK_otilde, -// 240 - XK_odiaeresis, XK_ae, XK_ugrave, XK_uacute, - XK_ucircumflex, XK_idotless, XK_udiaeresis, XK_ygrave, - XK_lstroke, XK_ooblique, XK_oe, XK_ssharp, - XK_thorn, XK_ydiaeresis, NoSymbol, NoSymbol, - }; - -#define MIN_SYMBOL 0xAC -static KeySym const symbol_to_x[] = { - XK_Left, XK_Up, XK_Right, XK_Down - }; -static int const NUM_SYMBOL = sizeof(symbol_to_x) / sizeof(symbol_to_x[0]); - -#define MIN_FUNCKEY 0x20 -static KeySym const funckey_to_x[] = { - XK_F1, XK_F2, XK_F3, XK_F4, - XK_F5, XK_F6, XK_F7, XK_F8, - XK_F9, XK_F10, XK_F11, XK_F12, - XK_Insert, XK_Delete, XK_Home, XK_End, - XK_Page_Up, XK_Page_Down, XK_F13, XK_F14, - XK_F15 - }; -static int const NUM_FUNCKEY = sizeof(funckey_to_x) / sizeof(funckey_to_x[0]); - -typedef struct { - KeySym normalSym; - KeySym keypadSym; -} darwinKeyPad_t; - -static darwinKeyPad_t const normal_to_keypad[] = { - { XK_0, XK_KP_0 }, - { XK_1, XK_KP_1 }, - { XK_2, XK_KP_2 }, - { XK_3, XK_KP_3 }, - { XK_4, XK_KP_4 }, - { XK_5, XK_KP_5 }, - { XK_6, XK_KP_6 }, - { XK_7, XK_KP_7 }, - { XK_8, XK_KP_8 }, - { XK_9, XK_KP_9 }, - { XK_equal, XK_KP_Equal }, - { XK_asterisk, XK_KP_Multiply }, - { XK_plus, XK_KP_Add }, - { XK_comma, XK_KP_Separator }, - { XK_minus, XK_KP_Subtract }, - { XK_period, XK_KP_Decimal }, - { XK_slash, XK_KP_Divide } -}; - -static int const NUM_KEYPAD = sizeof(normal_to_keypad) / sizeof(normal_to_keypad[0]); - /* Table of keycode->keysym mappings we use to fallback on for important keys that are often not in the Unicode mapping. */ From b55cad4569e34e3c10e9a327e20b91ea87d9dd98 Mon Sep 17 00:00:00 2001 From: Jeremy Huddleston Date: Tue, 25 Nov 2008 00:15:53 -0800 Subject: [PATCH 37/62] XQuartz: Don't hardcode values of org.x.X11 for the preferences domain (cherry picked from commit 3a500d9247cf34686ec17b4a88c34d51ecd38ecd) --- hw/xquartz/X11Application.h | 2 -- hw/xquartz/X11Application.m | 17 +++++++++++------ hw/xquartz/pbproxy/app-main.m | 24 ++++++++++++++++++++++++ hw/xquartz/pbproxy/x-selection.m | 7 ++++--- 4 files changed, 39 insertions(+), 11 deletions(-) diff --git a/hw/xquartz/X11Application.h b/hw/xquartz/X11Application.h index 91debd663..1cfbe0803 100644 --- a/hw/xquartz/X11Application.h +++ b/hw/xquartz/X11Application.h @@ -75,8 +75,6 @@ void X11ApplicationMain(int argc, char **argv, char **envp); extern int X11EnableKeyEquivalents; extern int quartzHasRoot, quartzEnableRootless, quartzFullscreenMenu; -#define APP_PREFS "org.x.X11" - #define PREFS_APPSMENU "apps_menu" #define PREFS_FAKEBUTTONS "enable_fake_buttons" #define PREFS_SYSBEEP "enable_system_beep" diff --git a/hw/xquartz/X11Application.m b/hw/xquartz/X11Application.m index 57f680965..44b8418f0 100644 --- a/hw/xquartz/X11Application.m +++ b/hw/xquartz/X11Application.m @@ -76,6 +76,8 @@ extern int darwinFakeButtons; X11Application *X11App; +CFStringRef app_prefs_domain_cfstr = NULL; + #define ALL_KEY_MASKS (NSShiftKeyMask | NSControlKeyMask | NSAlternateKeyMask | NSCommandKeyMask) @interface X11Application (Private) @@ -466,7 +468,7 @@ static NSMutableArray * cfarray_to_nsarray (CFArrayRef in) { - (CFPropertyListRef) prefs_get:(NSString *)key { CFPropertyListRef value; - value = CFPreferencesCopyAppValue ((CFStringRef) key, CFSTR (APP_PREFS)); + value = CFPreferencesCopyAppValue ((CFStringRef) key, app_prefs_domain_cfstr); if (value == NULL) { static CFDictionaryRef defaults; @@ -618,7 +620,7 @@ static NSMutableArray * cfarray_to_nsarray (CFArrayRef in) { x = CFNumberCreate (NULL, kCFNumberIntType, &value); - CFPreferencesSetValue ((CFStringRef) key, (CFTypeRef) x, CFSTR (APP_PREFS), + CFPreferencesSetValue ((CFStringRef) key, (CFTypeRef) x, app_prefs_domain_cfstr, kCFPreferencesCurrentUser, kCFPreferencesAnyHost); CFRelease (x); @@ -629,7 +631,7 @@ static NSMutableArray * cfarray_to_nsarray (CFArrayRef in) { x = CFNumberCreate (NULL, kCFNumberFloatType, &value); - CFPreferencesSetValue ((CFStringRef) key, (CFTypeRef) x, CFSTR (APP_PREFS), + CFPreferencesSetValue ((CFStringRef) key, (CFTypeRef) x, app_prefs_domain_cfstr, kCFPreferencesCurrentUser, kCFPreferencesAnyHost); CFRelease (x); @@ -638,7 +640,7 @@ static NSMutableArray * cfarray_to_nsarray (CFArrayRef in) { - (void) prefs_set_boolean:(NSString *)key value:(int)value { CFPreferencesSetValue ((CFStringRef) key, (CFTypeRef) (value ? kCFBooleanTrue - : kCFBooleanFalse), CFSTR (APP_PREFS), + : kCFBooleanFalse), app_prefs_domain_cfstr, kCFPreferencesCurrentUser, kCFPreferencesAnyHost); } @@ -649,14 +651,14 @@ static NSMutableArray * cfarray_to_nsarray (CFArrayRef in) { cfarray = nsarray_to_cfarray (value); CFPreferencesSetValue ((CFStringRef) key, (CFTypeRef) cfarray, - CFSTR (APP_PREFS), + app_prefs_domain_cfstr, kCFPreferencesCurrentUser, kCFPreferencesAnyHost); CFRelease (cfarray); } - (void) prefs_set_string:(NSString *)key value:(NSString *)value { CFPreferencesSetValue ((CFStringRef) key, (CFTypeRef) value, - CFSTR (APP_PREFS), kCFPreferencesCurrentUser, + app_prefs_domain_cfstr, kCFPreferencesCurrentUser, kCFPreferencesAnyHost); } @@ -857,6 +859,9 @@ void X11ApplicationMain (int argc, char **argv, char **envp) { pool = [[NSAutoreleasePool alloc] init]; X11App = (X11Application *) [X11Application sharedApplication]; init_ports (); + + app_prefs_domain_cfstr = (CFStringRef)[[NSBundle mainBundle] bundleIdentifier]; + [NSApp read_defaults]; [NSBundle loadNibNamed:@"main" owner:NSApp]; [[NSNotificationCenter defaultCenter] addObserver:NSApp diff --git a/hw/xquartz/pbproxy/app-main.m b/hw/xquartz/pbproxy/app-main.m index b5748dace..e4a4652fc 100644 --- a/hw/xquartz/pbproxy/app-main.m +++ b/hw/xquartz/pbproxy/app-main.m @@ -34,6 +34,9 @@ #include /*for getpid*/ #include +static const char *app_prefs_domain = "org.x.X11"; +CFStringRef app_prefs_domain_cfstr; + static void signal_handler (int sig) { switch(sig) { case SIGHUP: @@ -50,6 +53,27 @@ int main (int argc, const char *argv[]) { #endif xpbproxy_is_standalone = YES; + + if((s = getenv("X11_PREFS_DOMAIN"))) + app_prefs_domain = s; + + for (i = 1; i < argc; i++) { + if(strcmp (argv[i], "--prefs-domain") == 0 && i+1 < argc) { + app_prefs_domain = argv[++i]; + } else if (strcmp (argv[i], "--help") == 0) { + printf("usage: xpbproxy OPTIONS\n" + "Pasteboard proxying for X11.\n\n" + "--prefs-domain Change the domain used for reading preferences\n" + " (default: org.x.X11)\n"); + return 0; + } else { + fprintf(stderr, "usage: xpbproxy OPTIONS...\n" + "Try 'xpbproxy --help' for more information.\n"); + return 1; + } + } + + app_prefs_domain_cfstr = CFStringCreateWithCString(NULL, app_prefs_domain, kCFStringEncodingUTF8); if(!xpbproxy_init()) return EXIT_FAILURE; diff --git a/hw/xquartz/pbproxy/x-selection.m b/hw/xquartz/pbproxy/x-selection.m index 960499557..cd540be98 100644 --- a/hw/xquartz/pbproxy/x-selection.m +++ b/hw/xquartz/pbproxy/x-selection.m @@ -97,12 +97,13 @@ dump_prefs (FILE *fp) { } #endif -#define APP_PREFS "org.x.X11" +extern CFStringRef app_prefs_domain_cfstr; + static BOOL prefs_get_bool (CFStringRef key, BOOL defaultValue) { Boolean value, ok; - value = CFPreferencesGetAppBooleanValue (key, CFSTR (APP_PREFS), &ok); + value = CFPreferencesGetAppBooleanValue (key, app_prefs_domain_cfstr, &ok); return ok ? (BOOL) value : defaultValue; } @@ -1425,7 +1426,7 @@ get_property(Window win, Atom property, struct propdata *pdata, Bool delete, Ato * It's uncertain how we could handle the synchronization failing, so cast to void. * The prefs_get_bool should fall back to defaults if the org.x.X11 plist doesn't exist or is invalid. */ - (void)CFPreferencesAppSynchronize(CFSTR(APP_PREFS)); + (void)CFPreferencesAppSynchronize(app_prefs_domain_cfstr); #ifdef STANDALONE_XPBPROXY if(xpbproxy_is_standalone) pbproxy_prefs.active = YES; From 40187f782beae4ae751824ef511c9f56a80357c7 Mon Sep 17 00:00:00 2001 From: Jeremy Huddleston Date: Tue, 25 Nov 2008 00:20:57 -0800 Subject: [PATCH 38/62] XQuartz: Dead code removal (cherry picked from commit eeb323612e0adbea37befed31bbaa1d295728385) --- hw/xquartz/mach-startup/bundle-main.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/hw/xquartz/mach-startup/bundle-main.c b/hw/xquartz/mach-startup/bundle-main.c index d9c895ec3..058fe7865 100644 --- a/hw/xquartz/mach-startup/bundle-main.c +++ b/hw/xquartz/mach-startup/bundle-main.c @@ -75,9 +75,6 @@ char *__crashreporter_info__ = __crashreporter_info__buf; #define DEBUG 1 -static int execute(const char *command); -static char *command_from_prefs(const char *key, const char *default_value); - /* This is in quartzStartup.c */ int server_main(int argc, char **argv, char **envp); From 13df49dca28cf680a4d104630cd675de25d3e944 Mon Sep 17 00:00:00 2001 From: Jeremy Huddleston Date: Tue, 25 Nov 2008 00:39:52 -0800 Subject: [PATCH 39/62] XQuartz: Use the environment to pass the bundle's prefs domain on to xinit/quartz-wm for Tiger or no-launchd-LEOPARD (cherry picked from commit fbf4b0d33fa5dc618c3191a4e823232dfa33cd95) --- hw/xquartz/mach-startup/bundle-main.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/hw/xquartz/mach-startup/bundle-main.c b/hw/xquartz/mach-startup/bundle-main.c index 058fe7865..fa19eab9a 100644 --- a/hw/xquartz/mach-startup/bundle-main.c +++ b/hw/xquartz/mach-startup/bundle-main.c @@ -426,6 +426,17 @@ int main(int argc, char **argv, char **envp) { /* Setup the initial crasherporter info */ strlcpy(__crashreporter_info__, __crashreporter_info__base, __crashreporter_info__len); + /* Pass on our prefs domain to startx and its inheritors (mainly for quartz-wm) */ + CFBundleRef bundle = CFBundleGetMainBundle(); + if(bundle) { + CFStringRef pd = CFBundleGetIdentifier(bundle); + if(pd) { + const char *pds = CFStringGetCStringPtr(pd, 0); + if(pds) + setenv("X11_PREFS_DOMAIN", pds, 1); + } + } + fprintf(stderr, "X11.app: main(): argc=%d\n", argc); for(i=0; i < argc; i++) { fprintf(stderr, "\targv[%u] = %s\n", (unsigned)i, argv[i]); From 065d2afb0ca34f89806e0936c51cd27805bc5123 Mon Sep 17 00:00:00 2001 From: Jeremy Huddleston Date: Tue, 25 Nov 2008 00:51:01 -0800 Subject: [PATCH 40/62] XQuartz: Add fallback for xpbproxy's display for Tiger or no-launchd-Leopard (cherry picked from commit 7a8c6665949d7804a97ef2539a74ec4aa682e1cc) --- hw/xquartz/pbproxy/app-main.m | 2 ++ hw/xquartz/pbproxy/main.m | 23 ++++++++++++++++++++--- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/hw/xquartz/pbproxy/app-main.m b/hw/xquartz/pbproxy/app-main.m index e4a4652fc..cb0fa5744 100644 --- a/hw/xquartz/pbproxy/app-main.m +++ b/hw/xquartz/pbproxy/app-main.m @@ -37,6 +37,8 @@ static const char *app_prefs_domain = "org.x.X11"; CFStringRef app_prefs_domain_cfstr; +char *display = NULL; + static void signal_handler (int sig) { switch(sig) { case SIGHUP: diff --git a/hw/xquartz/pbproxy/main.m b/hw/xquartz/pbproxy/main.m index efa42e3a3..17720abeb 100644 --- a/hw/xquartz/pbproxy/main.m +++ b/hw/xquartz/pbproxy/main.m @@ -31,6 +31,7 @@ #import "x-selection.h" #include +#include #include Display *xpbproxy_dpy; @@ -38,6 +39,8 @@ int xpbproxy_apple_wm_event_base, xpbproxy_apple_wm_error_base; int xpbproxy_xfixes_event_base, xpbproxy_xfixes_error_base; BOOL xpbproxy_have_xfixes; +extern char *display; + #ifdef STANDALONE_XPBPROXY BOOL xpbproxy_is_standalone = NO; #endif @@ -67,10 +70,24 @@ static int x_error_handler (Display *dpy, XErrorEvent *errevent) { BOOL xpbproxy_init (void) { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; + size_t i; - xpbproxy_dpy = XOpenDisplay (NULL); + for(i=0, xpbproxy_dpy=NULL; !xpbproxy_dpy && i<5; i++) { + xpbproxy_dpy = XOpenDisplay(NULL); + + if(!xpbproxy_dpy && display) { + char *_display = alloca(sizeof(char) * (strlen(display) + 2)); + strcpy(_display+1, display); + *_display=':'; + + xpbproxy_dpy=XOpenDisplay(_display); + } + if(!xpbproxy_dpy) + sleep(1); + } + if (xpbproxy_dpy == NULL) { - fprintf (stderr, "can't open default display\n"); + fprintf (stderr, "xpbproxy: can't open default display\n"); [pool release]; return FALSE; } @@ -80,7 +97,7 @@ BOOL xpbproxy_init (void) { if (!XAppleWMQueryExtension (xpbproxy_dpy, &xpbproxy_apple_wm_event_base, &xpbproxy_apple_wm_error_base)) { - fprintf (stderr, "can't open AppleWM server extension\n"); + fprintf (stderr, "xpbproxy: can't open AppleWM server extension\n"); [pool release]; return FALSE; } From 0b314c50a2a0ca1afbdc06663c3b719b05ebb851 Mon Sep 17 00:00:00 2001 From: Jeremy Huddleston Date: Tue, 25 Nov 2008 01:13:35 -0800 Subject: [PATCH 41/62] XQuartz: Removed hardcoded org.x.X11 from MachIPC as well (cherry picked from commit b4add7826d485600a13eba6a9c7be533f2c02d51) --- hw/xquartz/mach-startup/bundle-main.c | 17 ++++++++++++----- hw/xquartz/mach-startup/mach_startup_types.h | 1 - hw/xquartz/mach-startup/stub.c | 13 +++++++++++-- 3 files changed, 23 insertions(+), 8 deletions(-) diff --git a/hw/xquartz/mach-startup/bundle-main.c b/hw/xquartz/mach-startup/bundle-main.c index fa19eab9a..c1138be99 100644 --- a/hw/xquartz/mach-startup/bundle-main.c +++ b/hw/xquartz/mach-startup/bundle-main.c @@ -73,6 +73,8 @@ const char *__crashreporter_info__base = "X.Org X Server " XSERVER_VERSION " Bui char __crashreporter_info__buf[4096]; char *__crashreporter_info__ = __crashreporter_info__buf; +static char *server_bootstrap_name = "org.x.X11"; + #define DEBUG 1 /* This is in quartzStartup.c */ @@ -370,7 +372,7 @@ int startup_trigger(int argc, char **argv, char **envp) { strlcpy(newenvp[i], envp[i], STRING_T_SIZE); } - kr = bootstrap_look_up(bootstrap_port, SERVER_BOOTSTRAP_NAME, &mp); + kr = bootstrap_look_up(bootstrap_port, server_bootstrap_name, &mp); if (kr != KERN_SUCCESS) { #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050 fprintf(stderr, "bootstrap_look_up(): %s\n", bootstrap_strerror(kr)); @@ -426,14 +428,19 @@ int main(int argc, char **argv, char **envp) { /* Setup the initial crasherporter info */ strlcpy(__crashreporter_info__, __crashreporter_info__base, __crashreporter_info__len); - /* Pass on our prefs domain to startx and its inheritors (mainly for quartz-wm) */ + /* Pass on our prefs domain to startx and its inheritors (mainly for + * quartz-wm and the Xquartz stub's MachIPC) + */ CFBundleRef bundle = CFBundleGetMainBundle(); if(bundle) { CFStringRef pd = CFBundleGetIdentifier(bundle); if(pd) { const char *pds = CFStringGetCStringPtr(pd, 0); - if(pds) + if(pds) { + server_bootstrap_name = malloc(sizeof(char) * (strlen(pds) + 1)); + strcpy(server_bootstrap_name, pds); setenv("X11_PREFS_DOMAIN", pds, 1); + } } } @@ -445,9 +452,9 @@ int main(int argc, char **argv, char **envp) { } } - mp = checkin_or_register(SERVER_BOOTSTRAP_NAME); + mp = checkin_or_register(server_bootstrap_name); if(mp == MACH_PORT_NULL) { - fprintf(stderr, "NULL mach service: %s", SERVER_BOOTSTRAP_NAME); + fprintf(stderr, "NULL mach service: %s", server_bootstrap_name); return EXIT_FAILURE; } diff --git a/hw/xquartz/mach-startup/mach_startup_types.h b/hw/xquartz/mach-startup/mach_startup_types.h index 97ac147cd..459c750db 100644 --- a/hw/xquartz/mach-startup/mach_startup_types.h +++ b/hw/xquartz/mach-startup/mach_startup_types.h @@ -1,7 +1,6 @@ #ifndef _MACH_STARTUP_TYPES_H_ #define _MACH_STARTUP_TYPES_H_ -#define SERVER_BOOTSTRAP_NAME "org.x.X11" #define STRING_T_SIZE 1024 typedef char string_t[STRING_T_SIZE]; diff --git a/hw/xquartz/mach-startup/stub.c b/hw/xquartz/mach-startup/stub.c index aa0505a32..893d19c8d 100644 --- a/hw/xquartz/mach-startup/stub.c +++ b/hw/xquartz/mach-startup/stub.c @@ -40,6 +40,12 @@ #include #include +static char *server_bootstrap_name = "org.x.X11"; + +/* The launchd startup is only designed for the primary X11.app that is + * org.x.X11... server_bootstrap_name might be differnet if we were triggered to + * start by another X11.app. + */ #define kX11AppBundleId "org.x.X11" #define kX11AppBundlePath "/Contents/MacOS/X11" @@ -222,6 +228,9 @@ int main(int argc, char **argv, char **envp) { return EXIT_SUCCESS; } + if(getenv("X11_PREFS_DOMAIN")) + server_bootstrap_name = getenv("X11_PREFS_DOMAIN"); + /* We don't have a mechanism in place to handle this interrupt driven * server-start notification, so just send the signal now, so xinit doesn't * time out waiting for it and will just poll for the server. @@ -238,7 +247,7 @@ int main(int argc, char **argv, char **envp) { /* Get the $DISPLAY FD */ launchd_fd = launchd_display_fd(); - kr = bootstrap_look_up(bootstrap_port, SERVER_BOOTSTRAP_NAME, &mp); + kr = bootstrap_look_up(bootstrap_port, server_bootstrap_name, &mp); if(kr != KERN_SUCCESS) { set_x11_path(); @@ -261,7 +270,7 @@ int main(int argc, char **argv, char **envp) { /* Try connecting for 10 seconds */ for(i=0; i < 80; i++) { usleep(250000); - kr = bootstrap_look_up(bootstrap_port, SERVER_BOOTSTRAP_NAME, &mp); + kr = bootstrap_look_up(bootstrap_port, server_bootstrap_name, &mp); if(kr == KERN_SUCCESS) break; } From 94df1ab7f09a64f57c1e1453e3640462e984619c Mon Sep 17 00:00:00 2001 From: Jeremy Huddleston Date: Tue, 25 Nov 2008 01:30:03 -0800 Subject: [PATCH 42/62] XQuartz: Force X11Controller to reset a broken DISPLAY envvar. (cherry picked from commit f1a52b5b5ac31702497937efe3ac578be9a6c54f) --- hw/xquartz/X11Controller.m | 12 ++++++++++++ hw/xquartz/mach-startup/bundle-main.c | 5 +++++ hw/xquartz/pbproxy/main.m | 6 +++--- 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/hw/xquartz/X11Controller.m b/hw/xquartz/X11Controller.m index 76fbb573a..ae9429c3e 100644 --- a/hw/xquartz/X11Controller.m +++ b/hw/xquartz/X11Controller.m @@ -55,6 +55,8 @@ #include #include +BOOL xquartz_resetenv_display = NO; + @implementation X11Controller - (void) awakeFromNib @@ -319,6 +321,16 @@ int child1, child2 = 0; int status; + if(xquartz_resetenv_display) { + char _display[32]; + size_t i; + for(i=0; !display && i < 5; i++) + sleep(1); + + snprintf(_display, sizeof(_display), ":%s", display); + setenv("DISPLAY", _display, TRUE); + } + argv[0] = "/usr/bin/login"; argv[1] = "-fp"; argv[2] = getlogin(); diff --git a/hw/xquartz/mach-startup/bundle-main.c b/hw/xquartz/mach-startup/bundle-main.c index c1138be99..e58277a9e 100644 --- a/hw/xquartz/mach-startup/bundle-main.c +++ b/hw/xquartz/mach-startup/bundle-main.c @@ -57,6 +57,8 @@ void DarwinListenOnOpenFD(int fd); extern int noPanoramiXExtension; +extern int xquartz_resetenv_display; + #define DEFAULT_CLIENT "/usr/X11/bin/xterm" #define DEFAULT_STARTX "/usr/X11/bin/startx" #define DEFAULT_SHELL "/bin/sh" @@ -408,6 +410,9 @@ int startup_trigger(int argc, char **argv, char **envp) { if((s = getenv("DISPLAY"))) { fprintf(stderr, "X11.app: Could not connect to server (DISPLAY=\"%s\", unsetting). Starting X server.\n", s); unsetenv("DISPLAY"); + + /* This tells X11Controller to not use the environment's DISPLAY and reset it based on the server's display */ + xquartz_resetenv_display = 1; } else { fprintf(stderr, "X11.app: Could not connect to server (DISPLAY is not set). Starting X server.\n"); } diff --git a/hw/xquartz/pbproxy/main.m b/hw/xquartz/pbproxy/main.m index 17720abeb..247ff7475 100644 --- a/hw/xquartz/pbproxy/main.m +++ b/hw/xquartz/pbproxy/main.m @@ -76,9 +76,9 @@ BOOL xpbproxy_init (void) { xpbproxy_dpy = XOpenDisplay(NULL); if(!xpbproxy_dpy && display) { - char *_display = alloca(sizeof(char) * (strlen(display) + 2)); - strcpy(_display+1, display); - *_display=':'; + char _display[32]; + snprintf(_display, sizeof(_display), ":%s", display); + setenv("DISPLAY", _display, TRUE); xpbproxy_dpy=XOpenDisplay(_display); } From eb474adf98229a43bbe17ab98ff084371cb9fa09 Mon Sep 17 00:00:00 2001 From: Jeremy Huddleston Date: Tue, 25 Nov 2008 11:25:58 -0800 Subject: [PATCH 43/62] XQuartz: Simplify the xquartz_resetenv_display path (cherry picked from commit d2e0624dd30eb234bb25595ceedfa51d48ca1724) --- hw/xquartz/X11Controller.m | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/hw/xquartz/X11Controller.m b/hw/xquartz/X11Controller.m index ae9429c3e..233fd4f1d 100644 --- a/hw/xquartz/X11Controller.m +++ b/hw/xquartz/X11Controller.m @@ -321,16 +321,6 @@ BOOL xquartz_resetenv_display = NO; int child1, child2 = 0; int status; - if(xquartz_resetenv_display) { - char _display[32]; - size_t i; - for(i=0; !display && i < 5; i++) - sleep(1); - - snprintf(_display, sizeof(_display), ":%s", display); - setenv("DISPLAY", _display, TRUE); - } - argv[0] = "/usr/bin/login"; argv[1] = "-fp"; argv[2] = getlogin(); @@ -368,7 +358,7 @@ BOOL xquartz_resetenv_display = NO; /* Setup environment */ temp = getenv("DISPLAY"); - if (temp == NULL || temp[0] == 0) { + if (xquartz_resetenv_display || temp == NULL || temp[0] == 0) { snprintf(buf, sizeof(buf), ":%s", display); setenv("DISPLAY", buf, TRUE); } From cbaca6ec666d7349c4680b8affc13b5c9cae1fa5 Mon Sep 17 00:00:00 2001 From: Adam Jackson Date: Tue, 25 Nov 2008 00:14:24 -0500 Subject: [PATCH 44/62] Remove dead FreeModuleDesc. --- hw/xfree86/loader/loadmod.c | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/hw/xfree86/loader/loadmod.c b/hw/xfree86/loader/loadmod.c index 70c54a76a..e98f013c4 100644 --- a/hw/xfree86/loader/loadmod.c +++ b/hw/xfree86/loader/loadmod.c @@ -1133,24 +1133,6 @@ UnloadSubModule(ModuleDescPtr mod) xfree(mod); } -static void -FreeModuleDesc(ModuleDescPtr head) -{ - ModuleDescPtr sibs, prev; - - if (head == (ModuleDescPtr) 1) - return; - if (head->child) - FreeModuleDesc(head->child); - sibs = head; - while (sibs) { - prev = sibs; - sibs = sibs->sib; - TestFree(prev->name); - xfree(prev); - } -} - static void RemoveChild(ModuleDescPtr child) { From fbabb1c5c243cfd8c954dec4c060dff1a0b81015 Mon Sep 17 00:00:00 2001 From: Adam Jackson Date: Tue, 25 Nov 2008 00:34:28 -0500 Subject: [PATCH 45/62] Warning fix. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In file included from l3-xaaStipple.c:4: ./xaaStipple.c:35: warning: no previous prototype for ‘XAAGetStippleScanlineFunc3LSBFirst’ etc --- hw/xfree86/xaa/xaalocal.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/hw/xfree86/xaa/xaalocal.h b/hw/xfree86/xaa/xaalocal.h index e25b9df52..69a59050c 100644 --- a/hw/xfree86/xaa/xaalocal.h +++ b/hw/xfree86/xaa/xaalocal.h @@ -1051,6 +1051,10 @@ StippleScanlineProcPtr *XAAGetStippleScanlineFuncMSBFirstFixedBase(void); StippleScanlineProcPtr *XAAGetStippleScanlineFuncMSBFirst(void); StippleScanlineProcPtr *XAAGetStippleScanlineFuncLSBFirstFixedBase(void); StippleScanlineProcPtr *XAAGetStippleScanlineFuncLSBFirst(void); +StippleScanlineProcPtr *XAAGetStippleScanlineFunc3MSBFirstFixedBase(void); +StippleScanlineProcPtr *XAAGetStippleScanlineFunc3MSBFirst(void); +StippleScanlineProcPtr *XAAGetStippleScanlineFunc3LSBFirstFixedBase(void); +StippleScanlineProcPtr *XAAGetStippleScanlineFunc3LSBFirst(void); int XAAPolyText8TEColorExpansion( From 8b9253f6383df3fefe38bde43a5f892b158a77c4 Mon Sep 17 00:00:00 2001 From: Adam Jackson Date: Tue, 25 Nov 2008 00:38:47 -0500 Subject: [PATCH 46/62] Code motion: subsume xf86DoProbe.c into xf86Init.c --- hw/xfree86/common/Makefile.am | 3 +- hw/xfree86/common/xf86DoProbe.c | 116 -------------------------------- hw/xfree86/common/xf86Init.c | 69 +++++++++++++++++++ hw/xfree86/common/xf86Priv.h | 5 +- 4 files changed, 73 insertions(+), 120 deletions(-) delete mode 100644 hw/xfree86/common/xf86DoProbe.c diff --git a/hw/xfree86/common/Makefile.am b/hw/xfree86/common/Makefile.am index d3202bcfc..77ab4c386 100644 --- a/hw/xfree86/common/Makefile.am +++ b/hw/xfree86/common/Makefile.am @@ -27,8 +27,7 @@ BUILT_SOURCES = xf86DefModeSet.c AM_LDFLAGS = -r libcommon_la_SOURCES = xf86Configure.c xf86ShowOpts.c xf86Bus.c xf86Config.c \ xf86Cursor.c xf86DGA.c xf86DPMS.c \ - xf86DoProbe.c xf86Events.c \ - xf86Globals.c xf86AutoConfig.c \ + xf86Events.c xf86Globals.c xf86AutoConfig.c \ xf86Option.c \ xf86VidMode.c xf86fbman.c xf86cmap.c \ xf86Helper.c xf86PM.c xf86RAC.c xf86Xinput.c xisb.c \ diff --git a/hw/xfree86/common/xf86DoProbe.c b/hw/xfree86/common/xf86DoProbe.c deleted file mode 100644 index bba6ab7e8..000000000 --- a/hw/xfree86/common/xf86DoProbe.c +++ /dev/null @@ -1,116 +0,0 @@ -/* - * Copyright (c) 1999-2002 by The XFree86 Project, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name of the copyright holder(s) - * and author(s) shall not be used in advertising or otherwise to promote - * the sale, use or other dealings in this Software without prior written - * authorization from the copyright holder(s) and author(s). - */ - -/* - * finish setting up the server - * Load the driver modules and call their probe functions. - */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include -#include -#include -#include -#include "os.h" -#include "loaderProcs.h" -#include "xf86Config.h" -#include "xf86_OSlib.h" -#include "xf86.h" -#include "xf86Priv.h" - -void -DoProbe() -{ - int i; - Bool probeResult; - Bool ioEnableFailed = FALSE; - - /* Find the list of video driver modules. */ - char **list = xf86DriverlistFromCompile(); - char **l; - - if (list) { - ErrorF("List of video driver modules:\n"); - for (l = list; *l; l++) - ErrorF("\t%s\n", *l); - } else { - ErrorF("No video driver modules found\n"); - } - - /* Load all the drivers that were found. */ - xf86LoadModules(list, NULL); - - /* Disable PCI devices */ - xf86AccessInit(); - - /* Call all of the probe functions, reporting the results. */ - for (i = 0; i < xf86NumDrivers; i++) { - DriverRec * const drv = xf86DriverList[i]; - - if (!xorgHWAccess) { - xorgHWFlags flags; - if (!drv->driverFunc - || !drv->driverFunc( NULL, GET_REQUIRED_HW_INTERFACES, &flags ) - || NEED_IO_ENABLED(flags)) { - if (ioEnableFailed) - continue; - if (!xf86EnableIO()) { - ioEnableFailed = TRUE; - continue; - } - xorgHWAccess = TRUE; - } - } - - - xf86MsgVerb(X_INFO, 3, "Probing in driver %s\n", drv->driverName); - - probeResult = xf86CallDriverProbe( drv, TRUE ); - if (!probeResult) { - xf86ErrorF("Probe in driver `%s' returns FALSE\n", - drv->driverName); - } else { - xf86ErrorF("Probe in driver `%s' returns TRUE\n", - drv->driverName); - - /* If we have a result, then call driver's Identify function */ - if (drv->Identify != NULL) { - const int verbose = xf86SetVerbosity(1); - (*drv->Identify)(0); - xf86SetVerbosity(verbose); - } - } - } - - OsCleanup(TRUE); - AbortDDX(); - fflush(stderr); - exit(0); -} diff --git a/hw/xfree86/common/xf86Init.c b/hw/xfree86/common/xf86Init.c index a052247c8..922e7b35d 100644 --- a/hw/xfree86/common/xf86Init.c +++ b/hw/xfree86/common/xf86Init.c @@ -643,6 +643,75 @@ xf86CallDriverProbe( DriverPtr drv, Bool detect_only ) return foundScreen; } +static void +DoProbe(void) +{ + int i; + Bool probeResult; + Bool ioEnableFailed = FALSE; + + /* Find the list of video driver modules. */ + char **list = xf86DriverlistFromCompile(); + char **l; + + if (list) { + ErrorF("List of video driver modules:\n"); + for (l = list; *l; l++) + ErrorF("\t%s\n", *l); + } else { + ErrorF("No video driver modules found\n"); + } + + /* Load all the drivers that were found. */ + xf86LoadModules(list, NULL); + + /* Disable PCI devices */ + xf86AccessInit(); + + /* Call all of the probe functions, reporting the results. */ + for (i = 0; i < xf86NumDrivers; i++) { + DriverRec * const drv = xf86DriverList[i]; + + if (!xorgHWAccess) { + xorgHWFlags flags; + if (!drv->driverFunc + || !drv->driverFunc( NULL, GET_REQUIRED_HW_INTERFACES, &flags ) + || NEED_IO_ENABLED(flags)) { + if (ioEnableFailed) + continue; + if (!xf86EnableIO()) { + ioEnableFailed = TRUE; + continue; + } + xorgHWAccess = TRUE; + } + } + + + xf86MsgVerb(X_INFO, 3, "Probing in driver %s\n", drv->driverName); + + probeResult = xf86CallDriverProbe( drv, TRUE ); + if (!probeResult) { + xf86ErrorF("Probe in driver `%s' returns FALSE\n", + drv->driverName); + } else { + xf86ErrorF("Probe in driver `%s' returns TRUE\n", + drv->driverName); + + /* If we have a result, then call driver's Identify function */ + if (drv->Identify != NULL) { + const int verbose = xf86SetVerbosity(1); + (*drv->Identify)(0); + xf86SetVerbosity(verbose); + } + } + } + + OsCleanup(TRUE); + AbortDDX(); + fflush(stderr); + exit(0); +} /* * InitOutput -- diff --git a/hw/xfree86/common/xf86Priv.h b/hw/xfree86/common/xf86Priv.h index f3dfd70d8..5de48ac77 100644 --- a/hw/xfree86/common/xf86Priv.h +++ b/hw/xfree86/common/xf86Priv.h @@ -150,9 +150,10 @@ Bool xf86PathIsSafe(const char *path); extern const DisplayModeRec xf86DefaultModes[]; extern const int xf86NumDefaultModes; -/* xf86DoProbe.c */ -void DoProbe(void); +/* xf86Configure.c */ void DoConfigure(void); + +/* xf86ShowOpts.c */ void DoShowOptions(void); /* xf86Events.c */ From 09bfb25e031772611a2f0902d4ba77b587e4bdb2 Mon Sep 17 00:00:00 2001 From: Adam Jackson Date: Tue, 25 Nov 2008 00:43:36 -0500 Subject: [PATCH 47/62] Remove unused XAAAvailableOptions --- hw/xfree86/xaa/xaaInitAccel.c | 9 --------- 1 file changed, 9 deletions(-) diff --git a/hw/xfree86/xaa/xaaInitAccel.c b/hw/xfree86/xaa/xaaInitAccel.c index 0672bcf5b..40871424a 100644 --- a/hw/xfree86/xaa/xaaInitAccel.c +++ b/hw/xfree86/xaa/xaaInitAccel.c @@ -16,8 +16,6 @@ #include "xf86fbman.h" #include "servermd.h" -static const OptionInfoRec *XAAAvailableOptions(void *unused); - /* * XAA Config options */ @@ -111,13 +109,6 @@ static XF86ModuleVersionInfo xaaVersRec = _X_EXPORT XF86ModuleData xaaModuleData = { &xaaVersRec, NULL, NULL }; -/*ARGSUSED*/ -static const OptionInfoRec * -XAAAvailableOptions(void *unused) -{ - return (XAAOptions); -} - Bool XAAInitAccel(ScreenPtr pScreen, XAAInfoRecPtr infoRec) { From 81eafe9f93a272b06aa9f9235ec5676b9aa3ee3e Mon Sep 17 00:00:00 2001 From: Adam Jackson Date: Tue, 25 Nov 2008 00:45:07 -0500 Subject: [PATCH 48/62] Warning fix. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit vbe.c: In function ‘VBEReadPanelID’: vbe.c:1145: warning: return from incompatible pointer type --- hw/xfree86/vbe/vbe.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hw/xfree86/vbe/vbe.c b/hw/xfree86/vbe/vbe.c index 8af1727cc..4986b5b29 100644 --- a/hw/xfree86/vbe/vbe.c +++ b/hw/xfree86/vbe/vbe.c @@ -1108,7 +1108,7 @@ VBEReadPanelID(vbeInfoPtr pVbe) { int RealOff = pVbe->real_mode_base; pointer page = pVbe->memory; - unsigned char *tmp = NULL; + void *tmp = NULL; int screen = pVbe->pInt10->scrnIndex; pVbe->pInt10->ax = 0x4F11; @@ -1129,8 +1129,8 @@ VBEReadPanelID(vbeInfoPtr pVbe) switch (pVbe->pInt10->ax & 0xff00) { case 0x0: xf86DrvMsgVerb(screen,X_INFO,3,"VESA VBE PanelID read successfully\n"); - tmp = (unsigned char *)xnfalloc(32); - memcpy(tmp,page,32); + tmp = xnfalloc(32); + memcpy(tmp, page, 32); break; case 0x100: xf86DrvMsgVerb(screen,X_INFO,3,"VESA VBE PanelID read failed\n"); From a9853c7d337b3b1ad49793e9b4b90e313b6fa536 Mon Sep 17 00:00:00 2001 From: Adam Jackson Date: Tue, 25 Nov 2008 00:53:55 -0500 Subject: [PATCH 49/62] Warning fix MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Pixmap.c: In function ‘xnestPixmapToRegion’: Pixmap.c:93: warning: ‘Box.x1’ may be used uninitialized in this function --- hw/xnest/Pixmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/xnest/Pixmap.c b/hw/xnest/Pixmap.c index 08305b10b..676a2ba95 100644 --- a/hw/xnest/Pixmap.c +++ b/hw/xnest/Pixmap.c @@ -90,7 +90,7 @@ xnestPixmapToRegion(PixmapPtr pPixmap) register RegionPtr pReg, pTmpReg; register int x, y; unsigned long previousPixel, currentPixel; - BoxRec Box; + BoxRec Box = { 0, 0, 0, 0 }; Bool overlap; ximage = XGetImage(xnestDisplay, xnestPixmap(pPixmap), 0, 0, From 09ea671cbff605fd2b2af71619e7db5002108bf8 Mon Sep 17 00:00:00 2001 From: Adam Jackson Date: Tue, 25 Nov 2008 13:40:47 -0500 Subject: [PATCH 50/62] Warning fix MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit lnx_bell.c:37: warning: no previous prototype for ‘xf86OSRingBell’ --- hw/xfree86/os-support/linux/lnx_bell.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/xfree86/os-support/linux/lnx_bell.c b/hw/xfree86/os-support/linux/lnx_bell.c index 93ad680d7..702dfa675 100644 --- a/hw/xfree86/os-support/linux/lnx_bell.c +++ b/hw/xfree86/os-support/linux/lnx_bell.c @@ -32,6 +32,7 @@ #include "xf86.h" #include "xf86Priv.h" +#include "xf86_OSproc.h" _X_EXPORT void xf86OSRingBell(int loudness, int pitch, int duration) From d96bffce2dcf209e76be9b36ca1ede7e0c976d77 Mon Sep 17 00:00:00 2001 From: Adam Jackson Date: Tue, 25 Nov 2008 13:59:00 -0500 Subject: [PATCH 51/62] Warning fix MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Init.c:139: warning: no previous prototype for ‘ddxBeforeReset’ Just declare the prototype always, seriously. --- include/dix.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/include/dix.h b/include/dix.h index 76ddbb52b..66af953b2 100644 --- a/include/dix.h +++ b/include/dix.h @@ -169,9 +169,7 @@ extern void SendErrorToClient( extern void MarkClientException( ClientPtr /*client*/); -#if defined(DDXBEFORERESET) extern void ddxBeforeReset (void); -#endif /* dixutils.c */ From 37072500f7bcf39e0d6aa2ceb5d1f2aeeab0b26b Mon Sep 17 00:00:00 2001 From: Adam Jackson Date: Tue, 25 Nov 2008 14:04:44 -0500 Subject: [PATCH 52/62] Warning fix MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit helper_exec.c: In function ‘port_rep_inb’: helper_exec.c:219: warning: implicit declaration of function ‘DEBUG_IO_TRACE’ helper_exec.c:219: warning: nested extern declaration of ‘DEBUG_IO_TRACE’ --- hw/xfree86/int10/helper_exec.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hw/xfree86/int10/helper_exec.c b/hw/xfree86/int10/helper_exec.c index 15eba4928..1c89ce508 100644 --- a/hw/xfree86/int10/helper_exec.c +++ b/hw/xfree86/int10/helper_exec.c @@ -32,6 +32,8 @@ #include "Pci.h" #ifdef _X86EMU #include "x86emu/x86emui.h" +#else +#define DEBUG_IO_TRACE() 0 #endif #include From e5eaea599ab16428c69912b6b3427ebe46707d7c Mon Sep 17 00:00:00 2001 From: Adam Jackson Date: Tue, 25 Nov 2008 14:05:51 -0500 Subject: [PATCH 53/62] Warning fix xf86info.c:11: warning: initialization makes integer from pointer without a cast --- hw/xfree86/dummylib/xf86info.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/xfree86/dummylib/xf86info.c b/hw/xfree86/dummylib/xf86info.c index 221a9d2bb..7db6817c3 100644 --- a/hw/xfree86/dummylib/xf86info.c +++ b/hw/xfree86/dummylib/xf86info.c @@ -8,5 +8,5 @@ #include "xf86Priv.h" /* Dummy variables */ -xf86InfoRec xf86Info = {NULL, }; +xf86InfoRec xf86Info; From 88297558aada44bc714ad57adbeed3740aaadee5 Mon Sep 17 00:00:00 2001 From: Adam Jackson Date: Tue, 25 Nov 2008 14:20:58 -0500 Subject: [PATCH 54/62] Dead code cleanup over DBE. No DDXes have explicit DBE support anymore, so the init registration table never got used. Just nuke it all. --- dbe/dbe.c | 83 ++----------------------------------------------- dbe/dbestruct.h | 1 + 2 files changed, 3 insertions(+), 81 deletions(-) diff --git a/dbe/dbe.c b/dbe/dbe.c index bd2778938..ff9df7f9f 100644 --- a/dbe/dbe.c +++ b/dbe/dbe.c @@ -58,9 +58,6 @@ /* GLOBALS */ -/* Per-screen initialization functions [init'ed by DbeRegisterFunction()] */ -static Bool (* DbeInitFunct[MAXSCREENS])(); /* pScreen, pDbeScreenPriv */ - /* These are static globals copied to DBE's screen private for use by DDX */ static int dbeScreenPrivKeyIndex; static DevPrivateKey dbeScreenPrivKey = &dbeScreenPrivKeyIndex; @@ -74,45 +71,6 @@ static RESTYPE dbeWindowPrivResType; /* Used to generate DBE's BadBuffer error. */ static int dbeErrorBase; -/* Used by DbeRegisterFunction() to initialize the initialization function - * table only once per server lifetime. - */ -static Bool firstRegistrationPass = TRUE; - - -/****************************************************************************** - * - * DBE DIX Procedure: DbeRegisterFunction - * - * Description: - * - * This function registers the DBE init function for the specified screen. - * - *****************************************************************************/ - -void -DbeRegisterFunction(ScreenPtr pScreen, Bool (*funct) (/* ??? */)) -{ - int i; - - /* Initialize the initialization function table if it has not been - * initialized already. - */ - if (firstRegistrationPass) - { - for (i = 0; i < MAXSCREENS; i++) - { - DbeInitFunct[i] = NULL; - } - - firstRegistrationPass = FALSE; - } - - DbeInitFunct[pScreen->myNum] = funct; - -} /* DbeRegisterFunction() */ - - /****************************************************************************** * * DBE DIX Procedure: DbeStubScreen @@ -1498,12 +1456,6 @@ DbeResetProc(ExtensionEntry *extEntry) xfree(pDbeScreenPriv); } } - - /* We want to init the initialization function table after every server - * reset in DbeRegisterFunction(). - */ - firstRegistrationPass = TRUE; - } /* DbeResetProc() */ @@ -1659,39 +1611,8 @@ DbeExtensionInit(void) pDbeScreenPriv->dbeScreenPrivKey = dbeScreenPrivKey; pDbeScreenPriv->dbeWindowPrivKey = dbeWindowPrivKey; - if(DbeInitFunct[i]) { - /* This screen supports DBE. */ - - /* Setup DIX. */ - pDbeScreenPriv->SetupBackgroundPainter = DbeSetupBackgroundPainter; - - /* Setup DDX. */ - ddxInitSuccess = (*DbeInitFunct[i])(pScreen, pDbeScreenPriv); - - /* DDX DBE initialization may have the side affect of - * reallocating pDbeScreenPriv, so we need to update it. - */ - pDbeScreenPriv = DBE_SCREEN_PRIV(pScreen); - - if (ddxInitSuccess) - { - /* Wrap DestroyWindow. The DDX initialization function - * already wrapped PositionWindow for us. - */ - - pDbeScreenPriv->DestroyWindow = pScreen->DestroyWindow; - pScreen->DestroyWindow = DbeDestroyWindow; - } - else - { - /* DDX initialization failed. Stub the screen. */ - DbeStubScreen(pDbeScreenPriv, &nStubbedScreens); - } - } - else - { - /* This screen does not support DBE. */ + /* We don't have DDX support for DBE anymore */ #ifndef DISABLE_MI_DBE_BY_DEFAULT /* Setup DIX. */ @@ -1723,7 +1644,7 @@ DbeExtensionInit(void) DbeStubScreen(pDbeScreenPriv, &nStubbedScreens); #endif - } /* else -- this screen does not support DBE. */ + } } /* for (i = 0; i < screenInfo.numScreens; i++) */ diff --git a/dbe/dbestruct.h b/dbe/dbestruct.h index 7d5a115ad..641f209da 100644 --- a/dbe/dbestruct.h +++ b/dbe/dbestruct.h @@ -74,6 +74,7 @@ /* Marker for free elements in the buffer ID array. */ #define DBE_FREE_ID_ELEMENT 0 +extern void DbeExtensionInit (void); /* TYPEDEFS */ From c8472a74441838e16d0d3414db1fa7fe996868a9 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Tue, 25 Nov 2008 19:35:17 +0200 Subject: [PATCH 55/62] Do not send VisibilityNotify events when MapUnmapEvents are disabled This prevents a protocol visible side-effect (XVisibilityEvent) on XCompositeRedirectWindow() followed by a XCompositeUnredirectWindow(). The problem shows up in gnome-screensaver with compiz and "unredirect fullscreen windows" enable. A VisibilityNotify event is generated (first with obscured and than with unobscured) when the window swithces from redirected to unredirected. https://bugs.freedesktop.org/show_bug.cgi?id=18133 http://launchpad.net/bugs/278112 --- dix/window.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dix/window.c b/dix/window.c index ff5ba4acc..c31fa875b 100644 --- a/dix/window.c +++ b/dix/window.c @@ -3091,6 +3091,8 @@ void SendVisibilityNotify(WindowPtr pWin) { xEvent event; + if (!MapUnmapEventsEnabled(pWin)) + return; #ifndef NO_XINERAMA_PORT unsigned int visibility = pWin->visibility; #endif From 2538fc0d893a150e978355d281750f0a989728a7 Mon Sep 17 00:00:00 2001 From: Eamon Walsh Date: Tue, 25 Nov 2008 18:18:46 -0500 Subject: [PATCH 56/62] xselinux: don't pass a NULL key string to selabel_lookup(). --- Xext/xselinux.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Xext/xselinux.c b/Xext/xselinux.c index 945984dec..0e8f25468 100644 --- a/Xext/xselinux.c +++ b/Xext/xselinux.c @@ -474,7 +474,7 @@ SELinuxLabelClient(ClientPtr client) /* Try to get a context from the socket */ if (fd < 0 || getpeercon(fd, &ctx) < 0) { /* Otherwise, fall back to a default context */ - if (selabel_lookup(label_hnd, &ctx, NULL, SELABEL_X_CLIENT) < 0) + if (selabel_lookup(label_hnd, &ctx, "remote", SELABEL_X_CLIENT) < 0) FatalError("SELinux: failed to look up remote-client context\n"); } From d5ad296869c38ab30136b5a293a0125b76aad994 Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Tue, 25 Nov 2008 14:12:26 -0800 Subject: [PATCH 57/62] Remove duplication from code paths in XkbDDXCompileKeymapByNames --- xkb/ddxLoad.c | 76 ++++++++++++++++++++++++++++----------------------- 1 file changed, 42 insertions(+), 34 deletions(-) diff --git a/xkb/ddxLoad.c b/xkb/ddxLoad.c index 80da96317..4d5dfb685 100644 --- a/xkb/ddxLoad.c +++ b/xkb/ddxLoad.c @@ -186,53 +186,61 @@ XkbDDXCompileKeymapByNames( XkbDescPtr xkb, char * nameRtrn, int nameRtrnLen) { -FILE * out; -char *buf = NULL, keymap[PATH_MAX],xkm_output_dir[PATH_MAX]; + FILE * out; + char *buf = NULL, keymap[PATH_MAX], xkm_output_dir[PATH_MAX]; + + const char *emptystring = ""; + const char *xkbbasedirflag = emptystring; + const char *xkbbindir = emptystring; + const char *xkbbindirsep = emptystring; #ifdef WIN32 -char tmpname[PATH_MAX]; -#endif + /* WIN32 has no popen. The input must be stored in a file which is + used as input for xkbcomp. xkbcomp does not read from stdin. */ + char tmpname[PATH_MAX]; + const char *xkmfile = tmpname; +#else + const char *xkmfile = "-"; +#endif snprintf(keymap, sizeof(keymap), "server-%s", display); XkbEnsureSafeMapName(keymap); OutputDirectory(xkm_output_dir, sizeof(xkm_output_dir)); + #ifdef WIN32 strcpy(tmpname, Win32TempDir()); strcat(tmpname, "\\xkb_XXXXXX"); (void) mktemp(tmpname); #endif - if (XkbBaseDirectory!=NULL) { -#ifndef WIN32 - char *xkmfile = "-"; -#else - /* WIN32 has no popen. The input must be stored in a file which is used as input - for xkbcomp. xkbcomp does not read from stdin. */ - char *xkmfile = tmpname; -#endif - char *xkbbasedir = XkbBaseDirectory; - char *xkbbindir = XkbBinDirectory; - - buf = Xprintf( - "\"%s" PATHSEPARATOR "xkbcomp\" -w %d \"-R%s\" -xkm \"%s\" -em1 %s -emp %s -eml %s \"%s%s.xkm\"", - xkbbindir, - ((xkbDebugFlags<2)?1:((xkbDebugFlags>10)?10:(int)xkbDebugFlags)), - xkbbasedir, xkmfile, - PRE_ERROR_MSG,ERROR_PREFIX,POST_ERROR_MSG1, - xkm_output_dir,keymap); + + if (XkbBaseDirectory != NULL) { + xkbbasedirflag = Xprintf("\"-R%s\"", XkbBaseDirectory); } - else { -#ifndef WIN32 - char *xkmfile = "-"; -#else - char *xkmfile = tmpname; -#endif - buf = Xprintf( - "xkbcomp -w %d -xkm \"%s\" -em1 %s -emp %s -eml %s \"%s%s.xkm\"", - ((xkbDebugFlags<2)?1:((xkbDebugFlags>10)?10:(int)xkbDebugFlags)), - xkmfile, - PRE_ERROR_MSG,ERROR_PREFIX,POST_ERROR_MSG1, - xkm_output_dir,keymap); + + if (XkbBinDirectory != NULL) { + int ld = strlen(XkbBinDirectory); + int lps = strlen(PATHSEPARATOR); + + xkbbindir = XkbBinDirectory; + + if ((ld >= lps) && + (strcmp(xkbbindir + ld - lps, PATHSEPARATOR) != 0)) { + xkbbindirsep = PATHSEPARATOR; + } + } + + buf = Xprintf("\"%s%sxkbcomp\" -w %d %s -xkm \"%s\" " + "-em1 %s -emp %s -eml %s \"%s%s.xkm\"", + xkbbindir, xkbbindirsep, + ( (xkbDebugFlags < 2) ? 1 : + ((xkbDebugFlags > 10) ? 10 : (int)xkbDebugFlags) ), + xkbbasedirflag, xkmfile, + PRE_ERROR_MSG, ERROR_PREFIX, POST_ERROR_MSG1, + xkm_output_dir, keymap); + + if (xkbbasedirflag != emptystring) { + xfree(xkbbasedirflag); } #ifndef WIN32 From d5f9a131a2d5bd33f82fdd4e809880b0ff792b45 Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Tue, 25 Nov 2008 15:46:39 -0800 Subject: [PATCH 58/62] Fix const-mismatch warnings for DisplayModePtr's Includes fixes for: "xf86Config.c", line 2434: warning: argument #1 is incompatible with prototype: prototype: pointer to struct _DisplayModeRec: "xf86.h", line 351 argument : pointer to const struct _DisplayModeRec "xf86EdidModes.c", line 312: warning: argument #1 is incompatible with prototype: prototype: pointer to struct _DisplayModeRec: "../../../hw/xfree86/common/xf86.h", line 351 argument : pointer to const struct _DisplayModeRec "xf86EdidModes.c", line 438: warning: assignment type mismatch: pointer to struct _DisplayModeRec "=" pointer to const struct _DisplayModeRec "xf86Modes.c", line 701: warning: assignment type mismatch: pointer to struct _DisplayModeRec "=" pointer to const struct _DisplayModeRec --- hw/xfree86/common/xf86.h | 9 +++++---- hw/xfree86/modes/xf86EdidModes.c | 4 ++-- hw/xfree86/modes/xf86Modes.c | 16 ++++++++-------- hw/xfree86/modes/xf86Modes.h | 15 ++++++++------- 4 files changed, 23 insertions(+), 21 deletions(-) diff --git a/hw/xfree86/common/xf86.h b/hw/xfree86/common/xf86.h index e1f1b7051..a32aa9bcc 100644 --- a/hw/xfree86/common/xf86.h +++ b/hw/xfree86/common/xf86.h @@ -344,13 +344,14 @@ void xf86PruneDriverModes(ScrnInfoPtr scrp); void xf86SetCrtcForModes(ScrnInfoPtr scrp, int adjustFlags); void xf86PrintModes(ScrnInfoPtr scrp); void xf86ShowClockRanges(ScrnInfoPtr scrp, ClockRangePtr clockRanges); -double xf86ModeHSync(DisplayModePtr mode); -double xf86ModeVRefresh(DisplayModePtr mode); +double xf86ModeHSync(const DisplayModeRec *mode); +double xf86ModeVRefresh(const DisplayModeRec *mode); void xf86SetModeDefaultName(DisplayModePtr mode); void xf86SetModeCrtc(DisplayModePtr p, int adjustFlags); -DisplayModePtr xf86DuplicateMode(DisplayModePtr pMode); +DisplayModePtr xf86DuplicateMode(const DisplayModeRec *pMode); DisplayModePtr xf86DuplicateModes(ScrnInfoPtr pScrn, DisplayModePtr modeList); -Bool xf86ModesEqual(DisplayModePtr pMode1, DisplayModePtr pMode2); +Bool xf86ModesEqual(const DisplayModeRec *pMode1, + const DisplayModeRec *pMode2); void xf86PrintModeline(int scrnIndex,DisplayModePtr mode); DisplayModePtr xf86ModesAdd(DisplayModePtr modes, DisplayModePtr new); diff --git a/hw/xfree86/modes/xf86EdidModes.c b/hw/xfree86/modes/xf86EdidModes.c index bea2f7e64..5ed61c1d0 100644 --- a/hw/xfree86/modes/xf86EdidModes.c +++ b/hw/xfree86/modes/xf86EdidModes.c @@ -418,7 +418,7 @@ MonitorStandardTimingLevel(xf86MonPtr DDC) } static int -ModeRefresh(DisplayModePtr mode) +ModeRefresh(const DisplayModeRec *mode) { return (int)(xf86ModeVRefresh(mode) + 0.5); } @@ -432,7 +432,7 @@ static DisplayModePtr FindDMTMode(int hsize, int vsize, int refresh, Bool rb) { int i; - DisplayModePtr ret; + const DisplayModeRec *ret; for (i = 0; i < sizeof(DMTModes) / sizeof(DisplayModeRec); i++) { ret = &DMTModes[i]; diff --git a/hw/xfree86/modes/xf86Modes.c b/hw/xfree86/modes/xf86Modes.c index 0fdfbdb85..1522fa731 100644 --- a/hw/xfree86/modes/xf86Modes.c +++ b/hw/xfree86/modes/xf86Modes.c @@ -52,7 +52,7 @@ extern XF86ConfigPtr xf86configptr; * Exact copy of xf86Mode.c's. */ _X_EXPORT double -xf86ModeHSync(DisplayModePtr mode) +xf86ModeHSync(const DisplayModeRec *mode) { double hsync = 0.0; @@ -70,7 +70,7 @@ xf86ModeHSync(DisplayModePtr mode) * Exact copy of xf86Mode.c's. */ _X_EXPORT double -xf86ModeVRefresh(DisplayModePtr mode) +xf86ModeVRefresh(const DisplayModeRec *mode) { double refresh = 0.0; @@ -89,7 +89,7 @@ xf86ModeVRefresh(DisplayModePtr mode) } _X_EXPORT int -xf86ModeWidth (DisplayModePtr mode, Rotation rotation) +xf86ModeWidth (const DisplayModeRec *mode, Rotation rotation) { switch (rotation & 0xf) { case RR_Rotate_0: @@ -104,7 +104,7 @@ xf86ModeWidth (DisplayModePtr mode, Rotation rotation) } _X_EXPORT int -xf86ModeHeight (DisplayModePtr mode, Rotation rotation) +xf86ModeHeight (const DisplayModeRec *mode, Rotation rotation) { switch (rotation & 0xf) { case RR_Rotate_0: @@ -206,7 +206,7 @@ xf86SetModeCrtc(DisplayModePtr p, int adjustFlags) * Allocates and returns a copy of pMode, including pointers within pMode. */ _X_EXPORT DisplayModePtr -xf86DuplicateMode(DisplayModePtr pMode) +xf86DuplicateMode(const DisplayModeRec *pMode) { DisplayModePtr pNew; @@ -264,7 +264,7 @@ xf86DuplicateModes(ScrnInfoPtr pScrn, DisplayModePtr modeList) * This isn't in xf86Modes.c, but it might deserve to be there. */ _X_EXPORT Bool -xf86ModesEqual(DisplayModePtr pMode1, DisplayModePtr pMode2) +xf86ModesEqual(const DisplayModeRec *pMode1, const DisplayModeRec *pMode2) { if (pMode1->Clock == pMode2->Clock && pMode1->HDisplay == pMode2->HDisplay && @@ -519,7 +519,7 @@ xf86ValidateModesBandwidth(ScrnInfoPtr pScrn, DisplayModePtr modeList, } Bool -xf86ModeIsReduced(DisplayModePtr mode) +xf86ModeIsReduced(const DisplayModeRec *mode) { if ((((mode->HDisplay * 5 / 4) & ~0x07) > mode->HTotal) && ((mode->HTotal - mode->HDisplay) == 160) && @@ -698,7 +698,7 @@ xf86GetDefaultModes (Bool interlaceAllowed, Bool doubleScanAllowed) for (i = 0; i < xf86NumDefaultModes; i++) { - DisplayModePtr defMode = &xf86DefaultModes[i]; + const DisplayModeRec *defMode = &xf86DefaultModes[i]; if (!interlaceAllowed && (defMode->Flags & V_INTERLACE)) continue; diff --git a/hw/xfree86/modes/xf86Modes.h b/hw/xfree86/modes/xf86Modes.h index af5987b24..2fb6a374d 100644 --- a/hw/xfree86/modes/xf86Modes.h +++ b/hw/xfree86/modes/xf86Modes.h @@ -40,22 +40,23 @@ #include "xf86Rename.h" #endif -double xf86ModeHSync(DisplayModePtr mode); -double xf86ModeVRefresh(DisplayModePtr mode); +double xf86ModeHSync(const DisplayModeRec *mode); +double xf86ModeVRefresh(const DisplayModeRec *mode); unsigned int xf86ModeBandwidth(DisplayModePtr mode, int depth); int -xf86ModeWidth (DisplayModePtr mode, Rotation rotation); +xf86ModeWidth (const DisplayModeRec *mode, Rotation rotation); int -xf86ModeHeight (DisplayModePtr mode, Rotation rotation); +xf86ModeHeight (const DisplayModeRec *mode, Rotation rotation); -DisplayModePtr xf86DuplicateMode(DisplayModePtr pMode); +DisplayModePtr xf86DuplicateMode(const DisplayModeRec *pMode); DisplayModePtr xf86DuplicateModes(ScrnInfoPtr pScrn, DisplayModePtr modeList); void xf86SetModeDefaultName(DisplayModePtr mode); void xf86SetModeCrtc(DisplayModePtr p, int adjustFlags); -Bool xf86ModesEqual(DisplayModePtr pMode1, DisplayModePtr pMode2); +Bool xf86ModesEqual(const DisplayModeRec *pMode1, + const DisplayModeRec *pMode2); void xf86PrintModeline(int scrnIndex,DisplayModePtr mode); DisplayModePtr xf86ModesAdd(DisplayModePtr modes, DisplayModePtr new); @@ -65,7 +66,7 @@ DisplayModePtr xf86CVTMode(int HDisplay, int VDisplay, float VRefresh, DisplayModePtr xf86GTFMode(int h_pixels, int v_lines, float freq, int interlaced, int margins); Bool -xf86ModeIsReduced(DisplayModePtr mode); +xf86ModeIsReduced(const DisplayModeRec *mode); void xf86ValidateModesFlags(ScrnInfoPtr pScrn, DisplayModePtr modeList, From 416685c295353b5816689994c7c58ae7db3e878d Mon Sep 17 00:00:00 2001 From: Jeremy Uejio Date: Tue, 25 Nov 2008 16:26:44 -0800 Subject: [PATCH 59/62] Refix Sun bug #6685465: Xephyr uses wrong or bad colortable in 8-bit mode This is a refix of the previous fix for CR 6685465. In the first fix I was shifting the colors to match the mask by the bits_per_rgb amount in the visual structure. That field has nothing to do with the # of bits to shift by. I should just instead shift the bits to match the mask. --- hw/kdrive/ephyr/hostx.c | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/hw/kdrive/ephyr/hostx.c b/hw/kdrive/ephyr/hostx.c index 1bc95a8fc..d289d7335 100644 --- a/hw/kdrive/ephyr/hostx.c +++ b/hw/kdrive/ephyr/hostx.c @@ -578,14 +578,14 @@ hostx_get_visual_masks (EphyrScreenInfo screen, } static int -hostx_calculate_color_shift(unsigned long mask, - int bits_per_rgb) +hostx_calculate_color_shift(unsigned long mask) { - int shift = 0; - while(mask) { - mask = mask >> bits_per_rgb; - if (mask) shift += bits_per_rgb; - } + int shift = 1; + /* count # of bits in mask */ + while (mask=(mask>>1)) shift++; + /* cmap entry is an unsigned char so adjust it by size of that */ + shift = shift - sizeof(unsigned char) * 8; + if (shift < 0) shift = 0; return shift; } @@ -601,12 +601,9 @@ hostx_set_cmap_entry(unsigned char idx, static int first_time = 1; if (first_time) { first_time = 0; - rshift = hostx_calculate_color_shift(HostX.visual->red_mask, - HostX.visual->bits_per_rgb); - gshift = hostx_calculate_color_shift(HostX.visual->green_mask, - HostX.visual->bits_per_rgb); - bshift = hostx_calculate_color_shift(HostX.visual->blue_mask, - HostX.visual->bits_per_rgb); + rshift = hostx_calculate_color_shift(HostX.visual->red_mask); + gshift = hostx_calculate_color_shift(HostX.visual->green_mask); + bshift = hostx_calculate_color_shift(HostX.visual->blue_mask); } HostX.cmap[idx] = ((r << rshift) & HostX.visual->red_mask) | ((g << gshift) & HostX.visual->green_mask) | From 2b45602e828a07a0817691b2838cd34ffee531bd Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Wed, 26 Nov 2008 10:42:52 +1000 Subject: [PATCH 60/62] Revert "dix: Enable core devices in InitCoreDevices already." I merged the wrong patch. See correct patch at: http://lists.freedesktop.org/archives/xorg/2008-November/040540.html Not activating the device before attempting to enable it would leave the sprite unset, crashing the server when enabling the real devices. This reverts commit e078901a4eca02bd3e7a80d9462dafbca939a187. Signed-off-by: Peter Hutterer --- dix/devices.c | 29 +++++++++++++++++++++-------- dix/main.c | 3 ++- include/input.h | 2 +- 3 files changed, 24 insertions(+), 10 deletions(-) diff --git a/dix/devices.c b/dix/devices.c index 583ecc016..afc78d81e 100644 --- a/dix/devices.c +++ b/dix/devices.c @@ -595,6 +595,8 @@ CorePointerProc(DeviceIntPtr pDev, int what) * Both devices are not tied to physical devices, but guarantee that there is * always a keyboard and a pointer present and keep the protocol semantics. * + * The devices are activated but not enabled. + * * Note that the server MUST have two core devices at all times, even if there * is no physical device connected. */ @@ -605,12 +607,6 @@ InitCoreDevices(void) &inputInfo.pointer, &inputInfo.keyboard) != Success) FatalError("Failed to allocate core devices"); - - if (inputInfo.pointer->inited && inputInfo.pointer->startup) - EnableDevice(inputInfo.pointer); - if (inputInfo.keyboard->inited && inputInfo.keyboard->startup) - EnableDevice(inputInfo.keyboard); - } /** @@ -625,7 +621,7 @@ InitCoreDevices(void) * * @return Success or error code on failure. */ -void +int InitAndStartDevices() { DeviceIntPtr dev, next; @@ -636,14 +632,31 @@ InitAndStartDevices() ActivateDevice(dev); } + if (!inputInfo.keyboard) { /* In theory, this cannot happen */ + ErrorF("[dix] No core keyboard\n"); + return BadImplementation; + } + if (!inputInfo.pointer) { /* In theory, this cannot happen */ + ErrorF("[dix] No core pointer\n"); + return BadImplementation; + } + + /* Now enable all devices */ + if (inputInfo.pointer->inited && inputInfo.pointer->startup) + EnableDevice(inputInfo.pointer); + if (inputInfo.keyboard->inited && inputInfo.keyboard->startup) + EnableDevice(inputInfo.keyboard); + /* enable real devices */ for (dev = inputInfo.off_devices; dev; dev = next) { DebugF("(dix) enabling device %d\n", dev->id); next = dev->next; if (dev->inited && dev->startup) - EnableDevice(dev); + (void)EnableDevice(dev); } + + return Success; } /** diff --git a/dix/main.c b/dix/main.c index ee2e10db5..7bd91e0c2 100644 --- a/dix/main.c +++ b/dix/main.c @@ -361,7 +361,8 @@ int main(int argc, char *argv[], char *envp[]) InitCoreDevices(); InitInput(argc, argv); - InitAndStartDevices(); + if (InitAndStartDevices() != Success) + FatalError("failed to initialize core devices"); dixSaveScreens(serverClient, SCREEN_SAVER_FORCER, ScreenSaverReset); diff --git a/include/input.h b/include/input.h index 62f54491c..c78f0b750 100644 --- a/include/input.h +++ b/include/input.h @@ -233,7 +233,7 @@ extern Bool ActivateDevice( extern Bool DisableDevice( DeviceIntPtr /*device*/); -extern void InitAndStartDevices(void); +extern int InitAndStartDevices(void); extern void CloseDownDevices(void); From ec1d08442f69353cb0e73ac4eaf0346ebb975594 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Fri, 21 Nov 2008 15:13:00 +1000 Subject: [PATCH 61/62] dix: Enable core devices in InitCoreDevices already. Updated patch, see http://lists.freedesktop.org/archives/xorg/2008-November/040540.html Signed-off-by: Peter Hutterer Signed-off-by: Adam Jackson --- dix/devices.c | 23 ++++++----------------- dix/main.c | 3 +-- 2 files changed, 7 insertions(+), 19 deletions(-) diff --git a/dix/devices.c b/dix/devices.c index afc78d81e..f85e875af 100644 --- a/dix/devices.c +++ b/dix/devices.c @@ -595,8 +595,6 @@ CorePointerProc(DeviceIntPtr pDev, int what) * Both devices are not tied to physical devices, but guarantee that there is * always a keyboard and a pointer present and keep the protocol semantics. * - * The devices are activated but not enabled. - * * Note that the server MUST have two core devices at all times, even if there * is no physical device connected. */ @@ -607,6 +605,12 @@ InitCoreDevices(void) &inputInfo.pointer, &inputInfo.keyboard) != Success) FatalError("Failed to allocate core devices"); + + ActivateDevice(inputInfo.pointer); + ActivateDevice(inputInfo.keyboard); + EnableDevice(inputInfo.pointer); + EnableDevice(inputInfo.keyboard); + } /** @@ -632,21 +636,6 @@ InitAndStartDevices() ActivateDevice(dev); } - if (!inputInfo.keyboard) { /* In theory, this cannot happen */ - ErrorF("[dix] No core keyboard\n"); - return BadImplementation; - } - if (!inputInfo.pointer) { /* In theory, this cannot happen */ - ErrorF("[dix] No core pointer\n"); - return BadImplementation; - } - - /* Now enable all devices */ - if (inputInfo.pointer->inited && inputInfo.pointer->startup) - EnableDevice(inputInfo.pointer); - if (inputInfo.keyboard->inited && inputInfo.keyboard->startup) - EnableDevice(inputInfo.keyboard); - /* enable real devices */ for (dev = inputInfo.off_devices; dev; dev = next) { diff --git a/dix/main.c b/dix/main.c index 7bd91e0c2..ee2e10db5 100644 --- a/dix/main.c +++ b/dix/main.c @@ -361,8 +361,7 @@ int main(int argc, char *argv[], char *envp[]) InitCoreDevices(); InitInput(argc, argv); - if (InitAndStartDevices() != Success) - FatalError("failed to initialize core devices"); + InitAndStartDevices(); dixSaveScreens(serverClient, SCREEN_SAVER_FORCER, ScreenSaverReset); From ed597f19fdc3017dde6d1452b5cdf8ddcd69a5b1 Mon Sep 17 00:00:00 2001 From: Eamon Walsh Date: Tue, 25 Nov 2008 19:36:31 -0500 Subject: [PATCH 62/62] xselinux: use "raw context" variants of getpeercon() and getcon(). --- Xext/xselinux.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Xext/xselinux.c b/Xext/xselinux.c index 0e8f25468..93ea05b92 100644 --- a/Xext/xselinux.c +++ b/Xext/xselinux.c @@ -472,7 +472,7 @@ SELinuxLabelClient(ClientPtr client) sidput(obj->sid); /* Try to get a context from the socket */ - if (fd < 0 || getpeercon(fd, &ctx) < 0) { + if (fd < 0 || getpeercon_raw(fd, &ctx) < 0) { /* Otherwise, fall back to a default context */ if (selabel_lookup(label_hnd, &ctx, "remote", SELABEL_X_CLIENT) < 0) FatalError("SELinux: failed to look up remote-client context\n"); @@ -537,7 +537,7 @@ SELinuxLabelInitial(void) sidput(subj->sid); /* Use the context of the X server process for the serverClient */ - if (getcon(&ctx) < 0) + if (getcon_raw(&ctx) < 0) FatalError("SELinux: couldn't get context of X server process\n"); /* Get a SID from the context */