Fri Jul 19 16:35:57 2013 UTC ()
Properly initialize the palette for while on black even on 1bpp framebuffer.
Preparing for demonstration in Open Source Conference 2013 Kyoto.


(tsutsui)
diff -r1.26 -r1.27 src/sys/arch/luna68k/dev/lunafb.c

cvs diff -r1.26 -r1.27 src/sys/arch/luna68k/dev/lunafb.c (expand / switch to unified diff)

--- src/sys/arch/luna68k/dev/lunafb.c 2012/07/20 19:31:53 1.26
+++ src/sys/arch/luna68k/dev/lunafb.c 2013/07/19 16:35:57 1.27
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: lunafb.c,v 1.26 2012/07/20 19:31:53 tsutsui Exp $ */ 1/* $NetBSD: lunafb.c,v 1.27 2013/07/19 16:35:57 tsutsui Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2000 The NetBSD Foundation, Inc. 4 * Copyright (c) 2000 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Tohru Nishimura. 8 * by Tohru Nishimura.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -21,27 +21,27 @@ @@ -21,27 +21,27 @@
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE. 29 * POSSIBILITY OF SUCH DAMAGE.
30 */ 30 */
31 31
32#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */ 32#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
33 33
34__KERNEL_RCSID(0, "$NetBSD: lunafb.c,v 1.26 2012/07/20 19:31:53 tsutsui Exp $"); 34__KERNEL_RCSID(0, "$NetBSD: lunafb.c,v 1.27 2013/07/19 16:35:57 tsutsui Exp $");
35 35
36#include <sys/param.h> 36#include <sys/param.h>
37#include <sys/systm.h> 37#include <sys/systm.h>
38#include <sys/conf.h> 38#include <sys/conf.h>
39#include <sys/device.h> 39#include <sys/device.h>
40#include <sys/ioctl.h> 40#include <sys/ioctl.h>
41#include <sys/malloc.h> 41#include <sys/malloc.h>
42#include <sys/mman.h> 42#include <sys/mman.h>
43#include <sys/proc.h> 43#include <sys/proc.h>
44#include <sys/tty.h> 44#include <sys/tty.h>
45#include <sys/errno.h> 45#include <sys/errno.h>
46#include <sys/buf.h> 46#include <sys/buf.h>
47 47
@@ -369,29 +369,50 @@ omfb_getdevconfig(paddr_t paddr, struct  @@ -369,29 +369,50 @@ omfb_getdevconfig(paddr_t paddr, struct
369#endif 369#endif
370 case 1: 370 case 1:
371 bpp = 1; 371 bpp = 1;
372 break; 372 break;
373 } 373 }
374 dc->dc_wid = 1280; 374 dc->dc_wid = 1280;
375 dc->dc_ht = 1024; 375 dc->dc_ht = 1024;
376 dc->dc_depth = bpp; 376 dc->dc_depth = bpp;
377 dc->dc_rowbytes = 2048 / 8; 377 dc->dc_rowbytes = 2048 / 8;
378 dc->dc_cmsize = (bpp == 1) ? 0 : 1 << bpp; 378 dc->dc_cmsize = (bpp == 1) ? 0 : 1 << bpp;
379 dc->dc_videobase = paddr; 379 dc->dc_videobase = paddr;
380 380
381 /* WHITE on BLACK */ 381 /* WHITE on BLACK */
382 if (hwplanemask == 0x0f) { 382 if (hwplanemask == 0x01) {
383 /* XXX Need Bt454 more initialization */ 383 struct bt454 *odac = (struct bt454 *)OMFB_RAMDAC;
 384
 385 /*
 386 * On 1bpp framebuffer, only plane P0 has framebuffer memory
 387 * and other planes seems pulled up, i.e. always 1.
 388 * Set white only for a palette (P0,P1,P2,P3) = (1,1,1,1).
 389 */
 390 odac->bt_addr = 0;
 391 for (i = 0; i < 15; i++) {
 392 odac->bt_cmap = 0;
 393 odac->bt_cmap = 0;
 394 odac->bt_cmap = 0;
 395 }
 396 /*
 397 * The B/W video connector is connected to IOG of Bt454,
 398 * and IOR and IOB are unused.
 399 */
 400 odac->bt_cmap = 0;
 401 odac->bt_cmap = 255;
 402 odac->bt_cmap = 0;
 403 } else if (hwplanemask == 0x0f) {
384 struct bt454 *odac = (struct bt454 *)OMFB_RAMDAC; 404 struct bt454 *odac = (struct bt454 *)OMFB_RAMDAC;
 405
385 odac->bt_addr = 0; 406 odac->bt_addr = 0;
386 odac->bt_cmap = 0; 407 odac->bt_cmap = 0;
387 odac->bt_cmap = 0; 408 odac->bt_cmap = 0;
388 odac->bt_cmap = 0; 409 odac->bt_cmap = 0;
389 for (i = 1; i < 16; i++) { 410 for (i = 1; i < 16; i++) {
390 odac->bt_cmap = 255; 411 odac->bt_cmap = 255;
391 odac->bt_cmap = 255; 412 odac->bt_cmap = 255;
392 odac->bt_cmap = 255; 413 odac->bt_cmap = 255;
393 } 414 }
394 } else if (hwplanemask == 0xff) { 415 } else if (hwplanemask == 0xff) {
395 struct bt458 *ndac = (struct bt458 *)OMFB_RAMDAC; 416 struct bt458 *ndac = (struct bt458 *)OMFB_RAMDAC;
396 417
397 ndac->bt_addr = 0x04; 418 ndac->bt_addr = 0x04;