Subject: kern/9449: rasops code is rather endianness-dependant
To: None <gnats-bugs@gnats.netbsd.org>
From: None <bjh21@cam.ac.uk>
List: netbsd-bugs
Date: 02/19/2000 10:40:18
>Number:         9449
>Category:       kern
>Synopsis:       rasops code is rather endianness-dependant
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people (Kernel Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Feb 19 10:39:00 2000
>Last-Modified:
>Originator:     Ben Harris
>Organization:
University of Cambridge
>Release:        1.4T (2000-02-18)
>Environment:
(Not yet ported, *grin*)
>Description:
When using the rasops code in sys/dev/rasops on a little-endian
framebuffer, things seem to end up mangled.  It looks as if the code has
almost no support for non-big-endian framebuffers -- RI_BSWAP is referenced
anywhere.

>How-To-Repeat:

>Fix:
This patch at least makes the code work using an 8-pixel wide font on
a 1-bit display, at least.  Gallant still doesn't work.

--- rasops.c    2000/01/06 05:27:19     1.26
+++ rasops.c    2000/02/19 18:33:11
@@ -121,6 +121,7 @@
        struct rasops_info *ri;
        int wantrows, wantcols;
 {
+       int font_order;
 
 #ifdef _KERNEL 
        /* Select a font if the caller doesn't care */
@@ -138,8 +139,19 @@
                        return (-1);
                }
                
-               if (wsfont_lock(cookie, &ri->ri_font, 
-                   WSDISPLAY_FONTORDER_L2R, WSDISPLAY_FONTORDER_L2R) <= 0) {
+#if BYTE_ORDER == BIG_ENDIAN
+               if (ri->ri_flg & RI_BSWAP)
+                       font_order = WSDISPLAY_FONTORDER_R2L;
+               else
+                       font_order = WSDISPLAY_FONTORDER_L2R;
+#else
+               if (ri->ri_flg & RI_BSWAP)
+                       font_order = WSDISPLAY_FONTORDER_L2R;
+               else
+                       font_order = WSDISPLAY_FONTORDER_R2L;
+#endif
+               if (wsfont_lock(cookie, &ri->ri_font,
+                               font_order, font_order) <= 0) {
                        printf("rasops_init: couldn't lock font\n");
                        return (-1);
                }

>Audit-Trail:
>Unformatted: