Commit 779c4c28 authored by Ville Syrjälä's avatar Ville Syrjälä

drm/edid: Set AVI infoframe Q even when QS=0

HDMI 2.0 recommends that we set the Q bits in the AVI infoframe
even when the sink does not support quantization range selection (QS=0).
According to CEA-861 we can do that as long as the Q we send matches
the default quantization range for the mode.

Previously I think I had misread the spec as saying that you can't
send a non-zero Q at all when QS=0. But that's not what the spec
actually says.

v2: Fix typo in commit message (Jani)
Signed-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170111125725.8086-5-ville.syrjala@linux.intel.comReviewed-by: default avatarJani Nikula <jani.nikula@intel.com>
Acked-by: default avatarEric Anholt <eric@anholt.net>
parent a2ce26f8
...@@ -4296,11 +4296,13 @@ EXPORT_SYMBOL(drm_hdmi_avi_infoframe_from_display_mode); ...@@ -4296,11 +4296,13 @@ EXPORT_SYMBOL(drm_hdmi_avi_infoframe_from_display_mode);
* drm_hdmi_avi_infoframe_quant_range() - fill the HDMI AVI infoframe * drm_hdmi_avi_infoframe_quant_range() - fill the HDMI AVI infoframe
* quantization range information * quantization range information
* @frame: HDMI AVI infoframe * @frame: HDMI AVI infoframe
* @mode: DRM display mode
* @rgb_quant_range: RGB quantization range (Q) * @rgb_quant_range: RGB quantization range (Q)
* @rgb_quant_range_selectable: Sink support selectable RGB quantization range (QS) * @rgb_quant_range_selectable: Sink support selectable RGB quantization range (QS)
*/ */
void void
drm_hdmi_avi_infoframe_quant_range(struct hdmi_avi_infoframe *frame, drm_hdmi_avi_infoframe_quant_range(struct hdmi_avi_infoframe *frame,
const struct drm_display_mode *mode,
enum hdmi_quantization_range rgb_quant_range, enum hdmi_quantization_range rgb_quant_range,
bool rgb_quant_range_selectable) bool rgb_quant_range_selectable)
{ {
...@@ -4310,8 +4312,12 @@ drm_hdmi_avi_infoframe_quant_range(struct hdmi_avi_infoframe *frame, ...@@ -4310,8 +4312,12 @@ drm_hdmi_avi_infoframe_quant_range(struct hdmi_avi_infoframe *frame,
* to the default RGB Quantization Range for the transmitted Picture * to the default RGB Quantization Range for the transmitted Picture
* unless the Sink indicates support for the Q bit in a Video * unless the Sink indicates support for the Q bit in a Video
* Capabilities Data Block." * Capabilities Data Block."
*
* HDMI 2.0 recommends sending non-zero Q when it does match the
* default RGB quantization range for the mode, even when QS=0.
*/ */
if (rgb_quant_range_selectable) if (rgb_quant_range_selectable ||
rgb_quant_range == drm_default_rgb_quant_range(mode))
frame->quantization_range = rgb_quant_range; frame->quantization_range = rgb_quant_range;
else else
frame->quantization_range = HDMI_QUANTIZATION_RANGE_DEFAULT; frame->quantization_range = HDMI_QUANTIZATION_RANGE_DEFAULT;
......
...@@ -455,17 +455,19 @@ static void intel_hdmi_set_avi_infoframe(struct drm_encoder *encoder, ...@@ -455,17 +455,19 @@ static void intel_hdmi_set_avi_infoframe(struct drm_encoder *encoder,
const struct intel_crtc_state *crtc_state) const struct intel_crtc_state *crtc_state)
{ {
struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(encoder); struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(encoder);
const struct drm_display_mode *adjusted_mode =
&crtc_state->base.adjusted_mode;
union hdmi_infoframe frame; union hdmi_infoframe frame;
int ret; int ret;
ret = drm_hdmi_avi_infoframe_from_display_mode(&frame.avi, ret = drm_hdmi_avi_infoframe_from_display_mode(&frame.avi,
&crtc_state->base.adjusted_mode); adjusted_mode);
if (ret < 0) { if (ret < 0) {
DRM_ERROR("couldn't fill AVI infoframe\n"); DRM_ERROR("couldn't fill AVI infoframe\n");
return; return;
} }
drm_hdmi_avi_infoframe_quant_range(&frame.avi, drm_hdmi_avi_infoframe_quant_range(&frame.avi, adjusted_mode,
crtc_state->limited_color_range ? crtc_state->limited_color_range ?
HDMI_QUANTIZATION_RANGE_LIMITED : HDMI_QUANTIZATION_RANGE_LIMITED :
HDMI_QUANTIZATION_RANGE_FULL, HDMI_QUANTIZATION_RANGE_FULL,
......
...@@ -356,7 +356,7 @@ static void vc4_hdmi_set_avi_infoframe(struct drm_encoder *encoder) ...@@ -356,7 +356,7 @@ static void vc4_hdmi_set_avi_infoframe(struct drm_encoder *encoder)
return; return;
} }
drm_hdmi_avi_infoframe_quant_range(&frame.avi, drm_hdmi_avi_infoframe_quant_range(&frame.avi, mode,
vc4_encoder->limited_rgb_range ? vc4_encoder->limited_rgb_range ?
HDMI_QUANTIZATION_RANGE_LIMITED : HDMI_QUANTIZATION_RANGE_LIMITED :
HDMI_QUANTIZATION_RANGE_FULL, HDMI_QUANTIZATION_RANGE_FULL,
......
...@@ -347,6 +347,7 @@ drm_hdmi_vendor_infoframe_from_display_mode(struct hdmi_vendor_infoframe *frame, ...@@ -347,6 +347,7 @@ drm_hdmi_vendor_infoframe_from_display_mode(struct hdmi_vendor_infoframe *frame,
const struct drm_display_mode *mode); const struct drm_display_mode *mode);
void void
drm_hdmi_avi_infoframe_quant_range(struct hdmi_avi_infoframe *frame, drm_hdmi_avi_infoframe_quant_range(struct hdmi_avi_infoframe *frame,
const struct drm_display_mode *mode,
enum hdmi_quantization_range rgb_quant_range, enum hdmi_quantization_range rgb_quant_range,
bool rgb_quant_range_selectable); bool rgb_quant_range_selectable);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment