From 055aa67cc71b3e6336faba42d82d43cee54d0d4e Mon Sep 17 00:00:00 2001 From: rin Date: Mon, 29 Jul 2019 16:17:29 +0000 Subject: Hmmm, color was still strange for 24bpp on little endian machine, only when font width is 12. We need to use different devcmap for that case, if we wish to share codes for other depths/font widths as possible as we can. XXX What should we do for big endian? I have no big endian machines with 24bpp framebuffer... --- sys/dev/rasops/rasops.c | 18 ++++++++++++++---- sys/dev/rasops/rasops24.c | 12 ++++++++++-- 2 files changed, 24 insertions(+), 6 deletions(-) (limited to 'sys/dev') diff --git a/sys/dev/rasops/rasops.c b/sys/dev/rasops/rasops.c index 0b1e04289c3..4cfe4c50d70 100644 --- a/sys/dev/rasops/rasops.c +++ b/sys/dev/rasops/rasops.c @@ -1,4 +1,4 @@ -/* $NetBSD: rasops.c,v 1.96 2019/07/29 14:43:14 rin Exp $ */ +/* $NetBSD: rasops.c,v 1.97 2019/07/29 16:17:29 rin Exp $ */ /*- * Copyright (c) 1999 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rasops.c,v 1.96 2019/07/29 14:43:14 rin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rasops.c,v 1.97 2019/07/29 16:17:29 rin Exp $"); #include "opt_rasops.h" #include "rasops_glue.h" @@ -901,8 +901,18 @@ rasops_init_devcmap(struct rasops_info *ri) c |= c << 16; else if (ri->ri_depth == 24) { #if BYTE_ORDER == LITTLE_ENDIAN - c = (c & 0x0000ff) << 16 | (c & 0x00ff00) | - (c & 0xff0000) >> 16; +# ifndef RASOPS_SMALL + if (ri->ri_font->fontwidth != 12) +# endif + c = (c & 0x0000ff) << 16 | (c & 0x00ff00) | + (c & 0xff0000) >> 16; +# ifndef RASOPS_SMALL + else + c = (c & 0x0000ff) | (c & 0x00ff00) << 8 | + (c & 0xff0000) >> 8; +# endif +#else + /* XXXRO What should we do here? */ #endif c |= (c & 0xff) << 24; } diff --git a/sys/dev/rasops/rasops24.c b/sys/dev/rasops/rasops24.c index 78e7f158afc..c6187891cac 100644 --- a/sys/dev/rasops/rasops24.c +++ b/sys/dev/rasops/rasops24.c @@ -1,4 +1,4 @@ -/* $NetBSD: rasops24.c,v 1.37 2019/07/29 14:06:32 rin Exp $ */ +/* $NetBSD: rasops24.c,v 1.38 2019/07/29 16:17:29 rin Exp $ */ /*- * Copyright (c) 1999 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rasops24.c,v 1.37 2019/07/29 14:06:32 rin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rasops24.c,v 1.38 2019/07/29 16:17:29 rin Exp $"); #include "opt_rasops.h" @@ -80,6 +80,14 @@ void rasops24_init(struct rasops_info *ri) { +#ifndef RASOPS_SMALL + /* + * Different devcmap's are used depending on font widths, + * therefore we need reset stamp here. + */ + stamp_attr = 0; +#endif + if (ri->ri_rnum == 0) { ri->ri_rnum = ri->ri_gnum = ri->ri_bnum = 8; -- cgit