Received: by 10.213.65.68 with SMTP id h4csp1860300imn; Mon, 19 Mar 2018 15:30:24 -0700 (PDT) X-Google-Smtp-Source: AG47ELtV9CxWrSYP2XwE1JP6YAai1bGR34Y8vS/vI2c94NNOIB8jvBZ/kF+EJhGRpnSg5GrvL+Ta X-Received: by 10.99.123.80 with SMTP id k16mr10378980pgn.173.1521498624223; Mon, 19 Mar 2018 15:30:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521498624; cv=none; d=google.com; s=arc-20160816; b=YLVKHfz6DrojZ5RemmOJSZv1sjE6NPqS7CBuRQmm7km6fBEYfRAvxFioSDcYDMpDLc 9HU8KH4GtYE30uXgiW5EqPxgEoEA3XmLoxVuhiRPKO1wQ4CtqJG8Chdvng72wP9nbAZx EGTWQdO0X2NsZ0d5Bzo9adwP1RpOsUujAXi5MrQVpNxctAC5LrukhhDyqG4OGtb4+Bz0 IPOUVcnll75VlxxnsJFYrSNowddHBJmOT6gl+L50loVwhjWLDXWmRfPhu4w0woSEn9Tp TymVlYOKqoykrBEjYzNd8/4FE4KwfGC+SdxlpaK2Nw5xyQ36YgyRkNUK8RfHYpDLZXcr EtzA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :spamdiagnosticmetadata:spamdiagnosticoutput:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=HLkZyfRp7S5/Y0POzDH+iiHaSysu2mRW8WSqMfND0G0=; b=fsOvVGQxRmfHq8PTGJTn44OLWDspv15j75tPUElk31HnQB8FjWMaFBJ3sBloVbKCla xbXzX/4Il0tosl8cvnBiLGoDsv1ybzEgYoAEtX65bbdIeJn87MmAnnnmM4r8yrZleOWX zj6kGRQK6fuB3QkVTAVk7Ui/3uRXaU12H5X76rA4IkZrULqHotKqBtf8NZdMpcETKHRM g34BFALs4SPWJeyIc1cmw660mBow8e/UbJy/tXjhZHESyF42+JheInZPyD9RCs58iO2N tl7WuHnIsMUYG/HOAc/qKVWXMD7Q2JQvEsbLpralbHE01l2766TeBXloffZZrAYdyobW v/Mg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=XL8bGbJ2; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y5si157842pgc.820.2018.03.19.15.30.09; Mon, 19 Mar 2018 15:30:24 -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; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=XL8bGbJ2; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933820AbeCSPss (ORCPT + 99 others); Mon, 19 Mar 2018 11:48:48 -0400 Received: from mail-by2nam01on0123.outbound.protection.outlook.com ([104.47.34.123]:15712 "EHLO NAM01-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S933763AbeCSPsZ (ORCPT ); Mon, 19 Mar 2018 11:48:25 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=HLkZyfRp7S5/Y0POzDH+iiHaSysu2mRW8WSqMfND0G0=; b=XL8bGbJ2vT7WnO4YoJubxtbAU9JE37Yy0X1oybxAJEUjSC0+ki/iuUuNxQhGX6HAAqnV35e8G5RiyYPeO4zHunA6f1RcIXHruXtnSusDL7kJJNMg5FuzkJXmAC9Jog2D0v2TSgtU1qOF+fiOQui5VJyDE2AB6NzN+MjYhss/SoU= Received: from DM5PR2101MB1032.namprd21.prod.outlook.com (52.132.128.13) by DM5PR2101MB1031.namprd21.prod.outlook.com (52.132.128.12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.631.0; Mon, 19 Mar 2018 15:48:11 +0000 Received: from DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::3d9b:79e7:94eb:5d62]) by DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::3d9b:79e7:94eb:5d62%5]) with mapi id 15.20.0631.004; Mon, 19 Mar 2018 15:48:11 +0000 From: Sasha Levin To: "linux-kernel@vger.kernel.org" , "stable@vger.kernel.org" CC: "Pieter \\\"PoroCYon\\\" Sluys" , Bartlomiej Zolnierkiewicz , Sasha Levin Subject: [PATCH AUTOSEL for 4.15 049/124] vfb: fix video mode and line_length being set when loaded Thread-Topic: [PATCH AUTOSEL for 4.15 049/124] vfb: fix video mode and line_length being set when loaded Thread-Index: AQHTv5mjr/DFMERnt0eP5itUq5OUmA== Date: Mon, 19 Mar 2018 15:47:51 +0000 Message-ID: <20180319154645.11350-49-alexander.levin@microsoft.com> References: <20180319154645.11350-1-alexander.levin@microsoft.com> In-Reply-To: <20180319154645.11350-1-alexander.levin@microsoft.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [52.168.54.252] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;DM5PR2101MB1031;7:nJqaHK3H4zcVjj9MsPV1SAYcvyPi/cVQPp9MYBZ407L+Kkn5ewUE1I2vjtioe19fzlDNDlpFXsUhFJX2w2JWEntZ7+KpwrhtQlmZfcIVGnmj5C+s+HmoRWWyHOQxkl5XT435yYpyLqMTQdNoWFf43Aa1sOHGMofyQFoHAVA8FrprxkCWgfEwoQLDuxiY1H/8nUbXbk9L02cxrL0wgvym63+GXO0ZOjQxfB0/vNGEeFsJWKYkHd9HrMC1dtA2f3g4;20:TszoFD4s+Kywch9WXVnkkFdTLL88nqqrZvFeGDp6SPcmBQ/Rz247glCon/rWgUgMRRodL1TYj4NE1wefViCtg4KhHBuYGHfIGorzHZr7qBi/Pi4tRhK+ssWcO3PtMnyllX/PxpFJDZQ5n33egoWZH9vYqLu3rlz/yAqSj/5MZPc= x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: 732b1818-ff66-48e6-936f-08d58db0d1eb x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(3008032)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7193020);SRVR:DM5PR2101MB1031; x-ms-traffictypediagnostic: DM5PR2101MB1031: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alexander.Levin@microsoft.com; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(28532068793085)(89211679590171)(7411616537696); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(8211001083)(61425038)(6040522)(2401047)(8121501046)(5005006)(93006095)(93001095)(10201501046)(3231221)(944501300)(52105095)(3002001)(6055026)(61426038)(61427038)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123562045)(20161123558120)(20161123560045)(6072148)(201708071742011);SRVR:DM5PR2101MB1031;BCL:0;PCL:0;RULEID:;SRVR:DM5PR2101MB1031; x-forefront-prvs: 06167FAD59 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(366004)(346002)(396003)(39860400002)(39380400002)(376002)(189003)(199004)(6436002)(6512007)(6666003)(3280700002)(2950100002)(7736002)(6116002)(3846002)(10090500001)(105586002)(4326008)(5660300001)(305945005)(1076002)(81156014)(2906002)(6486002)(81166006)(8676002)(8936002)(2900100001)(106356001)(36756003)(68736007)(54906003)(3660700001)(22452003)(97736004)(6506007)(25786009)(99286004)(10290500003)(76176011)(66066001)(14454004)(72206003)(478600001)(102836004)(26005)(186003)(316002)(2501003)(110136005)(5250100002)(575784001)(86362001)(53936002)(107886003)(86612001)(22906009)(217873001);DIR:OUT;SFP:1102;SCL:1;SRVR:DM5PR2101MB1031;H:DM5PR2101MB1032.namprd21.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: 3RtdUAMdXwoFXKNyyy4qFLqMkuG+nmM9LZ08BoCS2BoamczSGMe/0eik0QaANnJ/xLZLwkkb9fZH/2UHWS635f0zdJcVP7bLqlXan2RxIeB5zXs4NpkaB+cDfrT1bzMHJvyEx14HVlyjNpkvzzK6JY76HWiopmh+VPLy89PA4xAb5ikCa3NrmS48+idItEfP1ZStUf1I6+JkIapSNwbwAgjiJVYU9mvNyFb2SLQt8NGetdzdzDEDYpdVtnAEef8M37wYxXPeibMboubij3bj0GO80VG5qiKk5BJ1HMydS+LnqT/mb5KJl7lPAfHjTDuEZWnPLN+vgfLhljWNGNpOlw== spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: 732b1818-ff66-48e6-936f-08d58db0d1eb X-MS-Exchange-CrossTenant-originalarrivaltime: 19 Mar 2018 15:47:51.4928 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR2101MB1031 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- drivers/video/fbdev/vfb.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/drivers/video/fbdev/vfb.c b/drivers/video/fbdev/vfb.c index da653a080394..54127905bfe7 100644 --- a/drivers/video/fbdev/vfb.c +++ b/drivers/video/fbdev/vfb.c @@ -239,8 +239,23 @@ static int vfb_check_var(struct fb_var_screeninfo *var= , */ static int vfb_set_par(struct fb_info *info) { + switch (info->var.bits_per_pixel) { + case 1: + info->fix.visual =3D FB_VISUAL_MONO01; + break; + case 8: + info->fix.visual =3D FB_VISUAL_PSEUDOCOLOR; + break; + case 16: + case 24: + case 32: + info->fix.visual =3D FB_VISUAL_TRUECOLOR; + break; + } + info->fix.line_length =3D get_line_length(info->var.xres_virtual, info->var.bits_per_pixel); + return 0; } =20 @@ -450,6 +465,8 @@ static int vfb_probe(struct platform_device *dev) goto err2; platform_set_drvdata(dev, info); =20 + vfb_set_par(info); + fb_info(info, "Virtual frame buffer device, using %ldK of video memory\n"= , videomemorysize >> 10); return 0; --=20 2.14.1