drm/edid: Pass connector to AVI infoframe functions
Make life easier for drivers by simply passing the connector to drm_hdmi_avi_infoframe_from_display_mode() and drm_hdmi_avi_infoframe_quant_range(). That way drivers don't need to worry about is_hdmi2_sink mess. v2: Make is_hdmi2_sink() return true for sil-sii8620 Adapt to omap/vc4 changes Cc: Alex Deucher <alexander.deucher@amd.com> Cc: "Christian König" <christian.koenig@amd.com> Cc: "David (ChunMing) Zhou" <David1.Zhou@amd.com> Cc: Archit Taneja <architt@codeaurora.org> Cc: Andrzej Hajda <a.hajda@samsung.com> Cc: Laurent Pinchart <Laurent.pinchart@ideasonboard.com> Cc: Inki Dae <inki.dae@samsung.com> Cc: Joonyoung Shim <jy0922.shim@samsung.com> Cc: Seung-Woo Kim <sw0312.kim@samsung.com> Cc: Kyungmin Park <kyungmin.park@samsung.com> Cc: Russell King <linux@armlinux.org.uk> Cc: CK Hu <ck.hu@mediatek.com> Cc: Philipp Zabel <p.zabel@pengutronix.de> Cc: Rob Clark <robdclark@gmail.com> Cc: Ben Skeggs <bskeggs@redhat.com> Cc: Tomi Valkeinen <tomi.valkeinen@ti.com> Cc: Sandy Huang <hjc@rock-chips.com> Cc: "Heiko Stübner" <heiko@sntech.de> Cc: Benjamin Gaignard <benjamin.gaignard@linaro.org> Cc: Vincent Abriou <vincent.abriou@st.com> Cc: Thierry Reding <thierry.reding@gmail.com> Cc: Eric Anholt <eric@anholt.net> Cc: Shawn Guo <shawnguo@kernel.org> Cc: Ilia Mirkin <imirkin@alum.mit.edu> Cc: amd-gfx@lists.freedesktop.org Cc: linux-arm-msm@vger.kernel.org Cc: freedreno@lists.freedesktop.org Cc: nouveau@lists.freedesktop.org Cc: linux-tegra@vger.kernel.org Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Acked-by: Thierry Reding <treding@nvidia.com> Acked-by: Russell King <rmk+kernel@armlinux.org.uk> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jani Nikula <jani.nikula@intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20190108172828.15184-1-ville.syrjala@linux.intel.com
This commit is contained in:
@@ -4830,19 +4830,32 @@ void drm_set_preferred_mode(struct drm_connector *connector,
|
||||
}
|
||||
EXPORT_SYMBOL(drm_set_preferred_mode);
|
||||
|
||||
static bool is_hdmi2_sink(struct drm_connector *connector)
|
||||
{
|
||||
/*
|
||||
* FIXME: sil-sii8620 doesn't have a connector around when
|
||||
* we need one, so we have to be prepared for a NULL connector.
|
||||
*/
|
||||
if (!connector)
|
||||
return true;
|
||||
|
||||
return connector->display_info.hdmi.scdc.supported ||
|
||||
connector->display_info.color_formats & DRM_COLOR_FORMAT_YCRCB420;
|
||||
}
|
||||
|
||||
/**
|
||||
* drm_hdmi_avi_infoframe_from_display_mode() - fill an HDMI AVI infoframe with
|
||||
* data from a DRM display mode
|
||||
* @frame: HDMI AVI infoframe
|
||||
* @connector: the connector
|
||||
* @mode: DRM display mode
|
||||
* @is_hdmi2_sink: Sink is HDMI 2.0 compliant
|
||||
*
|
||||
* Return: 0 on success or a negative error code on failure.
|
||||
*/
|
||||
int
|
||||
drm_hdmi_avi_infoframe_from_display_mode(struct hdmi_avi_infoframe *frame,
|
||||
const struct drm_display_mode *mode,
|
||||
bool is_hdmi2_sink)
|
||||
struct drm_connector *connector,
|
||||
const struct drm_display_mode *mode)
|
||||
{
|
||||
enum hdmi_picture_aspect picture_aspect;
|
||||
int err;
|
||||
@@ -4864,7 +4877,7 @@ drm_hdmi_avi_infoframe_from_display_mode(struct hdmi_avi_infoframe *frame,
|
||||
* HDMI 2.0 VIC range: 1 <= VIC <= 107 (CEA-861-F). So we
|
||||
* have to make sure we dont break HDMI 1.4 sinks.
|
||||
*/
|
||||
if (!is_hdmi2_sink && frame->video_code > 64)
|
||||
if (!is_hdmi2_sink(connector) && frame->video_code > 64)
|
||||
frame->video_code = 0;
|
||||
|
||||
/*
|
||||
@@ -4923,21 +4936,17 @@ EXPORT_SYMBOL(drm_hdmi_avi_infoframe_from_display_mode);
|
||||
* drm_hdmi_avi_infoframe_quant_range() - fill the HDMI AVI infoframe
|
||||
* quantization range information
|
||||
* @frame: HDMI AVI infoframe
|
||||
* @connector: the connector
|
||||
* @mode: DRM display mode
|
||||
* @rgb_quant_range: RGB quantization range (Q)
|
||||
* @rgb_quant_range_selectable: Sink support selectable RGB quantization range (QS)
|
||||
* @is_hdmi2_sink: HDMI 2.0 sink, which has different default recommendations
|
||||
*
|
||||
* Note that @is_hdmi2_sink can be derived by looking at the
|
||||
* &drm_scdc.supported flag stored in &drm_hdmi_info.scdc,
|
||||
* &drm_display_info.hdmi, which can be found in &drm_connector.display_info.
|
||||
*/
|
||||
void
|
||||
drm_hdmi_avi_infoframe_quant_range(struct hdmi_avi_infoframe *frame,
|
||||
struct drm_connector *connector,
|
||||
const struct drm_display_mode *mode,
|
||||
enum hdmi_quantization_range rgb_quant_range,
|
||||
bool rgb_quant_range_selectable,
|
||||
bool is_hdmi2_sink)
|
||||
bool rgb_quant_range_selectable)
|
||||
{
|
||||
/*
|
||||
* CEA-861:
|
||||
@@ -4968,7 +4977,7 @@ drm_hdmi_avi_infoframe_quant_range(struct hdmi_avi_infoframe *frame,
|
||||
* we limit non-zero YQ to HDMI 2.0 sinks only as HDMI 2.0 is based
|
||||
* on on CEA-861-F.
|
||||
*/
|
||||
if (!is_hdmi2_sink ||
|
||||
if (!is_hdmi2_sink(connector) ||
|
||||
rgb_quant_range == HDMI_QUANTIZATION_RANGE_LIMITED)
|
||||
frame->ycc_quantization_range =
|
||||
HDMI_YCC_QUANTIZATION_RANGE_LIMITED;
|
||||
|
Reference in New Issue
Block a user