[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 3/5] efi: try to use the currently set GOP mode


  • To: Roger Pau Monne <roger.pau@xxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Mon, 5 Dec 2022 15:32:04 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=HcEqBOiY2VQUZ4juWC98x6PwggUQ0hDrYf1g+S46Q7M=; b=jrLMdRIRL5cc1hC+6wsNs3y+9O447XKSiVXOAXtRsUa5Acj8BMgg/iSXTeMBCYBWcd8pCKrWX92fouz/YE5bxOx9Jo+8vB+KYqG3ApkSJQ+CKIvRskNtz75K6+HtCdCibK7VvKihYFtLRqvw1Kp6kwTkmmWiJGC6jHSL8GbOQq2XJ6L27lprG9Pz6tg71ueYYnbQQRETNVgvMErJVZkiKvax+5/Mhg8YJ5wFpwQBI/l+VizfiA8ogPqY1WPG47dX00tdY/5ZRDOtL6Jq4MCNdMonDOs13O+vxHv38rwu+3HREIE5tiIEqmei+N+4S4qX+wwLNPt8QTDq6zR98SYyjQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=j2YFS9Swmm0rfGOQ0DaSyiy5dbgVW0p2XlnnolVpN7VCqz0DDP0LRu6MiQoZiKcrmjLgxLq2KRG5Y6fpXPgEmJ8zAGzdxP0LnL4RulveNrilttxWCN2INioCRNbVh4QcZaA7HgBELHse/taAZpRCvf4PJZoOofXcXmH46M/iJsJy4lDRWZmhpJLnIFzbnCeaZVURxStXvCnK/tYgsxrevVr/5avd/xCbxNuVmLZmA/XIoA36sPryDyLElLiJYnqm2lzQVFHVxXzSAe2zbSx12tRUXZlphgMQy1xhd9mmwR/ydWUpF22R2NXcnOTtV1S6Zr6RtSJpFuxguj+Ujdfz8A==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: marmarek@xxxxxxxxxxxxxxxxxxxxxx, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Mon, 05 Dec 2022 14:32:24 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 23.11.2022 16:45, Roger Pau Monne wrote:
> --- a/xen/common/efi/boot.c
> +++ b/xen/common/efi/boot.c
> @@ -864,6 +864,26 @@ static UINTN __init 
> efi_find_gop_mode(EFI_GRAPHICS_OUTPUT_PROTOCOL *gop,
>      UINTN gop_mode = ~0, info_size, size;
>      unsigned int i;
>  
> +    if ( (!cols || !rows) && gop->Mode->Mode < gop->Mode->MaxMode )
> +    {
> +        /* If no (valid) resolution suggested, try to use the current mode. 
> */
> +        status = gop->QueryMode(gop, gop->Mode->Mode, &info_size, 
> &mode_info);
> +        if ( EFI_ERROR(status) )
> +            PrintErr(L"Invalid current graphics mode\r\n");
> +        else if ( mode_info->PixelFormat < PixelBltOnly )
> +            return gop->Mode->Mode;
> +        else
> +        {
> +            /*
> +             * Try to find a mode with the same resolution and a valid pixel
> +             * format.
> +             */
> +            cols = mode_info->HorizontalResolution;
> +            rows = mode_info->VerticalResolution;

For these I think you want to replace cols and rows individually, i.e.

            if ( !cols )
                cols = mode_info->HorizontalResolution;
            if ( !rows )
                rows = mode_info->VerticalResolution;

whereas ...

> +            depth = 0;

... this case looks more complicated, as 0 is also already legitimate
as a value to come in. By zapping a non-zero incoming value you may end
up switching modes _just_ to alter depth, and then you may not fulfill
what was requested. For now I think depth simply wants leaving alone
here (and perhaps using the current mode's value if the incoming value
was zero, thus eliminating the need for a mode change in certain cases).

In a separate change we might then enhance this, e.g. by finding a
supported mode matching geometry but only coming close for "depth".

Jan



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.