Module Name: src
Committed By: jmcneill
Date: Tue Jan 23 00:13:37 UTC 2024
Modified Files:
src/sys/arch/evbppc/include: wii.h
src/sys/arch/evbppc/wii/dev: wiifb.c
Log Message:
wii: Use screen dimming register for screen blanking.
To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/evbppc/include/wii.h
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/evbppc/wii/dev/wiifb.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/arch/evbppc/include/wii.h
diff -u src/sys/arch/evbppc/include/wii.h:1.3 src/sys/arch/evbppc/include/wii.h:1.4
--- src/sys/arch/evbppc/include/wii.h:1.3 Mon Jan 22 21:28:15 2024
+++ src/sys/arch/evbppc/include/wii.h Tue Jan 23 00:13:37 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: wii.h,v 1.3 2024/01/22 21:28:15 jmcneill Exp $ */
+/* $NetBSD: wii.h,v 1.4 2024/01/23 00:13:37 jmcneill Exp $ */
/*-
* Copyright (c) 2024 Jared McNeill <[email protected]>
@@ -101,6 +101,10 @@
#define PI_IRQ_HOLLYWOOD 14
/* Hollywood registers */
+#define HW_VIDIM (HOLLYWOOD_PRIV_BASE + 0x01c)
+#define VIDIM_E __BIT(7)
+#define VIDIM_Y __BITS(5,3)
+#define VIDIM_C __BITS(2,0)
#define HW_PPCIRQFLAGS (HOLLYWOOD_BASE + 0x030)
#define HW_PPCIRQMASK (HOLLYWOOD_BASE + 0x034)
#define HW_ARMIRQFLAGS (HOLLYWOOD_PRIV_BASE + 0x038)
Index: src/sys/arch/evbppc/wii/dev/wiifb.c
diff -u src/sys/arch/evbppc/wii/dev/wiifb.c:1.3 src/sys/arch/evbppc/wii/dev/wiifb.c:1.4
--- src/sys/arch/evbppc/wii/dev/wiifb.c:1.3 Mon Jan 22 23:07:43 2024
+++ src/sys/arch/evbppc/wii/dev/wiifb.c Tue Jan 23 00:13:37 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: wiifb.c,v 1.3 2024/01/22 23:07:43 jmcneill Exp $ */
+/* $NetBSD: wiifb.c,v 1.4 2024/01/23 00:13:37 jmcneill Exp $ */
/*-
* Copyright (c) 2024 Jared McNeill <[email protected]>
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: wiifb.c,v 1.3 2024/01/22 23:07:43 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wiifb.c,v 1.4 2024/01/23 00:13:37 jmcneill Exp $");
#include <sys/param.h>
#include <sys/bus.h>
@@ -118,7 +118,6 @@ static void wiifb_attach(device_t, devic
static void wiifb_init(struct wiifb_softc *);
static void wiifb_set_mode(struct wiifb_softc *, uint8_t, bool);
static void wiifb_set_fb(struct wiifb_softc *);
-static void wiifb_set_picconf(struct wiifb_softc *, u_int, bool);
static int wiifb_ioctl(void *, void *, u_long, void *, int, lwp_t *);
static paddr_t wiifb_mmap(void *, void *, off_t, int);
@@ -203,6 +202,7 @@ static void
wiifb_set_mode(struct wiifb_softc *sc, uint8_t format, bool interlaced)
{
u_int modeidx;
+ u_int strides, reads;
modeidx = WIIFB_MODE_INDEX(format, interlaced);
if (modeidx >= WIIFB_NMODES || wiifb_modes[modeidx].name == NULL) {
@@ -238,7 +238,11 @@ wiifb_set_mode(struct wiifb_softc *sc, u
}
/* Picture configuration */
- wiifb_set_picconf(sc, sc->sc_curmode->width, interlaced);
+ strides = (sc->sc_curmode->width * 2) / (interlaced ? 16 : 32);
+ reads = (sc->sc_curmode->width * 2) / 32;
+ WR2(sc, VI_PICCONF,
+ __SHIFTIN(strides, VI_PICCONF_STRIDES) |
+ __SHIFTIN(reads, VI_PICCONF_READS));
/* Horizontal scaler configuration */
if (interlaced) {
@@ -278,18 +282,6 @@ wiifb_set_fb(struct wiifb_softc *sc)
WR4(sc, VI_BFBR, 0);
}
-static void
-wiifb_set_picconf(struct wiifb_softc *sc, u_int width, bool interlaced)
-{
- u_int strides, reads;
-
- strides = (width * 2) / (interlaced ? 16 : 32);
- reads = (width * 2) / 32;
- WR2(sc, VI_PICCONF,
- __SHIFTIN(strides, VI_PICCONF_STRIDES) |
- __SHIFTIN(reads, VI_PICCONF_READS));
-}
-
static int
wiifb_ioctl(void *v, void *vs, u_long cmd, void *data, int flag, lwp_t *l)
{
@@ -328,11 +320,12 @@ wiifb_ioctl(void *v, void *vs, u_long cm
video = *(u_int *)data;
switch (video) {
case WSDISPLAYIO_VIDEO_OFF:
- wiifb_set_picconf(sc, 0, sc->sc_interlaced);
+ out32(HW_VIDIM, __SHIFTIN(7, VIDIM_Y) |
+ __SHIFTIN(7, VIDIM_C) |
+ VIDIM_E);
return 0;
case WSDISPLAYIO_VIDEO_ON:
- wiifb_set_picconf(sc, sc->sc_curmode->width,
- sc->sc_interlaced);
+ out32(HW_VIDIM, 0);
return 0;
default:
return EINVAL;