diff mbox series

[01/60] drm/edid: Add flag to drm_display_info to identify HDMI sinks

Message ID 20190707180852.5512-2-laurent.pinchart@ideasonboard.com (mailing list archive)
State New, archived
Headers show
Series drm/omap: Replace custom display drivers with drm_bridge and drm_panel | expand

Commit Message

Laurent Pinchart July 7, 2019, 6:07 p.m. UTC
The drm_display_info structure contains many fields related to HDMI
sinks, but none that identifies if a sink compliant with CEA-861 (EDID)
shall be treated as an HDMI sink or a DVI sink. Add such a flag, and
populate it according to section 8.3.3 ("DVI/HDMI Device
Discrimination") of the HDMI v1.3 specification.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 drivers/gpu/drm/drm_edid.c  | 3 +++
 include/drm/drm_connector.h | 5 +++++
 2 files changed, 8 insertions(+)

Comments

Andrzej Hajda July 9, 2019, 1:20 p.m. UTC | #1
On 07.07.2019 20:07, Laurent Pinchart wrote:
> The drm_display_info structure contains many fields related to HDMI
> sinks, but none that identifies if a sink compliant with CEA-861 (EDID)
> shall be treated as an HDMI sink or a DVI sink. Add such a flag, and
> populate it according to section 8.3.3 ("DVI/HDMI Device
> Discrimination") of the HDMI v1.3 specification.
>
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>


It looks like it can replace drm_detect_hdmi_monitor usage in most cases.

Reviewed-by: Andrzej Hajda <a.hajda@samsung.com>

 --
Regards
Andrzej



> ---
>  drivers/gpu/drm/drm_edid.c  | 3 +++
>  include/drm/drm_connector.h | 5 +++++
>  2 files changed, 8 insertions(+)
>
> diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
> index 82a4ceed3fcf..d2e7a5334c3f 100644
> --- a/drivers/gpu/drm/drm_edid.c
> +++ b/drivers/gpu/drm/drm_edid.c
> @@ -4559,6 +4559,8 @@ drm_parse_hdmi_vsdb_video(struct drm_connector *connector, const u8 *db)
>  	struct drm_display_info *info = &connector->display_info;
>  	u8 len = cea_db_payload_len(db);
>  
> +	info->is_hdmi = true;
> +
>  	if (len >= 6)
>  		info->dvi_dual = db[6] & 1;
>  	if (len >= 7)
> @@ -4627,6 +4629,7 @@ drm_reset_display_info(struct drm_connector *connector)
>  	info->cea_rev = 0;
>  	info->max_tmds_clock = 0;
>  	info->dvi_dual = false;
> +	info->is_hdmi = false;
>  	info->has_hdmi_infoframe = false;
>  	info->rgb_quant_range_selectable = false;
>  	memset(&info->hdmi, 0, sizeof(info->hdmi));
> diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h
> index ca745d9feaf5..e80ca0d149e5 100644
> --- a/include/drm/drm_connector.h
> +++ b/include/drm/drm_connector.h
> @@ -426,6 +426,11 @@ struct drm_display_info {
>  	 */
>  	bool dvi_dual;
>  
> +	/**
> +	 * @is_hdmi: True if the sink is an HDMI device.
> +	 */
> +	bool is_hdmi;
> +
>  	/**
>  	 * @has_hdmi_infoframe: Does the sink support the HDMI infoframe?
>  	 */
Daniel Vetter July 10, 2019, 3:41 p.m. UTC | #2
On Tue, Jul 09, 2019 at 03:20:58PM +0200, Andrzej Hajda wrote:
> On 07.07.2019 20:07, Laurent Pinchart wrote:
> > The drm_display_info structure contains many fields related to HDMI
> > sinks, but none that identifies if a sink compliant with CEA-861 (EDID)
> > shall be treated as an HDMI sink or a DVI sink. Add such a flag, and
> > populate it according to section 8.3.3 ("DVI/HDMI Device
> > Discrimination") of the HDMI v1.3 specification.
> >
> > Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> 
> 
> It looks like it can replace drm_detect_hdmi_monitor usage in most cases.

Yeah I think kerneldoc should at least between these too, i.e. from
info.is_hdmi to drm_detect_hdmi_monitor() and back.

Plus ideally a refactor task in todo.rst, this is ideal getting started
fodder I think. And I like if we standardize as much as possible on
drm_display_info.

With that: Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> 
> Reviewed-by: Andrzej Hajda <a.hajda@samsung.com>
> 
>  --
> Regards
> Andrzej
> 
> 
> 
> > ---
> >  drivers/gpu/drm/drm_edid.c  | 3 +++
> >  include/drm/drm_connector.h | 5 +++++
> >  2 files changed, 8 insertions(+)
> >
> > diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
> > index 82a4ceed3fcf..d2e7a5334c3f 100644
> > --- a/drivers/gpu/drm/drm_edid.c
> > +++ b/drivers/gpu/drm/drm_edid.c
> > @@ -4559,6 +4559,8 @@ drm_parse_hdmi_vsdb_video(struct drm_connector *connector, const u8 *db)
> >  	struct drm_display_info *info = &connector->display_info;
> >  	u8 len = cea_db_payload_len(db);
> >  
> > +	info->is_hdmi = true;
> > +
> >  	if (len >= 6)
> >  		info->dvi_dual = db[6] & 1;
> >  	if (len >= 7)
> > @@ -4627,6 +4629,7 @@ drm_reset_display_info(struct drm_connector *connector)
> >  	info->cea_rev = 0;
> >  	info->max_tmds_clock = 0;
> >  	info->dvi_dual = false;
> > +	info->is_hdmi = false;
> >  	info->has_hdmi_infoframe = false;
> >  	info->rgb_quant_range_selectable = false;
> >  	memset(&info->hdmi, 0, sizeof(info->hdmi));
> > diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h
> > index ca745d9feaf5..e80ca0d149e5 100644
> > --- a/include/drm/drm_connector.h
> > +++ b/include/drm/drm_connector.h
> > @@ -426,6 +426,11 @@ struct drm_display_info {
> >  	 */
> >  	bool dvi_dual;
> >  
> > +	/**
> > +	 * @is_hdmi: True if the sink is an HDMI device.
> > +	 */
> > +	bool is_hdmi;
> > +
> >  	/**
> >  	 * @has_hdmi_infoframe: Does the sink support the HDMI infoframe?
> >  	 */
> 
>
Ville Syrjälä July 10, 2019, 3:59 p.m. UTC | #3
On Sun, Jul 07, 2019 at 09:07:53PM +0300, Laurent Pinchart wrote:
> The drm_display_info structure contains many fields related to HDMI
> sinks, but none that identifies if a sink compliant with CEA-861 (EDID)
> shall be treated as an HDMI sink or a DVI sink. Add such a flag, and
> populate it according to section 8.3.3 ("DVI/HDMI Device
> Discrimination") of the HDMI v1.3 specification.
> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> ---
>  drivers/gpu/drm/drm_edid.c  | 3 +++
>  include/drm/drm_connector.h | 5 +++++
>  2 files changed, 8 insertions(+)
> 
> diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
> index 82a4ceed3fcf..d2e7a5334c3f 100644
> --- a/drivers/gpu/drm/drm_edid.c
> +++ b/drivers/gpu/drm/drm_edid.c
> @@ -4559,6 +4559,8 @@ drm_parse_hdmi_vsdb_video(struct drm_connector *connector, const u8 *db)
>  	struct drm_display_info *info = &connector->display_info;
>  	u8 len = cea_db_payload_len(db);
>  
> +	info->is_hdmi = true;
> +

Almost missed this one since it was hidden inside a rather big series.

I was pondering if we should set this in drm_parse_hdmi_forum_vsdb()
too, but looks like the spec says we don't have to:
"An H14b VSDB shall always be included, regardless of the inclusion of
 an HF-VSDB, to ensure correct functioning of DVI/HDMI discrimination..."

Also we don't check for the HF-VSDB in drm_detect_hdmi_monitor() either.
Unfortunately we can't simply replace drm_detect_hdmi_monitor() in
i915 with a check for this flag because we populate display_info way
too late.

Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

>  	if (len >= 6)
>  		info->dvi_dual = db[6] & 1;
>  	if (len >= 7)
> @@ -4627,6 +4629,7 @@ drm_reset_display_info(struct drm_connector *connector)
>  	info->cea_rev = 0;
>  	info->max_tmds_clock = 0;
>  	info->dvi_dual = false;
> +	info->is_hdmi = false;
>  	info->has_hdmi_infoframe = false;
>  	info->rgb_quant_range_selectable = false;
>  	memset(&info->hdmi, 0, sizeof(info->hdmi));
> diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h
> index ca745d9feaf5..e80ca0d149e5 100644
> --- a/include/drm/drm_connector.h
> +++ b/include/drm/drm_connector.h
> @@ -426,6 +426,11 @@ struct drm_display_info {
>  	 */
>  	bool dvi_dual;
>  
> +	/**
> +	 * @is_hdmi: True if the sink is an HDMI device.
> +	 */
> +	bool is_hdmi;
> +
>  	/**
>  	 * @has_hdmi_infoframe: Does the sink support the HDMI infoframe?
>  	 */
> -- 
> Regards,
> 
> Laurent Pinchart
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
diff mbox series

Patch

diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
index 82a4ceed3fcf..d2e7a5334c3f 100644
--- a/drivers/gpu/drm/drm_edid.c
+++ b/drivers/gpu/drm/drm_edid.c
@@ -4559,6 +4559,8 @@  drm_parse_hdmi_vsdb_video(struct drm_connector *connector, const u8 *db)
 	struct drm_display_info *info = &connector->display_info;
 	u8 len = cea_db_payload_len(db);
 
+	info->is_hdmi = true;
+
 	if (len >= 6)
 		info->dvi_dual = db[6] & 1;
 	if (len >= 7)
@@ -4627,6 +4629,7 @@  drm_reset_display_info(struct drm_connector *connector)
 	info->cea_rev = 0;
 	info->max_tmds_clock = 0;
 	info->dvi_dual = false;
+	info->is_hdmi = false;
 	info->has_hdmi_infoframe = false;
 	info->rgb_quant_range_selectable = false;
 	memset(&info->hdmi, 0, sizeof(info->hdmi));
diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h
index ca745d9feaf5..e80ca0d149e5 100644
--- a/include/drm/drm_connector.h
+++ b/include/drm/drm_connector.h
@@ -426,6 +426,11 @@  struct drm_display_info {
 	 */
 	bool dvi_dual;
 
+	/**
+	 * @is_hdmi: True if the sink is an HDMI device.
+	 */
+	bool is_hdmi;
+
 	/**
 	 * @has_hdmi_infoframe: Does the sink support the HDMI infoframe?
 	 */