2021-08-21 08:54:34 +00:00
|
|
|
From 82a5aa1df1b04efef46c7be82a7d71ea5300ce92 Mon Sep 17 00:00:00 2001
|
|
|
|
From: Dave Stevenson <dave.stevenson@raspberrypi.com>
|
|
|
|
Date: Wed, 2 Dec 2020 18:36:24 +0000
|
|
|
|
Subject: [PATCH] drm/vc4: Add HDR metadata property to the VC5 HDMI
|
|
|
|
connectors
|
|
|
|
|
|
|
|
Now that we can export deeper colour depths, add in the signalling
|
|
|
|
for HDR metadata.
|
|
|
|
|
|
|
|
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
|
|
|
|
---
|
|
|
|
drivers/gpu/drm/vc4/vc4_hdmi.c | 28 ++++++++++++++++++++++++++++
|
|
|
|
drivers/gpu/drm/vc4/vc4_hdmi.h | 3 +++
|
|
|
|
2 files changed, 31 insertions(+)
|
|
|
|
|
|
|
|
--- a/drivers/gpu/drm/vc4/vc4_hdmi.c
|
|
|
|
+++ b/drivers/gpu/drm/vc4/vc4_hdmi.c
|
2022-01-27 12:08:41 +00:00
|
|
|
@@ -310,6 +310,10 @@ static int vc4_hdmi_connector_init(struc
|
2021-08-21 08:54:34 +00:00
|
|
|
connector->doublescan_allowed = 0;
|
|
|
|
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);
|
|
|
|
|
|
|
|
return 0;
|
2022-01-27 12:08:41 +00:00
|
|
|
@@ -449,6 +453,25 @@ static void vc4_hdmi_set_audio_infoframe
|
2021-08-21 08:54:34 +00:00
|
|
|
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)
|
|
|
|
{
|
|
|
|
struct vc4_hdmi *vc4_hdmi = encoder_to_vc4_hdmi(encoder);
|
2022-01-27 12:08:41 +00:00
|
|
|
@@ -461,6 +484,8 @@ static void vc4_hdmi_set_infoframes(stru
|
2021-08-21 08:54:34 +00:00
|
|
|
*/
|
|
|
|
if (vc4_hdmi->audio.streaming)
|
|
|
|
vc4_hdmi_set_audio_infoframe(encoder);
|
|
|
|
+
|
|
|
|
+ vc4_hdmi_set_hdr_infoframe(encoder);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void vc4_hdmi_encoder_post_crtc_disable(struct drm_encoder *encoder,
|
2022-01-27 12:08:41 +00:00
|
|
|
@@ -2304,6 +2329,7 @@ static const struct vc4_hdmi_variant bcm
|
2021-08-21 08:54:34 +00:00
|
|
|
.phy_rng_enable = vc4_hdmi_phy_rng_enable,
|
|
|
|
.phy_rng_disable = vc4_hdmi_phy_rng_disable,
|
|
|
|
.channel_map = vc4_hdmi_channel_map,
|
|
|
|
+ .supports_hdr = false,
|
|
|
|
};
|
|
|
|
|
|
|
|
static const struct vc4_hdmi_variant bcm2711_hdmi0_variant = {
|
2022-01-27 12:08:41 +00:00
|
|
|
@@ -2331,6 +2357,7 @@ static const struct vc4_hdmi_variant bcm
|
2021-08-21 08:54:34 +00:00
|
|
|
.phy_rng_enable = vc5_hdmi_phy_rng_enable,
|
|
|
|
.phy_rng_disable = vc5_hdmi_phy_rng_disable,
|
|
|
|
.channel_map = vc5_hdmi_channel_map,
|
|
|
|
+ .supports_hdr = true,
|
|
|
|
};
|
|
|
|
|
|
|
|
static const struct vc4_hdmi_variant bcm2711_hdmi1_variant = {
|
2022-01-27 12:08:41 +00:00
|
|
|
@@ -2358,6 +2385,7 @@ static const struct vc4_hdmi_variant bcm
|
2021-08-21 08:54:34 +00:00
|
|
|
.phy_rng_enable = vc5_hdmi_phy_rng_enable,
|
|
|
|
.phy_rng_disable = vc5_hdmi_phy_rng_disable,
|
|
|
|
.channel_map = vc5_hdmi_channel_map,
|
|
|
|
+ .supports_hdr = true,
|
|
|
|
};
|
|
|
|
|
|
|
|
static const struct of_device_id vc4_hdmi_dt_match[] = {
|
|
|
|
--- a/drivers/gpu/drm/vc4/vc4_hdmi.h
|
|
|
|
+++ b/drivers/gpu/drm/vc4/vc4_hdmi.h
|
|
|
|
@@ -99,6 +99,9 @@ struct vc4_hdmi_variant {
|
|
|
|
|
|
|
|
/* Callback to get channel map */
|
|
|
|
u32 (*channel_map)(struct vc4_hdmi *vc4_hdmi, u32 channel_mask);
|
|
|
|
+
|
|
|
|
+ /* Enables HDR metadata */
|
|
|
|
+ bool supports_hdr;
|
|
|
|
};
|
|
|
|
|
|
|
|
/* HDMI audio information */
|