Bug 382 - Timing patch for glxgears to rotate smoothly.
Summary: Timing patch for glxgears to rotate smoothly.
Status: RESOLVED FIXED
Alias: None
Product: xorg
Classification: Unclassified
Component: App/other (show other bugs)
Version: unspecified
Hardware: All Linux (All)
: high enhancement
Assignee: Roland Mainz
QA Contact:
URL: http://bugs.xfree86.org/show_bug.cgi?...
Whiteboard:
Keywords:
Depends on:
Blocks: 1747
  Show dependency treegraph
 
Reported: 2004-03-29 00:47 UTC by Behdad Esfahbod
Modified: 2004-10-30 23:50 UTC (History)
3 users (show)

See Also:
i915 platform:
i915 features:


Attachments
Patch to fix. (8.49 KB, patch)
2004-03-29 00:48 UTC, Behdad Esfahbod
no flags Details | Splinter Review
Patch updated to 2004-10-01-trunk (31.17 KB, patch)
2004-10-01 18:37 UTC, Roland Mainz
no flags Details | Splinter Review
Patch updated to 2004-10-01-trunk (same as attachment #990 but with % diff -u -w ... # to hide the whitespace changes caused by the TAB removal) (26.89 KB, patch)
2004-10-01 18:42 UTC, Roland Mainz
no flags Details | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Behdad Esfahbod 2004-03-29 00:47:38 UTC
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
not hardware.
Comment 1 Behdad Esfahbod 2004-03-29 00:48:46 UTC
Created attachment 168 [details] [review]
Patch to fix.
Comment 2 Alex Deucher 2004-09-29 09:39:06 UTC
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.

-Brian
Comment 3 Ian Romanick 2004-09-29 10:04:42 UTC
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.
Comment 4 Roland Mainz 2004-10-01 12:13:24 UTC
I'll take the bug and check it in...
Comment 5 Roland Mainz 2004-10-01 12:19:27 UTC
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,
please) ?
Comment 6 Roland Mainz 2004-10-01 18:37:52 UTC
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
switches), too.
Comment 7 Roland Mainz 2004-10-01 18:42:50 UTC
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)
Comment 8 Roland Mainz 2004-10-01 18:49:16 UTC
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 xorg-commit@pdx.freedesktop.org...

... marking bug as FIXED.
Comment 9 Roland Mainz 2004-10-31 17:50:06 UTC
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,
too.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.