I first reported this on xfree86 bugzilla, with no response. Pasting here now:
Traditionally glxgears and the original gears program, have a main drawing loop,
and add to angle two degrees in each frame. Two degrees out of 360 may have
been a good value in old days, but let's see what does it do now:
* On my laptop with DRI enables, I get more than 1000FPS from glxgears.
* 1000*2 = 2000 = 6 * 360. Means the gear rotates 6 rounds in a second!
* I get something around 60 frames on my LCD display, so I get around 2000/60
degrees of rotation between frames on the screen.
* The gears have 10 teeth, each 36 degrees then.
* Net result: I see the gears stopped!
- If I would get something around 500FPS, then I would see them rotating so fast
that one cannot say in which direction they are rotating.
- With around 250FPS you see the rotating in the right direction, but so fast.
- With around 750FPS you see them rotating in the other direction.
- With so much degrees to rotate in each frame, a simple delay would cause in a
bad jerk in movement.
The attached patch fixes the rotation speed of the gears, so no matter what FPS
you get, the gears rotate smoothly. Some extra bells and whistles done too
(change speed, ...).
The reason I went for the patch is that everyone seems glxgears rotating *jerky*
on his computer, so at least you would think there's a bug in your driver, if
Created attachment 168 [details] [review]
Patch to fix.
From Brian Paul on mesa3d-dev:
A good idea in general. I have one concern with the patch though: I
don't think the sys/timeb.h and sched.h standard ANSI C header files.
Perhaps someone can look into removing/fixing those dependencies.
The patch should also be modified/applied to the original GLUT-based
gears demo too.
Thre are currently 7 different versions of the gears demo in the Mesa source
tree. They are all almost identical. At this point, it might be useful to
extract out the main "guts" into a common source file that is shared, at least,
by demos/gears, xdemos/glxgears, and xdemos/glxgears_fbconfig.
I'll take the bug and check it in...
Ian Romanick wrote:
> Thre are currently 7 different versions of the gears demo in the Mesa source
> tree. They are all almost identical.
Or it may be possible to builds one all-in-one version... some of them have
unique functionalities (for example the Xorg version supports printers as output
device) and sharing code may not always be possible (the *fbconfig version may
fall into that category).
Where can the up-to-date sources of the other versions be found (CVSweb URLs,
Created attachment 990 [details] [review]
Patch updated to 2004-10-01-trunk
Note: I've ported the patch to our internal tree, therefore some unrelated
changes are pulled into this one (mainly better logging and some nice test
Created attachment 991 [details] [review]
Patch updated to 2004-10-01-trunk (same as attachment #990 [details] [review] but with % diff -u -w ... # to hide the whitespace changes caused by the TAB removal)
Attachment #990 [details] checked-in...
/cvs/xorg/xc/ChangeLog,v <-- ChangeLog
new revision: 1.414; previous revision: 1.413
/cvs/xorg/xc/programs/glxgears/Imakefile,v <-- Imakefile
new revision: 1.9; previous revision: 1.8
/cvs/xorg/xc/programs/glxgears/glxgears.c,v <-- glxgears.c
new revision: 1.7; previous revision: 1.6
Mailing the commit message to firstname.lastname@example.org...
... marking bug as FIXED.
Note: This cased bug 1747 ("Build failure in xc/programs/glxgears/"). If this
patch gets ported to any other branch then the patch from bug 1747 is needed,