From b161d698250fbff888301b5f2eeaf31259463c3b Mon Sep 17 00:00:00 2001 From: Hans Petter Selasky Date: Sun, 15 Feb 2015 22:05:30 +0000 Subject: [PATCH] Bugfixes. Check if a framebuffer is present before using it. Dequeue element from correct head structure. No need to multiply framebuffer offset by two. It is already given in bytes. --- sys/dev/usb/video/udl.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/sys/dev/usb/video/udl.c b/sys/dev/usb/video/udl.c index d0a2f826a58b..40915bd38587 100644 --- a/sys/dev/usb/video/udl.c +++ b/sys/dev/usb/video/udl.c @@ -347,7 +347,7 @@ udl_attach(device_t dev) sc->sc_fb_info.fb_width = udl_get_fb_width(sc); sc->sc_fb_info.fb_height = udl_get_fb_height(sc); sc->sc_fb_info.fb_stride = sc->sc_fb_info.fb_width * 2; - sc->sc_fb_info.fb_pbase = (uintptr_t)sc->sc_fb_addr; + sc->sc_fb_info.fb_pbase = 0; sc->sc_fb_info.fb_vbase = (uintptr_t)sc->sc_fb_addr; sc->sc_fbdev = device_add_child(dev, "fbd", -1); @@ -475,6 +475,11 @@ udl_fb_synchronize(struct udl_softc *sc) { const uint32_t max = udl_get_fb_size(sc); + /* check if framebuffer is not ready */ + if (sc->sc_fb_addr == NULL || + sc->sc_fb_copy == NULL) + return (NULL); + while (sc->sc_sync_off < max) { uint32_t delta = max - sc->sc_sync_off; @@ -522,8 +527,9 @@ udl_bulk_write_callback(struct usb_xfer *xfer, usb_error_t error) cb = udl_fb_synchronize(sc); if (cb == NULL) break; + } else { + TAILQ_REMOVE(&sc->sc_cmd_buf_pending, cb, entry); } - TAILQ_REMOVE(&sc->sc_cmd_buf_pending, cb, entry); TAILQ_INSERT_TAIL(phead, cb, entry); usbd_xfer_set_frame_data(xfer, i, cb->buf, cb->off); } @@ -1059,9 +1065,9 @@ udl_cmd_buf_copy_le16(struct udl_softc *sc, uint32_t src, uint32_t dst, udl_cmd_insert_int_1(cb, UDL_BULK_SOC); udl_cmd_insert_int_1(cb, UDL_BULK_CMD_FB_COPY | UDL_BULK_CMD_FB_WORD); - udl_cmd_insert_int_3(cb, 2 * dst); + udl_cmd_insert_int_3(cb, dst); udl_cmd_insert_int_1(cb, pixels); - udl_cmd_insert_int_3(cb, 2 * src); + udl_cmd_insert_int_3(cb, src); udl_cmd_buf_send(sc, cb); return (0);