Received: by 10.192.165.156 with SMTP id m28csp1192146imm; Wed, 11 Apr 2018 14:15:38 -0700 (PDT) X-Google-Smtp-Source: AIpwx48UTOKQmYhJxjDmrl5FHvMpfDjIrANp2DHWbF6YnwkwQOytcb3QjBT8gMwHd6lbYPEMgMox X-Received: by 2002:a17:902:6689:: with SMTP id e9-v6mr6830679plk.176.1523481338254; Wed, 11 Apr 2018 14:15:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523481338; cv=none; d=google.com; s=arc-20160816; b=ecf4gygjwLjwJx+wHYzZbe0e8hDP79PNxwOfv+pHuUuVhVWJdK94NXirB3IGPogiHq HwjRZsecX2p+JZEEJffTKk6Kl8Mju7fSs/pa1hS6ZvSddocCpvNSQuwJ8P4SS8tBbX78 Kx9+7XChRtMemDjsyDFs4rm7wPJnAZI7hin85TEJ2UevqWtfjZBGgx0scMUZwrDvrmjr hgSuNkn33zorZi8bWCTQ8h0Nc8stsY+fObMwrU7V3C3YSBfo/BCkip+rmYXWEtQ4g2vu zFXT3KsLpAR8lb7JWEzzodyG5avm+RgdEBSqfgoFvNd9KfFpv9B9NsaFIi34Qy1Ym98q TjrQ== 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=D0QMK4qwXKvrDnXL7fPflVeV6j6JFw26IdhugZcnadk=; b=q5btY3XuDOIqJX8qcTWUtPYZuPdwFLBI3su1iGTRdgXpF3H8gUaeK3ZZxPMUu2phLC aWlmbw2LPTUkbULJKoL+z01cDCzjJqbvlq6TKKdGZ+kXZPD+Cbme8RSgUOn7O7ql7B6R uyF/HQ6KKGnmyGZVmUBl8JChMU3Hzt7cx7cnLQOfqqLlde5jeJPkHQAqzz3BlYh94Sbt cOVk8T9RarqQCHjhB0DG3njrpqAzmBxr8OaDLfkoyJrIucQICsxK2/s3ofSLWzP740KS G8iOtAOs2tfGdnD/2Tg8DfjoT8P2MlcytZFY/4U9BpA3f0PEWzmioo6vsjuj5oWhHME/ /W9Q== 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 c16-v6si1571069plz.685.2018.04.11.14.15.01; Wed, 11 Apr 2018 14:15:38 -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 S1754883AbeDKSll (ORCPT + 99 others); Wed, 11 Apr 2018 14:41:41 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:56892 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753904AbeDKSlh (ORCPT ); Wed, 11 Apr 2018 14:41:37 -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 4D74BDEB; Wed, 11 Apr 2018 18:41:36 +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 3.18 051/121] vfb: fix video mode and line_length being set when loaded Date: Wed, 11 Apr 2018 20:35:54 +0200 Message-Id: <20180411183459.425624949@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180411183456.195010921@linuxfoundation.org> References: <20180411183456.195010921@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 3.18-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 @@ -284,8 +284,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; } @@ -526,6 +541,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;