Windowed OpenGL Performance on OS X

I am trying to get the testgl sample to run at a reasonable framerate on OS X
(10.3). I’m working on an iBook 600 (rage128 pro mobility, 8mb). I get ~350fps
in fullscreen (perfectly reasonable for a spinning cube), but only ~5fps in
windowed mode, and it maxes out the CPU.

Sampler reports 99.8% of the CPU time is being spent in CGLFlushDrawable().

I don’t yet understand enough about SDL’s internals to figure out why this is
the case. My only guesses are that it’s actually using the software renderer
even though it reports that it’s using the rage128pro driver, or that it is
copying the buffers rather than swapping them…

or even worse, rendering, copying to main memory, compositing via Quartz, then
copying back the framebuffer, which is completley unnecessary. It should just
be rendering to a surface in the video card and ignoring all compositing (as it
should on a machine without QE).

One other idea is that with the recent 10.3 upgrade, Apple is now doing
compositing in software even on non-QE enabled systems. I’ll probably test this
by putting together a GLUT example tonight and seeing how it performs, or by
placing something transparent on top of the SDL window and seeing if it
composites correctly (it shouldn’t).

Has anyone run into this, and perhaps can point me in the right direction?
Richard Schreyer

or even worse, rendering, copying to main memory, compositing via
Quartz, then
copying back the framebuffer, which is completley unnecessary. It
should just
be rendering to a surface in the video card and ignoring all
compositing (as it
should on a machine without QE).

That’s right. OpenGL bypasses the Quartz compositor unless other
windows overlap the OpenGL window. So windowed mode should run near
fullscreen mode (though fullscreen mode can pageflip on some cards and
it as more video memory at its disposal so it tends to be faster).

One other idea is that with the recent 10.3 upgrade, Apple is now doing
compositing in software even on non-QE enabled systems. I’ll probably
test this
by putting together a GLUT example tonight and seeing how it performs,
or by
placing something transparent on top of the SDL window and seeing if it
composites correctly (it shouldn’t).

It could be that you don’t have enough video memory available so it’s
reverting to a software surface. Apple recommends 32MB VRAM for QE, so
try disabling QE if you’ve got that enabled and also lowering the
desktop/window size/depth.

Well, this fixed itself with a restart. I’m now getting ~70fps in
windowed mode.

Interestingly enough, in Panther compositing on OpenGL surfaces is
indeed done even on machines without QE, unlike in 10.2 (recall, my
card is a rage128 pro, 8mb). Having a transparent terminal on top of
the testgl example dropped framerates from 70fps back down to ~5, right
where it was before. (Compositing still isn’t done at all for DVD
player surfaces, only for OpenGL).

There are two possibilities:

  1. There was a completely transparent fullscreen window on top of it,
    and Quartz was compositing. What app created/owned this, I don’t know.
  2. Some resources on the card were not freed when a previous process
    quit.

Richard SchreyerOn Nov 5, 2003, at 4:21 PM, Darrell Walisser wrote:

or even worse, rendering, copying to main memory, compositing via
Quartz, then
copying back the framebuffer, which is completley unnecessary. It
should just
be rendering to a surface in the video card and ignoring all
compositing (as it
should on a machine without QE).

That’s right. OpenGL bypasses the Quartz compositor unless other
windows overlap the OpenGL window. So windowed mode should run near
fullscreen mode (though fullscreen mode can pageflip on some cards and
it as more video memory at its disposal so it tends to be faster).

One other idea is that with the recent 10.3 upgrade, Apple is now
doing
compositing in software even on non-QE enabled systems. I’ll
probably test this
by putting together a GLUT example tonight and seeing how it
performs, or by
placing something transparent on top of the SDL window and seeing if
it
composites correctly (it shouldn’t).

It could be that you don’t have enough video memory available so it’s
reverting to a software surface. Apple recommends 32MB VRAM for QE, so
try disabling QE if you’ve got that enabled and also lowering the
desktop/window size/depth.


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl