All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Vladimir 'φ-coder/phcoder' Serbinenko" <phcoder@gmail.com>
To: The development of GNU GRUB <grub-devel@gnu.org>
Cc: Matthew Garrett <mjg@redhat.com>
Subject: Re: [PATCH 4/4] Add support for getting EDID via EFI
Date: Wed, 08 Feb 2012 21:07:28 +0100	[thread overview]
Message-ID: <4F32D600.2060104@gmail.com> (raw)
In-Reply-To: <1328719918-4789-5-git-send-email-mjg@redhat.com>

On 08.02.2012 17:51, Matthew Garrett wrote:
> EFI gives a couple of defined methods for retrieving the EDID, so make use
> of them. Some Apple devices don't provide these but do stash the EDID in an
> nvram variable - grab it from there if it exists.
> ---
>   ChangeLog                 |    8 +++++
>   grub-core/video/efi_gop.c |   69 +++++++++++++++++++++++++++++++++++++++++++++
>   2 files changed, 77 insertions(+), 0 deletions(-)
>
> diff --git a/ChangeLog b/ChangeLog
> index 26d779b..d46b3d1 100644
> --- a/ChangeLog
> +++ b/ChangeLog
> @@ -1,5 +1,13 @@
>   2012-02-08  Matthew Garrett<mjg@redhat.com>
>
> +  }
> +
> +  grub_memcpy (&edid_info, edid->edid, sizeof(edid_info));
> +
This code may copy more than actually present. You need to take minimum 
of both length and fill the rest with zeros
> +  return GRUB_ERR_NONE;
> +}
> +
> +static grub_err_t
> +grub_gop_get_preferred_mode (unsigned int *width, unsigned int *height)
> +{
> +  struct grub_video_edid_info edid_info;
> +
> +  if (grub_video_gop_get_edid(&edid_info) == GRUB_ERR_NONE)
> +    {
> +      if (grub_video_edid_checksum (&edid_info) == GRUB_ERR_NONE
> +	&&  grub_video_edid_preferred_mode (&edid_info, width, height)
> +	  == GRUB_ERR_NONE)
> +	return GRUB_ERR_NONE;
> +      else
> +	grub_dprintf("video", "invalid edid");
> +    }
> +  return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "cannot get preferred mode");
Please reuse the error which actually happened. E.g:
err = grub_video_gop_get_edid(&edid_info);
if (err)
    return err;
err =  grub_video_edid_checksum (&edid_info);
if (err)
   return err;
...
> +}
> +
> +static grub_err_t
>   grub_video_gop_setup (unsigned int width, unsigned int height,
>   		      unsigned int mode_type,
>   		      unsigned int mode_mask __attribute__ ((unused)))
> @@ -268,10 +319,18 @@ grub_video_gop_setup (unsigned int width, unsigned int height,
>     unsigned bpp;
>     int found = 0;
>     unsigned long long best_volume = 0;
> +  int preferred_mode = 0;
>
>     depth = (mode_type&  GRUB_VIDEO_MODE_TYPE_DEPTH_MASK)
>       >>  GRUB_VIDEO_MODE_TYPE_DEPTH_POS;
>
> +  if (width == 0&&  height == 0)
> +    {
> +      grub_gop_get_preferred_mode (&width,&height);
> +      if (grub_errno == GRUB_ERR_NONE)
> +	  preferred_mode = 1;
> +    }
> +
You need to discard error if you continue
>     /* Keep current mode if possible.  */
>     if (gop->mode->info)
>       {
> @@ -306,6 +365,15 @@ grub_video_gop_setup (


-- 
Regards
Vladimir 'φ-coder/phcoder' Serbinenko



  reply	other threads:[~2012-02-08 20:07 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-08 16:51 Some improvements to EFI GOP support Matthew Garrett
2012-02-08 16:51 ` [PATCH 1/4] Add PCI protocols Matthew Garrett
2012-02-08 19:51   ` Vladimir 'φ-coder/phcoder' Serbinenko
2012-02-08 16:51 ` [PATCH 2/4] Add grub_efi_get_variable Matthew Garrett
2012-02-08 19:55   ` Vladimir 'φ-coder/phcoder' Serbinenko
2012-02-08 20:04     ` Matthew Garrett
2012-02-08 20:09       ` Vladimir 'φ-coder/phcoder' Serbinenko
2012-02-08 20:19         ` Matthew Garrett
2012-02-08 20:29           ` Vladimir 'φ-coder/phcoder' Serbinenko
2012-02-08 16:51 ` [PATCH 3/4] Prefer GOP devices which implement the pci_io protocol Matthew Garrett
2012-02-08 19:59   ` Vladimir 'φ-coder/phcoder' Serbinenko
2012-02-08 16:51 ` [PATCH 4/4] Add support for getting EDID via EFI Matthew Garrett
2012-02-08 20:07   ` Vladimir 'φ-coder/phcoder' Serbinenko [this message]
2012-02-08 17:02 ` Some improvements to EFI GOP support Keshav P R

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4F32D600.2060104@gmail.com \
    --to=phcoder@gmail.com \
    --cc=grub-devel@gnu.org \
    --cc=mjg@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.