Split the global videosize variable into videowidth and videoheight:

makes the code clearer and avoids multiple parts of it having to know
how videosize was encoded.
This commit is contained in:
jmmv 2007-08-29 12:39:31 +00:00
parent b2d2477c73
commit 2b47cc7981
4 changed files with 22 additions and 18 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: macfb.c,v 1.15 2007/03/04 06:00:07 christos Exp $ */
/* $NetBSD: macfb.c,v 1.16 2007/08/29 12:39:31 jmmv Exp $ */
/*
* Copyright (c) 1998 Matt DeBergalis
* All rights reserved.
@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: macfb.c,v 1.15 2007/03/04 06:00:07 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: macfb.c,v 1.16 2007/08/29 12:39:31 jmmv Exp $");
#include "opt_wsdisplay_compat.h"
#include "grf.h"
@ -121,7 +121,8 @@ static struct macfb_devconfig macfb_console_dc;
extern long videoaddr;
extern long videorowbytes;
extern long videobitdepth;
extern u_long videosize;
extern long videowidth;
extern long videoheight;
extern u_int32_t mac68k_vidlog;
extern u_int32_t mac68k_vidphys;
extern u_int32_t mac68k_vidlen;
@ -344,8 +345,8 @@ macfb_cnattach(paddr_t addr)
dc->dc_vaddr = m68k_trunc_page(videoaddr);
dc->dc_paddr = m68k_trunc_page(mac68k_vidphys);
dc->dc_wid = videosize & 0xffff;
dc->dc_ht = (videosize >> 16) & 0xffff;
dc->dc_wid = videowidth;
dc->dc_ht = videoheight;
dc->dc_depth = videobitdepth;
dc->dc_rowbytes = videorowbytes;

View File

@ -1,4 +1,4 @@
/* $NetBSD: machdep.c,v 1.316 2007/06/02 12:07:04 tsutsui Exp $ */
/* $NetBSD: machdep.c,v 1.317 2007/08/29 12:39:32 jmmv Exp $ */
/*
* Copyright (c) 1982, 1990 The Regents of the University of California.
@ -107,7 +107,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.316 2007/06/02 12:07:04 tsutsui Exp $");
__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.317 2007/08/29 12:39:32 jmmv Exp $");
#include "opt_adb.h"
#include "opt_ddb.h"
@ -212,7 +212,8 @@ long nblen[NBMAXRANGES]; /* Length of this range If the length is */
long videoaddr; /* Addr used in kernel for video */
long videorowbytes; /* Length of row in video RAM */
long videobitdepth; /* Number of bits per pixel */
u_long videosize; /* height = 31:16, width = 15:0 */
long videowidth; /* Framebuffer width */
long videoheight; /* Framebuffer height */
/*
* Values for IIvx-like internal video
@ -989,7 +990,8 @@ getenvvars(u_long flag, char *buf)
videoaddr = getenv("VIDEO_ADDR");
videorowbytes = getenv("ROW_BYTES");
videobitdepth = getenv("SCREEN_DEPTH");
videosize = getenv("DIMENSIONS");
videowidth = getenv("DIMENSIONS") & 0xffff;
videoheight = (getenv("DIMENSIONS") >> 16) & 0xffff;
/*
* More misc stuff from booter.

View File

@ -1,4 +1,4 @@
/* $NetBSD: pmap_bootstrap.c,v 1.70 2007/08/01 23:48:24 dogcow Exp $ */
/* $NetBSD: pmap_bootstrap.c,v 1.71 2007/08/29 12:39:32 jmmv Exp $ */
/*
* Copyright (c) 1991, 1993
@ -36,7 +36,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: pmap_bootstrap.c,v 1.70 2007/08/01 23:48:24 dogcow Exp $");
__KERNEL_RCSID(0, "$NetBSD: pmap_bootstrap.c,v 1.71 2007/08/29 12:39:32 jmmv Exp $");
#include "opt_ddb.h"
#include "opt_kgdb.h"
@ -87,7 +87,7 @@ int vidlen;
extern u_int32_t mac68k_vidphys;
extern u_int32_t videoaddr;
extern u_int32_t videorowbytes;
extern u_int32_t videosize;
extern long videoheight;
static u_int32_t newvideoaddr;
extern void * ROMBase;
@ -130,7 +130,7 @@ pmap_bootstrap(paddr_t nextpa, paddr_t firstpa)
pt_entry_t protopte, *pte, *epte;
extern char start[];
vidlen = m68k_round_page(((videosize >> 16) & 0xffff) * videorowbytes +
vidlen = m68k_round_page(videoheight * videorowbytes +
m68k_page_offset(mac68k_vidphys));
/*

View File

@ -1,4 +1,4 @@
/* $NetBSD: grf_obio.c,v 1.53 2007/03/04 06:00:09 christos Exp $ */
/* $NetBSD: grf_obio.c,v 1.54 2007/08/29 12:39:32 jmmv Exp $ */
/*
* Copyright (C) 1998 Scott Reynolds
@ -60,7 +60,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: grf_obio.c,v 1.53 2007/03/04 06:00:09 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: grf_obio.c,v 1.54 2007/08/29 12:39:32 jmmv Exp $");
#include <sys/param.h>
#include <sys/device.h>
@ -86,7 +86,8 @@ extern u_int32_t mac68k_vidlen;
extern long videoaddr;
extern long videorowbytes;
extern long videobitdepth;
extern u_long videosize;
extern long videowidth;
extern long videoheight;
static int grfiv_mode(struct grf_softc *, int, void *);
static int grfiv_match(struct device *, struct cfdata *, void *);
@ -339,8 +340,8 @@ grfiv_attach(struct device *parent, struct device *self, void *aux)
gm->mode_id = 0;
gm->psize = videobitdepth;
gm->ptype = 0;
gm->width = videosize & 0xffff;
gm->height = (videosize >> 16) & 0xffff;
gm->width = videowidth;
gm->height = videoheight;
gm->rowbytes = videorowbytes;
gm->hres = 80; /* XXX hack */
gm->vres = 80; /* XXX hack */