From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Jani Nikula <jani.nikula@intel.com>
Cc: intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org
Subject: Re: [Intel-gfx] [PATCH 3/9] drm/edid: use struct detailed_timing member access in is_rb()
Date: Fri, 25 Mar 2022 15:06:35 +0200 [thread overview]
Message-ID: <Yj2+W4LXRBd3a+5j@intel.com> (raw)
In-Reply-To: <7fd382f989d169f6a03c473699e1385dd145069e.1648210803.git.jani.nikula@intel.com>
On Fri, Mar 25, 2022 at 02:25:25PM +0200, Jani Nikula wrote:
> Use struct detailed_timing member access instead of direct offsets to
> avoid casting.
>
> Use BUILD_BUG_ON() for sanity check.
>
> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
>
> ---
>
> Note: Why can we use range.formula.cvt.flags directly in is_rb() while
> gtf2 functions check for range.flags == 0x02 first to ensure it's gtf2?
Looks to me like is_rb() is just borked.
Other weird stuff I just noticed is get_monitor_range() not doing
anything for flags!=0x1 cases. It also fails to handle the other
flags that were added to byte 4 in EDID 1.4.
> ---
> drivers/gpu/drm/drm_edid.c | 12 +++++++-----
> 1 file changed, 7 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
> index 48707eef1dc2..5396fa78e864 100644
> --- a/drivers/gpu/drm/drm_edid.c
> +++ b/drivers/gpu/drm/drm_edid.c
> @@ -2405,15 +2405,17 @@ drm_for_each_detailed_block(u8 *raw_edid, detailed_cb *cb, void *closure)
> }
>
> static void
> -is_rb(struct detailed_timing *t, void *data)
> +is_rb(struct detailed_timing *timing, void *data)
> {
> - u8 *r = (u8 *)t;
> + bool *res = data;
>
> - if (!is_display_descriptor(t, EDID_DETAIL_MONITOR_RANGE))
> + if (!is_display_descriptor(timing, EDID_DETAIL_MONITOR_RANGE))
Calling this 'timing' when it's not is a bit confusing. I'd probably
rename it to something else for all the display descriptor cases.
> return;
>
> - if (r[15] & 0x10)
> - *(bool *)data = true;
> + BUILD_BUG_ON(offsetof(typeof(*timing), data.other_data.data.range.formula.cvt.flags) != 15);
> +
> + if (timing->data.other_data.data.range.formula.cvt.flags & 0x10)
> + *res = true;
> }
>
> /* EDID 1.4 defines this explicitly. For EDID 1.3, we guess, badly. */
> --
> 2.30.2
--
Ville Syrjälä
Intel
next prev parent reply other threads:[~2022-03-25 13:06 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-25 12:25 [Intel-gfx] [PATCH 0/9] drm/edid: constify EDID parsing Jani Nikula
2022-03-25 12:25 ` [Intel-gfx] [PATCH 1/9] drm/edid: don't modify EDID while parsing Jani Nikula
2022-03-25 12:40 ` Ville Syrjälä
2022-03-25 12:25 ` [Intel-gfx] [PATCH 2/9] drm/edid: pass a timing pointer to is_display_descriptor() Jani Nikula
2022-03-25 12:49 ` Ville Syrjälä
2022-03-25 12:25 ` [Intel-gfx] [PATCH 3/9] drm/edid: use struct detailed_timing member access in is_rb() Jani Nikula
2022-03-25 13:06 ` Ville Syrjälä [this message]
2022-03-25 12:25 ` [Intel-gfx] [PATCH 4/9] drm/edid: use struct detailed_timing member access in gtf2 functions Jani Nikula
2022-03-25 12:25 ` [Intel-gfx] [PATCH 5/9] drm/edid: constify struct detailed_timing in lower level parsing Jani Nikula
2022-03-25 12:25 ` [Intel-gfx] [PATCH 6/9] drm/edid: constify struct detailed_timing in parsing callbacks Jani Nikula
2022-03-25 12:25 ` [Intel-gfx] [PATCH 7/9] drm/edid: constify struct edid passed to detailed blocks Jani Nikula
2022-03-25 12:25 ` [Intel-gfx] [PATCH 8/9] drm/edid: constify struct edid passed around in callbacks and closure Jani Nikula
2022-03-25 12:25 ` [Intel-gfx] [PATCH 9/9] drm/edid: add more general struct edid constness in the interfaces Jani Nikula
2022-03-25 13:19 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for drm/edid: constify EDID parsing Patchwork
2022-03-25 13:26 ` [Intel-gfx] ✗ Fi.CI.DOCS: " Patchwork
2022-03-25 13:46 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2022-03-25 15:54 ` [Intel-gfx] ✓ Fi.CI.IGT: " Patchwork
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=Yj2+W4LXRBd3a+5j@intel.com \
--to=ville.syrjala@linux.intel.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-gfx@lists.freedesktop.org \
--cc=jani.nikula@intel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox