Problem with cfb_imageblit
Hi,
I have an unusual problem with cfb_imageblit. I'm not too sure if this is unique to my system. I get garbage pixels. For example the underscore character (_) appears like this magnified:
01234567
0
.
.
.
13 *******
14 *
15 ** <-- belongs to apostrophe char
It seems that the image is off by one bit and one row of pixels so it also includes the first row of pixels of the next character (`) in fontdata.
Looking at the code in cfbimgblt.c, I cannot find any obvious mistake, so I made a dump of the variables during the loop iteration. Here's what I get:
/* bpp = 8, 8x16 font, caret (^) bitmap */
pad 0 /* no excess pixels */
10 /* initial content of *src */
i 0, j 2, k 4, l 7
i 0, j 2, k 3, l 6
i 0, j 2, k 2, l 5
i 0, j 2, k 1, l 4
i 0, j 1, k 4, l 3
i 0, j 1, k 3, l 2
i 0, j 1, k 2, l 1
i 0, j 1, k 1, l 0 /* everything is okay until ... */
38 l 7 /* l = 7, and new content of *src = 0x38 */
i 1, j 2, k 4, l 0 <--- l = 0?!?! I'm confused here ...
6c l 7 /* so, src is again updated (*src = 0x6c)*/
i 1, j 2, k 3, l 7 /* at this point, we're off by 9 bits */
i 1, j 2, k 2, l 6
i 1, j 2, k 1, l 5
i 1, j 1, k 4, l 4
i 1, j 1, k 3, l 3
i 1, j 1, k 2, l 2
i 1, j 1, k 1, l 1
i 2, j 2, k 4, l 0
c6 l 7
i 2, j 2, k 3, l 7 /* the algo is now doing what it should */ i 2, j 2, k 2, l 6 /* and continues to do so till the end */
i 2, j 2, k 1, l 5
i 2, j 1, k 4, l 4
i 2, j 1, k 3, l 3
i 2, j 1, k 2, l 2
i 2, j 1, k 1, l 1
i 3, j 2, k 4, l 0
0 l 7
<<< cut >>>
I'm not too sure why 'l' did not retain it's assignment. This happens only after the first iteration of 'i'. I've tried using different compilers (gcc-2.95.3 and gcc-3.0.4). I've changed the declaration of 'l' to static and volatile, and changed its placement, but I still get the same result.
Just to prove that cfb_imageblit is correct, I used 'k' and 'j' instead of 'l' in the test_bit() part. It's slower, but it proves that the algorithm of cfb_imageblit is correct.
for (i = 0; i < image->height; i++) {
dst = (unsigned long *) dst1;
for (j = image->width/ppw; j > 0; j--) {
mask = 0;
for (k = ppw; k > 0; k--) {
if (test_bit((j*ppw - (ppw-k) - 1), src))
mask |= (tmp >> (p->var.bits_per_pixel*(k-1)));
}
fb_writel((mask & eorx)^bgx, dst);
dst++; }
src++;
l =- pad;
dst1 += p->fix.line_length;
}
Any comments?
Tony
_______________________________________________________________
Don't miss the 2002 Sprint PCS Application Developer's Conference August 25-28 in Las Vegas -- http://devcon.sprintpcs.com/adp/index.cfm
Quoted 10 lines · Antonino Daplas
I have an unusual problem with
cfb_imageblit. I'm not too sure if this is unique to my system. I get garbage pixels. For example the underscore character (_) appears like this magnified:012345670
.
.
.
Quoted 8 lines
13 *******
14 *
15 ** <-- belongs to apostrophe charIt seems that the image is off by one bit and one row of pixels so it also includes the first row of pixels of the next character (`) in fontdata.
Any comments?
Some time ago I had the same problem even under X Window and Window$. And it seems it's problem with hardware. Try to reduce system bus frequency.
Signature · 7 lines
with best regards, Andrey Ulanov. [email protected] _______________________________________________________________ Don't miss the 2002 Sprint PCS Application Developer's Conference August 25-28 in Las Vegas -- http://devcon.sprintpcs.com/adp/index.cfm
Quoted 5 lines · Antonino Daplas
Hi,
I have an unusual problem with
cfb_imageblit. I'm not too sure if this is unique to my system. I get garbage pixels. For example the underscore character (_) appears like this magnified:
Didn't look carefully enough, I found the problem.
Tony
cfbimgblt.c renamed from cfbimgblt.c-orig +1 -1
@@ -105,7 +105,7 @@fb_writel ((mask & eorx)^bgx, dst); dst++; } - l =- pad; + l -= pad; dst1 += p->fix.line_length; } }
_______________________________________________________________
Don't miss the 2002 Sprint PCS Application Developer's Conference August 25-28 in Las Vegas -- http://devcon.sprintpcs.com/adp/index.cfm
Quoted 14 lines
Quoted 6 lines
Hi,
I have an unusual problem with
cfb_imageblit. I'm not too sure if this is unique to my system. I get garbage pixels. For example the underscore character (_) appears like this magnified:Didn't look carefully enough, I found the problem.
Tony
cfbimgblt.c Fri May 24 15:51:28 2002 line 111
Quoted 8 lines
cfbimgblt.c Fri May 24 15:51:28 2002 renamed from cfbimgblt.c-orig Fri May 24 15:51:13 2002 +1
-1@@ -105,7 +105,7 @@ fb_writel((mask & eorx)^bgx, dst); dst++; } - l =- pad; + l -= pad; dst1 += p->fix.line_length; } }
Great job finding that bug :-) I applied it to my BK tree. I plan to push things to Linus now.
_______________________________________________________________
Don't miss the 2002 Sprint PCS Application Developer's Conference August 25-28 in Las Vegas -- http://devcon.sprintpcs.com/adp/index.cfm