lsched_setscheduler SCHED_FIFO

Hi,

i’ve posted this on the linux forum, but thought it might be more appropriate in the advanced forum. hope thats ok.

i’m looking for an example of some opengl code that uses sched_setschedule on linux OS. I have a program that records the time between an opengl object disappearing from the screen, and a button press by the player. I want to develop my programms such that calls between gettimeofday() at object disappearance and button press (typically between 400 and 1200ms) are not interupted by other running processes. i’ve looked at the man pages, but am not experienced enough to implement sched_setscheduler into a working openGL program. any advice or working examples greatly appreciated

Simon

cf Linux forum…

SCHED_FIFO has absolutely nothing to do with OpenGL.

You don’t have perfect knowledge of when the OpenGL driver ACTUALLY presents the data to the user, because

  1. swap is asynchronous
  2. if you turn off vblank, the screen update phase is randon when you swap

Also, “pressing a key” is a very poor timer for various hardware and software related reasons. If you’re actually doing research, then you need something like a data capture card with time-stamped data.

SCHED_FIFO is not the way it’s got to be, but it could be managed to work as fine as possible… however, RT scheduling are those we need to use.

what do you mean with
"OpenGL driver ACTUALLY presents the data to the user, because

  1. swap is asynchronous
  2. if you turn off vblank, the screen update phase is randon when you swap" ?

what swapping do you refer for ? schedule ?

and with “Also, “pressing a key” is a very poor timer for various hardware and software related reasons.” ?

I don’t understand ‘very poor timer’: key press depends on X, so the thread is always waiting for any key event. When it has one, it does it works… and some other thread do the stuffs.

Fratt

[QUOTE]Originally posted by jwatte:
>[b]SCHED_FIFO has absolutely nothing to do >with OpenGL.

>You don’t have perfect knowledge of when >the OpenGL driver ACTUALLY presents the >data to the user, because
>1) swap is asynchronous
>2) if you turn off vblank, the screen >update phase is randon when you swap

jwatte,
all i’m looking for is an example of SCHED_FIFO in some opengl code. it seems that others do use it with opengl programming. its not the timing of the opengl objects that i am interested in, so syncing swap to vblank is sufficient (nvidia cards provide _GL_SYNC_TO_VBLANK=1 for this purpose). what i am wanting to do is have an interval in my program (between object disappearance and key press) that is timed acurately, and the way to do this, it seems, is with sched_setscheduler. i’m looking for information/examples/tutorials about threads with opengl, and using sched_setscheduler without hanging the system. if this is not the most appropriate site to post these questions, please feel free to send me a link to an appropriate forum.