Bug 4678 - Evdev mouse input
Status: RESOLVED WONTFIX
Alias: None
Product: ioquake3
Classification: Unclassified
Component: Platform
Version: GIT MASTER
Hardware: PC Linux
: P3 enhancement
Assignee: Zachary J. Slater
QA Contact: ioquake3 bugzilla mailing list
URL:
Depends on:
Blocks:
 
Reported: 2010-07-14 14:48 EDT by Gabriel Schnoering
Modified: 2011-03-07 18:10:01 EST
1 user (show)

See Also:


Attachments
evdev patch (6.55 KB, patch)
2010-07-14 14:49 EDT, Gabriel Schnoering
non threaded version (6.42 KB, application/octet-stream)
2010-07-15 14:52 EDT, Gabriel Schnoering
threaded version with mutex (7.58 KB, application/octet-stream)
2010-07-15 14:55 EDT, Gabriel Schnoering

Description Gabriel Schnoering 2010-07-14 14:48:33 EDT
i made a small modification in the input code to allow
playing with direct mouse input from the kernel (using the evdev driver)
the mouse work is done in a separated thread, filling the event queue.
the feeling is good, the response too and it's very smooth.

in_mouse 2 to activate
in_mousedevice to open the wanted device (make sure you have the permissions on it)

but sometimes the game crashs with a "Z_Free: freed a freed pointer"
Z_Free is the one called by Com_EventLoop in Com_Frame
and using gdb i got that it occurs with SE_PACKET event type.

I tried with the default free/malloc from glibc and it crashes too.
I changed the size of the queue event and it doesn't change the behaviour.

Maybe someone with more experience in threads could help if it is thread related.
The evdev code sends more events, so maybe it can come from here too.

Note : i forgot to put #defines to make it linux only but i don't think i'll be applied to HEAD like this ^^

If someone is interested and wants to give some hints or feedbacks that would be great.
Comment 1 Gabriel Schnoering 2010-07-14 14:49:37 EDT
Created attachment 2372 [details]
evdev patch
Comment 2 Gabriel Schnoering 2010-07-15 14:52:14 EDT
Created attachment 2373 [details]
non threaded version

I made a non threaded version which works fine
Comment 3 Gabriel Schnoering 2010-07-15 14:55:32 EDT
Created attachment 2374 [details]
threaded version with mutex

The error seems to be some race condition.
I made a version using mutex to acces event ressources on creation.
This one should work fine the time the event queue isn't overflowed.
I would appreciate some feedbacks or/and improvements.
Comment 4 Thilo Schulz 2011-03-07 18:10:01 EST
Sorry, this is not portable, Linux-only, I have to decline. This might be something for the patches section: http://ioquake3.org/extras/patches/