Discussion:
SetTimer vs. setitimer and XF86VidModeGetAllModeLines
(too old to reply)
James Van Buskirk
2017-02-28 02:12:41 UTC
Permalink
Raw Message
I seem to have two problems. The first involves finding an equivalent to
SetTimer in Linux. I tried setitimer and then sending an XExposeEvent
from the SIGALRM handler but the program freezes up after a while
because, I assume, that such usage is just not at all thread safe.

I read that XCB is thread safe, but you still need some Xlib to set up
a rendering context. If I changed some of my code to XCB, would it
avoid the conflict that is currently making it hang? What is the usual
idiom in Linux to replace SetTimer/WM_TIMER?

The other thing is that all the NeHe examples use
XF86VidModGetAllModeLines as a starting point to set the video mode.
In another thread where I have coaxed some readers to try out my
example,
https://software.intel.com/sites/default/files/managed/b2/de/lesson01.f90
I have received the discouraging news that the function either fails
outright with error status, or none of the mode lines obtained pass
XF86VidModeValidateModeLine although you are still allowed to
switch to them. Problems ensue after switching in that any window
that was active during the switch maximizes the first time you click
on it and often the mouse driver forgets that the desktop is double
buffered and leaves trails of phantom pointers in alternating buffers
creating an effect like a movie marquee, see

All of these examples are quite old; is there a more contemporary
way to switch video modes on Linux that works?
Alberto Luaces
2017-02-28 11:11:23 UTC
Permalink
Raw Message
Post by James Van Buskirk
I seem to have two problems. The first involves finding an equivalent to
SetTimer in Linux. I tried setitimer and then sending an XExposeEvent
from the SIGALRM handler but the program freezes up after a while
because, I assume, that such usage is just not at all thread safe.
I read that XCB is thread safe, but you still need some Xlib to set up
a rendering context. If I changed some of my code to XCB, would it
avoid the conflict that is currently making it hang? What is the usual
idiom in Linux to replace SetTimer/WM_TIMER?
The other thing is that all the NeHe examples use
XF86VidModGetAllModeLines as a starting point to set the video mode.
In another thread where I have coaxed some readers to try out my
example,
https://software.intel.com/sites/default/files/managed/b2/de/lesson01.f90
I have received the discouraging news that the function either fails
outright with error status, or none of the mode lines obtained pass
XF86VidModeValidateModeLine although you are still allowed to
switch to them. Problems ensue after switching in that any window
that was active during the switch maximizes the first time you click
on it and often the mouse driver forgets that the desktop is double
buffered and leaves trails of phantom pointers in alternating buffers
creating an effect like a movie marquee, see
http://youtu.be/XD7thJVRKmQ
All of these examples are quite old; is there a more contemporary
way to switch video modes on Linux that works?
I guess this is not what you expect to hear, but I would begin by
studying how they made it in SDL for both problems.

Loading...