Received: by 10.213.65.68 with SMTP id h4csp1899707imn; Mon, 19 Mar 2018 16:54:42 -0700 (PDT) X-Google-Smtp-Source: AG47ELs8UahLUUiiKb2vi28GT0bUWe+TLXuzgpKWoP13QbxyNGn8be9CR+E5Yw5eGzZG3Gc8gPEW X-Received: by 2002:a17:902:9a8f:: with SMTP id w15-v6mr128614plp.103.1521503682699; Mon, 19 Mar 2018 16:54:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521503682; cv=none; d=google.com; s=arc-20160816; b=o9oyIJL/hHcSsEqjAEuTHqj/W2CuecKLXIHEt4GzIl14YuFbo3pJStSjJYtG6mTOx7 vEiZkCp489DHM5KPk+7vIGaWilEjq1TRFo3mIdbHtdl43+xtTvkP5nbYaD1ZsPhHMZn9 DQNj7fYbomdH5lRT9tzvbySwtx1auL9Gj6U5eE7rnKJ84CCHp4+TuEhcor+RTusvGSJs qVoFxDXbnZfdH7A9ZFyUrtQUsVAzp7qxvM6A34ciP5bYmVVKS07d5YC9D+kvsps6CaxE MNFnIDv40GTbQofka70D4/LEJRTJdbLKqo6coj+bPRiZfLOdfjZnAszjoikYDdig6q9c 6hFQ== 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=1w50QNwzYOwQkGTF0mSRnf3UaT3yV9w62A9G3nRR/G4=; b=HnOyuWnzgs/JD7DhogAfAH2LhuWPe9I4J1YKuRv73xoV5Okeaa6yEAMMNCAPwBZeOb Uc+RFy/CjRvVY4q4L7DVeaDRjuyBjUOeJRUGDH6LlxrZBp++mnqiC8JNIlkYms6GzigM BqCk0gMQsEcWhVDYkzSvPa9SVVOgGbDR7PN0NDFW+oZGP+Z/s6GHLNxchPG9vc9RXEVv HObOslyCrJbnMi4zeG+CjJjgbiES+whKbpO5ZrgyRooVC/2KQ5PYAWgVNHmaQZRnCp0Y n1L4IgRnY3fNRcQXThwyIcXcz4ajKcygtILDoaePyF98istlFdr3fHdjtnzZK4XjaozX jjOQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=EJx1QNEX; 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 w5si265953pgm.362.2018.03.19.16.54.28; Mon, 19 Mar 2018 16:54:42 -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=EJx1QNEX; 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 S967871AbeCSRSU (ORCPT + 99 others); Mon, 19 Mar 2018 13:18:20 -0400 Received: from mail-sn1nam01on0103.outbound.protection.outlook.com ([104.47.32.103]:51328 "EHLO NAM01-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S966504AbeCSQJq (ORCPT ); Mon, 19 Mar 2018 12:09:46 -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=1w50QNwzYOwQkGTF0mSRnf3UaT3yV9w62A9G3nRR/G4=; b=EJx1QNEXl3UAwzY90+FDU/VZKZvdSK0G4KBJSBhTJMIoYFkBo2uLpjv95ZoCaDAzEprSCjZQxDtJg0l/IpHsOsl5rqMUzgEV5L+dSWBgJgU5oh2Y3IjD+SwG0E9G3T4eK0IxoRLj2D68qH22eJqrLYuwxE8Wv7iH0CVFk/E36A0= Received: from DM5PR2101MB1032.namprd21.prod.outlook.com (52.132.128.13) by DM5PR2101MB0902.namprd21.prod.outlook.com (52.132.132.159) 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 16:09:43 +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 16:09:43 +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.4 092/167] vfb: fix video mode and line_length being set when loaded Thread-Topic: [PATCH AUTOSEL for 4.4 092/167] vfb: fix video mode and line_length being set when loaded Thread-Index: AQHTv5xalNY8PoCxoUiOXeNL9Dw24w== Date: Mon, 19 Mar 2018 16:07:17 +0000 Message-ID: <20180319160513.16384-92-alexander.levin@microsoft.com> References: <20180319160513.16384-1-alexander.levin@microsoft.com> In-Reply-To: <20180319160513.16384-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;DM5PR2101MB0902;7:Ejesfsyx8L1GWhtH+kbdI4yj7ms/coUkMY8VY09omnwyqEA0bh5W3NnFtsEqSN2yT+j/Vuu/OtaKrcQ+/gJZ0dVeixdYJwYebbjaZ7d15V51/ds410RnIMcGbJ56jRa6tFywEFRV3FUtIl9/fPzAmKdIB9wbnMX9Pk+Ls998iUXymGjlF6TegHWs+6FGiOHuWB4W7GiOMKpMBy8eqBZWp5FA5O8tQM6TyrtMHEfFc6lOxxN5+v6m6ZddOtFSE6N0;20:hbWHXO4H5OOkGkDtZwD3WXsxRv55goywGS2KBY1jC7k3HpYpCfuqTejR3jLnN9RA5tefszoGu5M3MhNQeNvbVDPLLe9q5Fwj4sYFw9UVCjK8Z24UXMwGBmk88VJZynzm7ZXWZCy1ck26Zzxc9zyhEdWqByZS/JH+vFkfzjmmr4g= x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: accafa81-df33-4302-e9b3-08d58db3d3d1 x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(3008032)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7193020);SRVR:DM5PR2101MB0902; x-ms-traffictypediagnostic: DM5PR2101MB0902: 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)(5005006)(8121501046)(3231221)(944501300)(52105095)(3002001)(93006095)(93001095)(10201501046)(6055026)(61426038)(61427038)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123562045)(20161123564045)(20161123558120)(6072148)(201708071742011);SRVR:DM5PR2101MB0902;BCL:0;PCL:0;RULEID:;SRVR:DM5PR2101MB0902; x-forefront-prvs: 06167FAD59 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(346002)(366004)(39860400002)(396003)(39380400002)(376002)(199004)(189003)(4326008)(305945005)(7736002)(66066001)(105586002)(316002)(8676002)(25786009)(8936002)(6666003)(2950100002)(5660300001)(97736004)(81166006)(81156014)(3280700002)(22452003)(99286004)(186003)(2906002)(76176011)(5250100002)(54906003)(10090500001)(110136005)(6116002)(2900100001)(3846002)(2501003)(1076002)(86612001)(107886003)(106356001)(6436002)(6512007)(575784001)(86362001)(53936002)(6506007)(6486002)(26005)(14454004)(10290500003)(102836004)(68736007)(3660700001)(478600001)(72206003)(36756003)(22906009)(217873001);DIR:OUT;SFP:1102;SCL:1;SRVR:DM5PR2101MB0902;H:DM5PR2101MB1032.namprd21.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: Xgu6poX9fZX20U8WCKacWNhWv2kisZ4f2TtCORhgVQ6VICdcnGeG11UCKRW74/st1RPjCdhz7STq0RvOBfqxbU0v1/GsVxQ2Epd1lFSQBX7ehMRCc4181OXUEw9ufwyT31nUOYilKrkGcK7oKOBcXXi4oqF7ndGy9zgWoSOzG9WOyUzOnXmjcmGcOtEd9a7c3RtBEbOdjx9eEUrvBi97eYUXyWnLSfkMGRQydt4fIwNslokuq1mAYBBw5oWQmCAxoTwXHxndFpuUwUy/PZHu/OSBNzis4MwSW08vzXMnACp+RNo9XYnCPOUgTZD79c26HTFLcbGErfXnmHCLM1GF/Q== 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: accafa81-df33-4302-e9b3-08d58db3d3d1 X-MS-Exchange-CrossTenant-originalarrivaltime: 19 Mar 2018 16:07:17.3389 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR2101MB0902 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 b9c2f81fb6b9..556c39997aab 100644 --- a/drivers/video/fbdev/vfb.c +++ b/drivers/video/fbdev/vfb.c @@ -291,8 +291,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 @@ -525,6 +540,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