Commit 949561eb authored by Ville Syrjälä's avatar Ville Syrjälä

drm/edid: Fix HDMI VIC handling

Extract drm_mode_hdmi_vic() to correctly calculate the final HDMI
VIC for us. Currently this is being done a bit differently between
the AVI and HDMI infoframes. Let's get both to agree on this.

We need to allow the case where a mode is both 3D and has a HDMI
VIC. Currently we'll just refuse to generate the HDMI infoframe when
we really should be setting HDMI VIC to 0 and instead enabling 3D
stereo signalling.

If the sink doesn't even support the HDMI infoframe we should
not be picking the HDMI VIC in favor of the CEA VIC, because then
we'll end up not sending either VIC in the end.

Cc: Wayne Lin <waynelin@amd.com>
Signed-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20191004141914.20600-3-ville.syrjala@linux.intel.comReviewed-by: default avatarUma Shankar <uma.shankar@intel.com>
parent cfd6f8c3
...@@ -5161,11 +5161,25 @@ drm_hdmi_infoframe_set_hdr_metadata(struct hdmi_drm_infoframe *frame, ...@@ -5161,11 +5161,25 @@ drm_hdmi_infoframe_set_hdr_metadata(struct hdmi_drm_infoframe *frame,
} }
EXPORT_SYMBOL(drm_hdmi_infoframe_set_hdr_metadata); EXPORT_SYMBOL(drm_hdmi_infoframe_set_hdr_metadata);
static u8 drm_mode_hdmi_vic(struct drm_connector *connector,
const struct drm_display_mode *mode)
{
bool has_hdmi_infoframe = connector ?
connector->display_info.has_hdmi_infoframe : false;
if (!has_hdmi_infoframe)
return 0;
/* No HDMI VIC when signalling 3D video format */
if (mode->flags & DRM_MODE_FLAG_3D_MASK)
return 0;
return drm_match_hdmi_mode(mode);
}
static u8 drm_mode_cea_vic(struct drm_connector *connector, static u8 drm_mode_cea_vic(struct drm_connector *connector,
const struct drm_display_mode *mode) const struct drm_display_mode *mode)
{ {
u8 vendor_if_vic = drm_match_hdmi_mode(mode);
bool is_s3d = mode->flags & DRM_MODE_FLAG_3D_MASK;
u8 vic; u8 vic;
/* /*
...@@ -5174,7 +5188,7 @@ static u8 drm_mode_cea_vic(struct drm_connector *connector, ...@@ -5174,7 +5188,7 @@ static u8 drm_mode_cea_vic(struct drm_connector *connector,
* VIC in AVI infoframes. Lets check if this mode is present in * VIC in AVI infoframes. Lets check if this mode is present in
* HDMI 1.4b 4K modes * HDMI 1.4b 4K modes
*/ */
if (drm_valid_hdmi_vic(vendor_if_vic) && !is_s3d) if (drm_mode_hdmi_vic(connector, mode))
return 0; return 0;
vic = drm_match_cea_mode(mode); vic = drm_match_cea_mode(mode);
...@@ -5434,8 +5448,6 @@ drm_hdmi_vendor_infoframe_from_display_mode(struct hdmi_vendor_infoframe *frame, ...@@ -5434,8 +5448,6 @@ drm_hdmi_vendor_infoframe_from_display_mode(struct hdmi_vendor_infoframe *frame,
bool has_hdmi_infoframe = connector ? bool has_hdmi_infoframe = connector ?
connector->display_info.has_hdmi_infoframe : false; connector->display_info.has_hdmi_infoframe : false;
int err; int err;
u32 s3d_flags;
u8 vic;
if (!frame || !mode) if (!frame || !mode)
return -EINVAL; return -EINVAL;
...@@ -5443,8 +5455,9 @@ drm_hdmi_vendor_infoframe_from_display_mode(struct hdmi_vendor_infoframe *frame, ...@@ -5443,8 +5455,9 @@ drm_hdmi_vendor_infoframe_from_display_mode(struct hdmi_vendor_infoframe *frame,
if (!has_hdmi_infoframe) if (!has_hdmi_infoframe)
return -EINVAL; return -EINVAL;
vic = drm_match_hdmi_mode(mode); err = hdmi_vendor_infoframe_init(frame);
s3d_flags = mode->flags & DRM_MODE_FLAG_3D_MASK; if (err < 0)
return err;
/* /*
* Even if it's not absolutely necessary to send the infoframe * Even if it's not absolutely necessary to send the infoframe
...@@ -5455,15 +5468,7 @@ drm_hdmi_vendor_infoframe_from_display_mode(struct hdmi_vendor_infoframe *frame, ...@@ -5455,15 +5468,7 @@ drm_hdmi_vendor_infoframe_from_display_mode(struct hdmi_vendor_infoframe *frame,
* mode if the source simply stops sending the infoframe when * mode if the source simply stops sending the infoframe when
* it wants to switch from 3D to 2D. * it wants to switch from 3D to 2D.
*/ */
frame->vic = drm_mode_hdmi_vic(connector, mode);
if (vic && s3d_flags)
return -EINVAL;
err = hdmi_vendor_infoframe_init(frame);
if (err < 0)
return err;
frame->vic = vic;
frame->s3d_struct = s3d_structure_from_display_mode(mode); frame->s3d_struct = s3d_structure_from_display_mode(mode);
return 0; return 0;
......
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