PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

Touchscreen CPU load on a716

After some initial testing I'm seeing a big hit on the a716 when the touchscreen is in use. Around a 50% drop in FPS. Can anyone else verify this? Has anyone found a solution to this performance issue that basically all Pocket PCs exhibit? Supposedly Tomb Raider does not slow down when the stylus is in use. This could be the result of it already running at a low FPS, an inaccurate (or purposefully fudged) FPS counter, or they actually identified and found a way to correct the problem.

Here are existing threads on the issue:
http://www.pocketmatrix.com/forums/view ... hp?t=10065
http://www.pocketmatrix.com/forums/view ... hp?t=13790
http://www.pocketmatrix.com/forums/view ... hp?t=13497

Dan East
I used to see a pretty big hit on my Dell Axim, but not anything like 50%... more like 20%. I did, however, notice a change when I reworked my 'main loop'. I no longer use PeekMessage, rather I use GetMessage. I use SetTimer to make sure I get enough messages to maintain 40fps... the rest of the time the OS can back off and reduce power usage. This greatly increased battery life. In addition, I noticed that it decreased the hit that the stylus imparts... it is now no more than 10%. I don't know if this is because the game is limited to 40fps, or if using GetMessage allows other parts of the OS to have more time to do whatever and service the touchscreen in a more effcient manner.

I would do more serious testing, however, I need to get our pool game released before some of the email threats are made good upon. :)

Cheers,
rcp
I'm seeing this regardless of FPS. If the FPS is 60 then it will drop to 30. If it is 15 it will drop to 8.

I am using PeekMessage, followed by TranslateMessage and DispatchMessage if there was a queued message. I'll try GetMessage tomorrow and see if that helps.

Dan East
OK, I hope what I said was clear... my reason for using GetMessage over PeekMessage was to reduce power usage. This was based on the following tidbits I found in MSVCe Help...

If you port an application to a Windows CE-based platform that operates on batteries you need to consider the limited power resources on the Windows CE-based device. Avoid cycling the CPU unnecessarily by calling energy-consuming functions such as PeekMessage.


and...

Use PeekMessage carefully, because it does not block the waiting for a message event, which enables an application to continue running regardless of messages in the queue. In a Windows CE–based application, if an application does not block the waiting for a message or some other event, the kernel cannot shift the CPU into low-power mode, which can drain the device batteries quickly.


The last of these I really didn't believe, as I couldn't imagine how the kernel could possibly put the CPU into low-power mode whilst I am trying to get the damn CPU to render 3d graphics. Apparently, I was wrong, because this 'fix' improved power usage by 3x or more.

I've written and worked on embedded OSes in the past, and I know how certain 'code paths' are structured that are considered 'always gonna happen' and what happens when they don't!! My guess is that GetMessage does some 'other things' that really need to be done that PeekMessage should have done. Thus it may well be a design or implementation bug.

Anyway, using GetMessage got our power usage down to very reasonable levels and seemed to address FPS issues as well. I thought it would make the game jerky or slower, but in fact it made it smoother and at least appears to be faster.

Let me know what you find!!

Cheers,

rcp
rcp: I just changed my app class to work with GetMessage as you described. However, just wondering - what happens if it takes longer than the interval between each WM_TIMER msg to process the frame? Do the messages queue up?
FYI: I was previously using PeekMessage (..., PM_NOREMOVE) + GetMessage in GapiDraw but experienced issues on some PocketPC 2000 devices when minimizing / restoring the application. Not all messages were caught. After switching to PeekMessage (..., PM_REMOVE) and translate/dispatch the problem was solved.

So please take caution when using GetMessage if you want your app to run reliably on all older Pocket PCs...
joshbu [MSFT] · 13 Apr 2004, 17:16 UTC
I took a look in the message queing code. Each message que in CE has a an event associated with it that gets signaled when a new message has been entered into the que. GetMessage's primary difference from PeekMessage is that it calls WaitForSingleObject on that event.

All of the low power magic is happening in the WaitForSingleObject routine.

So, you should be able to reap low power goodness with either loop, so long as when you use PeekMessage, you still give some cycles back to the OS in some way: a Wait* or a Sleep.

Now, I'm afraid that I can't answer why the touch driver performance would improve in that case. Perhaps it is multithreaded and giving up a few cycles allows the touch worker threads to do work in a more timely fasion? <shrugs>
I don't see how that would help battery life either, except that your game is not requiring 100% CPU and you are not Sleeping away the uneeded cycles.

Dan East
joshbu [MSFT] · 13 Apr 2004, 18:04 UTC
addendum:

I ran into on the BSP guys in the hall, and here's his take:

What's likely happening is that the touch sample rate is too high, and the touch driver is flooding gwes with touch events. Now, if you access the message que "slower" (like via a GetMessage, where there's thread scheduling going on,) that gives gwes the opportunity to "merge" the touch event with prior events still sitting in the que.
Okay, I've tried several incarnations without any change in FPS:

PeekMessage(&msg;, NULL, 0, 0, PM_REMOVE);
PeekMessage(&msg;, hWnd, 0, 0, PM_REMOVE);
GetMessage(&msg;, NULL, 0, 0);
GetMessage(&msg;, hWnd, 0, 0);

Again, FPS is halved when the stylus is down, regardless of how high or low the FPS is when the stylus is not down.

RCP, I re-read your post. I see what they are saying. That suggestion is purely for standard gui / event driven applications like DEXplor, or games like Solitaire, etc. Those apps basically don't do anything until the system sends it messages, so while they are waiting they should be Sleeping or letting the message retrieval call block via GetMessage.

Dan East
Dan:
Sorry, I was hoping to make that clear. In our game (Virtual Pool) nothing happens until the player does something. When they aim, the 3D scene updates, stroke the cue, the cue draws, hit a ball, the balls move. Thus a large part of the time the game doesn't really do anything. However, you can't just wait on the user because during animation the user isn't doing anything.. thus the need for WM_TIMER. When I used PeekMessage (obviously) the game ran full blast even when not required. It didn't draw anything or do anything useful, but the CPU load was 100%... just a lot of nothing, which unfortunately draws power. I didn't want to use Sleep, so I left it up to GetMessage to do the work. I also checked the CE source and saw the WaitForSingleObject and knew that would effectively let the CPU sleep and wake up more like an ISR driven system. All that said, I would use the same approach in any game. Low power operation is law on mobile devices and given the CE architecture, it appears GetMessage is the best way of allowing CE to manage its power usage.

Unfortunately, this doesn't seem to help the touchscreen hit on your device. This pretty much sounds like a configuration problem or bug in the touchscreen driver. Possibly just a really crappy touchscreen. The decrease I saw is probably just related to my game being much more thread friendly than when I used PeekMessage.

J. Edwards:
Good question. I've seen my app run over the 40fps limit at times, so I am assuming that WM_TIMER messages were queued when it was running slower than 40fps and the frame rate increase is the queued messages comming out. I probably should verify this.

Johan:
I tried PeekMessage followed by GetMessage if there was something there and I too missed messages. This seemed like a logical thing to do, but it really, really didn't work well. When I switched to just GetMessage, everything seemed to work just fine.

In general:
Use PeekMessage if you are going to handle idle time yourself by a Wait* or Sleep. Use GetMessage if you would like the OS to do it for you. In that case, setup a timer to make sure you get enough control to render at the desired frame rate. Personally, I had lots of problems with Sleep and thus I chose to use GetMessage and let WinCE work it out.

Cheers,

rcp
I tried PeekMessage followed by GetMessage if there was something there and I too missed messages. This seemed like a logical thing to do, but it really, really didn't work well. When I switched to just GetMessage, everything seemed to work just fine.


Is there a way to clear the whole message queue? It seems to me, that if the code is taking longer than the timeframe in between consecutive WM_TIMER events, it is necessary to flush the message cueue.

In any case, GetMessage saves power only if WaitForSingleObject blocks the thread, that is when the "queue-not-empty" event is not yet signaled when GetMessage is called.
rcp: have you done any tests to see if the WM_TIMER msgs queue up?

joshbu: you mentioned events being "merged" - does this apply to WM_TIMER messages also?
joshbu [MSFT] · 16 Apr 2004, 06:42 UTC
No WM_TIMER messages aren't merged. It's a mouse move thing. It's the effect you get when you pull a stylus or mouse across a paint program really fast on a slow machine and instead of getting the exact path you traced, you get line segments. The paint program can't service the mouse move events as fast as they are being generated, hence they are merged. I was really grasping at straws to explain the behavoir rcp had originally reported.

I think rcp is right: the touch panel sample rate is cranked way up (maybe for handwriting recognition?) or the driver is inefficent or both. I don't know how to mitigate that.
Dumb question, have any of you actually loaded Tomb Raider on one of these devices such as the a716 and verified that Tomb Raider doesn't suffer from this performance hit?

I know that TR costs $30 and you can't install it on multiple devices, but $30 isn't much to spend when you're talking about doing a lot of investigative work that may not even be necessary.
Has anybody tried using GetCursorPos directly rather than windows messages?
I am having some trouble trying to get reliable FPS using GetMessage and WM_TIMER. I remember encountering WM_TIMER issues a while back in Delphi and found out that it's really only reliable to about 50ms and even then is not all that accurate. The windows help states that WM_TIMER messages are only sent if no other messages are in the queue. This is probably not a big deal as performance seems smooth anyhow, but when trying to lock at 40fps for example I only get about 38 but not because it's taking too long to process each frame - if I lock to 20 fps I get an actual of 15-17 etc. I'm averaging over 10 frames to get that result, and in general it takes between 1050ms and 1500ms to draw 10 frames.
andyclap wrote:Has anybody tried using GetCursorPos directly rather than windows messages?


Wouldn't the window messages still be sent even though you'd be ignoring them? Or is there a way to disable them?
joshbu [MSFT] · 19 Apr 2004, 21:15 UTC
j.edwards wrote:I am having some trouble trying to get reliable FPS using GetMessage and WM_TIMER. I remember encountering WM_TIMER issues a while back in Delphi and found out that it's really only reliable to about 50ms and even then is not all that accurate. The windows help states that WM_TIMER messages are only sent if no other messages are in the queue. This is probably not a big deal as performance seems smooth anyhow, but when trying to lock at 40fps for example I only get about 38 but not because it's taking too long to process each frame - if I lock to 20 fps I get an actual of 15-17 etc. I'm averaging over 10 frames to get that result, and in general it takes between 1050ms and 1500ms to draw 10 frames.


I think once you start using GetMessage, (and implicitly WaitForSingleObject,) you are at the mercy of the kernel's thread scheduler. Only a few more threads on the system using their entire quanta could throw you off your "locked" FPS.

And yes, WM_TIMER is not espically precise, because it depeneds on a bunch of system wide variables. If a bunch of messages are coming from somewhere (touch screen, for example,) then you might get to your WM_TIMER late. WM_TIMER messages are prioritized last in the message queue. I've never heard the 50ms value.

Windows CE does have a rather precise "Sleep" function (1ms or better) which might get you better, but still not perfect results. Other API with good potential for game loops: MsgWaitForMultipleObjects.
Yes, WM_TIMER is really low priority and you can't use it alone to lock a frame rate. You can use it to make sure you get at least that and then throttle more precisely. Other messages do get sent ahead of WM_TIMER, but most messages mean that my app is going to draw. Thus there are two ways my app draws.. first, it gets an input message that requires the screen to be updated.. thus I get immediate update. Second, there are no other messages so the WM_TIMER filters its way through and I draw the screen. Thus, when the app is idle (that is, from the user input point of view... animation may be occuring) then the frame rate is limited, but when the user is interacting, the frame rate increases to match the input. Respond to the user, limit everything else.
Obviously, if you SetTimer(1001,2,NULL), then you get a flood of WM_TIMER and you kill the battery... so what you are happy limiting the frame rate to is what saves battery. In addition, I use dirty rectangles so that if *nothing* changes, the nothing is drawn, regardless of the WM_TIMER message.
Dan: have you come across any solution yet?

I am using GetMessage as described, but I just got the following comment for my game which is using the stylus to control a unit:

on a toshiba e750, I get from 37 FPS down to 23 FPS when the stylus is down.
If it were window messages causing the problem, then wouldn't a stationary sytlus not send any messages? Since it's already down, not moved, and has not been lifted?
Not sure fast_rx, I've only got a 1910 and 1940 to test on and they don't have the problem. What you say makes sense though.
I modified the message handler using the MsgFilterMin and Max (i.e. if (::PeekMessage( &msg, 0, WM_KEYFIRST , WM_KEYLAST , PM_REMOVE )))
So that everything but keys should be ignored and touching the screen still drops the framerate.

I also took a look to see if only WM_LBUTTONDOWN, WM_MOUSEMOVE, and WM_LBUTTONUP were being sent and that seems to be the case.

I guess the next step is to make an app that does nothing but loop, and time it with the stylus up and down. No messages, timers, anything but a loop. If that is affected, then there's not much you could do to fix it.
I verified some time ago that when the stylus is stationary, no messages are sent to the application at all, yet the FPS is still affected. So the problem has nothing to do with my application, or the sending / processing of messages.

No, I've not found a fix.

Dan East
Surely it's just the device barfing on a load of interrupts being generated by the touchscreen? (I.e. a hardware/driver issue that you can do nothing about).

We've been over this before, at least, <a href="http://www.pocketmatrix.com/forums/viewtopic.php?t=10065&postdays;=0&postorder;=asc&start;=15">here</a>. If something (like the aforementioned Tomb Raider) didn't suffer a degredation then it's something "fixable" within an application. As Digby said, the sure way to find out is to try..
refractor: ya, we covered all of this before, however, as you say... the 'new' part is that Tomb Raider doesn't have the same slowdown on the same PPC. Did I read that Dan verified this? If Dan ran both and saw these results with his very own eyes, then I'd go straight to hack mode and figure out what TombRaider is doing. (well, after I release VirtualPool). :)

-rcp
I have been testing my game using the GetMessage/WM_TIMER technique as described in this post and found that if I just left the game run for an hour or two it would gradually slow down from 40fps to about 10fps and I imagine if I left it running it would get slower still.

After changing back to PeekMessage, everything is fine. Has anyone else experience the same thing?
We've been over this before, at least, here. If something (like the aforementioned Tomb Raider) didn't suffer a degredation then it's something "fixable" within an application. As Digby said, the sure way to find out is to try...


There is maybe an undocumented device driver feature, which either is able to disable paticular device interrupts or just dismiss them fast they arrive. If this is the case, it is done by DeviceIoControl calls.
j.edwards:
I let our game sit for a full day, checking every couple of hours (sometimes up to 8 hours) and I never found any slowdown. I'd really like to know just why you were seeing the slowdown in case it comes up for me somewhere down the line.

Cheers,

rcp
rcp: sorry to worry you, I've just traced it back to a bug that I happened to have fixed at the same time I swapped back.
hehe, no problem. probably was a *good thing*, as i've been playing the damn thing off and on nearly 30 hours now. nice to know that it is solid.
We are getting ready to release very, very soon... so I am in full panic mode. ;)

Cheers,
rcp
In WM2003 SE the problems seem to be less visible.

It's still there, but now Snes games a playable under Morphgear using the virtula gamepad.

I have to try TombRaider, but with the old WM2003, I'got a slowdow, light but visible.

Ulf
I have this same problem as I'm sure every other PPC game does. On my e335 I see a drop from 34 to 20 fps, and on my Axim I go from 90 to 65, although at lower fps it drops from 16 to 15 fps. So if Tomb Raider is running very slow perhaps the drop is still there its just not noticable. Has anyone tried emailing the dev group or company that did TR to see if they did do anything?
I would be surprised if Tomb Raider did anything special. They probably just fixed the frame rate at something low so that the speed hit wouldn't be noticeable.
Just a thought - came across this standard touchpanel driver function
http://msdn.microsoft.com/library/defau ... frame=true

But I've not investigated whether it's possible to use it from an application or not, or indeed if it actually does anything.
Anybody care to try it out?
That's interesting. I checked and those registry entries don't exist on my a716.

Dan East
this may be the fix, dan you might not see the reg entries because you have to call the function first. although its not much help because if you have a real time game with fast action you probably need a high resolution sample rate, which is what is eating the cpu, but if you only need 'button hits' on the touchscreen then setting it to low or normal priority may help, only one way to find out...
Facinating. Im going to look at gfDoom when I get home, See if that has the same problem.

If it does, i've never noticed it before.

Has anyone noticed also that the touch screen is quite inaccurate on an Ipaq 1910? Coordinate for top right is 239,0 and bottom right is 235,319. Screen recently recalibrated.
joshbu [MSFT] · 02 Aug 2004, 20:32 UTC — TouchPanelSetMode
This is a DDI implemented by the touch driver. It's not a function that's meant to be called by an application. (ie. I don't think coredll.dll exposes this...)
Wow Guys It's incredible, the answer about what everybody search is Available Here:

http://www.biplip.com/default.aspx?mid= ... ItemId=258


Another more interresting is:

http://sourceforge.net/projects/openwince/
or
http://openwince.sourceforge.net/drivers.php


Now we can work with Touch Panel!!

Schtruck.
It looks like Platform Builder is required to build that first project. I'm at least missing these headers:

nkintr.h
tchddi.h
tchddsi.h

Dan East
Dan, i've just discovered that touch.dll exist too in our pocketPC, you can see it using the WIndows CE remote Process viewer and watching the process gwes.exe... this Process run Thread linked with touch.dll, ikbdmouse.dll,ddi.dll, core.dll which are in \windows\

So now i'm curently trying to link using LoadLibrary etc to access ..

News soon...

Schtruck
Reading some of the articles Touch/GWES gets an improved accuracy for stylus input, factor 4. This is intended for handwriting recognition.

I've long wanted to make a sub pixel brush on a simple scribble pad using better than pixel resolution from stylus input.

By this or any other way, more than curve smoothing pixel points, could you get at the factor 4 co-ordinates.
Good , i have successfully Extracted touch.dll from my rom.

here is exported function from it, to be continue....
[/img]
Attachments:
touch.jpg
ok in TouchPanelSetmode on msdn they said that:

Remarks
High and normal IST thread priorities are read from the registry. The high priority value is set by HKEY_LOCAL_MACHINE\Drivers\BuiltIn\Touch\HighPriority256. The normal priority value is set by HKEY_LOCAL_MACHINE\Drivers\BuiltIn\Touch\Priority256. By default, high and normal priority settings are both 109.


SO this mean that with Have first to Disable Panel, Set both Registry To lower Priority and SetMode to normal Priority and low sample rate (TPSM_SAMPLERATE_LOW) then re-enable Panel, and this should be OK.

Ok i try to Link touch.dll, i'll tell you more!

Schtruck/
Guys that work!!!!!

Now i try to tune a bit to find the good Values...!!!
What device are you using? Did those Registry values already exist or did you create them?

Dan East
you have to create them
Hello guys,

Is it possible to know if this problem is now considered as "solved" ?

And if yes, could someone post less "elliptical" informations about it ?
Anyone with access to Tchddi.h care to provide the values for the following:

TPSM_SAMPLERATE_HIGH
TPSM_SAMPLERATE_LOW
TPSM_PRIORITY_HIGH_ID
TPSM_PRIORITY_NORMAL_ID

Thanks.

Dan East
Just by changing the thread priority of the touchpad driver I was able to get a 10% increase in performance. So if schtruck was able to boost performance more than that it was from reducing the sample rate.

The default priority is 109. If set to 90 or lower my engine runs 10% faster (when the stylus is down).

Priority 109
Stylus Up: 57 fps
Stylus Dn: 34 fps

Priority between 1 and 90
Stylus Up: 57 fps
Stylus Dn: 38 fps

I did not test values between 90 and 109.

Dan East
So is this a solution that can be applied at runtime? (in which case my next question is how?)

Or does it require a reset of the device?
schtruck wrote:Guys that work!!!!!


After re-reading all your posts I can't tell if you are referring to just being able to load and call into touch.dll, or that you actually increased performance substantially on the a716.

I'm also accessing the DLL, and TouchPanelSetMode doesn't seem to do anything. It requires a second parameter, a pointer to memory. I do not understand what that is supposed to point to, so I'm passing NULL. TouchPanelSetMode returns success, so it appears that's okay?

Also in your post you talk about disabling, setting the mode, then enabling the touch driver. In order to enable you have to pass a function that is called when screen events occur. I assume that is a routine in gwes that then dispatches those events as windows messages. Since I don't know the address of that function I cannot call TouchPadEnable. If I pass NULL for the proc then then my app will crash the first time the screen is touched, and the touchpad will not function at all until I reset.

So in short, did you actually get it to work? :)

Dan East
Thierry wrote:So is this a solution that can be applied at runtime? (in which case my next question is how?)

Or does it require a reset of the device?


According to the touch driver source code I'm looking at, found on one of the pages referenced earlier in this thread, the registry values are loaded when TouchPanelEnable is called. So if we can't figure out how to call that routine (specifically what callback function to pass) then a soft reset is required.

Dan East
Another note.

touch.dll doesn't actually do anything when TouchPanelSetMode(TPSM_SAMPLERATE_LOW_ID | TPSM_SAMPLERATE_HIGH_ID) is called - it just passes that on to DdsiTouchPanelSetMode. So that lower-level driver is what needs to be reset, not touch.dll. DdsiTouchPanelEnable does not take any parameters, so if that routine can be found (what DLL is it in?), perhaps the driver can be reset directly.

However that would not be thread-safe, which could lead to potential coincidental issues. All the thread code is handled in touch.dll.

Dan East
Hey Dan, what's up? Not much, just working on this touchpad issue. Cool. So what have you found out? Well, potentially bad news. If TouchPanelGetDeviceCaps isn't returning nonsensical values then it appears the a716 touchpad driver only has a single sampling rate:

TPDC_SAMPLE_RATE {
SamplesPerSecondLow 100
SamplesPerSecondHigh 100
CurrentSampleRateSetting 0 (indicates SamplesPerSecondLow is being used)
}

If that is accurate (and the values appear valid) then changing the rate with TouchPanelSetMode won't accomplish anything either way.

So the best we can do is reduce the priority of the driver's thread, gaining about 10%. I'm anxious to hear what Schtruck figured out.

Dan East
Here's source code to call into touch.dll. The code as provided doesn't work, because pTouchPanelEnable requires a callback routine which then dispatches all screen events to the appropriate windows.

It is useful for querying the device caps, as well as completely disabling the touch pad until the device is reset. Yes, when the touchpad is disabled I experience no drop in FPS when the screen is touched. :)

Code:

#define TPSM_SAMPLERATE_HIGH_ID 0x00
#define TPSM_SAMPLERATE_LOW_ID 0x01
#define TPSM_PRIORITY_HIGH_ID 0x02
#define TPSM_PRIORITY_NORMAL_ID 0x04


#define TPDC_SAMPLE_RATE_ID 0
struct TPDC_SAMPLE_RATE
{
INT SamplesPerSecondLow;
INT SamplesPerSecondHigh;
INT CurrentSampleRateSetting; // 0 => Low, 1 => High
};

typedef BOOL (*TOUCHPANELSETMODE)(INT iIndex,LPVOID lpInput);
typedef VOID (*TOUCHPANELDISABLE)();
typedef BOOL (*TOUCHPANELENABLE)(LPVOID);
typedef BOOL (*TOUCHPANELGETDEVICECAPS)(INT iIndex, LPVOID lpOutput);

BOOL SetTouchMode(BOOL bPerformanceMode) {
HINSTANCE hTouch=LoadLibrary(_T("touch.dll"));
if (!hTouch)
return FALSE;

TOUCHPANELSETMODE pTouchPanelSetMode=(TOUCHPANELSETMODE)GetProcAddress(hTouch, _T("TouchPanelSetMode"));
TOUCHPANELENABLE pTouchPanelEnable=(TOUCHPANELENABLE)GetProcAddress(hTouch, _T("TouchPanelEnable"));
TOUCHPANELDISABLE pTouchPanelDisable=(TOUCHPANELDISABLE)GetProcAddress(hTouch, _T("TouchPanelDisable"));
TOUCHPANELGETDEVICECAPS pTouchPanelGetDeviceCaps=(TOUCHPANELGETDEVICECAPS)GetProcAddress(hTouch, _T("TouchPanelGetDeviceCaps"));

if (!pTouchPanelSetMode || !pTouchPanelEnable || !pTouchPanelDisable || !pTouchPanelGetDeviceCaps) {
FreeLibrary(hTouch);
return FALSE;
}

//Query sample rate
TPDC_SAMPLE_RATE sr;
if (pTouchPanelGetDeviceCaps(TPDC_SAMPLE_RATE_ID, &sr;)) {
//Success
}

//Attempt to set sample rate
pTouchPanelDisable();
BOOL b=pTouchPanelSetMode(bPerformanceMode?TPSM_SAMPLERATE_LOW_ID:TPSM_SAMPLERATE_HIGH_ID, NULL);
pTouchPanelEnable(NULL); //Driver will crash when screen is touched if NULL is passed

FreeLibrary(hTouch);

return TRUE;
}


Dan East
Dan East wrote:Yes, when the touchpad is disabled I experience no drop in FPS when the screen is touched. :)
Dan East


Well, that actually is pretty good news as it does (kinda.. more-less) point at the driver for the source of the delay. Even if it rules out being able to do anything about it... that would at least let me know that I don't have to keep wondering if there *is* something I could do about it.

Also, thanks for taking the time to put this code snip up.
Yes, thanks a bunch Dan. I will surely take a look eventually, but I have more important stuff to look at right now.
Instead of telling touch.dll to lower its thread priority via the API, it should be possible to enumerate the threads owned by the gwes process to find touch.dll's thread and set a lower priority directly.

According the DEXplor's task manager, gwes has 14 threads. Not sure how to identify the desired thread - that would be the trick.

Dan East
I was thinking about the same thing. Not sure how to retrieve the thread.

You can probably find where in memory touch.dll is loaded, but even if you could get at the thread's IP, it wouldnt work reliably (the IP could be in some kernel code at any time).
Actually there should be a way to retrieve the ThreadProc() used to start the thread. If that can be found, then we can find if a given thread started inside touch.dll.

Any (undocumented) ways of accessing the thread info block?
Yeah, I've done that before via the kernel headers. Take a look at kernel.h for the Thread struct (note that the struct was changed from CE 3.0 to CE 4.2 - they aren't compatible). It has over 50 members, so there's quite a bit of info in there.

Dan East
Bump. Anyone make any progress with this issue yet?

Dan East