提交 853599d0 编写于 作者: D Dave Stevenson 提交者: Zheng Zengkai

drm/vc4: Add HDR metadata property to the VC5 HDMI connectors

raspberrypi inclusion
category: feature
bugzilla: 50432

--------------------------------

Now that we can export deeper colour depths, add in the signalling
for HDR metadata.
Signed-off-by: NDave Stevenson <dave.stevenson@raspberrypi.com>
Signed-off-by: NFang Yafen <yafen@iscas.ac.cn>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 4e8c9dd0
...@@ -613,6 +613,10 @@ static int vc4_hdmi_connector_init(struct drm_device *dev, ...@@ -613,6 +613,10 @@ static int vc4_hdmi_connector_init(struct drm_device *dev,
connector->doublescan_allowed = 0; connector->doublescan_allowed = 0;
connector->stereo_allowed = 1; connector->stereo_allowed = 1;
if (vc4_hdmi->variant->supports_hdr)
drm_object_attach_property(&connector->base,
connector->dev->mode_config.hdr_output_metadata_property, 0);
drm_connector_attach_encoder(connector, encoder); drm_connector_attach_encoder(connector, encoder);
return 0; return 0;
...@@ -755,6 +759,25 @@ static void vc4_hdmi_set_audio_infoframe(struct drm_encoder *encoder) ...@@ -755,6 +759,25 @@ static void vc4_hdmi_set_audio_infoframe(struct drm_encoder *encoder)
vc4_hdmi_write_infoframe(encoder, &frame); vc4_hdmi_write_infoframe(encoder, &frame);
} }
static void vc4_hdmi_set_hdr_infoframe(struct drm_encoder *encoder)
{
struct vc4_hdmi *vc4_hdmi = encoder_to_vc4_hdmi(encoder);
struct drm_connector *connector = &vc4_hdmi->connector;
struct drm_connector_state *conn_state = connector->state;
union hdmi_infoframe frame;
if (!vc4_hdmi->variant->supports_hdr)
return;
if (!conn_state->hdr_output_metadata)
return;
if (drm_hdmi_infoframe_set_hdr_metadata(&frame.drm, conn_state))
return;
vc4_hdmi_write_infoframe(encoder, &frame);
}
static void vc4_hdmi_set_infoframes(struct drm_encoder *encoder) static void vc4_hdmi_set_infoframes(struct drm_encoder *encoder)
{ {
struct vc4_hdmi *vc4_hdmi = encoder_to_vc4_hdmi(encoder); struct vc4_hdmi *vc4_hdmi = encoder_to_vc4_hdmi(encoder);
...@@ -767,6 +790,8 @@ static void vc4_hdmi_set_infoframes(struct drm_encoder *encoder) ...@@ -767,6 +790,8 @@ static void vc4_hdmi_set_infoframes(struct drm_encoder *encoder)
*/ */
if (vc4_hdmi->audio.streaming) if (vc4_hdmi->audio.streaming)
vc4_hdmi_set_audio_infoframe(encoder); vc4_hdmi_set_audio_infoframe(encoder);
vc4_hdmi_set_hdr_infoframe(encoder);
} }
static void vc4_hdmi_encoder_post_crtc_disable(struct drm_encoder *encoder, static void vc4_hdmi_encoder_post_crtc_disable(struct drm_encoder *encoder,
...@@ -2672,6 +2697,7 @@ static const struct vc4_hdmi_variant bcm2835_variant = { ...@@ -2672,6 +2697,7 @@ static const struct vc4_hdmi_variant bcm2835_variant = {
.phy_rng_enable = vc4_hdmi_phy_rng_enable, .phy_rng_enable = vc4_hdmi_phy_rng_enable,
.phy_rng_disable = vc4_hdmi_phy_rng_disable, .phy_rng_disable = vc4_hdmi_phy_rng_disable,
.channel_map = vc4_hdmi_channel_map, .channel_map = vc4_hdmi_channel_map,
.supports_hdr = false,
}; };
static const struct vc4_hdmi_variant bcm2711_hdmi0_variant = { static const struct vc4_hdmi_variant bcm2711_hdmi0_variant = {
...@@ -2699,6 +2725,7 @@ static const struct vc4_hdmi_variant bcm2711_hdmi0_variant = { ...@@ -2699,6 +2725,7 @@ static const struct vc4_hdmi_variant bcm2711_hdmi0_variant = {
.phy_rng_enable = vc5_hdmi_phy_rng_enable, .phy_rng_enable = vc5_hdmi_phy_rng_enable,
.phy_rng_disable = vc5_hdmi_phy_rng_disable, .phy_rng_disable = vc5_hdmi_phy_rng_disable,
.channel_map = vc5_hdmi_channel_map, .channel_map = vc5_hdmi_channel_map,
.supports_hdr = true,
}; };
static const struct vc4_hdmi_variant bcm2711_hdmi1_variant = { static const struct vc4_hdmi_variant bcm2711_hdmi1_variant = {
...@@ -2726,6 +2753,7 @@ static const struct vc4_hdmi_variant bcm2711_hdmi1_variant = { ...@@ -2726,6 +2753,7 @@ static const struct vc4_hdmi_variant bcm2711_hdmi1_variant = {
.phy_rng_enable = vc5_hdmi_phy_rng_enable, .phy_rng_enable = vc5_hdmi_phy_rng_enable,
.phy_rng_disable = vc5_hdmi_phy_rng_disable, .phy_rng_disable = vc5_hdmi_phy_rng_disable,
.channel_map = vc5_hdmi_channel_map, .channel_map = vc5_hdmi_channel_map,
.supports_hdr = true,
}; };
static const struct of_device_id vc4_hdmi_dt_match[] = { static const struct of_device_id vc4_hdmi_dt_match[] = {
......
...@@ -99,6 +99,9 @@ struct vc4_hdmi_variant { ...@@ -99,6 +99,9 @@ struct vc4_hdmi_variant {
/* Callback to get channel map */ /* Callback to get channel map */
u32 (*channel_map)(struct vc4_hdmi *vc4_hdmi, u32 channel_mask); u32 (*channel_map)(struct vc4_hdmi *vc4_hdmi, u32 channel_mask);
/* Enables HDR metadata */
bool supports_hdr;
}; };
/* HDMI audio information */ /* HDMI audio information */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册