drm/amd/display: hook up content_type property
Subsystems (3)
v2 cover drm/amd/display: hook up content_type property
Hi,
The first version of this series from Joshua [1] was accepted, but never merged upstream.
During this time, Guilherme reported issues when performing GPU reset that point to this work, and I identified the need to mark CRTC state for reset when the property differs between states.
In this v2, I basically rebase the work to amd-staging-drm-next, add the r-b tag accordingly and include the fix mentioned above.
Thanks,
Melissa
[1] https://lore.kernel.org/amd-gfx/[email protected]/
Joshua Ashton (2):
drm/amd/display: Hook up 'content type' property for HDMI drm/amd/display: Remove unused display_content_support
.../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 32 +++++++++ .../gpu/drm/amd/display/dc/core/dc_resource.c | 69 ++++++------------- drivers/gpu/drm/amd/display/dc/dc_stream.h | 2 +- drivers/gpu/drm/amd/display/dc/dc_types.h | 14 ---- 4 files changed, 54 insertions(+), 63 deletions(-)
Signature · 1 line
2.40.1
PATCH v2 1/2 drm/amd/display: Hook up 'content type' property for HDMI
From: Joshua Ashton <[email protected]>
Implements the 'content type' property for HDMI connectors. Verified by checking the avi infoframe on a connected TV.
This also simplifies a lot of the code in that area as well, there were a lot of temp variables doing very little and unnecessary logic that was quite confusing.
It is not necessary to check for support in the EDID before sending a 'content type' value in the avi infoframe also.
v2:
- rebase to amd-staging-drm-next
- mark CRTC state for reset if content_type differs
--- .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 32 +++++++++ .../gpu/drm/amd/display/dc/core/dc_resource.c | 69 ++++++------------- drivers/gpu/drm/amd/display/dc/dc_stream.h | 1 + 3 files changed, 54 insertions(+), 48 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +32 -0
@@ -5461,6 +5461,24 @@ get_output_color_space(const struct dc_crtc_timing *dc_crtc_timing,return color_space; } +static enum display_content_type +get_output_content_type (const struct drm_connector_state *connector_state) +{ +switch (connector_state->content_type) { +default : +case DRM_MODE_CONTENT_TYPE_NO_DATA : +return DISPLAY_CONTENT_TYPE_NO_DATA ; +case DRM_MODE_CONTENT_TYPE_GRAPHICS : +return DISPLAY_CONTENT_TYPE_GRAPHICS ; +case DRM_MODE_CONTENT_TYPE_PHOTO : +return DISPLAY_CONTENT_TYPE_PHOTO ; +case DRM_MODE_CONTENT_TYPE_CINEMA : +return DISPLAY_CONTENT_TYPE_CINEMA ; +case DRM_MODE_CONTENT_TYPE_GAME : +return DISPLAY_CONTENT_TYPE_GAME ; + } +} +static bool adjust_colour_depth_from_display_info (struct dc_crtc_timing *timing_out,const struct drm_display_info *info)
@@ -5595,6 +5613,7 @@ static void fill_stream_properties_from_drm_display_mode( } stream->output_color_space =get_output_color_space (timing_out, connector_state); + stream->content_type =get_output_content_type (connector_state); } static void fill_audio_info(struct audio_info *audio_info,
@@ -6795,6 +6814,14 @@ amdgpu_dm_connector_atomic_check(struct drm_connector *conn, new_crtc_state->mode_changed = true; } +if (new_con_state->content_type != old_con_state->content_type) { + new_crtc_state =drm_atomic_get_crtc_state (state, crtc); +if (IS_ERR (new_crtc_state)) +return PTR_ERR (new_crtc_state); + + new_crtc_state->mode_changed = true; + } +if (!drm_connector_atomic_hdr_metadata_equal (old_con_state, new_con_state)) {struct dc_info_packet hdr_infopacket;
@@ -7430,6 +7457,11 @@ void amdgpu_dm_connector_init_helper(struct amdgpu_display_manager *dm, adev->mode_info.abm_level_property, 0); } +if (connector_type ==DRM_MODE_CONNECTOR_HDMIA ) { +/* Content Type is currently only implemented for HDMI. */ +drm_connector_attach_content_type_property (&aconnector->base); + } +if (connector_type ==DRM_MODE_CONNECTOR_HDMIA ) {if (!drm_mode_create_hdmi_colorspace_property (&aconnector->base, supported_colorspaces))drm_connector_attach_colorspace_property (&aconnector->base);
drivers/gpu/drm/amd/display/dc/core/dc_resource.c +21 -48
84 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/dc_stream.h +1 -0
@@ -212,6 +212,7 @@ struct dc_stream_state {struct dc_csc_transform csc_color_matrix;enum dc_color_space output_color_space; +enum display_content_type content_type;enum dc_dither_option dither_option;enum view_3d_format view_format;
Signature · 1 line
2.40.1
Re: [PATCH v2 1/2] drm/amd/display: Hook up 'content type' property for HDMI
Quoted 80 lines · Melissa Wen
From: Joshua Ashton <[email protected]>
Implements the 'content type' property for HDMI connectors. Verified by checking the avi infoframe on a connected TV.
This also simplifies a lot of the code in that area as well, there were a lot of temp variables doing very little and unnecessary logic that was quite confusing.
It is not necessary to check for support in the EDID before sending a 'content type' value in the avi infoframe also.
v2:
- rebase to amd-staging-drm-next
- mark CRTC state for reset ifcontent_typediffersReviewed-by Harry Wentland <[email protected]> (v1)Signed-off-by Joshua Ashton <[email protected]>Co-developed-by Melissa Wen <[email protected]>Signed-off-by Melissa Wen <[email protected]>--- .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 32 +++++++++ .../gpu/drm/amd/display/dc/core/dc_resource.c | 69 ++++++------------- drivers/gpu/drm/amd/display/dc/dc_stream.h | 1 + 3 files changed, 54 insertions(+), 48 deletions(-)drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +27
-0@@ -5461,6 +5461,24 @@ get_output_color_space(const struct dc_crtc_timing *dc_crtc_timing,return color_space; } +static enum display_content_type +get_output_content_type (const struct drm_connector_state *connector_state) +{ +switch (connector_state->content_type) { +default : +case DRM_MODE_CONTENT_TYPE_NO_DATA : +return DISPLAY_CONTENT_TYPE_NO_DATA ; +case DRM_MODE_CONTENT_TYPE_GRAPHICS : +return DISPLAY_CONTENT_TYPE_GRAPHICS ; +case DRM_MODE_CONTENT_TYPE_PHOTO : +return DISPLAY_CONTENT_TYPE_PHOTO ; +case DRM_MODE_CONTENT_TYPE_CINEMA : +return DISPLAY_CONTENT_TYPE_CINEMA ; +case DRM_MODE_CONTENT_TYPE_GAME : +return DISPLAY_CONTENT_TYPE_GAME ; + } +} +static bool adjust_colour_depth_from_display_info (struct dc_crtc_timing *timing_out,const struct drm_display_info *info)@@ -5595,6 +5613,7 @@ static void fill_stream_properties_from_drm_display_mode( } stream->output_color_space =get_output_color_space (timing_out, connector_state); + stream->content_type =get_output_content_type (connector_state); } static void fill_audio_info(struct audio_info *audio_info,@@ -6795,6 +6814,14 @@ amdgpu_dm_connector_atomic_check(struct drm_connector *conn, new_crtc_state->mode_changed = true; } +if (new_con_state->content_type != old_con_state->content_type) { + new_crtc_state =drm_atomic_get_crtc_state (state, crtc); +if (IS_ERR (new_crtc_state)) +return PTR_ERR (new_crtc_state); + + new_crtc_state->mode_changed = true; + } +if (!drm_connector_atomic_hdr_metadata_equal (old_con_state, new_con_state)) {struct dc_info_packet hdr_infopacket;
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c void amdgpu_dm_connector_init_helper(struct amdgpu_display_manager *dm, · line 7464
Quoted 8 lines
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +5
-0@@ -7430,6 +7457,11 @@ void amdgpu_dm_connector_init_helper(struct amdgpu_display_manager *dm, adev->mode_info.abm_level_property, 0); } +if (connector_type ==DRM_MODE_CONNECTOR_HDMIA ) { +/* Content Type is currently only implemented for HDMI. */ +drm_connector_attach_content_type_property (&aconnector->base); + } +
This could just be squashed into the clause below. Either way, looks fine to me. The series is:
Alex
Quoted 108 lines
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +0
-0if (connector_type ==DRM_MODE_CONNECTOR_HDMIA ) {if (!drm_mode_create_hdmi_colorspace_property (&aconnector->base, supported_colorspaces))drm_connector_attach_colorspace_property (&aconnector->base);drivers/gpu/drm/amd/display/dc/core/dc_resource.c +21
-48@@ -3928,14 +3928,9 @@ static void set_avi_info_frame(uint32_t pixel_encoding =0 ;enum scanning_type scan_type =SCANNING_TYPE_NODATA ;enum dc_aspect_ratio aspect =ASPECT_RATIO_NO_DATA ; -bool itc = false; -uint8_t itc_value =0 ; -uint8_t cn0_cn1 =0 ; -unsigned int cn0_cn1_value =0 ;uint8_t *check_sum =NULL ;uint8_t byte_index =0 ;union hdmi_info_packet hdmi_info; -union display_content_support support = {0 };unsigned int vic = pipe_ctx->stream->timing.vic;unsigned int rid = pipe_ctx->stream->timing.rid;unsigned int fr_ind = pipe_ctx->stream->timing.fr_index;@@ -4045,49 +4040,27 @@ static void set_avi_info_frame(/* Active Format Aspect ratio - same as Picture Aspect Ratio. */ hdmi_info.bits.R0_R3 =ACTIVE_FORMAT_ASPECT_RATIO_SAME_AS_PICTURE ; -/* TODO: un-hardcode cn0_cn1 and itc */ - - cn0_cn1 =0 ; - cn0_cn1_value =0 ; - - itc = true; - itc_value =1 ; - - support = stream->content_support; - -if (itc) { -if (!support.bits.valid_content_type) { - cn0_cn1_value =0 ; - }else { -if (cn0_cn1 ==DISPLAY_CONTENT_TYPE_GRAPHICS ) { -if (support.bits.graphics_content ==1 ) { - cn0_cn1_value =0 ; - } - }else if (cn0_cn1 ==DISPLAY_CONTENT_TYPE_PHOTO ) { -if (support.bits.photo_content ==1 ) { - cn0_cn1_value =1 ; - }else { - cn0_cn1_value =0 ; - itc_value =0 ; - } - }else if (cn0_cn1 ==DISPLAY_CONTENT_TYPE_CINEMA ) { -if (support.bits.cinema_content ==1 ) { - cn0_cn1_value =2 ; - }else { - cn0_cn1_value =0 ; - itc_value =0 ; - } - }else if (cn0_cn1 ==DISPLAY_CONTENT_TYPE_GAME ) { -if (support.bits.game_content ==1 ) { - cn0_cn1_value =3 ; - }else { - cn0_cn1_value =0 ; - itc_value =0 ; - } - } - } - hdmi_info.bits.CN0_CN1 = cn0_cn1_value; - hdmi_info.bits.ITC = itc_value; +switch (stream->content_type) { +case DISPLAY_CONTENT_TYPE_NO_DATA : + hdmi_info.bits.CN0_CN1 =0 ; + hdmi_info.bits.ITC =0 ; +break ; +case DISPLAY_CONTENT_TYPE_GRAPHICS : + hdmi_info.bits.CN0_CN1 =0 ; + hdmi_info.bits.ITC =1 ; +break ; +case DISPLAY_CONTENT_TYPE_PHOTO : + hdmi_info.bits.CN0_CN1 =1 ; + hdmi_info.bits.ITC =1 ; +break ; +case DISPLAY_CONTENT_TYPE_CINEMA : + hdmi_info.bits.CN0_CN1 =2 ; + hdmi_info.bits.ITC =1 ; +break ; +case DISPLAY_CONTENT_TYPE_GAME : + hdmi_info.bits.CN0_CN1 =3 ; + hdmi_info.bits.ITC =1 ; +break ; }if (stream->qs_bit ==1 ) {drivers/gpu/drm/amd/display/dc/dc_stream.h +1
-1@@ -212,6 +212,7 @@ struct dc_stream_state {struct dc_csc_transform csc_color_matrix;enum dc_color_space output_color_space; +enum display_content_type content_type;enum dc_dither_option dither_option;enum view_3d_format view_format; --2.40.1
Harry Wentland
maintainerRe: [PATCH v2 1/2] drm/amd/display: Hook up 'content type' property for HDMI
Quoted 92 lines · Alex Deucher
Quoted 80 lines · Melissa Wen
From: Joshua Ashton <[email protected]>
Implements the 'content type' property for HDMI connectors. Verified by checking the avi infoframe on a connected TV.
This also simplifies a lot of the code in that area as well, there were a lot of temp variables doing very little and unnecessary logic that was quite confusing.
It is not necessary to check for support in the EDID before sending a 'content type' value in the avi infoframe also.
v2:
- rebase to amd-staging-drm-next
- mark CRTC state for reset ifcontent_typediffersReviewed-by Harry Wentland <[email protected]> (v1)Signed-off-by Joshua Ashton <[email protected]>Co-developed-by Melissa Wen <[email protected]>Signed-off-by Melissa Wen <[email protected]>--- .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 32 +++++++++ .../gpu/drm/amd/display/dc/core/dc_resource.c | 69 ++++++------------- drivers/gpu/drm/amd/display/dc/dc_stream.h | 1 + 3 files changed, 54 insertions(+), 48 deletions(-)drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +27
-0@@ -5461,6 +5461,24 @@ get_output_color_space(const struct dc_crtc_timing *dc_crtc_timing,return color_space; } +static enum display_content_type +get_output_content_type (const struct drm_connector_state *connector_state) +{ +switch (connector_state->content_type) { +default : +case DRM_MODE_CONTENT_TYPE_NO_DATA : +return DISPLAY_CONTENT_TYPE_NO_DATA ; +case DRM_MODE_CONTENT_TYPE_GRAPHICS : +return DISPLAY_CONTENT_TYPE_GRAPHICS ; +case DRM_MODE_CONTENT_TYPE_PHOTO : +return DISPLAY_CONTENT_TYPE_PHOTO ; +case DRM_MODE_CONTENT_TYPE_CINEMA : +return DISPLAY_CONTENT_TYPE_CINEMA ; +case DRM_MODE_CONTENT_TYPE_GAME : +return DISPLAY_CONTENT_TYPE_GAME ; + } +} +static bool adjust_colour_depth_from_display_info (struct dc_crtc_timing *timing_out,const struct drm_display_info *info)@@ -5595,6 +5613,7 @@ static void fill_stream_properties_from_drm_display_mode( } stream->output_color_space =get_output_color_space (timing_out, connector_state); + stream->content_type =get_output_content_type (connector_state); } static void fill_audio_info(struct audio_info *audio_info,@@ -6795,6 +6814,14 @@ amdgpu_dm_connector_atomic_check(struct drm_connector *conn, new_crtc_state->mode_changed = true; } +if (new_con_state->content_type != old_con_state->content_type) { + new_crtc_state =drm_atomic_get_crtc_state (state, crtc); +if (IS_ERR (new_crtc_state)) +return PTR_ERR (new_crtc_state); + + new_crtc_state->mode_changed = true; + } +if (!drm_connector_atomic_hdr_metadata_equal (old_con_state, new_con_state)) {struct dc_info_packet hdr_infopacket;drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c void amdgpu_dm_connector_init_helper(struct amdgpu_display_manager *dm, · line 7464
Quoted 8 lines
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +5
-0@@ -7430,6 +7457,11 @@ void amdgpu_dm_connector_init_helper(struct amdgpu_display_manager *dm, adev->mode_info.abm_level_property, 0); } +if (connector_type ==DRM_MODE_CONNECTOR_HDMIA ) { +/* Content Type is currently only implemented for HDMI. */ +drm_connector_attach_content_type_property (&aconnector->base); + } +This could just be squashed into the clause below. Either way, looks fine to me. The series is:
Quoted 2 lines
Acked-by Alex Deucher <[email protected]>
Series is merged.
Harry
Quoted 111 lines
Alex
Quoted 108 lines
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +0
-0if (connector_type ==DRM_MODE_CONNECTOR_HDMIA ) {if (!drm_mode_create_hdmi_colorspace_property (&aconnector->base, supported_colorspaces))drm_connector_attach_colorspace_property (&aconnector->base);drivers/gpu/drm/amd/display/dc/core/dc_resource.c +21
-48@@ -3928,14 +3928,9 @@ static void set_avi_info_frame(uint32_t pixel_encoding =0 ;enum scanning_type scan_type =SCANNING_TYPE_NODATA ;enum dc_aspect_ratio aspect =ASPECT_RATIO_NO_DATA ; -bool itc = false; -uint8_t itc_value =0 ; -uint8_t cn0_cn1 =0 ; -unsigned int cn0_cn1_value =0 ;uint8_t *check_sum =NULL ;uint8_t byte_index =0 ;union hdmi_info_packet hdmi_info; -union display_content_support support = {0 };unsigned int vic = pipe_ctx->stream->timing.vic;unsigned int rid = pipe_ctx->stream->timing.rid;unsigned int fr_ind = pipe_ctx->stream->timing.fr_index;@@ -4045,49 +4040,27 @@ static void set_avi_info_frame(/* Active Format Aspect ratio - same as Picture Aspect Ratio. */ hdmi_info.bits.R0_R3 =ACTIVE_FORMAT_ASPECT_RATIO_SAME_AS_PICTURE ; -/* TODO: un-hardcode cn0_cn1 and itc */ - - cn0_cn1 =0 ; - cn0_cn1_value =0 ; - - itc = true; - itc_value =1 ; - - support = stream->content_support; - -if (itc) { -if (!support.bits.valid_content_type) { - cn0_cn1_value =0 ; - }else { -if (cn0_cn1 ==DISPLAY_CONTENT_TYPE_GRAPHICS ) { -if (support.bits.graphics_content ==1 ) { - cn0_cn1_value =0 ; - } - }else if (cn0_cn1 ==DISPLAY_CONTENT_TYPE_PHOTO ) { -if (support.bits.photo_content ==1 ) { - cn0_cn1_value =1 ; - }else { - cn0_cn1_value =0 ; - itc_value =0 ; - } - }else if (cn0_cn1 ==DISPLAY_CONTENT_TYPE_CINEMA ) { -if (support.bits.cinema_content ==1 ) { - cn0_cn1_value =2 ; - }else { - cn0_cn1_value =0 ; - itc_value =0 ; - } - }else if (cn0_cn1 ==DISPLAY_CONTENT_TYPE_GAME ) { -if (support.bits.game_content ==1 ) { - cn0_cn1_value =3 ; - }else { - cn0_cn1_value =0 ; - itc_value =0 ; - } - } - } - hdmi_info.bits.CN0_CN1 = cn0_cn1_value; - hdmi_info.bits.ITC = itc_value; +switch (stream->content_type) { +case DISPLAY_CONTENT_TYPE_NO_DATA : + hdmi_info.bits.CN0_CN1 =0 ; + hdmi_info.bits.ITC =0 ; +break ; +case DISPLAY_CONTENT_TYPE_GRAPHICS : + hdmi_info.bits.CN0_CN1 =0 ; + hdmi_info.bits.ITC =1 ; +break ; +case DISPLAY_CONTENT_TYPE_PHOTO : + hdmi_info.bits.CN0_CN1 =1 ; + hdmi_info.bits.ITC =1 ; +break ; +case DISPLAY_CONTENT_TYPE_CINEMA : + hdmi_info.bits.CN0_CN1 =2 ; + hdmi_info.bits.ITC =1 ; +break ; +case DISPLAY_CONTENT_TYPE_GAME : + hdmi_info.bits.CN0_CN1 =3 ; + hdmi_info.bits.ITC =1 ; +break ; }if (stream->qs_bit ==1 ) {drivers/gpu/drm/amd/display/dc/dc_stream.h +1
-1@@ -212,6 +212,7 @@ struct dc_stream_state {struct dc_csc_transform csc_color_matrix;enum dc_color_space output_color_space; +enum display_content_type content_type;enum dc_dither_option dither_option;enum view_3d_format view_format; --2.40.1
PATCH v2 2/2 drm/amd/display: Remove unused display_content_support
In reply to Melissa WenFrom: Joshua Ashton <[email protected]>
This was never filled in and thus never truly used.
Checking the EDID for content_type support is not required for sending the avi infoframe packet.
v2:
- rebase to amd-staging-drm-next
--- drivers/gpu/drm/amd/display/dc/dc_stream.h | 1 - drivers/gpu/drm/amd/display/dc/dc_types.h | 14 -------------- 2 files changed, 15 deletions(-)
drivers/gpu/drm/amd/display/dc/dc_stream.h +0 -1
@@ -188,7 +188,6 @@ struct dc_stream_state {struct link_encoder *link_enc;struct dc_stream_debug_options debug;struct dc_panel_patch sink_patches; -union display_content_support content_support;struct dc_crtc_timing timing;struct dc_crtc_timing_adjust adjust;struct dc_info_packet vrr_infopacket;
drivers/gpu/drm/amd/display/dc/dc_types.h +0 -14
@@ -163,18 +163,6 @@ struct dc_edid {#define AUDIO_INFO_DISPLAY_NAME_SIZE_IN_CHARS 20 -union display_content_support { -unsigned int raw; -struct { -unsigned int valid_content_type :1 ; -unsigned int game_content :1 ; -unsigned int cinema_content :1 ; -unsigned int photo_content :1 ; -unsigned int graphics_content :1 ; -unsigned int reserved :27 ; - } bits; -}; -struct dc_panel_patch {unsigned int dppowerup_delay;unsigned int extra_t12_ms;
@@ -207,8 +195,6 @@ struct dc_edid_caps {uint32_t audio_latency;uint32_t video_latency; -union display_content_support content_support; -uint8_t qs_bit;uint8_t qy_bit;
Signature · 1 line
2.40.1