* SIMPLE_TEXT_OUTPUT_PROTOCOL and Video Resolution [not found] <CAGRSmLuizR=TQgKQOALmhyZxqTgUxQxP2W7BM5ruG7QjARQPXw@mail.gmail.com> @ 2021-06-16 6:32 ` David F. [not found] ` <1688FC67A39CB5DB.19105@groups.io> 1 sibling, 0 replies; 7+ messages in thread From: David F. @ 2021-06-16 6:32 UTC (permalink / raw) To: devel Hello, I've found that most implementation of UEFI don't automatically change the resolution when setting the mode with STOP (Simple Text Output Protocol) . You can use GOP to change it after the mode but that causes other problems. For example, using surface pro 7 in this case, with 4K screen. The default text mode is 342x96 which puts it in 2736x1824 mode which you'd expect and the text is tiny. But now you set the mode to 0 which is 80x25 and it actually sets the mode to 2736x1824 if not already in that resolution and uses a 80x25 area in the center of the screen, still tiny text you can hardly read. If you then say you want GOP in 640x480 mode (which is available as GOP mode 1 on this system, it will make the font larger but you can't see anything because it's still offset to the middle of the 2736x1824 area and you're only seeing the 640x480 upper left of that area on the screen. Likewise if you have it in 342x96 so it's fully in the upper left corner of the screen and change the mode to say 800x600 (available as GOP mode 2 on this system) it will make the text readable but the text can go off the screen in both directions because it's still 342x96 when the 100x31 STOP mode would be the correct one (which happens to be mode 2 on this system). Shouldn't setting the STOP mode handle adjusting the resolution since that's the main reason you want to change the mode so the size shown on the screen changes to something you can read. Any tricks? I've tried a bunch of things, resetting the controller, using the Reset() protocol function, and other things but nothing works. As soon as you use STOP to set the mode, it is back to high resolution and using an area centered in the screen and changing the resolution after that leaves it in the area centered in the high res screen and not in the upper left area. Thanks. ^ permalink raw reply [flat|nested] 7+ messages in thread
[parent not found: <1688FC67A39CB5DB.19105@groups.io>]
* Re: [edk2-devel] SIMPLE_TEXT_OUTPUT_PROTOCOL and Video Resolution [not found] ` <1688FC67A39CB5DB.19105@groups.io> @ 2021-06-16 21:45 ` David F. 2021-06-16 23:22 ` Andrew Fish 0 siblings, 1 reply; 7+ messages in thread From: David F. @ 2021-06-16 21:45 UTC (permalink / raw) To: devel Also, I found if there are 2 GOP handles and you change the mode of one, the other one doesn't reflect the change (but still doesn't solve anything with the original question), are you supposed to set the mode on every handle to keep that part in sync? On Tue, Jun 15, 2021 at 11:33 PM David F. via groups.io <df7729=gmail.com@groups.io> wrote: > > Hello, > > I've found that most implementation of UEFI don't automatically change > the resolution when setting the mode with STOP (Simple Text Output > Protocol) . You can use GOP to change it after the mode but that > causes other problems. For example, using surface pro 7 in this case, > with 4K screen. The default text mode is 342x96 which puts it in > 2736x1824 mode which you'd expect and the text is tiny. But now you > set the mode to 0 which is 80x25 and it actually sets the mode to > 2736x1824 if not already in that resolution and uses a 80x25 area in > the center of the screen, still tiny text you can hardly read. If you > then say you want GOP in 640x480 mode (which is available as GOP mode > 1 on this system, it will make the font larger but you can't see > anything because it's still offset to the middle of the 2736x1824 area > and you're only seeing the 640x480 upper left of that area on the > screen. Likewise if you have it in 342x96 so it's fully in the upper > left corner of the screen and change the mode to say 800x600 > (available as GOP mode 2 on this system) it will make the text > readable but the text can go off the screen in both directions because > it's still 342x96 when the 100x31 STOP mode would be the correct one > (which happens to be mode 2 on this system). > > Shouldn't setting the STOP mode handle adjusting the resolution since > that's the main reason you want to change the mode so the size shown > on the screen changes to something you can read. > > Any tricks? I've tried a bunch of things, resetting the controller, > using the Reset() protocol function, and other things but nothing > works. As soon as you use STOP to set the mode, it is back to high > resolution and using an area centered in the screen and changing the > resolution after that leaves it in the area centered in the high res > screen and not in the upper left area. > > Thanks. > ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [edk2-devel] SIMPLE_TEXT_OUTPUT_PROTOCOL and Video Resolution 2021-06-16 21:45 ` [edk2-devel] " David F. @ 2021-06-16 23:22 ` Andrew Fish 2021-06-23 10:24 ` Laszlo Ersek 0 siblings, 1 reply; 7+ messages in thread From: Andrew Fish @ 2021-06-16 23:22 UTC (permalink / raw) To: edk2-devel-groups-io, df7729 [-- Attachment #1: Type: text/plain, Size: 3979 bytes --] > On Jun 16, 2021, at 2:45 PM, David F. <df7729@gmail.com> wrote: > > Also, I found if there are 2 GOP handles and you change the mode of > one, the other one doesn't reflect the change (but still doesn't solve > anything with the original question), are you supposed to set the mode > on every handle to keep that part in sync? > A common implementation is to have the Conspliter [1] driver that produces virtual handles that aggregate how many actual devices you have and manages policy. You should grab the protocols on the gST->ConsoleOutHandle as these are the Spec defined active console devices. In terms on Simple Text Output Protocol on Graphics this is the default driver in edk2 [2]. These are the config knobs you can set from your DSC file to control defaults. [Pcd] gEfiMdeModulePkgTokenSpaceGuid.PcdVideoHorizontalResolution ## SOMETIMES_CONSUMES gEfiMdeModulePkgTokenSpaceGuid.PcdVideoVerticalResolution ## SOMETIMES_CONSUMES gEfiMdeModulePkgTokenSpaceGuid.PcdConOutRow ## SOMETIMES_CONSUMES gEfiMdeModulePkgTokenSpaceGuid.PcdConOutColumn ## SOMETIMES_CONSUMES Note: If you have serial active that may mess with the Conspliter and force it to pick a lower resolution since it has to find the best match between the serial and graphics Simple Text In. So try the Graphics without the serial terminal connect to see if it does different stuff. [1] https://github.com/tianocore/edk2/tree/master/MdeModulePkg/Universal/Console/ConSplitterDxe <https://github.com/tianocore/edk2/tree/master/MdeModulePkg/Universal/Console/ConSplitterDxe> [2] https://github.com/tianocore/edk2/tree/master/MdeModulePkg/Universal/Console/GraphicsConsoleDxe <https://github.com/tianocore/edk2/tree/master/MdeModulePkg/Universal/Console/GraphicsConsoleDxe> Thanks, Andrew Fish > On Tue, Jun 15, 2021 at 11:33 PM David F. via groups.io > <df7729=gmail.com@groups.io> wrote: >> >> Hello, >> >> I've found that most implementation of UEFI don't automatically change >> the resolution when setting the mode with STOP (Simple Text Output >> Protocol) . You can use GOP to change it after the mode but that >> causes other problems. For example, using surface pro 7 in this case, >> with 4K screen. The default text mode is 342x96 which puts it in >> 2736x1824 mode which you'd expect and the text is tiny. But now you >> set the mode to 0 which is 80x25 and it actually sets the mode to >> 2736x1824 if not already in that resolution and uses a 80x25 area in >> the center of the screen, still tiny text you can hardly read. If you >> then say you want GOP in 640x480 mode (which is available as GOP mode >> 1 on this system, it will make the font larger but you can't see >> anything because it's still offset to the middle of the 2736x1824 area >> and you're only seeing the 640x480 upper left of that area on the >> screen. Likewise if you have it in 342x96 so it's fully in the upper >> left corner of the screen and change the mode to say 800x600 >> (available as GOP mode 2 on this system) it will make the text >> readable but the text can go off the screen in both directions because >> it's still 342x96 when the 100x31 STOP mode would be the correct one >> (which happens to be mode 2 on this system). >> >> Shouldn't setting the STOP mode handle adjusting the resolution since >> that's the main reason you want to change the mode so the size shown >> on the screen changes to something you can read. >> >> Any tricks? I've tried a bunch of things, resetting the controller, >> using the Reset() protocol function, and other things but nothing >> works. As soon as you use STOP to set the mode, it is back to high >> resolution and using an area centered in the screen and changing the >> resolution after that leaves it in the area centered in the high res >> screen and not in the upper left area. >> >> Thanks. >> > > > > > [-- Attachment #2: Type: text/html, Size: 11042 bytes --] ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [edk2-devel] SIMPLE_TEXT_OUTPUT_PROTOCOL and Video Resolution 2021-06-16 23:22 ` Andrew Fish @ 2021-06-23 10:24 ` Laszlo Ersek 2021-06-23 16:57 ` Andrew Fish 2021-06-24 0:34 ` David F. 0 siblings, 2 replies; 7+ messages in thread From: Laszlo Ersek @ 2021-06-23 10:24 UTC (permalink / raw) To: devel, afish, df7729 On 06/17/21 01:22, Andrew Fish via groups.io wrote: > > >> On Jun 16, 2021, at 2:45 PM, David F. <df7729@gmail.com> wrote: >> >> Also, I found if there are 2 GOP handles and you change the mode of >> one, the other one doesn't reflect the change (but still doesn't solve >> anything with the original question), are you supposed to set the mode >> on every handle to keep that part in sync? >> > > A common implementation is to have the Conspliter [1] driver that produces virtual handles that aggregate how many actual devices you have and manages policy. > > You should grab the protocols on the gST->ConsoleOutHandle as these are the Spec defined active console devices. > > > In terms on Simple Text Output Protocol on Graphics this is the default driver in edk2 [2]. These are the config knobs you can set from your DSC file to control defaults. > > [Pcd] > gEfiMdeModulePkgTokenSpaceGuid.PcdVideoHorizontalResolution ## SOMETIMES_CONSUMES > gEfiMdeModulePkgTokenSpaceGuid.PcdVideoVerticalResolution ## SOMETIMES_CONSUMES > gEfiMdeModulePkgTokenSpaceGuid.PcdConOutRow ## SOMETIMES_CONSUMES > gEfiMdeModulePkgTokenSpaceGuid.PcdConOutColumn ## SOMETIMES_CONSUMES > Note: If you have serial active that may mess with the Conspliter and force it to pick a lower resolution since it has to find the best match between the serial and graphics Simple Text In. So try the Graphics without the serial terminal connect to see if it does different stuff. Regarding the serial terminal aspect, we discussed the following patch (maybe: workaround?) for that, many years ago, off-list: diff --git a/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.c b/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.c index a98b690c8b95..ded5513c74a7 100644 --- a/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.c +++ b/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.c @@ -115,9 +115,44 @@ TERMINAL_DEV mTerminalDevTemplate = { }; TERMINAL_CONSOLE_MODE_DATA mTerminalConsoleModeData[] = { - {80, 25}, - {80, 50}, - {100, 31}, + { 80, 25 }, // from graphics resolution 640 x 480 + { 80, 50 }, // from graphics resolution 640 x 960 + { 100, 25 }, // from graphics resolution 800 x 480 + { 100, 31 }, // from graphics resolution 800 x 600 + { 104, 32 }, // from graphics resolution 832 x 624 + { 120, 33 }, // from graphics resolution 960 x 640 + { 128, 31 }, // from graphics resolution 1024 x 600 + { 128, 40 }, // from graphics resolution 1024 x 768 + { 144, 45 }, // from graphics resolution 1152 x 864 + { 144, 45 }, // from graphics resolution 1152 x 870 + { 160, 37 }, // from graphics resolution 1280 x 720 + { 160, 40 }, // from graphics resolution 1280 x 760 + { 160, 40 }, // from graphics resolution 1280 x 768 + { 160, 42 }, // from graphics resolution 1280 x 800 + { 160, 50 }, // from graphics resolution 1280 x 960 + { 160, 53 }, // from graphics resolution 1280 x 1024 + { 170, 40 }, // from graphics resolution 1360 x 768 + { 170, 40 }, // from graphics resolution 1366 x 768 + { 175, 55 }, // from graphics resolution 1400 x 1050 + { 180, 47 }, // from graphics resolution 1440 x 900 + { 200, 47 }, // from graphics resolution 1600 x 900 + { 200, 63 }, // from graphics resolution 1600 x 1200 + { 210, 55 }, // from graphics resolution 1680 x 1050 + { 240, 56 }, // from graphics resolution 1920 x 1080 + { 240, 63 }, // from graphics resolution 1920 x 1200 + { 240, 75 }, // from graphics resolution 1920 x 1440 + { 250, 105 }, // from graphics resolution 2000 x 2000 + { 256, 80 }, // from graphics resolution 2048 x 1536 + { 256, 107 }, // from graphics resolution 2048 x 2048 + { 320, 75 }, // from graphics resolution 2560 x 1440 + { 320, 84 }, // from graphics resolution 2560 x 1600 + { 320, 107 }, // from graphics resolution 2560 x 2048 + { 350, 110 }, // from graphics resolution 2800 x 2100 + { 400, 126 }, // from graphics resolution 3200 x 2400 + { 480, 113 }, // from graphics resolution 3840 x 2160 + { 512, 113 }, // from graphics resolution 4096 x 2160 + { 960, 227 }, // from graphics resolution 7680 x 4320 + { 1024, 227 }, // from graphics resolution 8192 x 4320 // // New modes can be added here. // but the discussion didn't go anywhere over several months, so we've been carrying this patch downstream-only ever since. Thanks Laszlo > > > [1] https://github.com/tianocore/edk2/tree/master/MdeModulePkg/Universal/Console/ConSplitterDxe <https://github.com/tianocore/edk2/tree/master/MdeModulePkg/Universal/Console/ConSplitterDxe> > > [2] https://github.com/tianocore/edk2/tree/master/MdeModulePkg/Universal/Console/GraphicsConsoleDxe <https://github.com/tianocore/edk2/tree/master/MdeModulePkg/Universal/Console/GraphicsConsoleDxe> > > > Thanks, > > Andrew Fish > >> On Tue, Jun 15, 2021 at 11:33 PM David F. via groups.io >> <df7729=gmail.com@groups.io> wrote: >>> >>> Hello, >>> >>> I've found that most implementation of UEFI don't automatically change >>> the resolution when setting the mode with STOP (Simple Text Output >>> Protocol) . You can use GOP to change it after the mode but that >>> causes other problems. For example, using surface pro 7 in this case, >>> with 4K screen. The default text mode is 342x96 which puts it in >>> 2736x1824 mode which you'd expect and the text is tiny. But now you >>> set the mode to 0 which is 80x25 and it actually sets the mode to >>> 2736x1824 if not already in that resolution and uses a 80x25 area in >>> the center of the screen, still tiny text you can hardly read. If you >>> then say you want GOP in 640x480 mode (which is available as GOP mode >>> 1 on this system, it will make the font larger but you can't see >>> anything because it's still offset to the middle of the 2736x1824 area >>> and you're only seeing the 640x480 upper left of that area on the >>> screen. Likewise if you have it in 342x96 so it's fully in the upper >>> left corner of the screen and change the mode to say 800x600 >>> (available as GOP mode 2 on this system) it will make the text >>> readable but the text can go off the screen in both directions because >>> it's still 342x96 when the 100x31 STOP mode would be the correct one >>> (which happens to be mode 2 on this system). >>> >>> Shouldn't setting the STOP mode handle adjusting the resolution since >>> that's the main reason you want to change the mode so the size shown >>> on the screen changes to something you can read. >>> >>> Any tricks? I've tried a bunch of things, resetting the controller, >>> using the Reset() protocol function, and other things but nothing >>> works. As soon as you use STOP to set the mode, it is back to high >>> resolution and using an area centered in the screen and changing the >>> resolution after that leaves it in the area centered in the high res >>> screen and not in the upper left area. >>> >>> Thanks. >>> >> >> >> >> >> > > > > > > > ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [edk2-devel] SIMPLE_TEXT_OUTPUT_PROTOCOL and Video Resolution 2021-06-23 10:24 ` Laszlo Ersek @ 2021-06-23 16:57 ` Andrew Fish 2021-06-23 19:23 ` Laszlo Ersek 2021-06-24 0:34 ` David F. 1 sibling, 1 reply; 7+ messages in thread From: Andrew Fish @ 2021-06-23 16:57 UTC (permalink / raw) To: edk2-devel-groups-io, Laszlo Ersek; +Cc: df7729 [-- Attachment #1: Type: text/plain, Size: 9069 bytes --] > On Jun 23, 2021, at 3:24 AM, Laszlo Ersek <lersek@redhat.com> wrote: > > On 06/17/21 01:22, Andrew Fish via groups.io <http://groups.io/> wrote: >> >> >>> On Jun 16, 2021, at 2:45 PM, David F. <df7729@gmail.com> wrote: >>> >>> Also, I found if there are 2 GOP handles and you change the mode of >>> one, the other one doesn't reflect the change (but still doesn't solve >>> anything with the original question), are you supposed to set the mode >>> on every handle to keep that part in sync? >>> >> >> A common implementation is to have the Conspliter [1] driver that produces virtual handles that aggregate how many actual devices you have and manages policy. >> >> You should grab the protocols on the gST->ConsoleOutHandle as these are the Spec defined active console devices. >> >> >> In terms on Simple Text Output Protocol on Graphics this is the default driver in edk2 [2]. These are the config knobs you can set from your DSC file to control defaults. >> >> [Pcd] >> gEfiMdeModulePkgTokenSpaceGuid.PcdVideoHorizontalResolution ## SOMETIMES_CONSUMES >> gEfiMdeModulePkgTokenSpaceGuid.PcdVideoVerticalResolution ## SOMETIMES_CONSUMES >> gEfiMdeModulePkgTokenSpaceGuid.PcdConOutRow ## SOMETIMES_CONSUMES >> gEfiMdeModulePkgTokenSpaceGuid.PcdConOutColumn ## SOMETIMES_CONSUMES >> Note: If you have serial active that may mess with the Conspliter and force it to pick a lower resolution since it has to find the best match between the serial and graphics Simple Text In. So try the Graphics without the serial terminal connect to see if it does different stuff. > > Regarding the serial terminal aspect, we discussed the following patch (maybe: workaround?) for that, many years ago, off-list: > Laszlo, This reminds me I have some hacks in our terminal driver too. 1) Add a mode that matches the Mode 2 of the GraphicsConsole driver. a) This kind of assumes BDS connects the graphics 1st. b) We could generalized this to match the higher modes of the ConSpliter? 2) I added a PCD to make the Mode 2 match the current size terminal. a) The EFI Terminal driver sends { ESC, '[', '1', '8', 't', 0 } to the terminal emulator app and gets the current size as a response. b) I mostly use this for OVMF with no Graphics console. 3) I think 1) and 2) may require a PCD to the ConSpliter to pick the max mode vs. a known mode. It might be possible to hijack the current PCD values for this. 4) At one point I added some code with 1) that would auto resize the terminal window to match the graphics screen resolution. I think this was one of the most unpopular things I’ve ever done at work. I guess I’m a just open a bunch of windows and switch between them person, but some people optimize the windows layout and get really angry if you resize windows on them. Thanks, Andrew Fish > diff --git a/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.c b/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.c > index a98b690c8b95..ded5513c74a7 100644 > --- a/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.c > +++ b/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.c > @@ -115,9 +115,44 @@ TERMINAL_DEV mTerminalDevTemplate = { > }; > > TERMINAL_CONSOLE_MODE_DATA mTerminalConsoleModeData[] = { > - {80, 25}, > - {80, 50}, > - {100, 31}, > + { 80, 25 }, // from graphics resolution 640 x 480 > + { 80, 50 }, // from graphics resolution 640 x 960 > + { 100, 25 }, // from graphics resolution 800 x 480 > + { 100, 31 }, // from graphics resolution 800 x 600 > + { 104, 32 }, // from graphics resolution 832 x 624 > + { 120, 33 }, // from graphics resolution 960 x 640 > + { 128, 31 }, // from graphics resolution 1024 x 600 > + { 128, 40 }, // from graphics resolution 1024 x 768 > + { 144, 45 }, // from graphics resolution 1152 x 864 > + { 144, 45 }, // from graphics resolution 1152 x 870 > + { 160, 37 }, // from graphics resolution 1280 x 720 > + { 160, 40 }, // from graphics resolution 1280 x 760 > + { 160, 40 }, // from graphics resolution 1280 x 768 > + { 160, 42 }, // from graphics resolution 1280 x 800 > + { 160, 50 }, // from graphics resolution 1280 x 960 > + { 160, 53 }, // from graphics resolution 1280 x 1024 > + { 170, 40 }, // from graphics resolution 1360 x 768 > + { 170, 40 }, // from graphics resolution 1366 x 768 > + { 175, 55 }, // from graphics resolution 1400 x 1050 > + { 180, 47 }, // from graphics resolution 1440 x 900 > + { 200, 47 }, // from graphics resolution 1600 x 900 > + { 200, 63 }, // from graphics resolution 1600 x 1200 > + { 210, 55 }, // from graphics resolution 1680 x 1050 > + { 240, 56 }, // from graphics resolution 1920 x 1080 > + { 240, 63 }, // from graphics resolution 1920 x 1200 > + { 240, 75 }, // from graphics resolution 1920 x 1440 > + { 250, 105 }, // from graphics resolution 2000 x 2000 > + { 256, 80 }, // from graphics resolution 2048 x 1536 > + { 256, 107 }, // from graphics resolution 2048 x 2048 > + { 320, 75 }, // from graphics resolution 2560 x 1440 > + { 320, 84 }, // from graphics resolution 2560 x 1600 > + { 320, 107 }, // from graphics resolution 2560 x 2048 > + { 350, 110 }, // from graphics resolution 2800 x 2100 > + { 400, 126 }, // from graphics resolution 3200 x 2400 > + { 480, 113 }, // from graphics resolution 3840 x 2160 > + { 512, 113 }, // from graphics resolution 4096 x 2160 > + { 960, 227 }, // from graphics resolution 7680 x 4320 > + { 1024, 227 }, // from graphics resolution 8192 x 4320 > // > // New modes can be added here. > // > > but the discussion didn't go anywhere over several months, so we've been carrying this patch downstream-only ever since. > > Thanks > Laszlo > >> >> >> [1] https://github.com/tianocore/edk2/tree/master/MdeModulePkg/Universal/Console/ConSplitterDxe <https://github.com/tianocore/edk2/tree/master/MdeModulePkg/Universal/Console/ConSplitterDxe> <https://github.com/tianocore/edk2/tree/master/MdeModulePkg/Universal/Console/ConSplitterDxe <https://github.com/tianocore/edk2/tree/master/MdeModulePkg/Universal/Console/ConSplitterDxe>> >> >> [2] https://github.com/tianocore/edk2/tree/master/MdeModulePkg/Universal/Console/GraphicsConsoleDxe <https://github.com/tianocore/edk2/tree/master/MdeModulePkg/Universal/Console/GraphicsConsoleDxe> <https://github.com/tianocore/edk2/tree/master/MdeModulePkg/Universal/Console/GraphicsConsoleDxe <https://github.com/tianocore/edk2/tree/master/MdeModulePkg/Universal/Console/GraphicsConsoleDxe>> >> >> >> Thanks, >> >> Andrew Fish >> >>> On Tue, Jun 15, 2021 at 11:33 PM David F. via groups.io <http://groups.io/> >>> <df7729=gmail.com@groups.io <mailto:df7729=gmail.com@groups.io>> wrote: >>>> >>>> Hello, >>>> >>>> I've found that most implementation of UEFI don't automatically change >>>> the resolution when setting the mode with STOP (Simple Text Output >>>> Protocol) . You can use GOP to change it after the mode but that >>>> causes other problems. For example, using surface pro 7 in this case, >>>> with 4K screen. The default text mode is 342x96 which puts it in >>>> 2736x1824 mode which you'd expect and the text is tiny. But now you >>>> set the mode to 0 which is 80x25 and it actually sets the mode to >>>> 2736x1824 if not already in that resolution and uses a 80x25 area in >>>> the center of the screen, still tiny text you can hardly read. If you >>>> then say you want GOP in 640x480 mode (which is available as GOP mode >>>> 1 on this system, it will make the font larger but you can't see >>>> anything because it's still offset to the middle of the 2736x1824 area >>>> and you're only seeing the 640x480 upper left of that area on the >>>> screen. Likewise if you have it in 342x96 so it's fully in the upper >>>> left corner of the screen and change the mode to say 800x600 >>>> (available as GOP mode 2 on this system) it will make the text >>>> readable but the text can go off the screen in both directions because >>>> it's still 342x96 when the 100x31 STOP mode would be the correct one >>>> (which happens to be mode 2 on this system). >>>> >>>> Shouldn't setting the STOP mode handle adjusting the resolution since >>>> that's the main reason you want to change the mode so the size shown >>>> on the screen changes to something you can read. >>>> >>>> Any tricks? I've tried a bunch of things, resetting the controller, >>>> using the Reset() protocol function, and other things but nothing >>>> works. As soon as you use STOP to set the mode, it is back to high >>>> resolution and using an area centered in the screen and changing the >>>> resolution after that leaves it in the area centered in the high res >>>> screen and not in the upper left area. >>>> >>>> Thanks. >>>> >>> >>> >>> >>> >>> >> >> >> >> >> >> >> > > > > [-- Attachment #2: Type: text/html, Size: 57238 bytes --] ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [edk2-devel] SIMPLE_TEXT_OUTPUT_PROTOCOL and Video Resolution 2021-06-23 16:57 ` Andrew Fish @ 2021-06-23 19:23 ` Laszlo Ersek 0 siblings, 0 replies; 7+ messages in thread From: Laszlo Ersek @ 2021-06-23 19:23 UTC (permalink / raw) To: Andrew Fish, edk2-devel-groups-io; +Cc: df7729 On 06/23/21 18:57, Andrew Fish wrote: > > >> On Jun 23, 2021, at 3:24 AM, Laszlo Ersek <lersek@redhat.com> wrote: >> >> On 06/17/21 01:22, Andrew Fish via groups.io <http://groups.io/> wrote: >>> >>> >>>> On Jun 16, 2021, at 2:45 PM, David F. <df7729@gmail.com> wrote: >>>> >>>> Also, I found if there are 2 GOP handles and you change the mode of >>>> one, the other one doesn't reflect the change (but still doesn't solve >>>> anything with the original question), are you supposed to set the mode >>>> on every handle to keep that part in sync? >>>> >>> >>> A common implementation is to have the Conspliter [1] driver that produces virtual handles that aggregate how many actual devices you have and manages policy. >>> >>> You should grab the protocols on the gST->ConsoleOutHandle as these are the Spec defined active console devices. >>> >>> >>> In terms on Simple Text Output Protocol on Graphics this is the default driver in edk2 [2]. These are the config knobs you can set from your DSC file to control defaults. >>> >>> [Pcd] >>> gEfiMdeModulePkgTokenSpaceGuid.PcdVideoHorizontalResolution ## SOMETIMES_CONSUMES >>> gEfiMdeModulePkgTokenSpaceGuid.PcdVideoVerticalResolution ## SOMETIMES_CONSUMES >>> gEfiMdeModulePkgTokenSpaceGuid.PcdConOutRow ## SOMETIMES_CONSUMES >>> gEfiMdeModulePkgTokenSpaceGuid.PcdConOutColumn ## SOMETIMES_CONSUMES >>> Note: If you have serial active that may mess with the Conspliter and force it to pick a lower resolution since it has to find the best match between the serial and graphics Simple Text In. So try the Graphics without the serial terminal connect to see if it does different stuff. >> >> Regarding the serial terminal aspect, we discussed the following patch (maybe: workaround?) for that, many years ago, off-list: >> > > Laszlo, > > This reminds me I have some hacks in our terminal driver too. > 1) Add a mode that matches the Mode 2 of the GraphicsConsole driver. > a) This kind of assumes BDS connects the graphics 1st. > b) We could generalized this to match the higher modes of the ConSpliter? No capacity to think about this :) > 2) I added a PCD to make the Mode 2 match the current size terminal. > a) The EFI Terminal driver sends { ESC, '[', '1', '8', 't', 0 } to the terminal emulator app and gets the current size as a response. > b) I mostly use this for OVMF with no Graphics console. Nice :) > 3) I think 1) and 2) may require a PCD to the ConSpliter to pick the max mode vs. a known mode. It might be possible to hijack the current PCD values for this. > 4) At one point I added some code with 1) that would auto resize the terminal window to match the graphics screen resolution. I think this was one of the most unpopular things I’ve ever done at work. I guess I’m a just open a bunch of windows and switch between them person, but some people optimize the windows layout and get really angry if you resize windows on them. I even posted a variant of this to the list years ago, and we've been carrying it downstream since. It's based on a dynamic boolean PCD, and the PCD can be controlled on the QEMU command line with the "-fw_cfg" switch (so QEMU need not know any internals). By default, nothing changes, but if the PCD is set to TRUE, then TerminalDxe emits xterm control codes for resizing xterm. In general it's a really annoying feature, but for debugging issues in the UEFI shell (with a graphics console enabled too), it's very useful to have an auto-resized, super-wide terminal window. It's a debugging aid for sure. Thanks Laszlo > > Thanks, > > Andrew Fish > >> diff --git a/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.c b/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.c >> index a98b690c8b95..ded5513c74a7 100644 >> --- a/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.c >> +++ b/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.c >> @@ -115,9 +115,44 @@ TERMINAL_DEV mTerminalDevTemplate = { >> }; >> >> TERMINAL_CONSOLE_MODE_DATA mTerminalConsoleModeData[] = { >> - {80, 25}, >> - {80, 50}, >> - {100, 31}, >> + { 80, 25 }, // from graphics resolution 640 x 480 >> + { 80, 50 }, // from graphics resolution 640 x 960 >> + { 100, 25 }, // from graphics resolution 800 x 480 >> + { 100, 31 }, // from graphics resolution 800 x 600 >> + { 104, 32 }, // from graphics resolution 832 x 624 >> + { 120, 33 }, // from graphics resolution 960 x 640 >> + { 128, 31 }, // from graphics resolution 1024 x 600 >> + { 128, 40 }, // from graphics resolution 1024 x 768 >> + { 144, 45 }, // from graphics resolution 1152 x 864 >> + { 144, 45 }, // from graphics resolution 1152 x 870 >> + { 160, 37 }, // from graphics resolution 1280 x 720 >> + { 160, 40 }, // from graphics resolution 1280 x 760 >> + { 160, 40 }, // from graphics resolution 1280 x 768 >> + { 160, 42 }, // from graphics resolution 1280 x 800 >> + { 160, 50 }, // from graphics resolution 1280 x 960 >> + { 160, 53 }, // from graphics resolution 1280 x 1024 >> + { 170, 40 }, // from graphics resolution 1360 x 768 >> + { 170, 40 }, // from graphics resolution 1366 x 768 >> + { 175, 55 }, // from graphics resolution 1400 x 1050 >> + { 180, 47 }, // from graphics resolution 1440 x 900 >> + { 200, 47 }, // from graphics resolution 1600 x 900 >> + { 200, 63 }, // from graphics resolution 1600 x 1200 >> + { 210, 55 }, // from graphics resolution 1680 x 1050 >> + { 240, 56 }, // from graphics resolution 1920 x 1080 >> + { 240, 63 }, // from graphics resolution 1920 x 1200 >> + { 240, 75 }, // from graphics resolution 1920 x 1440 >> + { 250, 105 }, // from graphics resolution 2000 x 2000 >> + { 256, 80 }, // from graphics resolution 2048 x 1536 >> + { 256, 107 }, // from graphics resolution 2048 x 2048 >> + { 320, 75 }, // from graphics resolution 2560 x 1440 >> + { 320, 84 }, // from graphics resolution 2560 x 1600 >> + { 320, 107 }, // from graphics resolution 2560 x 2048 >> + { 350, 110 }, // from graphics resolution 2800 x 2100 >> + { 400, 126 }, // from graphics resolution 3200 x 2400 >> + { 480, 113 }, // from graphics resolution 3840 x 2160 >> + { 512, 113 }, // from graphics resolution 4096 x 2160 >> + { 960, 227 }, // from graphics resolution 7680 x 4320 >> + { 1024, 227 }, // from graphics resolution 8192 x 4320 >> // >> // New modes can be added here. >> // >> >> but the discussion didn't go anywhere over several months, so we've been carrying this patch downstream-only ever since. >> >> Thanks >> Laszlo >> >>> >>> >>> [1] https://github.com/tianocore/edk2/tree/master/MdeModulePkg/Universal/Console/ConSplitterDxe <https://github.com/tianocore/edk2/tree/master/MdeModulePkg/Universal/Console/ConSplitterDxe> <https://github.com/tianocore/edk2/tree/master/MdeModulePkg/Universal/Console/ConSplitterDxe <https://github.com/tianocore/edk2/tree/master/MdeModulePkg/Universal/Console/ConSplitterDxe>> >>> >>> [2] https://github.com/tianocore/edk2/tree/master/MdeModulePkg/Universal/Console/GraphicsConsoleDxe <https://github.com/tianocore/edk2/tree/master/MdeModulePkg/Universal/Console/GraphicsConsoleDxe> <https://github.com/tianocore/edk2/tree/master/MdeModulePkg/Universal/Console/GraphicsConsoleDxe <https://github.com/tianocore/edk2/tree/master/MdeModulePkg/Universal/Console/GraphicsConsoleDxe>> >>> >>> >>> Thanks, >>> >>> Andrew Fish >>> >>>> On Tue, Jun 15, 2021 at 11:33 PM David F. via groups.io <http://groups.io/> >>>> <df7729=gmail.com@groups.io <mailto:df7729=gmail.com@groups.io>> wrote: >>>>> >>>>> Hello, >>>>> >>>>> I've found that most implementation of UEFI don't automatically change >>>>> the resolution when setting the mode with STOP (Simple Text Output >>>>> Protocol) . You can use GOP to change it after the mode but that >>>>> causes other problems. For example, using surface pro 7 in this case, >>>>> with 4K screen. The default text mode is 342x96 which puts it in >>>>> 2736x1824 mode which you'd expect and the text is tiny. But now you >>>>> set the mode to 0 which is 80x25 and it actually sets the mode to >>>>> 2736x1824 if not already in that resolution and uses a 80x25 area in >>>>> the center of the screen, still tiny text you can hardly read. If you >>>>> then say you want GOP in 640x480 mode (which is available as GOP mode >>>>> 1 on this system, it will make the font larger but you can't see >>>>> anything because it's still offset to the middle of the 2736x1824 area >>>>> and you're only seeing the 640x480 upper left of that area on the >>>>> screen. Likewise if you have it in 342x96 so it's fully in the upper >>>>> left corner of the screen and change the mode to say 800x600 >>>>> (available as GOP mode 2 on this system) it will make the text >>>>> readable but the text can go off the screen in both directions because >>>>> it's still 342x96 when the 100x31 STOP mode would be the correct one >>>>> (which happens to be mode 2 on this system). >>>>> >>>>> Shouldn't setting the STOP mode handle adjusting the resolution since >>>>> that's the main reason you want to change the mode so the size shown >>>>> on the screen changes to something you can read. >>>>> >>>>> Any tricks? I've tried a bunch of things, resetting the controller, >>>>> using the Reset() protocol function, and other things but nothing >>>>> works. As soon as you use STOP to set the mode, it is back to high >>>>> resolution and using an area centered in the screen and changing the >>>>> resolution after that leaves it in the area centered in the high res >>>>> screen and not in the upper left area. >>>>> >>>>> Thanks. >>>>> >>>> >>>> >>>> >>>> >>>> >>> >>> >>> >>> >>> >>> >>> >> >> >> >> > > ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [edk2-devel] SIMPLE_TEXT_OUTPUT_PROTOCOL and Video Resolution 2021-06-23 10:24 ` Laszlo Ersek 2021-06-23 16:57 ` Andrew Fish @ 2021-06-24 0:34 ` David F. 1 sibling, 0 replies; 7+ messages in thread From: David F. @ 2021-06-24 0:34 UTC (permalink / raw) To: Laszlo Ersek; +Cc: devel, Andrew Fish It would be nice to just update the specs to say, when a text mode is chosen the resolution shall be set to the lowest resolution that supports the cols and rows of the given text mode. Then over time all the systems will handle it. On Wed, Jun 23, 2021 at 3:24 AM Laszlo Ersek <lersek@redhat.com> wrote: > > On 06/17/21 01:22, Andrew Fish via groups.io wrote: > > > > > >> On Jun 16, 2021, at 2:45 PM, David F. <df7729@gmail.com> wrote: > >> > >> Also, I found if there are 2 GOP handles and you change the mode of > >> one, the other one doesn't reflect the change (but still doesn't solve > >> anything with the original question), are you supposed to set the mode > >> on every handle to keep that part in sync? > >> > > > > A common implementation is to have the Conspliter [1] driver that produces virtual handles that aggregate how many actual devices you have and manages policy. > > > > You should grab the protocols on the gST->ConsoleOutHandle as these are the Spec defined active console devices. > > > > > > In terms on Simple Text Output Protocol on Graphics this is the default driver in edk2 [2]. These are the config knobs you can set from your DSC file to control defaults. > > > > [Pcd] > > gEfiMdeModulePkgTokenSpaceGuid.PcdVideoHorizontalResolution ## SOMETIMES_CONSUMES > > gEfiMdeModulePkgTokenSpaceGuid.PcdVideoVerticalResolution ## SOMETIMES_CONSUMES > > gEfiMdeModulePkgTokenSpaceGuid.PcdConOutRow ## SOMETIMES_CONSUMES > > gEfiMdeModulePkgTokenSpaceGuid.PcdConOutColumn ## SOMETIMES_CONSUMES > > Note: If you have serial active that may mess with the Conspliter and force it to pick a lower resolution since it has to find the best match between the serial and graphics Simple Text In. So try the Graphics without the serial terminal connect to see if it does different stuff. > > Regarding the serial terminal aspect, we discussed the following patch (maybe: workaround?) for that, many years ago, off-list: > > diff --git a/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.c b/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.c > index a98b690c8b95..ded5513c74a7 100644 > --- a/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.c > +++ b/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.c > @@ -115,9 +115,44 @@ TERMINAL_DEV mTerminalDevTemplate = { > }; > > TERMINAL_CONSOLE_MODE_DATA mTerminalConsoleModeData[] = { > - {80, 25}, > - {80, 50}, > - {100, 31}, > + { 80, 25 }, // from graphics resolution 640 x 480 > + { 80, 50 }, // from graphics resolution 640 x 960 > + { 100, 25 }, // from graphics resolution 800 x 480 > + { 100, 31 }, // from graphics resolution 800 x 600 > + { 104, 32 }, // from graphics resolution 832 x 624 > + { 120, 33 }, // from graphics resolution 960 x 640 > + { 128, 31 }, // from graphics resolution 1024 x 600 > + { 128, 40 }, // from graphics resolution 1024 x 768 > + { 144, 45 }, // from graphics resolution 1152 x 864 > + { 144, 45 }, // from graphics resolution 1152 x 870 > + { 160, 37 }, // from graphics resolution 1280 x 720 > + { 160, 40 }, // from graphics resolution 1280 x 760 > + { 160, 40 }, // from graphics resolution 1280 x 768 > + { 160, 42 }, // from graphics resolution 1280 x 800 > + { 160, 50 }, // from graphics resolution 1280 x 960 > + { 160, 53 }, // from graphics resolution 1280 x 1024 > + { 170, 40 }, // from graphics resolution 1360 x 768 > + { 170, 40 }, // from graphics resolution 1366 x 768 > + { 175, 55 }, // from graphics resolution 1400 x 1050 > + { 180, 47 }, // from graphics resolution 1440 x 900 > + { 200, 47 }, // from graphics resolution 1600 x 900 > + { 200, 63 }, // from graphics resolution 1600 x 1200 > + { 210, 55 }, // from graphics resolution 1680 x 1050 > + { 240, 56 }, // from graphics resolution 1920 x 1080 > + { 240, 63 }, // from graphics resolution 1920 x 1200 > + { 240, 75 }, // from graphics resolution 1920 x 1440 > + { 250, 105 }, // from graphics resolution 2000 x 2000 > + { 256, 80 }, // from graphics resolution 2048 x 1536 > + { 256, 107 }, // from graphics resolution 2048 x 2048 > + { 320, 75 }, // from graphics resolution 2560 x 1440 > + { 320, 84 }, // from graphics resolution 2560 x 1600 > + { 320, 107 }, // from graphics resolution 2560 x 2048 > + { 350, 110 }, // from graphics resolution 2800 x 2100 > + { 400, 126 }, // from graphics resolution 3200 x 2400 > + { 480, 113 }, // from graphics resolution 3840 x 2160 > + { 512, 113 }, // from graphics resolution 4096 x 2160 > + { 960, 227 }, // from graphics resolution 7680 x 4320 > + { 1024, 227 }, // from graphics resolution 8192 x 4320 > // > // New modes can be added here. > // > > but the discussion didn't go anywhere over several months, so we've been carrying this patch downstream-only ever since. > > Thanks > Laszlo > > > > > > > [1] https://github.com/tianocore/edk2/tree/master/MdeModulePkg/Universal/Console/ConSplitterDxe <https://github.com/tianocore/edk2/tree/master/MdeModulePkg/Universal/Console/ConSplitterDxe> > > > > [2] https://github.com/tianocore/edk2/tree/master/MdeModulePkg/Universal/Console/GraphicsConsoleDxe <https://github.com/tianocore/edk2/tree/master/MdeModulePkg/Universal/Console/GraphicsConsoleDxe> > > > > > > Thanks, > > > > Andrew Fish > > > >> On Tue, Jun 15, 2021 at 11:33 PM David F. via groups.io > >> <df7729=gmail.com@groups.io> wrote: > >>> > >>> Hello, > >>> > >>> I've found that most implementation of UEFI don't automatically change > >>> the resolution when setting the mode with STOP (Simple Text Output > >>> Protocol) . You can use GOP to change it after the mode but that > >>> causes other problems. For example, using surface pro 7 in this case, > >>> with 4K screen. The default text mode is 342x96 which puts it in > >>> 2736x1824 mode which you'd expect and the text is tiny. But now you > >>> set the mode to 0 which is 80x25 and it actually sets the mode to > >>> 2736x1824 if not already in that resolution and uses a 80x25 area in > >>> the center of the screen, still tiny text you can hardly read. If you > >>> then say you want GOP in 640x480 mode (which is available as GOP mode > >>> 1 on this system, it will make the font larger but you can't see > >>> anything because it's still offset to the middle of the 2736x1824 area > >>> and you're only seeing the 640x480 upper left of that area on the > >>> screen. Likewise if you have it in 342x96 so it's fully in the upper > >>> left corner of the screen and change the mode to say 800x600 > >>> (available as GOP mode 2 on this system) it will make the text > >>> readable but the text can go off the screen in both directions because > >>> it's still 342x96 when the 100x31 STOP mode would be the correct one > >>> (which happens to be mode 2 on this system). > >>> > >>> Shouldn't setting the STOP mode handle adjusting the resolution since > >>> that's the main reason you want to change the mode so the size shown > >>> on the screen changes to something you can read. > >>> > >>> Any tricks? I've tried a bunch of things, resetting the controller, > >>> using the Reset() protocol function, and other things but nothing > >>> works. As soon as you use STOP to set the mode, it is back to high > >>> resolution and using an area centered in the screen and changing the > >>> resolution after that leaves it in the area centered in the high res > >>> screen and not in the upper left area. > >>> > >>> Thanks. > >>> > >> > >> > >> > >> > >> > > > > > > > > > > > > > > > ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2021-06-24 0:34 UTC | newest] Thread overview: 7+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- [not found] <CAGRSmLuizR=TQgKQOALmhyZxqTgUxQxP2W7BM5ruG7QjARQPXw@mail.gmail.com> 2021-06-16 6:32 ` SIMPLE_TEXT_OUTPUT_PROTOCOL and Video Resolution David F. [not found] ` <1688FC67A39CB5DB.19105@groups.io> 2021-06-16 21:45 ` [edk2-devel] " David F. 2021-06-16 23:22 ` Andrew Fish 2021-06-23 10:24 ` Laszlo Ersek 2021-06-23 16:57 ` Andrew Fish 2021-06-23 19:23 ` Laszlo Ersek 2021-06-24 0:34 ` David F.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox