Re: [AD] X-windows screen updates |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
Bertrand Coconnier <bcoconni@xxxxxxxxxx> wrote:
>
> It made me realized that double-buffering is not useful under X-windows
> since it already uses one internally. Anyway, it is slower to draw
> directly to the screen than to draw to a BITMAP and blit it to the
> screen. I discovered that direct drawing to the screen is slower because
> the screen is updated every time someting is drawn onto it. I think that
> we can use the acquire_screen / release_screen functions to tell the
> X-windows driver not to update the screen (acquire_screen = stop
> updating the screen, release_screen = update the screen and go back to
> usual behaviour). This way direct draw is faster than double-buffering.
> I have attached a small patch that perform that stuff. It works...
> However, I think that a X-windows gourou should have a look at it ;-)
I used the "Profile screen" function in the `test' program, and
found that while the patch did make some improvements in some areas,
in other areas it was a lot worse. For example:
DRAW_MODE_SOLID results: (without patch)
putpixel() - 20622
hline() - 14655
vline() - 5987
line() - 306
rectfill() - 823
circle() - 162
circlefill() - 299
ellipse() - 154
ellipsefill() - 300
arc() - 387
triangle() - 305
DRAW_MODE_SOLID results: (with patch)
putpixel() - 25107
hline() - 17081
vline() - 6884
line() - 29
rectfill() - 28
circle() - 29
circlefill() - 29
ellipse() - 29
ellipsefill() - 29
arc() - 29
triangle() - 29
> +/* _xwin_release:
> + * Unlock and update screen
> + */
> +static void _xwin_release(BITMAP *bmp)
> +{
> + if (lock_nested <= 0) return;
> + lock_nested--;
> + if (lock_nested == 0) {
> + _xwin_in_gfx_call = 0;
> + _xwin_update_screen(0, 0, _xwin.virtual_width, _xwin.virtual_height);
I think it is because of this `_xwin_update_screen' line, which,
AFAICT, updates the entire screen every time it is unacquired. If
instead we marked a "dirty lines" array and only update those lines
during the unacquisition, I think it would be faster.
--
GLANTICS (GLAN tiks), n. Two people, who, while making out, open their
eyes at the same time to see if the other is looking.
-- Rich Hall, "Sniglets"