Resent-Date: Fri, 18 Dec 1998 15:14:15 +0100 (MET)
Date: Sat, 19 Dec 1998 01:07:46 +1100 (EST)
From: Ken Tyler <kent@werple.net.au>
Reply-To: Ken Tyler <kent@werple.net.au>
Subject: Re: mb(), iobarrier(), eieio()
To: linux-apus@sunsite.auc.dk
Cc: linux-m68k@lists.linux-m68k.org
Organization: Organization
Resent-From: linux-m68k@phil.uni-sb.de


Here's a bit of a description of CV64-3d corruption and a diff that fixes
it.  I'm not suggesting the diff as a proper fix to the problem, just a
step on the way to finding where exactly the problem is. 

I enter a command :

    >12345678

and left arrow the cursor back to the 3 and insert a single 'r' I see
 
    >12rr35678

the 2nd 'r' and the 3 are badly rendered with parts missing, 4 is gone,
right arrow once gives

    >12r335678

the 2nd 3 is now the only char badly rendered but still no 4, another
right arrow gives

    >12r345678

just as it should be.

Two types of corruption shown, b) badly rendered chars, b) a
doubled/missing char. 

Adding a few cache_pushes to fbcon-cfb8.c, the console display works
correctly at the shell prompt.  But still evident in pine/pico is a
variation of the problem, when inserting a char at the start of a line, a
blank space 'overstrikes' the next position, a ^L fixes this. 

This is the cache_push diff.  A similar diff adding eieio() instead of
cache_push calls in the same places and a #include <asm/io.h> fixes the
badly rendered chars but not the doubled/missing chars. 

Ken.


--- fbcon-cfb8.c.save	Fri Dec 18 17:30:24 1998
+++ fbcon-cfb8.c	Sat Dec 19 11:24:47 1998
@@ -18,7 +18,7 @@
 #include <video/fbcon.h>
 #include <video/fbcon-cfb8.h>
 
-
+extern void cache_push(u32, int);
     /*
      *  8 bpp packed pixels
      */
@@ -50,7 +50,6 @@
 {
     int bytes = p->next_line, linesize = bytes * fontheight(p), rows;
     u8 *src,*dst;
-
     if (sx == 0 && dx == 0 && width * fontwidth(p) == bytes) {
 	mymemmove(p->screen_base + dy * linesize,
 		  p->screen_base + sy * linesize,
@@ -136,8 +135,12 @@
         break;
     case 8:
 	for (rows = fontheight(p) ; rows-- ; dest += bytes) {
+cache_push((u32)dest[0],4);
 	    ((u32 *)dest)[0]= (nibbletab_cfb8[*cdat >> 4] & eorx) ^ bgx;
+cache_push((u32)dest[0],4);
+cache_push((u32)dest[1],4);
 	    ((u32 *)dest)[1]= (nibbletab_cfb8[*cdat++ & 0xf] & eorx) ^ bgx;
+cache_push((u32)dest[1],4);
         }
         break;
     case 12:
@@ -187,8 +190,12 @@
 	    cdat = p->fontdata + c * fontheight(p);
 
 	    for (rows = fontheight(p), dest = dest0; rows-- ; dest += bytes) {
+cache_push((u32)dest[0],4);
 		((u32 *)dest)[0]= (nibbletab_cfb8[*cdat >> 4] & eorx) ^ bgx;
+cache_push((u32)dest[0],4);
+cache_push((u32)dest[1],4);
 		((u32 *)dest)[1]= (nibbletab_cfb8[*cdat++ & 0xf] & eorx) ^ bgx;
+cache_push((u32)dest[1],4);
 	    }
 	    dest0+=8;
         }
@@ -223,8 +230,12 @@
     	switch (fontwidth(p)) {
     	case 16: ((u32 *)dest)[3] ^= 0x0f0f0f0f; /* FALL THROUGH */
     	case 12: ((u32 *)dest)[2] ^= 0x0f0f0f0f; /* FALL THROUGH */
+cache_push((u32)dest[1],8);
     	case 8: ((u32 *)dest)[1] ^= 0x0f0f0f0f;  /* FALL THROUGH */
+cache_push((u32)dest[1],8);
+cache_push((u32)dest[0],8);
     	case 4: ((u32 *)dest)[0] ^= 0x0f0f0f0f;  /* FALL THROUGH */
+cache_push((u32)dest[0],8);
     	default: break;
     	}
     }




----------------


