* [v10 01/12] drm: Add HDR source metadata property
2019-05-14 17:36 [v10 00/12] Add HDR Metadata Parsing and handling in DRM layer Uma Shankar
@ 2019-05-14 17:36 ` Uma Shankar
2019-05-15 19:10 ` Ville Syrjälä
2019-05-14 17:36 ` [v10 02/12] drm: Add reference counting on HDR metadata blob Uma Shankar
` (10 subsequent siblings)
11 siblings, 1 reply; 27+ messages in thread
From: Uma Shankar @ 2019-05-14 17:36 UTC (permalink / raw)
To: intel-gfx, dri-devel; +Cc: dcastagna, jonas, seanpaul
This patch adds a blob property to get HDR metadata
information from userspace. This will be send as part
of AVI Infoframe to panel.
It also implements get() and set() functions for HDR output
metadata property.The blob data is received from userspace and
saved in connector state, the same is returned as blob in get
property call to userspace.
v2: Rebase and modified the metadata structure elements
as per Ville's POC changes.
v3: No Change
v4: Addressed Shashank's review comments
v5: Rebase.
v6: Addressed Brian Starkey's review comments, defined
new structure with header for dynamic metadata scalability.
Merge get/set property functions for metadata in this patch.
v7: Addressed Jonas Karlman review comments and defined separate
structure for infoframe to better align with CTA 861.G spec. Added
Shashank's RB.
v8: Addressed Ville's review comments. Moved sink metadata structure
out of uapi headers as suggested by Jonas Karlman.
v9: Rebase and addressed Jonas Karlman review comments.
Signed-off-by: Uma Shankar <uma.shankar@intel.com>
Reviewed-by: Shashank Sharma <shashank.sharma@intel.com>
---
drivers/gpu/drm/drm_atomic.c | 2 ++
drivers/gpu/drm/drm_atomic_uapi.c | 13 +++++++++++++
drivers/gpu/drm/drm_connector.c | 6 ++++++
include/drm/drm_connector.h | 11 +++++++++++
include/drm/drm_mode_config.h | 7 +++++++
include/linux/hdmi.h | 26 ++++++++++++++++++++++++++
include/uapi/drm/drm_mode.h | 23 +++++++++++++++++++++++
7 files changed, 88 insertions(+)
diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
index f4924cb..0d27195 100644
--- a/drivers/gpu/drm/drm_atomic.c
+++ b/drivers/gpu/drm/drm_atomic.c
@@ -925,6 +925,8 @@ static void drm_atomic_connector_print_state(struct drm_printer *p,
drm_printf(p, "connector[%u]: %s\n", connector->base.id, connector->name);
drm_printf(p, "\tcrtc=%s\n", state->crtc ? state->crtc->name : "(null)");
+ drm_printf(p, "\thdr_metadata_changed=%d\n",
+ state->hdr_metadata_changed);
if (connector->connector_type == DRM_MODE_CONNECTOR_WRITEBACK)
if (state->writeback_job && state->writeback_job->fb)
diff --git a/drivers/gpu/drm/drm_atomic_uapi.c b/drivers/gpu/drm/drm_atomic_uapi.c
index 4131e66..4aa82c91 100644
--- a/drivers/gpu/drm/drm_atomic_uapi.c
+++ b/drivers/gpu/drm/drm_atomic_uapi.c
@@ -676,6 +676,8 @@ static int drm_atomic_connector_set_property(struct drm_connector *connector,
{
struct drm_device *dev = connector->dev;
struct drm_mode_config *config = &dev->mode_config;
+ bool replaced = false;
+ int ret;
if (property == config->prop_crtc_id) {
struct drm_crtc *crtc = drm_crtc_find(dev, file_priv, val);
@@ -726,6 +728,14 @@ static int drm_atomic_connector_set_property(struct drm_connector *connector,
*/
if (state->link_status != DRM_LINK_STATUS_GOOD)
state->link_status = val;
+ } else if (property == config->hdr_output_metadata_property) {
+ ret = drm_atomic_replace_property_blob_from_id(dev,
+ &state->hdr_output_metadata,
+ val,
+ -1, sizeof(struct hdr_output_metadata),
+ &replaced);
+ state->hdr_metadata_changed |= replaced;
+ return ret;
} else if (property == config->aspect_ratio_property) {
state->picture_aspect_ratio = val;
} else if (property == config->content_type_property) {
@@ -814,6 +824,9 @@ static int drm_atomic_connector_set_property(struct drm_connector *connector,
*val = state->colorspace;
} else if (property == connector->scaling_mode_property) {
*val = state->scaling_mode;
+ } else if (property == config->hdr_output_metadata_property) {
+ *val = state->hdr_output_metadata ?
+ state->hdr_output_metadata->base.id : 0;
} else if (property == config->content_protection_property) {
*val = state->content_protection;
} else if (property == config->writeback_fb_id_property) {
diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c
index 11fcd25..c9ac8b9 100644
--- a/drivers/gpu/drm/drm_connector.c
+++ b/drivers/gpu/drm/drm_connector.c
@@ -1051,6 +1051,12 @@ int drm_connector_create_standard_properties(struct drm_device *dev)
return -ENOMEM;
dev->mode_config.non_desktop_property = prop;
+ prop = drm_property_create(dev, DRM_MODE_PROP_BLOB,
+ "HDR_OUTPUT_METADATA", 0);
+ if (!prop)
+ return -ENOMEM;
+ dev->mode_config.hdr_output_metadata_property = prop;
+
return 0;
}
diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h
index e257b87..54daa54 100644
--- a/include/drm/drm_connector.h
+++ b/include/drm/drm_connector.h
@@ -603,6 +603,13 @@ struct drm_connector_state {
* and the connector bpc limitations obtained from edid.
*/
u8 max_bpc;
+
+ /**
+ * @hdr_output_metadata:
+ * DRM blob property for HDR output metadata
+ */
+ struct drm_property_blob *hdr_output_metadata;
+ u8 hdr_metadata_changed : 1;
};
/**
@@ -1237,6 +1244,10 @@ struct drm_connector {
* &drm_mode_config.connector_free_work.
*/
struct llist_node free_node;
+
+ /* HDR metdata */
+ struct hdr_output_metadata hdr_output_metadata;
+ struct hdr_sink_metadata hdr_sink_metadata;
};
#define obj_to_connector(x) container_of(x, struct drm_connector, base)
diff --git a/include/drm/drm_mode_config.h b/include/drm/drm_mode_config.h
index 5764ee3..58278cc 100644
--- a/include/drm/drm_mode_config.h
+++ b/include/drm/drm_mode_config.h
@@ -842,6 +842,13 @@ struct drm_mode_config {
*/
struct drm_property *content_protection_property;
+ /**
+ * hdr_output_metadata_property: Connector property containing hdr
+ * metatda. This will be provided by userspace compositors based
+ * on HDR content
+ */
+ struct drm_property *hdr_output_metadata_property;
+
/* dumb ioctl parameters */
uint32_t preferred_depth, prefer_shadow;
diff --git a/include/linux/hdmi.h b/include/linux/hdmi.h
index 927ad64..6780476 100644
--- a/include/linux/hdmi.h
+++ b/include/linux/hdmi.h
@@ -152,6 +152,16 @@ enum hdmi_content_type {
HDMI_CONTENT_TYPE_GAME,
};
+enum hdmi_metadata_type {
+ HDMI_STATIC_METADATA_TYPE1 = 1,
+};
+
+enum hdmi_eotf {
+ HDMI_EOTF_TRADITIONAL_GAMMA_SDR,
+ HDMI_EOTF_TRADITIONAL_GAMMA_HDR,
+ HDMI_EOTF_SMPTE_ST2084,
+};
+
struct hdmi_avi_infoframe {
enum hdmi_infoframe_type type;
unsigned char version;
@@ -320,6 +330,22 @@ struct hdmi_vendor_infoframe {
unsigned int s3d_ext_data;
};
+/* HDR Metadata as per 861.G spec */
+struct hdr_static_metadata {
+ __u8 eotf;
+ __u8 metadata_type;
+ __u16 max_cll;
+ __u16 max_fall;
+ __u16 min_cll;
+};
+
+struct hdr_sink_metadata {
+ __u32 metadata_type;
+ union {
+ struct hdr_static_metadata hdmi_type1;
+ };
+};
+
int hdmi_vendor_infoframe_init(struct hdmi_vendor_infoframe *frame);
ssize_t hdmi_vendor_infoframe_pack(struct hdmi_vendor_infoframe *frame,
void *buffer, size_t size);
diff --git a/include/uapi/drm/drm_mode.h b/include/uapi/drm/drm_mode.h
index 83cd163..997a7e0 100644
--- a/include/uapi/drm/drm_mode.h
+++ b/include/uapi/drm/drm_mode.h
@@ -630,6 +630,29 @@ struct drm_color_lut {
__u16 reserved;
};
+/* HDR Metadata Infoframe as per 861.G spec */
+struct hdr_metadata_infoframe {
+ __u8 eotf;
+ __u8 metadata_type;
+ struct {
+ __u16 x, y;
+ } display_primaries[3];
+ struct {
+ __u16 x, y;
+ } white_point;
+ __u16 max_display_mastering_luminance;
+ __u16 min_display_mastering_luminance;
+ __u16 max_cll;
+ __u16 max_fall;
+};
+
+struct hdr_output_metadata {
+ __u32 metadata_type;
+ union {
+ struct hdr_metadata_infoframe hdmi_metadata_type1;
+ };
+};
+
#define DRM_MODE_PAGE_FLIP_EVENT 0x01
#define DRM_MODE_PAGE_FLIP_ASYNC 0x02
#define DRM_MODE_PAGE_FLIP_TARGET_ABSOLUTE 0x4
--
1.9.1
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 27+ messages in thread* Re: [v10 01/12] drm: Add HDR source metadata property
2019-05-14 17:36 ` [v10 01/12] drm: Add HDR source metadata property Uma Shankar
@ 2019-05-15 19:10 ` Ville Syrjälä
2019-05-15 19:33 ` Jonas Karlman
2019-05-16 7:21 ` Shankar, Uma
0 siblings, 2 replies; 27+ messages in thread
From: Ville Syrjälä @ 2019-05-15 19:10 UTC (permalink / raw)
To: Uma Shankar; +Cc: dcastagna, jonas, intel-gfx, dri-devel, seanpaul
On Tue, May 14, 2019 at 11:06:23PM +0530, Uma Shankar wrote:
> This patch adds a blob property to get HDR metadata
> information from userspace. This will be send as part
> of AVI Infoframe to panel.
>
> It also implements get() and set() functions for HDR output
> metadata property.The blob data is received from userspace and
> saved in connector state, the same is returned as blob in get
> property call to userspace.
>
> v2: Rebase and modified the metadata structure elements
> as per Ville's POC changes.
>
> v3: No Change
>
> v4: Addressed Shashank's review comments
>
> v5: Rebase.
>
> v6: Addressed Brian Starkey's review comments, defined
> new structure with header for dynamic metadata scalability.
> Merge get/set property functions for metadata in this patch.
>
> v7: Addressed Jonas Karlman review comments and defined separate
> structure for infoframe to better align with CTA 861.G spec. Added
> Shashank's RB.
>
> v8: Addressed Ville's review comments. Moved sink metadata structure
> out of uapi headers as suggested by Jonas Karlman.
>
> v9: Rebase and addressed Jonas Karlman review comments.
>
> Signed-off-by: Uma Shankar <uma.shankar@intel.com>
> Reviewed-by: Shashank Sharma <shashank.sharma@intel.com>
> ---
> drivers/gpu/drm/drm_atomic.c | 2 ++
> drivers/gpu/drm/drm_atomic_uapi.c | 13 +++++++++++++
> drivers/gpu/drm/drm_connector.c | 6 ++++++
> include/drm/drm_connector.h | 11 +++++++++++
> include/drm/drm_mode_config.h | 7 +++++++
> include/linux/hdmi.h | 26 ++++++++++++++++++++++++++
> include/uapi/drm/drm_mode.h | 23 +++++++++++++++++++++++
> 7 files changed, 88 insertions(+)
>
> diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
> index f4924cb..0d27195 100644
> --- a/drivers/gpu/drm/drm_atomic.c
> +++ b/drivers/gpu/drm/drm_atomic.c
> @@ -925,6 +925,8 @@ static void drm_atomic_connector_print_state(struct drm_printer *p,
>
> drm_printf(p, "connector[%u]: %s\n", connector->base.id, connector->name);
> drm_printf(p, "\tcrtc=%s\n", state->crtc ? state->crtc->name : "(null)");
> + drm_printf(p, "\thdr_metadata_changed=%d\n",
> + state->hdr_metadata_changed);
>
> if (connector->connector_type == DRM_MODE_CONNECTOR_WRITEBACK)
> if (state->writeback_job && state->writeback_job->fb)
> diff --git a/drivers/gpu/drm/drm_atomic_uapi.c b/drivers/gpu/drm/drm_atomic_uapi.c
> index 4131e66..4aa82c91 100644
> --- a/drivers/gpu/drm/drm_atomic_uapi.c
> +++ b/drivers/gpu/drm/drm_atomic_uapi.c
> @@ -676,6 +676,8 @@ static int drm_atomic_connector_set_property(struct drm_connector *connector,
> {
> struct drm_device *dev = connector->dev;
> struct drm_mode_config *config = &dev->mode_config;
> + bool replaced = false;
> + int ret;
>
> if (property == config->prop_crtc_id) {
> struct drm_crtc *crtc = drm_crtc_find(dev, file_priv, val);
> @@ -726,6 +728,14 @@ static int drm_atomic_connector_set_property(struct drm_connector *connector,
> */
> if (state->link_status != DRM_LINK_STATUS_GOOD)
> state->link_status = val;
> + } else if (property == config->hdr_output_metadata_property) {
> + ret = drm_atomic_replace_property_blob_from_id(dev,
> + &state->hdr_output_metadata,
> + val,
> + -1, sizeof(struct hdr_output_metadata),
Those function arguments are nonsesne for a blob that isn't an array.
> + &replaced);
> + state->hdr_metadata_changed |= replaced;
> + return ret;
> } else if (property == config->aspect_ratio_property) {
> state->picture_aspect_ratio = val;
> } else if (property == config->content_type_property) {
> @@ -814,6 +824,9 @@ static int drm_atomic_connector_set_property(struct drm_connector *connector,
> *val = state->colorspace;
> } else if (property == connector->scaling_mode_property) {
> *val = state->scaling_mode;
> + } else if (property == config->hdr_output_metadata_property) {
> + *val = state->hdr_output_metadata ?
> + state->hdr_output_metadata->base.id : 0;
> } else if (property == config->content_protection_property) {
> *val = state->content_protection;
> } else if (property == config->writeback_fb_id_property) {
> diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c
> index 11fcd25..c9ac8b9 100644
> --- a/drivers/gpu/drm/drm_connector.c
> +++ b/drivers/gpu/drm/drm_connector.c
> @@ -1051,6 +1051,12 @@ int drm_connector_create_standard_properties(struct drm_device *dev)
> return -ENOMEM;
> dev->mode_config.non_desktop_property = prop;
>
> + prop = drm_property_create(dev, DRM_MODE_PROP_BLOB,
> + "HDR_OUTPUT_METADATA", 0);
> + if (!prop)
> + return -ENOMEM;
> + dev->mode_config.hdr_output_metadata_property = prop;
> +
> return 0;
> }
>
> diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h
> index e257b87..54daa54 100644
> --- a/include/drm/drm_connector.h
> +++ b/include/drm/drm_connector.h
> @@ -603,6 +603,13 @@ struct drm_connector_state {
> * and the connector bpc limitations obtained from edid.
> */
> u8 max_bpc;
> +
> + /**
> + * @hdr_output_metadata:
> + * DRM blob property for HDR output metadata
> + */
> + struct drm_property_blob *hdr_output_metadata;
> + u8 hdr_metadata_changed : 1;
I think the changed flag is now unused. Should be dropped if so.
> };
>
> /**
> @@ -1237,6 +1244,10 @@ struct drm_connector {
> * &drm_mode_config.connector_free_work.
> */
> struct llist_node free_node;
> +
> + /* HDR metdata */
> + struct hdr_output_metadata hdr_output_metadata;
> + struct hdr_sink_metadata hdr_sink_metadata;
> };
>
> #define obj_to_connector(x) container_of(x, struct drm_connector, base)
> diff --git a/include/drm/drm_mode_config.h b/include/drm/drm_mode_config.h
> index 5764ee3..58278cc 100644
> --- a/include/drm/drm_mode_config.h
> +++ b/include/drm/drm_mode_config.h
> @@ -842,6 +842,13 @@ struct drm_mode_config {
> */
> struct drm_property *content_protection_property;
>
> + /**
> + * hdr_output_metadata_property: Connector property containing hdr
> + * metatda. This will be provided by userspace compositors based
> + * on HDR content
> + */
> + struct drm_property *hdr_output_metadata_property;
> +
> /* dumb ioctl parameters */
> uint32_t preferred_depth, prefer_shadow;
>
> diff --git a/include/linux/hdmi.h b/include/linux/hdmi.h
> index 927ad64..6780476 100644
> --- a/include/linux/hdmi.h
> +++ b/include/linux/hdmi.h
> @@ -152,6 +152,16 @@ enum hdmi_content_type {
> HDMI_CONTENT_TYPE_GAME,
> };
>
> +enum hdmi_metadata_type {
> + HDMI_STATIC_METADATA_TYPE1 = 1,
> +};
> +
> +enum hdmi_eotf {
> + HDMI_EOTF_TRADITIONAL_GAMMA_SDR,
> + HDMI_EOTF_TRADITIONAL_GAMMA_HDR,
> + HDMI_EOTF_SMPTE_ST2084,
> +};
> +
> struct hdmi_avi_infoframe {
> enum hdmi_infoframe_type type;
> unsigned char version;
> @@ -320,6 +330,22 @@ struct hdmi_vendor_infoframe {
> unsigned int s3d_ext_data;
> };
>
> +/* HDR Metadata as per 861.G spec */
> +struct hdr_static_metadata {
> + __u8 eotf;
> + __u8 metadata_type;
> + __u16 max_cll;
> + __u16 max_fall;
> + __u16 min_cll;
> +};
> +
> +struct hdr_sink_metadata {
> + __u32 metadata_type;
> + union {
> + struct hdr_static_metadata hdmi_type1;
> + };
> +};
> +
> int hdmi_vendor_infoframe_init(struct hdmi_vendor_infoframe *frame);
> ssize_t hdmi_vendor_infoframe_pack(struct hdmi_vendor_infoframe *frame,
> void *buffer, size_t size);
> diff --git a/include/uapi/drm/drm_mode.h b/include/uapi/drm/drm_mode.h
> index 83cd163..997a7e0 100644
> --- a/include/uapi/drm/drm_mode.h
> +++ b/include/uapi/drm/drm_mode.h
> @@ -630,6 +630,29 @@ struct drm_color_lut {
> __u16 reserved;
> };
>
> +/* HDR Metadata Infoframe as per 861.G spec */
> +struct hdr_metadata_infoframe {
> + __u8 eotf;
> + __u8 metadata_type;
> + struct {
> + __u16 x, y;
> + } display_primaries[3];
> + struct {
> + __u16 x, y;
> + } white_point;
> + __u16 max_display_mastering_luminance;
> + __u16 min_display_mastering_luminance;
> + __u16 max_cll;
> + __u16 max_fall;
> +};
> +
> +struct hdr_output_metadata {
> + __u32 metadata_type;
> + union {
> + struct hdr_metadata_infoframe hdmi_metadata_type1;
> + };
> +};
> +
> #define DRM_MODE_PAGE_FLIP_EVENT 0x01
> #define DRM_MODE_PAGE_FLIP_ASYNC 0x02
> #define DRM_MODE_PAGE_FLIP_TARGET_ABSOLUTE 0x4
> --
> 1.9.1
--
Ville Syrjälä
Intel
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 27+ messages in thread* Re: [v10 01/12] drm: Add HDR source metadata property
2019-05-15 19:10 ` Ville Syrjälä
@ 2019-05-15 19:33 ` Jonas Karlman
2019-05-15 19:45 ` Ville Syrjälä
2019-05-16 7:21 ` Shankar, Uma
1 sibling, 1 reply; 27+ messages in thread
From: Jonas Karlman @ 2019-05-15 19:33 UTC (permalink / raw)
To: Ville Syrjälä, Uma Shankar
Cc: dcastagna@chromium.org, intel-gfx@lists.freedesktop.org,
dri-devel@lists.freedesktop.org, seanpaul@chromium.org
On 2019-05-15 21:10, Ville Syrjälä wrote:
> On Tue, May 14, 2019 at 11:06:23PM +0530, Uma Shankar wrote:
>> This patch adds a blob property to get HDR metadata
>> information from userspace. This will be send as part
>> of AVI Infoframe to panel.
>>
>> It also implements get() and set() functions for HDR output
>> metadata property.The blob data is received from userspace and
>> saved in connector state, the same is returned as blob in get
>> property call to userspace.
>>
>> v2: Rebase and modified the metadata structure elements
>> as per Ville's POC changes.
>>
>> v3: No Change
>>
>> v4: Addressed Shashank's review comments
>>
>> v5: Rebase.
>>
>> v6: Addressed Brian Starkey's review comments, defined
>> new structure with header for dynamic metadata scalability.
>> Merge get/set property functions for metadata in this patch.
>>
>> v7: Addressed Jonas Karlman review comments and defined separate
>> structure for infoframe to better align with CTA 861.G spec. Added
>> Shashank's RB.
>>
>> v8: Addressed Ville's review comments. Moved sink metadata structure
>> out of uapi headers as suggested by Jonas Karlman.
>>
>> v9: Rebase and addressed Jonas Karlman review comments.
>>
>> Signed-off-by: Uma Shankar <uma.shankar@intel.com>
>> Reviewed-by: Shashank Sharma <shashank.sharma@intel.com>
>> ---
>> drivers/gpu/drm/drm_atomic.c | 2 ++
>> drivers/gpu/drm/drm_atomic_uapi.c | 13 +++++++++++++
>> drivers/gpu/drm/drm_connector.c | 6 ++++++
>> include/drm/drm_connector.h | 11 +++++++++++
>> include/drm/drm_mode_config.h | 7 +++++++
>> include/linux/hdmi.h | 26 ++++++++++++++++++++++++++
>> include/uapi/drm/drm_mode.h | 23 +++++++++++++++++++++++
>> 7 files changed, 88 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
>> index f4924cb..0d27195 100644
>> --- a/drivers/gpu/drm/drm_atomic.c
>> +++ b/drivers/gpu/drm/drm_atomic.c
>> @@ -925,6 +925,8 @@ static void drm_atomic_connector_print_state(struct drm_printer *p,
>>
>> drm_printf(p, "connector[%u]: %s\n", connector->base.id, connector->name);
>> drm_printf(p, "\tcrtc=%s\n", state->crtc ? state->crtc->name : "(null)");
>> + drm_printf(p, "\thdr_metadata_changed=%d\n",
>> + state->hdr_metadata_changed);
>>
>> if (connector->connector_type == DRM_MODE_CONNECTOR_WRITEBACK)
>> if (state->writeback_job && state->writeback_job->fb)
>> diff --git a/drivers/gpu/drm/drm_atomic_uapi.c b/drivers/gpu/drm/drm_atomic_uapi.c
>> index 4131e66..4aa82c91 100644
>> --- a/drivers/gpu/drm/drm_atomic_uapi.c
>> +++ b/drivers/gpu/drm/drm_atomic_uapi.c
>> @@ -676,6 +676,8 @@ static int drm_atomic_connector_set_property(struct drm_connector *connector,
>> {
>> struct drm_device *dev = connector->dev;
>> struct drm_mode_config *config = &dev->mode_config;
>> + bool replaced = false;
>> + int ret;
>>
>> if (property == config->prop_crtc_id) {
>> struct drm_crtc *crtc = drm_crtc_find(dev, file_priv, val);
>> @@ -726,6 +728,14 @@ static int drm_atomic_connector_set_property(struct drm_connector *connector,
>> */
>> if (state->link_status != DRM_LINK_STATUS_GOOD)
>> state->link_status = val;
>> + } else if (property == config->hdr_output_metadata_property) {
>> + ret = drm_atomic_replace_property_blob_from_id(dev,
>> + &state->hdr_output_metadata,
>> + val,
>> + -1, sizeof(struct hdr_output_metadata),
> Those function arguments are nonsesne for a blob that isn't an array.
>
>> + &replaced);
>> + state->hdr_metadata_changed |= replaced;
>> + return ret;
>> } else if (property == config->aspect_ratio_property) {
>> state->picture_aspect_ratio = val;
>> } else if (property == config->content_type_property) {
>> @@ -814,6 +824,9 @@ static int drm_atomic_connector_set_property(struct drm_connector *connector,
>> *val = state->colorspace;
>> } else if (property == connector->scaling_mode_property) {
>> *val = state->scaling_mode;
>> + } else if (property == config->hdr_output_metadata_property) {
>> + *val = state->hdr_output_metadata ?
>> + state->hdr_output_metadata->base.id : 0;
>> } else if (property == config->content_protection_property) {
>> *val = state->content_protection;
>> } else if (property == config->writeback_fb_id_property) {
>> diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c
>> index 11fcd25..c9ac8b9 100644
>> --- a/drivers/gpu/drm/drm_connector.c
>> +++ b/drivers/gpu/drm/drm_connector.c
>> @@ -1051,6 +1051,12 @@ int drm_connector_create_standard_properties(struct drm_device *dev)
>> return -ENOMEM;
>> dev->mode_config.non_desktop_property = prop;
>>
>> + prop = drm_property_create(dev, DRM_MODE_PROP_BLOB,
>> + "HDR_OUTPUT_METADATA", 0);
>> + if (!prop)
>> + return -ENOMEM;
>> + dev->mode_config.hdr_output_metadata_property = prop;
>> +
>> return 0;
>> }
>>
>> diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h
>> index e257b87..54daa54 100644
>> --- a/include/drm/drm_connector.h
>> +++ b/include/drm/drm_connector.h
>> @@ -603,6 +603,13 @@ struct drm_connector_state {
>> * and the connector bpc limitations obtained from edid.
>> */
>> u8 max_bpc;
>> +
>> + /**
>> + * @hdr_output_metadata:
>> + * DRM blob property for HDR output metadata
>> + */
>> + struct drm_property_blob *hdr_output_metadata;
>> + u8 hdr_metadata_changed : 1;
> I think the changed flag is now unused. Should be dropped if so.
I am using this changed flag in my dw-hdmi HDR patch [1] to force set mode_changed.
if (new_state->hdr_metadata_changed)
crtc_state->mode_changed = true;
Maybe this is bad practice and should be handled in some other way?
[1] https://github.com/Kwiboo/linux-rockchip/commit/a9ccea6d3d51001f6b4ab9a1fb600a38e517b9ce
Regards,
Jonas
>
>> };
>>
>> /**
>> @@ -1237,6 +1244,10 @@ struct drm_connector {
>> * &drm_mode_config.connector_free_work.
>> */
>> struct llist_node free_node;
>> +
>> + /* HDR metdata */
>> + struct hdr_output_metadata hdr_output_metadata;
>> + struct hdr_sink_metadata hdr_sink_metadata;
>> };
>>
>> #define obj_to_connector(x) container_of(x, struct drm_connector, base)
>> diff --git a/include/drm/drm_mode_config.h b/include/drm/drm_mode_config.h
>> index 5764ee3..58278cc 100644
>> --- a/include/drm/drm_mode_config.h
>> +++ b/include/drm/drm_mode_config.h
>> @@ -842,6 +842,13 @@ struct drm_mode_config {
>> */
>> struct drm_property *content_protection_property;
>>
>> + /**
>> + * hdr_output_metadata_property: Connector property containing hdr
>> + * metatda. This will be provided by userspace compositors based
>> + * on HDR content
>> + */
>> + struct drm_property *hdr_output_metadata_property;
>> +
>> /* dumb ioctl parameters */
>> uint32_t preferred_depth, prefer_shadow;
>>
>> diff --git a/include/linux/hdmi.h b/include/linux/hdmi.h
>> index 927ad64..6780476 100644
>> --- a/include/linux/hdmi.h
>> +++ b/include/linux/hdmi.h
>> @@ -152,6 +152,16 @@ enum hdmi_content_type {
>> HDMI_CONTENT_TYPE_GAME,
>> };
>>
>> +enum hdmi_metadata_type {
>> + HDMI_STATIC_METADATA_TYPE1 = 1,
>> +};
>> +
>> +enum hdmi_eotf {
>> + HDMI_EOTF_TRADITIONAL_GAMMA_SDR,
>> + HDMI_EOTF_TRADITIONAL_GAMMA_HDR,
>> + HDMI_EOTF_SMPTE_ST2084,
>> +};
>> +
>> struct hdmi_avi_infoframe {
>> enum hdmi_infoframe_type type;
>> unsigned char version;
>> @@ -320,6 +330,22 @@ struct hdmi_vendor_infoframe {
>> unsigned int s3d_ext_data;
>> };
>>
>> +/* HDR Metadata as per 861.G spec */
>> +struct hdr_static_metadata {
>> + __u8 eotf;
>> + __u8 metadata_type;
>> + __u16 max_cll;
>> + __u16 max_fall;
>> + __u16 min_cll;
>> +};
>> +
>> +struct hdr_sink_metadata {
>> + __u32 metadata_type;
>> + union {
>> + struct hdr_static_metadata hdmi_type1;
>> + };
>> +};
>> +
>> int hdmi_vendor_infoframe_init(struct hdmi_vendor_infoframe *frame);
>> ssize_t hdmi_vendor_infoframe_pack(struct hdmi_vendor_infoframe *frame,
>> void *buffer, size_t size);
>> diff --git a/include/uapi/drm/drm_mode.h b/include/uapi/drm/drm_mode.h
>> index 83cd163..997a7e0 100644
>> --- a/include/uapi/drm/drm_mode.h
>> +++ b/include/uapi/drm/drm_mode.h
>> @@ -630,6 +630,29 @@ struct drm_color_lut {
>> __u16 reserved;
>> };
>>
>> +/* HDR Metadata Infoframe as per 861.G spec */
>> +struct hdr_metadata_infoframe {
>> + __u8 eotf;
>> + __u8 metadata_type;
>> + struct {
>> + __u16 x, y;
>> + } display_primaries[3];
>> + struct {
>> + __u16 x, y;
>> + } white_point;
>> + __u16 max_display_mastering_luminance;
>> + __u16 min_display_mastering_luminance;
>> + __u16 max_cll;
>> + __u16 max_fall;
>> +};
>> +
>> +struct hdr_output_metadata {
>> + __u32 metadata_type;
>> + union {
>> + struct hdr_metadata_infoframe hdmi_metadata_type1;
>> + };
>> +};
>> +
>> #define DRM_MODE_PAGE_FLIP_EVENT 0x01
>> #define DRM_MODE_PAGE_FLIP_ASYNC 0x02
>> #define DRM_MODE_PAGE_FLIP_TARGET_ABSOLUTE 0x4
>> --
>> 1.9.1
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 27+ messages in thread* Re: [v10 01/12] drm: Add HDR source metadata property
2019-05-15 19:33 ` Jonas Karlman
@ 2019-05-15 19:45 ` Ville Syrjälä
2019-05-15 19:50 ` Jonas Karlman
0 siblings, 1 reply; 27+ messages in thread
From: Ville Syrjälä @ 2019-05-15 19:45 UTC (permalink / raw)
To: Jonas Karlman
Cc: dcastagna@chromium.org, intel-gfx@lists.freedesktop.org,
emil.l.velikov@gmail.com, dri-devel@lists.freedesktop.org,
Uma Shankar, seanpaul@chromium.org
On Wed, May 15, 2019 at 07:33:10PM +0000, Jonas Karlman wrote:
> On 2019-05-15 21:10, Ville Syrjälä wrote:
> > On Tue, May 14, 2019 at 11:06:23PM +0530, Uma Shankar wrote:
> >> This patch adds a blob property to get HDR metadata
> >> information from userspace. This will be send as part
> >> of AVI Infoframe to panel.
> >>
> >> It also implements get() and set() functions for HDR output
> >> metadata property.The blob data is received from userspace and
> >> saved in connector state, the same is returned as blob in get
> >> property call to userspace.
> >>
> >> v2: Rebase and modified the metadata structure elements
> >> as per Ville's POC changes.
> >>
> >> v3: No Change
> >>
> >> v4: Addressed Shashank's review comments
> >>
> >> v5: Rebase.
> >>
> >> v6: Addressed Brian Starkey's review comments, defined
> >> new structure with header for dynamic metadata scalability.
> >> Merge get/set property functions for metadata in this patch.
> >>
> >> v7: Addressed Jonas Karlman review comments and defined separate
> >> structure for infoframe to better align with CTA 861.G spec. Added
> >> Shashank's RB.
> >>
> >> v8: Addressed Ville's review comments. Moved sink metadata structure
> >> out of uapi headers as suggested by Jonas Karlman.
> >>
> >> v9: Rebase and addressed Jonas Karlman review comments.
> >>
> >> Signed-off-by: Uma Shankar <uma.shankar@intel.com>
> >> Reviewed-by: Shashank Sharma <shashank.sharma@intel.com>
> >> ---
> >> drivers/gpu/drm/drm_atomic.c | 2 ++
> >> drivers/gpu/drm/drm_atomic_uapi.c | 13 +++++++++++++
> >> drivers/gpu/drm/drm_connector.c | 6 ++++++
> >> include/drm/drm_connector.h | 11 +++++++++++
> >> include/drm/drm_mode_config.h | 7 +++++++
> >> include/linux/hdmi.h | 26 ++++++++++++++++++++++++++
> >> include/uapi/drm/drm_mode.h | 23 +++++++++++++++++++++++
> >> 7 files changed, 88 insertions(+)
> >>
> >> diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
> >> index f4924cb..0d27195 100644
> >> --- a/drivers/gpu/drm/drm_atomic.c
> >> +++ b/drivers/gpu/drm/drm_atomic.c
> >> @@ -925,6 +925,8 @@ static void drm_atomic_connector_print_state(struct drm_printer *p,
> >>
> >> drm_printf(p, "connector[%u]: %s\n", connector->base.id, connector->name);
> >> drm_printf(p, "\tcrtc=%s\n", state->crtc ? state->crtc->name : "(null)");
> >> + drm_printf(p, "\thdr_metadata_changed=%d\n",
> >> + state->hdr_metadata_changed);
> >>
> >> if (connector->connector_type == DRM_MODE_CONNECTOR_WRITEBACK)
> >> if (state->writeback_job && state->writeback_job->fb)
> >> diff --git a/drivers/gpu/drm/drm_atomic_uapi.c b/drivers/gpu/drm/drm_atomic_uapi.c
> >> index 4131e66..4aa82c91 100644
> >> --- a/drivers/gpu/drm/drm_atomic_uapi.c
> >> +++ b/drivers/gpu/drm/drm_atomic_uapi.c
> >> @@ -676,6 +676,8 @@ static int drm_atomic_connector_set_property(struct drm_connector *connector,
> >> {
> >> struct drm_device *dev = connector->dev;
> >> struct drm_mode_config *config = &dev->mode_config;
> >> + bool replaced = false;
> >> + int ret;
> >>
> >> if (property == config->prop_crtc_id) {
> >> struct drm_crtc *crtc = drm_crtc_find(dev, file_priv, val);
> >> @@ -726,6 +728,14 @@ static int drm_atomic_connector_set_property(struct drm_connector *connector,
> >> */
> >> if (state->link_status != DRM_LINK_STATUS_GOOD)
> >> state->link_status = val;
> >> + } else if (property == config->hdr_output_metadata_property) {
> >> + ret = drm_atomic_replace_property_blob_from_id(dev,
> >> + &state->hdr_output_metadata,
> >> + val,
> >> + -1, sizeof(struct hdr_output_metadata),
> > Those function arguments are nonsesne for a blob that isn't an array.
> >
> >> + &replaced);
> >> + state->hdr_metadata_changed |= replaced;
> >> + return ret;
> >> } else if (property == config->aspect_ratio_property) {
> >> state->picture_aspect_ratio = val;
> >> } else if (property == config->content_type_property) {
> >> @@ -814,6 +824,9 @@ static int drm_atomic_connector_set_property(struct drm_connector *connector,
> >> *val = state->colorspace;
> >> } else if (property == connector->scaling_mode_property) {
> >> *val = state->scaling_mode;
> >> + } else if (property == config->hdr_output_metadata_property) {
> >> + *val = state->hdr_output_metadata ?
> >> + state->hdr_output_metadata->base.id : 0;
> >> } else if (property == config->content_protection_property) {
> >> *val = state->content_protection;
> >> } else if (property == config->writeback_fb_id_property) {
> >> diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c
> >> index 11fcd25..c9ac8b9 100644
> >> --- a/drivers/gpu/drm/drm_connector.c
> >> +++ b/drivers/gpu/drm/drm_connector.c
> >> @@ -1051,6 +1051,12 @@ int drm_connector_create_standard_properties(struct drm_device *dev)
> >> return -ENOMEM;
> >> dev->mode_config.non_desktop_property = prop;
> >>
> >> + prop = drm_property_create(dev, DRM_MODE_PROP_BLOB,
> >> + "HDR_OUTPUT_METADATA", 0);
> >> + if (!prop)
> >> + return -ENOMEM;
> >> + dev->mode_config.hdr_output_metadata_property = prop;
> >> +
> >> return 0;
> >> }
> >>
> >> diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h
> >> index e257b87..54daa54 100644
> >> --- a/include/drm/drm_connector.h
> >> +++ b/include/drm/drm_connector.h
> >> @@ -603,6 +603,13 @@ struct drm_connector_state {
> >> * and the connector bpc limitations obtained from edid.
> >> */
> >> u8 max_bpc;
> >> +
> >> + /**
> >> + * @hdr_output_metadata:
> >> + * DRM blob property for HDR output metadata
> >> + */
> >> + struct drm_property_blob *hdr_output_metadata;
> >> + u8 hdr_metadata_changed : 1;
> > I think the changed flag is now unused. Should be dropped if so.
>
> I am using this changed flag in my dw-hdmi HDR patch [1] to force set mode_changed.
>
> if (new_state->hdr_metadata_changed)
> crtc_state->mode_changed = true;
>
> Maybe this is bad practice and should be handled in some other way?
Could just check old metadata != new metadata. The i915 patch even
memcmp()s the thing, but I think that's probably overdoing it since
we anyway downgrade the modeset to a fastset whenever possible.
The core doesn't memcmp() either IIRC, so hdr_metadata_changed should
be equal to just comparing the old and new blob pointers.
>
> [1] https://github.com/Kwiboo/linux-rockchip/commit/a9ccea6d3d51001f6b4ab9a1fb600a38e517b9ce
>
> Regards,
> Jonas
> >
> >> };
> >>
> >> /**
> >> @@ -1237,6 +1244,10 @@ struct drm_connector {
> >> * &drm_mode_config.connector_free_work.
> >> */
> >> struct llist_node free_node;
> >> +
> >> + /* HDR metdata */
> >> + struct hdr_output_metadata hdr_output_metadata;
> >> + struct hdr_sink_metadata hdr_sink_metadata;
> >> };
> >>
> >> #define obj_to_connector(x) container_of(x, struct drm_connector, base)
> >> diff --git a/include/drm/drm_mode_config.h b/include/drm/drm_mode_config.h
> >> index 5764ee3..58278cc 100644
> >> --- a/include/drm/drm_mode_config.h
> >> +++ b/include/drm/drm_mode_config.h
> >> @@ -842,6 +842,13 @@ struct drm_mode_config {
> >> */
> >> struct drm_property *content_protection_property;
> >>
> >> + /**
> >> + * hdr_output_metadata_property: Connector property containing hdr
> >> + * metatda. This will be provided by userspace compositors based
> >> + * on HDR content
> >> + */
> >> + struct drm_property *hdr_output_metadata_property;
> >> +
> >> /* dumb ioctl parameters */
> >> uint32_t preferred_depth, prefer_shadow;
> >>
> >> diff --git a/include/linux/hdmi.h b/include/linux/hdmi.h
> >> index 927ad64..6780476 100644
> >> --- a/include/linux/hdmi.h
> >> +++ b/include/linux/hdmi.h
> >> @@ -152,6 +152,16 @@ enum hdmi_content_type {
> >> HDMI_CONTENT_TYPE_GAME,
> >> };
> >>
> >> +enum hdmi_metadata_type {
> >> + HDMI_STATIC_METADATA_TYPE1 = 1,
> >> +};
> >> +
> >> +enum hdmi_eotf {
> >> + HDMI_EOTF_TRADITIONAL_GAMMA_SDR,
> >> + HDMI_EOTF_TRADITIONAL_GAMMA_HDR,
> >> + HDMI_EOTF_SMPTE_ST2084,
> >> +};
> >> +
> >> struct hdmi_avi_infoframe {
> >> enum hdmi_infoframe_type type;
> >> unsigned char version;
> >> @@ -320,6 +330,22 @@ struct hdmi_vendor_infoframe {
> >> unsigned int s3d_ext_data;
> >> };
> >>
> >> +/* HDR Metadata as per 861.G spec */
> >> +struct hdr_static_metadata {
> >> + __u8 eotf;
> >> + __u8 metadata_type;
> >> + __u16 max_cll;
> >> + __u16 max_fall;
> >> + __u16 min_cll;
> >> +};
> >> +
> >> +struct hdr_sink_metadata {
> >> + __u32 metadata_type;
> >> + union {
> >> + struct hdr_static_metadata hdmi_type1;
> >> + };
> >> +};
> >> +
> >> int hdmi_vendor_infoframe_init(struct hdmi_vendor_infoframe *frame);
> >> ssize_t hdmi_vendor_infoframe_pack(struct hdmi_vendor_infoframe *frame,
> >> void *buffer, size_t size);
> >> diff --git a/include/uapi/drm/drm_mode.h b/include/uapi/drm/drm_mode.h
> >> index 83cd163..997a7e0 100644
> >> --- a/include/uapi/drm/drm_mode.h
> >> +++ b/include/uapi/drm/drm_mode.h
> >> @@ -630,6 +630,29 @@ struct drm_color_lut {
> >> __u16 reserved;
> >> };
> >>
> >> +/* HDR Metadata Infoframe as per 861.G spec */
> >> +struct hdr_metadata_infoframe {
> >> + __u8 eotf;
> >> + __u8 metadata_type;
> >> + struct {
> >> + __u16 x, y;
> >> + } display_primaries[3];
> >> + struct {
> >> + __u16 x, y;
> >> + } white_point;
> >> + __u16 max_display_mastering_luminance;
> >> + __u16 min_display_mastering_luminance;
> >> + __u16 max_cll;
> >> + __u16 max_fall;
> >> +};
> >> +
> >> +struct hdr_output_metadata {
> >> + __u32 metadata_type;
> >> + union {
> >> + struct hdr_metadata_infoframe hdmi_metadata_type1;
> >> + };
> >> +};
> >> +
> >> #define DRM_MODE_PAGE_FLIP_EVENT 0x01
> >> #define DRM_MODE_PAGE_FLIP_ASYNC 0x02
> >> #define DRM_MODE_PAGE_FLIP_TARGET_ABSOLUTE 0x4
> >> --
> >> 1.9.1
--
Ville Syrjälä
Intel
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 27+ messages in thread* Re: [v10 01/12] drm: Add HDR source metadata property
2019-05-15 19:45 ` Ville Syrjälä
@ 2019-05-15 19:50 ` Jonas Karlman
0 siblings, 0 replies; 27+ messages in thread
From: Jonas Karlman @ 2019-05-15 19:50 UTC (permalink / raw)
To: Ville Syrjälä
Cc: dcastagna@chromium.org, intel-gfx@lists.freedesktop.org,
dri-devel@lists.freedesktop.org, seanpaul@chromium.org
On 2019-05-15 21:45, Ville Syrjälä wrote:
> On Wed, May 15, 2019 at 07:33:10PM +0000, Jonas Karlman wrote:
>> On 2019-05-15 21:10, Ville Syrjälä wrote:
>>> On Tue, May 14, 2019 at 11:06:23PM +0530, Uma Shankar wrote:
>>>> This patch adds a blob property to get HDR metadata
>>>> information from userspace. This will be send as part
>>>> of AVI Infoframe to panel.
>>>>
>>>> It also implements get() and set() functions for HDR output
>>>> metadata property.The blob data is received from userspace and
>>>> saved in connector state, the same is returned as blob in get
>>>> property call to userspace.
>>>>
>>>> v2: Rebase and modified the metadata structure elements
>>>> as per Ville's POC changes.
>>>>
>>>> v3: No Change
>>>>
>>>> v4: Addressed Shashank's review comments
>>>>
>>>> v5: Rebase.
>>>>
>>>> v6: Addressed Brian Starkey's review comments, defined
>>>> new structure with header for dynamic metadata scalability.
>>>> Merge get/set property functions for metadata in this patch.
>>>>
>>>> v7: Addressed Jonas Karlman review comments and defined separate
>>>> structure for infoframe to better align with CTA 861.G spec. Added
>>>> Shashank's RB.
>>>>
>>>> v8: Addressed Ville's review comments. Moved sink metadata structure
>>>> out of uapi headers as suggested by Jonas Karlman.
>>>>
>>>> v9: Rebase and addressed Jonas Karlman review comments.
>>>>
>>>> Signed-off-by: Uma Shankar <uma.shankar@intel.com>
>>>> Reviewed-by: Shashank Sharma <shashank.sharma@intel.com>
>>>> ---
>>>> drivers/gpu/drm/drm_atomic.c | 2 ++
>>>> drivers/gpu/drm/drm_atomic_uapi.c | 13 +++++++++++++
>>>> drivers/gpu/drm/drm_connector.c | 6 ++++++
>>>> include/drm/drm_connector.h | 11 +++++++++++
>>>> include/drm/drm_mode_config.h | 7 +++++++
>>>> include/linux/hdmi.h | 26 ++++++++++++++++++++++++++
>>>> include/uapi/drm/drm_mode.h | 23 +++++++++++++++++++++++
>>>> 7 files changed, 88 insertions(+)
>>>>
>>>> diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
>>>> index f4924cb..0d27195 100644
>>>> --- a/drivers/gpu/drm/drm_atomic.c
>>>> +++ b/drivers/gpu/drm/drm_atomic.c
>>>> @@ -925,6 +925,8 @@ static void drm_atomic_connector_print_state(struct drm_printer *p,
>>>>
>>>> drm_printf(p, "connector[%u]: %s\n", connector->base.id, connector->name);
>>>> drm_printf(p, "\tcrtc=%s\n", state->crtc ? state->crtc->name : "(null)");
>>>> + drm_printf(p, "\thdr_metadata_changed=%d\n",
>>>> + state->hdr_metadata_changed);
>>>>
>>>> if (connector->connector_type == DRM_MODE_CONNECTOR_WRITEBACK)
>>>> if (state->writeback_job && state->writeback_job->fb)
>>>> diff --git a/drivers/gpu/drm/drm_atomic_uapi.c b/drivers/gpu/drm/drm_atomic_uapi.c
>>>> index 4131e66..4aa82c91 100644
>>>> --- a/drivers/gpu/drm/drm_atomic_uapi.c
>>>> +++ b/drivers/gpu/drm/drm_atomic_uapi.c
>>>> @@ -676,6 +676,8 @@ static int drm_atomic_connector_set_property(struct drm_connector *connector,
>>>> {
>>>> struct drm_device *dev = connector->dev;
>>>> struct drm_mode_config *config = &dev->mode_config;
>>>> + bool replaced = false;
>>>> + int ret;
>>>>
>>>> if (property == config->prop_crtc_id) {
>>>> struct drm_crtc *crtc = drm_crtc_find(dev, file_priv, val);
>>>> @@ -726,6 +728,14 @@ static int drm_atomic_connector_set_property(struct drm_connector *connector,
>>>> */
>>>> if (state->link_status != DRM_LINK_STATUS_GOOD)
>>>> state->link_status = val;
>>>> + } else if (property == config->hdr_output_metadata_property) {
>>>> + ret = drm_atomic_replace_property_blob_from_id(dev,
>>>> + &state->hdr_output_metadata,
>>>> + val,
>>>> + -1, sizeof(struct hdr_output_metadata),
>>> Those function arguments are nonsesne for a blob that isn't an array.
>>>
>>>> + &replaced);
>>>> + state->hdr_metadata_changed |= replaced;
>>>> + return ret;
>>>> } else if (property == config->aspect_ratio_property) {
>>>> state->picture_aspect_ratio = val;
>>>> } else if (property == config->content_type_property) {
>>>> @@ -814,6 +824,9 @@ static int drm_atomic_connector_set_property(struct drm_connector *connector,
>>>> *val = state->colorspace;
>>>> } else if (property == connector->scaling_mode_property) {
>>>> *val = state->scaling_mode;
>>>> + } else if (property == config->hdr_output_metadata_property) {
>>>> + *val = state->hdr_output_metadata ?
>>>> + state->hdr_output_metadata->base.id : 0;
>>>> } else if (property == config->content_protection_property) {
>>>> *val = state->content_protection;
>>>> } else if (property == config->writeback_fb_id_property) {
>>>> diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c
>>>> index 11fcd25..c9ac8b9 100644
>>>> --- a/drivers/gpu/drm/drm_connector.c
>>>> +++ b/drivers/gpu/drm/drm_connector.c
>>>> @@ -1051,6 +1051,12 @@ int drm_connector_create_standard_properties(struct drm_device *dev)
>>>> return -ENOMEM;
>>>> dev->mode_config.non_desktop_property = prop;
>>>>
>>>> + prop = drm_property_create(dev, DRM_MODE_PROP_BLOB,
>>>> + "HDR_OUTPUT_METADATA", 0);
>>>> + if (!prop)
>>>> + return -ENOMEM;
>>>> + dev->mode_config.hdr_output_metadata_property = prop;
>>>> +
>>>> return 0;
>>>> }
>>>>
>>>> diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h
>>>> index e257b87..54daa54 100644
>>>> --- a/include/drm/drm_connector.h
>>>> +++ b/include/drm/drm_connector.h
>>>> @@ -603,6 +603,13 @@ struct drm_connector_state {
>>>> * and the connector bpc limitations obtained from edid.
>>>> */
>>>> u8 max_bpc;
>>>> +
>>>> + /**
>>>> + * @hdr_output_metadata:
>>>> + * DRM blob property for HDR output metadata
>>>> + */
>>>> + struct drm_property_blob *hdr_output_metadata;
>>>> + u8 hdr_metadata_changed : 1;
>>> I think the changed flag is now unused. Should be dropped if so.
>> I am using this changed flag in my dw-hdmi HDR patch [1] to force set mode_changed.
>>
>> if (new_state->hdr_metadata_changed)
>> crtc_state->mode_changed = true;
>>
>> Maybe this is bad practice and should be handled in some other way?
> Could just check old metadata != new metadata. The i915 patch even
> memcmp()s the thing, but I think that's probably overdoing it since
> we anyway downgrade the modeset to a fastset whenever possible.
>
> The core doesn't memcmp() either IIRC, so hdr_metadata_changed should
> be equal to just comparing the old and new blob pointers.
Thanks for the pointers, I will probably end up following what the i915 code does once it is fully ready.
Regards,
Jonas
>
>> [1] https://github.com/Kwiboo/linux-rockchip/commit/a9ccea6d3d51001f6b4ab9a1fb600a38e517b9ce
>>
>> Regards,
>> Jonas
>>>> };
>>>>
>>>> /**
>>>> @@ -1237,6 +1244,10 @@ struct drm_connector {
>>>> * &drm_mode_config.connector_free_work.
>>>> */
>>>> struct llist_node free_node;
>>>> +
>>>> + /* HDR metdata */
>>>> + struct hdr_output_metadata hdr_output_metadata;
>>>> + struct hdr_sink_metadata hdr_sink_metadata;
>>>> };
>>>>
>>>> #define obj_to_connector(x) container_of(x, struct drm_connector, base)
>>>> diff --git a/include/drm/drm_mode_config.h b/include/drm/drm_mode_config.h
>>>> index 5764ee3..58278cc 100644
>>>> --- a/include/drm/drm_mode_config.h
>>>> +++ b/include/drm/drm_mode_config.h
>>>> @@ -842,6 +842,13 @@ struct drm_mode_config {
>>>> */
>>>> struct drm_property *content_protection_property;
>>>>
>>>> + /**
>>>> + * hdr_output_metadata_property: Connector property containing hdr
>>>> + * metatda. This will be provided by userspace compositors based
>>>> + * on HDR content
>>>> + */
>>>> + struct drm_property *hdr_output_metadata_property;
>>>> +
>>>> /* dumb ioctl parameters */
>>>> uint32_t preferred_depth, prefer_shadow;
>>>>
>>>> diff --git a/include/linux/hdmi.h b/include/linux/hdmi.h
>>>> index 927ad64..6780476 100644
>>>> --- a/include/linux/hdmi.h
>>>> +++ b/include/linux/hdmi.h
>>>> @@ -152,6 +152,16 @@ enum hdmi_content_type {
>>>> HDMI_CONTENT_TYPE_GAME,
>>>> };
>>>>
>>>> +enum hdmi_metadata_type {
>>>> + HDMI_STATIC_METADATA_TYPE1 = 1,
>>>> +};
>>>> +
>>>> +enum hdmi_eotf {
>>>> + HDMI_EOTF_TRADITIONAL_GAMMA_SDR,
>>>> + HDMI_EOTF_TRADITIONAL_GAMMA_HDR,
>>>> + HDMI_EOTF_SMPTE_ST2084,
>>>> +};
>>>> +
>>>> struct hdmi_avi_infoframe {
>>>> enum hdmi_infoframe_type type;
>>>> unsigned char version;
>>>> @@ -320,6 +330,22 @@ struct hdmi_vendor_infoframe {
>>>> unsigned int s3d_ext_data;
>>>> };
>>>>
>>>> +/* HDR Metadata as per 861.G spec */
>>>> +struct hdr_static_metadata {
>>>> + __u8 eotf;
>>>> + __u8 metadata_type;
>>>> + __u16 max_cll;
>>>> + __u16 max_fall;
>>>> + __u16 min_cll;
>>>> +};
>>>> +
>>>> +struct hdr_sink_metadata {
>>>> + __u32 metadata_type;
>>>> + union {
>>>> + struct hdr_static_metadata hdmi_type1;
>>>> + };
>>>> +};
>>>> +
>>>> int hdmi_vendor_infoframe_init(struct hdmi_vendor_infoframe *frame);
>>>> ssize_t hdmi_vendor_infoframe_pack(struct hdmi_vendor_infoframe *frame,
>>>> void *buffer, size_t size);
>>>> diff --git a/include/uapi/drm/drm_mode.h b/include/uapi/drm/drm_mode.h
>>>> index 83cd163..997a7e0 100644
>>>> --- a/include/uapi/drm/drm_mode.h
>>>> +++ b/include/uapi/drm/drm_mode.h
>>>> @@ -630,6 +630,29 @@ struct drm_color_lut {
>>>> __u16 reserved;
>>>> };
>>>>
>>>> +/* HDR Metadata Infoframe as per 861.G spec */
>>>> +struct hdr_metadata_infoframe {
>>>> + __u8 eotf;
>>>> + __u8 metadata_type;
>>>> + struct {
>>>> + __u16 x, y;
>>>> + } display_primaries[3];
>>>> + struct {
>>>> + __u16 x, y;
>>>> + } white_point;
>>>> + __u16 max_display_mastering_luminance;
>>>> + __u16 min_display_mastering_luminance;
>>>> + __u16 max_cll;
>>>> + __u16 max_fall;
>>>> +};
>>>> +
>>>> +struct hdr_output_metadata {
>>>> + __u32 metadata_type;
>>>> + union {
>>>> + struct hdr_metadata_infoframe hdmi_metadata_type1;
>>>> + };
>>>> +};
>>>> +
>>>> #define DRM_MODE_PAGE_FLIP_EVENT 0x01
>>>> #define DRM_MODE_PAGE_FLIP_ASYNC 0x02
>>>> #define DRM_MODE_PAGE_FLIP_TARGET_ABSOLUTE 0x4
>>>> --
>>>> 1.9.1
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [v10 01/12] drm: Add HDR source metadata property
2019-05-15 19:10 ` Ville Syrjälä
2019-05-15 19:33 ` Jonas Karlman
@ 2019-05-16 7:21 ` Shankar, Uma
1 sibling, 0 replies; 27+ messages in thread
From: Shankar, Uma @ 2019-05-16 7:21 UTC (permalink / raw)
To: Ville Syrjälä
Cc: dcastagna@chromium.org, jonas@kwiboo.se,
intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
seanpaul@chromium.org
>-----Original Message-----
>From: Ville Syrjälä [mailto:ville.syrjala@linux.intel.com]
>Sent: Thursday, May 16, 2019 12:40 AM
>To: Shankar, Uma <uma.shankar@intel.com>
>Cc: intel-gfx@lists.freedesktop.org; dri-devel@lists.freedesktop.org;
>maarten.lankhorst@linux.intel.com; Sharma, Shashank
><shashank.sharma@intel.com>; emil.l.velikov@gmail.com; brian.starkey@arm.com;
>dcastagna@chromium.org; seanpaul@chromium.org; Roper, Matthew D
><matthew.d.roper@intel.com>; jonas@kwiboo.se
>Subject: Re: [v10 01/12] drm: Add HDR source metadata property
>
>On Tue, May 14, 2019 at 11:06:23PM +0530, Uma Shankar wrote:
>> This patch adds a blob property to get HDR metadata information from
>> userspace. This will be send as part of AVI Infoframe to panel.
>>
>> It also implements get() and set() functions for HDR output metadata
>> property.The blob data is received from userspace and saved in
>> connector state, the same is returned as blob in get property call to
>> userspace.
>>
>> v2: Rebase and modified the metadata structure elements as per Ville's
>> POC changes.
>>
>> v3: No Change
>>
>> v4: Addressed Shashank's review comments
>>
>> v5: Rebase.
>>
>> v6: Addressed Brian Starkey's review comments, defined new structure
>> with header for dynamic metadata scalability.
>> Merge get/set property functions for metadata in this patch.
>>
>> v7: Addressed Jonas Karlman review comments and defined separate
>> structure for infoframe to better align with CTA 861.G spec. Added
>> Shashank's RB.
>>
>> v8: Addressed Ville's review comments. Moved sink metadata structure
>> out of uapi headers as suggested by Jonas Karlman.
>>
>> v9: Rebase and addressed Jonas Karlman review comments.
>>
>> Signed-off-by: Uma Shankar <uma.shankar@intel.com>
>> Reviewed-by: Shashank Sharma <shashank.sharma@intel.com>
>> ---
>> drivers/gpu/drm/drm_atomic.c | 2 ++
>> drivers/gpu/drm/drm_atomic_uapi.c | 13 +++++++++++++
>> drivers/gpu/drm/drm_connector.c | 6 ++++++
>> include/drm/drm_connector.h | 11 +++++++++++
>> include/drm/drm_mode_config.h | 7 +++++++
>> include/linux/hdmi.h | 26 ++++++++++++++++++++++++++
>> include/uapi/drm/drm_mode.h | 23 +++++++++++++++++++++++
>> 7 files changed, 88 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/drm_atomic.c
>> b/drivers/gpu/drm/drm_atomic.c index f4924cb..0d27195 100644
>> --- a/drivers/gpu/drm/drm_atomic.c
>> +++ b/drivers/gpu/drm/drm_atomic.c
>> @@ -925,6 +925,8 @@ static void
>> drm_atomic_connector_print_state(struct drm_printer *p,
>>
>> drm_printf(p, "connector[%u]: %s\n", connector->base.id, connector-
>>name);
>> drm_printf(p, "\tcrtc=%s\n", state->crtc ? state->crtc->name :
>> "(null)");
>> + drm_printf(p, "\thdr_metadata_changed=%d\n",
>> + state->hdr_metadata_changed);
>>
>> if (connector->connector_type == DRM_MODE_CONNECTOR_WRITEBACK)
>> if (state->writeback_job && state->writeback_job->fb) diff --git
>> a/drivers/gpu/drm/drm_atomic_uapi.c
>> b/drivers/gpu/drm/drm_atomic_uapi.c
>> index 4131e66..4aa82c91 100644
>> --- a/drivers/gpu/drm/drm_atomic_uapi.c
>> +++ b/drivers/gpu/drm/drm_atomic_uapi.c
>> @@ -676,6 +676,8 @@ static int
>> drm_atomic_connector_set_property(struct drm_connector *connector, {
>> struct drm_device *dev = connector->dev;
>> struct drm_mode_config *config = &dev->mode_config;
>> + bool replaced = false;
>> + int ret;
>>
>> if (property == config->prop_crtc_id) {
>> struct drm_crtc *crtc = drm_crtc_find(dev, file_priv, val); @@
>> -726,6 +728,14 @@ static int drm_atomic_connector_set_property(struct
>drm_connector *connector,
>> */
>> if (state->link_status != DRM_LINK_STATUS_GOOD)
>> state->link_status = val;
>> + } else if (property == config->hdr_output_metadata_property) {
>> + ret = drm_atomic_replace_property_blob_from_id(dev,
>> + &state->hdr_output_metadata,
>> + val,
>> + -1, sizeof(struct hdr_output_metadata),
>
>Those function arguments are nonsesne for a blob that isn't an array.
Hmm, just to clarify - Since this is a fixed struct being passed. We should make
ret = drm_atomic_replace_property_blob_from_id(dev,
&state->hdr_output_metadata,
val,
sizeof(struct hdr_output_metadata), -1,
&replaced);
Basically have check for expected_size rather expected_elem_size.
Hope this is what you meant.
>> + state->hdr_metadata_changed |= replaced;
>> + return ret;
>> } else if (property == config->aspect_ratio_property) {
>> state->picture_aspect_ratio = val;
>> } else if (property == config->content_type_property) { @@ -814,6
>> +824,9 @@ static int drm_atomic_connector_set_property(struct drm_connector
>*connector,
>> *val = state->colorspace;
>> } else if (property == connector->scaling_mode_property) {
>> *val = state->scaling_mode;
>> + } else if (property == config->hdr_output_metadata_property) {
>> + *val = state->hdr_output_metadata ?
>> + state->hdr_output_metadata->base.id : 0;
>> } else if (property == config->content_protection_property) {
>> *val = state->content_protection;
>> } else if (property == config->writeback_fb_id_property) { diff
>> --git a/drivers/gpu/drm/drm_connector.c
>> b/drivers/gpu/drm/drm_connector.c index 11fcd25..c9ac8b9 100644
>> --- a/drivers/gpu/drm/drm_connector.c
>> +++ b/drivers/gpu/drm/drm_connector.c
>> @@ -1051,6 +1051,12 @@ int drm_connector_create_standard_properties(struct
>drm_device *dev)
>> return -ENOMEM;
>> dev->mode_config.non_desktop_property = prop;
>>
>> + prop = drm_property_create(dev, DRM_MODE_PROP_BLOB,
>> + "HDR_OUTPUT_METADATA", 0);
>> + if (!prop)
>> + return -ENOMEM;
>> + dev->mode_config.hdr_output_metadata_property = prop;
>> +
>> return 0;
>> }
>>
>> diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h
>> index e257b87..54daa54 100644
>> --- a/include/drm/drm_connector.h
>> +++ b/include/drm/drm_connector.h
>> @@ -603,6 +603,13 @@ struct drm_connector_state {
>> * and the connector bpc limitations obtained from edid.
>> */
>> u8 max_bpc;
>> +
>> + /**
>> + * @hdr_output_metadata:
>> + * DRM blob property for HDR output metadata
>> + */
>> + struct drm_property_blob *hdr_output_metadata;
>> + u8 hdr_metadata_changed : 1;
>
>I think the changed flag is now unused. Should be dropped if so.
Ok Sure, will drop this.
>> };
>>
>> /**
>> @@ -1237,6 +1244,10 @@ struct drm_connector {
>> * &drm_mode_config.connector_free_work.
>> */
>> struct llist_node free_node;
>> +
>> + /* HDR metdata */
>> + struct hdr_output_metadata hdr_output_metadata;
>> + struct hdr_sink_metadata hdr_sink_metadata;
>> };
>>
>> #define obj_to_connector(x) container_of(x, struct drm_connector,
>> base) diff --git a/include/drm/drm_mode_config.h
>> b/include/drm/drm_mode_config.h index 5764ee3..58278cc 100644
>> --- a/include/drm/drm_mode_config.h
>> +++ b/include/drm/drm_mode_config.h
>> @@ -842,6 +842,13 @@ struct drm_mode_config {
>> */
>> struct drm_property *content_protection_property;
>>
>> + /**
>> + * hdr_output_metadata_property: Connector property containing hdr
>> + * metatda. This will be provided by userspace compositors based
>> + * on HDR content
>> + */
>> + struct drm_property *hdr_output_metadata_property;
>> +
>> /* dumb ioctl parameters */
>> uint32_t preferred_depth, prefer_shadow;
>>
>> diff --git a/include/linux/hdmi.h b/include/linux/hdmi.h index
>> 927ad64..6780476 100644
>> --- a/include/linux/hdmi.h
>> +++ b/include/linux/hdmi.h
>> @@ -152,6 +152,16 @@ enum hdmi_content_type {
>> HDMI_CONTENT_TYPE_GAME,
>> };
>>
>> +enum hdmi_metadata_type {
>> + HDMI_STATIC_METADATA_TYPE1 = 1,
>> +};
>> +
>> +enum hdmi_eotf {
>> + HDMI_EOTF_TRADITIONAL_GAMMA_SDR,
>> + HDMI_EOTF_TRADITIONAL_GAMMA_HDR,
>> + HDMI_EOTF_SMPTE_ST2084,
>> +};
>> +
>> struct hdmi_avi_infoframe {
>> enum hdmi_infoframe_type type;
>> unsigned char version;
>> @@ -320,6 +330,22 @@ struct hdmi_vendor_infoframe {
>> unsigned int s3d_ext_data;
>> };
>>
>> +/* HDR Metadata as per 861.G spec */
>> +struct hdr_static_metadata {
>> + __u8 eotf;
>> + __u8 metadata_type;
>> + __u16 max_cll;
>> + __u16 max_fall;
>> + __u16 min_cll;
>> +};
>> +
>> +struct hdr_sink_metadata {
>> + __u32 metadata_type;
>> + union {
>> + struct hdr_static_metadata hdmi_type1;
>> + };
>> +};
>> +
>> int hdmi_vendor_infoframe_init(struct hdmi_vendor_infoframe *frame);
>> ssize_t hdmi_vendor_infoframe_pack(struct hdmi_vendor_infoframe *frame,
>> void *buffer, size_t size);
>> diff --git a/include/uapi/drm/drm_mode.h b/include/uapi/drm/drm_mode.h
>> index 83cd163..997a7e0 100644
>> --- a/include/uapi/drm/drm_mode.h
>> +++ b/include/uapi/drm/drm_mode.h
>> @@ -630,6 +630,29 @@ struct drm_color_lut {
>> __u16 reserved;
>> };
>>
>> +/* HDR Metadata Infoframe as per 861.G spec */ struct
>> +hdr_metadata_infoframe {
>> + __u8 eotf;
>> + __u8 metadata_type;
>> + struct {
>> + __u16 x, y;
>> + } display_primaries[3];
>> + struct {
>> + __u16 x, y;
>> + } white_point;
>> + __u16 max_display_mastering_luminance;
>> + __u16 min_display_mastering_luminance;
>> + __u16 max_cll;
>> + __u16 max_fall;
>> +};
>> +
>> +struct hdr_output_metadata {
>> + __u32 metadata_type;
>> + union {
>> + struct hdr_metadata_infoframe hdmi_metadata_type1;
>> + };
>> +};
>> +
>> #define DRM_MODE_PAGE_FLIP_EVENT 0x01 #define
>> DRM_MODE_PAGE_FLIP_ASYNC 0x02 #define
>> DRM_MODE_PAGE_FLIP_TARGET_ABSOLUTE 0x4
>> --
>> 1.9.1
>
>--
>Ville Syrjälä
>Intel
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 27+ messages in thread
* [v10 02/12] drm: Add reference counting on HDR metadata blob
2019-05-14 17:36 [v10 00/12] Add HDR Metadata Parsing and handling in DRM layer Uma Shankar
2019-05-14 17:36 ` [v10 01/12] drm: Add HDR source metadata property Uma Shankar
@ 2019-05-14 17:36 ` Uma Shankar
2019-05-14 17:36 ` [v10 03/12] drm: Parse HDR metadata info from EDID Uma Shankar
` (9 subsequent siblings)
11 siblings, 0 replies; 27+ messages in thread
From: Uma Shankar @ 2019-05-14 17:36 UTC (permalink / raw)
To: intel-gfx, dri-devel; +Cc: dcastagna, jonas, seanpaul
From: Jonas Karlman <jonas@kwiboo.se>
This adds reference count for HDR metadata blob,
handled as part of duplicate and destroy connector
state functions.
Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Signed-off-by: Uma Shankar <uma.shankar@intel.com>
---
drivers/gpu/drm/drm_atomic_state_helper.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/gpu/drm/drm_atomic_state_helper.c b/drivers/gpu/drm/drm_atomic_state_helper.c
index ac929f6..8f49952 100644
--- a/drivers/gpu/drm/drm_atomic_state_helper.c
+++ b/drivers/gpu/drm/drm_atomic_state_helper.c
@@ -391,6 +391,10 @@ void drm_atomic_helper_connector_reset(struct drm_connector *connector)
drm_connector_get(connector);
state->commit = NULL;
+ if (state->hdr_output_metadata)
+ drm_property_blob_get(state->hdr_output_metadata);
+ state->hdr_metadata_changed = false;
+
/* Don't copy over a writeback job, they are used only once */
state->writeback_job = NULL;
}
@@ -438,6 +442,8 @@ struct drm_connector_state *
if (state->writeback_job)
drm_writeback_cleanup_job(state->writeback_job);
+
+ drm_property_blob_put(state->hdr_output_metadata);
}
EXPORT_SYMBOL(__drm_atomic_helper_connector_destroy_state);
--
1.9.1
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 27+ messages in thread* [v10 03/12] drm: Parse HDR metadata info from EDID
2019-05-14 17:36 [v10 00/12] Add HDR Metadata Parsing and handling in DRM layer Uma Shankar
2019-05-14 17:36 ` [v10 01/12] drm: Add HDR source metadata property Uma Shankar
2019-05-14 17:36 ` [v10 02/12] drm: Add reference counting on HDR metadata blob Uma Shankar
@ 2019-05-14 17:36 ` Uma Shankar
2019-05-15 19:36 ` Ville Syrjälä
2019-05-14 17:36 ` [v10 04/12] drm: Enable HDR infoframe support Uma Shankar
` (8 subsequent siblings)
11 siblings, 1 reply; 27+ messages in thread
From: Uma Shankar @ 2019-05-14 17:36 UTC (permalink / raw)
To: intel-gfx, dri-devel; +Cc: dcastagna, jonas, seanpaul
HDR metadata block is introduced in CEA-861.3 spec.
Parsing the same to get the panel's HDR metadata.
v2: Rebase and added Ville's POC changes to the patch.
v3: No Change
v4: Addressed Shashank's review comments
v5: Addressed Shashank's comment and added his RB.
v6: Addressed Jonas Karlman review comments.
v7: Adressed Ville's review comments and fixed the issue
with length handling.
Signed-off-by: Uma Shankar <uma.shankar@intel.com>
Reviewed-by: Shashank Sharma <shashank.sharma@intel.com>
---
drivers/gpu/drm/drm_edid.c | 49 ++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 49 insertions(+)
diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
index 852bdd8..2e0b5be 100644
--- a/drivers/gpu/drm/drm_edid.c
+++ b/drivers/gpu/drm/drm_edid.c
@@ -2852,6 +2852,7 @@ static int drm_cvt_modes(struct drm_connector *connector,
#define VIDEO_BLOCK 0x02
#define VENDOR_BLOCK 0x03
#define SPEAKER_BLOCK 0x04
+#define HDR_STATIC_METADATA_BLOCK 0x6
#define USE_EXTENDED_TAG 0x07
#define EXT_VIDEO_CAPABILITY_BLOCK 0x00
#define EXT_VIDEO_DATA_BLOCK_420 0x0E
@@ -3834,6 +3835,52 @@ static void fixup_detailed_cea_mode_clock(struct drm_display_mode *mode)
mode->clock = clock;
}
+static bool cea_db_is_hdmi_hdr_metadata_block(const u8 *db)
+{
+ if (cea_db_tag(db) != USE_EXTENDED_TAG)
+ return false;
+
+ if (db[1] != HDR_STATIC_METADATA_BLOCK)
+ return false;
+
+ return true;
+}
+
+static uint8_t eotf_supported(const u8 *edid_ext)
+{
+ return edid_ext[2] &
+ (BIT(HDMI_EOTF_TRADITIONAL_GAMMA_SDR) |
+ BIT(HDMI_EOTF_TRADITIONAL_GAMMA_HDR) |
+ BIT(HDMI_EOTF_SMPTE_ST2084));
+}
+
+static uint8_t hdr_metadata_type(const u8 *edid_ext)
+{
+ return edid_ext[3] &
+ BIT(HDMI_STATIC_METADATA_TYPE1);
+}
+
+static void
+drm_parse_hdr_metadata_block(struct drm_connector *connector, const u8 *db)
+{
+ u16 len;
+
+ len = cea_db_payload_len(db);
+ if (len >= 3) {
+ connector->hdr_sink_metadata.hdmi_type1.eotf =
+ eotf_supported(db);
+ connector->hdr_sink_metadata.hdmi_type1.metadata_type =
+ hdr_metadata_type(db);
+ }
+
+ if (len >= 4)
+ connector->hdr_sink_metadata.hdmi_type1.max_cll = db[4];
+ if (len >= 5)
+ connector->hdr_sink_metadata.hdmi_type1.max_fall = db[5];
+ if (len >= 6)
+ connector->hdr_sink_metadata.hdmi_type1.min_cll = db[6];
+}
+
static void
drm_parse_hdmi_vsdb_audio(struct drm_connector *connector, const u8 *db)
{
@@ -4461,6 +4508,8 @@ static void drm_parse_cea_ext(struct drm_connector *connector,
drm_parse_y420cmdb_bitmap(connector, db);
if (cea_db_is_vcdb(db))
drm_parse_vcdb(connector, db);
+ if (cea_db_is_hdmi_hdr_metadata_block(db))
+ drm_parse_hdr_metadata_block(connector, db);
}
}
--
1.9.1
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 27+ messages in thread* Re: [v10 03/12] drm: Parse HDR metadata info from EDID
2019-05-14 17:36 ` [v10 03/12] drm: Parse HDR metadata info from EDID Uma Shankar
@ 2019-05-15 19:36 ` Ville Syrjälä
2019-05-16 7:25 ` Shankar, Uma
0 siblings, 1 reply; 27+ messages in thread
From: Ville Syrjälä @ 2019-05-15 19:36 UTC (permalink / raw)
To: Uma Shankar; +Cc: dcastagna, jonas, intel-gfx, dri-devel, seanpaul
On Tue, May 14, 2019 at 11:06:25PM +0530, Uma Shankar wrote:
> HDR metadata block is introduced in CEA-861.3 spec.
> Parsing the same to get the panel's HDR metadata.
>
> v2: Rebase and added Ville's POC changes to the patch.
>
> v3: No Change
>
> v4: Addressed Shashank's review comments
>
> v5: Addressed Shashank's comment and added his RB.
>
> v6: Addressed Jonas Karlman review comments.
>
> v7: Adressed Ville's review comments and fixed the issue
> with length handling.
>
> Signed-off-by: Uma Shankar <uma.shankar@intel.com>
> Reviewed-by: Shashank Sharma <shashank.sharma@intel.com>
> ---
> drivers/gpu/drm/drm_edid.c | 49 ++++++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 49 insertions(+)
>
> diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
> index 852bdd8..2e0b5be 100644
> --- a/drivers/gpu/drm/drm_edid.c
> +++ b/drivers/gpu/drm/drm_edid.c
> @@ -2852,6 +2852,7 @@ static int drm_cvt_modes(struct drm_connector *connector,
> #define VIDEO_BLOCK 0x02
> #define VENDOR_BLOCK 0x03
> #define SPEAKER_BLOCK 0x04
> +#define HDR_STATIC_METADATA_BLOCK 0x6
> #define USE_EXTENDED_TAG 0x07
> #define EXT_VIDEO_CAPABILITY_BLOCK 0x00
> #define EXT_VIDEO_DATA_BLOCK_420 0x0E
> @@ -3834,6 +3835,52 @@ static void fixup_detailed_cea_mode_clock(struct drm_display_mode *mode)
> mode->clock = clock;
> }
>
> +static bool cea_db_is_hdmi_hdr_metadata_block(const u8 *db)
> +{
> + if (cea_db_tag(db) != USE_EXTENDED_TAG)
> + return false;
> +
> + if (db[1] != HDR_STATIC_METADATA_BLOCK)
> + return false;
> +
> + return true;
> +}
> +
> +static uint8_t eotf_supported(const u8 *edid_ext)
> +{
> + return edid_ext[2] &
> + (BIT(HDMI_EOTF_TRADITIONAL_GAMMA_SDR) |
> + BIT(HDMI_EOTF_TRADITIONAL_GAMMA_HDR) |
> + BIT(HDMI_EOTF_SMPTE_ST2084));
> +}
> +
> +static uint8_t hdr_metadata_type(const u8 *edid_ext)
> +{
> + return edid_ext[3] &
> + BIT(HDMI_STATIC_METADATA_TYPE1);
> +}
> +
> +static void
> +drm_parse_hdr_metadata_block(struct drm_connector *connector, const u8 *db)
> +{
> + u16 len;
> +
> + len = cea_db_payload_len(db);
> + if (len >= 3) {
I believe in other cases we've put the length check for the
mandatory bytes into the cea_db_is_foo() function. Would be
good to follow the path laid out by existing code here too.
> + connector->hdr_sink_metadata.hdmi_type1.eotf =
> + eotf_supported(db);
> + connector->hdr_sink_metadata.hdmi_type1.metadata_type =
> + hdr_metadata_type(db);
> + }
> +
> + if (len >= 4)
> + connector->hdr_sink_metadata.hdmi_type1.max_cll = db[4];
> + if (len >= 5)
> + connector->hdr_sink_metadata.hdmi_type1.max_fall = db[5];
> + if (len >= 6)
> + connector->hdr_sink_metadata.hdmi_type1.min_cll = db[6];
> +}
> +
> static void
> drm_parse_hdmi_vsdb_audio(struct drm_connector *connector, const u8 *db)
> {
> @@ -4461,6 +4508,8 @@ static void drm_parse_cea_ext(struct drm_connector *connector,
> drm_parse_y420cmdb_bitmap(connector, db);
> if (cea_db_is_vcdb(db))
> drm_parse_vcdb(connector, db);
> + if (cea_db_is_hdmi_hdr_metadata_block(db))
> + drm_parse_hdr_metadata_block(connector, db);
> }
> }
>
> --
> 1.9.1
--
Ville Syrjälä
Intel
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 27+ messages in thread* Re: [v10 03/12] drm: Parse HDR metadata info from EDID
2019-05-15 19:36 ` Ville Syrjälä
@ 2019-05-16 7:25 ` Shankar, Uma
0 siblings, 0 replies; 27+ messages in thread
From: Shankar, Uma @ 2019-05-16 7:25 UTC (permalink / raw)
To: Ville Syrjälä
Cc: dcastagna@chromium.org, jonas@kwiboo.se,
intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
seanpaul@chromium.org
>-----Original Message-----
>From: Ville Syrjälä [mailto:ville.syrjala@linux.intel.com]
>Sent: Thursday, May 16, 2019 1:06 AM
>To: Shankar, Uma <uma.shankar@intel.com>
>Cc: intel-gfx@lists.freedesktop.org; dri-devel@lists.freedesktop.org;
>maarten.lankhorst@linux.intel.com; Sharma, Shashank
><shashank.sharma@intel.com>; emil.l.velikov@gmail.com; brian.starkey@arm.com;
>dcastagna@chromium.org; seanpaul@chromium.org; Roper, Matthew D
><matthew.d.roper@intel.com>; jonas@kwiboo.se
>Subject: Re: [v10 03/12] drm: Parse HDR metadata info from EDID
>
>On Tue, May 14, 2019 at 11:06:25PM +0530, Uma Shankar wrote:
>> HDR metadata block is introduced in CEA-861.3 spec.
>> Parsing the same to get the panel's HDR metadata.
>>
>> v2: Rebase and added Ville's POC changes to the patch.
>>
>> v3: No Change
>>
>> v4: Addressed Shashank's review comments
>>
>> v5: Addressed Shashank's comment and added his RB.
>>
>> v6: Addressed Jonas Karlman review comments.
>>
>> v7: Adressed Ville's review comments and fixed the issue with length
>> handling.
>>
>> Signed-off-by: Uma Shankar <uma.shankar@intel.com>
>> Reviewed-by: Shashank Sharma <shashank.sharma@intel.com>
>> ---
>> drivers/gpu/drm/drm_edid.c | 49
>> ++++++++++++++++++++++++++++++++++++++++++++++
>> 1 file changed, 49 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
>> index 852bdd8..2e0b5be 100644
>> --- a/drivers/gpu/drm/drm_edid.c
>> +++ b/drivers/gpu/drm/drm_edid.c
>> @@ -2852,6 +2852,7 @@ static int drm_cvt_modes(struct drm_connector
>*connector,
>> #define VIDEO_BLOCK 0x02
>> #define VENDOR_BLOCK 0x03
>> #define SPEAKER_BLOCK 0x04
>> +#define HDR_STATIC_METADATA_BLOCK 0x6
>> #define USE_EXTENDED_TAG 0x07
>> #define EXT_VIDEO_CAPABILITY_BLOCK 0x00
>> #define EXT_VIDEO_DATA_BLOCK_420 0x0E
>> @@ -3834,6 +3835,52 @@ static void fixup_detailed_cea_mode_clock(struct
>drm_display_mode *mode)
>> mode->clock = clock;
>> }
>>
>> +static bool cea_db_is_hdmi_hdr_metadata_block(const u8 *db) {
>> + if (cea_db_tag(db) != USE_EXTENDED_TAG)
>> + return false;
>> +
>> + if (db[1] != HDR_STATIC_METADATA_BLOCK)
>> + return false;
>> +
>> + return true;
>> +}
>> +
>> +static uint8_t eotf_supported(const u8 *edid_ext) {
>> + return edid_ext[2] &
>> + (BIT(HDMI_EOTF_TRADITIONAL_GAMMA_SDR) |
>> + BIT(HDMI_EOTF_TRADITIONAL_GAMMA_HDR) |
>> + BIT(HDMI_EOTF_SMPTE_ST2084));
>> +}
>> +
>> +static uint8_t hdr_metadata_type(const u8 *edid_ext) {
>> + return edid_ext[3] &
>> + BIT(HDMI_STATIC_METADATA_TYPE1);
>> +}
>> +
>> +static void
>> +drm_parse_hdr_metadata_block(struct drm_connector *connector, const
>> +u8 *db) {
>> + u16 len;
>> +
>> + len = cea_db_payload_len(db);
>> + if (len >= 3) {
>
>I believe in other cases we've put the length check for the mandatory bytes into the
>cea_db_is_foo() function. Would be good to follow the path laid out by existing code
>here too.
Ok got it. Will update this.
>> + connector->hdr_sink_metadata.hdmi_type1.eotf =
>> + eotf_supported(db);
>> + connector->hdr_sink_metadata.hdmi_type1.metadata_type =
>> + hdr_metadata_type(db);
>> + }
>> +
>> + if (len >= 4)
>> + connector->hdr_sink_metadata.hdmi_type1.max_cll = db[4];
>> + if (len >= 5)
>> + connector->hdr_sink_metadata.hdmi_type1.max_fall = db[5];
>> + if (len >= 6)
>> + connector->hdr_sink_metadata.hdmi_type1.min_cll = db[6]; }
>> +
>> static void
>> drm_parse_hdmi_vsdb_audio(struct drm_connector *connector, const u8
>> *db) { @@ -4461,6 +4508,8 @@ static void drm_parse_cea_ext(struct
>> drm_connector *connector,
>> drm_parse_y420cmdb_bitmap(connector, db);
>> if (cea_db_is_vcdb(db))
>> drm_parse_vcdb(connector, db);
>> + if (cea_db_is_hdmi_hdr_metadata_block(db))
>> + drm_parse_hdr_metadata_block(connector, db);
>> }
>> }
>>
>> --
>> 1.9.1
>
>--
>Ville Syrjälä
>Intel
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 27+ messages in thread
* [v10 04/12] drm: Enable HDR infoframe support
2019-05-14 17:36 [v10 00/12] Add HDR Metadata Parsing and handling in DRM layer Uma Shankar
` (2 preceding siblings ...)
2019-05-14 17:36 ` [v10 03/12] drm: Parse HDR metadata info from EDID Uma Shankar
@ 2019-05-14 17:36 ` Uma Shankar
2019-05-15 19:15 ` Ville Syrjälä
2019-05-14 17:36 ` [v10 05/12] drm/i915: Attach HDR metadata property to connector Uma Shankar
` (7 subsequent siblings)
11 siblings, 1 reply; 27+ messages in thread
From: Uma Shankar @ 2019-05-14 17:36 UTC (permalink / raw)
To: intel-gfx, dri-devel; +Cc: dcastagna, jonas, seanpaul
Enable Dynamic Range and Mastering Infoframe for HDR
content, which is defined in CEA 861.3 spec.
The metadata will be computed based on blending
policy in userspace compositors and passed as a connector
property blob to driver. The same will be sent as infoframe
to panel which support HDR.
Added the const version of infoframe for DRM metadata
for HDR.
v2: Rebase and added Ville's POC changes.
v3: No Change
v4: Addressed Shashank's review comments and merged the
patch making drm infoframe function arguments as constant.
v5: Rebase
v6: Fixed checkpatch warnings with --strict option. Addressed
Shashank's review comments and added his RB.
v7: Addressed Brian Starkey's review comments. Merged 2 patches
into one.
v8: Addressed Jonas Karlman review comments.
v9: Addressed Jonas Karlman review comments.
Signed-off-by: Uma Shankar <uma.shankar@intel.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Shashank Sharma <shashank.sharma@intel.com>
---
drivers/gpu/drm/drm_edid.c | 43 +++++++++++
drivers/video/hdmi.c | 187 +++++++++++++++++++++++++++++++++++++++++++++
include/drm/drm_edid.h | 5 ++
include/linux/hdmi.h | 27 +++++++
4 files changed, 262 insertions(+)
diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
index 2e0b5be..73b7905 100644
--- a/drivers/gpu/drm/drm_edid.c
+++ b/drivers/gpu/drm/drm_edid.c
@@ -4903,6 +4903,49 @@ static bool is_hdmi2_sink(struct drm_connector *connector)
}
/**
+ * drm_hdmi_infoframe_set_hdr_metadata() - fill an HDMI DRM infoframe with
+ * HDR metadata from userspace
+ * @frame: HDMI DRM infoframe
+ * @hdr_metadata: hdr_source_metadata info from userspace
+ *
+ * Return: 0 on success or a negative error code on failure.
+ */
+int
+drm_hdmi_infoframe_set_hdr_metadata(struct hdmi_drm_infoframe *frame,
+ const struct hdr_output_metadata *hdr_metadata)
+{
+ int err;
+
+ if (!frame || !hdr_metadata)
+ return -EINVAL;
+
+ err = hdmi_drm_infoframe_init(frame);
+ if (err < 0)
+ return err;
+
+ DRM_DEBUG_KMS("type = %x\n", frame->type);
+
+ frame->eotf = hdr_metadata->hdmi_metadata_type1.eotf;
+ frame->metadata_type = hdr_metadata->hdmi_metadata_type1.metadata_type;
+
+ memcpy(&frame->display_primaries,
+ &hdr_metadata->hdmi_metadata_type1.display_primaries, 12);
+
+ memcpy(&frame->white_point,
+ &hdr_metadata->hdmi_metadata_type1.white_point, 4);
+
+ frame->max_display_mastering_luminance =
+ hdr_metadata->hdmi_metadata_type1.max_display_mastering_luminance;
+ frame->min_display_mastering_luminance =
+ hdr_metadata->hdmi_metadata_type1.min_display_mastering_luminance;
+ frame->max_fall = hdr_metadata->hdmi_metadata_type1.max_fall;
+ frame->max_cll = hdr_metadata->hdmi_metadata_type1.max_cll;
+
+ return 0;
+}
+EXPORT_SYMBOL(drm_hdmi_infoframe_set_hdr_metadata);
+
+/**
* drm_hdmi_avi_infoframe_from_display_mode() - fill an HDMI AVI infoframe with
* data from a DRM display mode
* @frame: HDMI AVI infoframe
diff --git a/drivers/video/hdmi.c b/drivers/video/hdmi.c
index 799ae49..c5ecd16 100644
--- a/drivers/video/hdmi.c
+++ b/drivers/video/hdmi.c
@@ -650,6 +650,147 @@ ssize_t hdmi_vendor_infoframe_pack(struct hdmi_vendor_infoframe *frame,
return 0;
}
+/**
+ * hdmi_drm_infoframe_init() - initialize an HDMI Dynaminc Range and
+ * mastering infoframe
+ * @frame: HDMI DRM infoframe
+ *
+ * Returns 0 on success or a negative error code on failure.
+ */
+int hdmi_drm_infoframe_init(struct hdmi_drm_infoframe *frame)
+{
+ memset(frame, 0, sizeof(*frame));
+
+ frame->type = HDMI_INFOFRAME_TYPE_DRM;
+ frame->version = 1;
+ frame->length = HDMI_DRM_INFOFRAME_SIZE;
+
+ return 0;
+}
+EXPORT_SYMBOL(hdmi_drm_infoframe_init);
+
+static int hdmi_drm_infoframe_check_only(const struct hdmi_drm_infoframe *frame)
+{
+ if (frame->type != HDMI_INFOFRAME_TYPE_DRM ||
+ frame->version != 1)
+ return -EINVAL;
+
+ return 0;
+}
+
+/**
+ * hdmi_drm_infoframe_check() - check a HDMI DRM infoframe
+ * @frame: HDMI DRM infoframe
+ *
+ * Validates that the infoframe is consistent.
+ * Returns 0 on success or a negative error code on failure.
+ */
+int hdmi_drm_infoframe_check(struct hdmi_drm_infoframe *frame)
+{
+ return hdmi_drm_infoframe_check_only(frame);
+}
+EXPORT_SYMBOL(hdmi_drm_infoframe_check);
+
+/**
+ * hdmi_drm_infoframe_pack_only() - write HDMI DRM infoframe to binary buffer
+ * @frame: HDMI DRM infoframe
+ * @buffer: destination buffer
+ * @size: size of buffer
+ *
+ * Packs the information contained in the @frame structure into a binary
+ * representation that can be written into the corresponding controller
+ * registers. Also computes the checksum as required by section 5.3.5 of
+ * the HDMI 1.4 specification.
+ *
+ * Returns the number of bytes packed into the binary buffer or a negative
+ * error code on failure.
+ */
+ssize_t hdmi_drm_infoframe_pack_only(const struct hdmi_drm_infoframe *frame,
+ void *buffer, size_t size)
+{
+ u8 *ptr = buffer;
+ size_t length;
+ int i;
+
+ length = HDMI_INFOFRAME_HEADER_SIZE + frame->length;
+
+ if (size < length)
+ return -ENOSPC;
+
+ memset(buffer, 0, size);
+
+ ptr[0] = frame->type;
+ ptr[1] = frame->version;
+ ptr[2] = frame->length;
+ ptr[3] = 0; /* checksum */
+
+ /* start infoframe payload */
+ ptr += HDMI_INFOFRAME_HEADER_SIZE;
+
+ *ptr++ = frame->eotf;
+ *ptr++ = frame->metadata_type;
+
+ for (i = 0; i < 3; i++) {
+ *ptr++ = frame->display_primaries[i].x;
+ *ptr++ = frame->display_primaries[i].x >> 8;
+ *ptr++ = frame->display_primaries[i].y;
+ *ptr++ = frame->display_primaries[i].y >> 8;
+ }
+
+ *ptr++ = frame->white_point.x;
+ *ptr++ = frame->white_point.x >> 8;
+
+ *ptr++ = frame->white_point.y;
+ *ptr++ = frame->white_point.y >> 8;
+
+ *ptr++ = frame->max_display_mastering_luminance;
+ *ptr++ = frame->max_display_mastering_luminance >> 8;
+
+ *ptr++ = frame->min_display_mastering_luminance;
+ *ptr++ = frame->min_display_mastering_luminance >> 8;
+
+ *ptr++ = frame->max_cll;
+ *ptr++ = frame->max_cll >> 8;
+
+ *ptr++ = frame->max_fall;
+ *ptr++ = frame->max_fall >> 8;
+
+ hdmi_infoframe_set_checksum(buffer, length);
+
+ return length;
+}
+EXPORT_SYMBOL(hdmi_drm_infoframe_pack_only);
+
+/**
+ * hdmi_drm_infoframe_pack() - check a HDMI DRM infoframe,
+ * and write it to binary buffer
+ * @frame: HDMI DRM infoframe
+ * @buffer: destination buffer
+ * @size: size of buffer
+ *
+ * Validates that the infoframe is consistent and updates derived fields
+ * (eg. length) based on other fields, after which it packs the information
+ * contained in the @frame structure into a binary representation that
+ * can be written into the corresponding controller registers. This function
+ * also computes the checksum as required by section 5.3.5 of the HDMI 1.4
+ * specification.
+ *
+ * Returns the number of bytes packed into the binary buffer or a negative
+ * error code on failure.
+ */
+ssize_t hdmi_drm_infoframe_pack(struct hdmi_drm_infoframe *frame,
+ void *buffer, size_t size)
+{
+ int ret;
+
+ ret = hdmi_drm_infoframe_check(frame);
+ if (ret)
+ return ret;
+
+ return hdmi_drm_infoframe_pack_only(frame, buffer, size);
+}
+EXPORT_SYMBOL(hdmi_drm_infoframe_pack);
+
/*
* hdmi_vendor_any_infoframe_check() - check a vendor infoframe
*/
@@ -758,6 +899,10 @@ ssize_t hdmi_vendor_infoframe_pack(struct hdmi_vendor_infoframe *frame,
length = hdmi_avi_infoframe_pack_only(&frame->avi,
buffer, size);
break;
+ case HDMI_INFOFRAME_TYPE_DRM:
+ length = hdmi_drm_infoframe_pack_only(&frame->drm,
+ buffer, size);
+ break;
case HDMI_INFOFRAME_TYPE_SPD:
length = hdmi_spd_infoframe_pack_only(&frame->spd,
buffer, size);
@@ -806,6 +951,9 @@ ssize_t hdmi_vendor_infoframe_pack(struct hdmi_vendor_infoframe *frame,
case HDMI_INFOFRAME_TYPE_AVI:
length = hdmi_avi_infoframe_pack(&frame->avi, buffer, size);
break;
+ case HDMI_INFOFRAME_TYPE_DRM:
+ length = hdmi_drm_infoframe_pack(&frame->drm, buffer, size);
+ break;
case HDMI_INFOFRAME_TYPE_SPD:
length = hdmi_spd_infoframe_pack(&frame->spd, buffer, size);
break;
@@ -838,6 +986,8 @@ static const char *hdmi_infoframe_type_get_name(enum hdmi_infoframe_type type)
return "Source Product Description (SPD)";
case HDMI_INFOFRAME_TYPE_AUDIO:
return "Audio";
+ case HDMI_INFOFRAME_TYPE_DRM:
+ return "Dynamic Range and Mastering";
}
return "Reserved";
}
@@ -1284,6 +1434,40 @@ static void hdmi_audio_infoframe_log(const char *level,
frame->downmix_inhibit ? "Yes" : "No");
}
+/**
+ * hdmi_drm_infoframe_log() - log info of HDMI DRM infoframe
+ * @level: logging level
+ * @dev: device
+ * @frame: HDMI DRM infoframe
+ */
+static void hdmi_drm_infoframe_log(const char *level,
+ struct device *dev,
+ const struct hdmi_drm_infoframe *frame)
+{
+ int i;
+
+ hdmi_infoframe_log_header(level, dev,
+ (struct hdmi_any_infoframe *)frame);
+ hdmi_log("length: %d\n", frame->length);
+ hdmi_log("metadata type: %d\n", frame->metadata_type);
+ hdmi_log("eotf: %d\n", frame->eotf);
+ for (i = 0; i < 3; i++) {
+ hdmi_log("x[%d]: %d\n", i, frame->display_primaries[i].x);
+ hdmi_log("y[%d]: %d\n", i, frame->display_primaries[i].y);
+ }
+
+ hdmi_log("white point x: %d\n", frame->white_point.x);
+ hdmi_log("white point y: %d\n", frame->white_point.y);
+
+ hdmi_log("max_display_mastering_luminance: %d\n",
+ frame->max_display_mastering_luminance);
+ hdmi_log("min_display_mastering_luminance: %d\n",
+ frame->min_display_mastering_luminance);
+
+ hdmi_log("max_cll: %d\n", frame->max_cll);
+ hdmi_log("max_fall: %d\n", frame->max_fall);
+}
+
static const char *
hdmi_3d_structure_get_name(enum hdmi_3d_structure s3d_struct)
{
@@ -1372,6 +1556,9 @@ void hdmi_infoframe_log(const char *level,
case HDMI_INFOFRAME_TYPE_VENDOR:
hdmi_vendor_any_infoframe_log(level, dev, &frame->vendor);
break;
+ case HDMI_INFOFRAME_TYPE_DRM:
+ hdmi_drm_infoframe_log(level, dev, &frame->drm);
+ break;
}
}
EXPORT_SYMBOL(hdmi_infoframe_log);
diff --git a/include/drm/drm_edid.h b/include/drm/drm_edid.h
index 9d3b5b9..4ba56f5 100644
--- a/include/drm/drm_edid.h
+++ b/include/drm/drm_edid.h
@@ -25,6 +25,7 @@
#include <linux/types.h>
#include <linux/hdmi.h>
+#include <drm/drm_mode.h>
struct drm_device;
struct i2c_adapter;
@@ -370,6 +371,10 @@ int drm_av_sync_delay(struct drm_connector *connector,
const struct drm_display_mode *mode,
enum hdmi_quantization_range rgb_quant_range);
+int
+drm_hdmi_infoframe_set_hdr_metadata(struct hdmi_drm_infoframe *frame,
+ const struct hdr_output_metadata *hdr_metadata);
+
/**
* drm_eld_mnl - Get ELD monitor name length in bytes.
* @eld: pointer to an eld memory structure with mnl set
diff --git a/include/linux/hdmi.h b/include/linux/hdmi.h
index 6780476..7edafcf 100644
--- a/include/linux/hdmi.h
+++ b/include/linux/hdmi.h
@@ -47,6 +47,7 @@ enum hdmi_infoframe_type {
HDMI_INFOFRAME_TYPE_AVI = 0x82,
HDMI_INFOFRAME_TYPE_SPD = 0x83,
HDMI_INFOFRAME_TYPE_AUDIO = 0x84,
+ HDMI_INFOFRAME_TYPE_DRM = 0x87,
};
#define HDMI_IEEE_OUI 0x000c03
@@ -185,12 +186,37 @@ struct hdmi_avi_infoframe {
unsigned short right_bar;
};
+/* DRM Infoframe as per CTA 861.G spec */
+struct hdmi_drm_infoframe {
+ enum hdmi_infoframe_type type;
+ unsigned char version;
+ unsigned char length;
+ enum hdmi_eotf eotf;
+ enum hdmi_metadata_type metadata_type;
+ struct {
+ u16 x, y;
+ } display_primaries[3];
+ struct {
+ u16 x, y;
+ } white_point;
+ u16 max_display_mastering_luminance;
+ u16 min_display_mastering_luminance;
+ u16 max_cll;
+ u16 max_fall;
+};
+
int hdmi_avi_infoframe_init(struct hdmi_avi_infoframe *frame);
ssize_t hdmi_avi_infoframe_pack(struct hdmi_avi_infoframe *frame, void *buffer,
size_t size);
ssize_t hdmi_avi_infoframe_pack_only(const struct hdmi_avi_infoframe *frame,
void *buffer, size_t size);
int hdmi_avi_infoframe_check(struct hdmi_avi_infoframe *frame);
+int hdmi_drm_infoframe_init(struct hdmi_drm_infoframe *frame);
+ssize_t hdmi_drm_infoframe_pack(struct hdmi_drm_infoframe *frame, void *buffer,
+ size_t size);
+ssize_t hdmi_drm_infoframe_pack_only(const struct hdmi_drm_infoframe *frame,
+ void *buffer, size_t size);
+int hdmi_drm_infoframe_check(struct hdmi_drm_infoframe *frame);
enum hdmi_spd_sdi {
HDMI_SPD_SDI_UNKNOWN,
@@ -381,6 +407,7 @@ ssize_t hdmi_vendor_infoframe_pack_only(const struct hdmi_vendor_infoframe *fram
struct hdmi_spd_infoframe spd;
union hdmi_vendor_any_infoframe vendor;
struct hdmi_audio_infoframe audio;
+ struct hdmi_drm_infoframe drm;
};
ssize_t hdmi_infoframe_pack(union hdmi_infoframe *frame, void *buffer,
--
1.9.1
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 27+ messages in thread* Re: [v10 04/12] drm: Enable HDR infoframe support
2019-05-14 17:36 ` [v10 04/12] drm: Enable HDR infoframe support Uma Shankar
@ 2019-05-15 19:15 ` Ville Syrjälä
2019-05-16 7:22 ` Shankar, Uma
0 siblings, 1 reply; 27+ messages in thread
From: Ville Syrjälä @ 2019-05-15 19:15 UTC (permalink / raw)
To: Uma Shankar
Cc: dcastagna, jonas, intel-gfx, emil.l.velikov, dri-devel, seanpaul
On Tue, May 14, 2019 at 11:06:26PM +0530, Uma Shankar wrote:
> Enable Dynamic Range and Mastering Infoframe for HDR
> content, which is defined in CEA 861.3 spec.
>
> The metadata will be computed based on blending
> policy in userspace compositors and passed as a connector
> property blob to driver. The same will be sent as infoframe
> to panel which support HDR.
>
> Added the const version of infoframe for DRM metadata
> for HDR.
>
> v2: Rebase and added Ville's POC changes.
>
> v3: No Change
>
> v4: Addressed Shashank's review comments and merged the
> patch making drm infoframe function arguments as constant.
>
> v5: Rebase
>
> v6: Fixed checkpatch warnings with --strict option. Addressed
> Shashank's review comments and added his RB.
>
> v7: Addressed Brian Starkey's review comments. Merged 2 patches
> into one.
>
> v8: Addressed Jonas Karlman review comments.
>
> v9: Addressed Jonas Karlman review comments.
>
> Signed-off-by: Uma Shankar <uma.shankar@intel.com>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Reviewed-by: Shashank Sharma <shashank.sharma@intel.com>
> ---
> drivers/gpu/drm/drm_edid.c | 43 +++++++++++
> drivers/video/hdmi.c | 187 +++++++++++++++++++++++++++++++++++++++++++++
> include/drm/drm_edid.h | 5 ++
> include/linux/hdmi.h | 27 +++++++
> 4 files changed, 262 insertions(+)
>
> diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
> index 2e0b5be..73b7905 100644
> --- a/drivers/gpu/drm/drm_edid.c
> +++ b/drivers/gpu/drm/drm_edid.c
> @@ -4903,6 +4903,49 @@ static bool is_hdmi2_sink(struct drm_connector *connector)
> }
>
> /**
> + * drm_hdmi_infoframe_set_hdr_metadata() - fill an HDMI DRM infoframe with
> + * HDR metadata from userspace
> + * @frame: HDMI DRM infoframe
> + * @hdr_metadata: hdr_source_metadata info from userspace
> + *
> + * Return: 0 on success or a negative error code on failure.
> + */
> +int
> +drm_hdmi_infoframe_set_hdr_metadata(struct hdmi_drm_infoframe *frame,
> + const struct hdr_output_metadata *hdr_metadata)
> +{
> + int err;
> +
> + if (!frame || !hdr_metadata)
> + return -EINVAL;
> +
> + err = hdmi_drm_infoframe_init(frame);
> + if (err < 0)
> + return err;
> +
> + DRM_DEBUG_KMS("type = %x\n", frame->type);
This debug seems pointless.
> +
> + frame->eotf = hdr_metadata->hdmi_metadata_type1.eotf;
> + frame->metadata_type = hdr_metadata->hdmi_metadata_type1.metadata_type;
> +
> + memcpy(&frame->display_primaries,
> + &hdr_metadata->hdmi_metadata_type1.display_primaries, 12);
sizeof() can be used here.
Could also slap on a BUILD_BUG_ON() to make sure both are the same size.
> +
> + memcpy(&frame->white_point,
> + &hdr_metadata->hdmi_metadata_type1.white_point, 4);
ditto.
> +
> + frame->max_display_mastering_luminance =
> + hdr_metadata->hdmi_metadata_type1.max_display_mastering_luminance;
> + frame->min_display_mastering_luminance =
> + hdr_metadata->hdmi_metadata_type1.min_display_mastering_luminance;
> + frame->max_fall = hdr_metadata->hdmi_metadata_type1.max_fall;
> + frame->max_cll = hdr_metadata->hdmi_metadata_type1.max_cll;
> +
> + return 0;
> +}
> +EXPORT_SYMBOL(drm_hdmi_infoframe_set_hdr_metadata);
> +
> +/**
> * drm_hdmi_avi_infoframe_from_display_mode() - fill an HDMI AVI infoframe with
> * data from a DRM display mode
> * @frame: HDMI AVI infoframe
> diff --git a/drivers/video/hdmi.c b/drivers/video/hdmi.c
> index 799ae49..c5ecd16 100644
> --- a/drivers/video/hdmi.c
> +++ b/drivers/video/hdmi.c
> @@ -650,6 +650,147 @@ ssize_t hdmi_vendor_infoframe_pack(struct hdmi_vendor_infoframe *frame,
> return 0;
> }
>
> +/**
> + * hdmi_drm_infoframe_init() - initialize an HDMI Dynaminc Range and
> + * mastering infoframe
> + * @frame: HDMI DRM infoframe
> + *
> + * Returns 0 on success or a negative error code on failure.
> + */
> +int hdmi_drm_infoframe_init(struct hdmi_drm_infoframe *frame)
> +{
> + memset(frame, 0, sizeof(*frame));
> +
> + frame->type = HDMI_INFOFRAME_TYPE_DRM;
> + frame->version = 1;
> + frame->length = HDMI_DRM_INFOFRAME_SIZE;
> +
> + return 0;
> +}
> +EXPORT_SYMBOL(hdmi_drm_infoframe_init);
> +
> +static int hdmi_drm_infoframe_check_only(const struct hdmi_drm_infoframe *frame)
> +{
> + if (frame->type != HDMI_INFOFRAME_TYPE_DRM ||
> + frame->version != 1)
Missing the length check.
> + return -EINVAL;
> +
> + return 0;
> +}
> +
> +/**
> + * hdmi_drm_infoframe_check() - check a HDMI DRM infoframe
> + * @frame: HDMI DRM infoframe
> + *
> + * Validates that the infoframe is consistent.
> + * Returns 0 on success or a negative error code on failure.
> + */
> +int hdmi_drm_infoframe_check(struct hdmi_drm_infoframe *frame)
> +{
> + return hdmi_drm_infoframe_check_only(frame);
> +}
> +EXPORT_SYMBOL(hdmi_drm_infoframe_check);
> +
> +/**
> + * hdmi_drm_infoframe_pack_only() - write HDMI DRM infoframe to binary buffer
> + * @frame: HDMI DRM infoframe
> + * @buffer: destination buffer
> + * @size: size of buffer
> + *
> + * Packs the information contained in the @frame structure into a binary
> + * representation that can be written into the corresponding controller
> + * registers. Also computes the checksum as required by section 5.3.5 of
> + * the HDMI 1.4 specification.
> + *
> + * Returns the number of bytes packed into the binary buffer or a negative
> + * error code on failure.
> + */
> +ssize_t hdmi_drm_infoframe_pack_only(const struct hdmi_drm_infoframe *frame,
> + void *buffer, size_t size)
> +{
> + u8 *ptr = buffer;
> + size_t length;
> + int i;
> +
> + length = HDMI_INFOFRAME_HEADER_SIZE + frame->length;
> +
> + if (size < length)
> + return -ENOSPC;
> +
> + memset(buffer, 0, size);
> +
> + ptr[0] = frame->type;
> + ptr[1] = frame->version;
> + ptr[2] = frame->length;
> + ptr[3] = 0; /* checksum */
> +
> + /* start infoframe payload */
> + ptr += HDMI_INFOFRAME_HEADER_SIZE;
> +
> + *ptr++ = frame->eotf;
> + *ptr++ = frame->metadata_type;
> +
> + for (i = 0; i < 3; i++) {
> + *ptr++ = frame->display_primaries[i].x;
> + *ptr++ = frame->display_primaries[i].x >> 8;
> + *ptr++ = frame->display_primaries[i].y;
> + *ptr++ = frame->display_primaries[i].y >> 8;
> + }
> +
> + *ptr++ = frame->white_point.x;
> + *ptr++ = frame->white_point.x >> 8;
> +
> + *ptr++ = frame->white_point.y;
> + *ptr++ = frame->white_point.y >> 8;
> +
> + *ptr++ = frame->max_display_mastering_luminance;
> + *ptr++ = frame->max_display_mastering_luminance >> 8;
> +
> + *ptr++ = frame->min_display_mastering_luminance;
> + *ptr++ = frame->min_display_mastering_luminance >> 8;
> +
> + *ptr++ = frame->max_cll;
> + *ptr++ = frame->max_cll >> 8;
> +
> + *ptr++ = frame->max_fall;
> + *ptr++ = frame->max_fall >> 8;
> +
> + hdmi_infoframe_set_checksum(buffer, length);
> +
> + return length;
> +}
> +EXPORT_SYMBOL(hdmi_drm_infoframe_pack_only);
> +
> +/**
> + * hdmi_drm_infoframe_pack() - check a HDMI DRM infoframe,
> + * and write it to binary buffer
> + * @frame: HDMI DRM infoframe
> + * @buffer: destination buffer
> + * @size: size of buffer
> + *
> + * Validates that the infoframe is consistent and updates derived fields
> + * (eg. length) based on other fields, after which it packs the information
> + * contained in the @frame structure into a binary representation that
> + * can be written into the corresponding controller registers. This function
> + * also computes the checksum as required by section 5.3.5 of the HDMI 1.4
> + * specification.
> + *
> + * Returns the number of bytes packed into the binary buffer or a negative
> + * error code on failure.
> + */
> +ssize_t hdmi_drm_infoframe_pack(struct hdmi_drm_infoframe *frame,
> + void *buffer, size_t size)
> +{
> + int ret;
> +
> + ret = hdmi_drm_infoframe_check(frame);
> + if (ret)
> + return ret;
> +
> + return hdmi_drm_infoframe_pack_only(frame, buffer, size);
> +}
> +EXPORT_SYMBOL(hdmi_drm_infoframe_pack);
> +
> /*
> * hdmi_vendor_any_infoframe_check() - check a vendor infoframe
> */
> @@ -758,6 +899,10 @@ ssize_t hdmi_vendor_infoframe_pack(struct hdmi_vendor_infoframe *frame,
> length = hdmi_avi_infoframe_pack_only(&frame->avi,
> buffer, size);
> break;
> + case HDMI_INFOFRAME_TYPE_DRM:
> + length = hdmi_drm_infoframe_pack_only(&frame->drm,
> + buffer, size);
> + break;
> case HDMI_INFOFRAME_TYPE_SPD:
> length = hdmi_spd_infoframe_pack_only(&frame->spd,
> buffer, size);
> @@ -806,6 +951,9 @@ ssize_t hdmi_vendor_infoframe_pack(struct hdmi_vendor_infoframe *frame,
> case HDMI_INFOFRAME_TYPE_AVI:
> length = hdmi_avi_infoframe_pack(&frame->avi, buffer, size);
> break;
> + case HDMI_INFOFRAME_TYPE_DRM:
> + length = hdmi_drm_infoframe_pack(&frame->drm, buffer, size);
> + break;
> case HDMI_INFOFRAME_TYPE_SPD:
> length = hdmi_spd_infoframe_pack(&frame->spd, buffer, size);
> break;
> @@ -838,6 +986,8 @@ static const char *hdmi_infoframe_type_get_name(enum hdmi_infoframe_type type)
> return "Source Product Description (SPD)";
> case HDMI_INFOFRAME_TYPE_AUDIO:
> return "Audio";
> + case HDMI_INFOFRAME_TYPE_DRM:
> + return "Dynamic Range and Mastering";
> }
> return "Reserved";
> }
> @@ -1284,6 +1434,40 @@ static void hdmi_audio_infoframe_log(const char *level,
> frame->downmix_inhibit ? "Yes" : "No");
> }
>
> +/**
> + * hdmi_drm_infoframe_log() - log info of HDMI DRM infoframe
> + * @level: logging level
> + * @dev: device
> + * @frame: HDMI DRM infoframe
> + */
> +static void hdmi_drm_infoframe_log(const char *level,
> + struct device *dev,
> + const struct hdmi_drm_infoframe *frame)
> +{
> + int i;
> +
> + hdmi_infoframe_log_header(level, dev,
> + (struct hdmi_any_infoframe *)frame);
> + hdmi_log("length: %d\n", frame->length);
> + hdmi_log("metadata type: %d\n", frame->metadata_type);
> + hdmi_log("eotf: %d\n", frame->eotf);
> + for (i = 0; i < 3; i++) {
> + hdmi_log("x[%d]: %d\n", i, frame->display_primaries[i].x);
> + hdmi_log("y[%d]: %d\n", i, frame->display_primaries[i].y);
> + }
> +
> + hdmi_log("white point x: %d\n", frame->white_point.x);
> + hdmi_log("white point y: %d\n", frame->white_point.y);
> +
> + hdmi_log("max_display_mastering_luminance: %d\n",
> + frame->max_display_mastering_luminance);
> + hdmi_log("min_display_mastering_luminance: %d\n",
> + frame->min_display_mastering_luminance);
> +
> + hdmi_log("max_cll: %d\n", frame->max_cll);
> + hdmi_log("max_fall: %d\n", frame->max_fall);
> +}
> +
> static const char *
> hdmi_3d_structure_get_name(enum hdmi_3d_structure s3d_struct)
> {
> @@ -1372,6 +1556,9 @@ void hdmi_infoframe_log(const char *level,
> case HDMI_INFOFRAME_TYPE_VENDOR:
> hdmi_vendor_any_infoframe_log(level, dev, &frame->vendor);
> break;
> + case HDMI_INFOFRAME_TYPE_DRM:
> + hdmi_drm_infoframe_log(level, dev, &frame->drm);
> + break;
> }
> }
> EXPORT_SYMBOL(hdmi_infoframe_log);
> diff --git a/include/drm/drm_edid.h b/include/drm/drm_edid.h
> index 9d3b5b9..4ba56f5 100644
> --- a/include/drm/drm_edid.h
> +++ b/include/drm/drm_edid.h
> @@ -25,6 +25,7 @@
>
> #include <linux/types.h>
> #include <linux/hdmi.h>
> +#include <drm/drm_mode.h>
>
> struct drm_device;
> struct i2c_adapter;
> @@ -370,6 +371,10 @@ int drm_av_sync_delay(struct drm_connector *connector,
> const struct drm_display_mode *mode,
> enum hdmi_quantization_range rgb_quant_range);
>
> +int
> +drm_hdmi_infoframe_set_hdr_metadata(struct hdmi_drm_infoframe *frame,
> + const struct hdr_output_metadata *hdr_metadata);
> +
> /**
> * drm_eld_mnl - Get ELD monitor name length in bytes.
> * @eld: pointer to an eld memory structure with mnl set
> diff --git a/include/linux/hdmi.h b/include/linux/hdmi.h
> index 6780476..7edafcf 100644
> --- a/include/linux/hdmi.h
> +++ b/include/linux/hdmi.h
> @@ -47,6 +47,7 @@ enum hdmi_infoframe_type {
> HDMI_INFOFRAME_TYPE_AVI = 0x82,
> HDMI_INFOFRAME_TYPE_SPD = 0x83,
> HDMI_INFOFRAME_TYPE_AUDIO = 0x84,
> + HDMI_INFOFRAME_TYPE_DRM = 0x87,
> };
>
> #define HDMI_IEEE_OUI 0x000c03
> @@ -185,12 +186,37 @@ struct hdmi_avi_infoframe {
> unsigned short right_bar;
> };
>
> +/* DRM Infoframe as per CTA 861.G spec */
> +struct hdmi_drm_infoframe {
> + enum hdmi_infoframe_type type;
> + unsigned char version;
> + unsigned char length;
> + enum hdmi_eotf eotf;
> + enum hdmi_metadata_type metadata_type;
> + struct {
> + u16 x, y;
> + } display_primaries[3];
> + struct {
> + u16 x, y;
> + } white_point;
> + u16 max_display_mastering_luminance;
> + u16 min_display_mastering_luminance;
> + u16 max_cll;
> + u16 max_fall;
> +};
> +
> int hdmi_avi_infoframe_init(struct hdmi_avi_infoframe *frame);
> ssize_t hdmi_avi_infoframe_pack(struct hdmi_avi_infoframe *frame, void *buffer,
> size_t size);
> ssize_t hdmi_avi_infoframe_pack_only(const struct hdmi_avi_infoframe *frame,
> void *buffer, size_t size);
> int hdmi_avi_infoframe_check(struct hdmi_avi_infoframe *frame);
> +int hdmi_drm_infoframe_init(struct hdmi_drm_infoframe *frame);
> +ssize_t hdmi_drm_infoframe_pack(struct hdmi_drm_infoframe *frame, void *buffer,
> + size_t size);
> +ssize_t hdmi_drm_infoframe_pack_only(const struct hdmi_drm_infoframe *frame,
> + void *buffer, size_t size);
> +int hdmi_drm_infoframe_check(struct hdmi_drm_infoframe *frame);
>
> enum hdmi_spd_sdi {
> HDMI_SPD_SDI_UNKNOWN,
> @@ -381,6 +407,7 @@ ssize_t hdmi_vendor_infoframe_pack_only(const struct hdmi_vendor_infoframe *fram
> struct hdmi_spd_infoframe spd;
> union hdmi_vendor_any_infoframe vendor;
> struct hdmi_audio_infoframe audio;
> + struct hdmi_drm_infoframe drm;
> };
>
> ssize_t hdmi_infoframe_pack(union hdmi_infoframe *frame, void *buffer,
> --
> 1.9.1
--
Ville Syrjälä
Intel
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 27+ messages in thread* Re: [v10 04/12] drm: Enable HDR infoframe support
2019-05-15 19:15 ` Ville Syrjälä
@ 2019-05-16 7:22 ` Shankar, Uma
0 siblings, 0 replies; 27+ messages in thread
From: Shankar, Uma @ 2019-05-16 7:22 UTC (permalink / raw)
To: Ville Syrjälä
Cc: dcastagna@chromium.org, jonas@kwiboo.se,
intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
seanpaul@chromium.org
>-----Original Message-----
>From: Ville Syrjälä [mailto:ville.syrjala@linux.intel.com]
>Sent: Thursday, May 16, 2019 12:45 AM
>To: Shankar, Uma <uma.shankar@intel.com>
>Cc: intel-gfx@lists.freedesktop.org; dri-devel@lists.freedesktop.org;
>maarten.lankhorst@linux.intel.com; Sharma, Shashank
><shashank.sharma@intel.com>; emil.l.velikov@gmail.com; brian.starkey@arm.com;
>dcastagna@chromium.org; seanpaul@chromium.org; Roper, Matthew D
><matthew.d.roper@intel.com>; jonas@kwiboo.se
>Subject: Re: [v10 04/12] drm: Enable HDR infoframe support
>
>On Tue, May 14, 2019 at 11:06:26PM +0530, Uma Shankar wrote:
>> Enable Dynamic Range and Mastering Infoframe for HDR content, which is
>> defined in CEA 861.3 spec.
>>
>> The metadata will be computed based on blending policy in userspace
>> compositors and passed as a connector property blob to driver. The
>> same will be sent as infoframe to panel which support HDR.
>>
>> Added the const version of infoframe for DRM metadata for HDR.
>>
>> v2: Rebase and added Ville's POC changes.
>>
>> v3: No Change
>>
>> v4: Addressed Shashank's review comments and merged the patch making
>> drm infoframe function arguments as constant.
>>
>> v5: Rebase
>>
>> v6: Fixed checkpatch warnings with --strict option. Addressed
>> Shashank's review comments and added his RB.
>>
>> v7: Addressed Brian Starkey's review comments. Merged 2 patches into
>> one.
>>
>> v8: Addressed Jonas Karlman review comments.
>>
>> v9: Addressed Jonas Karlman review comments.
>>
>> Signed-off-by: Uma Shankar <uma.shankar@intel.com>
>> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
>> Reviewed-by: Shashank Sharma <shashank.sharma@intel.com>
>> ---
>> drivers/gpu/drm/drm_edid.c | 43 +++++++++++
>> drivers/video/hdmi.c | 187
>+++++++++++++++++++++++++++++++++++++++++++++
>> include/drm/drm_edid.h | 5 ++
>> include/linux/hdmi.h | 27 +++++++
>> 4 files changed, 262 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
>> index 2e0b5be..73b7905 100644
>> --- a/drivers/gpu/drm/drm_edid.c
>> +++ b/drivers/gpu/drm/drm_edid.c
>> @@ -4903,6 +4903,49 @@ static bool is_hdmi2_sink(struct drm_connector
>> *connector) }
>>
>> /**
>> + * drm_hdmi_infoframe_set_hdr_metadata() - fill an HDMI DRM infoframe with
>> + * HDR metadata from userspace
>> + * @frame: HDMI DRM infoframe
>> + * @hdr_metadata: hdr_source_metadata info from userspace
>> + *
>> + * Return: 0 on success or a negative error code on failure.
>> + */
>> +int
>> +drm_hdmi_infoframe_set_hdr_metadata(struct hdmi_drm_infoframe *frame,
>> + const struct hdr_output_metadata
>*hdr_metadata) {
>> + int err;
>> +
>> + if (!frame || !hdr_metadata)
>> + return -EINVAL;
>> +
>> + err = hdmi_drm_infoframe_init(frame);
>> + if (err < 0)
>> + return err;
>> +
>> + DRM_DEBUG_KMS("type = %x\n", frame->type);
>
>This debug seems pointless.
Ok, will drop this.
>> +
>> + frame->eotf = hdr_metadata->hdmi_metadata_type1.eotf;
>> + frame->metadata_type =
>> +hdr_metadata->hdmi_metadata_type1.metadata_type;
>> +
>> + memcpy(&frame->display_primaries,
>> + &hdr_metadata->hdmi_metadata_type1.display_primaries, 12);
>
>sizeof() can be used here.
Sure.
>Could also slap on a BUILD_BUG_ON() to make sure both are the same size.
Ok, will addd it.
>
>> +
>> + memcpy(&frame->white_point,
>> + &hdr_metadata->hdmi_metadata_type1.white_point, 4);
>
>ditto.
Sure.
>> +
>> + frame->max_display_mastering_luminance =
>> + hdr_metadata-
>>hdmi_metadata_type1.max_display_mastering_luminance;
>> + frame->min_display_mastering_luminance =
>> + hdr_metadata-
>>hdmi_metadata_type1.min_display_mastering_luminance;
>> + frame->max_fall = hdr_metadata->hdmi_metadata_type1.max_fall;
>> + frame->max_cll = hdr_metadata->hdmi_metadata_type1.max_cll;
>> +
>> + return 0;
>> +}
>> +EXPORT_SYMBOL(drm_hdmi_infoframe_set_hdr_metadata);
>> +
>> +/**
>> * drm_hdmi_avi_infoframe_from_display_mode() - fill an HDMI AVI infoframe with
>> * data from a DRM display mode
>> * @frame: HDMI AVI infoframe
>> diff --git a/drivers/video/hdmi.c b/drivers/video/hdmi.c index
>> 799ae49..c5ecd16 100644
>> --- a/drivers/video/hdmi.c
>> +++ b/drivers/video/hdmi.c
>> @@ -650,6 +650,147 @@ ssize_t hdmi_vendor_infoframe_pack(struct
>hdmi_vendor_infoframe *frame,
>> return 0;
>> }
>>
>> +/**
>> + * hdmi_drm_infoframe_init() - initialize an HDMI Dynaminc Range and
>> + * mastering infoframe
>> + * @frame: HDMI DRM infoframe
>> + *
>> + * Returns 0 on success or a negative error code on failure.
>> + */
>> +int hdmi_drm_infoframe_init(struct hdmi_drm_infoframe *frame) {
>> + memset(frame, 0, sizeof(*frame));
>> +
>> + frame->type = HDMI_INFOFRAME_TYPE_DRM;
>> + frame->version = 1;
>> + frame->length = HDMI_DRM_INFOFRAME_SIZE;
>> +
>> + return 0;
>> +}
>> +EXPORT_SYMBOL(hdmi_drm_infoframe_init);
>> +
>> +static int hdmi_drm_infoframe_check_only(const struct
>> +hdmi_drm_infoframe *frame) {
>> + if (frame->type != HDMI_INFOFRAME_TYPE_DRM ||
>> + frame->version != 1)
>
>Missing the length check.
>
>> + return -EINVAL;
>> +
>> + return 0;
>> +}
>> +
>> +/**
>> + * hdmi_drm_infoframe_check() - check a HDMI DRM infoframe
>> + * @frame: HDMI DRM infoframe
>> + *
>> + * Validates that the infoframe is consistent.
>> + * Returns 0 on success or a negative error code on failure.
>> + */
>> +int hdmi_drm_infoframe_check(struct hdmi_drm_infoframe *frame) {
>> + return hdmi_drm_infoframe_check_only(frame);
>> +}
>> +EXPORT_SYMBOL(hdmi_drm_infoframe_check);
>> +
>> +/**
>> + * hdmi_drm_infoframe_pack_only() - write HDMI DRM infoframe to
>> +binary buffer
>> + * @frame: HDMI DRM infoframe
>> + * @buffer: destination buffer
>> + * @size: size of buffer
>> + *
>> + * Packs the information contained in the @frame structure into a
>> +binary
>> + * representation that can be written into the corresponding
>> +controller
>> + * registers. Also computes the checksum as required by section 5.3.5
>> +of
>> + * the HDMI 1.4 specification.
>> + *
>> + * Returns the number of bytes packed into the binary buffer or a
>> +negative
>> + * error code on failure.
>> + */
>> +ssize_t hdmi_drm_infoframe_pack_only(const struct hdmi_drm_infoframe *frame,
>> + void *buffer, size_t size)
>> +{
>> + u8 *ptr = buffer;
>> + size_t length;
>> + int i;
>> +
>> + length = HDMI_INFOFRAME_HEADER_SIZE + frame->length;
>> +
>> + if (size < length)
>> + return -ENOSPC;
>> +
>> + memset(buffer, 0, size);
>> +
>> + ptr[0] = frame->type;
>> + ptr[1] = frame->version;
>> + ptr[2] = frame->length;
>> + ptr[3] = 0; /* checksum */
>> +
>> + /* start infoframe payload */
>> + ptr += HDMI_INFOFRAME_HEADER_SIZE;
>> +
>> + *ptr++ = frame->eotf;
>> + *ptr++ = frame->metadata_type;
>> +
>> + for (i = 0; i < 3; i++) {
>> + *ptr++ = frame->display_primaries[i].x;
>> + *ptr++ = frame->display_primaries[i].x >> 8;
>> + *ptr++ = frame->display_primaries[i].y;
>> + *ptr++ = frame->display_primaries[i].y >> 8;
>> + }
>> +
>> + *ptr++ = frame->white_point.x;
>> + *ptr++ = frame->white_point.x >> 8;
>> +
>> + *ptr++ = frame->white_point.y;
>> + *ptr++ = frame->white_point.y >> 8;
>> +
>> + *ptr++ = frame->max_display_mastering_luminance;
>> + *ptr++ = frame->max_display_mastering_luminance >> 8;
>> +
>> + *ptr++ = frame->min_display_mastering_luminance;
>> + *ptr++ = frame->min_display_mastering_luminance >> 8;
>> +
>> + *ptr++ = frame->max_cll;
>> + *ptr++ = frame->max_cll >> 8;
>> +
>> + *ptr++ = frame->max_fall;
>> + *ptr++ = frame->max_fall >> 8;
>> +
>> + hdmi_infoframe_set_checksum(buffer, length);
>> +
>> + return length;
>> +}
>> +EXPORT_SYMBOL(hdmi_drm_infoframe_pack_only);
>> +
>> +/**
>> + * hdmi_drm_infoframe_pack() - check a HDMI DRM infoframe,
>> + * and write it to binary buffer
>> + * @frame: HDMI DRM infoframe
>> + * @buffer: destination buffer
>> + * @size: size of buffer
>> + *
>> + * Validates that the infoframe is consistent and updates derived
>> +fields
>> + * (eg. length) based on other fields, after which it packs the
>> +information
>> + * contained in the @frame structure into a binary representation
>> +that
>> + * can be written into the corresponding controller registers. This
>> +function
>> + * also computes the checksum as required by section 5.3.5 of the
>> +HDMI 1.4
>> + * specification.
>> + *
>> + * Returns the number of bytes packed into the binary buffer or a
>> +negative
>> + * error code on failure.
>> + */
>> +ssize_t hdmi_drm_infoframe_pack(struct hdmi_drm_infoframe *frame,
>> + void *buffer, size_t size)
>> +{
>> + int ret;
>> +
>> + ret = hdmi_drm_infoframe_check(frame);
>> + if (ret)
>> + return ret;
>> +
>> + return hdmi_drm_infoframe_pack_only(frame, buffer, size); }
>> +EXPORT_SYMBOL(hdmi_drm_infoframe_pack);
>> +
>> /*
>> * hdmi_vendor_any_infoframe_check() - check a vendor infoframe
>> */
>> @@ -758,6 +899,10 @@ ssize_t hdmi_vendor_infoframe_pack(struct
>hdmi_vendor_infoframe *frame,
>> length = hdmi_avi_infoframe_pack_only(&frame->avi,
>> buffer, size);
>> break;
>> + case HDMI_INFOFRAME_TYPE_DRM:
>> + length = hdmi_drm_infoframe_pack_only(&frame->drm,
>> + buffer, size);
>> + break;
>> case HDMI_INFOFRAME_TYPE_SPD:
>> length = hdmi_spd_infoframe_pack_only(&frame->spd,
>> buffer, size);
>> @@ -806,6 +951,9 @@ ssize_t hdmi_vendor_infoframe_pack(struct
>hdmi_vendor_infoframe *frame,
>> case HDMI_INFOFRAME_TYPE_AVI:
>> length = hdmi_avi_infoframe_pack(&frame->avi, buffer, size);
>> break;
>> + case HDMI_INFOFRAME_TYPE_DRM:
>> + length = hdmi_drm_infoframe_pack(&frame->drm, buffer, size);
>> + break;
>> case HDMI_INFOFRAME_TYPE_SPD:
>> length = hdmi_spd_infoframe_pack(&frame->spd, buffer, size);
>> break;
>> @@ -838,6 +986,8 @@ static const char *hdmi_infoframe_type_get_name(enum
>hdmi_infoframe_type type)
>> return "Source Product Description (SPD)";
>> case HDMI_INFOFRAME_TYPE_AUDIO:
>> return "Audio";
>> + case HDMI_INFOFRAME_TYPE_DRM:
>> + return "Dynamic Range and Mastering";
>> }
>> return "Reserved";
>> }
>> @@ -1284,6 +1434,40 @@ static void hdmi_audio_infoframe_log(const char
>*level,
>> frame->downmix_inhibit ? "Yes" : "No"); }
>>
>> +/**
>> + * hdmi_drm_infoframe_log() - log info of HDMI DRM infoframe
>> + * @level: logging level
>> + * @dev: device
>> + * @frame: HDMI DRM infoframe
>> + */
>> +static void hdmi_drm_infoframe_log(const char *level,
>> + struct device *dev,
>> + const struct hdmi_drm_infoframe *frame) {
>> + int i;
>> +
>> + hdmi_infoframe_log_header(level, dev,
>> + (struct hdmi_any_infoframe *)frame);
>> + hdmi_log("length: %d\n", frame->length);
>> + hdmi_log("metadata type: %d\n", frame->metadata_type);
>> + hdmi_log("eotf: %d\n", frame->eotf);
>> + for (i = 0; i < 3; i++) {
>> + hdmi_log("x[%d]: %d\n", i, frame->display_primaries[i].x);
>> + hdmi_log("y[%d]: %d\n", i, frame->display_primaries[i].y);
>> + }
>> +
>> + hdmi_log("white point x: %d\n", frame->white_point.x);
>> + hdmi_log("white point y: %d\n", frame->white_point.y);
>> +
>> + hdmi_log("max_display_mastering_luminance: %d\n",
>> + frame->max_display_mastering_luminance);
>> + hdmi_log("min_display_mastering_luminance: %d\n",
>> + frame->min_display_mastering_luminance);
>> +
>> + hdmi_log("max_cll: %d\n", frame->max_cll);
>> + hdmi_log("max_fall: %d\n", frame->max_fall); }
>> +
>> static const char *
>> hdmi_3d_structure_get_name(enum hdmi_3d_structure s3d_struct) { @@
>> -1372,6 +1556,9 @@ void hdmi_infoframe_log(const char *level,
>> case HDMI_INFOFRAME_TYPE_VENDOR:
>> hdmi_vendor_any_infoframe_log(level, dev, &frame->vendor);
>> break;
>> + case HDMI_INFOFRAME_TYPE_DRM:
>> + hdmi_drm_infoframe_log(level, dev, &frame->drm);
>> + break;
>> }
>> }
>> EXPORT_SYMBOL(hdmi_infoframe_log);
>> diff --git a/include/drm/drm_edid.h b/include/drm/drm_edid.h index
>> 9d3b5b9..4ba56f5 100644
>> --- a/include/drm/drm_edid.h
>> +++ b/include/drm/drm_edid.h
>> @@ -25,6 +25,7 @@
>>
>> #include <linux/types.h>
>> #include <linux/hdmi.h>
>> +#include <drm/drm_mode.h>
>>
>> struct drm_device;
>> struct i2c_adapter;
>> @@ -370,6 +371,10 @@ int drm_av_sync_delay(struct drm_connector *connector,
>> const struct drm_display_mode *mode,
>> enum hdmi_quantization_range rgb_quant_range);
>>
>> +int
>> +drm_hdmi_infoframe_set_hdr_metadata(struct hdmi_drm_infoframe *frame,
>> + const struct hdr_output_metadata
>*hdr_metadata);
>> +
>> /**
>> * drm_eld_mnl - Get ELD monitor name length in bytes.
>> * @eld: pointer to an eld memory structure with mnl set diff --git
>> a/include/linux/hdmi.h b/include/linux/hdmi.h index 6780476..7edafcf
>> 100644
>> --- a/include/linux/hdmi.h
>> +++ b/include/linux/hdmi.h
>> @@ -47,6 +47,7 @@ enum hdmi_infoframe_type {
>> HDMI_INFOFRAME_TYPE_AVI = 0x82,
>> HDMI_INFOFRAME_TYPE_SPD = 0x83,
>> HDMI_INFOFRAME_TYPE_AUDIO = 0x84,
>> + HDMI_INFOFRAME_TYPE_DRM = 0x87,
>> };
>>
>> #define HDMI_IEEE_OUI 0x000c03
>> @@ -185,12 +186,37 @@ struct hdmi_avi_infoframe {
>> unsigned short right_bar;
>> };
>>
>> +/* DRM Infoframe as per CTA 861.G spec */ struct hdmi_drm_infoframe {
>> + enum hdmi_infoframe_type type;
>> + unsigned char version;
>> + unsigned char length;
>> + enum hdmi_eotf eotf;
>> + enum hdmi_metadata_type metadata_type;
>> + struct {
>> + u16 x, y;
>> + } display_primaries[3];
>> + struct {
>> + u16 x, y;
>> + } white_point;
>> + u16 max_display_mastering_luminance;
>> + u16 min_display_mastering_luminance;
>> + u16 max_cll;
>> + u16 max_fall;
>> +};
>> +
>> int hdmi_avi_infoframe_init(struct hdmi_avi_infoframe *frame);
>> ssize_t hdmi_avi_infoframe_pack(struct hdmi_avi_infoframe *frame, void *buffer,
>> size_t size);
>> ssize_t hdmi_avi_infoframe_pack_only(const struct hdmi_avi_infoframe *frame,
>> void *buffer, size_t size);
>> int hdmi_avi_infoframe_check(struct hdmi_avi_infoframe *frame);
>> +int hdmi_drm_infoframe_init(struct hdmi_drm_infoframe *frame);
>> +ssize_t hdmi_drm_infoframe_pack(struct hdmi_drm_infoframe *frame, void
>*buffer,
>> + size_t size);
>> +ssize_t hdmi_drm_infoframe_pack_only(const struct hdmi_drm_infoframe *frame,
>> + void *buffer, size_t size);
>> +int hdmi_drm_infoframe_check(struct hdmi_drm_infoframe *frame);
>>
>> enum hdmi_spd_sdi {
>> HDMI_SPD_SDI_UNKNOWN,
>> @@ -381,6 +407,7 @@ ssize_t hdmi_vendor_infoframe_pack_only(const struct
>hdmi_vendor_infoframe *fram
>> struct hdmi_spd_infoframe spd;
>> union hdmi_vendor_any_infoframe vendor;
>> struct hdmi_audio_infoframe audio;
>> + struct hdmi_drm_infoframe drm;
>> };
>>
>> ssize_t hdmi_infoframe_pack(union hdmi_infoframe *frame, void
>> *buffer,
>> --
>> 1.9.1
>
>--
>Ville Syrjälä
>Intel
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 27+ messages in thread
* [v10 05/12] drm/i915: Attach HDR metadata property to connector
2019-05-14 17:36 [v10 00/12] Add HDR Metadata Parsing and handling in DRM layer Uma Shankar
` (3 preceding siblings ...)
2019-05-14 17:36 ` [v10 04/12] drm: Enable HDR infoframe support Uma Shankar
@ 2019-05-14 17:36 ` Uma Shankar
2019-05-14 17:36 ` [v10 06/12] drm/i915: Write HDR infoframe and send to panel Uma Shankar
` (6 subsequent siblings)
11 siblings, 0 replies; 27+ messages in thread
From: Uma Shankar @ 2019-05-14 17:36 UTC (permalink / raw)
To: intel-gfx, dri-devel; +Cc: dcastagna, jonas, seanpaul
Attach HDR metadata property to connector object.
v2: Rebase
v3: Updated the property name as per updated name
while creating hdr metadata property
Signed-off-by: Uma Shankar <uma.shankar@intel.com>
Reviewed-by: Shashank Sharma <shashank.sharma@intel.com>
---
drivers/gpu/drm/i915/intel_hdmi.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c
index 2a4086c..92597d8 100644
--- a/drivers/gpu/drm/i915/intel_hdmi.c
+++ b/drivers/gpu/drm/i915/intel_hdmi.c
@@ -2724,6 +2724,8 @@ static void intel_hdmi_destroy(struct drm_connector *connector)
drm_connector_attach_content_type_property(connector);
connector->state->picture_aspect_ratio = HDMI_PICTURE_ASPECT_NONE;
+ drm_object_attach_property(&connector->base,
+ connector->dev->mode_config.hdr_output_metadata_property, 0);
if (!HAS_GMCH(dev_priv))
drm_connector_attach_max_bpc_property(connector, 8, 12);
--
1.9.1
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 27+ messages in thread* [v10 06/12] drm/i915: Write HDR infoframe and send to panel
2019-05-14 17:36 [v10 00/12] Add HDR Metadata Parsing and handling in DRM layer Uma Shankar
` (4 preceding siblings ...)
2019-05-14 17:36 ` [v10 05/12] drm/i915: Attach HDR metadata property to connector Uma Shankar
@ 2019-05-14 17:36 ` Uma Shankar
2019-05-14 17:36 ` [v10 07/12] drm: Add HLG EOTF Uma Shankar
` (5 subsequent siblings)
11 siblings, 0 replies; 27+ messages in thread
From: Uma Shankar @ 2019-05-14 17:36 UTC (permalink / raw)
To: intel-gfx, dri-devel
Cc: dcastagna, jonas, emil.l.velikov, Uma Shankar, seanpaul
Enable writing of HDR metadata infoframe to panel.
The data will be provid by usersapace compositors, based
on blending policies and passsed to driver through a blob
property.
v2: Rebase
v3: Fixed a warning message
v4: Addressed Shashank's review comments
v5: Rebase. Added infoframe calculation in compute config.
v6: Addressed Shashank's review comment. Added HDR metadata
support from GEN10 onwards as per Shashank's recommendation.
v7: Addressed Shashank's review comments
v8: Added Shashank's RB.
v9: Addressed Ville's review comments.
Signed-off-by: Uma Shankar <uma.shankar@intel.com>
Reviewed-by: Shashank Sharma <shashank.sharma@intel.com>
---
drivers/gpu/drm/i915/intel_drv.h | 1 +
drivers/gpu/drm/i915/intel_hdmi.c | 47 +++++++++++++++++++++++++++++++++++++++
2 files changed, 48 insertions(+)
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index 5258abb..40e2c52 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -910,6 +910,7 @@ struct intel_crtc_state {
union hdmi_infoframe avi;
union hdmi_infoframe spd;
union hdmi_infoframe hdmi;
+ union hdmi_infoframe drm;
} infoframes;
/* HDMI scrambling status */
diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c
index 92597d8..f49f949 100644
--- a/drivers/gpu/drm/i915/intel_hdmi.c
+++ b/drivers/gpu/drm/i915/intel_hdmi.c
@@ -573,6 +573,7 @@ static u32 hsw_infoframes_enabled(struct intel_encoder *encoder,
HDMI_INFOFRAME_TYPE_AVI,
HDMI_INFOFRAME_TYPE_SPD,
HDMI_INFOFRAME_TYPE_VENDOR,
+ HDMI_INFOFRAME_TYPE_DRM,
};
u32 intel_hdmi_infoframe_enable(unsigned int type)
@@ -795,6 +796,44 @@ void intel_read_infoframe(struct intel_encoder *encoder,
return true;
}
+static bool
+intel_hdmi_compute_drm_infoframe(struct intel_encoder *encoder,
+ struct intel_crtc_state *crtc_state,
+ struct drm_connector_state *conn_state)
+{
+ struct hdmi_drm_infoframe *frame = &crtc_state->infoframes.drm.drm;
+ struct hdr_output_metadata *hdr_metadata;
+ struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
+ int ret;
+
+ if (!(INTEL_GEN(dev_priv) >= 10 || IS_GEMINILAKE(dev_priv)))
+ return true;
+
+ if (!crtc_state->has_infoframe)
+ return true;
+
+ if (!conn_state->hdr_output_metadata ||
+ conn_state->hdr_output_metadata->length == 0)
+ return true;
+
+ hdr_metadata = conn_state->hdr_output_metadata->data;
+
+ crtc_state->infoframes.enable |=
+ intel_hdmi_infoframe_enable(HDMI_INFOFRAME_TYPE_DRM);
+
+ ret = drm_hdmi_infoframe_set_hdr_metadata(frame, hdr_metadata);
+ if (ret < 0) {
+ DRM_ERROR("couldn't set HDR metadata in infoframe\n");
+ return false;
+ }
+
+ ret = hdmi_drm_infoframe_check(frame);
+ if (WARN_ON(ret))
+ return false;
+
+ return true;
+}
+
static void g4x_set_infoframes(struct intel_encoder *encoder,
bool enable,
const struct intel_crtc_state *crtc_state,
@@ -1180,6 +1219,9 @@ static void hsw_set_infoframes(struct intel_encoder *encoder,
intel_write_infoframe(encoder, crtc_state,
HDMI_INFOFRAME_TYPE_VENDOR,
&crtc_state->infoframes.hdmi);
+ intel_write_infoframe(encoder, crtc_state,
+ HDMI_INFOFRAME_TYPE_DRM,
+ &crtc_state->infoframes.drm);
}
void intel_dp_dual_mode_set_tmds_output(struct intel_hdmi *hdmi, bool enable)
@@ -2386,6 +2428,11 @@ int intel_hdmi_compute_config(struct intel_encoder *encoder,
return -EINVAL;
}
+ if (!intel_hdmi_compute_drm_infoframe(encoder, pipe_config, conn_state)) {
+ DRM_DEBUG_KMS("bad DRM infoframe\n");
+ return -EINVAL;
+ }
+
return 0;
}
--
1.9.1
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply related [flat|nested] 27+ messages in thread* [v10 07/12] drm: Add HLG EOTF
2019-05-14 17:36 [v10 00/12] Add HDR Metadata Parsing and handling in DRM layer Uma Shankar
` (5 preceding siblings ...)
2019-05-14 17:36 ` [v10 06/12] drm/i915: Write HDR infoframe and send to panel Uma Shankar
@ 2019-05-14 17:36 ` Uma Shankar
2019-05-14 17:36 ` [v10 08/12] drm/i915: Enable infoframes on GLK+ for HDR Uma Shankar
` (4 subsequent siblings)
11 siblings, 0 replies; 27+ messages in thread
From: Uma Shankar @ 2019-05-14 17:36 UTC (permalink / raw)
To: intel-gfx, dri-devel; +Cc: dcastagna, jonas, seanpaul
From: Ville Syrjälä <ville.syrjala@linux.intel.com>
ADD HLG EOTF to the list of EOTF transfer functions supported.
Hybrid Log-Gamma (HLG) is a high dynamic range (HDR) standard.
HLG defines a nonlinear transfer function in which the lower
half of the signal values use a gamma curve and the upper half
of the signal values use a logarithmic curve.
v2: Rebase
v3: Fixed a warning message
v4: Addressed Shashank's review comments
v5: Addressed Jonas Karlman's review comment and dropped the i915
tag from header.
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Uma Shankar <uma.shankar@intel.com>
Reviewed-by: Shashank Sharma <shashank.sharma@intel.com>
---
drivers/gpu/drm/drm_edid.c | 3 ++-
include/linux/hdmi.h | 1 +
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
index 73b7905..bc46041 100644
--- a/drivers/gpu/drm/drm_edid.c
+++ b/drivers/gpu/drm/drm_edid.c
@@ -3851,7 +3851,8 @@ static uint8_t eotf_supported(const u8 *edid_ext)
return edid_ext[2] &
(BIT(HDMI_EOTF_TRADITIONAL_GAMMA_SDR) |
BIT(HDMI_EOTF_TRADITIONAL_GAMMA_HDR) |
- BIT(HDMI_EOTF_SMPTE_ST2084));
+ BIT(HDMI_EOTF_SMPTE_ST2084) |
+ BIT(HDMI_EOTF_BT_2100_HLG));
}
static uint8_t hdr_metadata_type(const u8 *edid_ext)
diff --git a/include/linux/hdmi.h b/include/linux/hdmi.h
index 7edafcf..3d7f10f 100644
--- a/include/linux/hdmi.h
+++ b/include/linux/hdmi.h
@@ -161,6 +161,7 @@ enum hdmi_eotf {
HDMI_EOTF_TRADITIONAL_GAMMA_SDR,
HDMI_EOTF_TRADITIONAL_GAMMA_HDR,
HDMI_EOTF_SMPTE_ST2084,
+ HDMI_EOTF_BT_2100_HLG,
};
struct hdmi_avi_infoframe {
--
1.9.1
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 27+ messages in thread* [v10 08/12] drm/i915: Enable infoframes on GLK+ for HDR
2019-05-14 17:36 [v10 00/12] Add HDR Metadata Parsing and handling in DRM layer Uma Shankar
` (6 preceding siblings ...)
2019-05-14 17:36 ` [v10 07/12] drm: Add HLG EOTF Uma Shankar
@ 2019-05-14 17:36 ` Uma Shankar
2019-05-14 17:36 ` [v10 09/12] drm/i915:Enabled Modeset when HDR Infoframe changes Uma Shankar
` (3 subsequent siblings)
11 siblings, 0 replies; 27+ messages in thread
From: Uma Shankar @ 2019-05-14 17:36 UTC (permalink / raw)
To: intel-gfx, dri-devel
Cc: dcastagna, jonas, emil.l.velikov, Uma Shankar, seanpaul
From: Ville Syrjälä <ville.syrjala@linux.intel.com>
This patch enables infoframes on GLK+ to be
used to send HDR metadata to HDMI sink.
v2: Addressed Shashank's review comment.
v3: Addressed Shashank's review comment.
v4: Added Shashank's RB.
v5: Dropped hdr_metadata_change check while modeset, as per
Ville's suggestion.
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Uma Shankar <uma.shankar@intel.com>
Reviewed-by: Shashank Sharma <shashank.sharma@intel.com>
---
drivers/gpu/drm/i915/i915_reg.h | 4 ++++
drivers/gpu/drm/i915/intel_hdmi.c | 19 +++++++++++++++----
2 files changed, 19 insertions(+), 4 deletions(-)
diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
index e97c47f..d3f5510 100644
--- a/drivers/gpu/drm/i915/i915_reg.h
+++ b/drivers/gpu/drm/i915/i915_reg.h
@@ -4694,6 +4694,7 @@ enum {
#define VIDEO_DIP_FREQ_MASK (3 << 16)
/* HSW and later: */
#define DRM_DIP_ENABLE (1 << 28)
+#define VIDEO_DIP_ENABLE_DRM_GLK (1 << 28)
#define PSR_VSC_BIT_7_SET (1 << 27)
#define VSC_SELECT_MASK (0x3 << 25)
#define VSC_SELECT_SHIFT 25
@@ -8146,6 +8147,7 @@ enum {
#define _HSW_VIDEO_DIP_SPD_DATA_A 0x602A0
#define _HSW_VIDEO_DIP_GMP_DATA_A 0x602E0
#define _HSW_VIDEO_DIP_VSC_DATA_A 0x60320
+#define _GLK_VIDEO_DIP_DRM_DATA_A 0x60440
#define _HSW_VIDEO_DIP_AVI_ECC_A 0x60240
#define _HSW_VIDEO_DIP_VS_ECC_A 0x60280
#define _HSW_VIDEO_DIP_SPD_ECC_A 0x602C0
@@ -8159,6 +8161,7 @@ enum {
#define _HSW_VIDEO_DIP_SPD_DATA_B 0x612A0
#define _HSW_VIDEO_DIP_GMP_DATA_B 0x612E0
#define _HSW_VIDEO_DIP_VSC_DATA_B 0x61320
+#define _GLK_VIDEO_DIP_DRM_DATA_B 0x61440
#define _HSW_VIDEO_DIP_BVI_ECC_B 0x61240
#define _HSW_VIDEO_DIP_VS_ECC_B 0x61280
#define _HSW_VIDEO_DIP_SPD_ECC_B 0x612C0
@@ -8184,6 +8187,7 @@ enum {
#define HSW_TVIDEO_DIP_SPD_DATA(trans, i) _MMIO_TRANS2(trans, _HSW_VIDEO_DIP_SPD_DATA_A + (i) * 4)
#define HSW_TVIDEO_DIP_GMP_DATA(trans, i) _MMIO_TRANS2(trans, _HSW_VIDEO_DIP_GMP_DATA_A + (i) * 4)
#define HSW_TVIDEO_DIP_VSC_DATA(trans, i) _MMIO_TRANS2(trans, _HSW_VIDEO_DIP_VSC_DATA_A + (i) * 4)
+#define GLK_TVIDEO_DIP_DRM_DATA(trans, i) _MMIO_TRANS2(trans, _GLK_VIDEO_DIP_DRM_DATA_A + (i) * 4)
#define ICL_VIDEO_DIP_PPS_DATA(trans, i) _MMIO_TRANS2(trans, _ICL_VIDEO_DIP_PPS_DATA_A + (i) * 4)
#define ICL_VIDEO_DIP_PPS_ECC(trans, i) _MMIO_TRANS2(trans, _ICL_VIDEO_DIP_PPS_ECC_A + (i) * 4)
diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c
index f49f949..b80406b 100644
--- a/drivers/gpu/drm/i915/intel_hdmi.c
+++ b/drivers/gpu/drm/i915/intel_hdmi.c
@@ -152,6 +152,8 @@ static u32 hsw_infoframe_enable(unsigned int type)
return VIDEO_DIP_ENABLE_SPD_HSW;
case HDMI_INFOFRAME_TYPE_VENDOR:
return VIDEO_DIP_ENABLE_VS_HSW;
+ case HDMI_INFOFRAME_TYPE_DRM:
+ return VIDEO_DIP_ENABLE_DRM_GLK;
default:
MISSING_CASE(type);
return 0;
@@ -177,6 +179,8 @@ static u32 hsw_infoframe_enable(unsigned int type)
return HSW_TVIDEO_DIP_SPD_DATA(cpu_transcoder, i);
case HDMI_INFOFRAME_TYPE_VENDOR:
return HSW_TVIDEO_DIP_VS_DATA(cpu_transcoder, i);
+ case HDMI_INFOFRAME_TYPE_DRM:
+ return GLK_TVIDEO_DIP_DRM_DATA(cpu_transcoder, i);
default:
MISSING_CASE(type);
return INVALID_MMIO_REG;
@@ -560,10 +564,16 @@ static u32 hsw_infoframes_enabled(struct intel_encoder *encoder,
{
struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
u32 val = I915_READ(HSW_TVIDEO_DIP_CTL(pipe_config->cpu_transcoder));
+ u32 mask;
- return val & (VIDEO_DIP_ENABLE_VSC_HSW | VIDEO_DIP_ENABLE_AVI_HSW |
- VIDEO_DIP_ENABLE_GCP_HSW | VIDEO_DIP_ENABLE_VS_HSW |
- VIDEO_DIP_ENABLE_GMP_HSW | VIDEO_DIP_ENABLE_SPD_HSW);
+ mask = (VIDEO_DIP_ENABLE_VSC_HSW | VIDEO_DIP_ENABLE_AVI_HSW |
+ VIDEO_DIP_ENABLE_GCP_HSW | VIDEO_DIP_ENABLE_VS_HSW |
+ VIDEO_DIP_ENABLE_GMP_HSW | VIDEO_DIP_ENABLE_SPD_HSW);
+
+ if (INTEL_GEN(dev_priv) >= 10 || IS_GEMINILAKE(dev_priv))
+ mask |= VIDEO_DIP_ENABLE_DRM_GLK;
+
+ return val & mask;
}
static const u8 infoframe_type_to_idx[] = {
@@ -1196,7 +1206,8 @@ static void hsw_set_infoframes(struct intel_encoder *encoder,
val &= ~(VIDEO_DIP_ENABLE_VSC_HSW | VIDEO_DIP_ENABLE_AVI_HSW |
VIDEO_DIP_ENABLE_GCP_HSW | VIDEO_DIP_ENABLE_VS_HSW |
- VIDEO_DIP_ENABLE_GMP_HSW | VIDEO_DIP_ENABLE_SPD_HSW);
+ VIDEO_DIP_ENABLE_GMP_HSW | VIDEO_DIP_ENABLE_SPD_HSW |
+ VIDEO_DIP_ENABLE_DRM_GLK);
if (!enable) {
I915_WRITE(reg, val);
--
1.9.1
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply related [flat|nested] 27+ messages in thread* [v10 09/12] drm/i915:Enabled Modeset when HDR Infoframe changes
2019-05-14 17:36 [v10 00/12] Add HDR Metadata Parsing and handling in DRM layer Uma Shankar
` (7 preceding siblings ...)
2019-05-14 17:36 ` [v10 08/12] drm/i915: Enable infoframes on GLK+ for HDR Uma Shankar
@ 2019-05-14 17:36 ` Uma Shankar
2019-05-15 19:27 ` Ville Syrjälä
2019-05-14 17:36 ` [v10 10/12] drm/i915: Added DRM Infoframe handling for BYT/CHT Uma Shankar
` (2 subsequent siblings)
11 siblings, 1 reply; 27+ messages in thread
From: Uma Shankar @ 2019-05-14 17:36 UTC (permalink / raw)
To: intel-gfx, dri-devel; +Cc: dcastagna, jonas, seanpaul
This patch enables modeset whenever HDR metadata
needs to be updated to sink.
v2: Addressed Shashank's review comments.
v3: Added Shashank's RB.
v4: Addressed Ville's review comments.
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Uma Shankar <uma.shankar@intel.com>
Reviewed-by: Shashank Sharma <shashank.sharma@intel.com>
---
drivers/gpu/drm/i915/intel_atomic.c | 14 +++++++++++++-
drivers/gpu/drm/i915/intel_hdmi.c | 13 +++++++++++++
2 files changed, 26 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/i915/intel_atomic.c b/drivers/gpu/drm/i915/intel_atomic.c
index 58b8049..6b985e8 100644
--- a/drivers/gpu/drm/i915/intel_atomic.c
+++ b/drivers/gpu/drm/i915/intel_atomic.c
@@ -105,6 +105,16 @@ int intel_digital_connector_atomic_set_property(struct drm_connector *connector,
return -EINVAL;
}
+static bool blob_equal(const struct drm_property_blob *a,
+ const struct drm_property_blob *b)
+{
+ if (a && b)
+ return a->length == b->length &&
+ !memcmp(a->data, b->data, a->length);
+
+ return !a == !b;
+}
+
int intel_digital_connector_atomic_check(struct drm_connector *conn,
struct drm_connector_state *new_state)
{
@@ -132,7 +142,9 @@ int intel_digital_connector_atomic_check(struct drm_connector *conn,
new_conn_state->base.colorspace != old_conn_state->base.colorspace ||
new_conn_state->base.picture_aspect_ratio != old_conn_state->base.picture_aspect_ratio ||
new_conn_state->base.content_type != old_conn_state->base.content_type ||
- new_conn_state->base.scaling_mode != old_conn_state->base.scaling_mode)
+ new_conn_state->base.scaling_mode != old_conn_state->base.scaling_mode ||
+ !blob_equal(new_conn_state->base.hdr_output_metadata,
+ old_conn_state->base.hdr_output_metadata))
crtc_state->mode_changed = true;
return 0;
diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c
index b80406b..e97bf6e 100644
--- a/drivers/gpu/drm/i915/intel_hdmi.c
+++ b/drivers/gpu/drm/i915/intel_hdmi.c
@@ -806,6 +806,11 @@ void intel_read_infoframe(struct intel_encoder *encoder,
return true;
}
+static inline bool is_eotf_supported(u8 output_eotf, u8 sink_eotf)
+{
+ return sink_eotf & BIT(output_eotf);
+}
+
static bool
intel_hdmi_compute_drm_infoframe(struct intel_encoder *encoder,
struct intel_crtc_state *crtc_state,
@@ -814,6 +819,7 @@ void intel_read_infoframe(struct intel_encoder *encoder,
struct hdmi_drm_infoframe *frame = &crtc_state->infoframes.drm.drm;
struct hdr_output_metadata *hdr_metadata;
struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
+ struct drm_connector *connector = conn_state->connector;
int ret;
if (!(INTEL_GEN(dev_priv) >= 10 || IS_GEMINILAKE(dev_priv)))
@@ -828,6 +834,13 @@ void intel_read_infoframe(struct intel_encoder *encoder,
hdr_metadata = conn_state->hdr_output_metadata->data;
+ /* Sink EOTF is Bit map while infoframe is absolute values */
+ if (!is_eotf_supported(hdr_metadata->hdmi_metadata_type1.eotf,
+ connector->hdr_sink_metadata.hdmi_type1.eotf)) {
+ DRM_ERROR("EOTF Not Supported\n");
+ return true;
+ }
+
crtc_state->infoframes.enable |=
intel_hdmi_infoframe_enable(HDMI_INFOFRAME_TYPE_DRM);
--
1.9.1
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 27+ messages in thread* Re: [v10 09/12] drm/i915:Enabled Modeset when HDR Infoframe changes
2019-05-14 17:36 ` [v10 09/12] drm/i915:Enabled Modeset when HDR Infoframe changes Uma Shankar
@ 2019-05-15 19:27 ` Ville Syrjälä
2019-05-16 10:54 ` Shankar, Uma
0 siblings, 1 reply; 27+ messages in thread
From: Ville Syrjälä @ 2019-05-15 19:27 UTC (permalink / raw)
To: Uma Shankar
Cc: dcastagna, jonas, intel-gfx, emil.l.velikov, dri-devel, seanpaul
On Tue, May 14, 2019 at 11:06:31PM +0530, Uma Shankar wrote:
> This patch enables modeset whenever HDR metadata
> needs to be updated to sink.
>
> v2: Addressed Shashank's review comments.
>
> v3: Added Shashank's RB.
>
> v4: Addressed Ville's review comments.
>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Signed-off-by: Uma Shankar <uma.shankar@intel.com>
> Reviewed-by: Shashank Sharma <shashank.sharma@intel.com>
> ---
> drivers/gpu/drm/i915/intel_atomic.c | 14 +++++++++++++-
> drivers/gpu/drm/i915/intel_hdmi.c | 13 +++++++++++++
> 2 files changed, 26 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_atomic.c b/drivers/gpu/drm/i915/intel_atomic.c
> index 58b8049..6b985e8 100644
> --- a/drivers/gpu/drm/i915/intel_atomic.c
> +++ b/drivers/gpu/drm/i915/intel_atomic.c
> @@ -105,6 +105,16 @@ int intel_digital_connector_atomic_set_property(struct drm_connector *connector,
> return -EINVAL;
> }
>
> +static bool blob_equal(const struct drm_property_blob *a,
> + const struct drm_property_blob *b)
> +{
> + if (a && b)
> + return a->length == b->length &&
> + !memcmp(a->data, b->data, a->length);
> +
> + return !a == !b;
> +}
> +
> int intel_digital_connector_atomic_check(struct drm_connector *conn,
> struct drm_connector_state *new_state)
> {
> @@ -132,7 +142,9 @@ int intel_digital_connector_atomic_check(struct drm_connector *conn,
> new_conn_state->base.colorspace != old_conn_state->base.colorspace ||
> new_conn_state->base.picture_aspect_ratio != old_conn_state->base.picture_aspect_ratio ||
> new_conn_state->base.content_type != old_conn_state->base.content_type ||
> - new_conn_state->base.scaling_mode != old_conn_state->base.scaling_mode)
> + new_conn_state->base.scaling_mode != old_conn_state->base.scaling_mode ||
> + !blob_equal(new_conn_state->base.hdr_output_metadata,
> + old_conn_state->base.hdr_output_metadata))
> crtc_state->mode_changed = true;
>
> return 0;
> diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c
> index b80406b..e97bf6e 100644
> --- a/drivers/gpu/drm/i915/intel_hdmi.c
> +++ b/drivers/gpu/drm/i915/intel_hdmi.c
> @@ -806,6 +806,11 @@ void intel_read_infoframe(struct intel_encoder *encoder,
> return true;
> }
>
> +static inline bool is_eotf_supported(u8 output_eotf, u8 sink_eotf)
> +{
> + return sink_eotf & BIT(output_eotf);
> +}
> +
> static bool
> intel_hdmi_compute_drm_infoframe(struct intel_encoder *encoder,
> struct intel_crtc_state *crtc_state,
> @@ -814,6 +819,7 @@ void intel_read_infoframe(struct intel_encoder *encoder,
> struct hdmi_drm_infoframe *frame = &crtc_state->infoframes.drm.drm;
> struct hdr_output_metadata *hdr_metadata;
> struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
> + struct drm_connector *connector = conn_state->connector;
> int ret;
>
> if (!(INTEL_GEN(dev_priv) >= 10 || IS_GEMINILAKE(dev_priv)))
> @@ -828,6 +834,13 @@ void intel_read_infoframe(struct intel_encoder *encoder,
>
> hdr_metadata = conn_state->hdr_output_metadata->data;
>
> + /* Sink EOTF is Bit map while infoframe is absolute values */
> + if (!is_eotf_supported(hdr_metadata->hdmi_metadata_type1.eotf,
> + connector->hdr_sink_metadata.hdmi_type1.eotf)) {
> + DRM_ERROR("EOTF Not Supported\n");
> + return true;
> + }
I was going to say that this should probably be in the
drm_set_hdr_metdata() or whatever it was called.
But now I'm now wondering if we can even have this check
here. What happens if someone does a display switcheroo
while the machine is suspended? Depends on when we're going to
reprobe the displays I suppose. Hmm. Maybe it's fine. We already
have a similar issue after all wih the has_hdmi2_sink stuff.
Either way the user triggerable DRM_ERROR()s are at least a nono.
> +
> crtc_state->infoframes.enable |=
> intel_hdmi_infoframe_enable(HDMI_INFOFRAME_TYPE_DRM);
>
> --
> 1.9.1
--
Ville Syrjälä
Intel
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 27+ messages in thread* Re: [v10 09/12] drm/i915:Enabled Modeset when HDR Infoframe changes
2019-05-15 19:27 ` Ville Syrjälä
@ 2019-05-16 10:54 ` Shankar, Uma
2019-05-16 13:13 ` Ville Syrjälä
0 siblings, 1 reply; 27+ messages in thread
From: Shankar, Uma @ 2019-05-16 10:54 UTC (permalink / raw)
To: Ville Syrjälä
Cc: dcastagna@chromium.org, jonas@kwiboo.se,
intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
seanpaul@chromium.org
>-----Original Message-----
>From: dri-devel [mailto:dri-devel-bounces@lists.freedesktop.org] On Behalf Of Ville
>Syrjälä
>Sent: Thursday, May 16, 2019 12:57 AM
>To: Shankar, Uma <uma.shankar@intel.com>
>Cc: dcastagna@chromium.org; jonas@kwiboo.se; intel-gfx@lists.freedesktop.org;
>emil.l.velikov@gmail.com; dri-devel@lists.freedesktop.org; seanpaul@chromium.org
>Subject: Re: [v10 09/12] drm/i915:Enabled Modeset when HDR Infoframe changes
>
>On Tue, May 14, 2019 at 11:06:31PM +0530, Uma Shankar wrote:
>> This patch enables modeset whenever HDR metadata needs to be updated
>> to sink.
>>
>> v2: Addressed Shashank's review comments.
>>
>> v3: Added Shashank's RB.
>>
>> v4: Addressed Ville's review comments.
>>
>> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
>> Signed-off-by: Uma Shankar <uma.shankar@intel.com>
>> Reviewed-by: Shashank Sharma <shashank.sharma@intel.com>
>> ---
>> drivers/gpu/drm/i915/intel_atomic.c | 14 +++++++++++++-
>> drivers/gpu/drm/i915/intel_hdmi.c | 13 +++++++++++++
>> 2 files changed, 26 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/gpu/drm/i915/intel_atomic.c
>> b/drivers/gpu/drm/i915/intel_atomic.c
>> index 58b8049..6b985e8 100644
>> --- a/drivers/gpu/drm/i915/intel_atomic.c
>> +++ b/drivers/gpu/drm/i915/intel_atomic.c
>> @@ -105,6 +105,16 @@ int intel_digital_connector_atomic_set_property(struct
>drm_connector *connector,
>> return -EINVAL;
>> }
>>
>> +static bool blob_equal(const struct drm_property_blob *a,
>> + const struct drm_property_blob *b) {
>> + if (a && b)
>> + return a->length == b->length &&
>> + !memcmp(a->data, b->data, a->length);
>> +
>> + return !a == !b;
>> +}
>> +
>> int intel_digital_connector_atomic_check(struct drm_connector *conn,
>> struct drm_connector_state *new_state) {
>@@ -132,7 +142,9 @@
>> int intel_digital_connector_atomic_check(struct drm_connector *conn,
>> new_conn_state->base.colorspace != old_conn_state->base.colorspace ||
>> new_conn_state->base.picture_aspect_ratio != old_conn_state-
>>base.picture_aspect_ratio ||
>> new_conn_state->base.content_type != old_conn_state-
>>base.content_type ||
>> - new_conn_state->base.scaling_mode != old_conn_state-
>>base.scaling_mode)
>> + new_conn_state->base.scaling_mode != old_conn_state-
>>base.scaling_mode ||
>> + !blob_equal(new_conn_state->base.hdr_output_metadata,
>> + old_conn_state->base.hdr_output_metadata))
>> crtc_state->mode_changed = true;
>>
>> return 0;
>> diff --git a/drivers/gpu/drm/i915/intel_hdmi.c
>> b/drivers/gpu/drm/i915/intel_hdmi.c
>> index b80406b..e97bf6e 100644
>> --- a/drivers/gpu/drm/i915/intel_hdmi.c
>> +++ b/drivers/gpu/drm/i915/intel_hdmi.c
>> @@ -806,6 +806,11 @@ void intel_read_infoframe(struct intel_encoder *encoder,
>> return true;
>> }
>>
>> +static inline bool is_eotf_supported(u8 output_eotf, u8 sink_eotf) {
>> + return sink_eotf & BIT(output_eotf); }
>> +
>> static bool
>> intel_hdmi_compute_drm_infoframe(struct intel_encoder *encoder,
>> struct intel_crtc_state *crtc_state, @@ -814,6
>+819,7 @@ void
>> intel_read_infoframe(struct intel_encoder *encoder,
>> struct hdmi_drm_infoframe *frame = &crtc_state->infoframes.drm.drm;
>> struct hdr_output_metadata *hdr_metadata;
>> struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
>> + struct drm_connector *connector = conn_state->connector;
>> int ret;
>>
>> if (!(INTEL_GEN(dev_priv) >= 10 || IS_GEMINILAKE(dev_priv))) @@
>> -828,6 +834,13 @@ void intel_read_infoframe(struct intel_encoder
>> *encoder,
>>
>> hdr_metadata = conn_state->hdr_output_metadata->data;
>>
>> + /* Sink EOTF is Bit map while infoframe is absolute values */
>> + if (!is_eotf_supported(hdr_metadata->hdmi_metadata_type1.eotf,
>> + connector->hdr_sink_metadata.hdmi_type1.eotf)) {
>> + DRM_ERROR("EOTF Not Supported\n");
>> + return true;
>> + }
>
>I was going to say that this should probably be in the
>drm_set_hdr_metdata() or whatever it was called.
>
>But now I'm now wondering if we can even have this check here. What happens if
>someone does a display switcheroo while the machine is suspended? Depends on
>when we're going to reprobe the displays I suppose. Hmm. Maybe it's fine. We
>already have a similar issue after all wih the has_hdmi2_sink stuff.
>
>Either way the user triggerable DRM_ERROR()s are at least a nono.
Ok, Will keep the check and move it inside the drm_set_hdr_metdata(). Also downgrade
the print as INFO instead of ERROR. Hope this is fine.
>> +
>> crtc_state->infoframes.enable |=
>> intel_hdmi_infoframe_enable(HDMI_INFOFRAME_TYPE_DRM);
>>
>> --
>> 1.9.1
>
>--
>Ville Syrjälä
>Intel
>_______________________________________________
>dri-devel mailing list
>dri-devel@lists.freedesktop.org
>https://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 27+ messages in thread* Re: [v10 09/12] drm/i915:Enabled Modeset when HDR Infoframe changes
2019-05-16 10:54 ` Shankar, Uma
@ 2019-05-16 13:13 ` Ville Syrjälä
0 siblings, 0 replies; 27+ messages in thread
From: Ville Syrjälä @ 2019-05-16 13:13 UTC (permalink / raw)
To: Shankar, Uma
Cc: dcastagna@chromium.org, jonas@kwiboo.se,
intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
seanpaul@chromium.org
On Thu, May 16, 2019 at 10:54:14AM +0000, Shankar, Uma wrote:
>
>
> >-----Original Message-----
> >From: dri-devel [mailto:dri-devel-bounces@lists.freedesktop.org] On Behalf Of Ville
> >Syrjälä
> >Sent: Thursday, May 16, 2019 12:57 AM
> >To: Shankar, Uma <uma.shankar@intel.com>
> >Cc: dcastagna@chromium.org; jonas@kwiboo.se; intel-gfx@lists.freedesktop.org;
> >emil.l.velikov@gmail.com; dri-devel@lists.freedesktop.org; seanpaul@chromium.org
> >Subject: Re: [v10 09/12] drm/i915:Enabled Modeset when HDR Infoframe changes
> >
> >On Tue, May 14, 2019 at 11:06:31PM +0530, Uma Shankar wrote:
> >> This patch enables modeset whenever HDR metadata needs to be updated
> >> to sink.
> >>
> >> v2: Addressed Shashank's review comments.
> >>
> >> v3: Added Shashank's RB.
> >>
> >> v4: Addressed Ville's review comments.
> >>
> >> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> >> Signed-off-by: Uma Shankar <uma.shankar@intel.com>
> >> Reviewed-by: Shashank Sharma <shashank.sharma@intel.com>
> >> ---
> >> drivers/gpu/drm/i915/intel_atomic.c | 14 +++++++++++++-
> >> drivers/gpu/drm/i915/intel_hdmi.c | 13 +++++++++++++
> >> 2 files changed, 26 insertions(+), 1 deletion(-)
> >>
> >> diff --git a/drivers/gpu/drm/i915/intel_atomic.c
> >> b/drivers/gpu/drm/i915/intel_atomic.c
> >> index 58b8049..6b985e8 100644
> >> --- a/drivers/gpu/drm/i915/intel_atomic.c
> >> +++ b/drivers/gpu/drm/i915/intel_atomic.c
> >> @@ -105,6 +105,16 @@ int intel_digital_connector_atomic_set_property(struct
> >drm_connector *connector,
> >> return -EINVAL;
> >> }
> >>
> >> +static bool blob_equal(const struct drm_property_blob *a,
> >> + const struct drm_property_blob *b) {
> >> + if (a && b)
> >> + return a->length == b->length &&
> >> + !memcmp(a->data, b->data, a->length);
> >> +
> >> + return !a == !b;
> >> +}
> >> +
> >> int intel_digital_connector_atomic_check(struct drm_connector *conn,
> >> struct drm_connector_state *new_state) {
> >@@ -132,7 +142,9 @@
> >> int intel_digital_connector_atomic_check(struct drm_connector *conn,
> >> new_conn_state->base.colorspace != old_conn_state->base.colorspace ||
> >> new_conn_state->base.picture_aspect_ratio != old_conn_state-
> >>base.picture_aspect_ratio ||
> >> new_conn_state->base.content_type != old_conn_state-
> >>base.content_type ||
> >> - new_conn_state->base.scaling_mode != old_conn_state-
> >>base.scaling_mode)
> >> + new_conn_state->base.scaling_mode != old_conn_state-
> >>base.scaling_mode ||
> >> + !blob_equal(new_conn_state->base.hdr_output_metadata,
> >> + old_conn_state->base.hdr_output_metadata))
> >> crtc_state->mode_changed = true;
> >>
> >> return 0;
> >> diff --git a/drivers/gpu/drm/i915/intel_hdmi.c
> >> b/drivers/gpu/drm/i915/intel_hdmi.c
> >> index b80406b..e97bf6e 100644
> >> --- a/drivers/gpu/drm/i915/intel_hdmi.c
> >> +++ b/drivers/gpu/drm/i915/intel_hdmi.c
> >> @@ -806,6 +806,11 @@ void intel_read_infoframe(struct intel_encoder *encoder,
> >> return true;
> >> }
> >>
> >> +static inline bool is_eotf_supported(u8 output_eotf, u8 sink_eotf) {
> >> + return sink_eotf & BIT(output_eotf); }
> >> +
> >> static bool
> >> intel_hdmi_compute_drm_infoframe(struct intel_encoder *encoder,
> >> struct intel_crtc_state *crtc_state, @@ -814,6
> >+819,7 @@ void
> >> intel_read_infoframe(struct intel_encoder *encoder,
> >> struct hdmi_drm_infoframe *frame = &crtc_state->infoframes.drm.drm;
> >> struct hdr_output_metadata *hdr_metadata;
> >> struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
> >> + struct drm_connector *connector = conn_state->connector;
> >> int ret;
> >>
> >> if (!(INTEL_GEN(dev_priv) >= 10 || IS_GEMINILAKE(dev_priv))) @@
> >> -828,6 +834,13 @@ void intel_read_infoframe(struct intel_encoder
> >> *encoder,
> >>
> >> hdr_metadata = conn_state->hdr_output_metadata->data;
> >>
> >> + /* Sink EOTF is Bit map while infoframe is absolute values */
> >> + if (!is_eotf_supported(hdr_metadata->hdmi_metadata_type1.eotf,
> >> + connector->hdr_sink_metadata.hdmi_type1.eotf)) {
> >> + DRM_ERROR("EOTF Not Supported\n");
> >> + return true;
> >> + }
> >
> >I was going to say that this should probably be in the
> >drm_set_hdr_metdata() or whatever it was called.
> >
> >But now I'm now wondering if we can even have this check here. What happens if
> >someone does a display switcheroo while the machine is suspended? Depends on
> >when we're going to reprobe the displays I suppose. Hmm. Maybe it's fine. We
> >already have a similar issue after all wih the has_hdmi2_sink stuff.
> >
> >Either way the user triggerable DRM_ERROR()s are at least a nono.
>
> Ok, Will keep the check and move it inside the drm_set_hdr_metdata(). Also downgrade
> the print as INFO instead of ERROR. Hope this is fine.
DEBUG_KMS like everything else.
>
> >> +
> >> crtc_state->infoframes.enable |=
> >> intel_hdmi_infoframe_enable(HDMI_INFOFRAME_TYPE_DRM);
> >>
> >> --
> >> 1.9.1
> >
> >--
> >Ville Syrjälä
> >Intel
> >_______________________________________________
> >dri-devel mailing list
> >dri-devel@lists.freedesktop.org
> >https://lists.freedesktop.org/mailman/listinfo/dri-devel
--
Ville Syrjälä
Intel
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 27+ messages in thread
* [v10 10/12] drm/i915: Added DRM Infoframe handling for BYT/CHT
2019-05-14 17:36 [v10 00/12] Add HDR Metadata Parsing and handling in DRM layer Uma Shankar
` (8 preceding siblings ...)
2019-05-14 17:36 ` [v10 09/12] drm/i915:Enabled Modeset when HDR Infoframe changes Uma Shankar
@ 2019-05-14 17:36 ` Uma Shankar
2019-05-14 17:36 ` [v10 11/12] video/hdmi: Add Unpack function for DRM infoframe Uma Shankar
2019-05-14 17:36 ` [v10 12/12] drm/i915: Add state readout " Uma Shankar
11 siblings, 0 replies; 27+ messages in thread
From: Uma Shankar @ 2019-05-14 17:36 UTC (permalink / raw)
To: intel-gfx, dri-devel; +Cc: dcastagna, jonas, seanpaul
BYT/CHT doesn't support DRM Infoframe. This caused
a WARN_ON due to a missing CASE while executing
intel_hdmi_infoframes_enabled function. This patch
fixes the same.
Signed-off-by: Uma Shankar <uma.shankar@intel.com>
---
drivers/gpu/drm/i915/intel_hdmi.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c
index e97bf6e..b645cbb 100644
--- a/drivers/gpu/drm/i915/intel_hdmi.c
+++ b/drivers/gpu/drm/i915/intel_hdmi.c
@@ -129,6 +129,8 @@ static u32 g4x_infoframe_enable(unsigned int type)
return VIDEO_DIP_ENABLE_SPD;
case HDMI_INFOFRAME_TYPE_VENDOR:
return VIDEO_DIP_ENABLE_VENDOR;
+ case HDMI_INFOFRAME_TYPE_DRM:
+ return 0;
default:
MISSING_CASE(type);
return 0;
--
1.9.1
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 27+ messages in thread* [v10 11/12] video/hdmi: Add Unpack function for DRM infoframe
2019-05-14 17:36 [v10 00/12] Add HDR Metadata Parsing and handling in DRM layer Uma Shankar
` (9 preceding siblings ...)
2019-05-14 17:36 ` [v10 10/12] drm/i915: Added DRM Infoframe handling for BYT/CHT Uma Shankar
@ 2019-05-14 17:36 ` Uma Shankar
2019-05-14 17:36 ` [v10 12/12] drm/i915: Add state readout " Uma Shankar
11 siblings, 0 replies; 27+ messages in thread
From: Uma Shankar @ 2019-05-14 17:36 UTC (permalink / raw)
To: intel-gfx, dri-devel; +Cc: dcastagna, jonas, seanpaul
Added unpack function for DRM infoframe for dynamic
range and mastering infoframe readout.
v2: Addressed Ville's review comments.
Suggested-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Uma Shankar <uma.shankar@intel.com>
---
drivers/video/hdmi.c | 70 ++++++++++++++++++++++++++++++++++++++++++++++++++++
include/linux/hdmi.h | 1 +
2 files changed, 71 insertions(+)
diff --git a/drivers/video/hdmi.c b/drivers/video/hdmi.c
index c5ecd16..b99ba01 100644
--- a/drivers/video/hdmi.c
+++ b/drivers/video/hdmi.c
@@ -675,6 +675,9 @@ static int hdmi_drm_infoframe_check_only(const struct hdmi_drm_infoframe *frame)
frame->version != 1)
return -EINVAL;
+ if (frame->length != HDMI_DRM_INFOFRAME_SIZE)
+ return -EINVAL;
+
return 0;
}
@@ -1802,6 +1805,70 @@ static int hdmi_audio_infoframe_unpack(struct hdmi_audio_infoframe *frame,
}
/**
+ * hdmi_drm_infoframe_unpack() - unpack binary buffer to a HDMI DRM infoframe
+ * @frame: HDMI DRM infoframe
+ * @buffer: source buffer
+ * @size: size of buffer
+ *
+ * Unpacks the information contained in binary @buffer into a structured
+ * @frame of the HDMI Dynamic Range and Mastering (DRM) information frame.
+ * Also verifies the checksum as required by section 5.3.5 of the HDMI 1.4
+ * specification.
+ *
+ * Returns 0 on success or a negative error code on failure.
+ */
+static int hdmi_drm_infoframe_unpack(struct hdmi_drm_infoframe *frame,
+ const void *buffer, size_t size)
+{
+ const u8 *ptr = buffer;
+ const u8 *temp;
+ u8 x_lsb, x_msb;
+ u8 y_lsb, y_msb;
+ int ret;
+ int i;
+
+ if (size < HDMI_INFOFRAME_SIZE(DRM))
+ return -EINVAL;
+
+ if (ptr[0] != HDMI_INFOFRAME_TYPE_DRM ||
+ ptr[1] != 1 ||
+ ptr[2] != HDMI_DRM_INFOFRAME_SIZE)
+ return -EINVAL;
+
+ if (hdmi_infoframe_checksum(buffer, HDMI_INFOFRAME_SIZE(DRM)) != 0)
+ return -EINVAL;
+
+ ret = hdmi_drm_infoframe_init(frame);
+ if (ret)
+ return ret;
+
+ ptr += HDMI_INFOFRAME_HEADER_SIZE;
+
+ frame->eotf = ptr[0] & 0x7;
+ frame->metadata_type = ptr[1] & 0x7;
+
+ temp = ptr + 2;
+ for (i = 0; i < 3; i++) {
+ x_lsb = *temp++;
+ x_msb = *temp++;
+ frame->display_primaries[i].x = (x_msb << 8) | x_lsb;
+ y_lsb = *temp++;
+ y_msb = *temp++;
+ frame->display_primaries[i].y = (y_msb << 8) | y_lsb;
+ }
+
+ frame->white_point.x = (ptr[15] << 8) | ptr[14];
+ frame->white_point.y = (ptr[17] << 8) | ptr[16];
+
+ frame->max_display_mastering_luminance = (ptr[19] << 8) | ptr[18];
+ frame->min_display_mastering_luminance = (ptr[21] << 8) | ptr[20];
+ frame->max_cll = (ptr[23] << 8) | ptr[22];
+ frame->max_fall = (ptr[25] << 8) | ptr[24];
+
+ return 0;
+}
+
+/**
* hdmi_infoframe_unpack() - unpack binary buffer to a HDMI infoframe
* @frame: HDMI infoframe
* @buffer: source buffer
@@ -1827,6 +1894,9 @@ int hdmi_infoframe_unpack(union hdmi_infoframe *frame,
case HDMI_INFOFRAME_TYPE_AVI:
ret = hdmi_avi_infoframe_unpack(&frame->avi, buffer, size);
break;
+ case HDMI_INFOFRAME_TYPE_DRM:
+ ret = hdmi_drm_infoframe_unpack(&frame->drm, buffer, size);
+ break;
case HDMI_INFOFRAME_TYPE_SPD:
ret = hdmi_spd_infoframe_unpack(&frame->spd, buffer, size);
break;
diff --git a/include/linux/hdmi.h b/include/linux/hdmi.h
index 3d7f10f..ee55ba5 100644
--- a/include/linux/hdmi.h
+++ b/include/linux/hdmi.h
@@ -56,6 +56,7 @@ enum hdmi_infoframe_type {
#define HDMI_AVI_INFOFRAME_SIZE 13
#define HDMI_SPD_INFOFRAME_SIZE 25
#define HDMI_AUDIO_INFOFRAME_SIZE 10
+#define HDMI_DRM_INFOFRAME_SIZE 26
#define HDMI_INFOFRAME_SIZE(type) \
(HDMI_INFOFRAME_HEADER_SIZE + HDMI_ ## type ## _INFOFRAME_SIZE)
--
1.9.1
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 27+ messages in thread* [v10 12/12] drm/i915: Add state readout for DRM infoframe
2019-05-14 17:36 [v10 00/12] Add HDR Metadata Parsing and handling in DRM layer Uma Shankar
` (10 preceding siblings ...)
2019-05-14 17:36 ` [v10 11/12] video/hdmi: Add Unpack function for DRM infoframe Uma Shankar
@ 2019-05-14 17:36 ` Uma Shankar
2019-05-15 19:29 ` Ville Syrjälä
11 siblings, 1 reply; 27+ messages in thread
From: Uma Shankar @ 2019-05-14 17:36 UTC (permalink / raw)
To: intel-gfx, dri-devel; +Cc: dcastagna, jonas, seanpaul
Added state readout for DRM infoframe and enabled
state validation for DRM infoframe.
v2: Addressed Ville's review comments and dropped the
unused drm infoframe read at intel_hdmi_init.
Signed-off-by: Uma Shankar <uma.shankar@intel.com>
---
drivers/gpu/drm/i915/intel_ddi.c | 4 ++++
drivers/gpu/drm/i915/intel_display.c | 1 +
2 files changed, 5 insertions(+)
diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c
index 0af47f3..f574315 100644
--- a/drivers/gpu/drm/i915/intel_ddi.c
+++ b/drivers/gpu/drm/i915/intel_ddi.c
@@ -3834,6 +3834,10 @@ void intel_ddi_get_config(struct intel_encoder *encoder,
intel_read_infoframe(encoder, pipe_config,
HDMI_INFOFRAME_TYPE_VENDOR,
&pipe_config->infoframes.hdmi);
+ if ((INTEL_GEN(dev_priv) >= 10 || IS_GEMINILAKE(dev_priv)))
+ intel_read_infoframe(encoder, pipe_config,
+ HDMI_INFOFRAME_TYPE_DRM,
+ &pipe_config->infoframes.drm);
}
static enum intel_output_type
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index e35ba8d..c89b214 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -12274,6 +12274,7 @@ static bool fastboot_enabled(struct drm_i915_private *dev_priv)
PIPE_CONF_CHECK_INFOFRAME(avi);
PIPE_CONF_CHECK_INFOFRAME(spd);
PIPE_CONF_CHECK_INFOFRAME(hdmi);
+ PIPE_CONF_CHECK_INFOFRAME(drm);
#undef PIPE_CONF_CHECK_X
#undef PIPE_CONF_CHECK_I
--
1.9.1
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 27+ messages in thread* Re: [v10 12/12] drm/i915: Add state readout for DRM infoframe
2019-05-14 17:36 ` [v10 12/12] drm/i915: Add state readout " Uma Shankar
@ 2019-05-15 19:29 ` Ville Syrjälä
2019-05-16 7:23 ` Shankar, Uma
0 siblings, 1 reply; 27+ messages in thread
From: Ville Syrjälä @ 2019-05-15 19:29 UTC (permalink / raw)
To: Uma Shankar
Cc: dcastagna, jonas, intel-gfx, emil.l.velikov, dri-devel, seanpaul
On Tue, May 14, 2019 at 11:06:34PM +0530, Uma Shankar wrote:
> Added state readout for DRM infoframe and enabled
> state validation for DRM infoframe.
>
> v2: Addressed Ville's review comments and dropped the
> unused drm infoframe read at intel_hdmi_init.
>
> Signed-off-by: Uma Shankar <uma.shankar@intel.com>
> ---
> drivers/gpu/drm/i915/intel_ddi.c | 4 ++++
> drivers/gpu/drm/i915/intel_display.c | 1 +
> 2 files changed, 5 insertions(+)
>
> diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c
> index 0af47f3..f574315 100644
> --- a/drivers/gpu/drm/i915/intel_ddi.c
> +++ b/drivers/gpu/drm/i915/intel_ddi.c
> @@ -3834,6 +3834,10 @@ void intel_ddi_get_config(struct intel_encoder *encoder,
> intel_read_infoframe(encoder, pipe_config,
> HDMI_INFOFRAME_TYPE_VENDOR,
> &pipe_config->infoframes.hdmi);
> + if ((INTEL_GEN(dev_priv) >= 10 || IS_GEMINILAKE(dev_priv)))
Silly extra parens. Actually, I think the check can be
removed entirely since intel_read_infoframe() also checks
infoframes.enable.
> + intel_read_infoframe(encoder, pipe_config,
> + HDMI_INFOFRAME_TYPE_DRM,
> + &pipe_config->infoframes.drm);
> }
>
> static enum intel_output_type
> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> index e35ba8d..c89b214 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -12274,6 +12274,7 @@ static bool fastboot_enabled(struct drm_i915_private *dev_priv)
> PIPE_CONF_CHECK_INFOFRAME(avi);
> PIPE_CONF_CHECK_INFOFRAME(spd);
> PIPE_CONF_CHECK_INFOFRAME(hdmi);
> + PIPE_CONF_CHECK_INFOFRAME(drm);
>
> #undef PIPE_CONF_CHECK_X
> #undef PIPE_CONF_CHECK_I
> --
> 1.9.1
--
Ville Syrjälä
Intel
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [v10 12/12] drm/i915: Add state readout for DRM infoframe
2019-05-15 19:29 ` Ville Syrjälä
@ 2019-05-16 7:23 ` Shankar, Uma
0 siblings, 0 replies; 27+ messages in thread
From: Shankar, Uma @ 2019-05-16 7:23 UTC (permalink / raw)
To: Ville Syrjälä
Cc: dcastagna@chromium.org, jonas@kwiboo.se,
intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
seanpaul@chromium.org
>-----Original Message-----
>From: Ville Syrjälä [mailto:ville.syrjala@linux.intel.com]
>Sent: Thursday, May 16, 2019 1:00 AM
>To: Shankar, Uma <uma.shankar@intel.com>
>Cc: intel-gfx@lists.freedesktop.org; dri-devel@lists.freedesktop.org;
>maarten.lankhorst@linux.intel.com; Sharma, Shashank
><shashank.sharma@intel.com>; emil.l.velikov@gmail.com; brian.starkey@arm.com;
>dcastagna@chromium.org; seanpaul@chromium.org; Roper, Matthew D
><matthew.d.roper@intel.com>; jonas@kwiboo.se
>Subject: Re: [v10 12/12] drm/i915: Add state readout for DRM infoframe
>
>On Tue, May 14, 2019 at 11:06:34PM +0530, Uma Shankar wrote:
>> Added state readout for DRM infoframe and enabled state validation for
>> DRM infoframe.
>>
>> v2: Addressed Ville's review comments and dropped the unused drm
>> infoframe read at intel_hdmi_init.
>>
>> Signed-off-by: Uma Shankar <uma.shankar@intel.com>
>> ---
>> drivers/gpu/drm/i915/intel_ddi.c | 4 ++++
>> drivers/gpu/drm/i915/intel_display.c | 1 +
>> 2 files changed, 5 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/i915/intel_ddi.c
>> b/drivers/gpu/drm/i915/intel_ddi.c
>> index 0af47f3..f574315 100644
>> --- a/drivers/gpu/drm/i915/intel_ddi.c
>> +++ b/drivers/gpu/drm/i915/intel_ddi.c
>> @@ -3834,6 +3834,10 @@ void intel_ddi_get_config(struct intel_encoder
>*encoder,
>> intel_read_infoframe(encoder, pipe_config,
>> HDMI_INFOFRAME_TYPE_VENDOR,
>> &pipe_config->infoframes.hdmi);
>> + if ((INTEL_GEN(dev_priv) >= 10 || IS_GEMINILAKE(dev_priv)))
>
>Silly extra parens. Actually, I think the check can be removed entirely since
>intel_read_infoframe() also checks infoframes.enable.
Hmm yeah, will drop this.
>> + intel_read_infoframe(encoder, pipe_config,
>> + HDMI_INFOFRAME_TYPE_DRM,
>> + &pipe_config->infoframes.drm);
>> }
>>
>> static enum intel_output_type
>> diff --git a/drivers/gpu/drm/i915/intel_display.c
>> b/drivers/gpu/drm/i915/intel_display.c
>> index e35ba8d..c89b214 100644
>> --- a/drivers/gpu/drm/i915/intel_display.c
>> +++ b/drivers/gpu/drm/i915/intel_display.c
>> @@ -12274,6 +12274,7 @@ static bool fastboot_enabled(struct drm_i915_private
>*dev_priv)
>> PIPE_CONF_CHECK_INFOFRAME(avi);
>> PIPE_CONF_CHECK_INFOFRAME(spd);
>> PIPE_CONF_CHECK_INFOFRAME(hdmi);
>> + PIPE_CONF_CHECK_INFOFRAME(drm);
>>
>> #undef PIPE_CONF_CHECK_X
>> #undef PIPE_CONF_CHECK_I
>> --
>> 1.9.1
>
>--
>Ville Syrjälä
>Intel
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 27+ messages in thread