Skip to contentSkip to conversation

drm/edid: Fill PAR in AVI infoframe based on CEA mode list

PATCH Superseded Vandana Kannan 4 participants 15 messages Mar 21, 2014 – Apr 1, 2014

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/edid: Fill PAR in AVI infoframe based on CEA mode list

Populate PAR in infoframe structure. If there is a user setting for PAR, then that value is set. Else, value is taken from CEA mode list if VIC is found. Else, PAR is calculated from resolution. If none of these conditions are satisfied, PAR is NONE as per initialization.

As a next step, create a property that would enable a user space app to set aspect ratio. (will be pushed as a separate patch)

Cc Jesse Barnes <[email protected]>
Cc Vijay Purushothaman <[email protected]>
Cc Ville Syrjälä <[email protected]>
---
 drivers/gpu/drm/drm_edid.c |   34 ++++++++++++++++++++++++++++++++++
 include/drm/drm_crtc.h     |    1 +
 2 files changed, 35 insertions(+)
drivers/gpu/drm/drm_edid.c +34 -0
index d4e3f9d..3db693f 100644
@@ -2452,6 +2452,21 @@ u8 drm_match_cea_mode(const struct drm_display_mode *to_match)
 }
 EXPORT_SYMBOL(drm_match_cea_mode);
 
+/**
+ * drm_get_cea_aspect_ratio - get the picture aspect ratio corresponding to
+ * the input VIC from the CEA mode list
+ *
+ * Returns picture aspect ratio
+ */
+enum hdmi_picture_aspect drm_get_cea_aspect_ratio(const u8 video_code)
+{
+	/* return picture aspect ratio for video_code - 1 to access the
+	 * right array element
+	*/
+	return edid_cea_modes[video_code-1].picture_aspect_ratio;
+}
+EXPORT_SYMBOL(drm_get_cea_aspect_ratio);
+
 /*
  * Calculate the alternate clock for HDMI modes (those from the HDMI vendor
  * specific block).
@@ -3613,6 +3628,25 @@ drm_hdmi_avi_infoframe_from_display_mode(struct hdmi_avi_infoframe *frame,
 	frame->video_code = drm_match_cea_mode(mode);
 
 	frame->picture_aspect = HDMI_PICTURE_ASPECT_NONE;
+
+	/* Populate picture aspect ratio from either CEA mode list or
+	 *  user input
+	*/
+	if (mode->picture_aspect_ratio == HDMI_PICTURE_ASPECT_4_3 ||
+		mode->picture_aspect_ratio == HDMI_PICTURE_ASPECT_16_9)
+		frame->picture_aspect = mode->picture_aspect_ratio;
+	else if (frame->video_code > 0)
+		frame->picture_aspect = drm_get_cea_aspect_ratio(
+						frame->video_code);
+	else {
+		if (!(mode->vdisplay % 3) &&
+			(((mode->vdisplay * 4) / 3) == mode->hdisplay))
+			frame->picture_aspect = HDMI_PICTURE_ASPECT_4_3;
+		else if (!(mode->vdisplay % 9) &&
+			(((mode->vdisplay * 16) / 9) == mode->hdisplay))
+			frame->picture_aspect = HDMI_PICTURE_ASPECT_16_9;
+	}
+
 	frame->active_aspect = HDMI_ACTIVE_ASPECT_PICTURE;
 	frame->scan_mode = HDMI_SCAN_MODE_UNDERSCAN;
 
include/drm/drm_crtc.h +1 -0
index 27f828c..50dc55a 100644
@@ -983,6 +983,7 @@ extern int drm_mode_gamma_get_ioctl(struct drm_device *dev,
 extern int drm_mode_gamma_set_ioctl(struct drm_device *dev,
 				    void *data, struct drm_file *file_priv);
 extern u8 drm_match_cea_mode(const struct drm_display_mode *to_match);
+extern enum hdmi_picture_aspect drm_get_cea_aspect_ratio(const u8 video_code);
 extern bool drm_detect_hdmi_monitor(struct edid *edid);
 extern bool drm_detect_monitor_audio(struct edid *edid);
 extern bool drm_rgb_quant_range_selectable(struct edid *edid);
Signature · 6 lines
1.7.9.5

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by on v1 1/1
#1 lore raw
Quoted 75 lines · On Fri, 21 Mar 2014 08:31:29 +0530 Vandana Kannan <[email protected]>…

Populate PAR in infoframe structure. If there is a user setting for PAR, then that value is set. Else, value is taken from CEA mode list if VIC is found. Else, PAR is calculated from resolution. If none of these conditions are satisfied, PAR is NONE as per initialization.

As a next step, create a property that would enable a user space app to set aspect ratio. (will be pushed as a separate patch)

Cc Jesse Barnes <[email protected]>
Cc Vijay Purushothaman <[email protected]>
Cc Ville Syrjälä <[email protected]>
---
 drivers/gpu/drm/drm_edid.c |   34 ++++++++++++++++++++++++++++++++++
 include/drm/drm_crtc.h     |    1 +
 2 files changed, 35 insertions(+)
drivers/gpu/drm/drm_edid.c +34 -0
index d4e3f9d..3db693f 100644
@@ -2452,6 +2452,21 @@ u8 drm_match_cea_mode(const struct drm_display_mode *to_match)
 }
 EXPORT_SYMBOL(drm_match_cea_mode);
 
+/**
+ * drm_get_cea_aspect_ratio - get the picture aspect ratio corresponding to
+ * the input VIC from the CEA mode list
+ *
+ * Returns picture aspect ratio
+ */
+enum hdmi_picture_aspect drm_get_cea_aspect_ratio(const u8 video_code)
+{
+	/* return picture aspect ratio for video_code - 1 to access the
+	 * right array element
+	*/
+	return edid_cea_modes[video_code-1].picture_aspect_ratio;
+}
+EXPORT_SYMBOL(drm_get_cea_aspect_ratio);
+
 /*
  * Calculate the alternate clock for HDMI modes (those from the HDMI vendor
  * specific block).
@@ -3613,6 +3628,25 @@ drm_hdmi_avi_infoframe_from_display_mode(struct hdmi_avi_infoframe *frame,
 	frame->video_code = drm_match_cea_mode(mode);
 
 	frame->picture_aspect = HDMI_PICTURE_ASPECT_NONE;
+
+	/* Populate picture aspect ratio from either CEA mode list or
+	 *  user input
+	*/
+	if (mode->picture_aspect_ratio == HDMI_PICTURE_ASPECT_4_3 ||
+		mode->picture_aspect_ratio == HDMI_PICTURE_ASPECT_16_9)
+		frame->picture_aspect = mode->picture_aspect_ratio;
+	else if (frame->video_code > 0)
+		frame->picture_aspect = drm_get_cea_aspect_ratio(
+						frame->video_code);
+	else {
+		if (!(mode->vdisplay % 3) &&
+			(((mode->vdisplay * 4) / 3) == mode->hdisplay))
+			frame->picture_aspect = HDMI_PICTURE_ASPECT_4_3;
+		else if (!(mode->vdisplay % 9) &&
+			(((mode->vdisplay * 16) / 9) == mode->hdisplay))
+			frame->picture_aspect = HDMI_PICTURE_ASPECT_16_9;
+	}
+
 	frame->active_aspect = HDMI_ACTIVE_ASPECT_PICTURE;
 	frame->scan_mode = HDMI_SCAN_MODE_UNDERSCAN;
 
include/drm/drm_crtc.h +0 -0
index 27f828c..50dc55a 100644

include/drm/drm_crtc.h extern int drm_mode_gamma_get_ioctl(struct drm_device *dev, · line 989

Quoted 7 lines
include/drm/drm_crtc.h +1 -0
@@ -983,6 +983,7 @@ extern int drm_mode_gamma_get_ioctl(struct drm_device *dev,
 extern int drm_mode_gamma_set_ioctl(struct drm_device *dev,
 				    void *data, struct drm_file *file_priv);
 extern u8 drm_match_cea_mode(const struct drm_display_mode *to_match);
+extern enum hdmi_picture_aspect drm_get_cea_aspect_ratio(const u8 video_code);
 extern bool drm_detect_hdmi_monitor(struct edid *edid);
 extern bool drm_detect_monitor_audio(struct edid *edid);
 extern bool drm_rgb_quant_range_selectable(struct edid *edid);

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

#2 lore raw
In reply to Vandana Kannan
Quoted 45 lines · Vandana Kannan

Populate PAR in infoframe structure. If there is a user setting for PAR, then that value is set. Else, value is taken from CEA mode list if VIC is found. Else, PAR is calculated from resolution. If none of these conditions are satisfied, PAR is NONE as per initialization.

As a next step, create a property that would enable a user space app to set aspect ratio. (will be pushed as a separate patch)

Cc Jesse Barnes <[email protected]>
Cc Vijay Purushothaman <[email protected]>
Cc Ville Syrjälä <[email protected]>
---
 drivers/gpu/drm/drm_edid.c |   34 ++++++++++++++++++++++++++++++++++
 include/drm/drm_crtc.h     |    1 +
 2 files changed, 35 insertions(+)
drivers/gpu/drm/drm_edid.c +15 -0
index d4e3f9d..3db693f 100644
@@ -2452,6 +2452,21 @@ u8 drm_match_cea_mode(const struct drm_display_mode *to_match)
 }
 EXPORT_SYMBOL(drm_match_cea_mode);
 
+/**
+ * drm_get_cea_aspect_ratio - get the picture aspect ratio corresponding to
+ * the input VIC from the CEA mode list
+ *
+ * Returns picture aspect ratio
+ */
+enum hdmi_picture_aspect drm_get_cea_aspect_ratio(const u8 video_code)
+{
+	/* return picture aspect ratio for video_code - 1 to access the
+	 * right array element
+	*/
+	return edid_cea_modes[video_code-1].picture_aspect_ratio;
+}
+EXPORT_SYMBOL(drm_get_cea_aspect_ratio);
+
 /*
  * Calculate the alternate clock for HDMI modes (those from the HDMI vendor
  * specific block).

drivers/gpu/drm/drm_edid.c drm_hdmi_avi_infoframe_from_display_mode(struct hdmi_avi_infoframe *frame, · line 3637

Quoted 10 lines
drivers/gpu/drm/drm_edid.c +7 -0
@@ -3613,6 +3628,25 @@ drm_hdmi_avi_infoframe_from_display_mode(struct hdmi_avi_infoframe *frame,
 	frame->video_code = drm_match_cea_mode(mode);
 
 	frame->picture_aspect = HDMI_PICTURE_ASPECT_NONE;
+
+	/* Populate picture aspect ratio from either CEA mode list or
+	 *  user input
+	*/
+	if (mode->picture_aspect_ratio == HDMI_PICTURE_ASPECT_4_3 ||
+		mode->picture_aspect_ratio == HDMI_PICTURE_ASPECT_16_9)
+		frame->picture_aspect = mode->picture_aspect_ratio;

Please pardon my ignorance, but how can userspace actually set this part of the mode? I couldn't find any code which sets this anywhere ... -Daniel

Quoted 34 lines
drivers/gpu/drm/drm_edid.c +12 -0
+	else if (frame->video_code > 0)
+		frame->picture_aspect = drm_get_cea_aspect_ratio(
+						frame->video_code);
+	else {
+		if (!(mode->vdisplay % 3) &&
+			(((mode->vdisplay * 4) / 3) == mode->hdisplay))
+			frame->picture_aspect = HDMI_PICTURE_ASPECT_4_3;
+		else if (!(mode->vdisplay % 9) &&
+			(((mode->vdisplay * 16) / 9) == mode->hdisplay))
+			frame->picture_aspect = HDMI_PICTURE_ASPECT_16_9;
+	}
+
 	frame->active_aspect = HDMI_ACTIVE_ASPECT_PICTURE;
 	frame->scan_mode = HDMI_SCAN_MODE_UNDERSCAN;
 
include/drm/drm_crtc.h +1 -0
index 27f828c..50dc55a 100644
@@ -983,6 +983,7 @@ extern int drm_mode_gamma_get_ioctl(struct drm_device *dev,
 extern int drm_mode_gamma_set_ioctl(struct drm_device *dev,
 				    void *data, struct drm_file *file_priv);
 extern u8 drm_match_cea_mode(const struct drm_display_mode *to_match);
+extern enum hdmi_picture_aspect drm_get_cea_aspect_ratio(const u8 video_code);
 extern bool drm_detect_hdmi_monitor(struct edid *edid);
 extern bool drm_detect_monitor_audio(struct edid *edid);
 extern bool drm_rgb_quant_range_selectable(struct edid *edid);
Signature · 6 lines
1.7.9.5

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
#3 lore raw
Quoted 48 lines · Daniel Vetter
Quoted 47 lines · Vandana Kannan

Populate PAR in infoframe structure. If there is a user setting for PAR, then that value is set. Else, value is taken from CEA mode list if VIC is found. Else, PAR is calculated from resolution. If none of these conditions are satisfied, PAR is NONE as per initialization.

As a next step, create a property that would enable a user space app to set aspect ratio. (will be pushed as a separate patch)

Cc Jesse Barnes <[email protected]>
Cc Vijay Purushothaman <[email protected]>
Cc Ville Syrjälä <[email protected]>
---
 drivers/gpu/drm/drm_edid.c |   34 ++++++++++++++++++++++++++++++++++
 include/drm/drm_crtc.h     |    1 +
 2 files changed, 35 insertions(+)
drivers/gpu/drm/drm_edid.c +15 -0
index d4e3f9d..3db693f 100644
@@ -2452,6 +2452,21 @@ u8 drm_match_cea_mode(const struct drm_display_mode *to_match)
 }
 EXPORT_SYMBOL(drm_match_cea_mode);
 
+/**
+ * drm_get_cea_aspect_ratio - get the picture aspect ratio corresponding to
+ * the input VIC from the CEA mode list
+ *
+ * Returns picture aspect ratio
+ */
+enum hdmi_picture_aspect drm_get_cea_aspect_ratio(const u8 video_code)
+{
+	/* return picture aspect ratio for video_code - 1 to access the
+	 * right array element
+	*/
+	return edid_cea_modes[video_code-1].picture_aspect_ratio;
+}
+EXPORT_SYMBOL(drm_get_cea_aspect_ratio);
+
 /*
  * Calculate the alternate clock for HDMI modes (those from the HDMI vendor
  * specific block).
@@ -3613,6 +3628,25 @@ drm_hdmi_avi_infoframe_from_display_mode(struct hdmi_avi_infoframe *frame,
 	frame->video_code = drm_match_cea_mode(mode);
 
Quoted 13 lines

drivers/gpu/drm/drm_edid.c drm_hdmi_avi_infoframe_from_display_mode(struct hdmi_avi_infoframe *frame, · line 3637

Quoted 8 lines
drivers/gpu/drm/drm_edid.c +7 -0
 	frame->picture_aspect = HDMI_PICTURE_ASPECT_NONE;
+
+	/* Populate picture aspect ratio from either CEA mode list or
+	 *  user input
+	*/
+	if (mode->picture_aspect_ratio == HDMI_PICTURE_ASPECT_4_3 ||
+		mode->picture_aspect_ratio == HDMI_PICTURE_ASPECT_16_9)
+		frame->picture_aspect = mode->picture_aspect_ratio;

Please pardon my ignorance, but how can userspace actually set this part of the mode? I couldn't find any code which sets this anywhere ... -Daniel

I have submitted a patch to enable user space to set picture aspect ratio through a property..
drm/i915: Add property to set HDMI aspect ratio
http://lists.freedesktop.org/archives/intel-gfx/2014-March/042403.html
-Vandana

Quoted 35 lines
Quoted 34 lines
drivers/gpu/drm/drm_edid.c +12 -0
+	else if (frame->video_code > 0)
+		frame->picture_aspect = drm_get_cea_aspect_ratio(
+						frame->video_code);
+	else {
+		if (!(mode->vdisplay % 3) &&
+			(((mode->vdisplay * 4) / 3) == mode->hdisplay))
+			frame->picture_aspect = HDMI_PICTURE_ASPECT_4_3;
+		else if (!(mode->vdisplay % 9) &&
+			(((mode->vdisplay * 16) / 9) == mode->hdisplay))
+			frame->picture_aspect = HDMI_PICTURE_ASPECT_16_9;
+	}
+
 	frame->active_aspect = HDMI_ACTIVE_ASPECT_PICTURE;
 	frame->scan_mode = HDMI_SCAN_MODE_UNDERSCAN;
 
include/drm/drm_crtc.h +1 -0
index 27f828c..50dc55a 100644
@@ -983,6 +983,7 @@ extern int drm_mode_gamma_get_ioctl(struct drm_device *dev,
 extern int drm_mode_gamma_set_ioctl(struct drm_device *dev,
 				    void *data, struct drm_file *file_priv);
 extern u8 drm_match_cea_mode(const struct drm_display_mode *to_match);
+extern enum hdmi_picture_aspect drm_get_cea_aspect_ratio(const u8 video_code);
 extern bool drm_detect_hdmi_monitor(struct edid *edid);
 extern bool drm_detect_monitor_audio(struct edid *edid);
 extern bool drm_rgb_quant_range_selectable(struct edid *edid);
Signature · 6 lines
1.7.9.5

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
#4 lore raw
Quoted 62 lines · Vandana Kannan
Quoted 48 lines · Daniel Vetter
Quoted 47 lines · Vandana Kannan

Populate PAR in infoframe structure. If there is a user setting for PAR, then that value is set. Else, value is taken from CEA mode list if VIC is found. Else, PAR is calculated from resolution. If none of these conditions are satisfied, PAR is NONE as per initialization.

As a next step, create a property that would enable a user space app to set aspect ratio. (will be pushed as a separate patch)

Cc Jesse Barnes <[email protected]>
Cc Vijay Purushothaman <[email protected]>
Cc Ville Syrjälä <[email protected]>
---
 drivers/gpu/drm/drm_edid.c |   34 ++++++++++++++++++++++++++++++++++
 include/drm/drm_crtc.h     |    1 +
 2 files changed, 35 insertions(+)
drivers/gpu/drm/drm_edid.c +15 -0
index d4e3f9d..3db693f 100644
@@ -2452,6 +2452,21 @@ u8 drm_match_cea_mode(const struct drm_display_mode *to_match)
 }
 EXPORT_SYMBOL(drm_match_cea_mode);
 
+/**
+ * drm_get_cea_aspect_ratio - get the picture aspect ratio corresponding to
+ * the input VIC from the CEA mode list
+ *
+ * Returns picture aspect ratio
+ */
+enum hdmi_picture_aspect drm_get_cea_aspect_ratio(const u8 video_code)
+{
+	/* return picture aspect ratio for video_code - 1 to access the
+	 * right array element
+	*/
+	return edid_cea_modes[video_code-1].picture_aspect_ratio;
+}
+EXPORT_SYMBOL(drm_get_cea_aspect_ratio);
+
 /*
  * Calculate the alternate clock for HDMI modes (those from the HDMI vendor
  * specific block).
@@ -3613,6 +3628,25 @@ drm_hdmi_avi_infoframe_from_display_mode(struct hdmi_avi_infoframe *frame,
 	frame->video_code = drm_match_cea_mode(mode);
 
Quoted 13 lines

drivers/gpu/drm/drm_edid.c drm_hdmi_avi_infoframe_from_display_mode(struct hdmi_avi_infoframe *frame, · line 3637

Quoted 8 lines
drivers/gpu/drm/drm_edid.c +7 -0
 	frame->picture_aspect = HDMI_PICTURE_ASPECT_NONE;
+
+	/* Populate picture aspect ratio from either CEA mode list or
+	 *  user input
+	*/
+	if (mode->picture_aspect_ratio == HDMI_PICTURE_ASPECT_4_3 ||
+		mode->picture_aspect_ratio == HDMI_PICTURE_ASPECT_16_9)
+		frame->picture_aspect = mode->picture_aspect_ratio;

Please pardon my ignorance, but how can userspace actually set this part of the mode? I couldn't find any code which sets this anywhere ... -Daniel

Quoted 4 lines

I have submitted a patch to enable user space to set picture aspect ratio through a property..
drm/i915: Add property to set HDMI aspect ratio
http://lists.freedesktop.org/archives/intel-gfx/2014-March/042403.html

Ah, that makes more sense. I think we should move the property also into the drm core so that all drivers that want to expose this can use the same property. Also if you have patches which depend upon each another in a funtional way it's better to post them together in one series. -Daniel

Quoted 37 lines

-Vandana

Quoted 35 lines
Quoted 34 lines
drivers/gpu/drm/drm_edid.c +12 -0
+	else if (frame->video_code > 0)
+		frame->picture_aspect = drm_get_cea_aspect_ratio(
+						frame->video_code);
+	else {
+		if (!(mode->vdisplay % 3) &&
+			(((mode->vdisplay * 4) / 3) == mode->hdisplay))
+			frame->picture_aspect = HDMI_PICTURE_ASPECT_4_3;
+		else if (!(mode->vdisplay % 9) &&
+			(((mode->vdisplay * 16) / 9) == mode->hdisplay))
+			frame->picture_aspect = HDMI_PICTURE_ASPECT_16_9;
+	}
+
 	frame->active_aspect = HDMI_ACTIVE_ASPECT_PICTURE;
 	frame->scan_mode = HDMI_SCAN_MODE_UNDERSCAN;
 
include/drm/drm_crtc.h +1 -0
index 27f828c..50dc55a 100644
@@ -983,6 +983,7 @@ extern int drm_mode_gamma_get_ioctl(struct drm_device *dev,
 extern int drm_mode_gamma_set_ioctl(struct drm_device *dev,
 				    void *data, struct drm_file *file_priv);
 extern u8 drm_match_cea_mode(const struct drm_display_mode *to_match);
+extern enum hdmi_picture_aspect drm_get_cea_aspect_ratio(const u8 video_code);
 extern bool drm_detect_hdmi_monitor(struct edid *edid);
 extern bool drm_detect_monitor_audio(struct edid *edid);
 extern bool drm_rgb_quant_range_selectable(struct edid *edid);
Signature · 6 lines
1.7.9.5

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
#5 lore raw
Quoted 68 lines · Daniel Vetter
Quoted 62 lines · Vandana Kannan
Quoted 48 lines · Daniel Vetter
Quoted 47 lines · Vandana Kannan

Populate PAR in infoframe structure. If there is a user setting for PAR, then that value is set. Else, value is taken from CEA mode list if VIC is found. Else, PAR is calculated from resolution. If none of these conditions are satisfied, PAR is NONE as per initialization.

As a next step, create a property that would enable a user space app to set aspect ratio. (will be pushed as a separate patch)

Cc Jesse Barnes <[email protected]>
Cc Vijay Purushothaman <[email protected]>
Cc Ville Syrjälä <[email protected]>
---
 drivers/gpu/drm/drm_edid.c |   34 ++++++++++++++++++++++++++++++++++
 include/drm/drm_crtc.h     |    1 +
 2 files changed, 35 insertions(+)
drivers/gpu/drm/drm_edid.c +15 -0
index d4e3f9d..3db693f 100644
@@ -2452,6 +2452,21 @@ u8 drm_match_cea_mode(const struct drm_display_mode *to_match)
 }
 EXPORT_SYMBOL(drm_match_cea_mode);
 
+/**
+ * drm_get_cea_aspect_ratio - get the picture aspect ratio corresponding to
+ * the input VIC from the CEA mode list
+ *
+ * Returns picture aspect ratio
+ */
+enum hdmi_picture_aspect drm_get_cea_aspect_ratio(const u8 video_code)
+{
+	/* return picture aspect ratio for video_code - 1 to access the
+	 * right array element
+	*/
+	return edid_cea_modes[video_code-1].picture_aspect_ratio;
+}
+EXPORT_SYMBOL(drm_get_cea_aspect_ratio);
+
 /*
  * Calculate the alternate clock for HDMI modes (those from the HDMI vendor
  * specific block).
@@ -3613,6 +3628,25 @@ drm_hdmi_avi_infoframe_from_display_mode(struct hdmi_avi_infoframe *frame,
 	frame->video_code = drm_match_cea_mode(mode);
 
Quoted 13 lines

drivers/gpu/drm/drm_edid.c drm_hdmi_avi_infoframe_from_display_mode(struct hdmi_avi_infoframe *frame, · line 3637

Quoted 8 lines
drivers/gpu/drm/drm_edid.c +7 -0
 	frame->picture_aspect = HDMI_PICTURE_ASPECT_NONE;
+
+	/* Populate picture aspect ratio from either CEA mode list or
+	 *  user input
+	*/
+	if (mode->picture_aspect_ratio == HDMI_PICTURE_ASPECT_4_3 ||
+		mode->picture_aspect_ratio == HDMI_PICTURE_ASPECT_16_9)
+		frame->picture_aspect = mode->picture_aspect_ratio;

Please pardon my ignorance, but how can userspace actually set this part of the mode? I couldn't find any code which sets this anywhere ... -Daniel

Quoted 4 lines

I have submitted a patch to enable user space to set picture aspect ratio through a property..
drm/i915: Add property to set HDMI aspect ratio
http://lists.freedesktop.org/archives/intel-gfx/2014-March/042403.html

Quoted 6 lines

Ah, that makes more sense. I think we should move the property also into the drm core so that all drivers that want to expose this can use the same property. Also if you have patches which depend upon each another in a funtional way it's better to post them together in one series. -Daniel

Ok, I will modify the patch (which adds aspect ratio property) to move the property to drm and resend separately.
This patch as it is unblocks AVI infoframe compliance test, so can this patch be considered for acceptance now?

Quoted 38 lines
Quoted 37 lines

-Vandana

Quoted 35 lines
Quoted 34 lines
drivers/gpu/drm/drm_edid.c +12 -0
+	else if (frame->video_code > 0)
+		frame->picture_aspect = drm_get_cea_aspect_ratio(
+						frame->video_code);
+	else {
+		if (!(mode->vdisplay % 3) &&
+			(((mode->vdisplay * 4) / 3) == mode->hdisplay))
+			frame->picture_aspect = HDMI_PICTURE_ASPECT_4_3;
+		else if (!(mode->vdisplay % 9) &&
+			(((mode->vdisplay * 16) / 9) == mode->hdisplay))
+			frame->picture_aspect = HDMI_PICTURE_ASPECT_16_9;
+	}
+
 	frame->active_aspect = HDMI_ACTIVE_ASPECT_PICTURE;
 	frame->scan_mode = HDMI_SCAN_MODE_UNDERSCAN;
 
include/drm/drm_crtc.h +1 -0
index 27f828c..50dc55a 100644
@@ -983,6 +983,7 @@ extern int drm_mode_gamma_get_ioctl(struct drm_device *dev,
 extern int drm_mode_gamma_set_ioctl(struct drm_device *dev,
 				    void *data, struct drm_file *file_priv);
 extern u8 drm_match_cea_mode(const struct drm_display_mode *to_match);
+extern enum hdmi_picture_aspect drm_get_cea_aspect_ratio(const u8 video_code);
 extern bool drm_detect_hdmi_monitor(struct edid *edid);
 extern bool drm_detect_monitor_audio(struct edid *edid);
 extern bool drm_rgb_quant_range_selectable(struct edid *edid);
Signature · 6 lines
1.7.9.5

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
#6 lore raw
Quoted 4 lines · Vandana Kannan

Ok, I will modify the patch (which adds aspect ratio property) to move the property to drm and resend separately.
This patch as it is unblocks AVI infoframe compliance test, so can this patch be considered for acceptance now?

Without the 2 lines to look at mode->picture_aspect_ratio I think yes. -Daniel

Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
#7 lore raw

PATCH v2 1/1 drm/edid: Fill PAR in AVI infoframe based on CEA mode list

Populate PAR in infoframe structure. If there is a user setting for PAR, then that value is set. Else, value is taken from CEA mode list if VIC is found. Else, PAR is calculated from resolution. If none of these conditions are satisfied, PAR is NONE as per initialization.

v2: Removed the part which sets PAR according to user input, based on Daniel's review comments.

A separate patch will be submitted to create a property that would enable a user space app to set aspect ratio for AVI infoframe.

---
 drivers/gpu/drm/drm_edid.c | 29 +++++++++++++++++++++++++++++
 include/drm/drm_crtc.h     |  1 +
 2 files changed, 30 insertions(+)
drivers/gpu/drm/drm_edid.c +29 -0
index d4e3f9d..fee24d3 100644
@@ -2452,6 +2452,21 @@ u8 drm_match_cea_mode(const struct drm_display_mode *to_match)
 }
 EXPORT_SYMBOL(drm_match_cea_mode);
 
+/**
+ * drm_get_cea_aspect_ratio - get the picture aspect ratio corresponding to
+ * the input VIC from the CEA mode list
+ *
+ * Returns picture aspect ratio
+ */
+enum hdmi_picture_aspect drm_get_cea_aspect_ratio(const u8 video_code)
+{
+	/* return picture aspect ratio for video_code - 1 to access the
+	 * right array element
+	*/
+	return edid_cea_modes[video_code-1].picture_aspect_ratio;
+}
+EXPORT_SYMBOL(drm_get_cea_aspect_ratio);
+
 /*
  * Calculate the alternate clock for HDMI modes (those from the HDMI vendor
  * specific block).
@@ -3613,6 +3628,20 @@ drm_hdmi_avi_infoframe_from_display_mode(struct hdmi_avi_infoframe *frame,
 	frame->video_code = drm_match_cea_mode(mode);
 
 	frame->picture_aspect = HDMI_PICTURE_ASPECT_NONE;
+
+	/* Populate picture aspect ratio from CEA mode list */
+	if (frame->video_code > 0)
+		frame->picture_aspect = drm_get_cea_aspect_ratio(
+						frame->video_code);
+	else {
+		if (!(mode->vdisplay % 3) &&
+			(((mode->vdisplay * 4) / 3) == mode->hdisplay))
+			frame->picture_aspect = HDMI_PICTURE_ASPECT_4_3;
+		else if (!(mode->vdisplay % 9) &&
+			(((mode->vdisplay * 16) / 9) == mode->hdisplay))
+			frame->picture_aspect = HDMI_PICTURE_ASPECT_16_9;
+	}
+
 	frame->active_aspect = HDMI_ACTIVE_ASPECT_PICTURE;
 	frame->scan_mode = HDMI_SCAN_MODE_UNDERSCAN;
 
include/drm/drm_crtc.h +1 -0
index 27f828c..50dc55a 100644
@@ -983,6 +983,7 @@ extern int drm_mode_gamma_get_ioctl(struct drm_device *dev,
 extern int drm_mode_gamma_set_ioctl(struct drm_device *dev,
 				    void *data, struct drm_file *file_priv);
 extern u8 drm_match_cea_mode(const struct drm_display_mode *to_match);
+extern enum hdmi_picture_aspect drm_get_cea_aspect_ratio(const u8 video_code);
 extern bool drm_detect_hdmi_monitor(struct edid *edid);
 extern bool drm_detect_monitor_audio(struct edid *edid);
 extern bool drm_rgb_quant_range_selectable(struct edid *edid);
Signature · 6 lines
1.9.1

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
#8 lore raw
Quoted 55 lines · Vandana Kannan

Populate PAR in infoframe structure. If there is a user setting for PAR, then that value is set. Else, value is taken from CEA mode list if VIC is found. Else, PAR is calculated from resolution. If none of these conditions are satisfied, PAR is NONE as per initialization.

v2: Removed the part which sets PAR according to user input, based on Daniel's review comments.

A separate patch will be submitted to create a property that would enable a user space app to set aspect ratio for AVI infoframe.

---
 drivers/gpu/drm/drm_edid.c | 29 +++++++++++++++++++++++++++++
 include/drm/drm_crtc.h     |  1 +
 2 files changed, 30 insertions(+)
drivers/gpu/drm/drm_edid.c +18 -0
index d4e3f9d..fee24d3 100644
@@ -2452,6 +2452,21 @@ u8 drm_match_cea_mode(const struct drm_display_mode *to_match)
 }
 EXPORT_SYMBOL(drm_match_cea_mode);
 
+/**
+ * drm_get_cea_aspect_ratio - get the picture aspect ratio corresponding to
+ * the input VIC from the CEA mode list
+ *
+ * Returns picture aspect ratio
+ */
+enum hdmi_picture_aspect drm_get_cea_aspect_ratio(const u8 video_code)
+{
+	/* return picture aspect ratio for video_code - 1 to access the
+	 * right array element
+	*/
+	return edid_cea_modes[video_code-1].picture_aspect_ratio;
+}
+EXPORT_SYMBOL(drm_get_cea_aspect_ratio);
+
 /*
  * Calculate the alternate clock for HDMI modes (those from the HDMI vendor
  * specific block).
@@ -3613,6 +3628,20 @@ drm_hdmi_avi_infoframe_from_display_mode(struct hdmi_avi_infoframe *frame,
 	frame->video_code = drm_match_cea_mode(mode);
 
 	frame->picture_aspect = HDMI_PICTURE_ASPECT_NONE;
+
+	/* Populate picture aspect ratio from CEA mode list */
+	if (frame->video_code > 0)

drivers/gpu/drm/drm_edid.c drm_hdmi_avi_infoframe_from_display_mode(struct hdmi_avi_infoframe *frame, · line 3643

Quoted 10 lines
drivers/gpu/drm/drm_edid.c +10 -0
+		frame->picture_aspect = drm_get_cea_aspect_ratio(
+						frame->video_code);
+	else {
+		if (!(mode->vdisplay % 3) &&
+			(((mode->vdisplay * 4) / 3) == mode->hdisplay))
+			frame->picture_aspect = HDMI_PICTURE_ASPECT_4_3;
+		else if (!(mode->vdisplay % 9) &&
+			(((mode->vdisplay * 16) / 9) == mode->hdisplay))
+			frame->picture_aspect = HDMI_PICTURE_ASPECT_16_9;
+	}

I'm not sure if providing the PAR for non-CEA modes like this makes any real difference. But I guess it can't hurt since you only provide it for exact matches.

But the matches are maybe even a bit too exact. For instance 1366x768 will not match the 16:9 case. So maybe it should be calculated in a bit more relaxed way.

Or just dropped totally. I'm not sure.

Quoted 18 lines
drivers/gpu/drm/drm_edid.c +1 -0
+
 	frame->active_aspect = HDMI_ACTIVE_ASPECT_PICTURE;
 	frame->scan_mode = HDMI_SCAN_MODE_UNDERSCAN;
 
include/drm/drm_crtc.h +1 -0
index 27f828c..50dc55a 100644
@@ -983,6 +983,7 @@ extern int drm_mode_gamma_get_ioctl(struct drm_device *dev,
 extern int drm_mode_gamma_set_ioctl(struct drm_device *dev,
 				    void *data, struct drm_file *file_priv);
 extern u8 drm_match_cea_mode(const struct drm_display_mode *to_match);
+extern enum hdmi_picture_aspect drm_get_cea_aspect_ratio(const u8 video_code);
 extern bool drm_detect_hdmi_monitor(struct edid *edid);
 extern bool drm_detect_monitor_audio(struct edid *edid);
 extern bool drm_rgb_quant_range_selectable(struct edid *edid);
Signature · 1 line
1.9.1
Signature · 2 lines
Ville Syrjälä
Intel OTC
#9 lore raw
Quoted 71 lines · Ville Syrjälä
Quoted 55 lines · Vandana Kannan

Populate PAR in infoframe structure. If there is a user setting for PAR, then that value is set. Else, value is taken from CEA mode list if VIC is found. Else, PAR is calculated from resolution. If none of these conditions are satisfied, PAR is NONE as per initialization.

v2: Removed the part which sets PAR according to user input, based on Daniel's review comments.

A separate patch will be submitted to create a property that would enable a user space app to set aspect ratio for AVI infoframe.

---
 drivers/gpu/drm/drm_edid.c | 29 +++++++++++++++++++++++++++++
 include/drm/drm_crtc.h     |  1 +
 2 files changed, 30 insertions(+)
drivers/gpu/drm/drm_edid.c +18 -0
index d4e3f9d..fee24d3 100644
@@ -2452,6 +2452,21 @@ u8 drm_match_cea_mode(const struct drm_display_mode *to_match)
 }
 EXPORT_SYMBOL(drm_match_cea_mode);
 
+/**
+ * drm_get_cea_aspect_ratio - get the picture aspect ratio corresponding to
+ * the input VIC from the CEA mode list
+ *
+ * Returns picture aspect ratio
+ */
+enum hdmi_picture_aspect drm_get_cea_aspect_ratio(const u8 video_code)
+{
+	/* return picture aspect ratio for video_code - 1 to access the
+	 * right array element
+	*/
+	return edid_cea_modes[video_code-1].picture_aspect_ratio;
+}
+EXPORT_SYMBOL(drm_get_cea_aspect_ratio);
+
 /*
  * Calculate the alternate clock for HDMI modes (those from the HDMI vendor
  * specific block).
@@ -3613,6 +3628,20 @@ drm_hdmi_avi_infoframe_from_display_mode(struct hdmi_avi_infoframe *frame,
 	frame->video_code = drm_match_cea_mode(mode);
 
 	frame->picture_aspect = HDMI_PICTURE_ASPECT_NONE;
+
+	/* Populate picture aspect ratio from CEA mode list */
+	if (frame->video_code > 0)

drivers/gpu/drm/drm_edid.c drm_hdmi_avi_infoframe_from_display_mode(struct hdmi_avi_infoframe *frame, · line 3643

Quoted 10 lines
drivers/gpu/drm/drm_edid.c +10 -0
+		frame->picture_aspect = drm_get_cea_aspect_ratio(
+						frame->video_code);
+	else {
+		if (!(mode->vdisplay % 3) &&
+			(((mode->vdisplay * 4) / 3) == mode->hdisplay))
+			frame->picture_aspect = HDMI_PICTURE_ASPECT_4_3;
+		else if (!(mode->vdisplay % 9) &&
+			(((mode->vdisplay * 16) / 9) == mode->hdisplay))
+			frame->picture_aspect = HDMI_PICTURE_ASPECT_16_9;
+	}

I'm not sure if providing the PAR for non-CEA modes like this makes any real difference. But I guess it can't hurt since you only provide it for exact matches.

Quoted 6 lines

But the matches are maybe even a bit too exact. For instance 1366x768 will not match the 16:9 case. So maybe it should be calculated in a bit more relaxed way.

Or just dropped totally. I'm not sure.

Maybe we can drop it for now (for this patch) and come up with another patch containing calculations which are more relaxed than the above. What do you think?

Quoted 19 lines
Quoted 18 lines
drivers/gpu/drm/drm_edid.c +1 -0
+
 	frame->active_aspect = HDMI_ACTIVE_ASPECT_PICTURE;
 	frame->scan_mode = HDMI_SCAN_MODE_UNDERSCAN;
 
include/drm/drm_crtc.h +1 -0
index 27f828c..50dc55a 100644
@@ -983,6 +983,7 @@ extern int drm_mode_gamma_get_ioctl(struct drm_device *dev,
 extern int drm_mode_gamma_set_ioctl(struct drm_device *dev,
 				    void *data, struct drm_file *file_priv);
 extern u8 drm_match_cea_mode(const struct drm_display_mode *to_match);
+extern enum hdmi_picture_aspect drm_get_cea_aspect_ratio(const u8 video_code);
 extern bool drm_detect_hdmi_monitor(struct edid *edid);
 extern bool drm_detect_monitor_audio(struct edid *edid);
 extern bool drm_rgb_quant_range_selectable(struct edid *edid);
Signature · 1 line
1.9.1
#10 lore raw
Quoted 76 lines · Vandana Kannan
Quoted 75 lines · Ville Syrjälä
Quoted 55 lines · Vandana Kannan

Populate PAR in infoframe structure. If there is a user setting for PAR, then that value is set. Else, value is taken from CEA mode list if VIC is found. Else, PAR is calculated from resolution. If none of these conditions are satisfied, PAR is NONE as per initialization.

v2: Removed the part which sets PAR according to user input, based on Daniel's review comments.

A separate patch will be submitted to create a property that would enable a user space app to set aspect ratio for AVI infoframe.

---
 drivers/gpu/drm/drm_edid.c | 29 +++++++++++++++++++++++++++++
 include/drm/drm_crtc.h     |  1 +
 2 files changed, 30 insertions(+)
drivers/gpu/drm/drm_edid.c +18 -0
index d4e3f9d..fee24d3 100644
@@ -2452,6 +2452,21 @@ u8 drm_match_cea_mode(const struct drm_display_mode *to_match)
 }
 EXPORT_SYMBOL(drm_match_cea_mode);
 
+/**
+ * drm_get_cea_aspect_ratio - get the picture aspect ratio corresponding to
+ * the input VIC from the CEA mode list
+ *
+ * Returns picture aspect ratio
+ */
+enum hdmi_picture_aspect drm_get_cea_aspect_ratio(const u8 video_code)
+{
+	/* return picture aspect ratio for video_code - 1 to access the
+	 * right array element
+	*/
+	return edid_cea_modes[video_code-1].picture_aspect_ratio;
+}
+EXPORT_SYMBOL(drm_get_cea_aspect_ratio);
+
 /*
  * Calculate the alternate clock for HDMI modes (those from the HDMI vendor
  * specific block).
@@ -3613,6 +3628,20 @@ drm_hdmi_avi_infoframe_from_display_mode(struct hdmi_avi_infoframe *frame,
 	frame->video_code = drm_match_cea_mode(mode);
 
 	frame->picture_aspect = HDMI_PICTURE_ASPECT_NONE;
+
+	/* Populate picture aspect ratio from CEA mode list */
+	if (frame->video_code > 0)

drivers/gpu/drm/drm_edid.c drm_hdmi_avi_infoframe_from_display_mode(struct hdmi_avi_infoframe *frame, · line 3643

Quoted 10 lines
drivers/gpu/drm/drm_edid.c +10 -0
+		frame->picture_aspect = drm_get_cea_aspect_ratio(
+						frame->video_code);
+	else {
+		if (!(mode->vdisplay % 3) &&
+			(((mode->vdisplay * 4) / 3) == mode->hdisplay))
+			frame->picture_aspect = HDMI_PICTURE_ASPECT_4_3;
+		else if (!(mode->vdisplay % 9) &&
+			(((mode->vdisplay * 16) / 9) == mode->hdisplay))
+			frame->picture_aspect = HDMI_PICTURE_ASPECT_16_9;
+	}

I'm not sure if providing the PAR for non-CEA modes like this makes any real difference. But I guess it can't hurt since you only provide it for exact matches.

But the matches are maybe even a bit too exact. For instance 1366x768 will not match the 16:9 case. So maybe it should be calculated in a bit more relaxed way.

Quoted 5 lines
Quoted 2 lines

Or just dropped totally. I'm not sure.

Maybe we can drop it for now (for this patch) and come up with another patch containing calculations which are more relaxed than the above. What do you think?

That's fine by me.

Quoted 19 lines
Quoted 19 lines
Quoted 18 lines
drivers/gpu/drm/drm_edid.c +1 -0
+
 	frame->active_aspect = HDMI_ACTIVE_ASPECT_PICTURE;
 	frame->scan_mode = HDMI_SCAN_MODE_UNDERSCAN;
 
include/drm/drm_crtc.h +1 -0
index 27f828c..50dc55a 100644
@@ -983,6 +983,7 @@ extern int drm_mode_gamma_get_ioctl(struct drm_device *dev,
 extern int drm_mode_gamma_set_ioctl(struct drm_device *dev,
 				    void *data, struct drm_file *file_priv);
 extern u8 drm_match_cea_mode(const struct drm_display_mode *to_match);
+extern enum hdmi_picture_aspect drm_get_cea_aspect_ratio(const u8 video_code);
 extern bool drm_detect_hdmi_monitor(struct edid *edid);
 extern bool drm_detect_monitor_audio(struct edid *edid);
 extern bool drm_rgb_quant_range_selectable(struct edid *edid);
Signature · 1 line
1.9.1
Signature · 2 lines
Ville Syrjälä
Intel OTC
#11 lore raw

PATCH v3 1/1 drm/edid: Fill PAR in AVI infoframe based on CEA mode list

Populate PAR in infoframe structure. If there is a user setting for PAR, then that value is set. Else, value is taken from CEA mode list if VIC is found. Else, PAR is calculated from resolution. If none of these conditions are satisfied, PAR is NONE as per initialization.

v2: Removed the part which sets PAR according to user input, based on Daniel's review comments.

v3: Removed calculation of PAR for non-CEA modes as per discussion with Ville.

A separate patch will be submitted to create a property that would enable a user space app to set aspect ratio for AVI infoframe.

---
 drivers/gpu/drm/drm_edid.c | 21 +++++++++++++++++++++
 include/drm/drm_crtc.h     |  1 +
 2 files changed, 22 insertions(+)
drivers/gpu/drm/drm_edid.c +21 -0
index d4e3f9d..09ece10 100644
@@ -2452,6 +2452,21 @@ u8 drm_match_cea_mode(const struct drm_display_mode *to_match)
 }
 EXPORT_SYMBOL(drm_match_cea_mode);
 
+/**
+ * drm_get_cea_aspect_ratio - get the picture aspect ratio corresponding to
+ * the input VIC from the CEA mode list
+ *
+ * Returns picture aspect ratio
+ */
+enum hdmi_picture_aspect drm_get_cea_aspect_ratio(const u8 video_code)
+{
+	/* return picture aspect ratio for video_code - 1 to access the
+	 * right array element
+	*/
+	return edid_cea_modes[video_code-1].picture_aspect_ratio;
+}
+EXPORT_SYMBOL(drm_get_cea_aspect_ratio);
+
 /*
  * Calculate the alternate clock for HDMI modes (those from the HDMI vendor
  * specific block).
@@ -3613,6 +3628,12 @@ drm_hdmi_avi_infoframe_from_display_mode(struct hdmi_avi_infoframe *frame,
 	frame->video_code = drm_match_cea_mode(mode);
 
 	frame->picture_aspect = HDMI_PICTURE_ASPECT_NONE;
+
+	/* Populate picture aspect ratio from CEA mode list */
+	if (frame->video_code > 0)
+		frame->picture_aspect = drm_get_cea_aspect_ratio(
+						frame->video_code);
+
 	frame->active_aspect = HDMI_ACTIVE_ASPECT_PICTURE;
 	frame->scan_mode = HDMI_SCAN_MODE_UNDERSCAN;
 
include/drm/drm_crtc.h +1 -0
index 27f828c..50dc55a 100644
@@ -983,6 +983,7 @@ extern int drm_mode_gamma_get_ioctl(struct drm_device *dev,
 extern int drm_mode_gamma_set_ioctl(struct drm_device *dev,
 				    void *data, struct drm_file *file_priv);
 extern u8 drm_match_cea_mode(const struct drm_display_mode *to_match);
+extern enum hdmi_picture_aspect drm_get_cea_aspect_ratio(const u8 video_code);
 extern bool drm_detect_hdmi_monitor(struct edid *edid);
 extern bool drm_detect_monitor_audio(struct edid *edid);
 extern bool drm_rgb_quant_range_selectable(struct edid *edid);
Signature · 6 lines
1.9.1

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#12 lore raw

PATCH v4 1/1 drm/edid: Fill PAR in AVI infoframe based on CEA mode list

Populate PAR in infoframe structure. PAR is taken from CEA mode list if VIC is found. Else, PAR is NONE as per initialization.

v2: Removed the part which sets PAR according to user input, based on Daniel's review comments.

v3: Removed calculation of PAR for non-CEA modes as per discussion with Ville.

v4: Added description for the param video_code. Absence of the description led to a warning while executing "make htmldocs", as reported by Wu, Fengguang.
Modified commit message.

A separate patch will be submitted to create a property that would enable a user space app to set aspect ratio for AVI infoframe.

Cc Jesse Barnes <[email protected]>
Cc Vijay Purushothaman <[email protected]>
Cc Ville Syrjälä <[email protected]>
Cc Wu, Fengguang <[email protected]>
---
 drivers/gpu/drm/drm_edid.c | 22 ++++++++++++++++++++++
 include/drm/drm_crtc.h     |  1 +
 2 files changed, 23 insertions(+)
drivers/gpu/drm/drm_edid.c +22 -0
index d4e3f9d..b8d6c51 100644
@@ -2452,6 +2452,22 @@ u8 drm_match_cea_mode(const struct drm_display_mode *to_match)
 }
 EXPORT_SYMBOL(drm_match_cea_mode);
 
+/**
+ * drm_get_cea_aspect_ratio - get the picture aspect ratio corresponding to
+ * the input VIC from the CEA mode list
+ * @video_code: ID given to each of the CEA modes
+ *
+ * Returns picture aspect ratio
+ */
+enum hdmi_picture_aspect drm_get_cea_aspect_ratio(const u8 video_code)
+{
+	/* return picture aspect ratio for video_code - 1 to access the
+	 * right array element
+	*/
+	return edid_cea_modes[video_code-1].picture_aspect_ratio;
+}
+EXPORT_SYMBOL(drm_get_cea_aspect_ratio);
+
 /*
  * Calculate the alternate clock for HDMI modes (those from the HDMI vendor
  * specific block).
@@ -3613,6 +3629,12 @@ drm_hdmi_avi_infoframe_from_display_mode(struct hdmi_avi_infoframe *frame,
 	frame->video_code = drm_match_cea_mode(mode);
 
 	frame->picture_aspect = HDMI_PICTURE_ASPECT_NONE;
+
+	/* Populate picture aspect ratio from CEA mode list */
+	if (frame->video_code > 0)
+		frame->picture_aspect = drm_get_cea_aspect_ratio(
+						frame->video_code);
+
 	frame->active_aspect = HDMI_ACTIVE_ASPECT_PICTURE;
 	frame->scan_mode = HDMI_SCAN_MODE_UNDERSCAN;
 
include/drm/drm_crtc.h +1 -0
index 27f828c..50dc55a 100644
@@ -983,6 +983,7 @@ extern int drm_mode_gamma_get_ioctl(struct drm_device *dev,
 extern int drm_mode_gamma_set_ioctl(struct drm_device *dev,
 				    void *data, struct drm_file *file_priv);
 extern u8 drm_match_cea_mode(const struct drm_display_mode *to_match);
+extern enum hdmi_picture_aspect drm_get_cea_aspect_ratio(const u8 video_code);
 extern bool drm_detect_hdmi_monitor(struct edid *edid);
 extern bool drm_detect_monitor_audio(struct edid *edid);
 extern bool drm_rgb_quant_range_selectable(struct edid *edid);
Signature · 6 lines
1.9.1

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
#13 lore raw
Quoted 17 lines · Vandana Kannan

Populate PAR in infoframe structure. PAR is taken from CEA mode list if VIC is found. Else, PAR is NONE as per initialization.

v2: Removed the part which sets PAR according to user input, based on Daniel's review comments.

v3: Removed calculation of PAR for non-CEA modes as per discussion with Ville.

v4: Added description for the param video_code. Absence of the description led to a warning while executing "make htmldocs", as reported by Wu, Fengguang.
Modified commit message.

A separate patch will be submitted to create a property that would enable a user space app to set aspect ratio for AVI infoframe.

Quoted 7 lines
Cc Jesse Barnes <[email protected]>
Cc Vijay Purushothaman <[email protected]>
Cc Ville Syrjälä <[email protected]>
Cc Wu, Fengguang <[email protected]>

Applied. btw if I've merged a patch already I prefer a small fixup patch on top of what I have to squash into the main patch.
-Daniel

Quoted 64 lines
---
 drivers/gpu/drm/drm_edid.c | 22 ++++++++++++++++++++++
 include/drm/drm_crtc.h     |  1 +
 2 files changed, 23 insertions(+)
drivers/gpu/drm/drm_edid.c +22 -0
index d4e3f9d..b8d6c51 100644
@@ -2452,6 +2452,22 @@ u8 drm_match_cea_mode(const struct drm_display_mode *to_match)
 }
 EXPORT_SYMBOL(drm_match_cea_mode);
 
+/**
+ * drm_get_cea_aspect_ratio - get the picture aspect ratio corresponding to
+ * the input VIC from the CEA mode list
+ * @video_code: ID given to each of the CEA modes
+ *
+ * Returns picture aspect ratio
+ */
+enum hdmi_picture_aspect drm_get_cea_aspect_ratio(const u8 video_code)
+{
+	/* return picture aspect ratio for video_code - 1 to access the
+	 * right array element
+	*/
+	return edid_cea_modes[video_code-1].picture_aspect_ratio;
+}
+EXPORT_SYMBOL(drm_get_cea_aspect_ratio);
+
 /*
  * Calculate the alternate clock for HDMI modes (those from the HDMI vendor
  * specific block).
@@ -3613,6 +3629,12 @@ drm_hdmi_avi_infoframe_from_display_mode(struct hdmi_avi_infoframe *frame,
 	frame->video_code = drm_match_cea_mode(mode);
 
 	frame->picture_aspect = HDMI_PICTURE_ASPECT_NONE;
+
+	/* Populate picture aspect ratio from CEA mode list */
+	if (frame->video_code > 0)
+		frame->picture_aspect = drm_get_cea_aspect_ratio(
+						frame->video_code);
+
 	frame->active_aspect = HDMI_ACTIVE_ASPECT_PICTURE;
 	frame->scan_mode = HDMI_SCAN_MODE_UNDERSCAN;
 
include/drm/drm_crtc.h +1 -0
index 27f828c..50dc55a 100644
@@ -983,6 +983,7 @@ extern int drm_mode_gamma_get_ioctl(struct drm_device *dev,
 extern int drm_mode_gamma_set_ioctl(struct drm_device *dev,
 				    void *data, struct drm_file *file_priv);
 extern u8 drm_match_cea_mode(const struct drm_display_mode *to_match);
+extern enum hdmi_picture_aspect drm_get_cea_aspect_ratio(const u8 video_code);
 extern bool drm_detect_hdmi_monitor(struct edid *edid);
 extern bool drm_detect_monitor_audio(struct edid *edid);
 extern bool drm_rgb_quant_range_selectable(struct edid *edid);
Signature · 6 lines
1.9.1

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
#14 lore raw
In reply to Vandana Kannan
Quoted 14 lines · Vandana Kannan

Populate PAR in infoframe structure. If there is a user setting for PAR, then that value is set. Else, value is taken from CEA mode list if VIC is found. Else, PAR is calculated from resolution. If none of these conditions are satisfied, PAR is NONE as per initialization.

v2: Removed the part which sets PAR according to user input, based on Daniel's review comments.

v3: Removed calculation of PAR for non-CEA modes as per discussion with Ville.

A separate patch will be submitted to create a property that would enable a user space app to set aspect ratio for AVI infoframe.

Quoted 6 lines

I've pulled this into my topic/core-stuff branch so it doesn't get lost. -Daniel

Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch