summaryrefslogtreecommitdiff
path: root/sys/dev/usb
diff options
context:
space:
mode:
authorMarcus Glocker <mglocker@cvs.openbsd.org>2009-09-20 10:56:03 +0000
committerMarcus Glocker <mglocker@cvs.openbsd.org>2009-09-20 10:56:03 +0000
commit6bcbaccfebbd2c9080a564637dc1757b805c8b84 (patch)
treec6621227bf9d398522925a90c837fd10c486e692 /sys/dev/usb
parent98d8d217384b07580dc1aba6f3f596da070b92b6 (diff)
For now just clear the screen when switching to emulation mode (need to
figure out how we can repaint it as well).
Diffstat (limited to 'sys/dev/usb')
-rw-r--r--sys/dev/usb/udl.c34
1 files changed, 30 insertions, 4 deletions
diff --git a/sys/dev/usb/udl.c b/sys/dev/usb/udl.c
index e0a1e0ee6c2..2ed8c1ca594 100644
--- a/sys/dev/usb/udl.c
+++ b/sys/dev/usb/udl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: udl.c,v 1.47 2009/09/20 10:18:20 mglocker Exp $ */
+/* $OpenBSD: udl.c,v 1.48 2009/09/20 10:56:02 mglocker Exp $ */
/*
* Copyright (c) 2009 Marcus Glocker <mglocker@openbsd.org>
@@ -133,6 +133,7 @@ usbd_status udl_init_chip(struct udl_softc *);
void udl_init_fb_offsets(struct udl_softc *, uint32_t, uint32_t,
uint32_t, uint32_t);
usbd_status udl_init_resolution(struct udl_softc *, uint8_t *, uint8_t);
+usbd_status udl_clear_screen(struct udl_softc *);
int udl_fb_buf_write(struct udl_softc *, uint8_t *, uint32_t,
uint32_t, uint16_t);
int udl_fb_block_write(struct udl_softc *, uint16_t, uint32_t,
@@ -370,6 +371,11 @@ udl_attach_hook(void *arg)
* From this point on we do asynchronous xfers.
*/
udl_cmd_set_xfer_type(sc, UDL_CMD_XFER_ASYNC);
+
+ /*
+ * Set initial wsdisplay emulation mode.
+ */
+ sc->sc_mode = WSDISPLAYIO_MODE_EMUL;
}
int
@@ -461,11 +467,14 @@ udl_ioctl(void *v, u_long cmd, caddr_t data, int flag, struct proc *p)
break;
switch (mode) {
case WSDISPLAYIO_MODE_EMUL:
- /* TODO */
+ (void)udl_clear_screen(sc);
+ /* XXX how shall we repaint the screen? */
break;
case WSDISPLAYIO_MODE_DUMBFB:
/* TODO */
break;
+ default:
+ return (EINVAL);
}
sc->sc_mode = mode;
break;
@@ -1736,8 +1745,7 @@ udl_init_resolution(struct udl_softc *sc, uint8_t *buf, uint8_t len)
return (error);
/* clear screen */
- udl_fb_block_write(sc, 0x0000, 0, 0, sc->sc_width, sc->sc_height);
- error = udl_cmd_send(sc);
+ error = udl_clear_screen(sc);
if (error != USBD_NORMAL_COMPLETION)
return (error);
@@ -1751,6 +1759,24 @@ udl_init_resolution(struct udl_softc *sc, uint8_t *buf, uint8_t len)
return (USBD_NORMAL_COMPLETION);
}
+usbd_status
+udl_clear_screen(struct udl_softc *sc)
+{
+ struct udl_cmd_buf *cb = &sc->sc_cmd_buf;
+ usbd_status error;
+
+ /* clear screen */
+ udl_fb_block_write(sc, 0x0000, 0, 0, sc->sc_width, sc->sc_height);
+ if (cb->xfer_type == UDL_CMD_XFER_ASYNC)
+ error = udl_cmd_send_async(sc);
+ else
+ error = udl_cmd_send(sc);
+ if (error != USBD_NORMAL_COMPLETION)
+ return (error);
+
+ return (USBD_NORMAL_COMPLETION);
+}
+
int
udl_fb_buf_write(struct udl_softc *sc, uint8_t *buf, uint32_t x,
uint32_t y, uint16_t width)