Message ID | 2f43032d5f001510c7eed059321ceeb76d07a606.1630419362.git.jani.nikula@intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | drm/displayid: VESA vendor block and drm/i915 MSO use of it | expand |
> -----Original Message----- > From: dri-devel <dri-devel-bounces@lists.freedesktop.org> On Behalf Of Jani Nikula > Sent: Tuesday, August 31, 2021 7:48 PM > To: intel-gfx@lists.freedesktop.org > Cc: dri-devel@lists.freedesktop.org; ville.syrjala@linux.intel.com; Nikula, Jani > <jani.nikula@intel.com> > Subject: [PATCH v2 3/6] drm/edid: abstract OUI conversion to 24-bit int > > Replace the open coded OUI conversion from three bytes to a 24-bit int, as we'll be > adding one more user shortly. No functional changes. > > Side note: CTA-861 format has the OUI bytes in reverse order. Looks ok to me. Reviewed-by: Uma Shankar <uma.shankar@intel.com> > Signed-off-by: Jani Nikula <jani.nikula@intel.com> > --- > drivers/gpu/drm/drm_edid.c | 17 +++++++---------- > 1 file changed, 7 insertions(+), 10 deletions(-) > > diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c index > 6325877c5fd6..92974b1478bc 100644 > --- a/drivers/gpu/drm/drm_edid.c > +++ b/drivers/gpu/drm/drm_edid.c > @@ -49,6 +49,11 @@ > (((edid)->version > (maj)) || \ > ((edid)->version == (maj) && (edid)->revision > (min))) > > +static int oui(u8 first, u8 second, u8 third) { > + return (first << 16) | (second << 8) | third; } > + > #define EDID_EST_TIMINGS 16 > #define EDID_STD_TIMINGS 8 > #define EDID_DETAILED_TIMINGS 4 > @@ -4113,32 +4118,24 @@ cea_db_offsets(const u8 *cea, int *start, int *end) > > static bool cea_db_is_hdmi_vsdb(const u8 *db) { > - int hdmi_id; > - > if (cea_db_tag(db) != VENDOR_BLOCK) > return false; > > if (cea_db_payload_len(db) < 5) > return false; > > - hdmi_id = db[1] | (db[2] << 8) | (db[3] << 16); > - > - return hdmi_id == HDMI_IEEE_OUI; > + return oui(db[3], db[2], db[1]) == HDMI_IEEE_OUI; > } > > static bool cea_db_is_hdmi_forum_vsdb(const u8 *db) { > - unsigned int oui; > - > if (cea_db_tag(db) != VENDOR_BLOCK) > return false; > > if (cea_db_payload_len(db) < 7) > return false; > > - oui = db[3] << 16 | db[2] << 8 | db[1]; > - > - return oui == HDMI_FORUM_IEEE_OUI; > + return oui(db[3], db[2], db[1]) == HDMI_FORUM_IEEE_OUI; > } > > static bool cea_db_is_vcdb(const u8 *db) > -- > 2.30.2
diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c index 6325877c5fd6..92974b1478bc 100644 --- a/drivers/gpu/drm/drm_edid.c +++ b/drivers/gpu/drm/drm_edid.c @@ -49,6 +49,11 @@ (((edid)->version > (maj)) || \ ((edid)->version == (maj) && (edid)->revision > (min))) +static int oui(u8 first, u8 second, u8 third) +{ + return (first << 16) | (second << 8) | third; +} + #define EDID_EST_TIMINGS 16 #define EDID_STD_TIMINGS 8 #define EDID_DETAILED_TIMINGS 4 @@ -4113,32 +4118,24 @@ cea_db_offsets(const u8 *cea, int *start, int *end) static bool cea_db_is_hdmi_vsdb(const u8 *db) { - int hdmi_id; - if (cea_db_tag(db) != VENDOR_BLOCK) return false; if (cea_db_payload_len(db) < 5) return false; - hdmi_id = db[1] | (db[2] << 8) | (db[3] << 16); - - return hdmi_id == HDMI_IEEE_OUI; + return oui(db[3], db[2], db[1]) == HDMI_IEEE_OUI; } static bool cea_db_is_hdmi_forum_vsdb(const u8 *db) { - unsigned int oui; - if (cea_db_tag(db) != VENDOR_BLOCK) return false; if (cea_db_payload_len(db) < 7) return false; - oui = db[3] << 16 | db[2] << 8 | db[1]; - - return oui == HDMI_FORUM_IEEE_OUI; + return oui(db[3], db[2], db[1]) == HDMI_FORUM_IEEE_OUI; } static bool cea_db_is_vcdb(const u8 *db)
Replace the open coded OUI conversion from three bytes to a 24-bit int, as we'll be adding one more user shortly. No functional changes. Side note: CTA-861 format has the OUI bytes in reverse order. Signed-off-by: Jani Nikula <jani.nikula@intel.com> --- drivers/gpu/drm/drm_edid.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-)