From patchwork Mon Jan 7 08:26:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Rosin X-Patchwork-Id: 10751575 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 22E3713B5 for ; Tue, 8 Jan 2019 08:49:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0ECCF287D3 for ; Tue, 8 Jan 2019 08:49:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0386D28B82; Tue, 8 Jan 2019 08:49:26 +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=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 59338287D3 for ; Tue, 8 Jan 2019 08:49:25 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 417B46EEBE; Tue, 8 Jan 2019 08:48:50 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from EUR02-AM5-obe.outbound.protection.outlook.com (mail-am5eur02on0705.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe07::705]) by gabe.freedesktop.org (Postfix) with ESMTPS id EF2E16E399 for ; Mon, 7 Jan 2019 08:26:21 +0000 (UTC) Received: from AM6PR02MB4470.eurprd02.prod.outlook.com (20.177.191.218) by AM6PR02MB3640.eurprd02.prod.outlook.com (52.134.112.153) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1495.6; Mon, 7 Jan 2019 08:26:18 +0000 Received: from AM6PR02MB4470.eurprd02.prod.outlook.com ([fe80::e5f3:a239:2ec4:4453]) by AM6PR02MB4470.eurprd02.prod.outlook.com ([fe80::e5f3:a239:2ec4:4453%6]) with mapi id 15.20.1495.011; Mon, 7 Jan 2019 08:26:18 +0000 From: Peter Rosin To: Bartlomiej Zolnierkiewicz Subject: [PATCH] fbdev: fbmem: convert CONFIG_FB_LOGO_CENTER into a cmd line, option Thread-Topic: [PATCH] fbdev: fbmem: convert CONFIG_FB_LOGO_CENTER into a cmd line, option Thread-Index: AQHUpmKp1rTfj0qE9kqQItXBl7LZjA== Date: Mon, 7 Jan 2019 08:26:18 +0000 Message-ID: <37be75aa-7a63-a937-6de7-777a31af741b@axentia.se> References: <20181126215725.2548-1-peda@axentia.se> <20181126215725.2548-3-peda@axentia.se> In-Reply-To: Accept-Language: en-US, sv-SE Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: user-agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.3.3 x-originating-ip: [85.226.244.23] x-clientproxiedby: HE1PR07CA0037.eurprd07.prod.outlook.com (2603:10a6:7:66::23) To AM6PR02MB4470.eurprd02.prod.outlook.com (2603:10a6:20b:60::26) x-ms-exchange-messagesentrepresentingtype: 1 x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; AM6PR02MB3640; 6:InZQ5Pff19uk+db07E+5lvgQEuwE4R2w6DQed7sI45+eaXe5mxVgSeGLLPb+rzEBtb9Ti/fYjPXK0Fp4lm0pC2zrs4nvbCpNcFMh6Wqz9bs0ckhdWuhFpFtofE8+wAC+MDiduwdNZGZLJF4BTQQZUUnXzj1Pk7Q123DD/t5j7c6gFMZStMveOvZFnEwQggEEXMmCVBLpeBokaFYkv1I2tAowsLrdhQEAgIb8P14S0SJw1KzsI4E7+lWanNzRXtQcUgbSqMgsE+nmYhrnkqD/Jn85KMuFFb+oW2jaURbvKEm/ylpJ3sA/dIOTomFAo05zCcc1g42B2CzS1r7NVI8P/fRD05MvJsR2rmsbUA7dXtyQVqeORy5RcgU3vLEzpY2szpQjc5RSmgWDnbUfwgM1nArPwDhzhC3BAJaYeIQTqE2clNGvegIDJUG5D/1uFzcN3dW52+I9huLh2wyihHypOg==; 5:IJDU9tUj2ceBh4YgfluYXQBzk6dJqTfGL5LXGBusmU+1rRimC+8OfA/bDQvWx0iXhyPwIVJwfE1lBeWmTAp4sQEwJeB0LAZCcrK+SLvMhcYkhI515RJpFyCr+bCppWc2O0PYBFstQC9hRWcuWuK6Cm+HD9L1YXYCpL1U68NmKeJbXXzWq5dI0R07qxMLD5MeNYcNMyI0PneGc3abk2lb+Q==; 7:ltczMUuhRoM0VG52bOzmJKsxvfbCgxngpGy+Txtozg93CcZiVxSEjqOffxZAOwtLd7s8DCJjhsGQiCiTgK4umi/MGx0aGiJ5r/ikTNL0RbIfFqrfmziBakm06QDcHmSnn3vwQ5IgYseKLZ6mjzV7oA== x-ms-office365-filtering-correlation-id: af4825ef-6674-4c3a-15f2-08d67479cbd2 x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(7021145)(8989299)(4534185)(7022145)(4603075)(4627221)(201702281549075)(8990200)(7048125)(7024125)(7027125)(7023125)(5600109)(711020)(2017052603328)(7153060)(7193020); SRVR:AM6PR02MB3640; x-ms-traffictypediagnostic: AM6PR02MB3640: x-microsoft-antispam-prvs: x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(3230021)(908002)(999002)(5005026)(6040522)(8220060)(2401047)(8121501046)(3002001)(3231475)(944501520)(52105112)(93006095)(93001095)(10201501046)(6041310)(2016111802025)(20161123558120)(20161123560045)(20161123562045)(20161123564045)(6043046)(201708071742011)(7699051)(76991095); SRVR:AM6PR02MB3640; BCL:0; PCL:0; RULEID:; SRVR:AM6PR02MB3640; x-forefront-prvs: 0910AAF391 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(346002)(136003)(39830400003)(396003)(366004)(376002)(199004)(189003)(54906003)(6512007)(81156014)(8936002)(64126003)(76176011)(53936002)(8676002)(81166006)(316002)(71190400001)(71200400001)(36756003)(74482002)(6916009)(14454004)(97736004)(25786009)(7736002)(58126008)(5024004)(52116002)(31696002)(86362001)(575784001)(256004)(4326008)(68736007)(65826007)(5660300001)(11346002)(186003)(305945005)(105586002)(486006)(476003)(66066001)(106356001)(6486002)(446003)(2616005)(3846002)(26005)(6436002)(99286004)(2906002)(65806001)(65956001)(6116002)(102836004)(508600001)(31686004)(6506007)(386003)(6346003)(53546011); DIR:OUT; SFP:1102; SCL:1; SRVR:AM6PR02MB3640; H:AM6PR02MB4470.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-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: j0quF84YFgpUPuFJwXjr9EYSa6+GzsCp0Rnz9IZdL2hlz7d323ZOAJ3TkIgk1EdISCCz+4yluBolWTQ5wSJLq0YP3OKUiNaxFAsfb0FTEZLOclxOZxOuawbNlXB38ZxsbKlNK8f9e0FaGnkzYRJUrX3gyf7JfbvpcBGocciob80b37DtO1uaFPzR5S0n1Cd+PDn+VZkXcl9e5nYruKm3OepHJRk5x2FzKymk8aueU+FbpH2qWF7OieRZhUPImRkrC2NJYAoQeEIiBsJkIox0kv0iQsqbNR1OAYC8FsjRWDlbmz8kiW/5UjXduJtsJRys spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-ID: <51271FA3BF5BA840893FE6ACFCE39F3E@eurprd02.prod.outlook.com> MIME-Version: 1.0 X-OriginatorOrg: axentia.se X-MS-Exchange-CrossTenant-Network-Message-Id: af4825ef-6674-4c3a-15f2-08d67479cbd2 X-MS-Exchange-CrossTenant-originalarrivaltime: 07 Jan 2019 08:26:17.4188 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 4ee68585-03e1-4785-942a-df9c1871a234 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR02MB3640 X-Mailman-Approved-At: Tue, 08 Jan 2019 08:48:46 +0000 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "linux-fbdev@vger.kernel.org" , Linux Documentation List , Jonathan Corbet , "linux-kernel@vger.kernel.org" , "dri-devel@lists.freedesktop.org" , Geert Uytterhoeven Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP On 2019-01-06 10:33, Geert Uytterhoeven wrote: > Hi Peter, > > On Mon, Nov 26, 2018 at 10:59 PM Peter Rosin wrote: >> 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 > >> --- 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. >> + > > Isn't a kernel command line option more suitable to configure the position > of the logo? That didn't occur to me previously, but it does make sense now that you mention it. This is on top of v5.0-rc1, and if applied before v5.0 we can avoid possible regressions for folks who might start to rely on CONFIG_FB_LOGO_CENTER if v5.0 is released w/o this. Cheers, Peter From de7353ab519ba9b5c9ea3f62d607bb8e94b687cc Mon Sep 17 00:00:00 2001 From: Peter Rosin Cc: Bartlomiej Zolnierkiewicz Cc: Jonathan Corbet Cc: Peter Rosin Cc: dri-devel@lists.freedesktop.org Cc: linux-fbdev@vger.kernel.org Cc: linux-doc@vger.kernel.org To: linux-kernel@vger.kernel.org Date: Mon, 7 Jan 2019 08:35:26 +0100 Subject: [PATCH] fbdev: fbmem: convert CONFIG_FB_LOGO_CENTER into a cmd line option A command line option is much more flexible than a config option and the supporting code is small. Gets rid of #ifdefs in the code too... Suggested-by: Geert Uytterhoeven Signed-off-by: Peter Rosin --- Documentation/fb/fbcon.txt | 6 ++++++ drivers/video/fbdev/core/fbcon.c | 5 +++++ drivers/video/fbdev/core/fbmem.c | 19 ++++++++++--------- drivers/video/logo/Kconfig | 9 --------- include/linux/fb.h | 1 + 5 files changed, 22 insertions(+), 18 deletions(-) diff --git a/Documentation/fb/fbcon.txt b/Documentation/fb/fbcon.txt index 62af30511a95..fb5fa0a8d553 100644 --- a/Documentation/fb/fbcon.txt +++ b/Documentation/fb/fbcon.txt @@ -163,6 +163,12 @@ C. Boot options be preserved until there actually is some text is output to the console. This option causes fbcon to bind immediately to the fbdev device. +7. fbcon=center-logo + + 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. + C. Attaching, Detaching and Unloading Before going on to how to attach, detach and unload the framebuffer console, an diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c index 8976190b6c1f..552cfee63d76 100644 --- a/drivers/video/fbdev/core/fbcon.c +++ b/drivers/video/fbdev/core/fbcon.c @@ -510,6 +510,11 @@ static int __init fb_console_setup(char *this_opt) continue; } #endif + + if (!strcmp(options, "center-logo")) { + fb_center_logo = true; + continue; + } } return 1; } diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c index 558ed2ed3124..cb43a2258c51 100644 --- a/drivers/video/fbdev/core/fbmem.c +++ b/drivers/video/fbdev/core/fbmem.c @@ -53,6 +53,9 @@ EXPORT_SYMBOL(registered_fb); int num_registered_fb __read_mostly; EXPORT_SYMBOL(num_registered_fb); +bool fb_center_logo __read_mostly; +EXPORT_SYMBOL(fb_center_logo); + static struct fb_info *get_fb_info(unsigned int idx) { struct fb_info *fb_info; @@ -506,8 +509,7 @@ 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 - { + if (fb_center_logo) { int xres = info->var.xres; int yres = info->var.yres; @@ -520,11 +522,11 @@ static int fb_show_logo_line(struct fb_info *info, int rotate, --n; image.dx = (xres - n * (logo->width + 8) - 8) / 2; image.dy = y ?: (yres - logo->height) / 2; + } else { + image.dx = 0; + image.dy = y; } -#else - image.dx = 0; - image.dy = y; -#endif + image.width = logo->width; image.height = logo->height; @@ -684,9 +686,8 @@ int fb_prepare_logo(struct fb_info *info, int rotate) } height = fb_logo.logo->height; -#ifdef CONFIG_FB_LOGO_CENTER - height += (yres - fb_logo.logo->height) / 2; -#endif + if (fb_center_logo) + height += (yres - fb_logo.logo->height) / 2; return fb_prepare_extra_logos(info, height, yres); } diff --git a/drivers/video/logo/Kconfig b/drivers/video/logo/Kconfig index 1e972c4e88b1..d1f6196c8b9a 100644 --- a/drivers/video/logo/Kconfig +++ b/drivers/video/logo/Kconfig @@ -10,15 +10,6 @@ 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 diff --git a/include/linux/fb.h b/include/linux/fb.h index 7cdd31a69719..f52ef0ad6781 100644 --- a/include/linux/fb.h +++ b/include/linux/fb.h @@ -653,6 +653,7 @@ extern int fb_new_modelist(struct fb_info *info); extern struct fb_info *registered_fb[FB_MAX]; extern int num_registered_fb; +extern bool fb_center_logo; extern struct class *fb_class; #define for_each_registered_fb(i) \