Re: [AD] Thoughts on speeding up X

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


Evert Glebbeek wrote:
Were you thinking of using pixmaps as system bitmaps under X? That might make sense...

Actually, no. Although that's a good idea and one I could use. What I was thinking was something like this: user creates a normal memory bitmap, user requests to blit the normal memory bitmap to the screen. Since I'm not aware of any fast way to write pixel-by-pixel or line-by-line to an X display, it'd be best to do it as one XPutImage call. I would accomplish this by doing something like this:

XImage->width = bmp->w;
XImage->height = bmp->h;
XImage->bytes_per_line = bmp->line[1] - bmp->line[0];
XImage->data = bmp->dat;
XPutImage(XImage, _xwin.display, ...);

The "proper" way would be to memcpy, line-by-line, the bmp data to a screen-sized XImage and use XPutImage to copy the relevant part of that (which is basically what it does now, I think). The above hack, if possible, would pretty much just use the bmp data as an XImage to copy to an X display, no additional copying necessary.

Yes, but it's rather radical and probably ``Allegro 5'' stuff.

The only reason it's radical is because it's just so different from how the current X11 driver does it (which is rather poor, IMO).

What I'd like to see is something like a set_gfx_mode() where you can give hints for the update method you want to use: double buffering, triple buffering or plain. You then have something equivalent to GLbegin() and GLend in OpenGL to indicate the start and end of a drawing cycle, say gfx_begin() and gfx_end(). In between, blitting and drawing operations are buffered to a virtual screen or alternative screenpage. Only at gfx_end() is the actual screen updated.

Actually, I think I have something like this pretty much done already.. except it's a new function (set_display_mode) wrapped around the current set_gfx_mode. We already have the functions to indicate the beginning and end of a drawing cycle: acquire_bitmap and release_bitmap. I'll look around to see if I still have the code.

This is not so much a redesign of the X11 driver as of the whole graphics subsystem. And as I said, it's probably too much to do for now.

Well, as I just mentioned, I already have something like what you said already implemented on top of Allegro's current functions already. Although it's not complete (some people were asking for a way to get a BITMAP pointer to the currently displayed screen and stuff) it shouldn't take too much work to get fully working.

- Kitty Cat




Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/