Hi,
I'm seeing some strange problems with one of the accelerated 2D
functions in the latest XFree86 (= XFree86 CVS) ATI Radeon driver.
I'm observing the problem here on several ATI Radeon 7500 cards (all the
same model, though), both on Solaris 8 x86 and Linux x86. CPU is AMD
XP/MP in all cases, using Tyan Tiger S2460 and VIA KT266 boards.
The problematic acceleration is named "8x8 mono pattern filled
rectangles" in the XFree86 server logfile and the code used inside the
XFree Radeon driver for this accelerated OP is also present inside the
ATI Rage128 driver - so the same problem could exist in the
XFree86 ATI Rage128 driver as well.
Unfortunatelly I don't have access to a Rage128 card to confirm the
problem for the Rage128...
The attached program below reproduces the problem. It should paint a
window with a line of 'a' glyphs from an "Arial" truetype font. An 8x8
monochrome bitmap of the glyph is included in the test program. The
glyphs should look like this:
******
** **
**
*****
*** **
** **
** ***
**** **
but with our Radeon 7500's, the bitmap is displayed horizontally
mirrored:
******
** **
**
*****
** ***
** **
*** **
** ****
I've tried to get some feedback on usenet...
<URL:http://groups.google.de/groups?selm=wy8z3raht7.fsf%40tools.de>
... but the results so far indicate that noone else was able to reproduce this
problem. So it could be a problem that certain versions of the radeon
cards cannot flip the bits with the "8x8 mono pattern filled
rectangles" operations, while some other can.
Can anyone with access to the ATI specs comment on this problem?
Can anyone reproduce the problem on their radeon or r128 cards?
[ I've appended a patch that fixes the problem for me, but it seems that
the driver has to probe whether the hardware can bit-flip the pixels for
the "8x8 mono pattern filled rectangles" operation or not, or something
like that... ]
----- snip: sochar.c ----------------------------------------------------
/*
* gcc -o sochar sochar.c -L/usr/X11R6/lib -lX11
*/
#include <stdio.h>
#include <stdlib.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
/*#include "arial_a.bitmap"*/
#define arial_a_width 8
#define arial_a_height 8
static unsigned char arial_a_bits[] = {
0x7e, 0xc3, 0xc0, 0xf8, 0xce, 0xc3, 0xe3, 0xde};
int
main(int argc, char **argv)
{
Display *dpy;
Window win;
Pixmap pix;
int wval;
XSetWindowAttributes wattr;
int gcmask;
XGCValues gcval;
GC gc;
int x, y;
XEvent ev;
dpy = XOpenDisplay(NULL);
if (!dpy) {
printf("cannot open X11 display\n");
exit(1);
}
wval = 0;
wattr.background_pixel = WhitePixel(dpy, 0);
wattr.border_pixel = BlackPixel(dpy, 0);
wattr.backing_store = NotUseful;
wattr.event_mask = ExposureMask;
wval |= CWBackPixel|CWBorderPixel|CWBackingStore|CWEventMask;
win = XCreateWindow(dpy, RootWindow(dpy, 0), 0, 0, 200, 200, 1,
CopyFromParent, InputOutput,
DefaultVisual(dpy, 0), wval, &wattr);
if (!win) {
printf("cannot create X11 window\n");
exit(1);
}
pix = XCreatePixmapFromBitmapData(dpy, win, arial_a_bits,
arial_a_width, arial_a_height,
1, 0, 1);
XMapWindow(dpy, win);
XClearWindow(dpy, win);
gcmask = 0;
gcval.function = GXcopy;
gcval.foreground = BlackPixel(dpy, 0);
gcval.background = WhitePixel(dpy, 0);
gcval.line_style = LineSolid;
gcval.line_width = 0;
gcmask |= GCFunction|GCForeground|GCBackground|GCLineWidth|GCLineStyle;
gcval.fill_style = FillStippled;
gcmask |= GCFillStyle;
gc = XCreateGC(dpy, win, gcmask, &gcval);
for (;;) {
XNextEvent(dpy, &ev);
switch (ev.type) {
case Expose:
for (x = 10; x < 200; x += 10) {
gcval.stipple = pix;
gcval.ts_x_origin = x;
gcval.ts_y_origin = 10;
gcmask = GCStipple|GCTileStipXOrigin|GCTileStipYOrigin;
XChangeGC(dpy, gc, gcmask, &gcval);
XFillRectangle(dpy, win, gc, x, 10, arial_a_width, arial_a_height);
}
break;
default:
break;
}
}
}
------------------------------------------------------------------------
J�rgen Keil [EMAIL PROTECTED]
Tools GmbH +49 (228) 9858011
Index: radeon_accel.c
===================================================================
RCS file: /cvs/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_accel.c,v
retrieving revision 1.26
diff -u -B -r1.26 radeon_accel.c
--- radeon_accel.c 2002/06/02 03:00:47 1.26
+++ radeon_accel.c 2002/07/30 12:44:50
@@ -739,8 +739,7 @@
| (bg == -1
? RADEON_GMC_BRUSH_8X8_MONO_FG_LA
: RADEON_GMC_BRUSH_8X8_MONO_FG_BG)
- | RADEON_ROP[rop].pattern
- | RADEON_GMC_BYTE_LSB_TO_MSB));
+ | RADEON_ROP[rop].pattern));
OUTREG(RADEON_DP_WRITE_MASK, planemask);
OUTREG(RADEON_DP_BRUSH_FRGD_CLR, fg);
OUTREG(RADEON_DP_BRUSH_BKGD_CLR, bg);
@@ -1648,7 +1647,7 @@
a->Mono8x8PatternFillFlags = (HARDWARE_PATTERN_PROGRAMMED_BITS
| HARDWARE_PATTERN_PROGRAMMED_ORIGIN
| HARDWARE_PATTERN_SCREEN_ORIGIN
- | BIT_ORDER_IN_BYTE_LSBFIRST);
+ | BIT_ORDER_IN_BYTE_MSBFIRST );
/* Indirect CPU-To-Screen Color Expand */