From patchwork Sun Aug 21 20:34:17 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: bernie@plugable.com X-Patchwork-Id: 1083832 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.4) with ESMTP id p7LKYn1m027457 for ; Sun, 21 Aug 2011 20:35:06 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755581Ab1HUUfF (ORCPT ); Sun, 21 Aug 2011 16:35:05 -0400 Received: from mail-iy0-f170.google.com ([209.85.210.170]:64871 "EHLO mail-iy0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755463Ab1HUUfE (ORCPT ); Sun, 21 Aug 2011 16:35:04 -0400 Received: by mail-iy0-f170.google.com with SMTP id 16so9119350iye.1 for ; Sun, 21 Aug 2011 13:35:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=sender:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references; bh=RKrE23B3QpG1I+fERsBFGm36Ihj78Q6x0C3AEnUB/IU=; b=j0rnci2Tmb/daHuRMoBksQjE3oOxZjkw/9wwlRd0p49+yQseZZJjorm0PbsurSo//1 ZNSIxa0Sb/CMzNvpQ+rrAm/pK5yA63Kuf6wHZSBDNR2pMsCH4g6bPS+itWUgJ22r2Ntj xpZrB2OWiKBbvsyqYxzr/a1yh0Lr6UpdrZbAo= Received: by 10.231.85.12 with SMTP id m12mr4035464ibl.60.1313958904510; Sun, 21 Aug 2011 13:35:04 -0700 (PDT) Received: from localhost.localdomain (c-76-22-58-200.hsd1.wa.comcast.net [76.22.58.200]) by mx.google.com with ESMTPS id a9sm2974822ibi.60.2011.08.21.13.35.02 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 21 Aug 2011 13:35:03 -0700 (PDT) From: bernie@plugable.com To: linux-fbdev@vger.kernel.org Cc: FlorianSchandinat@gmx.de, Stuart Hopkins , Bernie Thompson Subject: [PATCH 4/6] udlfb: Add module option to do without shadow framebuffer Date: Sun, 21 Aug 2011 13:34:17 -0700 Message-Id: <1313958862-5640-7-git-send-email-bernie@plugable.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1313958862-5640-1-git-send-email-bernie@plugable.com> References: <1313958862-5640-1-git-send-email-bernie@plugable.com> Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Sun, 21 Aug 2011 20:35:06 +0000 (UTC) From: Stuart Hopkins By default, udlfb allocates a 2nd buffer to shadow what's across the bus on the USB device. It can operate without this shadow, but then it cannot tell which pixels have changed, and must send all. Saves host memory, but worsens the USB 2.0 bus bottleneck. This option allows users in very low memory situations (e.g. bifferboard) to optionally turn off this shadow framebuffer. Signed-off-by: Bernie Thompson Signed-off-by: Stuart Hopkins --- Documentation/fb/udlfb.txt | 5 +++++ drivers/video/udlfb.c | 10 ++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/Documentation/fb/udlfb.txt b/Documentation/fb/udlfb.txt index 7fdde2a..473ceed 100644 --- a/Documentation/fb/udlfb.txt +++ b/Documentation/fb/udlfb.txt @@ -105,6 +105,11 @@ console Allow fbcon to attach to udlfb provided framebuffers. This the first framebuffer it finds, which isn't usually what the user wants in the case of USB displays. +shadow Allocate a 2nd framebuffer to shadow what's currently across + the USB bus in device memory. If any pixels are unchanged, + do not transmit. Spends host memory to save USB transfers. + Enabled by default. Only disable on very low memory systems. + Sysfs Attributes ================ diff --git a/drivers/video/udlfb.c b/drivers/video/udlfb.c index f5df3d3..5a13dc5 100644 --- a/drivers/video/udlfb.c +++ b/drivers/video/udlfb.c @@ -72,6 +72,7 @@ MODULE_DEVICE_TABLE(usb, id_table); /* module options */ static int console; /* Optionally allow fbcon to consume first framebuffer */ static int fb_defio; /* Optionally enable experimental fb_defio mmap support */ +static int shadow = 1; /* Optionally disable shadow framebuffer */ /* dlfb keeps a list of urbs for efficient bulk transfers */ static void dlfb_urb_completion(struct urb *urb); @@ -1158,7 +1159,7 @@ static int dlfb_realloc_framebuffer(struct dlfb_data *dev, struct fb_info *info) int new_len; unsigned char *old_fb = info->screen_base; unsigned char *new_fb; - unsigned char *new_back; + unsigned char *new_back = 0; pr_warn("Reallocating framebuffer. Addresses will change!\n"); @@ -1190,7 +1191,8 @@ static int dlfb_realloc_framebuffer(struct dlfb_data *dev, struct fb_info *info) * But with imperfect damage info we may send pixels over USB * that were, in fact, unchanged - wasting limited USB bandwidth */ - new_back = vzalloc(new_len); + if (shadow) + new_back = vzalloc(new_len); if (!new_back) pr_info("No shadow/backing buffer allocated\n"); else { @@ -1603,6 +1605,7 @@ static int dlfb_usb_probe(struct usb_interface *interface, usbdev->descriptor.bcdDevice, dev); pr_info("console enable=%d\n", console); pr_info("fb_defio enable=%d\n", fb_defio); + pr_info("shadow enable=%d\n", shadow); dev->sku_pixel_limit = 2048 * 1152; /* default to maximum */ @@ -1960,6 +1963,9 @@ MODULE_PARM_DESC(console, "Allow fbcon to consume first framebuffer found"); module_param(fb_defio, bool, S_IWUSR | S_IRUSR | S_IWGRP | S_IRGRP); MODULE_PARM_DESC(fb_defio, "Enable fb_defio mmap support. *Experimental*"); +module_param(shadow, bool, S_IWUSR | S_IRUSR | S_IWGRP | S_IRGRP); +MODULE_PARM_DESC(shadow, "Shadow vid mem. Disable to save mem but lose perf"); + MODULE_AUTHOR("Roberto De Ioris , " "Jaya Kumar , " "Bernie Thompson ");