From 70683e338dacc48e3adf489d66ec33b29dfc3b77 Mon Sep 17 00:00:00 2001 From: Brian Date: Mon, 2 Apr 2007 12:26:27 -0600 Subject: [PATCH 01/15] formatting fixes --- hw/dmx/input/dmxbackend.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/hw/dmx/input/dmxbackend.c b/hw/dmx/input/dmxbackend.c index 7efb2eebe..09a2a324b 100644 --- a/hw/dmx/input/dmxbackend.c +++ b/hw/dmx/input/dmxbackend.c @@ -358,7 +358,8 @@ void dmxBackendCollectEvents(DevicePtr pDev, switch (X.type) { case EnterNotify: dmxCommonSaveState(priv); - if (entered++) continue; + if (entered++) + continue; priv->entered = 1; ignoreLeave = 1; DMXDBG5("dmxBackendCollectEvents: Enter %lu %d,%d; GRAB %s %p\n", @@ -382,7 +383,8 @@ void dmxBackendCollectEvents(DevicePtr pDev, continue; } dmxCommonRestoreState(priv); - if (left++) continue; + if (left++) + continue; DMXDBG7("dmxBackendCollectEvents: Leave %lu %d,%d %d %d %s %s\n", X.xcrossing.root, X.xcrossing.x, X.xcrossing.y, X.xcrossing.detail, X.xcrossing.focus, @@ -403,7 +405,8 @@ void dmxBackendCollectEvents(DevicePtr pDev, priv->newscreen, X.xmotion.x, X.xmotion.y, entered, priv->lastX, priv->lastY); - if (dmxBackendPendingMotionEvent(priv, TRUE)) continue; + if (dmxBackendPendingMotionEvent(priv, TRUE)) + continue; if (!(dmxScreen = dmxBackendFindWindow(priv, X.xmotion.window))) dmxLog(dmxFatal, " Event on non-existant window %lu\n", From 08a88d1803f672555141011e082fbc0edeedcf05 Mon Sep 17 00:00:00 2001 From: Brian Date: Mon, 2 Apr 2007 12:28:14 -0600 Subject: [PATCH 02/15] Pass num_valuators=0 for ButtonPress/Release. This seems to fix the button coordinate problem --- hw/dmx/input/dmxevents.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/hw/dmx/input/dmxevents.c b/hw/dmx/input/dmxevents.c index fae2049b3..d174a59c7 100644 --- a/hw/dmx/input/dmxevents.c +++ b/hw/dmx/input/dmxevents.c @@ -799,20 +799,12 @@ void dmxEnqueue(DevicePtr pDev, int type, int detail, KeySym keySym, DeviceIntPtr p = dmxLocal->pDevice; int i, nevents, valuators[3]; xEvent *events = Xcalloc(sizeof(xEvent), GetMaximumEventsNum()); - - valuators[0] = e->xbutton.x; - valuators[1] = e->xbutton.y; - /* - valuators[0] = dmxGlobalX; - valuators[1] = dmxGlobalY; - */ valuators[2] = e->xbutton.button; - nevents = GetPointerEvents(events, - /*pDev*/p, - /*KeyPress*/type, - detail, + nevents = GetPointerEvents(events, p, type, detail, POINTER_ABSOLUTE, - 0, 2/*3*/, valuators); + 0, /* first_valuator = 0 */ + 0, /* num_valuators = 0 */ + valuators); ErrorF("BUTTON %d, %d %d n=%d\n", valuators[0], valuators[1], valuators[2], nevents); From 0013bf6ddb3867c9a504603434d8c2ec83f3f3bc Mon Sep 17 00:00:00 2001 From: Brian Date: Mon, 2 Apr 2007 12:39:04 -0600 Subject: [PATCH 03/15] undo 1280 valuator hack --- hw/dmx/input/dmxinputinit.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hw/dmx/input/dmxinputinit.c b/hw/dmx/input/dmxinputinit.c index cf680517f..d14aeb70d 100644 --- a/hw/dmx/input/dmxinputinit.c +++ b/hw/dmx/input/dmxinputinit.c @@ -509,7 +509,7 @@ static int dmxDeviceOnOff(DeviceIntPtr pDevice, int what) #ifdef XINPUT for (i = 0; i < info.numRelAxes; i++) InitValuatorAxisStruct(pDevice, i, info.minval[0], - 1280/*info.maxval[0]*/, info.res[0], + info.maxval[0], info.res[0], info.minres[0], info.maxres[0]); #endif } else if (info.numRelAxes) { @@ -520,7 +520,7 @@ static int dmxDeviceOnOff(DeviceIntPtr pDevice, int what) #ifdef XINPUT for (i = 0; i < info.numRelAxes; i++) InitValuatorAxisStruct(pDevice, i, info.minval[0], - 1280/*info.maxval[0]*/, info.res[0], + info.maxval[0], info.res[0], info.minres[0], info.maxres[0]); #endif } else if (info.numAbsAxes) { @@ -531,7 +531,7 @@ static int dmxDeviceOnOff(DeviceIntPtr pDevice, int what) #ifdef XINPUT for (i = 0; i < info.numAbsAxes; i++) InitValuatorAxisStruct(pDevice, i+info.numRelAxes, - info.minval[i+1], 1280/*info.maxval[i+1]*/, + info.minval[i+1], info.maxval[i+1], info.res[i+1], info.minres[i+1], info.maxres[i+1]); #endif From 0aaf28e5633a59563b89a2e42d19fabc84adc3ed Mon Sep 17 00:00:00 2001 From: Brian Date: Mon, 2 Apr 2007 12:41:30 -0600 Subject: [PATCH 04/15] In dmxBackendMouGetInfo() initialize the info->minval[], maxval[] arrays to the size of the backend display. It seems that the changes to X input exposed a problem that wasn't detected before. The axis clipping code in GetPointerEvents() uses those limits to constrain the pointer's coordinate range. The max was zero so the pointer couldn't move. --- hw/dmx/input/dmxbackend.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/hw/dmx/input/dmxbackend.c b/hw/dmx/input/dmxbackend.c index 09a2a324b..315979eab 100644 --- a/hw/dmx/input/dmxbackend.c +++ b/hw/dmx/input/dmxbackend.c @@ -592,12 +592,16 @@ void dmxBackendInit(DevicePtr pDev) /** Get information about the backend pointer (for initialization). */ void dmxBackendMouGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info) { + const DMXScreenInfo *dmxScreen = dmxBackendInitPrivate(pDev); + info->buttonClass = 1; dmxCommonMouGetMap(pDev, info->map, &info->numButtons); info->valuatorClass = 1; info->numRelAxes = 2; info->minval[0] = 0; - info->maxval[0] = 0; + info->minval[1] = 0; + info->maxval[0] = dmxScreen->beWidth; + info->maxval[1] = dmxScreen->beHeight; info->res[0] = 1; info->minres[0] = 0; info->maxres[0] = 1; From 12016f20f7f5365f30cfbeb05568b3fb89759e5a Mon Sep 17 00:00:00 2001 From: Brian Date: Mon, 2 Apr 2007 14:50:48 -0600 Subject: [PATCH 05/15] As for normal mouse device, init valuator maxval[] to real values, not zero. --- hw/dmx/input/dmxconsole.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/hw/dmx/input/dmxconsole.c b/hw/dmx/input/dmxconsole.c index 835909e6c..aac5e08dc 100644 --- a/hw/dmx/input/dmxconsole.c +++ b/hw/dmx/input/dmxconsole.c @@ -860,12 +860,17 @@ void dmxConsoleInit(DevicePtr pDev) * for pointers. */ void dmxConsoleMouGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info) { + GETPRIVFROMPDEV; + info->buttonClass = 1; dmxCommonMouGetMap(pDev, info->map, &info->numButtons); info->valuatorClass = 1; info->numRelAxes = 2; - info->minval[0] = 0; - info->maxval[0] = 0; + info->minval[0] = 0; + info->minval[1] = 0; + /* max possible console window size: */ + info->maxval[0] = DisplayWidth(priv->display, DefaultScreen(priv->display)); + info->maxval[1] = DisplayHeight(priv->display, DefaultScreen(priv->display)); info->res[0] = 1; info->minres[0] = 0; info->maxres[0] = 1; From 3a0ce1084a18e17a3c8a009d99c228652b8763a9 Mon Sep 17 00:00:00 2001 From: Brian Date: Mon, 2 Apr 2007 14:51:21 -0600 Subject: [PATCH 06/15] for completeness, init dummy's min/maxval[1] values (vertical axis) --- hw/dmx/input/dmxdummy.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hw/dmx/input/dmxdummy.c b/hw/dmx/input/dmxdummy.c index d6e614e51..b9c72b015 100644 --- a/hw/dmx/input/dmxdummy.c +++ b/hw/dmx/input/dmxdummy.c @@ -79,7 +79,9 @@ void dmxDummyMouGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info) info->valuatorClass = 1; info->numRelAxes = 2; info->minval[0] = 0; + info->minval[1] = 0; info->maxval[0] = 0; + info->maxval[1] = 0; info->res[0] = 1; info->minres[0] = 0; info->maxres[0] = 1; From 0f873a9d4f02b399c37b4058c6a9a2e21aa205e8 Mon Sep 17 00:00:00 2001 From: Brian Date: Mon, 2 Apr 2007 14:51:38 -0600 Subject: [PATCH 07/15] remove some debug code --- hw/dmx/input/dmxinputinit.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/hw/dmx/input/dmxinputinit.c b/hw/dmx/input/dmxinputinit.c index d14aeb70d..a9d902ec2 100644 --- a/hw/dmx/input/dmxinputinit.c +++ b/hw/dmx/input/dmxinputinit.c @@ -505,7 +505,6 @@ static int dmxDeviceOnOff(DeviceIntPtr pDevice, int what) GetMaximumEventsNum(), #endif Relative); - ErrorF("MOTION BUFFER SIZE %d\n", GetMaximumEventsNum()); #ifdef XINPUT for (i = 0; i < info.numRelAxes; i++) InitValuatorAxisStruct(pDevice, i, info.minval[0], @@ -588,10 +587,6 @@ static void dmxProcessInputEvents(DMXInputInfo *dmxInput) { int i; - /* - ErrorF("%s\n", __FUNCTION__); - */ - dmxeqProcessInputEvents(); #if 00 /*BP*/ miPointerUpdate(); From 44eb15adeee3b299677070f39625daa53679bd13 Mon Sep 17 00:00:00 2001 From: Brian Date: Mon, 2 Apr 2007 15:12:04 -0600 Subject: [PATCH 08/15] checkpoint clean-up --- hw/dmx/input/dmxbackend.c | 17 +---------------- hw/dmx/input/dmxevents.c | 35 ++++++++++------------------------- 2 files changed, 11 insertions(+), 41 deletions(-) diff --git a/hw/dmx/input/dmxbackend.c b/hw/dmx/input/dmxbackend.c index 315979eab..7aa8510cb 100644 --- a/hw/dmx/input/dmxbackend.c +++ b/hw/dmx/input/dmxbackend.c @@ -242,11 +242,7 @@ static int dmxBackendOffscreen(int screen, int x, int y) void dmxBackendUpdatePosition(pointer private, int x, int y) { GETPRIVFROMPRIVATE; -#if 00 /*BP*/ - int screen = miPointerCurrentScreen()->myNum; -#else int screen = miPointerGetScreen(inputInfo.pointer)->myNum; -#endif DMXScreenInfo *dmxScreen = &dmxScreens[priv->myScreen]; int oldRelative = priv->relative; int topscreen = dmxBackendFindOverlapping(priv, screen, x, y); @@ -397,7 +393,6 @@ void dmxBackendCollectEvents(DevicePtr pDev, } break; case MotionNotify: -#if 001 /*BP*/ DMXDBG9("dmxBackendCollectEvents: MotionNotify %d/%d (mi %d)" " newscreen=%d: %d %d (e=%d; last=%d,%d)\n", dmxScreen->index, priv->myScreen, @@ -451,25 +446,15 @@ void dmxBackendCollectEvents(DevicePtr pDev, (dmxScreen->rootYOrigin + X.xmotion.y - dmxScreen->rootY)); } -#else - /* - ErrorF("motion %d, %d, %d\n", - X.xmotion.x, X.xmotion.y, X.xmotion.state); - */ - enqueue(priv->mou, X.type, 0/*X.xbutton.button*/, 0, &X, block); -#endif break; case KeyPress: case KeyRelease: enqueue(priv->kbd, X.type, X.xkey.keycode, 0, NULL, block); break; -#if 11/*BP*/ case ButtonPress: case ButtonRelease: - ErrorF("press/release at %d, %d\n", X.xbutton.x, X.xbutton.y); - /* fall-through */ -#endif + /* fall-through */ default: /* Pass the whole event here, because * this may be an extension event. */ diff --git a/hw/dmx/input/dmxevents.c b/hw/dmx/input/dmxevents.c index d174a59c7..3634324ca 100644 --- a/hw/dmx/input/dmxevents.c +++ b/hw/dmx/input/dmxevents.c @@ -194,30 +194,20 @@ DMXScreenInfo *dmxFindFirstScreen(int x, int y) #if 11/*BP*/ +/** + * Enqueue a motion event. + */ static void enqueueMotion(DevicePtr pDev, int x, int y) { - GETDMXINPUTFROMPDEV; + GETDMXLOCALFROMPDEV; DeviceIntPtr p = dmxLocal->pDevice; int i, nevents, valuators[3]; xEvent *events = Xcalloc(sizeof(xEvent), GetMaximumEventsNum()); - int detail = 0; - + int detail = 0; /* XXX should this be mask of pressed buttons? */ valuators[0] = x; valuators[1] = y; - valuators[2] = detail; - nevents = GetPointerEvents(events, - /*pDev*/p, - MotionNotify, - detail, - POINTER_ABSOLUTE, - 0, 2, valuators); - ErrorF("MOTION2 %d, %d n = %d\n", valuators[0], valuators[1], nevents); - /* - ErrorF("NEW MOTION %d st %d (%d,%d,%d) n=%d\n", - detail, e->xmotion.state, - valuators[0], valuators[1], valuators[2], - nevents); - */ + nevents = GetPointerEvents(events, p, MotionNotify, detail, + POINTER_ABSOLUTE, 0, 2, valuators); for (i = 0; i < nevents; i++) mieqEnqueue(p, events + i); xfree(events); @@ -347,8 +337,6 @@ void dmxCoreMotion(DevicePtr pDev, int x, int y, int delta, DMXBlockType block) if (dmxGlobalX >= dmxGlobalWidth) dmxGlobalX = dmxGlobalWidth + delta -1; if (dmxGlobalY >= dmxGlobalHeight) dmxGlobalY = dmxGlobalHeight + delta -1; - ErrorF("Global Pos: %d, %d\n", dmxGlobalX, dmxGlobalY); - if ((dmxScreen = dmxFindFirstScreen(dmxGlobalX, dmxGlobalY))) { localX = dmxGlobalX - dmxScreen->rootXOrigin; localY = dmxGlobalY - dmxScreen->rootYOrigin; @@ -397,7 +385,6 @@ void dmxCoreMotion(DevicePtr pDev, int x, int y, int delta, DMXBlockType block) #endif dmxGlobalX = localX + dmxScreens[pScreen->myNum].rootXOrigin; dmxGlobalY = localY + dmxScreens[pScreen->myNum].rootYOrigin; - ErrorF("Global is now %d, %d\n", dmxGlobalX, dmxGlobalY); DMXDBG6(" Moved to dmxGlobalX=%d dmxGlobalY=%d" " on screen index=%d/%d localX=%d localY=%d\n", dmxGlobalX, dmxGlobalY, @@ -750,7 +737,7 @@ static int dmxFixup(DevicePtr pDev, int detail, KeySym keySym) return keyCode ? keyCode : detail; } -/** Enqueue a non-motion event from the \a pDev device with the +/** Enqueue an event from the \a pDev device with the * specified \a type and \a detail. If the event is a KeyPress or * KeyRelease event, then the \a keySym is also specified. * @@ -778,10 +765,7 @@ void dmxEnqueue(DevicePtr pDev, int type, int detail, KeySym keySym, DeviceIntPtr p = dmxLocal->pDevice; int i, nevents; xEvent *events = Xcalloc(sizeof(xEvent), GetMaximumEventsNum()); - nevents = GetKeyboardEvents(events, - /*pDev*/p, - /*KeyPress*/type, - /*n*/detail); + nevents = GetKeyboardEvents(events, p, type, detail); ErrorF("KEY %d n=%d\n", detail, nevents); for (i = 0; i < nevents; i++) mieqEnqueue(p, events + i); @@ -795,6 +779,7 @@ void dmxEnqueue(DevicePtr pDev, int type, int detail, KeySym keySym, #if 00 /*BP*/ detail = dmxGetButtonMapping(dmxLocal, detail); #else + detail = dmxGetButtonMapping(dmxLocal, detail); { DeviceIntPtr p = dmxLocal->pDevice; int i, nevents, valuators[3]; From 69baad321d35dae0bfa535be0c6ed2131fed1e60 Mon Sep 17 00:00:00 2001 From: Brian Date: Mon, 2 Apr 2007 15:21:22 -0600 Subject: [PATCH 09/15] clean-up dmxCoreMotion() dmxCoreMotion2() --- hw/dmx/input/dmxevents.c | 146 ++------------------------------------- 1 file changed, 5 insertions(+), 141 deletions(-) diff --git a/hw/dmx/input/dmxevents.c b/hw/dmx/input/dmxevents.c index 3634324ca..bca1a10cf 100644 --- a/hw/dmx/input/dmxevents.c +++ b/hw/dmx/input/dmxevents.c @@ -192,8 +192,6 @@ DMXScreenInfo *dmxFindFirstScreen(int x, int y) } -#if 11/*BP*/ - /** * Enqueue a motion event. */ @@ -215,8 +213,8 @@ static void enqueueMotion(DevicePtr pDev, int x, int y) } -static void -dmxCoreMotion2(DevicePtr pDev, int x, int y, int delta, DMXBlockType block) +void +dmxCoreMotion(DevicePtr pDev, int x, int y, int delta, DMXBlockType block) { DMXScreenInfo *dmxScreen; DMXInputInfo *dmxInput; @@ -239,8 +237,6 @@ dmxCoreMotion2(DevicePtr pDev, int x, int y, int delta, DMXBlockType block) if (dmxGlobalX >= dmxGlobalWidth) dmxGlobalX = dmxGlobalWidth + delta -1; if (dmxGlobalY >= dmxGlobalHeight) dmxGlobalY = dmxGlobalHeight + delta -1; - ErrorF("Global Pos: %d, %d\n", dmxGlobalX, dmxGlobalY); - if ((dmxScreen = dmxFindFirstScreen(dmxGlobalX, dmxGlobalY))) { localX = dmxGlobalX - dmxScreen->rootXOrigin; localY = dmxGlobalY - dmxScreen->rootYOrigin; @@ -249,13 +245,8 @@ dmxCoreMotion2(DevicePtr pDev, int x, int y, int delta, DMXBlockType block) /* Screen is old screen */ if (block) dmxSigioBlock(); -#if 000 - miPointerSetPosition(inputInfo.pointer, &localX, &localY, - GetTimeInMillis()); -#else if (pDev) enqueueMotion(pDev, localX, localY); -#endif if (block) dmxSigioUnblock(); } else { @@ -267,13 +258,8 @@ dmxCoreMotion2(DevicePtr pDev, int x, int y, int delta, DMXBlockType block) dmxeqProcessInputEvents(); miPointerSetScreen(inputInfo.pointer, dmxScreen->index, localX, localY); -#if 000 - miPointerSetPosition(inputInfo.pointer, &localX, &localY, - GetTimeInMillis()); -#else if (pDev) enqueueMotion(pDev, localX, localY); -#endif if (block) dmxSigioUnblock(); } @@ -307,105 +293,6 @@ dmxCoreMotion2(DevicePtr pDev, int x, int y, int delta, DMXBlockType block) } if (!dmxScreen) ProcessInputEvents(); } -#endif - -void dmxCoreMotion(DevicePtr pDev, int x, int y, int delta, DMXBlockType block) -{ - DMXScreenInfo *dmxScreen; - DMXInputInfo *dmxInput; - ScreenPtr pScreen; - int localX; - int localY; - int i; - -#if 11/*BP*/ - dmxCoreMotion2(pDev, x, y, delta, block); - return; -#endif - - if (!dmxGlobalInvalid && dmxGlobalX == x && dmxGlobalY == y) return; - - DMXDBG5("dmxCoreMotion(%d,%d,%d) dmxGlobalX=%d dmxGlobalY=%d\n", - x, y, delta, dmxGlobalX, dmxGlobalY); - - dmxGlobalInvalid = 0; - dmxGlobalX = x; - dmxGlobalY = y; - - if (dmxGlobalX < 0) dmxGlobalX = 0; - if (dmxGlobalY < 0) dmxGlobalY = 0; - if (dmxGlobalX >= dmxGlobalWidth) dmxGlobalX = dmxGlobalWidth + delta -1; - if (dmxGlobalY >= dmxGlobalHeight) dmxGlobalY = dmxGlobalHeight + delta -1; - - if ((dmxScreen = dmxFindFirstScreen(dmxGlobalX, dmxGlobalY))) { - localX = dmxGlobalX - dmxScreen->rootXOrigin; - localY = dmxGlobalY - dmxScreen->rootYOrigin; -#if 00 /*BP*/ - if ((pScreen = miPointerCurrentScreen()) -#else - if ((pScreen = miPointerGetScreen(inputInfo.pointer)) -#endif - && pScreen->myNum == dmxScreen->index) { - /* Screen is old screen */ - if (block) dmxSigioBlock(); -#if 00 /*BP*/ - miPointerAbsoluteCursor(localX, localY, GetTimeInMillis()); -#else - miPointerSetPosition(inputInfo.pointer, &localX, &localY, - GetTimeInMillis()); -#endif - if (block) dmxSigioUnblock(); - } else { - /* Screen is new */ - DMXDBG4(" New screen: old=%d new=%d localX=%d localY=%d\n", - pScreen->myNum, dmxScreen->index, localX, localY); - if (block) dmxSigioBlock(); - dmxeqProcessInputEvents(); -#if 00 /*BP*/ - miPointerSetNewScreen(dmxScreen->index, localX, localY); - miPointerAbsoluteCursor(localX, localY, GetTimeInMillis()); -#else - miPointerSetScreen(inputInfo.pointer, dmxScreen->index, - localX, localY); - miPointerSetPosition(inputInfo.pointer, &localX, &localY, - GetTimeInMillis()); -#endif - if (block) dmxSigioUnblock(); - } -#if 00 /*BP*/ - miPointerPosition(&localX, &localY); -#else - miPointerGetPosition(inputInfo.pointer, &localX, &localY); -#endif - -#if 00 /*BP*/ - if ((pScreen = miPointerCurrentScreen())) { -#else - if ((pScreen = miPointerGetScreen(inputInfo.pointer))) { -#endif - dmxGlobalX = localX + dmxScreens[pScreen->myNum].rootXOrigin; - dmxGlobalY = localY + dmxScreens[pScreen->myNum].rootYOrigin; - DMXDBG6(" Moved to dmxGlobalX=%d dmxGlobalY=%d" - " on screen index=%d/%d localX=%d localY=%d\n", - dmxGlobalX, dmxGlobalY, - dmxScreen ? dmxScreen->index : -1, pScreen->myNum, - localX, localY); - } - } - /* Send updates down to all core input - * drivers */ - for (i = 0, dmxInput = &dmxInputs[0]; i < dmxNumInputs; i++, dmxInput++) { - int j; - - for (j = 0; j < dmxInput->numDevs; j += dmxInput->devs[j]->binding) - if (!dmxInput->detached - && dmxInput->devs[j]->sendsCore - && dmxInput->devs[j]->update_position) - dmxInput->devs[j]->update_position(dmxInput->devs[j]->private, - dmxGlobalX, dmxGlobalY); - } - if (!dmxScreen) ProcessInputEvents(); -} @@ -760,25 +647,20 @@ void dmxEnqueue(DevicePtr pDev, int type, int detail, KeySym keySym, return; if (dmxLocal->sendsCore && dmxLocal != dmxLocalCoreKeyboard) xE.u.u.detail = dmxFixup(pDev, detail, keySym); -#if 11/*BP*/ { DeviceIntPtr p = dmxLocal->pDevice; int i, nevents; xEvent *events = Xcalloc(sizeof(xEvent), GetMaximumEventsNum()); + ErrorF("KEY %d\n", detail); nevents = GetKeyboardEvents(events, p, type, detail); - ErrorF("KEY %d n=%d\n", detail, nevents); for (i = 0; i < nevents; i++) mieqEnqueue(p, events + i); xfree(events); return; } -#endif break; case ButtonPress: case ButtonRelease: -#if 00 /*BP*/ - detail = dmxGetButtonMapping(dmxLocal, detail); -#else detail = dmxGetButtonMapping(dmxLocal, detail); { DeviceIntPtr p = dmxLocal->pDevice; @@ -799,15 +681,8 @@ void dmxEnqueue(DevicePtr pDev, int type, int detail, KeySym keySym, xfree(events); return; } -#endif break; case MotionNotify: - /* All MotionNotify events should be sent via dmxCoreMotion and - * dmxExtMotion -- no input driver should build motion events by - * hand. */ -#if 00 /*BP*/ - dmxLog(dmxError, "dmxEnqueueXEvent: MotionNotify not allowed here\n"); -#else { DeviceIntPtr p = dmxLocal->pDevice; int i, nevents, valuators[3]; @@ -815,25 +690,14 @@ void dmxEnqueue(DevicePtr pDev, int type, int detail, KeySym keySym, valuators[0] = e->xmotion.x; valuators[1] = e->xmotion.y; valuators[2] = e->xmotion.state; - nevents = GetPointerEvents(events, - /*pDev*/p, - /*KeyPress*/type, - detail, - POINTER_ABSOLUTE, - 0, 3, valuators); + nevents = GetPointerEvents(events, p, type, detail, + POINTER_ABSOLUTE, 0, 3, valuators); ErrorF("MOTION %d, %d n = %d\n", valuators[0], valuators[1], nevents); - /* - ErrorF("NEW MOTION %d st %d (%d,%d,%d) n=%d\n", - detail, e->xmotion.state, - valuators[0], valuators[1], valuators[2], - nevents); - */ for (i = 0; i < nevents; i++) mieqEnqueue(p, events + i); xfree(events); return; } -#endif break; /* Always ignore these events */ case EnterNotify: From 76a7a5ca1f068c27c9b5fbd49d5a1da80ed6f488 Mon Sep 17 00:00:00 2001 From: Brian Date: Mon, 2 Apr 2007 15:24:05 -0600 Subject: [PATCH 10/15] formatting fixes --- hw/dmx/input/dmxevents.c | 74 +++++++++++++++++++++++++++------------- 1 file changed, 50 insertions(+), 24 deletions(-) diff --git a/hw/dmx/input/dmxevents.c b/hw/dmx/input/dmxevents.c index bca1a10cf..17047f77a 100644 --- a/hw/dmx/input/dmxevents.c +++ b/hw/dmx/input/dmxevents.c @@ -112,7 +112,8 @@ static int dmxCheckFunctionKeys(DMXLocalInputInfoPtr dmxLocal, DMXDBG3("dmxCheckFunctionKeys: keySym=0x%04x %s state=0x%04x\n", keySym, type == KeyPress ? "press" : "release", state); - if ((state & (ControlMask|Mod1Mask)) != (ControlMask|Mod1Mask)) return 0; + if ((state & (ControlMask|Mod1Mask)) != (ControlMask|Mod1Mask)) + return 0; switch (keySym) { case XK_g: @@ -147,16 +148,25 @@ static void dmxEnqueueExtEvent(DMXLocalInputInfoPtr dmxLocal, xEvent *e, int type = e->u.u.type; switch (e->u.u.type) { - case KeyPress: type = DeviceKeyPress; break; - case KeyRelease: type = DeviceKeyRelease; break; - case ButtonPress: type = DeviceButtonPress; break; - case ButtonRelease: type = DeviceButtonRelease; break; + case KeyPress: + type = DeviceKeyPress; + break; + case KeyRelease: + type = DeviceKeyRelease; + break; + case ButtonPress: + type = DeviceButtonPress; + break; + case ButtonRelease: + type = DeviceButtonRelease; + break; case MotionNotify: dmxLog(dmxError, "dmxEnqueueExtEvent: MotionNotify not allowed here\n"); return; default: - if (e->u.u.type == ProximityIn || e->u.u.type == ProximityOut) break; + if (e->u.u.type == ProximityIn || e->u.u.type == ProximityOut) + break; dmxLogInput(dmxInput, "dmxEnqueueExtEvent: Unhandled %s event (%d)\n", e->u.u.type >= LASTEvent ? "extension" : "non-extension", @@ -174,9 +184,11 @@ static void dmxEnqueueExtEvent(DMXLocalInputInfoPtr dmxLocal, xEvent *e, xv->num_valuators = 0; xv->first_valuator = 0; - if (block) dmxSigioBlock(); + if (block) + dmxSigioBlock(); dmxeqEnqueue(xE); - if (block) dmxSigioUnblock(); + if (block) + dmxSigioUnblock(); } #endif @@ -186,7 +198,8 @@ DMXScreenInfo *dmxFindFirstScreen(int x, int y) for (i = 0; i < dmxNumScreens; i++) { DMXScreenInfo *dmxScreen = &dmxScreens[i]; - if (dmxOnScreen(x, y, dmxScreen)) return dmxScreen; + if (dmxOnScreen(x, y, dmxScreen)) + return dmxScreen; } return NULL; } @@ -223,7 +236,8 @@ dmxCoreMotion(DevicePtr pDev, int x, int y, int delta, DMXBlockType block) int localY; int i; - if (!dmxGlobalInvalid && dmxGlobalX == x && dmxGlobalY == y) return; + if (!dmxGlobalInvalid && dmxGlobalX == x && dmxGlobalY == y) + return; DMXDBG5("dmxCoreMotion(%d,%d,%d) dmxGlobalX=%d dmxGlobalY=%d\n", x, y, delta, dmxGlobalX, dmxGlobalY); @@ -232,10 +246,14 @@ dmxCoreMotion(DevicePtr pDev, int x, int y, int delta, DMXBlockType block) dmxGlobalX = x; dmxGlobalY = y; - if (dmxGlobalX < 0) dmxGlobalX = 0; - if (dmxGlobalY < 0) dmxGlobalY = 0; - if (dmxGlobalX >= dmxGlobalWidth) dmxGlobalX = dmxGlobalWidth + delta -1; - if (dmxGlobalY >= dmxGlobalHeight) dmxGlobalY = dmxGlobalHeight + delta -1; + if (dmxGlobalX < 0) + dmxGlobalX = 0; + if (dmxGlobalY < 0) + dmxGlobalY = 0; + if (dmxGlobalX >= dmxGlobalWidth) + dmxGlobalX = dmxGlobalWidth + delta -1; + if (dmxGlobalY >= dmxGlobalHeight) + dmxGlobalY = dmxGlobalHeight + delta -1; if ((dmxScreen = dmxFindFirstScreen(dmxGlobalX, dmxGlobalY))) { localX = dmxGlobalX - dmxScreen->rootXOrigin; @@ -283,7 +301,6 @@ dmxCoreMotion(DevicePtr pDev, int x, int y, int delta, DMXBlockType block) * drivers */ for (i = 0, dmxInput = &dmxInputs[0]; i < dmxNumInputs; i++, dmxInput++) { int j; - for (j = 0; j < dmxInput->numDevs; j += dmxInput->devs[j]->binding) if (!dmxInput->detached && dmxInput->devs[j]->sendsCore @@ -386,10 +403,12 @@ static void dmxExtMotion(DMXLocalInputInfoPtr dmxLocal, } } - if (block) dmxSigioBlock(); + if (block) + dmxSigioBlock(); dmxPointerPutMotionEvent(pDevice, firstAxis, axesCount, v, xev->time); dmxeqEnqueue(xE); - if (block) dmxSigioUnblock(); + if (block) + dmxSigioUnblock(); } static int dmxTranslateAndEnqueueExtEvent(DMXLocalInputInfoPtr dmxLocal, @@ -403,7 +422,8 @@ static int dmxTranslateAndEnqueueExtEvent(DMXLocalInputInfoPtr dmxLocal, XDeviceKeyEvent *ke = (XDeviceKeyEvent *)e; XDeviceMotionEvent *me = (XDeviceMotionEvent *)e; - if (!e) return -1; /* No extended event passed, cannot handle */ + if (!e) + return -1; /* No extended event passed, cannot handle */ if ((XID)dmxLocal->deviceId != ke->deviceid) { /* Search for the correct dmxLocal, @@ -414,7 +434,8 @@ static int dmxTranslateAndEnqueueExtEvent(DMXLocalInputInfoPtr dmxLocal, DMXInputInfo *dmxInput = &dmxInputs[dmxLocal->inputIdx]; for (i = 0; i < dmxInput->numDevs; i++) { dmxLocal = dmxInput->devs[i]; - if ((XID)dmxLocal->deviceId == ke->deviceid) break; + if ((XID)dmxLocal->deviceId == ke->deviceid) + break; } } @@ -463,9 +484,11 @@ static int dmxTranslateAndEnqueueExtEvent(DMXLocalInputInfoPtr dmxLocal, xv->valuator4 = ke->axis_data[4]; xv->valuator5 = ke->axis_data[5]; - if (block) dmxSigioBlock(); + if (block) + dmxSigioBlock(); dmxeqEnqueue(xE); - if (block) dmxSigioUnblock(); + if (block) + dmxSigioUnblock(); break; case XI_DeviceMotionNotify: @@ -568,7 +591,8 @@ static KeySym dmxKeyCodeToKeySym(DMXLocalInputInfoPtr dmxLocal, if (!dmxLocal || !dmxLocal->pDevice || !dmxLocal->pDevice->key) return NoSymbol; pKeySyms = &dmxLocal->pDevice->key->curKeySyms; - if (!pKeySyms) return NoSymbol; + if (!pKeySyms) + return NoSymbol; if (keyCode > pKeySyms->minKeyCode && keyCode <= pKeySyms->maxKeyCode) { DMXDBG2("dmxKeyCodeToKeySym: Translated keyCode=%d to keySym=0x%04x\n", @@ -617,8 +641,10 @@ static int dmxFixup(DevicePtr pDev, int detail, KeySym keySym) dmxLocal->pDevice->name); return NoSymbol; } - if (!keySym) keySym = dmxKeyCodeToKeySym(dmxLocal, detail); - if (keySym == NoSymbol) return detail; + if (!keySym) + keySym = dmxKeyCodeToKeySym(dmxLocal, detail); + if (keySym == NoSymbol) + return detail; keyCode = dmxKeySymToKeyCode(dmxLocalCoreKeyboard, keySym, detail); return keyCode ? keyCode : detail; From 3e482de7b145a5eed79b81c30c359fe43647824a Mon Sep 17 00:00:00 2001 From: Brian Date: Mon, 2 Apr 2007 15:38:15 -0600 Subject: [PATCH 11/15] checkpoint: more clean-up --- hw/dmx/input/dmxevents.c | 98 ++++++++++++++++------------------------ 1 file changed, 39 insertions(+), 59 deletions(-) diff --git a/hw/dmx/input/dmxevents.c b/hw/dmx/input/dmxevents.c index 17047f77a..288570df8 100644 --- a/hw/dmx/input/dmxevents.c +++ b/hw/dmx/input/dmxevents.c @@ -662,70 +662,56 @@ void dmxEnqueue(DevicePtr pDev, int type, int detail, KeySym keySym, { GETDMXINPUTFROMPDEV; xEvent xE; + DeviceIntPtr p = dmxLocal->pDevice; + int i, nevents, valuators[3]; + xEvent *events; DMXDBG2("dmxEnqueue: Enqueuing type=%d detail=0x%0x\n", type, detail); switch (type) { case KeyPress: case KeyRelease: - if (!keySym) keySym = dmxKeyCodeToKeySym(dmxLocal, detail); + if (!keySym) + keySym = dmxKeyCodeToKeySym(dmxLocal, detail); if (dmxCheckFunctionKeys(dmxLocal, type, keySym)) return; if (dmxLocal->sendsCore && dmxLocal != dmxLocalCoreKeyboard) xE.u.u.detail = dmxFixup(pDev, detail, keySym); - { - DeviceIntPtr p = dmxLocal->pDevice; - int i, nevents; - xEvent *events = Xcalloc(sizeof(xEvent), GetMaximumEventsNum()); - ErrorF("KEY %d\n", detail); - nevents = GetKeyboardEvents(events, p, type, detail); - for (i = 0; i < nevents; i++) - mieqEnqueue(p, events + i); - xfree(events); - return; - } - break; + + events = Xcalloc(sizeof(xEvent), GetMaximumEventsNum()); + ErrorF("KEY %d\n", detail); + nevents = GetKeyboardEvents(events, p, type, detail); + for (i = 0; i < nevents; i++) + mieqEnqueue(p, events + i); + xfree(events); + return; + case ButtonPress: case ButtonRelease: detail = dmxGetButtonMapping(dmxLocal, detail); - { - DeviceIntPtr p = dmxLocal->pDevice; - int i, nevents, valuators[3]; - xEvent *events = Xcalloc(sizeof(xEvent), GetMaximumEventsNum()); - valuators[2] = e->xbutton.button; - nevents = GetPointerEvents(events, p, type, detail, - POINTER_ABSOLUTE, - 0, /* first_valuator = 0 */ - 0, /* num_valuators = 0 */ - valuators); + events = Xcalloc(sizeof(xEvent), GetMaximumEventsNum()); + nevents = GetPointerEvents(events, p, type, detail, + POINTER_ABSOLUTE, + 0, /* first_valuator = 0 */ + 0, /* num_valuators = 0 */ + valuators); + for (i = 0; i < nevents; i++) + mieqEnqueue(p, events + i); + xfree(events); + return; - ErrorF("BUTTON %d, %d %d n=%d\n", - valuators[0], valuators[1], valuators[2], nevents); - - for (i = 0; i < nevents; i++) - mieqEnqueue(p, events + i); - xfree(events); - return; - } - break; case MotionNotify: - { - DeviceIntPtr p = dmxLocal->pDevice; - int i, nevents, valuators[3]; - xEvent *events = Xcalloc(sizeof(xEvent), GetMaximumEventsNum()); - valuators[0] = e->xmotion.x; - valuators[1] = e->xmotion.y; - valuators[2] = e->xmotion.state; - nevents = GetPointerEvents(events, p, type, detail, - POINTER_ABSOLUTE, 0, 3, valuators); - ErrorF("MOTION %d, %d n = %d\n", valuators[0], valuators[1], nevents); - for (i = 0; i < nevents; i++) - mieqEnqueue(p, events + i); - xfree(events); - return; - } - break; - /* Always ignore these events */ + events = Xcalloc(sizeof(xEvent), GetMaximumEventsNum()); + valuators[0] = e->xmotion.x; + valuators[1] = e->xmotion.y; + valuators[2] = e->xmotion.state; + nevents = GetPointerEvents(events, p, type, detail, + POINTER_ABSOLUTE, 0, 3, valuators); + for (i = 0; i < nevents; i++) + mieqEnqueue(p, events + i); + xfree(events); + return; + case EnterNotify: case LeaveNotify: case KeymapNotify: @@ -754,25 +740,19 @@ void dmxEnqueue(DevicePtr pDev, int type, int detail, KeySym keySym, return; } +#if 00 /* dead code? */ memset(&xE, 0, sizeof(xE)); xE.u.u.type = type; xE.u.u.detail = detail; xE.u.keyButtonPointer.time = GetTimeInMillis(); #ifdef XINPUT - if (!dmxLocal->sendsCore) dmxEnqueueExtEvent(dmxLocal, &xE, block); + if (!dmxLocal->sendsCore) + dmxEnqueueExtEvent(dmxLocal, &xE, block); else #endif -#if 00 /*BP*/ dmxeqEnqueue(&xE); -#else - /* never get here! */ - if (0) { - DeviceIntPtr p = dmxLocal->pDevice; - ErrorF("enque %d\n", type); - mieqEnqueue(p, &xE); - } -#endif +#endif /*00*/ } /** A pointer to this routine is passed to low-level input drivers so From 8d8bc8927760fad631bef83fa2841b455ff6d511 Mon Sep 17 00:00:00 2001 From: Brian Date: Mon, 2 Apr 2007 16:21:57 -0600 Subject: [PATCH 12/15] fix formatting --- hw/dmx/input/dmxcommon.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/hw/dmx/input/dmxcommon.c b/hw/dmx/input/dmxcommon.c index 278a74e71..1dcc1e9e4 100644 --- a/hw/dmx/input/dmxcommon.c +++ b/hw/dmx/input/dmxcommon.c @@ -241,13 +241,15 @@ void dmxCommonKbdGetMap(DevicePtr pDev, KeySymsPtr pKeySyms, CARD8 *pModMap) /* Compute pModMap */ modifier_mapping = XGetModifierMapping(priv->display); - for (i = 0; i < MAP_LENGTH; i++) pModMap[i] = 0; + for (i = 0; i < MAP_LENGTH; i++) + pModMap[i] = 0; for (j = 0; j < 8; j++) { int max_keypermod = modifier_mapping->max_keypermod; for (i = 0; i < max_keypermod; i++) { CARD8 keycode = modifier_mapping->modifiermap[j*max_keypermod + i]; - if (keycode) pModMap[keycode] |= 1 << j; + if (keycode) + pModMap[keycode] |= 1 << j; } } XFreeModifiermap(modifier_mapping); @@ -611,6 +613,7 @@ void dmxCommonSaveState(pointer private) &priv->dmxLocal->kctrl); priv->savedModMap = XGetModifierMapping(priv->display); + modmap = XNewModifiermap(0); XSetModifierMapping(priv->display, modmap); if (dmxInput->scrnIdx != -1) @@ -627,8 +630,10 @@ void dmxCommonRestoreState(pointer private) int retcode = -1; CARD32 start; - if (dmxInput->console) priv = dmxInput->devs[0]->private; - if (!priv->stateSaved) return; + if (dmxInput->console) + priv = dmxInput->devs[0]->private; + if (!priv->stateSaved) + return; priv->stateSaved = 0; DMXDBG0("dmxCommonRestoreState\n"); @@ -645,7 +650,8 @@ void dmxCommonRestoreState(pointer private) CARD32 tmp; retcode = XSetModifierMapping(priv->display, priv->savedModMap); - if (retcode == MappingSuccess) break; + if (retcode == MappingSuccess) + break; if (retcode == MappingBusy) dmxLogInput(dmxInput, "Keyboard busy, waiting\n"); else From e44f106ffc796c025abdfb66717c06db8b12b4e4 Mon Sep 17 00:00:00 2001 From: Brian Date: Mon, 2 Apr 2007 16:26:15 -0600 Subject: [PATCH 13/15] clean-up, debug code --- hw/dmx/input/dmxevents.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/hw/dmx/input/dmxevents.c b/hw/dmx/input/dmxevents.c index 288570df8..e4d556b07 100644 --- a/hw/dmx/input/dmxevents.c +++ b/hw/dmx/input/dmxevents.c @@ -109,11 +109,11 @@ static int dmxCheckFunctionKeys(DMXLocalInputInfoPtr dmxLocal, else if (dmxLocal->pDevice->key) state = dmxLocal->pDevice->key->state; - DMXDBG3("dmxCheckFunctionKeys: keySym=0x%04x %s state=0x%04x\n", + ErrorF/*DMXDBG3*/("dmxCheckFunctionKeys: keySym=0x%04x %s state=0x%04x\n", keySym, type == KeyPress ? "press" : "release", state); if ((state & (ControlMask|Mod1Mask)) != (ControlMask|Mod1Mask)) - return 0; + return 0; switch (keySym) { case XK_g: @@ -679,7 +679,7 @@ void dmxEnqueue(DevicePtr pDev, int type, int detail, KeySym keySym, xE.u.u.detail = dmxFixup(pDev, detail, keySym); events = Xcalloc(sizeof(xEvent), GetMaximumEventsNum()); - ErrorF("KEY %d\n", detail); + ErrorF("KEY %d sym %d\n", detail, (int) keySym); nevents = GetKeyboardEvents(events, p, type, detail); for (i = 0; i < nevents; i++) mieqEnqueue(p, events + i); @@ -719,12 +719,12 @@ void dmxEnqueue(DevicePtr pDev, int type, int detail, KeySym keySym, * modifier map on the backend/console * input device so that we have complete * control of the input device LEDs. */ - ErrorF("Enter/Leave/Keymap/Mapping\n"); return; default: #ifdef XINPUT if (type == ProximityIn || type == ProximityOut) { - if (dmxLocal->sendsCore) return; /* Not a core event */ + if (dmxLocal->sendsCore) + return; /* Not a core event */ break; } #endif From 11797ffdcc22160317a5ebbc9291472570a51c6d Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 2 Apr 2007 18:21:58 -0700 Subject: [PATCH 14/15] Move modes/ debugging output under Option "ModeDebug" in the Device section. --- hw/xfree86/doc/man/xorg.conf.man.pre | 4 ++ hw/xfree86/modes/xf86Crtc.c | 58 ++++++++++++++++++---------- hw/xfree86/modes/xf86Crtc.h | 7 ++++ 3 files changed, 49 insertions(+), 20 deletions(-) diff --git a/hw/xfree86/doc/man/xorg.conf.man.pre b/hw/xfree86/doc/man/xorg.conf.man.pre index cc60d0754..19315c024 100644 --- a/hw/xfree86/doc/man/xorg.conf.man.pre +++ b/hw/xfree86/doc/man/xorg.conf.man.pre @@ -958,6 +958,10 @@ the driver-specific documentation recommends it. This optional entry specifies the pixel clock frequency that is used for the regular text mode. The frequency is specified in MHz. This is rarely used. +.TP 7 +.BI "Option \*qModeDebug\*q \*q" boolean \*q +Enable printing of additional debugging information about modesetting to +the server log. .ig .TP 7 This optional entry allows an IRQ number to be specified. diff --git a/hw/xfree86/modes/xf86Crtc.c b/hw/xfree86/modes/xf86Crtc.c index 7d86b6606..32bdcba11 100644 --- a/hw/xfree86/modes/xf86Crtc.c +++ b/hw/xfree86/modes/xf86Crtc.c @@ -377,6 +377,15 @@ static OptionInfoRec xf86OutputOptions[] = { {-1, NULL, OPTV_NONE, {0}, FALSE }, }; +enum { + OPTION_MODEDEBUG, +}; + +static OptionInfoRec xf86DeviceOptions[] = { + {OPTION_MODEDEBUG, "ModeDebug", OPTV_STRING, {0}, FALSE }, + {-1, NULL, OPTV_NONE, {0}, FALSE }, +}; + static void xf86OutputSetMonitor (xf86OutputPtr output) { @@ -1160,8 +1169,6 @@ xf86SortModes (DisplayModePtr input) return output; } -#define DEBUG_REPROBE 1 - void xf86ProbeOutputModes (ScrnInfoPtr scrn, int maxX, int maxY) { @@ -1330,7 +1337,8 @@ xf86ProbeOutputModes (ScrnInfoPtr scrn, int maxX, int maxY) if (mode->status == MODE_OK) mode->status = (*output->funcs->mode_valid)(output, mode); - xf86PruneInvalidModes(scrn, &output->probed_modes, TRUE); + xf86PruneInvalidModes(scrn, &output->probed_modes, + config->debug_modes); output->probed_modes = xf86SortModes (output->probed_modes); @@ -1363,17 +1371,17 @@ xf86ProbeOutputModes (ScrnInfoPtr scrn, int maxX, int maxY) output->initial_rotation = xf86OutputInitialRotation (output); -#ifdef DEBUG_REPROBE - if (output->probed_modes != NULL) { - xf86DrvMsg(scrn->scrnIndex, X_INFO, - "Printing probed modes for output %s\n", - output->name); - } else { - xf86DrvMsg(scrn->scrnIndex, X_INFO, - "No remaining probed modes for output %s\n", - output->name); + if (config->debug_modes) { + if (output->probed_modes != NULL) { + xf86DrvMsg(scrn->scrnIndex, X_INFO, + "Printing probed modes for output %s\n", + output->name); + } else { + xf86DrvMsg(scrn->scrnIndex, X_INFO, + "No remaining probed modes for output %s\n", + output->name); + } } -#endif for (mode = output->probed_modes; mode != NULL; mode = mode->next) { /* The code to choose the best mode per pipe later on will require @@ -1382,9 +1390,8 @@ xf86ProbeOutputModes (ScrnInfoPtr scrn, int maxX, int maxY) mode->VRefresh = xf86ModeVRefresh(mode); xf86SetModeCrtc(mode, INTERLACE_HALVE_V); -#ifdef DEBUG_REPROBE - xf86PrintModeline(scrn->scrnIndex, mode); -#endif + if (config->debug_modes) + xf86PrintModeline(scrn->scrnIndex, mode); } } } @@ -1479,6 +1486,15 @@ xf86InitialConfiguration (ScrnInfoPtr scrn, Bool canGrow) int width; int height; + /* Set up the device options */ + config->options = xnfalloc (sizeof (xf86DeviceOptions)); + memcpy (config->options, xf86DeviceOptions, sizeof (xf86DeviceOptions)); + xf86ProcessOptions (scrn->scrnIndex, + scrn->options, + config->options); + config->debug_modes = xf86ReturnOptValBool (config->options, + OPTION_MODEDEBUG, FALSE); + if (scrn->display->virtualX) width = scrn->display->virtualX; else @@ -1962,10 +1978,12 @@ xf86OutputSetEDID (xf86OutputPtr output, xf86MonPtr edid_mon) output->MonInfo = edid_mon; - /* Debug info for now, at least */ - xf86DrvMsg(scrn->scrnIndex, X_INFO, "EDID for output %s\n", output->name); - xf86PrintEDID(edid_mon); - + if (config->debug_modes) { + xf86DrvMsg(scrn->scrnIndex, X_INFO, "EDID for output %s\n", + output->name); + xf86PrintEDID(edid_mon); + } + /* Set the DDC properties for the 'compat' output */ if (output == config->output[config->compat_output]) xf86SetDDCproperties(scrn, edid_mon); diff --git a/hw/xfree86/modes/xf86Crtc.h b/hw/xfree86/modes/xf86Crtc.h index 42daf6079..030f6bf3a 100644 --- a/hw/xfree86/modes/xf86Crtc.h +++ b/hw/xfree86/modes/xf86Crtc.h @@ -552,6 +552,13 @@ typedef struct _xf86CrtcConfig { CARD8 *cursor_image; Bool cursor_on; CARD32 cursor_fg, cursor_bg; + + /** + * Options parsed from the related device section + */ + OptionInfoPtr options; + + Bool debug_modes; } xf86CrtcConfigRec, *xf86CrtcConfigPtr; extern int xf86CrtcConfigPrivateIndex; From a39f297ada4fa87c858395ae2aacefac5f8fba05 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Mon, 2 Apr 2007 14:15:36 -0700 Subject: [PATCH 15/15] Don't erase current crtc for outputs on CloseScreen Erasing this variable causes some outputs (SDVO on intel) to fail to be correctly reset at server reset time. (cherry picked from commit 56262a4ee943f328d089a8eb4aa70b9a4bd5d135) --- hw/xfree86/modes/xf86Crtc.c | 1 - 1 file changed, 1 deletion(-) diff --git a/hw/xfree86/modes/xf86Crtc.c b/hw/xfree86/modes/xf86Crtc.c index 32bdcba11..0fe03d372 100644 --- a/hw/xfree86/modes/xf86Crtc.c +++ b/hw/xfree86/modes/xf86Crtc.c @@ -598,7 +598,6 @@ xf86CrtcCloseScreen (int index, ScreenPtr screen) { xf86OutputPtr output = config->output[o]; - output->crtc = NULL; output->randr_output = NULL; } for (c = 0; c < config->num_crtc; c++)