linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Problem with cfb_imageblit
@ 2002-05-24 13:19 Antonino Daplas
  2002-05-24 17:30 ` Andrey Ulanov
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Antonino Daplas @ 2002-05-24 13:19 UTC (permalink / raw)
  To: fbdev

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Problem with cfb_imageblit
  2002-05-24 13:19 Problem with cfb_imageblit Antonino Daplas
@ 2002-05-24 17:30 ` Andrey Ulanov
  2002-05-24 23:24 ` Antonino Daplas
  2002-05-28 17:29 ` James Simmons
  2 siblings, 0 replies; 4+ messages in thread
From: Andrey Ulanov @ 2002-05-24 17:30 UTC (permalink / raw)
  To: Antonino Daplas; +Cc: fbdev

On Fri, May 24, 2002 at 09:19:09PM +0800, Antonino Daplas wrote:
> 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.
> 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.

-- 
with best regards, Andrey Ulanov.
drey@rt.mipt.ru

_______________________________________________________________

Don't miss the 2002 Sprint PCS Application Developer's Conference
August 25-28 in Las Vegas -- http://devcon.sprintpcs.com/adp/index.cfm

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Problem with cfb_imageblit
  2002-05-24 13:19 Problem with cfb_imageblit Antonino Daplas
  2002-05-24 17:30 ` Andrey Ulanov
@ 2002-05-24 23:24 ` Antonino Daplas
  2002-05-28 17:29 ` James Simmons
  2 siblings, 0 replies; 4+ messages in thread
From: Antonino Daplas @ 2002-05-24 23:24 UTC (permalink / raw)
  To: fbdev

On Fri, 2002-05-24 at 21:19, Antonino Daplas wrote:
> 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-orig	Fri May 24 15:51:13 2002
+++ cfbimgblt.c	Fri May 24 15:51:28 2002
@@ -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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Problem with cfb_imageblit
  2002-05-24 13:19 Problem with cfb_imageblit Antonino Daplas
  2002-05-24 17:30 ` Andrey Ulanov
  2002-05-24 23:24 ` Antonino Daplas
@ 2002-05-28 17:29 ` James Simmons
  2 siblings, 0 replies; 4+ messages in thread
From: James Simmons @ 2002-05-28 17:29 UTC (permalink / raw)
  To: Antonino Daplas; +Cc: fbdev


>> 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-orig    Fri May 24 15:51:13 2002
>+++ cfbimgblt.c Fri May 24 15:51:28 2002
>@@ -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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2002-05-28 17:29 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-05-24 13:19 Problem with cfb_imageblit Antonino Daplas
2002-05-24 17:30 ` Andrey Ulanov
2002-05-24 23:24 ` Antonino Daplas
2002-05-28 17:29 ` James Simmons

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).