From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Jani Nikula <jani.nikula@linux.intel.com>
Cc: Vamsi Krishna Brahmajosyula
<vamsikrishna.brahmajosyula@gmail.com>,
maarten.lankhorst@linux.intel.com, mripard@kernel.org,
tzimmermann@suse.de, airlied@gmail.com, simona@ffwll.ch,
"Syrjala, Ville" <ville.syrjala@intel.com>,
skhan@linuxfoundation.org, dri-devel@lists.freedesktop.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/5] drm/edid: convert drm_parse_hdmi_vsdb_video to use struct cea_db *
Date: Mon, 28 Oct 2024 16:38:50 +0200 [thread overview]
Message-ID: <Zx-h-qCeU0e9B-eK@intel.com> (raw)
In-Reply-To: <87cyjkpcik.fsf@intel.com>
On Mon, Oct 28, 2024 at 03:45:07PM +0200, Jani Nikula wrote:
> On Sun, 27 Oct 2024, Vamsi Krishna Brahmajosyula <vamsikrishna.brahmajosyula@gmail.com> wrote:
> > @@ -6320,19 +6321,20 @@ static void drm_parse_hdmi_deep_color_info(struct drm_connector *connector,
> >
> > /* HDMI Vendor-Specific Data Block (HDMI VSDB, H14b-VSDB) */
> > static void
> > -drm_parse_hdmi_vsdb_video(struct drm_connector *connector, const u8 *db)
> > +drm_parse_hdmi_vsdb_video(struct drm_connector *connector, const struct cea_db *db)
> > {
> > struct drm_display_info *info = &connector->display_info;
> > u8 len = cea_db_payload_len(db);
> > + const u8 *data = cea_db_data(db);
> >
> > info->is_hdmi = true;
> >
> > - info->source_physical_address = (db[4] << 8) | db[5];
> > + info->source_physical_address = (data[3] << 8) | data[4];
> >
> > if (len >= 6)
> > - info->dvi_dual = db[6] & 1;
> > + info->dvi_dual = data[5] & 1;
>
> Just commenting on one hunk, because it's a good example of the whole
> series I think.
>
> The above is nice, because it improves the offset vs. length
> comparisons. Many of the old checks like above look like off-by-ones,
> when indexing from the beginning of the data block, not from the
> beginning of payload, and cea_db_payload_len() excludes the first byte.
>
> The main problem is that the specs are written with indexing from the
> beginning of the data block. For example, HDMI 1.4 table 8-16 defining
> the HDMI VSDB says source physical address is at byte offsets 4 and 5,
> and dvi dual flag at byte offset 6. That will no longer be the case in
> code. It gets tricky to review when you have to keep adjusting the
> offsets in your head. (I don't remember if there are specs that specify
> the offsets starting from the "actual" payload after all the meta stuff
> has been removed.)
IIRC there was some off-by-one indexing difference between
some of the specs. But I don't remember which ones use what.
>
> Now, if we accept having to do that mental acrobatics, why stop there?
> You also have extended tags (first payload byte is the tag), as well as
> vendor tags (first three payload bytes are the OUI). It begs the
> question whether there should be higher level data and length helpers
> that identify and remove the tags (including extended tags and OUI
> stuff). For example, the actual data for HDMI VSDB starts at payload
> offset 3, as the first three bytes are the HDMI OUI.
>
> What to do? Ville, thoughts?
So just different *_{data,len}() for the different indexing variants
(as defined by the relevant spec)? That seems like a reasonable
apporach as then the len vs. index checks might actually make sense.
--
Ville Syrjälä
Intel
next prev parent reply other threads:[~2024-10-28 14:39 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-27 7:51 [PATCH 0/5] drm/edid: Convert cea_ext parsers to use struct cea_db * Vamsi Krishna Brahmajosyula
2024-10-27 7:51 ` [PATCH 1/5] drm/edid: convert drm_parse_hdmi_vsdb_video " Vamsi Krishna Brahmajosyula
2024-10-28 13:45 ` Jani Nikula
2024-10-28 14:38 ` Ville Syrjälä [this message]
2024-11-13 16:29 ` Vamsi Krishna Brahmajosyula
2024-10-27 7:51 ` [PATCH 2/5] drm/edid: convert drm_parse_hdmi_forum_scds " Vamsi Krishna Brahmajosyula
2024-10-27 7:51 ` [PATCH 3/5] drm/edid: convert drm_parse_microsoft_vsdb " Vamsi Krishna Brahmajosyula
2024-10-27 7:51 ` [PATCH 4/5] drm/edid: convert drm_parse_vcdb " Vamsi Krishna Brahmajosyula
2024-10-27 7:51 ` [PATCH 5/5] drm/edid: convert drm_parse_hdr_metadata_block " Vamsi Krishna Brahmajosyula
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=Zx-h-qCeU0e9B-eK@intel.com \
--to=ville.syrjala@linux.intel.com \
--cc=airlied@gmail.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=jani.nikula@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mripard@kernel.org \
--cc=simona@ffwll.ch \
--cc=skhan@linuxfoundation.org \
--cc=tzimmermann@suse.de \
--cc=vamsikrishna.brahmajosyula@gmail.com \
--cc=ville.syrjala@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