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:
@@ -1682,7 +1682,7 @@ static void dce_v10_0_afmt_setmode(struct drm_encoder *encoder,
|
|||||||
dce_v10_0_audio_write_sad_regs(encoder);
|
dce_v10_0_audio_write_sad_regs(encoder);
|
||||||
dce_v10_0_audio_write_latency_fields(encoder, mode);
|
dce_v10_0_audio_write_latency_fields(encoder, mode);
|
||||||
|
|
||||||
err = drm_hdmi_avi_infoframe_from_display_mode(&frame, mode, false);
|
err = drm_hdmi_avi_infoframe_from_display_mode(&frame, connector, mode);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
DRM_ERROR("failed to setup AVI infoframe: %zd\n", err);
|
DRM_ERROR("failed to setup AVI infoframe: %zd\n", err);
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -1724,7 +1724,7 @@ static void dce_v11_0_afmt_setmode(struct drm_encoder *encoder,
|
|||||||
dce_v11_0_audio_write_sad_regs(encoder);
|
dce_v11_0_audio_write_sad_regs(encoder);
|
||||||
dce_v11_0_audio_write_latency_fields(encoder, mode);
|
dce_v11_0_audio_write_latency_fields(encoder, mode);
|
||||||
|
|
||||||
err = drm_hdmi_avi_infoframe_from_display_mode(&frame, mode, false);
|
err = drm_hdmi_avi_infoframe_from_display_mode(&frame, connector, mode);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
DRM_ERROR("failed to setup AVI infoframe: %zd\n", err);
|
DRM_ERROR("failed to setup AVI infoframe: %zd\n", err);
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -1423,6 +1423,7 @@ static void dce_v6_0_audio_set_avi_infoframe(struct drm_encoder *encoder,
|
|||||||
struct amdgpu_device *adev = dev->dev_private;
|
struct amdgpu_device *adev = dev->dev_private;
|
||||||
struct amdgpu_encoder *amdgpu_encoder = to_amdgpu_encoder(encoder);
|
struct amdgpu_encoder *amdgpu_encoder = to_amdgpu_encoder(encoder);
|
||||||
struct amdgpu_encoder_atom_dig *dig = amdgpu_encoder->enc_priv;
|
struct amdgpu_encoder_atom_dig *dig = amdgpu_encoder->enc_priv;
|
||||||
|
struct drm_connector *connector = amdgpu_get_connector_for_encoder(encoder);
|
||||||
struct hdmi_avi_infoframe frame;
|
struct hdmi_avi_infoframe frame;
|
||||||
u8 buffer[HDMI_INFOFRAME_HEADER_SIZE + HDMI_AVI_INFOFRAME_SIZE];
|
u8 buffer[HDMI_INFOFRAME_HEADER_SIZE + HDMI_AVI_INFOFRAME_SIZE];
|
||||||
uint8_t *payload = buffer + 3;
|
uint8_t *payload = buffer + 3;
|
||||||
@@ -1430,7 +1431,7 @@ static void dce_v6_0_audio_set_avi_infoframe(struct drm_encoder *encoder,
|
|||||||
ssize_t err;
|
ssize_t err;
|
||||||
u32 tmp;
|
u32 tmp;
|
||||||
|
|
||||||
err = drm_hdmi_avi_infoframe_from_display_mode(&frame, mode, false);
|
err = drm_hdmi_avi_infoframe_from_display_mode(&frame, connector, mode);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
DRM_ERROR("failed to setup AVI infoframe: %zd\n", err);
|
DRM_ERROR("failed to setup AVI infoframe: %zd\n", err);
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -1616,7 +1616,7 @@ static void dce_v8_0_afmt_setmode(struct drm_encoder *encoder,
|
|||||||
dce_v8_0_audio_write_sad_regs(encoder);
|
dce_v8_0_audio_write_sad_regs(encoder);
|
||||||
dce_v8_0_audio_write_latency_fields(encoder, mode);
|
dce_v8_0_audio_write_latency_fields(encoder, mode);
|
||||||
|
|
||||||
err = drm_hdmi_avi_infoframe_from_display_mode(&frame, mode, false);
|
err = drm_hdmi_avi_infoframe_from_display_mode(&frame, connector, mode);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
DRM_ERROR("failed to setup AVI infoframe: %zd\n", err);
|
DRM_ERROR("failed to setup AVI infoframe: %zd\n", err);
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -1094,8 +1094,9 @@ static void anx78xx_bridge_mode_set(struct drm_bridge *bridge,
|
|||||||
|
|
||||||
mutex_lock(&anx78xx->lock);
|
mutex_lock(&anx78xx->lock);
|
||||||
|
|
||||||
err = drm_hdmi_avi_infoframe_from_display_mode(&frame, adjusted_mode,
|
err = drm_hdmi_avi_infoframe_from_display_mode(&frame,
|
||||||
false);
|
&anx78xx->connector,
|
||||||
|
adjusted_mode);
|
||||||
if (err) {
|
if (err) {
|
||||||
DRM_ERROR("Failed to setup AVI infoframe: %d\n", err);
|
DRM_ERROR("Failed to setup AVI infoframe: %d\n", err);
|
||||||
goto unlock;
|
goto unlock;
|
||||||
|
|||||||
@@ -258,7 +258,8 @@ static void sii902x_bridge_mode_set(struct drm_bridge *bridge,
|
|||||||
if (ret)
|
if (ret)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ret = drm_hdmi_avi_infoframe_from_display_mode(&frame, adj, false);
|
ret = drm_hdmi_avi_infoframe_from_display_mode(&frame,
|
||||||
|
&sii902x->connector, adj);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
DRM_ERROR("couldn't fill AVI infoframe\n");
|
DRM_ERROR("couldn't fill AVI infoframe\n");
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -1104,8 +1104,7 @@ static void sii8620_set_infoframes(struct sii8620 *ctx,
|
|||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ret = drm_hdmi_avi_infoframe_from_display_mode(&frm.avi,
|
ret = drm_hdmi_avi_infoframe_from_display_mode(&frm.avi,
|
||||||
mode,
|
NULL, mode);
|
||||||
true);
|
|
||||||
if (ctx->use_packed_pixel)
|
if (ctx->use_packed_pixel)
|
||||||
frm.avi.colorspace = HDMI_COLORSPACE_YUV422;
|
frm.avi.colorspace = HDMI_COLORSPACE_YUV422;
|
||||||
|
|
||||||
|
|||||||
@@ -1344,7 +1344,8 @@ static void hdmi_config_AVI(struct dw_hdmi *hdmi, struct drm_display_mode *mode)
|
|||||||
u8 val;
|
u8 val;
|
||||||
|
|
||||||
/* Initialise info frame from DRM mode */
|
/* Initialise info frame from DRM mode */
|
||||||
drm_hdmi_avi_infoframe_from_display_mode(&frame, mode, false);
|
drm_hdmi_avi_infoframe_from_display_mode(&frame,
|
||||||
|
&hdmi->connector, mode);
|
||||||
|
|
||||||
if (hdmi_bus_fmt_is_yuv444(hdmi->hdmi_data.enc_out_bus_format))
|
if (hdmi_bus_fmt_is_yuv444(hdmi->hdmi_data.enc_out_bus_format))
|
||||||
frame.colorspace = HDMI_COLORSPACE_YUV444;
|
frame.colorspace = HDMI_COLORSPACE_YUV444;
|
||||||
|
|||||||
@@ -4830,19 +4830,32 @@ void drm_set_preferred_mode(struct drm_connector *connector,
|
|||||||
}
|
}
|
||||||
EXPORT_SYMBOL(drm_set_preferred_mode);
|
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
|
* drm_hdmi_avi_infoframe_from_display_mode() - fill an HDMI AVI infoframe with
|
||||||
* data from a DRM display mode
|
* data from a DRM display mode
|
||||||
* @frame: HDMI AVI infoframe
|
* @frame: HDMI AVI infoframe
|
||||||
|
* @connector: the connector
|
||||||
* @mode: DRM display mode
|
* @mode: DRM display mode
|
||||||
* @is_hdmi2_sink: Sink is HDMI 2.0 compliant
|
|
||||||
*
|
*
|
||||||
* Return: 0 on success or a negative error code on failure.
|
* Return: 0 on success or a negative error code on failure.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
drm_hdmi_avi_infoframe_from_display_mode(struct hdmi_avi_infoframe *frame,
|
drm_hdmi_avi_infoframe_from_display_mode(struct hdmi_avi_infoframe *frame,
|
||||||
const struct drm_display_mode *mode,
|
struct drm_connector *connector,
|
||||||
bool is_hdmi2_sink)
|
const struct drm_display_mode *mode)
|
||||||
{
|
{
|
||||||
enum hdmi_picture_aspect picture_aspect;
|
enum hdmi_picture_aspect picture_aspect;
|
||||||
int err;
|
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
|
* HDMI 2.0 VIC range: 1 <= VIC <= 107 (CEA-861-F). So we
|
||||||
* have to make sure we dont break HDMI 1.4 sinks.
|
* 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;
|
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
|
* 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
|
||||||
|
* @connector: the connector
|
||||||
* @mode: DRM display mode
|
* @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)
|
||||||
* @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
|
void
|
||||||
drm_hdmi_avi_infoframe_quant_range(struct hdmi_avi_infoframe *frame,
|
drm_hdmi_avi_infoframe_quant_range(struct hdmi_avi_infoframe *frame,
|
||||||
|
struct drm_connector *connector,
|
||||||
const struct drm_display_mode *mode,
|
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)
|
||||||
bool is_hdmi2_sink)
|
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* CEA-861:
|
* 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
|
* we limit non-zero YQ to HDMI 2.0 sinks only as HDMI 2.0 is based
|
||||||
* on on CEA-861-F.
|
* on on CEA-861-F.
|
||||||
*/
|
*/
|
||||||
if (!is_hdmi2_sink ||
|
if (!is_hdmi2_sink(connector) ||
|
||||||
rgb_quant_range == HDMI_QUANTIZATION_RANGE_LIMITED)
|
rgb_quant_range == HDMI_QUANTIZATION_RANGE_LIMITED)
|
||||||
frame->ycc_quantization_range =
|
frame->ycc_quantization_range =
|
||||||
HDMI_YCC_QUANTIZATION_RANGE_LIMITED;
|
HDMI_YCC_QUANTIZATION_RANGE_LIMITED;
|
||||||
|
|||||||
@@ -819,7 +819,8 @@ static void hdmi_reg_infoframes(struct hdmi_context *hdata)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = drm_hdmi_avi_infoframe_from_display_mode(&frm.avi, m, false);
|
ret = drm_hdmi_avi_infoframe_from_display_mode(&frm.avi,
|
||||||
|
&hdata->connector, m);
|
||||||
if (!ret)
|
if (!ret)
|
||||||
ret = hdmi_avi_infoframe_pack(&frm.avi, buf, sizeof(buf));
|
ret = hdmi_avi_infoframe_pack(&frm.avi, buf, sizeof(buf));
|
||||||
if (ret > 0) {
|
if (ret > 0) {
|
||||||
|
|||||||
@@ -849,7 +849,8 @@ tda998x_write_avi(struct tda998x_priv *priv, struct drm_display_mode *mode)
|
|||||||
{
|
{
|
||||||
union hdmi_infoframe frame;
|
union hdmi_infoframe frame;
|
||||||
|
|
||||||
drm_hdmi_avi_infoframe_from_display_mode(&frame.avi, mode, false);
|
drm_hdmi_avi_infoframe_from_display_mode(&frame.avi,
|
||||||
|
&priv->connector, mode);
|
||||||
frame.avi.quantization_range = HDMI_QUANTIZATION_RANGE_FULL;
|
frame.avi.quantization_range = HDMI_QUANTIZATION_RANGE_FULL;
|
||||||
|
|
||||||
tda998x_write_if(priv, DIP_IF_FLAGS_IF2, REG_IF2_HB0, &frame);
|
tda998x_write_if(priv, DIP_IF_FLAGS_IF2, REG_IF2_HB0, &frame);
|
||||||
|
|||||||
@@ -465,15 +465,12 @@ static void intel_hdmi_set_avi_infoframe(struct intel_encoder *encoder,
|
|||||||
struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(&encoder->base);
|
struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(&encoder->base);
|
||||||
const struct drm_display_mode *adjusted_mode =
|
const struct drm_display_mode *adjusted_mode =
|
||||||
&crtc_state->base.adjusted_mode;
|
&crtc_state->base.adjusted_mode;
|
||||||
struct drm_connector *connector = &intel_hdmi->attached_connector->base;
|
|
||||||
bool is_hdmi2_sink = connector->display_info.hdmi.scdc.supported ||
|
|
||||||
connector->display_info.color_formats & DRM_COLOR_FORMAT_YCRCB420;
|
|
||||||
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,
|
||||||
adjusted_mode,
|
conn_state->connector,
|
||||||
is_hdmi2_sink);
|
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;
|
||||||
@@ -486,12 +483,13 @@ static void intel_hdmi_set_avi_infoframe(struct intel_encoder *encoder,
|
|||||||
else
|
else
|
||||||
frame.avi.colorspace = HDMI_COLORSPACE_RGB;
|
frame.avi.colorspace = HDMI_COLORSPACE_RGB;
|
||||||
|
|
||||||
drm_hdmi_avi_infoframe_quant_range(&frame.avi, adjusted_mode,
|
drm_hdmi_avi_infoframe_quant_range(&frame.avi,
|
||||||
|
conn_state->connector,
|
||||||
|
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,
|
||||||
intel_hdmi->rgb_quant_range_selectable,
|
intel_hdmi->rgb_quant_range_selectable);
|
||||||
is_hdmi2_sink);
|
|
||||||
|
|
||||||
drm_hdmi_avi_infoframe_content_type(&frame.avi,
|
drm_hdmi_avi_infoframe_content_type(&frame.avi,
|
||||||
conn_state);
|
conn_state);
|
||||||
|
|||||||
@@ -462,10 +462,8 @@ void lspcon_set_infoframes(struct intel_encoder *encoder,
|
|||||||
uint8_t buf[VIDEO_DIP_DATA_SIZE];
|
uint8_t buf[VIDEO_DIP_DATA_SIZE];
|
||||||
struct intel_digital_port *dig_port = enc_to_dig_port(&encoder->base);
|
struct intel_digital_port *dig_port = enc_to_dig_port(&encoder->base);
|
||||||
struct intel_lspcon *lspcon = &dig_port->lspcon;
|
struct intel_lspcon *lspcon = &dig_port->lspcon;
|
||||||
struct intel_dp *intel_dp = &dig_port->dp;
|
const struct drm_display_mode *adjusted_mode =
|
||||||
struct drm_connector *connector = &intel_dp->attached_connector->base;
|
&crtc_state->base.adjusted_mode;
|
||||||
const struct drm_display_mode *mode = &crtc_state->base.adjusted_mode;
|
|
||||||
bool is_hdmi2_sink = connector->display_info.hdmi.scdc.supported;
|
|
||||||
|
|
||||||
if (!lspcon->active) {
|
if (!lspcon->active) {
|
||||||
DRM_ERROR("Writing infoframes while LSPCON disabled ?\n");
|
DRM_ERROR("Writing infoframes while LSPCON disabled ?\n");
|
||||||
@@ -473,7 +471,8 @@ void lspcon_set_infoframes(struct intel_encoder *encoder,
|
|||||||
}
|
}
|
||||||
|
|
||||||
ret = drm_hdmi_avi_infoframe_from_display_mode(&frame.avi,
|
ret = drm_hdmi_avi_infoframe_from_display_mode(&frame.avi,
|
||||||
mode, is_hdmi2_sink);
|
conn_state->connector,
|
||||||
|
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;
|
||||||
@@ -488,11 +487,13 @@ void lspcon_set_infoframes(struct intel_encoder *encoder,
|
|||||||
frame.avi.colorspace = HDMI_COLORSPACE_RGB;
|
frame.avi.colorspace = HDMI_COLORSPACE_RGB;
|
||||||
}
|
}
|
||||||
|
|
||||||
drm_hdmi_avi_infoframe_quant_range(&frame.avi, mode,
|
drm_hdmi_avi_infoframe_quant_range(&frame.avi,
|
||||||
|
conn_state->connector,
|
||||||
|
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,
|
||||||
false, is_hdmi2_sink);
|
false);
|
||||||
|
|
||||||
ret = hdmi_infoframe_pack(&frame, buf, sizeof(buf));
|
ret = hdmi_infoframe_pack(&frame, buf, sizeof(buf));
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
|
|||||||
@@ -981,7 +981,8 @@ static bool intel_sdvo_write_infoframe(struct intel_sdvo *intel_sdvo,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static bool intel_sdvo_set_avi_infoframe(struct intel_sdvo *intel_sdvo,
|
static bool intel_sdvo_set_avi_infoframe(struct intel_sdvo *intel_sdvo,
|
||||||
const struct intel_crtc_state *pipe_config)
|
const struct intel_crtc_state *pipe_config,
|
||||||
|
const struct drm_connector_state *conn_state)
|
||||||
{
|
{
|
||||||
uint8_t sdvo_data[HDMI_INFOFRAME_SIZE(AVI)];
|
uint8_t sdvo_data[HDMI_INFOFRAME_SIZE(AVI)];
|
||||||
union hdmi_infoframe frame;
|
union hdmi_infoframe frame;
|
||||||
@@ -989,8 +990,8 @@ static bool intel_sdvo_set_avi_infoframe(struct intel_sdvo *intel_sdvo,
|
|||||||
ssize_t len;
|
ssize_t len;
|
||||||
|
|
||||||
ret = drm_hdmi_avi_infoframe_from_display_mode(&frame.avi,
|
ret = drm_hdmi_avi_infoframe_from_display_mode(&frame.avi,
|
||||||
&pipe_config->base.adjusted_mode,
|
conn_state->connector,
|
||||||
false);
|
&pipe_config->base.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 false;
|
return false;
|
||||||
@@ -1316,7 +1317,8 @@ static void intel_sdvo_pre_enable(struct intel_encoder *intel_encoder,
|
|||||||
intel_sdvo_set_encode(intel_sdvo, SDVO_ENCODE_HDMI);
|
intel_sdvo_set_encode(intel_sdvo, SDVO_ENCODE_HDMI);
|
||||||
intel_sdvo_set_colorimetry(intel_sdvo,
|
intel_sdvo_set_colorimetry(intel_sdvo,
|
||||||
SDVO_COLORIMETRY_RGB256);
|
SDVO_COLORIMETRY_RGB256);
|
||||||
intel_sdvo_set_avi_infoframe(intel_sdvo, crtc_state);
|
intel_sdvo_set_avi_infoframe(intel_sdvo,
|
||||||
|
crtc_state, conn_state);
|
||||||
} else
|
} else
|
||||||
intel_sdvo_set_encode(intel_sdvo, SDVO_ENCODE_DVI);
|
intel_sdvo_set_encode(intel_sdvo, SDVO_ENCODE_DVI);
|
||||||
|
|
||||||
|
|||||||
@@ -981,7 +981,8 @@ static int mtk_hdmi_setup_avi_infoframe(struct mtk_hdmi *hdmi,
|
|||||||
u8 buffer[17];
|
u8 buffer[17];
|
||||||
ssize_t err;
|
ssize_t err;
|
||||||
|
|
||||||
err = drm_hdmi_avi_infoframe_from_display_mode(&frame, mode, false);
|
err = drm_hdmi_avi_infoframe_from_display_mode(&frame,
|
||||||
|
&hdmi->conn, mode);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
dev_err(hdmi->dev,
|
dev_err(hdmi->dev,
|
||||||
"Failed to get AVI infoframe from mode: %zd\n", err);
|
"Failed to get AVI infoframe from mode: %zd\n", err);
|
||||||
|
|||||||
@@ -101,7 +101,8 @@ static void msm_hdmi_config_avi_infoframe(struct hdmi *hdmi)
|
|||||||
u32 val;
|
u32 val;
|
||||||
int len;
|
int len;
|
||||||
|
|
||||||
drm_hdmi_avi_infoframe_from_display_mode(&frame.avi, mode, false);
|
drm_hdmi_avi_infoframe_from_display_mode(&frame.avi,
|
||||||
|
hdmi->connector, mode);
|
||||||
|
|
||||||
len = hdmi_infoframe_pack(&frame, buffer, sizeof(buffer));
|
len = hdmi_infoframe_pack(&frame, buffer, sizeof(buffer));
|
||||||
if (len < 0) {
|
if (len < 0) {
|
||||||
|
|||||||
@@ -554,7 +554,7 @@ nv50_hdmi_enable(struct drm_encoder *encoder, struct drm_display_mode *mode)
|
|||||||
u32 max_ac_packet;
|
u32 max_ac_packet;
|
||||||
union hdmi_infoframe avi_frame;
|
union hdmi_infoframe avi_frame;
|
||||||
union hdmi_infoframe vendor_frame;
|
union hdmi_infoframe vendor_frame;
|
||||||
bool scdc_supported, high_tmds_clock_ratio = false, scrambling = false;
|
bool high_tmds_clock_ratio = false, scrambling = false;
|
||||||
u8 config;
|
u8 config;
|
||||||
int ret;
|
int ret;
|
||||||
int size;
|
int size;
|
||||||
@@ -564,10 +564,9 @@ nv50_hdmi_enable(struct drm_encoder *encoder, struct drm_display_mode *mode)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
hdmi = &nv_connector->base.display_info.hdmi;
|
hdmi = &nv_connector->base.display_info.hdmi;
|
||||||
scdc_supported = hdmi->scdc.supported;
|
|
||||||
|
|
||||||
ret = drm_hdmi_avi_infoframe_from_display_mode(&avi_frame.avi, mode,
|
ret = drm_hdmi_avi_infoframe_from_display_mode(&avi_frame.avi,
|
||||||
scdc_supported);
|
&nv_connector->base, mode);
|
||||||
if (!ret) {
|
if (!ret) {
|
||||||
/* We have an AVI InfoFrame, populate it to the display */
|
/* We have an AVI InfoFrame, populate it to the display */
|
||||||
args.pwr.avi_infoframe_length
|
args.pwr.avi_infoframe_length
|
||||||
|
|||||||
@@ -128,8 +128,8 @@ static void omap_encoder_mode_set(struct drm_encoder *encoder,
|
|||||||
if (hdmi_mode && dssdev->ops->hdmi.set_infoframe) {
|
if (hdmi_mode && dssdev->ops->hdmi.set_infoframe) {
|
||||||
struct hdmi_avi_infoframe avi;
|
struct hdmi_avi_infoframe avi;
|
||||||
|
|
||||||
r = drm_hdmi_avi_infoframe_from_display_mode(&avi, adjusted_mode,
|
r = drm_hdmi_avi_infoframe_from_display_mode(&avi, connector,
|
||||||
false);
|
adjusted_mode);
|
||||||
if (r == 0)
|
if (r == 0)
|
||||||
dssdev->ops->hdmi.set_infoframe(dssdev, &avi);
|
dssdev->ops->hdmi.set_infoframe(dssdev, &avi);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -516,7 +516,7 @@ static int radeon_audio_set_avi_packet(struct drm_encoder *encoder,
|
|||||||
if (!connector)
|
if (!connector)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
err = drm_hdmi_avi_infoframe_from_display_mode(&frame, mode, false);
|
err = drm_hdmi_avi_infoframe_from_display_mode(&frame, connector, mode);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
DRM_ERROR("failed to setup AVI infoframe: %d\n", err);
|
DRM_ERROR("failed to setup AVI infoframe: %d\n", err);
|
||||||
return err;
|
return err;
|
||||||
|
|||||||
@@ -295,7 +295,9 @@ static int inno_hdmi_config_video_avi(struct inno_hdmi *hdmi,
|
|||||||
union hdmi_infoframe frame;
|
union hdmi_infoframe frame;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
rc = drm_hdmi_avi_infoframe_from_display_mode(&frame.avi, mode, false);
|
rc = drm_hdmi_avi_infoframe_from_display_mode(&frame.avi,
|
||||||
|
&hdmi->connector,
|
||||||
|
mode);
|
||||||
|
|
||||||
if (hdmi->hdmi_data.enc_out_format == HDMI_COLORSPACE_YUV444)
|
if (hdmi->hdmi_data.enc_out_format == HDMI_COLORSPACE_YUV444)
|
||||||
frame.avi.colorspace = HDMI_COLORSPACE_YUV444;
|
frame.avi.colorspace = HDMI_COLORSPACE_YUV444;
|
||||||
|
|||||||
@@ -434,7 +434,8 @@ static int hdmi_avi_infoframe_config(struct sti_hdmi *hdmi)
|
|||||||
|
|
||||||
DRM_DEBUG_DRIVER("\n");
|
DRM_DEBUG_DRIVER("\n");
|
||||||
|
|
||||||
ret = drm_hdmi_avi_infoframe_from_display_mode(&infoframe, mode, false);
|
ret = drm_hdmi_avi_infoframe_from_display_mode(&infoframe,
|
||||||
|
hdmi->drm_connector, mode);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
DRM_ERROR("failed to setup AVI infoframe: %d\n", ret);
|
DRM_ERROR("failed to setup AVI infoframe: %d\n", ret);
|
||||||
return ret;
|
return ret;
|
||||||
|
|||||||
@@ -52,7 +52,8 @@ static int sun4i_hdmi_setup_avi_infoframes(struct sun4i_hdmi *hdmi,
|
|||||||
u8 buffer[17];
|
u8 buffer[17];
|
||||||
int i, ret;
|
int i, ret;
|
||||||
|
|
||||||
ret = drm_hdmi_avi_infoframe_from_display_mode(&frame, mode, false);
|
ret = drm_hdmi_avi_infoframe_from_display_mode(&frame,
|
||||||
|
&hdmi->connector, mode);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
DRM_ERROR("Failed to get infoframes from mode\n");
|
DRM_ERROR("Failed to get infoframes from mode\n");
|
||||||
return ret;
|
return ret;
|
||||||
|
|||||||
@@ -741,7 +741,8 @@ static void tegra_hdmi_setup_avi_infoframe(struct tegra_hdmi *hdmi,
|
|||||||
u8 buffer[17];
|
u8 buffer[17];
|
||||||
ssize_t err;
|
ssize_t err;
|
||||||
|
|
||||||
err = drm_hdmi_avi_infoframe_from_display_mode(&frame, mode, false);
|
err = drm_hdmi_avi_infoframe_from_display_mode(&frame,
|
||||||
|
&hdmi->output.connector, mode);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
dev_err(hdmi->dev, "failed to setup AVI infoframe: %zd\n", err);
|
dev_err(hdmi->dev, "failed to setup AVI infoframe: %zd\n", err);
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -2116,7 +2116,8 @@ tegra_sor_hdmi_setup_avi_infoframe(struct tegra_sor *sor,
|
|||||||
value &= ~INFOFRAME_CTRL_ENABLE;
|
value &= ~INFOFRAME_CTRL_ENABLE;
|
||||||
tegra_sor_writel(sor, value, SOR_HDMI_AVI_INFOFRAME_CTRL);
|
tegra_sor_writel(sor, value, SOR_HDMI_AVI_INFOFRAME_CTRL);
|
||||||
|
|
||||||
err = drm_hdmi_avi_infoframe_from_display_mode(&frame, mode, false);
|
err = drm_hdmi_avi_infoframe_from_display_mode(&frame,
|
||||||
|
&sor->output.connector, mode);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
dev_err(sor->dev, "failed to setup AVI infoframe: %d\n", err);
|
dev_err(sor->dev, "failed to setup AVI infoframe: %d\n", err);
|
||||||
return err;
|
return err;
|
||||||
|
|||||||
@@ -424,18 +424,19 @@ static void vc4_hdmi_set_avi_infoframe(struct drm_encoder *encoder)
|
|||||||
union hdmi_infoframe frame;
|
union hdmi_infoframe frame;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ret = drm_hdmi_avi_infoframe_from_display_mode(&frame.avi, mode, false);
|
ret = drm_hdmi_avi_infoframe_from_display_mode(&frame.avi,
|
||||||
|
hdmi->connector, 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, mode,
|
drm_hdmi_avi_infoframe_quant_range(&frame.avi,
|
||||||
|
hdmi->connector, 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,
|
||||||
vc4_encoder->rgb_range_selectable,
|
vc4_encoder->rgb_range_selectable);
|
||||||
false);
|
|
||||||
|
|
||||||
frame.avi.right_bar = cstate->tv.margins.right;
|
frame.avi.right_bar = cstate->tv.margins.right;
|
||||||
frame.avi.left_bar = cstate->tv.margins.left;
|
frame.avi.left_bar = cstate->tv.margins.left;
|
||||||
|
|||||||
@@ -125,7 +125,9 @@ static int zx_hdmi_config_video_avi(struct zx_hdmi *hdmi,
|
|||||||
union hdmi_infoframe frame;
|
union hdmi_infoframe frame;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ret = drm_hdmi_avi_infoframe_from_display_mode(&frame.avi, mode, false);
|
ret = drm_hdmi_avi_infoframe_from_display_mode(&frame.avi,
|
||||||
|
&hdmi->connector,
|
||||||
|
mode);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
DRM_DEV_ERROR(hdmi->dev, "failed to get avi infoframe: %d\n",
|
DRM_DEV_ERROR(hdmi->dev, "failed to get avi infoframe: %d\n",
|
||||||
ret);
|
ret);
|
||||||
|
|||||||
@@ -352,18 +352,18 @@ drm_load_edid_firmware(struct drm_connector *connector)
|
|||||||
|
|
||||||
int
|
int
|
||||||
drm_hdmi_avi_infoframe_from_display_mode(struct hdmi_avi_infoframe *frame,
|
drm_hdmi_avi_infoframe_from_display_mode(struct hdmi_avi_infoframe *frame,
|
||||||
const struct drm_display_mode *mode,
|
struct drm_connector *connector,
|
||||||
bool is_hdmi2_sink);
|
const struct drm_display_mode *mode);
|
||||||
int
|
int
|
||||||
drm_hdmi_vendor_infoframe_from_display_mode(struct hdmi_vendor_infoframe *frame,
|
drm_hdmi_vendor_infoframe_from_display_mode(struct hdmi_vendor_infoframe *frame,
|
||||||
struct drm_connector *connector,
|
struct drm_connector *connector,
|
||||||
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,
|
||||||
|
struct drm_connector *connector,
|
||||||
const struct drm_display_mode *mode,
|
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);
|
||||||
bool is_hdmi2_sink);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* drm_eld_mnl - Get ELD monitor name length in bytes.
|
* drm_eld_mnl - Get ELD monitor name length in bytes.
|
||||||
|
|||||||
Reference in New Issue
Block a user