From owner-svn-src-all@FreeBSD.ORG Sat Mar 7 20:49:33 2015 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E07F55BE; Sat, 7 Mar 2015 20:49:33 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B120F23D; Sat, 7 Mar 2015 20:49:33 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t27KnXsH056064; Sat, 7 Mar 2015 20:49:33 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t27KnXBf056063; Sat, 7 Mar 2015 20:49:33 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201503072049.t27KnXBf056063@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Sat, 7 Mar 2015 20:49:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r279753 - head/sys/dev/usb/video X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Mar 2015 20:49:34 -0000 Author: hselasky Date: Sat Mar 7 20:49:32 2015 New Revision: 279753 URL: https://svnweb.freebsd.org/changeset/base/279753 Log: Allow the UDL screen refresh rate to be runtime configurable through a sysctl. Increase the default frame rate to 25 FPS. Add a comment about memory constraints. Modified: head/sys/dev/usb/video/udl.c Modified: head/sys/dev/usb/video/udl.c ============================================================================== --- head/sys/dev/usb/video/udl.c Sat Mar 7 20:45:15 2015 (r279752) +++ head/sys/dev/usb/video/udl.c Sat Mar 7 20:49:32 2015 (r279753) @@ -60,15 +60,22 @@ #define USB_DEBUG_VAR udl_debug #include +static SYSCTL_NODE(_hw_usb, OID_AUTO, udl, CTLFLAG_RW, 0, "USB UDL"); + #ifdef USB_DEBUG static int udl_debug = 0; -static SYSCTL_NODE(_hw_usb, OID_AUTO, udl, CTLFLAG_RW, 0, "USB UDL"); - SYSCTL_INT(_hw_usb_udl, OID_AUTO, debug, CTLFLAG_RWTUN, &udl_debug, 0, "Debug level"); #endif +#define UDL_FPS_MAX 60 +#define UDL_FPS_MIN 1 + +static int udl_fps = 25; +SYSCTL_INT(_hw_usb_udl, OID_AUTO, fps, CTLFLAG_RWTUN, + &udl_fps, 0, "Frames Per Second, 1-60"); + /* * Prototypes. */ @@ -206,14 +213,25 @@ udl_callout(void *arg) { struct udl_softc *sc = arg; const uint32_t max = udl_get_fb_size(sc); + int fps; if (sc->sc_power_save == 0) { + fps = udl_fps; + + /* figure out number of frames per second */ + if (fps < UDL_FPS_MIN) + fps = UDL_FPS_MIN; + else if (fps > UDL_FPS_MAX) + fps = UDL_FPS_MAX; + if (sc->sc_sync_off >= max) sc->sc_sync_off = 0; usbd_transfer_start(sc->sc_xfer[UDL_BULK_WRITE_0]); usbd_transfer_start(sc->sc_xfer[UDL_BULK_WRITE_1]); + } else { + fps = 1; } - callout_reset(&sc->sc_callout, hz / 5, &udl_callout, sc); + callout_reset(&sc->sc_callout, hz / fps, &udl_callout, sc); } static int @@ -765,6 +783,10 @@ udl_fbmem_alloc(struct udl_softc *sc) size = udl_get_fb_size(sc); size = round_page(size); + /* + * It is assumed that allocations above PAGE_SIZE bytes will + * be PAGE_SIZE aligned for use with mmap() + */ sc->sc_fb_addr = malloc(size, M_DEVBUF, M_WAITOK | M_ZERO); sc->sc_fb_copy = malloc(size, M_DEVBUF, M_WAITOK | M_ZERO); sc->sc_fb_size = size;