[AD] DGA acceleration

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


> I can not do that myself, because I'm using old X version.  Maybe I'll
> install newer version, when I buy new disk.

I wish I could help you out... I really thank you for the great job you've
done porting Allegro under X. Anyway, what X version are you currently using?
I'm on 3.3.6 now.

> AFAICS, this acceleration can be done by testing for the appropriate 
> DGA extension, then replacing vtable entries and setting flags for
> supported accelerated functions.

Ok, I've sat down and investigated a bit on the topic. I've also studied your
(Bukin) xwin.c code, and I've finally managed to add some sort of initial hw
acceleration support. The hw acceleration is automatically detected and used -
when available - if pixel format matches. This was done checking for the
XF86DGAAccelPresent flag into the dga_flags variable, once
XF86DGAQueryDirectVideo() was called. If this was present, the XF86DGADoAccel
flag was passed among others in the XF86DGADirectVideo call. After that, it was
just a matter of adding functions to support hw versions of accelerated
features, as you suggested. I've started coding the hline function replacement,
just to test things out... and that's all I've done until now. And I'm blocked.
Now, I'm a novice at X programming, and I was looking for docs on Xlib and DGA
(I'm talking about DGA version 1.x, used by XFree86 3.3.x); the best source I
was able to find for DGA was the file
/usr/X11R6/include/X11/extensions/xf86dga.h (dated 1996 btw). What is strange
is that I was unable to find some man pages on DGA functions for example...
However, looking at the header file above, I guessed how they work. Well, it
looks like hw acceleration can be supported by using the functions
XF86DGACopyArea() and XF86DGAFillRectangle(). I was hoping to use these two
simple functions to add hw acceleration to hline, vline, clear_to_color,
rectfill, blit and some others; I coded a new _xaccel_hline using
XF86DGAFillRectangle(), but there are some problems. The horizonatal lines are
drawn, but in the wrong place; they're shifted by approximately 8 pixels on the
right and 30 down. If you're wondering, I'm using the standard Allegro "test"
program to test my routine, and yes, I've added bitmap->x_ofs and bitmap->y_ofs
to the line endpoints before drawing. And what is even worse is that after some
lines are drawn, the whole system crashes; I've still not searched where the
real problem is though, but it seems that it locks if the lines fall too much
on the right side of the screen.
Now I'm wondering if it's my fault or a buggy DGA implementation. I've heard
DGA 1.x acceleration support was kinda buggy, and looking for docs I've
discovered DGA 2.0 is the first "real" officially working implementation of
this extension... About DGA 2.0, I was easily able to find some docs, as
there's a README in the XF86 4.0.x distribuition which explains how the API
works. And by the way, the API of DGA 2.0 is different from the one of 1.x...
The new version is much more easy to use, and there are even functions to find
and set available video modes without needing the vidmode extension. And best of
all, it is supposed to work...
A little time ago I tested XFree 4.0.0, but I switched back to old 3.3.6
mainly because Allegro refused to run in DGA mode under the new X server. I
don't know if this compatibility issue is Allegro's fault or if it has been
resolved in XF 4.0.1... Anyway, I'd like if X Allegro could support DGA 2 and 2d
hardware acceleration, so I'm thinking about giving it a try and begin working
on a new Allegro gfx driver by myself. But I'd also like some feedback before
beginning; am I the only one who tried XF 4 failing to run Allegro apps in DGA
mode? And another thing: I know XF 3.3.x is still widely used, so the current
Allegro DGA driver should remain untouched. The new driver I'd like to code
would need Allegro to autodetect in the "configure" step which driver to
compile: the one for DGA 1.x or the other for DGA 2.0... Modifying the current
DGA driver to detect which DGA version is in use at runtime is possible, and it
would cut off the need of writing a separated driver, but DGA 1.x and 2.0 APIs
are different AFAIK - and I'm beginning to doubt they're really compatible - so
I don't know if this is worth the effort after all.
Now I need more comments and suggestions!

-- 
Angelo Mottola
a.mottola@xxxxxxxxxx

PS: my system is a K6-200 with 64MB ram, and a TNT2 with 32MB ram, under Linux
2.2.14 and XFree86 3.3.6



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