[Y-devel] OpenGL and the drawing API
Mark Thomas mark at www.y-windows.org
Tue Mar 16 23:55:49 GMT 2004
On Wed, 17 Mar 2004, Darryl wrote:
> And you really cant consider the fact that currently it chugs on our
> computers because its not optimized almost at all for hardware
> acceleration.. It just has super super generic drivers, AND its running
> WITHIN X IN SDL. Hold off on the "the requirements are going to be too
> high" arguements.. No one knows what they may or may not be...
>
This is a very important point. What we have at the moment is the worst
case scenario: fully alphablending in software on a slow graphics surface.
There are a couple of ways in which things can, and will, be sped up:
1) Hardware acceleration
On hardware that supports it, everything should be done in hardware.
This needs careful planning since:
a) the user may have more than one graphics card, and may want to move
windows between their corrensponding screens
b) the graphics card may have limited graphics memory
c) the graphics card memory may be volatile (i.e. textures may be
deleted under certain circumstances)
I have fairly good ideas of how to deal with this. Essentially it
involves making buffers more intelligent. First, we give a hint to the
buffer how precious the data is, by providing it with a redraw function if
that is possible:
bufferSetRedrawCallback (...)
This indicates to the buffer that it may use volatile storage for the
buffer data since it can regenerate the contents at a whim. Buffers whose
data cannot be instantly regenerated (such as those that belong to a
client, e.g. through Canvas) have more care taken over where their data is
stored (probably will end up with the buffer keeping an in-memory copy as
well as the on-gfx-card copy just in case it needs to refresh the card or
move the data to a different card). Note that cilents DON'T have to
handle "expose" events: these are strictly server-side and should be
quick.
The buffer checks all the viewports to see whether it needs to work in
software mode, or whether it can use the hardware acceleration specific to
one or more of them. When a renderer encounters a buffer, it can then
either use the associated accelerated data, or the software fallback if
the accelerated data is unavailable. To make this more complex, this
should actually be implemented by the video driver since it is likely to
be implementation-specific. The generic buffer just provides hooks.
2) Implement support for opaque compositing
If a section of a widget is opaque, then there is no point rendering the
widgets behind it. Support will be added to check whether a specific
region of a widget is opaque. For each updated region, you start at the
front, move backward until you read the first opaque region, then move
forward from there compositing.
To make things even faster, you could improve this by slicing the update
region at each level into the opaque, semi-transparent and transparent
areas recursively.
This means if we write a theme where no transparency is used, the
optimisation means we can use opaque blits everywhere and suddenly we are
as fast as X, and still support semi-transparency with no "compositing
manager" in sight.
Regards,
Mark.
--
|| Mark Thomas
|| efaref.net
||
|| Efficiency is a highly developed form of laziness.
More information about the Y-devel mailing list
2026 © www.Y-Windows.Org - All Rights Reserved