From patchwork Mon Nov 26 21:57:41 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Rosin X-Patchwork-Id: 10699203 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id EBB6D109C for ; Mon, 26 Nov 2018 21:57:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DAC9A2A67C for ; Mon, 26 Nov 2018 21:57:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CC4FB2A680; Mon, 26 Nov 2018 21:57:56 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5C6FD2A67C for ; Mon, 26 Nov 2018 21:57:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727308AbeK0IxW (ORCPT ); Tue, 27 Nov 2018 03:53:22 -0500 Received: from mail-eopbgr20135.outbound.protection.outlook.com ([40.107.2.135]:43568 "EHLO EUR02-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727238AbeK0IxV (ORCPT ); Tue, 27 Nov 2018 03:53:21 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=axentia.se; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=VdLg27DoSmZJcp6ACARmJLHKrAYb+vfcrN4MQSCbMPc=; b=SwSz7kXqWljpaj4OE5H3j8tOyiV3JnJ3Kzp8t4zyUAMb0ZDNlHuh+V8JX+AYEpK6666Sdo4Yi7zp83Ao3ghGTchF5e44aVwYr462nFp1pVU1oOfRrOqa37S0/ZzNhLY5CqSH61+g0gCD2dp3iSrN7CnTKodOqmLHpsugKnTEUZo= Received: from VI1PR0201MB2464.eurprd02.prod.outlook.com (10.168.64.135) by VI1PR0201MB2414.eurprd02.prod.outlook.com (10.168.64.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1361.15; Mon, 26 Nov 2018 21:57:41 +0000 Received: from VI1PR0201MB2464.eurprd02.prod.outlook.com ([fe80::8de8:73c4:92c8:6c22]) by VI1PR0201MB2464.eurprd02.prod.outlook.com ([fe80::8de8:73c4:92c8:6c22%8]) with mapi id 15.20.1361.019; Mon, 26 Nov 2018 21:57:41 +0000 From: Peter Rosin To: "linux-kernel@vger.kernel.org" CC: Peter Rosin , Bartlomiej Zolnierkiewicz , "dri-devel@lists.freedesktop.org" , "linux-fbdev@vger.kernel.org" Subject: [PATCH 2/2] fbdev: fbmem: add config option to center the bootup logo Thread-Topic: [PATCH 2/2] fbdev: fbmem: add config option to center the bootup logo Thread-Index: AQHUhdMN6R8+9cdGjEGt9UkivTakjw== Date: Mon, 26 Nov 2018 21:57:41 +0000 Message-ID: <20181126215725.2548-3-peda@axentia.se> References: <20181126215725.2548-1-peda@axentia.se> In-Reply-To: <20181126215725.2548-1-peda@axentia.se> Accept-Language: en-US, sv-SE Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.11.0 x-originating-ip: [85.226.244.23] x-clientproxiedby: HE1PR05CA0275.eurprd05.prod.outlook.com (2603:10a6:3:fc::27) To VI1PR0201MB2464.eurprd02.prod.outlook.com (2603:10a6:800:55::7) authentication-results: spf=none (sender IP is ) smtp.mailfrom=peda@axentia.se; x-ms-exchange-messagesentrepresentingtype: 1 x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;VI1PR0201MB2414;6:sa1dFFCMmXg6gUMdk0BBneJcCaNDy2XpbgTVHtLa/LBAvaisptzRNkoAyag0RTtavPxRyfxdeVBbavT9ozJemv6WfmeZcmIoZW7+4pF6C4NQGOfokZAdiOMEaH5Lf0W5V+Rdh2Rc23RSqkZwalMPk5v13qZbTgqscsCORv5nO5jucy7pPTyktt/pDXD/Etmsjtn1dhUAqqe68PPbOa5tiqT5EtCDhJKQJ5M4VRCrd1RGIctymLRNq3EQ2Hopz5fW3G1dP5c+jeA7UIMm9SawrJvukVRE6KYH1msYQB0HEE/cWd3YwpNOQIgaRSIAwQazJ/sb6FDpfTt7u+lOa/HY2oOwBVJEBsCSPLMXdUcPaKK8zJW9kDXP0oCuFhY2LXfXX98jM2JMBf08rEw8GIB2nzxaWPfl3AdXwCSf0C55oHMQoNkzlQtzgk/xnTDigFh1GOrOh83/s1GcxFdm7ZaluQ==;5:CzM2hYnw7G6erlqCzU8BlZDKME8/5lrlR/G7BaP/x3+apjoGZK9a8RZ0ESKpUfO6FlwXJMjc+4Qql8ze1Fu+fQsBxCjSEpljCjFXSIgJ3iiCQab9YFoH0D2vLhPswB9Nh50nLvncfhNBbUTdn2Igc1L0NbLb6ltWTStqZLOwpkY=;7:Tb1BDhkcKuFGQ/0zvyIQuSbzkX3ykZtUMO1bo5/4OehqD3ClJrt4hjdETx/Kk37LQBC+AqTWw8gaeGor9RALYp6pFnzms1Vbn3PN6tDp4QBH5CG/OFuPuzLk+ishjq9RsV6o/xopCSsQ/JFdJpn4/w== x-ms-office365-filtering-correlation-id: b2741158-50c6-40a3-36e1-08d653ea3025 x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390098)(7020095)(4652040)(7021145)(8989299)(5600074)(711020)(4534185)(7022145)(4603075)(4627221)(201702281549075)(8990200)(7048125)(7024125)(7027125)(7023125)(2017052603328)(7153060)(7193020);SRVR:VI1PR0201MB2414; x-ms-traffictypediagnostic: VI1PR0201MB2414: x-microsoft-antispam-prvs: x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(6040522)(2401047)(8121501046)(5005006)(10201501046)(3231443)(944501410)(52105112)(93006095)(93001095)(3002001)(148016)(149066)(150057)(6041310)(20161123560045)(2016111802025)(20161123564045)(20161123562045)(20161123558120)(6043046)(201708071742011)(7699051)(76991095);SRVR:VI1PR0201MB2414;BCL:0;PCL:0;RULEID:;SRVR:VI1PR0201MB2414; x-forefront-prvs: 086831DFB4 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(376002)(39830400003)(396003)(346002)(136003)(366004)(199004)(189003)(6506007)(386003)(7736002)(68736007)(99286004)(305945005)(102836004)(5660300001)(3846002)(6116002)(71190400001)(71200400001)(76176011)(86362001)(36756003)(476003)(66066001)(2501003)(52116002)(1076002)(2906002)(74482002)(2351001)(316002)(6916009)(6436002)(14454004)(54906003)(4326008)(6486002)(6512007)(256004)(5640700003)(508600001)(53936002)(446003)(11346002)(2616005)(8936002)(97736004)(8676002)(486006)(186003)(25786009)(106356001)(26005)(14444005)(105586002)(81156014)(81166006)(50226002)(42262002);DIR:OUT;SFP:1102;SCL:1;SRVR:VI1PR0201MB2414;H:VI1PR0201MB2464.eurprd02.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: axentia.se does not designate permitted sender hosts) x-microsoft-antispam-message-info: L79ogqoxD1ACNKKMcFZRZvYf3AMCRQAqH5zIKcVXefjmiv4kWmJ+1qyLss0hDY4mqv8a/968+dp5net2byFjDwhUn6EodIgOr/kB2+ToXMAijN1OcTuv7GcGTB6sIV7NPFn0g70st6w3mqmhdtLE6wPLs2AQZq2Jr9alhAmHHM3aX/cRLNvyU79va5fFCKQPBI+fwSyJ1fRjH95nuwBNT6lxaWP2RPJ38nCmIkrWrodM51y/P4TbMTufUTke52X04zXKOJ2pkO8rOKu8W8oo+qCFwuVJ8DTzGdw8H16cNGUysSww3xnVpGq5pYQtE9IUFkZxQsaJFsmdOconYrUKF0szRLKGre/SJoY6Xw7OMCk= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: axentia.se X-MS-Exchange-CrossTenant-Network-Message-Id: b2741158-50c6-40a3-36e1-08d653ea3025 X-MS-Exchange-CrossTenant-originalarrivaltime: 26 Nov 2018 21:57:41.7694 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 4ee68585-03e1-4785-942a-df9c1871a234 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0201MB2414 Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP If there are extra logos (CONFIG_FB_LOGO_EXTRA) the heights of these extra logos are not considered when centering the first logo vertically. Signed-off-by: Peter Rosin --- drivers/video/fbdev/core/fbmem.c | 25 ++++++++++++++++++++++++- drivers/video/logo/Kconfig | 9 +++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c index 43d4047f472a..fdbad029e5e6 100644 --- a/drivers/video/fbdev/core/fbmem.c +++ b/drivers/video/fbdev/core/fbmem.c @@ -502,8 +502,25 @@ static int fb_show_logo_line(struct fb_info *info, int rotate, fb_set_logo(info, logo, logo_new, fb_logo.depth); } +#ifdef CONFIG_FB_LOGO_CENTER + { + int xres = info->var.xres; + int yres = info->var.yres; + + if (rotate == FB_ROTATE_CW || rotate == FB_ROTATE_CCW) { + xres = info->var.yres; + yres = info->var.xres; + } + + while (n && (n * (logo->width + 8) - 8 > xres)) + --n; + image.dx = (xres - n * (logo->width + 8) - 8) / 2; + image.dy = y ?: (yres - logo->height) / 2; + } +#else image.dx = 0; image.dy = y; +#endif image.width = logo->width; image.height = logo->height; @@ -600,6 +617,7 @@ int fb_prepare_logo(struct fb_info *info, int rotate) { int depth = fb_get_color_depth(&info->var, &info->fix); unsigned int yres; + int height; memset(&fb_logo, 0, sizeof(struct logo_data)); @@ -661,7 +679,12 @@ int fb_prepare_logo(struct fb_info *info, int rotate) } } - return fb_prepare_extra_logos(info, fb_logo.logo->height, yres); + height = fb_logo.logo->height; +#ifdef CONFIG_FB_LOGO_CENTER + height += (yres - fb_logo.logo->height) / 2; +#endif + + return fb_prepare_extra_logos(info, height, yres); } int fb_show_logo(struct fb_info *info, int rotate) diff --git a/drivers/video/logo/Kconfig b/drivers/video/logo/Kconfig index d1f6196c8b9a..1e972c4e88b1 100644 --- a/drivers/video/logo/Kconfig +++ b/drivers/video/logo/Kconfig @@ -10,6 +10,15 @@ menuconfig LOGO if LOGO +config FB_LOGO_CENTER + bool "Center the logo" + depends on FB=y + help + When this option is selected, the bootup logo is centered both + horizontally and vertically. If more than one logo is displayed + due to multiple CPUs, the collected line of logos is centered + as a whole. + config FB_LOGO_EXTRA bool depends on FB=y