Received: by 10.192.165.156 with SMTP id m28csp71507imm; Tue, 10 Apr 2018 16:40:14 -0700 (PDT) X-Google-Smtp-Source: AIpwx48vwdGsaA1z/R3L2cx3EwuxnguiRoANSZdC2QPzPcEqsE7tFyaSjl9BGQYy2YCmyXG8UNWC X-Received: by 2002:a17:902:24c:: with SMTP id 70-v6mr2481666plc.384.1523403614206; Tue, 10 Apr 2018 16:40:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523403614; cv=none; d=google.com; s=arc-20160816; b=0NcEk/FOBn8rIpYtX2xgEk6uXM5Fp49uf7qFa5Ye+6xlCrUZ0oi6hR72m1VXPLIhHW mrd7QuG22cRI5Fbg5OhHk8HfQrvhd6UV311rw5j1gH38fm7/CjWurivkcJs9/Qcw4D5V 9eavE/rCQEnZtx7n+B0AiayCwgFx6javwFdDFQoClL11Ui0f0MPqqJUnaBsoD/ZpuQy/ Lq8Jypmn5LNw+iX1aFLsYZ/h0OgALH8WVweeLo23Pn7KMsGU/yHzIhaWRK1ADmzKmnf0 hDyqQ0UP8muwsAQXwSRonBmh5pQ4UEyI8ozFs+wJY1ef8RMC1YGX/0R+m5HRkiBuwz8o 9EGA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=HSqusLhNT4uWbUCPY+cFsU6daGfxQe+0I0i/PqFFyUg=; b=ejGi9365NBLmV/7uVjjkNoz0OAfc4mD3MaCrn/h5gSipICwjRgP6RwGnNnwEzQgB3n yxP16n3KVwV34HfbyAkLh781OjhWBK6c5p01fx0C6Zc55BkI8AS7fa3wFJ4vLoANWOg4 h1W4ACQPQfAq8p82xHC81krrM30QDAy2TFzcbcy9xfc3Uh3pTlYLlAkox3lkEi1DRpxd WZ4KIoOxdcLxfPqSfEhoRwjEzJIGk/dE1yaiUwKF3CBtr9v+0+zOuyQWtK+kZLLeaPXv C3ngHXfha8nE03ppRe879/umDEtGdZh8rCwObOLWZrF1urppw4Fbt/v6ZXTC+FtZGxHb kC3g== 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 g1-v6si3546121pld.549.2018.04.10.16.39.37; Tue, 10 Apr 2018 16:40:14 -0700 (PDT) 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 S1753838AbeDJW1t (ORCPT + 99 others); Tue, 10 Apr 2018 18:27:49 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:37966 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753783AbeDJW1q (ORCPT ); Tue, 10 Apr 2018 18:27:46 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 2DAD7CDA; Tue, 10 Apr 2018 22:27:46 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Pieter \"PoroCYon\" Sluys" , Geert Uytterhoeven , Bartlomiej Zolnierkiewicz , Sasha Levin Subject: [PATCH 4.15 046/168] vfb: fix video mode and line_length being set when loaded Date: Wed, 11 Apr 2018 00:23:08 +0200 Message-Id: <20180410212802.165706545@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180410212800.144079021@linuxfoundation.org> References: <20180410212800.144079021@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: "Pieter \\\"PoroCYon\\\" Sluys" [ Upstream commit 7b9faf5df0ac495a1a3d7cdb64921c179f9008ac ] Currently, when loading the vfb module, the newly created fbdev has a line_length of 0, and its video mode would be PSEUDOCOLOR regardless of color depth. (The former could be worked around by calling the FBIOPUT_VSCREENINFO ioctl with having the FBACTIVIATE_FORCE flag set.) This patch automatically sets the line_length correctly, and the video mode is derived from the bit depth now as well. Thanks to Geert Uytterhoeven for confirming the bug and helping me with the patch. Output of `fbset -i' before the patch: mode "1366x768-60" # D: 72.432 MHz, H: 47.403 kHz, V: 60.004 Hz geometry 1366 768 1366 768 32 timings 13806 120 10 14 3 32 5 rgba 8/0,8/8,8/16,8/24 endmode Frame buffer device information: Name : Virtual FB Address : 0xffffaa1405d85000 Size : 4196352 Type : PACKED PIXELS Visual : PSEUDOCOLOR XPanStep : 1 YPanStep : 1 YWrapStep : 1 LineLength : 0 <-- note this Accelerator : No After: mode "1366x768-60" # D: 72.432 MHz, H: 47.403 kHz, V: 60.004 Hz geometry 1366 768 1366 768 32 timings 13806 120 10 14 3 32 5 rgba 8/0,8/8,8/16,8/24 endmode Frame buffer device information: Name : Virtual FB Address : 0xffffaa1405d85000 Size : 4196352 Type : PACKED PIXELS Visual : TRUECOLOR XPanStep : 1 YPanStep : 1 YWrapStep : 1 LineLength : 5464 Accelerator : No Signed-off-by: "Pieter \"PoroCYon\" Sluys" Reviewed-by: Geert Uytterhoeven [b.zolnierkie: minor fixups] Signed-off-by: Bartlomiej Zolnierkiewicz Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/video/fbdev/vfb.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) --- a/drivers/video/fbdev/vfb.c +++ b/drivers/video/fbdev/vfb.c @@ -239,8 +239,23 @@ static int vfb_check_var(struct fb_var_s */ static int vfb_set_par(struct fb_info *info) { + switch (info->var.bits_per_pixel) { + case 1: + info->fix.visual = FB_VISUAL_MONO01; + break; + case 8: + info->fix.visual = FB_VISUAL_PSEUDOCOLOR; + break; + case 16: + case 24: + case 32: + info->fix.visual = FB_VISUAL_TRUECOLOR; + break; + } + info->fix.line_length = get_line_length(info->var.xres_virtual, info->var.bits_per_pixel); + return 0; } @@ -450,6 +465,8 @@ static int vfb_probe(struct platform_dev goto err2; platform_set_drvdata(dev, info); + vfb_set_par(info); + fb_info(info, "Virtual frame buffer device, using %ldK of video memory\n", videomemorysize >> 10); return 0;