Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1p5RHH-0007ku-JO for mharc-grub-devel@gnu.org; Wed, 14 Dec 2022 07:54:27 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p5RHF-0007kZ-SE for grub-devel@gnu.org; Wed, 14 Dec 2022 07:54:25 -0500 Received: from mo4-p01-ob.smtp.rzone.de ([81.169.146.167]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p5RHC-0002OD-5v for grub-devel@gnu.org; Wed, 14 Dec 2022 07:54:25 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1671022457; s=strato-dkim-0002; d=novelsense.com; h=Message-ID:Date:Subject:In-Reply-To:References:Cc:To:From:Cc:Date: From:Subject:Sender; bh=41Wvys2KzaSJCEBS+QBGPkK02oPrblPEXfMtv6fKxM0=; b=dQi0uMdQMov2b4oASoWkfLnMf+SsLhv2RbMg1OZF5cCj5Zt/dpPoE9gmIO9i9/29GA KVHT3UBShx1s0i1GkXNHzb+mOmg1U1sGMCT7AdSfRXxWD41ZGYhKKoefVNC0mGrOHtmU QttQrcAtHMCWG+Eye8g7KXMwEOAm4jQFRO7WYcSrsfzQDQxdPMLAQNr/ii3j2ch9LJJq Z6pT6+r3Wz3HUbtwA2OFDyxlsSDeB97d0GfWjBtfRSQjv2JGjC1GJgDZSSsTe6/oTH15 rFIKx71b3chTHfg/Gt4vqjtQ6aip97SFR2j7Xf4Tjv0hiUOB4sQsOhls+TAKOC0wheBt ve7Q== Authentication-Results: strato.com; dkim=none X-RZG-AUTH: ":P28MekyyW/FuRqQOhYGtJMr0YcvcIev3suY5UMBvEvA20G1vQGGVl+SI6/tR6fR0V1lZFnou2Tw=" X-RZG-CLASS-ID: mo01 Received: from DESKTOP0NC8IKQ by smtp.strato.de (RZmta 48.2.1 AUTH) with ESMTPSA id m281d2yBECsGT35 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256 bits)) (Client did not present a certificate); Wed, 14 Dec 2022 13:54:16 +0100 (CET) From: "Markus Scholz" To: "'Zhang Boyang'" Cc: "'The development of GNU GRUB'" References: <032301d8de3f$990fe010$cb2fa030$@novelsense.com> <20221020173602.ls3hbhtnwhis4mrl@tomti.i.net-space.pl> <00f501d8e79b$1073c7c0$315b5740$@novelsense.com> <45d8f1f2-9df5-fda8-d003-d61aef4f83e1@gmail.com> <00a001d9097d$7dd0d3e0$79727ba0$@novelsense.com> <11c0f4f4-2b6a-c632-d2b5-7da7c9c8ffd6@gmail.com> In-Reply-To: <11c0f4f4-2b6a-c632-d2b5-7da7c9c8ffd6@gmail.com> Subject: AW: AW: AW: Adding --set to videoinfo to retrieve current video resolution Date: Wed, 14 Dec 2022 13:54:13 +0100 Message-ID: <004201d90fbb$2cb37640$861a62c0$@novelsense.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Mailer: Microsoft Outlook 16.0 Thread-Index: AQFLl7k4ZvZDucrDEG2kx8inGONqLAJc4q4AAbFSLBAB5NZkcQMjuqLhAlJ2bPYCf1zVvQIFaCm3rwjRZ7A= Content-Language: de Received-SPF: none client-ip=81.169.146.167; envelope-from=scholz@novelsense.com; helo=mo4-p01-ob.smtp.rzone.de X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_PASS=-0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 Dec 2022 12:54:26 -0000 Dear Zhang, thank you a lot for your advice and review! I will address the pointed out improvements and then ask Daniel (as he suggested) to take a look. Thanks again & best Markus -----Urspr=C3=BCngliche Nachricht----- Von: Zhang Boyang =20 Gesendet: Dienstag, 13. Dezember 2022 12:07 An: Markus Scholz Cc: The development of GNU GRUB Betreff: Re: AW: AW: Adding --set to videoinfo to retrieve current video = resolution Hi, On 2022/12/12 19:09, Markus Scholz wrote: > Hi, >=20 > thank you again for your reply and explanation. Despite the different=20 > focus, I am still looking forward to try out your additions. >=20 > Regarding my videoinfo patch I submitted them using git to the mailing = > list. What is the best way forward here? >=20 Maybe the only thing what can do now is wait... If you think the = maintainers forget you patches, you can resend them like [PATCH RESEND = 1/1] after few days/weeks. > Since its just a single file and no deep changes maybe the effort is=20 > no too much... Would you be so kind/able to review them or should I=20 > reach out to Daniel for this? I'm not a maintainer of GRUB, so I'm not sure whether I have rights to = send Reviewed-By tags. Although I think I can give some advice for these = patches. I think you can reach out to Daniel if you think these patches are = forgotten. > Since I am new to the grub process I am not sure how to get the = changes in. I'm also new to GRUB (and other open source projects).... So please = forgive me if I said something misleading. Best Regards, Zhang Boyang >=20 > Thank you and best > Markus >=20 >=20 > Zhang Boyang schrieb am Sa., 10. Dez. 2022, > 12:32: >=20 >> Hi, >> >> On 2022/12/6 22:17, Markus Scholz wrote: >>> Hi Zhang, >>> >>> now I need to apologize for my very late reply.. sorry! >>> I saw that you also went ahead as you said with committing the=20 >>> highdpi >> patches. >>> >>> Anyways, regarding the high DPI question: >>> until now we have mostly focused on different screen resolutions in=20 >>> our >> customer offerings and simply chose the font >>> size based on visual testing. So we did not attempt to solve this >> "mathematically". >>> >>> E.g. right now use: >>> - x_res >=3D 1024; bootmenu font ubuntu regular 20 (large theme) >>> - x_res =3D=3D 1204; bootmenu font ubuntu regular 17 (medium theme) >>> - x_res < 1024 & unknown ; bootmenu font ubuntu regular 15 (small=20 >>> theme) >>> >>> I don=E2=80=99t know if this helpful for you but that=E2=80=99s the = current state we=20 >>> are >> using to keep >>> the text readable given different resolutions. Of course, for the >> different fonts/themes >>> (small, medium, large) the screens still look different i.e. the=20 >>> user >> experience is not consistent. >>> Maybe using your highDPI patch it will become much easier to make=20 >>> the appearance consistent and more appealing across different >> screen resolutions. >>> >> >> Thanks for explaining your solution. My font scaling patches can't=20 >> give user consistent experience, because it only accept integer = scaling factors. >> >> By the way, Debian CDs use a fixed 800x600 resolution as far as I=20 >> know, and the user experience is consistent. However, its appearance=20 >> is blurry and this doesn't work on buggy firmwares which do not allow = >> to switch to >> 800x600 resolution. >> >>> Note that we exclusively use gfxmode for our application, avoiding=20 >>> text >> mode. >>> We believe that, for our application, this gives a much more=20 >>> polished >> and mature look&feel. >>> >> >> Unfortunately my patches only work on gfxterm and there is no support = >> for gfxmenu yet (at least for now). >> >> Nevertheless, I think it's good to have both my patches and your=20 >> patches, because I think we are focusing on different things. >> >> Best Regards, >> Zhang Boyang >> >> >>> Also thank you for your recommendation for the patch submission. >>> I will attempt to send another reply to this thread with the help of = >>> git >> patch asap. >>> >>> Best >>> Markus >>> >>> >>> -----Urspr=C3=BCngliche Nachricht----- >>> Von: grub-devel-bounces+scholz=3Dnovelsense.com@gnu.org >> Im Auftrag von=20 >> Zhang Boyang >>> Gesendet: Montag, 7. November 2022 08:56 >>> An: Markus Scholz ; grub-devel@gnu.org >>> Cc: phcoder@gmail.com; pmenzel@molgen.mpg.de; 'Daniel Kiper' < >> dkiper@net-space.pl> >>> Betreff: Re: AW: Adding --set to videoinfo to retrieve current video >> resolution >>> >>> Hi, >>> >>> Sorry for late reply... I think my patch is almost independent of >> Markus's, and it would be good to have both. However, I think there=20 >> are some point we can share opinions. I'd like to ask your opinions=20 >> of the mechanism of choosing font size automatically. In my patch=20 >> (preliminary), it scales Unifont(16x16) M times on a N x 1080p=20 >> screen, with M =3D pow(2,ceil(log2(N))), e.g. 2x when (1080p, 2160p], = >> 4x when (2160p, 4320p], 8x when (4320p, 8640p]. This approach seems=20 >> not good enough, and it might not suitable for custom themes. What's=20 >> your opinion on this from your perspective? I will probably go back=20 >> to work on my HiDPI patch after few weeks. >>> >>> By the way, if I understand correctly, you patch seems reversed, and >> your mail client seems corrupted your patch. You might find "git=20 >> format-patch" and "git send-email" useful :) >>> >>> Best Regards, >>> Zhang Boyang >>> >>> >>> On 2022/10/24 19:23, Markus Scholz wrote: >>>> Hi all, >>>> >>>> * I checked the links by Daniel (thanks for providing). >>>> * As I understand it Zhangs patches aim to add a high dpi scaling=20 >>>> feature for the fonts >>>> * In contrast, the patch I submitted (albeit having a similar >>>> use-case) adds the possibility for grub "scripts" / config files to = >>>> access & act upon the currently used display resolution >>>> * for me both things would have their merit and independent=20 >>>> use-cases >>>> >>>> What is your opinion on having both features? >>>> >>>> Besides, I am willing to help progress both features - if someone=20 >>>> can guide me /give a hint how to proceed best? >>>> >>>> Thank you >>>> Markus >>>> >>>> >>>> -----Urspr=C3=BCngliche Nachricht----- >>>> Von: Daniel Kiper >>>> Gesendet: Donnerstag, 20. Oktober 2022 19:36 >>>> An: Markus Scholz >>>> Cc: grub-devel@gnu.org; phcoder@gmail.com; pmenzel@molgen.mpg.de;=20 >>>> zhangboyang.id@gmail.com >>>> Betreff: Re: Adding --set to videoinfo to retrieve current video=20 >>>> resolution >>>> >>>> Adding Paul, Vladimir, and Zhang... >>>> >>>> On Wed, Oct 12, 2022 at 03:36:13PM +0200, Markus Scholz wrote: >>>>> Dear Grub Developers, >>>>> >>>>> recently we faced the problem the author in this old thread faced: >>>>> -=20 >>>>> https://lists.gnu.org/archive/html/grub-devel/2012-10/msg00009.htm >>>>> l >>>>> >>>>> Ie. our theme wouldn't display properly due to different screen >>>> resolutions. >>>>> Hence, I wanted to change specifically the font size of our theme=20 >>>>> given the current resolution. >>>>> While the videoinfo module provides info about the current=20 >>>>> resolution I wasn't able to discover any way to get the info from=20 >>>>> the booted grub. >>>>> >>>>> Following the aforementioned thread, I therefore patched the=20 >>>>> videoinfo mod to add the ability of a -set switch just like=20 >>>>> commands like "smbinfo" or "search" have. >>>>> >>>>> Ie. the documentation of the videoinfo call could change as = follows: >>>>> >>>>> Command: videoinfo [--set var | [WxH]xD] >>>>> >>>>> Retrieve available video modes. If --set is given, assign=20 >>>>> the currently active resolution to var. >>>>> If --set is not provided the available video modes are = listed. >>>>> If resolution is given, show only matching modes. >>>>> >>>>> Attached is my patch proposal for the module; I probably made a=20 >>>>> lot mistakes wrt. >>>>> coding style and guidelines - please bear with me. >>>>> >>>>> I would be grateful regarding feedback what I could do / how I=20 >>>>> could improve the patch to make it part of grub? If it possible at = >>>>> all with this >>>> approach? >>>> >>>> I think fix for similar problem has been proposed here [1] and I=20 >>>> commented it here [2]. Sadly it ended in limbo. Could you work with = >>>> Zhang on this issue? >>>> >>>> Daniel >>>> >>>> [1] >>>> https://lists.gnu.org/archive/html/grub-devel/2022-06/msg00143.html >>>> [2] >>>> https://lists.gnu.org/archive/html/grub-devel/2022-07/msg00027.html >>>> >>>>> Thank you for your reply & best, >>>>> Markus >>>>> >>>>> --- >>>>> >>>>> --- grub-mod/grub-core/commands/videoinfo.c 2022-10-12 >>>>> 13:30:54.992451000 +0000 >>>>> +++ grub/grub-core/commands/videoinfo.c 2022-10-12 >>>> 13:31:37.715512000 +0000 >>>>> @@ -30,7 +30,6 @@ GRUB_MOD_LICENSE ("GPLv3+"); struct hook_ctx { >>>>> unsigned height, width, depth; >>>>> - unsigned char set_variable; >>>>> struct grub_video_mode_info *current_mode; }; >>>>> >>>>> @@ -39,9 +38,6 @@ hook (const struct grub_video_mode_info { >>>>> struct hook_ctx *ctx =3D hook_arg; >>>>> >>>>> - if (ctx->set_variable) /* if variable should be set don't print = >>>>> all modes */ >>>>> - return 0; >>>>> - >>>>> if (ctx->height && ctx->width && (info->width !=3D = ctx->width=20 >>>>> || >>>>> info->height !=3D ctx->height)) >>>>> return 0; >>>>> >>>>> @@ -136,40 +132,31 @@ grub_cmd_videoinfo (grub_command_t cmd _ >>>>> grub_video_adapter_t adapter; >>>>> grub_video_driver_id_t id; >>>>> struct hook_ctx ctx; >>>>> - >>>>> - ctx.height =3D ctx.width =3D ctx.depth =3D ctx.set_variable =3D = 0; >>>>> - >>>>> + >>>>> + ctx.height =3D ctx.width =3D ctx.depth =3D 0; >>>>> if (argc) >>>>> { >>>>> - if (argc =3D=3D 2 && grub_memcmp(args[0], "--set", sizeof = ("--set") >> - >>>> 1) >>>>> =3D=3D 0 ) >>>>> - ctx.set_variable =3D 1; >>>>> - else >>>>> - { >>>>> const char *ptr; >>>>> ptr =3D args[0]; >>>>> ctx.width =3D grub_strtoul (ptr, &ptr, 0); >>>>> if (grub_errno) >>>>> - return grub_errno; >>>>> + return grub_errno; >>>>> if (*ptr !=3D 'x') >>>>> - return grub_error (GRUB_ERR_BAD_ARGUMENT, >>>>> - N_("invalid video mode specification `%s'"), >>>>> - args[0]); >>>>> + return grub_error (GRUB_ERR_BAD_ARGUMENT, >>>>> + N_("invalid video mode specification = `%s'"), >>>>> + args[0]); >>>>> ptr++; >>>>> ctx.height =3D grub_strtoul (ptr, &ptr, 0); >>>>> if (grub_errno) >>>>> - return grub_errno; >>>>> + return grub_errno; >>>>> if (*ptr =3D=3D 'x') >>>>> - { >>>>> - ptr++; >>>>> - ctx.depth =3D grub_strtoul (ptr, &ptr, 0); >>>>> - if (grub_errno) >>>>> - return grub_errno; >>>>> - } >>>>> - } >>>>> - >>>>> + { >>>>> + ptr++; >>>>> + ctx.depth =3D grub_strtoul (ptr, &ptr, 0); >>>>> + if (grub_errno) >>>>> + return grub_errno; >>>>> + } >>>>> } >>>>> - >>>>> - >>>>> >>>>> #ifdef GRUB_MACHINE_PCBIOS >>>>> if (grub_strcmp (cmd->name, "vbeinfo") =3D=3D 0) @@ -177,23=20 >>>>> +164,20 @@ grub_cmd_videoinfo (grub_command_t cmd _ #endif >>>>> >>>>> id =3D grub_video_get_driver_id (); >>>>> - if (!ctx.set_variable) >>>>> - { >>>>> -grub_puts_ (N_("List of supported video modes:")); -grub_puts_ >>>>> (N_("Legend: mask/position=3Dred/green/blue/reserved")); >>>>> - } >>>>> - >>>>> + >>>>> + grub_puts_ (N_("List of supported video modes:")); grub_puts_ >>>>> + (N_("Legend: mask/position=3Dred/green/blue/reserved")); >>>>> + >>>>> FOR_VIDEO_ADAPTERS (adapter) >>>>> { >>>>> struct grub_video_mode_info info; >>>>> struct grub_video_edid_info edid_info; >>>>> - if (!ctx.set_variable) >>>>> - grub_printf_ (N_("Adapter `%s':\n"), adapter->name); >>>>> + >>>>> + grub_printf_ (N_("Adapter `%s':\n"), adapter->name); >>>>> >>>>> if (!adapter->iterate) >>>>> { >>>>> - if (!ctx.set_variable) >>>>> - grub_puts_ (N_(" No info available")); >>>>> + grub_puts_ (N_(" No info available")); >>>>> continue; >>>>> } >>>>> >>>>> @@ -202,18 +186,7 @@ grub_puts_ (N_("Legend: mask/position=3Dre >>>>> if (adapter->id =3D=3D id) >>>>> { >>>>> if (grub_video_get_info (&info) =3D=3D GRUB_ERR_NONE) >>>>> - { >>>>> - ctx.current_mode =3D &info; >>>>> - if (ctx.set_variable) >>>>> - { >>>>> - /* set grub env var to current mode */ >>>>> - char screen_wxh[20]; >>>>> - unsigned int width =3D info.width; >>>>> - unsigned int height =3D info.height; >>>>> - grub_snprintf (screen_wxh, 20, "%ux%u", width, height); >>>>> - grub_env_set (args[1], screen_wxh); >>>>> - } >>>>> - } >>>>> + ctx.current_mode =3D &info; >>>>> else >>>>> /* Don't worry about errors. */ >>>>> grub_errno =3D GRUB_ERR_NONE; @@ -263,26 +236,19 @@=20 >>>>> GRUB_MOD_INIT(videoinfo) >>>>> /* TRANSLATORS: "x" has to be entered = in, >>>>> like an identifier, so please don't >>>>> use better Unicode codepoints. */ >>>>> - N_("[--set var | [WxH]xD]"), >>>>> - N_("Retrieve available video modes. " >>>>> - "--set is given, assign the currently" >>>>> - "active resolution to var. If --set " >>>>> - "is not provided the available video " >>>>> - "modes are listed. If resolution is " >>>>> - "given, show only matching modes.")); >>>>> - >>>>> + N_("[WxH[xD]]"), >>>>> + N_("List available video modes. If " >>>>> + "resolution is given show only = modes" >>>>> + " matching it.")); >>>>> #ifdef GRUB_MACHINE_PCBIOS >>>>> cmd_vbe =3D grub_register_command ("vbeinfo", = grub_cmd_videoinfo, >>>>> /* TRANSLATORS: "x" has to be=20 >>>>> entered >> in, >>>>> like an identifier, so please = don't >>>>> use better Unicode codepoints. = */ >>>>> - N_("[--set var | [WxH]xD]"), >>>>> - N_("Retrieve available video modes. " >>>>> - "--set is given, assign the currently" >>>>> - "active resolution to var. If --set " >>>>> - "is not provided the available video " >>>>> - "modes are listed. If resolution is " >>>>> - "given, show only matching modes.")); >>>>> + N_("[WxH[xD]]"), >>>>> + N_("List available video modes. If = " >>>>> + "resolution is given show only = modes" >>>>> + " matching it.")); >>>>> #endif >>>>> } >>>> >>> >>> _______________________________________________ >>> Grub-devel mailing list >>> Grub-devel@gnu.org >>> https://lists.gnu.org/mailman/listinfo/grub-devel >>> >> >=20