diff mbox series

[v2,03/50] drm/edid: Add flag to drm_display_info to identify HDMI sinks

Message ID 20190820011721.30136-4-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 Aug. 20, 2019, 1:16 a.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>
Reviewed-by: Andrzej Hajda <a.hajda@samsung.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
---
Changes since v1:

- Link the is_hdmi field doc with drm_detect_hdmi_monitor()
- Add a conversion task in todo.rst
---
 Documentation/gpu/todo.rst  | 12 ++++++++++++
 drivers/gpu/drm/drm_edid.c  |  6 ++++++
 include/drm/drm_connector.h |  8 ++++++++
 3 files changed, 26 insertions(+)

Comments

Boris Brezillon Aug. 22, 2019, 9:15 a.m. UTC | #1
On Tue, 20 Aug 2019 04:16:34 +0300
Laurent Pinchart <laurent.pinchart@ideasonboard.com> 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>
> Reviewed-by: Andrzej Hajda <a.hajda@samsung.com>
> Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>

Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>

> ---
> Changes since v1:
> 
> - Link the is_hdmi field doc with drm_detect_hdmi_monitor()
> - Add a conversion task in todo.rst
> ---
>  Documentation/gpu/todo.rst  | 12 ++++++++++++
>  drivers/gpu/drm/drm_edid.c  |  6 ++++++
>  include/drm/drm_connector.h |  8 ++++++++
>  3 files changed, 26 insertions(+)
> 
> diff --git a/Documentation/gpu/todo.rst b/Documentation/gpu/todo.rst
> index 32787acff0a8..199751149e23 100644
> --- a/Documentation/gpu/todo.rst
> +++ b/Documentation/gpu/todo.rst
> @@ -284,6 +284,18 @@ drm_fb_helper tasks
>    removed: drm_fb_helper_single_add_all_connectors(),
>    drm_fb_helper_add_one_connector() and drm_fb_helper_remove_one_connector().
>  
> +Replace drm_detect_hdmi_monitor() with drm_display_info.is_hdmi
> +---------------------------------------------------------------
> +
> +Once EDID is parsed, the monitor HDMI support information is available through
> +drm_display_info.is_hdmi. Many drivers still call drm_detect_hdmi_monitor() to
> +retrieve the same information, which is less efficient.
> +
> +Audit each individual driver calling drm_detect_hdmi_monitor() and switch to
> +drm_display_info.is_hdmi if applicable.
> +
> +Contact: Laurent Pinchart, respective driver maintainers
> +
>  Core refactorings
>  =================
>  
> diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
> index 86ddb67c1e8a..8be00dda945b 100644
> --- a/drivers/gpu/drm/drm_edid.c
> +++ b/drivers/gpu/drm/drm_edid.c
> @@ -4325,6 +4325,9 @@ EXPORT_SYMBOL(drm_av_sync_delay);
>   *
>   * Parse the CEA extension according to CEA-861-B.
>   *
> + * Drivers that have added the modes parsed from EDID to drm_display_info
> + * should use &drm_display_info.is_hdmi instead of calling this function.
> + *
>   * Return: True if the monitor is HDMI, false if not or unknown.
>   */
>  bool drm_detect_hdmi_monitor(struct edid *edid)
> @@ -4559,6 +4562,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 +4632,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 b91e369cfb11..9b6f69c5092b 100644
> --- a/include/drm/drm_connector.h
> +++ b/include/drm/drm_connector.h
> @@ -430,6 +430,14 @@ struct drm_display_info {
>  	 */
>  	bool dvi_dual;
>  
> +	/**
> +	 * @is_hdmi: True if the sink is an HDMI device.
> +	 *
> +	 * This field shall be used instead of calling
> +	 * drm_detect_hdmi_monitor() when possible.
> +	 */
> +	bool is_hdmi;
> +
>  	/**
>  	 * @has_hdmi_infoframe: Does the sink support the HDMI infoframe?
>  	 */
diff mbox series

Patch

diff --git a/Documentation/gpu/todo.rst b/Documentation/gpu/todo.rst
index 32787acff0a8..199751149e23 100644
--- a/Documentation/gpu/todo.rst
+++ b/Documentation/gpu/todo.rst
@@ -284,6 +284,18 @@  drm_fb_helper tasks
   removed: drm_fb_helper_single_add_all_connectors(),
   drm_fb_helper_add_one_connector() and drm_fb_helper_remove_one_connector().
 
+Replace drm_detect_hdmi_monitor() with drm_display_info.is_hdmi
+---------------------------------------------------------------
+
+Once EDID is parsed, the monitor HDMI support information is available through
+drm_display_info.is_hdmi. Many drivers still call drm_detect_hdmi_monitor() to
+retrieve the same information, which is less efficient.
+
+Audit each individual driver calling drm_detect_hdmi_monitor() and switch to
+drm_display_info.is_hdmi if applicable.
+
+Contact: Laurent Pinchart, respective driver maintainers
+
 Core refactorings
 =================
 
diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
index 86ddb67c1e8a..8be00dda945b 100644
--- a/drivers/gpu/drm/drm_edid.c
+++ b/drivers/gpu/drm/drm_edid.c
@@ -4325,6 +4325,9 @@  EXPORT_SYMBOL(drm_av_sync_delay);
  *
  * Parse the CEA extension according to CEA-861-B.
  *
+ * Drivers that have added the modes parsed from EDID to drm_display_info
+ * should use &drm_display_info.is_hdmi instead of calling this function.
+ *
  * Return: True if the monitor is HDMI, false if not or unknown.
  */
 bool drm_detect_hdmi_monitor(struct edid *edid)
@@ -4559,6 +4562,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 +4632,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 b91e369cfb11..9b6f69c5092b 100644
--- a/include/drm/drm_connector.h
+++ b/include/drm/drm_connector.h
@@ -430,6 +430,14 @@  struct drm_display_info {
 	 */
 	bool dvi_dual;
 
+	/**
+	 * @is_hdmi: True if the sink is an HDMI device.
+	 *
+	 * This field shall be used instead of calling
+	 * drm_detect_hdmi_monitor() when possible.
+	 */
+	bool is_hdmi;
+
 	/**
 	 * @has_hdmi_infoframe: Does the sink support the HDMI infoframe?
 	 */