Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2982620imu; Sun, 9 Dec 2018 14:15:07 -0800 (PST) X-Google-Smtp-Source: AFSGD/W0bkli9VcKeux0OCi8kQnw5ECHTDrkMpgB6PVQwqjPkuNy/Uk6ViYnKy6FmjEsnjTvaHhP X-Received: by 2002:a17:902:20b:: with SMTP id 11mr9939461plc.57.1544393707058; Sun, 09 Dec 2018 14:15:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544393707; cv=none; d=google.com; s=arc-20160816; b=pE3bdiCP7Nwd2mK+wa/gUWlfq8chOas54CioXiZRvnsBY5rc3zcnf6R1Tunw3ZNtDP tlpAMz2waBIEyyNaT3jKbdHawSDaK/akQwNKkETA/4NPgDr+pJFW1vwW5YOaJcJRQfaQ RkbpJ9+B/XiZ7tMPPeMLKrlkEnw4BI8c5hkV0Up5uHtJdaaBzi1QNW/XlV5i6TvDEJ39 OWwpfrzUQAAPCtegJDfjUiFonif1sQ/HUIE0JoGFYkBnmjM2L0lruWhbka5A1L/aGX7d Sl2IlHfdHMea+0OzG0/qpMh0IGqyzLFoHbr7r2nYiU7Q35M+e9hnG7MQqxTAjf66sYt5 Dqqg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:subject:message-id:date:cc:to :from:mime-version:content-transfer-encoding:content-disposition; bh=gVS2+kUDF+2+BrZVS6919vpVSa5AkN+CidK0xLkV4xg=; b=zbU9oaAPTlchC7pzYHL5pUtzeueH3uW6DY5sUFO8XAIuJNMJa4l1bk5DC6nH8BJcfY r+AUyPa4n3UF1T6YWu0wAbReRBo3xexzzdmFOTn+1Vd3RrSUuvirS9zjr91vlzR1hQEb I6AzisMVR4tko/jL9nv5yDlnR0fpL92+BMbq/voK7ndv3EQlCndHoW/DqOJou42Drc5N xxWZHXrJUSiF90jAJGvd7gmVlh7GgqJoxG4dHC9rEDLFuK5f3U0EtsciYNnHNBwBR/hp GvweyXZ98iEuDzCD5DXd2niwkO2V+ghbdgep5+CJAVa/yzMy834s9qxDKIh4abyu+EUW Y6/Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 3si8834610plo.102.2018.12.09.14.14.52; Sun, 09 Dec 2018 14:15:07 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728402AbeLIWNe (ORCPT + 99 others); Sun, 9 Dec 2018 17:13:34 -0500 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:37924 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726500AbeLIWNc (ORCPT ); Sun, 9 Dec 2018 17:13:32 -0500 Received: from pub.yeoldevic.com ([81.174.156.145] helo=deadeye) by shadbolt.decadent.org.uk with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1gW73N-0002ih-Mu; Sun, 09 Dec 2018 21:55:57 +0000 Received: from ben by deadeye with local (Exim 4.91) (envelope-from ) id 1gW72a-0003Gv-7D; Sun, 09 Dec 2018 21:55:08 +0000 Content-Type: text/plain; charset="UTF-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 From: Ben Hutchings To: linux-kernel@vger.kernel.org, stable@vger.kernel.org CC: akpm@linux-foundation.org, "Mikulas Patocka" , "Bartlomiej Zolnierkiewicz" Date: Sun, 09 Dec 2018 21:50:33 +0000 Message-ID: X-Mailer: LinuxStableQueue (scripts by bwh) X-Patchwork-Hint: ignore Subject: [PATCH 3.16 060/328] udlfb: don't switch if we are switching to the same videomode In-Reply-To: X-SA-Exim-Connect-IP: 81.174.156.145 X-SA-Exim-Mail-From: ben@decadent.org.uk X-SA-Exim-Scanned: No (on shadbolt.decadent.org.uk); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.16.62-rc1 review patch. If anyone has any objections, please let me know. ------------------ From: Mikulas Patocka commit 564f1807379298dfdb12ed0d5b25fcb89c238527 upstream. The udlfb driver reprograms the hardware everytime the user switches the console, that makes quite unusable when working on the console. This patch makes the driver remember the videomode we are in and avoid reprogramming the hardware if we switch to the same videomode. We mask the "activate" field and the "FB_VMODE_SMOOTH_XPAN" flag when comparing the videomode, because they cause spurious switches when switching to and from the Xserver. Signed-off-by: Mikulas Patocka Signed-off-by: Bartlomiej Zolnierkiewicz [bwh: Backported to 3.16: Pointer to struct dlfb_data is named "dev" rather than "dlfb"] Signed-off-by: Ben Hutchings --- drivers/video/fbdev/udlfb.c | 18 ++++++++++++++++-- include/video/udlfb.h | 1 + 2 files changed, 17 insertions(+), 2 deletions(-) --- a/drivers/video/fbdev/udlfb.c +++ b/drivers/video/fbdev/udlfb.c @@ -1057,10 +1057,24 @@ static int dlfb_ops_set_par(struct fb_in int result; u16 *pix_framebuffer; int i; + struct fb_var_screeninfo fvs; + + /* clear the activate field because it causes spurious miscompares */ + fvs = info->var; + fvs.activate = 0; + fvs.vmode &= ~FB_VMODE_SMOOTH_XPAN; + + if (!memcmp(&dev->current_mode, &fvs, sizeof(struct fb_var_screeninfo))) + return 0; result = dlfb_set_video_mode(dev, &info->var); - if ((result == 0) && (dev->fb_count == 0)) { + if (result) + return result; + + dev->current_mode = fvs; + + if (dev->fb_count == 0) { /* paint greenscreen */ @@ -1072,7 +1086,7 @@ static int dlfb_ops_set_par(struct fb_in info->screen_base); } - return result; + return 0; } /* To fonzi the jukebox (e.g. make blanking changes take effect) */ --- a/include/video/udlfb.h +++ b/include/video/udlfb.h @@ -56,6 +56,7 @@ struct dlfb_data { atomic_t bytes_identical; /* saved effort with backbuffer comparison */ atomic_t bytes_sent; /* to usb, after compression including overhead */ atomic_t cpu_kcycles_used; /* transpired during pixel processing */ + struct fb_var_screeninfo current_mode; }; #define NR_USB_REQUEST_I2C_SUB_IO 0x02