From 9dc302fec2b9953f4e999b0fdb948634fe2f2f13 Mon Sep 17 00:00:00 2001 From: bjh21 Date: Sat, 19 Aug 2006 13:34:15 +0000 Subject: [PATCH] Arrange things so that if MONITOR isn't defined in the kernel configration, we use the standard mode list from videomode.c rather than one generated by makemodes.awk. This is less useful than it might be since without a useful frame rate from the bootloader we're likely to end up choosing a screen mode that's either flickery or too fast for the monitor (or DRAM bandwidth). --- sys/arch/acorn32/conf/Makefile.acorn32 | 12 ++++++-- sys/arch/arm/iomd/files.iomd | 5 ++-- sys/arch/arm/iomd/vidc20config.c | 40 +++++++++++++++----------- sys/arch/arm/iomd/vidcvideo.c | 6 ++-- 4 files changed, 38 insertions(+), 25 deletions(-) diff --git a/sys/arch/acorn32/conf/Makefile.acorn32 b/sys/arch/acorn32/conf/Makefile.acorn32 index eb41d7a9f6e7..9781e4bd7dd4 100644 --- a/sys/arch/acorn32/conf/Makefile.acorn32 +++ b/sys/arch/acorn32/conf/Makefile.acorn32 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile.acorn32,v 1.18 2005/12/11 12:16:05 christos Exp $ +# $NetBSD: Makefile.acorn32,v 1.19 2006/08/19 13:34:15 bjh21 Exp $ # Makefile for NetBSD # @@ -51,16 +51,22 @@ MD_SFILES= ${ARM}/arm32/locore.S locore.o: ${ARM}/arm32/locore.S assym.h ${NORMAL_S} -.ifdef MONITOR MD_OBJS+= modedefs.o MD_CFILES+= modedefs.c +.ifdef MONITOR modedefs.c: ${ARM}/iomd/makemodes.awk ${ACORN32}/conf/monitors/${MONITOR} Makefile + ${_MKTARGET_CREATE} awk -f ${ARM}/iomd/makemodes.awk ${ACORN32}/conf/monitors/${MONITOR} ${MODES} >modedefs.c +.else +modedefs.c: ${ARM}/iomd/makemodes.awk Makefile + ${_MKTARGET_CREATE} + awk -f ${ARM}/iomd/makemodes.awk >modedefs.c +.endif modedefs.o: modedefs.c ${NORMAL_C} -.endif + ## ## (5) link settings diff --git a/sys/arch/arm/iomd/files.iomd b/sys/arch/arm/iomd/files.iomd index 1e19a9205ff6..b29be359e6d3 100644 --- a/sys/arch/arm/iomd/files.iomd +++ b/sys/arch/arm/iomd/files.iomd @@ -1,4 +1,4 @@ -# $NetBSD: files.iomd,v 1.17 2006/08/14 22:33:37 bjh21 Exp $ +# $NetBSD: files.iomd,v 1.18 2006/08/19 13:34:15 bjh21 Exp $ # # IOMD-specific configuration data # @@ -45,7 +45,8 @@ file arch/arm/iomd/vidc20.c vidc file arch/arm/iomd/console/consinit.c vidc # VIDC video wscons device -device vidcvideo: rasops4, rasops8, rasops16, rasops32, wsemuldisplaydev +device vidcvideo: rasops4, rasops8, rasops16, rasops32, wsemuldisplaydev, + videomode attach vidcvideo at vidc file arch/arm/iomd/vidc20config.c vidcvideo needs-flag file arch/arm/iomd/vidcvideo.c vidcvideo needs-flag diff --git a/sys/arch/arm/iomd/vidc20config.c b/sys/arch/arm/iomd/vidc20config.c index 2c3fd1d66826..a6439ae1a67d 100644 --- a/sys/arch/arm/iomd/vidc20config.c +++ b/sys/arch/arm/iomd/vidc20config.c @@ -1,4 +1,4 @@ -/* $NetBSD: vidc20config.c,v 1.25 2006/08/19 11:01:56 bjh21 Exp $ */ +/* $NetBSD: vidc20config.c,v 1.26 2006/08/19 13:34:15 bjh21 Exp $ */ /* * Copyright (c) 2001 Reinoud Zandijk @@ -48,7 +48,7 @@ #include -__KERNEL_RCSID(0, "$NetBSD: vidc20config.c,v 1.25 2006/08/19 11:01:56 bjh21 Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vidc20config.c,v 1.26 2006/08/19 13:34:15 bjh21 Exp $"); #include #include @@ -296,6 +296,8 @@ vidcvideo_getmode(struct vidc_mode *mode) static int vidcvideo_coldinit(void) { + struct videomode const *modes; + int count; int found; int i; unsigned framerate; @@ -322,35 +324,39 @@ vidcvideo_coldinit(void) dispend = dispstart+dispsize; + if (vidc_videomode_count > 0) { + modes = vidc_videomode_list; + count = vidc_videomode_count; + } else { + modes = videomode_list; + count = videomode_count; + } + /* try to find the current mode from the bootloader in my table */ - vidc_currentmode.timings = vidc_videomode_list[0]; + vidc_currentmode.timings = modes[0]; found = 0; - for (i = 0; i < vidc_videomode_count; i++) { + for (i = 0; i < count; i++) { /* * We jump through a few hoops here to ensure that we * round roughly to the nearest integer without too * much danger of overflow. */ - framerate = (vidc_videomode_list[i].dot_clock * 1000 / - vidc_videomode_list[i].htotal * 2 / - vidc_videomode_list[i].vtotal + 1) / 2; - if (vidc_videomode_list[i].hdisplay == bootconfig.width + 1 - && vidc_videomode_list[i].vdisplay == bootconfig.height + 1 + framerate = (modes[i].dot_clock * 1000 / + modes[i].htotal * 2 / modes[i].vtotal + 1) / 2; + if (modes[i].hdisplay == bootconfig.width + 1 + && modes[i].vdisplay == bootconfig.height + 1 && framerate == bootconfig.framerate) { - vidc_currentmode.timings = vidc_videomode_list[i]; + vidc_currentmode.timings = modes[i]; found = 1; } } /* if not found choose first mode but dont be picky on the framerate */ if (!found) { - for (i = 0; i < vidc_videomode_count; i++) { - if (vidc_videomode_list[i].hdisplay == - bootconfig.width + 1 - && vidc_videomode_list[i].vdisplay == - bootconfig.height + 1) { - vidc_currentmode.timings = - vidc_videomode_list[i]; + for (i = 0; i < count; i++) { + if (modes[i].hdisplay == bootconfig.width + 1 + && modes[i].vdisplay == bootconfig.height + 1) { + vidc_currentmode.timings = modes[i]; found = 1; } } diff --git a/sys/arch/arm/iomd/vidcvideo.c b/sys/arch/arm/iomd/vidcvideo.c index b772f888cd99..dad63aa7b055 100644 --- a/sys/arch/arm/iomd/vidcvideo.c +++ b/sys/arch/arm/iomd/vidcvideo.c @@ -1,4 +1,4 @@ -/* $NetBSD: vidcvideo.c,v 1.27 2006/08/17 22:33:59 bjh21 Exp $ */ +/* $NetBSD: vidcvideo.c,v 1.28 2006/08/19 13:34:15 bjh21 Exp $ */ /* * Copyright (c) 2001 Reinoud Zandijk @@ -36,7 +36,7 @@ #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: vidcvideo.c,v 1.27 2006/08/17 22:33:59 bjh21 Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vidcvideo.c,v 1.28 2006/08/19 13:34:15 bjh21 Exp $"); #include #include @@ -370,7 +370,7 @@ vidcvideo_attach(struct device *parent, struct device *self, void *aux) dc = sc->sc_dc; vidcvideo_printdetails(); - printf(": using %d x %d, %dbpp\n", dc->dc_wid, dc->dc_ht, + printf(": mode %s, %dbpp\n", dc->mode_info.timings.name, dc->dc_depth); /* initialise rasops */