From e8be2c58e91023fe36720327dd981408b81e4786 Mon Sep 17 00:00:00 2001 From: Marcus Glocker Date: Sat, 19 Sep 2009 20:49:54 +0000 Subject: If UDLIO_DAMAGE fails to queue the damage drawing request, undo the operation and tell the X11 driver to retry later (same as for rasops). --- sys/dev/usb/udl.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) (limited to 'sys/dev/usb/udl.c') diff --git a/sys/dev/usb/udl.c b/sys/dev/usb/udl.c index 6960caf7234..a5afd8f983e 100644 --- a/sys/dev/usb/udl.c +++ b/sys/dev/usb/udl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: udl.c,v 1.42 2009/09/19 11:54:16 mglocker Exp $ */ +/* $OpenBSD: udl.c,v 1.43 2009/09/19 20:49:53 mglocker Exp $ */ /* * Copyright (c) 2009 Marcus Glocker @@ -463,8 +463,9 @@ udl_ioctl(void *v, u_long cmd, caddr_t data, int flag, struct proc *p) d = (struct udl_ioctl_damage *)data; r = udl_damage(sc, sc->sc_fbmem, d->x1, d->x2, d->y1, d->y2); if (r != 0) { - /* XXX we need to inform X11 when we failed to draw */ - printf("%s: %s: damage draw failed!\n", DN(sc), FUNC); + d->status = UDLIO_STATUS_FAILED; + } else { + d->status = UDLIO_STATUS_OK; } break; default: @@ -934,6 +935,9 @@ udl_damage(struct udl_softc *sc, uint8_t *image, { int r; int x, y, width, height; + usbd_status error; + + udl_cmd_get_offset(sc); x = x1; y = y1; @@ -942,11 +946,14 @@ udl_damage(struct udl_softc *sc, uint8_t *image, r = udl_draw_image(sc, image, x, y, width, height); if (r != 0) - return (r); + goto fail; - r = udl_cmd_send_async(sc); - if (r != 0) - return (r); + error = udl_cmd_send_async(sc); + if (error != USBD_NORMAL_COMPLETION) { +fail: + udl_cmd_set_offset(sc); + return (EAGAIN); + } return (0); } -- cgit v1.2.3