Enabling content-type setting for HDMI displays.
Subsystems (4)
v2 cover Enabling content-type setting for HDMI displays.
From: Stanislav Lisovskiy <[email protected]>
Added content type setting property to drm_connector(part 1) and enabled transmitting it with HDMI AVI infoframes for i915(part 2).
rev 2:
Moved helper function which attaches content type property to the drm core, as was suggested.
Removed redundant connector state initialization.
Stanislav Lisovskiy (2):
drm: content-type property for HDMI connector
i915: content-type property for HDMI connector
Documentation/gpu/kms-properties.csv | 1 + drivers/gpu/drm/drm_atomic.c | 4 +++ drivers/gpu/drm/drm_connector.c | 50 ++++++++++++++++++++++++++++ drivers/gpu/drm/drm_edid.c | 1 + drivers/gpu/drm/i915/intel_atomic.c | 1 + drivers/gpu/drm/i915/intel_hdmi.c | 3 ++ include/drm/drm_connector.h | 11 ++++++ include/drm/drm_mode_config.h | 5 +++ include/uapi/drm/drm_mode.h | 5 +++ 9 files changed, 81 insertions(+)
Signature · 6 lines
2.17.0 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v2 1/2 drm: content-type property for HDMI connector
From: Stanislav Lisovskiy <[email protected]>
Added content_type property todrm_connector_state in order to properly handle
external HDMI TV content-type setting.
--- Documentation/gpu/kms-properties.csv | 1 + drivers/gpu/drm/drm_atomic.c | 4 +++ drivers/gpu/drm/drm_connector.c | 50 ++++++++++++++++++++++++++++ drivers/gpu/drm/drm_edid.c | 1 + include/drm/drm_connector.h | 11 ++++++ include/drm/drm_mode_config.h | 5 +++ include/uapi/drm/drm_mode.h | 5 +++ 7 files changed, 77 insertions(+)
Documentation/gpu/kms-properties.csv +1 -0
@@ -17,6 +17,7 @@ Owner Module/Drivers,Group,Property Name,Type,Property Values,Object attached,De ,Virtual GPU,“suggested X”,RANGE,"Min=0, Max=0xffffffff",Connector,property to suggest an X offset for a connector ,,“suggested Y”,RANGE,"Min=0, Max=0xffffffff",Connector,property to suggest an Y offset for a connector ,Optional,"""aspect ratio""",ENUM,"{ ""None"", ""4:3"", ""16:9"" }",Connector,TDB +,Optional,"""content type""",ENUM,"{ ""Graphics"", ""Photo"", ""Cinema"", ""Game"" }",Connector,TDB i915,Generic,"""Broadcast RGB""",ENUM,"{ ""Automatic"", ""Full"", ""Limited 16:235"" }",Connector,"When this property is set to Limited 16:235 and CTM is set, the hardware will be programmed with the result of the multiplication of CTM by the limited range matrix to ensure the pixels normaly in the range 0..1.0 are remapped to the range 16/255..235/255." ,,“audio”,ENUM,"{ ""force-dvi"", ""off"", ""auto"", ""on"" }",Connector,TBD ,SDVO-TV,“mode”,ENUM,"{ ""NTSC_M"", ""NTSC_J"", ""NTSC_443"", ""PAL_B"" } etc.",Connector,TBD
drivers/gpu/drm/drm_atomic.c +4 -0
@@ -1266,6 +1266,8 @@ static int drm_atomic_connector_set_property(struct drm_connector *connector, state->link_status = val; }else if (property == config->aspect_ratio_property) { state->picture_aspect_ratio = val; + }else if (property == config->content_type_property) { + state->content_type = val; }else if (property == connector->scaling_mode_property) { state->scaling_mode = val; }else if (property == connector->content_protection_property) {
@@ -1351,6 +1353,8 @@ drm_atomic_connector_get_property(struct drm_connector *connector, *val = state->link_status; }else if (property == config->aspect_ratio_property) { *val = state->picture_aspect_ratio; + }else if (property == config->content_type_property) { + *val = state->content_type; }else if (property == connector->scaling_mode_property) { *val = state->scaling_mode; }else if (property == connector->content_protection_property) {
drivers/gpu/drm/drm_connector.c +50 -0
68 lines not on this page · raw message
drivers/gpu/drm/drm_edid.c +1 -0
@@ -4867,6 +4867,7 @@ drm_hdmi_avi_infoframe_from_display_mode(struct hdmi_avi_infoframe *frame, } frame->picture_aspect =HDMI_PICTURE_ASPECT_NONE ; + frame->content_type =HDMI_CONTENT_TYPE_GRAPHICS ;/* * Populate picture aspect ratio from either
include/drm/drm_connector.h +11 -0
@@ -418,6 +418,15 @@ struct drm_connector_state {*/ enum hdmi_picture_aspect picture_aspect_ratio; +/** +* @content_type: Connector property to control the +* HDMI infoframe content type setting. +* +* The %DRM_MODE_CONTENT_TYPE_\* values much match the +* values for &enum hdmi_content_type +*/ +enum hdmi_content_type content_type; +/** * @scaling_mode: Connector property to control the * upscaling, mostly used for built-in panels.
@@ -1089,11 +1098,13 @@ int drm_mode_create_tv_properties(struct drm_device *dev,unsigned int num_modes, const char * const modes[]);int drm_mode_create_scaling_mode_property (struct drm_device *dev); +int drm_connector_attach_content_type_property (struct drm_connector *dev);int drm_connector_attach_scaling_mode_property (struct drm_connector *connector,u32 scaling_mode_mask);int drm_connector_attach_content_protection_property (struct drm_connector *connector);int drm_mode_create_aspect_ratio_property (struct drm_device *dev); +int drm_mode_create_content_type_property (struct drm_device *dev);int drm_mode_create_suggested_offset_properties (struct drm_device *dev); int drm_mode_connector_set_path_property(struct drm_connector *connector,
include/drm/drm_mode_config.h +5 -0
@@ -726,6 +726,11 @@ struct drm_mode_config {* HDMI infoframe aspect ratio setting. */ struct drm_property *aspect_ratio_property; +/** +* @content_type_property: Optional connector property to control the +* HDMI infoframe content type setting. +*/ +struct drm_property *content_type_property;/** * @degamma_lut_property: Optional CRTC property to set the LUT used to * convert the framebuffer's colors to linear gamma.
include/uapi/drm/drm_mode.h +5 -0
@@ -94,6 +94,11 @@ extern "C" {#define DRM_MODE_PICTURE_ASPECT_4_3 1#define DRM_MODE_PICTURE_ASPECT_16_9 2 +#define DRM_MODE_CONTENT_TYPE_GRAPHICS 0 +#define DRM_MODE_CONTENT_TYPE_PHOTO 1 +#define DRM_MODE_CONTENT_TYPE_CINEMA 2 +#define DRM_MODE_CONTENT_TYPE_GAME 3 +/* Aspect ratio flag bitmask (4 bits 22:19) */ #define DRM_MODE_FLAG_PIC_AR_MASK (0x0F<<19)#define DRM_MODE_FLAG_PIC_AR_NONE \
Signature · 6 lines
2.17.0 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Jani Nikula
maintainerRe: [PATCH v2 1/2] drm: content-type property for HDMI connector
drivers/gpu/drm/drm_connector.c static const struct drm_prop_enum_list drm_aspect_ratio_enum_list[] = { · line 729
Quoted 7 lines · StanLis
drivers/gpu/drm/drm_connector.c +7
-0+static const struct drm_prop_enum_list drm_content_type_enum_list[] = { + {DRM_MODE_CONTENT_TYPE_GRAPHICS ,"GRAPHICS" }, + {DRM_MODE_CONTENT_TYPE_PHOTO ,"PHOTO" }, + {DRM_MODE_CONTENT_TYPE_CINEMA ,"CINEMA" }, + {DRM_MODE_CONTENT_TYPE_GAME ,"GAME" }, +}; +
Values all caps...
drivers/gpu/drm/drm_connector.c int drm_mode_create_aspect_ratio_property(struct drm_device *dev) · line 1304
Quoted 9 lines
drivers/gpu/drm/drm_connector.c +9
-0+int drm_mode_create_content_type_property (struct drm_device *dev) +{ +if (dev->mode_config.content_type_property) +return 0 ; + + dev->mode_config.content_type_property = +drm_property_create_enum (dev,0 ,"content type" , + drm_content_type_enum_list, +ARRAY_SIZE (drm_content_type_enum_list));
...and property name lower case with a space.
Can we please have a little more consistency at least within properties? Overall it's a huge mess already, but it doesn't help to add to the mess.
BR,
Jani.
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
RE: [PATCH v2 1/2] drm: content-type property for HDMI connector
Totally agree about caps, thanks for spotting.
________________________________________
From: Jani Nikula [[email protected]]
Sent: Wednesday, April 18, 2018 2:50 PM
To: Lisovskiy, Stanislav; [email protected]
Cc: [email protected]
Subject: Re: [PATCH v2 1/2] drm: content-type property for HDMI connector
drivers/gpu/drm/drm_connector.c static const struct drm_prop_enum_list drm_aspect_ratio_enum_list[] = { · line 729
Quoted 7 lines · StanLis
drivers/gpu/drm/drm_connector.c +7
-0+static const struct drm_prop_enum_list drm_content_type_enum_list[] = { + {DRM_MODE_CONTENT_TYPE_GRAPHICS ,"GRAPHICS" }, + {DRM_MODE_CONTENT_TYPE_PHOTO ,"PHOTO" }, + {DRM_MODE_CONTENT_TYPE_CINEMA ,"CINEMA" }, + {DRM_MODE_CONTENT_TYPE_GAME ,"GAME" }, +}; +
Values all caps...
drivers/gpu/drm/drm_connector.c int drm_mode_create_aspect_ratio_property(struct drm_device *dev) · line 1304
Quoted 9 lines
drivers/gpu/drm/drm_connector.c +9
-0+int drm_mode_create_content_type_property (struct drm_device *dev) +{ +if (dev->mode_config.content_type_property) +return 0 ; + + dev->mode_config.content_type_property = +drm_property_create_enum (dev,0 ,"content type" , + drm_content_type_enum_list, +ARRAY_SIZE (drm_content_type_enum_list));
...and property name lower case with a space.
Can we please have a little more consistency at least within properties? Overall it's a huge mess already, but it doesn't help to add to the mess.
BR,
Jani.
--
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v2 2/2 i915: content-type property for HDMI connector
In reply to StanLisFrom: Stanislav Lisovskiy <[email protected]>
Added encoding of drm content_type property from drm_connector_state within AVI infoframe in order to properly handle external HDMI TV content-type setting.
--- drivers/gpu/drm/i915/intel_atomic.c | 1 + drivers/gpu/drm/i915/intel_hdmi.c | 3 +++ 2 files changed, 4 insertions(+)
drivers/gpu/drm/i915/intel_atomic.c +1 -0
@@ -124,6 +124,7 @@ int intel_digital_connector_atomic_check(struct drm_connector *conn,if (new_conn_state->force_audio != old_conn_state->force_audio || new_conn_state->broadcast_rgb != old_conn_state->broadcast_rgb || 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) crtc_state->mode_changed = true;
drivers/gpu/drm/i915/intel_hdmi.c +3 -0
@@ -491,6 +491,8 @@ static void intel_hdmi_set_avi_infoframe(struct drm_encoder *encoder, intel_hdmi->rgb_quant_range_selectable, is_hdmi2_sink); + frame.avi.content_type = connector->state->content_type; +/* TODO: handle pixel repetition for YCBCR420 outputs */ intel_write_infoframe (encoder, crtc_state, &frame); }
@@ -2065,6 +2067,7 @@ intel_hdmi_add_properties(struct intel_hdmi *intel_hdmi, struct drm_connector *cintel_attach_force_audio_property (connector);intel_attach_broadcast_rgb_property (connector);intel_attach_aspect_ratio_property (connector); +drm_connector_attach_content_type_property (connector); connector->state->picture_aspect_ratio =HDMI_PICTURE_ASPECT_NONE ; }
Signature · 6 lines
2.17.0 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel