DC Patches March 23th, 2020
cover DC Patches March 23th, 2020
This DC patchset brings improvements in multiple areas. In summary, we highlight:
* Rework part of the backlight function call;
* Support plane level CTM, and P010 pixel format;
* Get optimal number of taps;
Aric Cyr (2):
drm/amd/display: 3.2.77
drm/amd/display: LFC not working on 2.0x range monitors
Dmytro Laktyushkin (1):
drm/amd/display: Fix dcn21 num_states
Eric Bernstein (1):
drm/amd/display: Update function to get optimal number of taps
Isabel Zhang (1):
drm/amd/display: Revert change to HDCP display states
Nicholas Kazlauskas (1):
drm/amd/display: Use double buffered DRR timing update by default
Stylon Wang (3):
drm/amd/display: Support P010 pixel format drm/amd/display: Support plane level CTM drm/amd/display: Enable BT2020 in COLOR_ENCODING property
Wyatt Wood (2):
drm/amd/display: Add ABM driver implementation drm/amd/display: Move backlight pwm enable function call
Yongqiang Sun (1):
drm/amd/display: Not doing optimize bandwidth if flip pending.
.../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 12 +- drivers/gpu/drm/amd/display/dc/core/dc.c | 33 +- .../gpu/drm/amd/display/dc/core/dc_resource.c | 1 + drivers/gpu/drm/amd/display/dc/dc.h | 5 +- drivers/gpu/drm/amd/display/dc/dce/Makefile | 2 +- drivers/gpu/drm/amd/display/dc/dce/dce_abm.c | 1 + drivers/gpu/drm/amd/display/dc/dce/dmub_abm.c | 417 ++++++++++++++++++ drivers/gpu/drm/amd/display/dc/dce/dmub_abm.h | 40 ++ .../amd/display/dc/dcn10/dcn10_hw_sequencer.c | 6 + .../gpu/drm/amd/display/dc/dcn10/dcn10_optc.c | 18 + .../gpu/drm/amd/display/dc/dcn10/dcn10_optc.h | 3 + .../drm/amd/display/dc/dcn10/dcn10_resource.c | 3 +- .../drm/amd/display/dc/dcn20/dcn20_resource.c | 5 +- .../drm/amd/display/dc/dcn21/dcn21_resource.c | 81 ++-- .../gpu/drm/amd/display/dc/dml/dc_features.h | 2 +- .../amd/display/dc/dml/display_mode_structs.h | 7 +- drivers/gpu/drm/amd/display/dc/inc/hw/abm.h | 4 + .../gpu/drm/amd/display/dmub/inc/dmub_cmd.h | 11 + .../amd/display/modules/freesync/freesync.c | 34 +- .../gpu/drm/amd/display/modules/hdcp/hdcp.c | 5 +- .../gpu/drm/amd/display/modules/hdcp/hdcp.h | 28 +- .../display/modules/hdcp/hdcp1_execution.c | 2 +- .../display/modules/hdcp/hdcp2_execution.c | 2 +- .../drm/amd/display/modules/hdcp/hdcp_psp.c | 39 +- .../drm/amd/display/modules/inc/mod_hdcp.h | 1 + .../amd/display/modules/power/power_helpers.c | 21 +- 26 files changed, 680 insertions(+), 103 deletions(-) create mode 100644 drivers/gpu/drm/amd/display/dc/dce/dmub_abm.c create mode 100644 drivers/gpu/drm/amd/display/dc/dce/dmub_abm.h
Signature · 6 lines
2.25.2 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 1/12 drm/amd/display: 3.2.77
From: Aric Cyr <[email protected]>
--- drivers/gpu/drm/amd/display/dc/dc.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/dc.h +1 -1
@@ -39,7 +39,7 @@#include "inc/hw/dmcu.h" #include "dml/display_mode_lib.h" -#define DC_VER "3.2.76" +#define DC_VER "3.2.77"#define MAX_SURFACES 3#define MAX_PLANES 6
Signature · 6 lines
2.25.2 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 2/12 drm/amd/display: Update function to get optimal number of taps
In reply to Rodrigo SiqueiraFrom: Eric Bernstein <[email protected]>
[Why]
Diagnostics scaling test failing to set required number of vertical taps in 4:2:0 surface case
[How]
In dpp3_get_optimal_number_of_taps() need to use LB_MEMORY_CONFIG_3 for 4:2:0 surface case. In resource_build_scaling_params() make sure to also set plane res alpha enable based on updated surface state
--- drivers/gpu/drm/amd/display/dc/core/dc_resource.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/amd/display/dc/core/dc_resource.c +1 -0
@@ -1077,6 +1077,7 @@ bool resource_build_scaling_params(struct pipe_ctx *pipe_ctx)* on certain displays, such as the Sharp 4k */ pipe_ctx->plane_res.scl_data.lb_params.depth =LB_PIXEL_DEPTH_30BPP ; + pipe_ctx->plane_res.scl_data.lb_params.alpha_en = plane_state->per_pixel_alpha; pipe_ctx->plane_res.scl_data.recout.x += timing->h_border_left; pipe_ctx->plane_res.scl_data.recout.y += timing->v_border_top;
Signature · 6 lines
2.25.2 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 3/12 drm/amd/display: Support P010 pixel format
In reply to Rodrigo SiqueiraFrom: Stylon Wang <[email protected]>
[Why]
P010 pixel format is not declared as supported in DRM and DM.
[How]
Add P010 format to the support list presented to DRM and checked in DM
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 5 +++++ drivers/gpu/drm/amd/display/dc/dcn10/dcn10_resource.c | 3 ++- drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c | 3 ++- drivers/gpu/drm/amd/display/dc/dcn21/dcn21_resource.c | 3 ++- 4 files changed, 11 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +5 -0
@@ -3706,6 +3706,9 @@ fill_dc_plane_info_and_addr(struct amdgpu_device *adev,case DRM_FORMAT_NV12 : plane_info->format = SURFACE_PIXEL_FORMAT_VIDEO_420_YCrCb;break ; +case DRM_FORMAT_P010 : + plane_info->format = SURFACE_PIXEL_FORMAT_VIDEO_420_10bpc_YCrCb; +break ;default : DRM_ERROR( "Unsupported screen format %s\n",
@@ -5617,6 +5620,8 @@ static int get_plane_formats(const struct drm_plane *plane,if (plane_cap && plane_cap->pixel_format_support.nv12) formats[num_formats++] =DRM_FORMAT_NV12 ; +if (plane_cap && plane_cap->pixel_format_support.p010) + formats[num_formats++] =DRM_FORMAT_P010 ;break ;case DRM_PLANE_TYPE_OVERLAY :
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_resource.c +2 -1
@@ -552,7 +552,8 @@ static const struct dc_plane_cap plane_cap = { .pixel_format_support = { .argb8888 = true, .nv12 = true, - .fp16 = true + .fp16 = true, + .p010 = true }, .max_upscale_factor = {
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c +2 -1
@@ -1012,7 +1012,8 @@ static const struct dc_plane_cap plane_cap = { .pixel_format_support = { .argb8888 = true, .nv12 = true, - .fp16 = true + .fp16 = true, + .p010 = true }, .max_upscale_factor = {
drivers/gpu/drm/amd/display/dc/dcn21/dcn21_resource.c +2 -1
@@ -838,7 +838,8 @@ static const struct dc_plane_cap plane_cap = { .pixel_format_support = { .argb8888 = true, .nv12 = true, - .fp16 = true + .fp16 = true, + .p010 = true }, .max_upscale_factor = {
Signature · 6 lines
2.25.2 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 4/12 drm/amd/display: Add ABM driver implementation
In reply to Rodrigo SiqueiraFrom: Wyatt Wood <[email protected]>
[Why]
Moving ABM from DMCU to DMCUB.
[How]
Add ABM driver files and implementation.
--- drivers/gpu/drm/amd/display/dc/dce/Makefile | 2 +- drivers/gpu/drm/amd/display/dc/dce/dce_abm.c | 1 + drivers/gpu/drm/amd/display/dc/dce/dmub_abm.c | 417 ++++++++++++++++++ drivers/gpu/drm/amd/display/dc/dce/dmub_abm.h | 40 ++ .../drm/amd/display/dc/dcn21/dcn21_resource.c | 41 +- drivers/gpu/drm/amd/display/dc/inc/hw/abm.h | 4 + .../gpu/drm/amd/display/dmub/inc/dmub_cmd.h | 11 + .../amd/display/modules/power/power_helpers.c | 21 +- 8 files changed, 514 insertions(+), 23 deletions(-) create mode 100644 drivers/gpu/drm/amd/display/dc/dce/dmub_abm.c create mode 100644 drivers/gpu/drm/amd/display/dc/dce/dmub_abm.h
drivers/gpu/drm/amd/display/dc/dce/Makefile +1 -1
@@ -29,7 +29,7 @@ DCE = dce_audio.o dce_stream_encoder.o dce_link_encoder.o dce_hwseq.o \ dce_mem_input.o dce_clock_source.o dce_scl_filters.o dce_transform.o \ dce_opp.o dce_dmcu.o dce_abm.o dce_ipp.o dce_aux.o \ -dce_i2c.o dce_i2c_hw.o dce_i2c_sw.o dmub_psr.o +dce_i2c.o dce_i2c_hw.o dce_i2c_sw.o dmub_psr.o dmub_abm.o AMD_DAL_DCE = $(addprefix $(AMDDALPATH)/dc/dce/,$(DCE))
drivers/gpu/drm/amd/display/dc/dce/dce_abm.c +1 -0
@@ -447,6 +447,7 @@ static const struct abm_funcs dce_funcs = { .set_backlight_level_pwm = dce_abm_set_backlight_level_pwm, .get_current_backlight = dce_abm_get_current_backlight, .get_target_backlight = dce_abm_get_target_backlight, + .load_abm_config = NULL, .set_abm_immediate_disable = dce_abm_immediate_disable };
drivers/gpu/drm/amd/display/dc/dce/dmub_abm.c new file +417 -0
417 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/dce/dmub_abm.h new file +40 -0
@@ -0,0 +1,40 @@ +/* +* Copyright 2019 Advanced Micro Devices, Inc. +* +* Permission is hereby granted, free of charge, to any person obtaining a +* copy of this software and associated documentation files (the "Software"), +* to deal in the Software without restriction, including without limitation +* the rights to use, copy, modify, merge, publish, distribute, sublicense, +* and/or sell copies of the Software, and to permit persons to whom the +* Software is furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice shall be included in +* all copies or substantial portions of the Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR +* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +* OTHER DEALINGS IN THE SOFTWARE. +* +* Authors: AMD +* +*/ + +#ifndef __DMUB_ABM_H__ +#define __DMUB_ABM_H__ + +#include "abm.h" +#include "dce_abm.h" + +struct abm *dmub_abm_create ( +struct dc_context *ctx, +const struct dce_abm_registers *regs, +const struct dce_abm_shift *abm_shift, +const struct dce_abm_mask *abm_mask); + +void dmub_abm_destroy (struct abm **abm); + +#endif
drivers/gpu/drm/amd/display/dc/dcn21/dcn21_resource.c +24 -17
68 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/inc/hw/abm.h +4 -0
@@ -60,6 +60,10 @@ struct abm_funcs {unsigned int (*get_current_backlight)(struct abm *abm);unsigned int (*get_target_backlight)(struct abm *abm); +bool (*load_abm_config)(struct abm *abm, +unsigned int start_offset, +const char *src, + unsigned int bytes); };#endif
drivers/gpu/drm/amd/display/dmub/inc/dmub_cmd.h +11 -0
@@ -303,6 +303,16 @@ struct dmub_rb_cmd_abm_set_pwm_frac {struct dmub_cmd_abm_set_pwm_frac_data abm_set_pwm_frac_data; }; +struct dmub_cmd_abm_init_config_data { +union dmub_addr src; +uint16_t bytes; +}; + +struct dmub_rb_cmd_abm_init_config { +struct dmub_cmd_header header; +struct dmub_cmd_abm_init_config_data abm_init_config_data; +}; +union dmub_rb_cmd {struct dmub_rb_cmd_read_modify_write read_modify_write;struct dmub_rb_cmd_reg_field_update_sequence reg_field_update_seq;
@@ -324,6 +334,7 @@ union dmub_rb_cmd {struct dmub_rb_cmd_abm_set_level abm_set_level;struct dmub_rb_cmd_abm_set_ambient_level abm_set_ambient_level;struct dmub_rb_cmd_abm_set_pwm_frac abm_set_pwm_frac; +struct dmub_rb_cmd_abm_init_config abm_init_config; };#pragma pack(pop)
drivers/gpu/drm/amd/display/modules/power/power_helpers.c +16 -5
@@ -24,6 +24,9 @@#include "power_helpers.h" #include "dc/inc/hw/dmcu.h" +#include "dc/inc/hw/abm.h" +#include "dc.h" +#include "core_types.h" #define DIV_ROUNDUP (a, b) (((a)+((b)/2))/(b))
@@ -653,19 +656,27 @@ bool dmcu_load_iram(struct dmcu *dmcu, {unsigned char ram_table[IRAM_SIZE ];bool result = false; +struct abm *abm = dmcu->ctx->dc->res_pool->abm; -if (dmcu ==NULL ) +if (dmcu ==NULL && abm ==NULL )return false; -if (!dmcu->funcs->is_dmcu_initialized (dmcu)) +if (dmcu && !dmcu->funcs->is_dmcu_initialized (dmcu))return true;memset (&ram_table,0 ,sizeof (ram_table)); -if (dmcu->dmcu_version.abm_version ==0x24 ) { +// In the case where abm is implemented on dmcub, +// dmcu object will be null. +// ABM 2.4 and up are implemented on dmcub +if (dmcu ==NULL ) {fill_iram_v_2_3 ((struct iram_table_v_2_2 *)ram_table, params); - result = dmcu->funcs->load_iram ( - dmcu,0 , (char *)(&ram_table),IRAM_RESERVE_AREA_START_V2_2 ); + result = abm->funcs->load_abm_config ( + abm,0 , (char *)(&ram_table),IRAM_RESERVE_AREA_START_V2_2 ); + }else if (dmcu->dmcu_version.abm_version ==0x24 ) { +fill_iram_v_2_3 ((struct iram_table_v_2_2 *)ram_table, params); + result = dmcu->funcs->load_iram ( + dmcu,0 , (char *)(&ram_table),IRAM_RESERVE_AREA_START_V2_2 ); }else if (dmcu->dmcu_version.abm_version ==0x23 ) {fill_iram_v_2_3 ((struct iram_table_v_2_2 *)ram_table, params);
Signature · 6 lines
2.25.2 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 5/12 drm/amd/display: Use double buffered DRR timing update by default
In reply to Rodrigo SiqueiraFrom: Nicholas Kazlauskas <[email protected]>
[Why]
For some monitors extreme flickering can occur while using LFC for if we're not doing the DRR timing update for V_TOTAL_MIN / V_TOTAL_MAX at the DP start of frame.
Hardware can default to any time in the frame which isn't the behavior we want.
[How]
Add a new function for setting the double buffering mode for DRR timing.
Default to DP start of frame double buffering on timing generator init.
--- .../gpu/drm/amd/display/dc/dcn10/dcn10_optc.c | 18 ++++++++++++++++++ .../gpu/drm/amd/display/dc/dcn10/dcn10_optc.h | 3 +++ 2 files changed, 21 insertions(+)
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_optc.c +18 -0
@@ -342,6 +342,23 @@ void optc1_set_blank_data_double_buffer(struct timing_generator *optc, bool enab OTG_BLANK_DATA_DOUBLE_BUFFER_EN, blank_data_double_buffer_enable); } +/** +* optc1_set_timing_double_buffer() - DRR double buffering control +* +* Sets double buffer point for V_TOTAL, H_TOTAL, VTOTAL_MIN, +* VTOTAL_MAX, VTOTAL_MIN_SEL and VTOTAL_MAX_SEL registers. +* +* Options: any time, start of frame, dp start of frame (range timing) +*/ +void optc1_set_timing_double_buffer (struct timing_generator *optc,bool enable) +{ +struct optc *optc1 =DCN10TG_FROM_TG (optc); +uint32_t mode = enable ?2 :0 ; + +REG_UPDATE (OTG_DOUBLE_BUFFER_CONTROL , +OTG_RANGE_TIMING_DBUF_UPDATE_MODE , mode); +} +/** * unblank_crtc * Call ASIC Control Object to UnBlank CRTC.
@@ -1353,6 +1370,7 @@ void optc1_clear_optc_underflow(struct timing_generator *optc)void optc1_tg_init (struct timing_generator *optc) {optc1_set_blank_data_double_buffer (optc, true); +optc1_set_timing_double_buffer (optc, true);optc1_clear_optc_underflow (optc); }
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_optc.h +3 -0
@@ -185,6 +185,7 @@ struct dcn_optc_registers {SF (OTG0_OTG_GLOBAL_CONTROL0 ,OTG_MASTER_UPDATE_LOCK_SEL , mask_sh),\SF (OTG0_OTG_DOUBLE_BUFFER_CONTROL ,OTG_UPDATE_PENDING , mask_sh),\SF (OTG0_OTG_DOUBLE_BUFFER_CONTROL ,OTG_BLANK_DATA_DOUBLE_BUFFER_EN , mask_sh),\ +SF (OTG0_OTG_DOUBLE_BUFFER_CONTROL ,OTG_RANGE_TIMING_DBUF_UPDATE_MODE , mask_sh),\SF (OTG0_OTG_H_TOTAL ,OTG_H_TOTAL , mask_sh),\SF (OTG0_OTG_H_BLANK_START_END ,OTG_H_BLANK_START , mask_sh),\ SF(OTG0_OTG_H_BLANK_START_END, OTG_H_BLANK_END, mask_sh),\
@@ -643,6 +644,8 @@ bool optc1_is_optc_underflow_occurred(struct timing_generator *optc);void optc1_set_blank_data_double_buffer (struct timing_generator *optc,bool enable); +void optc1_set_timing_double_buffer (struct timing_generator *optc,bool enable); +bool optc1_get_otg_active_size (struct timing_generator *optc,uint32_t *otg_active_width,uint32_t *otg_active_height);
Signature · 6 lines
2.25.2 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 6/12 drm/amd/display: Not doing optimize bandwidth if flip pending.
In reply to Rodrigo SiqueiraFrom: Yongqiang Sun <[email protected]>
[Why]
In some scenario like 1366x768 VSR enabled connected with a 4K monitor and playing 4K video in clone mode, underflow will be observed due to decrease dppclk when previouse surface scan isn't finished
[How]
In this use case, surface flip is switching between 4K and 1366x768, 1366x768 needs smaller dppclk, and when decrease the clk and previous surface scan is for 4K and scan isn't done, underflow will happen. Not doing optimize bandwidth in case of flip pending.
--- drivers/gpu/drm/amd/display/dc/core/dc.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+)
drivers/gpu/drm/amd/display/dc/core/dc.c +23 -0
@@ -1360,6 +1360,26 @@ bool dc_commit_state(struct dc *dc, struct dc_state *context)return (result ==DC_OK ); } +static bool is_flip_pending_in_pipes (struct dc *dc,struct dc_state *context) +{ +int i; +struct pipe_ctx *pipe; + +for (i =0 ; i <MAX_PIPES ; i++) { + pipe = &context->res_ctx.pipe_ctx[i]; + +if (!pipe->plane_state) +continue ; + +/* Must set to false to start with, due to OR in update function */ + pipe->plane_state->status.is_flip_pending = false; + dc->hwss.update_pending_status (pipe); +if (pipe->plane_state->status.is_flip_pending) +return true; + } +return false; +} +bool dc_post_update_surfaces_to_stream (struct dc *dc) {int i;
@@ -1370,6 +1390,9 @@ bool dc_post_update_surfaces_to_stream(struct dc *dc)post_surface_trace (dc); +if (is_flip_pending_in_pipes (dc, context)) +return true; +for (i =0 ; i < dc->res_pool->pipe_count; i++)if (context->res_ctx.pipe_ctx[i].stream ==NULL || context->res_ctx.pipe_ctx[i].plane_state ==NULL ) {
Signature · 6 lines
2.25.2 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 7/12 drm/amd/display: Revert change to HDCP display states
In reply to Rodrigo SiqueiraFrom: Isabel Zhang <[email protected]>
[Why]
Change is causing a regression where the OPC app no longer functions properly.
[How]
Revert the changelist causing the issue.
--- .../gpu/drm/amd/display/modules/hdcp/hdcp.c | 5 +-- .../gpu/drm/amd/display/modules/hdcp/hdcp.h | 28 ++++++++++--- .../display/modules/hdcp/hdcp1_execution.c | 2 +- .../display/modules/hdcp/hdcp2_execution.c | 2 +- .../drm/amd/display/modules/hdcp/hdcp_psp.c | 39 +++++++++++-------- .../drm/amd/display/modules/inc/mod_hdcp.h | 1 + 6 files changed, 49 insertions(+), 28 deletions(-)
drivers/gpu/drm/amd/display/modules/hdcp/hdcp.c +2 -3
@@ -328,8 +328,7 @@ enum mod_hdcp_status mod_hdcp_add_display(struct mod_hdcp *hdcp,/* add display to connection */ hdcp->connection.link = *link; *display_container = *display; - status =mod_hdcp_add_display_to_topology (hdcp, display_container); - + status =mod_hdcp_add_display_to_topology (hdcp, display->index);if (status !=MOD_HDCP_STATUS_SUCCESS ) goto out;
@@ -375,7 +374,7 @@ enum mod_hdcp_status mod_hdcp_remove_display(struct mod_hdcp *hdcp, status =mod_hdcp_remove_display_from_topology (hdcp, index);if (status !=MOD_HDCP_STATUS_SUCCESS ) goto out; -memset (display,0 ,sizeof (struct mod_hdcp_display )); + display->state =MOD_HDCP_DISPLAY_INACTIVE ;/* request authentication when connection is not reset */ if (current_state (hdcp) !=HDCP_UNINITIALIZED )
drivers/gpu/drm/amd/display/modules/hdcp/hdcp.h +22 -6
@@ -328,7 +328,7 @@ void mod_hdcp_dump_binary_message(uint8_t *msg, uint32_t msg_size,/* psp functions */ enum mod_hdcp_status mod_hdcp_add_display_to_topology ( -struct mod_hdcp *hdcp,struct mod_hdcp_display *display); +struct mod_hdcp *hdcp,uint8_t index);enum mod_hdcp_status mod_hdcp_remove_display_from_topology (struct mod_hdcp *hdcp,uint8_t index);enum mod_hdcp_status mod_hdcp_hdcp1_create_session (struct mod_hdcp *hdcp);
@@ -503,6 +503,11 @@ static inline uint8_t is_display_active(struct mod_hdcp_display *display)return display->state >=MOD_HDCP_DISPLAY_ACTIVE ; } +static inline uint8_t is_display_added (struct mod_hdcp_display *display) +{ +return display->state >=MOD_HDCP_DISPLAY_ACTIVE_AND_ADDED ; +} +static inline uint8_t is_display_encryption_enabled (struct mod_hdcp_display *display) {return display->state >=MOD_HDCP_DISPLAY_ENCRYPTION_ENABLED ;
@@ -510,23 +515,34 @@ static inline uint8_t is_display_encryption_enabled(struct mod_hdcp_display *disstatic inline uint8_t get_active_display_count (struct mod_hdcp *hdcp) { -uint8_t active_count =0 ; +uint8_t added_count =0 ;uint8_t i;for (i =0 ; i <MAX_NUM_OF_DISPLAYS ; i++)if (is_display_active (&hdcp->displays[i])) - active_count++; -return active_count; + added_count++; +return added_count; +} + +static inline uint8_t get_added_display_count (struct mod_hdcp *hdcp) +{ +uint8_t added_count =0 ; +uint8_t i; + +for (i =0 ; i <MAX_NUM_OF_DISPLAYS ; i++) +if (is_display_added (&hdcp->displays[i])) + added_count++; +return added_count; } -static inline struct mod_hdcp_display *get_first_active_display ( +static inline struct mod_hdcp_display *get_first_added_display (struct mod_hdcp *hdcp) {uint8_t i;struct mod_hdcp_display *display =NULL ;for (i =0 ; i <MAX_NUM_OF_DISPLAYS ; i++) -if (is_display_active (&hdcp->displays[i])) { +if (is_display_added (&hdcp->displays[i])) { display = &hdcp->displays[i];break ; }
drivers/gpu/drm/amd/display/modules/hdcp/hdcp1_execution.c +1 -1
@@ -129,7 +129,7 @@ static inline uint8_t get_device_count(struct mod_hdcp *hdcp)static inline enum mod_hdcp_status check_device_count (struct mod_hdcp *hdcp) {/* device count must be greater than or equal to tracked hdcp displays */ -return (get_device_count (hdcp) <get_active_display_count (hdcp)) ? +return (get_device_count (hdcp) <get_added_display_count (hdcp)) ?MOD_HDCP_STATUS_HDCP1_DEVICE_COUNT_MISMATCH_FAILURE :MOD_HDCP_STATUS_SUCCESS ; }
drivers/gpu/drm/amd/display/modules/hdcp/hdcp2_execution.c +1 -1
@@ -208,7 +208,7 @@ static inline uint8_t get_device_count(struct mod_hdcp *hdcp)static enum mod_hdcp_status check_device_count (struct mod_hdcp *hdcp) {/* device count must be greater than or equal to tracked hdcp displays */ -return (get_device_count (hdcp) <get_active_display_count (hdcp)) ? +return (get_device_count (hdcp) <get_added_display_count (hdcp)) ?MOD_HDCP_STATUS_HDCP2_DEVICE_COUNT_MISMATCH_FAILURE :MOD_HDCP_STATUS_SUCCESS ; }
drivers/gpu/drm/amd/display/modules/hdcp/hdcp_psp.c +22 -17
@@ -54,7 +54,7 @@ enum mod_hdcp_status mod_hdcp_remove_display_from_topology( dtm_cmd = (struct ta_dtm_shared_memory *)psp->dtm_context.dtm_shared_buf; -if (!display || !is_display_active (display)) +if (!display || !is_display_added (display))return MOD_HDCP_STATUS_DISPLAY_NOT_FOUND ;memset (dtm_cmd,0 ,sizeof (struct ta_dtm_shared_memory ));
@@ -73,21 +73,25 @@ enum mod_hdcp_status mod_hdcp_remove_display_from_topology(HDCP_TOP_REMOVE_DISPLAY_TRACE (hdcp, display->index);return MOD_HDCP_STATUS_SUCCESS ; - } - -enum mod_hdcp_status mod_hdcp_add_display_to_topology ( -struct mod_hdcp *hdcp,struct mod_hdcp_display *display) + +} +enum mod_hdcp_status mod_hdcp_add_display_to_topology (struct mod_hdcp *hdcp, +uint8_t index) {struct psp_context *psp = hdcp->config.psp.handle;struct ta_dtm_shared_memory *dtm_cmd; +struct mod_hdcp_display *display = +get_active_display_at_index (hdcp, index);struct mod_hdcp_link *link = &hdcp->connection.link;if (!psp->dtm_context.dtm_initialized) {DRM_ERROR ("Failed to add display topology, DTM TA is not initialized." ); - display->state =MOD_HDCP_DISPLAY_INACTIVE ;return MOD_HDCP_STATUS_FAILURE ; } +if (!display ||is_display_added (display)) +return MOD_HDCP_STATUS_UPDATE_TOPOLOGY_FAILURE ; + dtm_cmd = (struct ta_dtm_shared_memory *)psp->dtm_context.dtm_shared_buf;memset (dtm_cmd,0 ,sizeof (struct ta_dtm_shared_memory ));
@@ -109,11 +113,10 @@ enum mod_hdcp_status mod_hdcp_add_display_to_topology(psp_dtm_invoke (psp, dtm_cmd->cmd_id); -if (dtm_cmd->dtm_status !=TA_DTM_STATUS__SUCCESS ) { - display->state =MOD_HDCP_DISPLAY_INACTIVE ; +if (dtm_cmd->dtm_status !=TA_DTM_STATUS__SUCCESS )return MOD_HDCP_STATUS_UPDATE_TOPOLOGY_FAILURE ; - } + display->state =MOD_HDCP_DISPLAY_ACTIVE_AND_ADDED ;HDCP_TOP_ADD_DISPLAY_TRACE (hdcp, display->index);return MOD_HDCP_STATUS_SUCCESS ;
@@ -123,7 +126,7 @@ enum mod_hdcp_status mod_hdcp_hdcp1_create_session(struct mod_hdcp *hdcp) {struct psp_context *psp = hdcp->config.psp.handle; -struct mod_hdcp_display *display =get_first_active_display (hdcp); +struct mod_hdcp_display *display =get_first_added_display (hdcp);struct ta_hdcp_shared_memory *hdcp_cmd;if (!psp->hdcp_context.hdcp_initialized) {
@@ -176,7 +179,7 @@ enum mod_hdcp_status mod_hdcp_hdcp1_destroy_session(struct mod_hdcp *hdcp)if (is_display_encryption_enabled ( &hdcp->displays[i])) { hdcp->displays[i].state = -MOD_HDCP_DISPLAY_ACTIVE ; +MOD_HDCP_DISPLAY_ACTIVE_AND_ADDED ;HDCP_HDCP1_DISABLED_TRACE (hdcp, hdcp->displays[i].index); }
@@ -228,7 +231,7 @@ enum mod_hdcp_status mod_hdcp_hdcp1_enable_encryption(struct mod_hdcp *hdcp) {struct psp_context *psp = hdcp->config.psp.handle;struct ta_hdcp_shared_memory *hdcp_cmd; -struct mod_hdcp_display *display =get_first_active_display (hdcp); +struct mod_hdcp_display *display =get_first_added_display (hdcp); hdcp_cmd = (struct ta_hdcp_shared_memory *)psp->hdcp_context.hdcp_shared_buf;memset (hdcp_cmd,0 ,sizeof (struct ta_hdcp_shared_memory ));
@@ -298,7 +301,8 @@ enum mod_hdcp_status mod_hdcp_hdcp1_enable_dp_stream_encryption(struct mod_hdcpfor (i =0 ; i <MAX_NUM_OF_DISPLAYS ; i++) { -if (hdcp->displays[i].adjust.disable) +if (hdcp->displays[i].state !=MOD_HDCP_DISPLAY_ACTIVE_AND_ADDED || + hdcp->displays[i].adjust.disable)continue ;memset (hdcp_cmd,0 ,sizeof (struct ta_hdcp_shared_memory ));
@@ -360,7 +364,7 @@ enum mod_hdcp_status mod_hdcp_hdcp2_create_session(struct mod_hdcp *hdcp) {struct psp_context *psp = hdcp->config.psp.handle;struct ta_hdcp_shared_memory *hdcp_cmd; -struct mod_hdcp_display *display =get_first_active_display (hdcp); +struct mod_hdcp_display *display =get_first_added_display (hdcp);if (!psp->hdcp_context.hdcp_initialized) {DRM_ERROR ("Failed to create hdcp session, HDCP TA is not initialized" );
@@ -419,7 +423,7 @@ enum mod_hdcp_status mod_hdcp_hdcp2_destroy_session(struct mod_hdcp *hdcp)if (is_display_encryption_enabled ( &hdcp->displays[i])) { hdcp->displays[i].state = -MOD_HDCP_DISPLAY_ACTIVE ; +MOD_HDCP_DISPLAY_ACTIVE_AND_ADDED ;HDCP_HDCP2_DISABLED_TRACE (hdcp, hdcp->displays[i].index); }
@@ -658,7 +662,7 @@ enum mod_hdcp_status mod_hdcp_hdcp2_enable_encryption(struct mod_hdcp *hdcp) {struct psp_context *psp = hdcp->config.psp.handle;struct ta_hdcp_shared_memory *hdcp_cmd; -struct mod_hdcp_display *display =get_first_active_display (hdcp); +struct mod_hdcp_display *display =get_first_added_display (hdcp); hdcp_cmd = (struct ta_hdcp_shared_memory *)psp->hdcp_context.hdcp_shared_buf;memset (hdcp_cmd,0 ,sizeof (struct ta_hdcp_shared_memory ));
@@ -743,7 +747,8 @@ enum mod_hdcp_status mod_hdcp_hdcp2_enable_dp_stream_encryption(struct mod_hdcpfor (i =0 ; i <MAX_NUM_OF_DISPLAYS ; i++) { -if (hdcp->displays[i].adjust.disable) +if (hdcp->displays[i].state !=MOD_HDCP_DISPLAY_ACTIVE_AND_ADDED || + hdcp->displays[i].adjust.disable)continue ; hdcp_cmd->in_msg.hdcp2_enable_dp_stream_encryption.display_handle = hdcp->displays[i].index; hdcp_cmd->in_msg.hdcp2_enable_dp_stream_encryption.session_handle = hdcp->auth.id;
drivers/gpu/drm/amd/display/modules/inc/mod_hdcp.h +1 -0
@@ -117,6 +117,7 @@ enum mod_hdcp_operation_mode {enum mod_hdcp_display_state {MOD_HDCP_DISPLAY_INACTIVE =0 ,MOD_HDCP_DISPLAY_ACTIVE , +MOD_HDCP_DISPLAY_ACTIVE_AND_ADDED ,MOD_HDCP_DISPLAY_ENCRYPTION_ENABLED };
Signature · 6 lines
2.25.2 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 8/12 drm/amd/display: Support plane level CTM
In reply to Rodrigo SiqueiraFrom: Stylon Wang <[email protected]>
[Why]
CTM was only supported at CRTC level and we need color space conversion in linear space at plane level.
[How]
- Add plane-level CTM to dc interface
- Program plane-level CTM in DCN
--- drivers/gpu/drm/amd/display/dc/core/dc.c | 10 +++++++++- drivers/gpu/drm/amd/display/dc/dc.h | 3 +++ .../gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c | 6 ++++++ 3 files changed, 18 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/core/dc.c +9 -1
@@ -1726,6 +1726,9 @@ static enum surface_update_type det_surface_update(const struct dc *dc,if (u->coeff_reduction_factor) update_flags->bits.coeff_reduction_change =1 ; +if (u->gamut_remap_matrix) + update_flags->bits.gamut_remap_change =1 ; +if (u->gamma) {enum surface_pixel_format format =SURFACE_PIXEL_FORMAT_GRPH_BEGIN ;
@@ -1751,7 +1754,8 @@ static enum surface_update_type det_surface_update(const struct dc *dc,if (update_flags->bits.input_csc_change || update_flags->bits.coeff_reduction_change - || update_flags->bits.gamma_change) { + || update_flags->bits.gamma_change + || update_flags->bits.gamut_remap_change) { type =UPDATE_TYPE_FULL ;elevate_update_type (&overall_type, type); }
@@ -1996,6 +2000,10 @@ static void copy_surface_update_to_plane(if (srf_update->coeff_reduction_factor) surface->coeff_reduction_factor = *srf_update->coeff_reduction_factor; + +if (srf_update->gamut_remap_matrix) + surface->gamut_remap_matrix = + *srf_update->gamut_remap_matrix; } static void copy_stream_update_to_stream(struct dc *dc,
drivers/gpu/drm/amd/display/dc/dc.h +3 -0
@@ -726,6 +726,7 @@ union surface_update_flags { uint32_t output_tf_change:1; uint32_t pixel_format_change:1; uint32_t plane_size_change:1; + uint32_t gamut_remap_change:1;/* Full updates */ uint32_t new_plane:1;
@@ -760,6 +761,7 @@ struct dc_plane_state {struct dc_csc_transform input_csc_color_matrix;struct fixed31_32 coeff_reduction_factor;struct fixed31_32 hdr_mult; +struct colorspace_transform gamut_remap_matrix;// TODO: No longer used, remove struct dc_hdr_static_metadata hdr_static_ctx;
@@ -839,6 +841,7 @@ struct dc_surface_update {const struct dc_transfer_func *func_shaper;const struct dc_3dlut *lut3d_func;const struct dc_transfer_func *blend_tf; +const struct colorspace_transform *gamut_remap_matrix; };/*
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c +6 -0
@@ -2004,6 +2004,12 @@ void dcn10_program_gamut_remap(struct pipe_ctx *pipe_ctx)for (i =0 ; i <CSC_TEMPERATURE_MATRIX_SIZE ; i++) adjust.temperature_matrix[i] = pipe_ctx->stream->gamut_remap_matrix.matrix[i]; + }else if (pipe_ctx->plane_state && + pipe_ctx->plane_state->gamut_remap_matrix.enable_remap == true) { + adjust.gamut_adjust_type =GRAPHICS_GAMUT_ADJUST_TYPE_SW ; +for (i =0 ; i <CSC_TEMPERATURE_MATRIX_SIZE ; i++) + adjust.temperature_matrix[i] = + pipe_ctx->plane_state->gamut_remap_matrix.matrix[i]; } pipe_ctx->plane_res.dpp->funcs->dpp_set_gamut_remap (pipe_ctx->plane_res.dpp, &adjust);
Signature · 6 lines
2.25.2 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 9/12 drm/amd/display: LFC not working on 2.0x range monitors
In reply to Rodrigo SiqueiraFrom: Aric Cyr <[email protected]>
[Why]
Nominal pixel clock and EDID information differ in precision so although monitor reports maximum refresh is 2x minimum, LFC was not being enabled.
[How]
Use minimum refresh rate as nominal/2 when EDID dictates that min refresh = max refresh/2.
--- .../amd/display/modules/freesync/freesync.c | 34 +++++++++++-------- 1 file changed, 19 insertions(+), 15 deletions(-)
drivers/gpu/drm/amd/display/modules/freesync/freesync.c +19 -15
@@ -734,6 +734,7 @@ void mod_freesync_build_vrr_params(struct mod_freesync *mod_freesync, {struct core_freesync *core_freesync =NULL ;unsigned long long nominal_field_rate_in_uhz =0 ; +unsigned long long rounded_nominal_in_uhz =0 ;unsigned int refresh_range =0 ;unsigned long long min_refresh_in_uhz =0 ;unsigned long long max_refresh_in_uhz =0 ;
@@ -750,17 +751,20 @@ void mod_freesync_build_vrr_params(struct mod_freesync *mod_freesync, min_refresh_in_uhz = in_config->min_refresh_in_uhz; max_refresh_in_uhz = in_config->max_refresh_in_uhz; -// Don't allow min > max -if (min_refresh_in_uhz > max_refresh_in_uhz) - min_refresh_in_uhz = max_refresh_in_uhz; -// Full range may be larger than current video timing, so cap at nominal if (max_refresh_in_uhz > nominal_field_rate_in_uhz) max_refresh_in_uhz = nominal_field_rate_in_uhz;// Full range may be larger than current video timing, so cap at nominal -if (min_refresh_in_uhz > nominal_field_rate_in_uhz) - min_refresh_in_uhz = nominal_field_rate_in_uhz; +if (min_refresh_in_uhz > max_refresh_in_uhz) + min_refresh_in_uhz = max_refresh_in_uhz; + +// If a monitor reports exactly max refresh of 2x of min, enforce it on nominal + rounded_nominal_in_uhz = + ((nominal_field_rate_in_uhz +50000 ) /100000 ) *100000 ; +if (in_config->max_refresh_in_uhz == (2 * in_config->min_refresh_in_uhz) && + in_config->max_refresh_in_uhz == rounded_nominal_in_uhz) + min_refresh_in_uhz = nominal_field_rate_in_uhz /2 ; if (!vrr_settings_require_update(core_freesync, in_config, (unsigned int)min_refresh_in_uhz, (unsigned int)max_refresh_in_uhz,
@@ -792,11 +796,6 @@ void mod_freesync_build_vrr_params(struct mod_freesync *mod_freesync, refresh_range = in_out_vrr->max_refresh_in_uhz - in_out_vrr->min_refresh_in_uhz; - in_out_vrr->btr.margin_in_us = in_out_vrr->max_duration_in_us - -2 * in_out_vrr->min_duration_in_us; -if (in_out_vrr->btr.margin_in_us >BTR_MAX_MARGIN ) - in_out_vrr->btr.margin_in_us =BTR_MAX_MARGIN ; - in_out_vrr->supported = true; }
@@ -804,9 +803,14 @@ void mod_freesync_build_vrr_params(struct mod_freesync *mod_freesync, in_out_vrr->btr.btr_enabled = in_config->btr; -if (in_out_vrr->max_refresh_in_uhz < -2 * in_out_vrr->min_refresh_in_uhz) +if (in_out_vrr->max_refresh_in_uhz < (2 * in_out_vrr->min_refresh_in_uhz)) in_out_vrr->btr.btr_enabled = false; +else { + in_out_vrr->btr.margin_in_us = in_out_vrr->max_duration_in_us - +2 * in_out_vrr->min_duration_in_us; +if (in_out_vrr->btr.margin_in_us >BTR_MAX_MARGIN ) + in_out_vrr->btr.margin_in_us =BTR_MAX_MARGIN ; + } in_out_vrr->btr.btr_active = false; in_out_vrr->btr.inserted_duration_in_us =0 ;
@@ -1008,8 +1012,8 @@ unsigned long long mod_freesync_calc_nominal_field_rate(unsigned int total = stream->timing.h_total * stream->timing.v_total;/* Calculate nominal field rate for stream, rounded up to nearest integer */ - nominal_field_rate_in_uhz = stream->timing.pix_clk_100hz /10 ; - nominal_field_rate_in_uhz *=1000ULL *1000ULL *1000ULL ; + nominal_field_rate_in_uhz = stream->timing.pix_clk_100hz; + nominal_field_rate_in_uhz *=100000000ULL ; nominal_field_rate_in_uhz =div_u64 (nominal_field_rate_in_uhz, total);
Signature · 6 lines
2.25.2 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 10/12 drm/amd/display: Move backlight pwm enable function call
In reply to Rodrigo SiqueiraFrom: Wyatt Wood <[email protected]>
[Why]
Can't call dmub_abm_enable_fractional_pwm from dmub_abm_create as dmub_srv is still null at this init stage, and therefore can't call to fw.
[How]
Move call to dmub_abm_init_backlight. This should be the first call from the driver for ABM.
--- drivers/gpu/drm/amd/display/dc/dce/dmub_abm.c | 34 +++++++++---------- 1 file changed, 17 insertions(+), 17 deletions(-)
drivers/gpu/drm/amd/display/dc/dce/dmub_abm.c +17 -17
@@ -257,11 +257,28 @@ static bool dmub_abm_immediate_disable(struct abm *abm)return true; } +static void dmub_abm_enable_fractional_pwm (struct dc_context *dc) +{ +union dmub_rb_cmd cmd; +uint32_t fractional_pwm = (dc->dc->config.disable_fractional_pwm == false) ?1 :0 ; + + cmd.abm_set_pwm_frac.header.type =DMUB_CMD__ABM ; + cmd.abm_set_pwm_frac.header.sub_type =DMUB_CMD__ABM_SET_PWM_FRAC ; + cmd.abm_set_pwm_frac.abm_set_pwm_frac_data.fractional_pwm = fractional_pwm; + cmd.abm_set_pwm_frac.header.payload_bytes =sizeof (struct dmub_cmd_abm_set_pwm_frac_data ); + +dc_dmub_srv_cmd_queue (dc->dmub_srv, &cmd.abm_set_pwm_frac.header); +dc_dmub_srv_cmd_execute (dc->dmub_srv); +dc_dmub_srv_wait_idle (dc->dmub_srv); +} +static bool dmub_abm_init_backlight (struct abm *abm) {struct dce_abm *dce_abm =TO_DMUB_ABM (abm);uint32_t value; +dmub_abm_enable_fractional_pwm (abm->ctx); +/* It must not be 0, so we have to restore them * Bios bug w/a - period resets to zero, * restoring to cache values which is always correct
@@ -331,21 +348,6 @@ static bool dmub_abm_set_backlight_level_pwm(return true; } -static void dmub_abm_enable_fractional_pwm (struct dc_context *dc) -{ -union dmub_rb_cmd cmd; -uint32_t fractional_pwm = (dc->dc->config.disable_fractional_pwm == false) ?1 :0 ; - - cmd.abm_set_pwm_frac.header.type =DMUB_CMD__ABM ; - cmd.abm_set_pwm_frac.header.sub_type =DMUB_CMD__ABM_SET_PWM_FRAC ; - cmd.abm_set_pwm_frac.abm_set_pwm_frac_data.fractional_pwm = fractional_pwm; - cmd.abm_set_pwm_frac.header.payload_bytes =sizeof (struct dmub_cmd_abm_set_pwm_frac_data ); - -dc_dmub_srv_cmd_queue (dc->dmub_srv, &cmd.abm_set_pwm_frac.header); -dc_dmub_srv_cmd_execute (dc->dmub_srv); -dc_dmub_srv_wait_idle (dc->dmub_srv); -} - static bool dmub_abm_load_config(struct abm *abm, unsigned int start_offset, const char *src,
@@ -386,8 +388,6 @@ static void dmub_abm_construct( abm_dce->regs = regs; abm_dce->abm_shift = abm_shift; abm_dce->abm_mask = abm_mask; - -dmub_abm_enable_fractional_pwm (ctx); } struct abm *dmub_abm_create(
Signature · 6 lines
2.25.2 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 11/12 drm/amd/display: Enable BT2020 in COLOR_ENCODING property
In reply to Rodrigo SiqueiraFrom: Stylon Wang <[email protected]>
[Why]
BT2020 is not supported in COLOR_ENCODING property of planes. Only BT601 and BT709 was available.
[How]
Allow BT2020 as legit value in setting COLOR_ENCODING property.
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +5 -2
@@ -5674,12 +5674,15 @@ static int amdgpu_dm_plane_init(struct amdgpu_display_manager *dm, }if (plane->type ==DRM_PLANE_TYPE_PRIMARY && - plane_cap && plane_cap->pixel_format_support.nv12) { + plane_cap && + (plane_cap->pixel_format_support.nv12 || + plane_cap->pixel_format_support.p010)) {/* This only affects YUV formats. */ drm_plane_create_color_properties ( plane,BIT (DRM_COLOR_YCBCR_BT601 ) | -BIT (DRM_COLOR_YCBCR_BT709 ), +BIT (DRM_COLOR_YCBCR_BT709 ) | +BIT (DRM_COLOR_YCBCR_BT2020 ),BIT (DRM_COLOR_YCBCR_LIMITED_RANGE ) |BIT (DRM_COLOR_YCBCR_FULL_RANGE ),DRM_COLOR_YCBCR_BT709 ,DRM_COLOR_YCBCR_LIMITED_RANGE );
Signature · 6 lines
2.25.2 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 12/12 drm/amd/display: Fix dcn21 num_states
In reply to Rodrigo SiqueiraFrom: Dmytro Laktyushkin <[email protected]>
[Why]
DML expects num_states to exclude the duplicate state.
[How]
Set num_states to correct value to prevent array off-by-one error. Also refactor max clock level code for diags.
--- .../drm/amd/display/dc/dcn20/dcn20_resource.c | 2 +- .../drm/amd/display/dc/dcn21/dcn21_resource.c | 37 ++++++------------- .../gpu/drm/amd/display/dc/dml/dc_features.h | 2 +- .../amd/display/dc/dml/display_mode_structs.h | 7 ++-- 4 files changed, 18 insertions(+), 30 deletions(-)
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c +1 -1
@@ -3343,7 +3343,7 @@ void dcn20_cap_soc_clocks(void dcn20_update_bounding_box (struct dc *dc,struct _vcs_dpi_soc_bounding_box_st *bb,struct pp_smu_nv_clock_table *max_clocks,unsigned int *uclk_states,unsigned int num_states) { -struct _vcs_dpi_voltage_scaling_st calculated_states[MAX_CLOCK_LIMIT_STATES ]; +struct _vcs_dpi_voltage_scaling_st calculated_states[DC__VOLTAGE_STATES ];int i;int num_calculated_states =0 ;int min_dcfclk =0 ;
drivers/gpu/drm/amd/display/dc/dcn21/dcn21_resource.c +12 -25
@@ -301,7 +301,7 @@ struct _vcs_dpi_soc_bounding_box_st dcn2_1_soc = { .xfc_bus_transport_time_us = 4, .xfc_xbuf_latency_tolerance_us = 4, .use_urgent_burst_bw = 1, - .num_states = 9 + .num_states = 8 };#ifndef MAX
@@ -1381,21 +1381,8 @@ static void update_bw_bounding_box(struct dc *dc, struct clk_bw_params *bw_paramunsigned int i, j, k;int closest_clk_lvl; -// diags does not retrieve proper values from SMU -// cap states to 5 and make state 5 the max state -if (IS_FPGA_MAXIMUS_DC (dc->ctx->dce_environment) ||IS_DIAG_DC (dc->ctx->dce_environment)) { - dcn2_1_soc.num_states =5 ; - - dcn2_1_soc.clock_limits[5 ].state =5 ; - dcn2_1_soc.clock_limits[5 ].dcfclk_mhz =810.0 ; - dcn2_1_soc.clock_limits[5 ].fabricclk_mhz =1600.0 ; - dcn2_1_soc.clock_limits[5 ].dispclk_mhz =1395.0 ; - dcn2_1_soc.clock_limits[5 ].dppclk_mhz =1285.0 ; - dcn2_1_soc.clock_limits[5 ].phyclk_mhz =1325.0 ; - dcn2_1_soc.clock_limits[5 ].socclk_mhz =953.0 ; - dcn2_1_soc.clock_limits[5 ].dscclk_mhz =489.0 ; - dcn2_1_soc.clock_limits[5 ].dram_speed_mts =4266.0 ; - }else { +// Default clock levels are used for diags, which may lead to overclocking. +if (!IS_FPGA_MAXIMUS_DC (dc->ctx->dce_environment) && !IS_DIAG_DC (dc->ctx->dce_environment)) { dcn2_1_ip.max_num_otg = pool->base.res_cap->num_timing_generator; dcn2_1_ip.max_num_dpp = pool->base.pipe_count; dcn2_1_soc.num_chans = bw_params->num_channels;
@@ -1408,16 +1395,16 @@ static void update_bw_bounding_box(struct dc *dc, struct clk_bw_params *bw_param dcn2_1_soc.clock_limits[0 ].dram_speed_mts = clk_table->entries[0 ].memclk_mhz *2 ;/* -* Other levels: find cloest DCN clocks that fit the given clock limit using dcfclk -* as indicater +* Other levels: find closest DCN clocks that fit the given clock limit using dcfclk +* as indicator */ closest_clk_lvl =-1 ;/* index currently being filled */ k =1 ;for (i =1 ; i < clk_table->num_entries; i++) { -/* loop backwards, skip duplicate state, +1 because SMU has precision issue */ -for (j = dcn2_1_soc.num_states -2 ; j >= k; j--) { +/* loop backwards, skip duplicate state*/ +for (j = dcn2_1_soc.num_states -1 ; j >= k; j--) {if ((unsigned int ) dcn2_1_soc.clock_limits[j].dcfclk_mhz <= clk_table->entries[i].dcfclk_mhz) { closest_clk_lvl = j;break ;
@@ -1442,13 +1429,13 @@ static void update_bw_bounding_box(struct dc *dc, struct clk_bw_params *bw_param k++; } } - -/* duplicate last level */ - dcn2_1_soc.clock_limits[k] = dcn2_1_soc.clock_limits[k -1 ]; - dcn2_1_soc.clock_limits[k].state = k; - dcn2_1_soc.num_states = k +1 ; + dcn2_1_soc.num_states = k; } +/* duplicate last level */ + dcn2_1_soc.clock_limits[dcn2_1_soc.num_states] = dcn2_1_soc.clock_limits[dcn2_1_soc.num_states -1 ]; + dcn2_1_soc.clock_limits[dcn2_1_soc.num_states].state = dcn2_1_soc.num_states; +dml_init_instance (&dc->dml, &dcn2_1_soc, &dcn2_1_ip,DML_PROJECT_DCN21 ); }
drivers/gpu/drm/amd/display/dc/dml/dc_features.h +1 -1
@@ -29,7 +29,7 @@#define DC__PRESENT 1#define DC__PRESENT__1 1#define DC__NUM_DPP 4 -#define DC__VOLTAGE_STATES 7 +#define DC__VOLTAGE_STATES 9#define DC__NUM_DPP__4 1#define DC__NUM_DPP__0_PRESENT 1#define DC__NUM_DPP__1_PRESENT 1
drivers/gpu/drm/amd/display/dc/dml/display_mode_structs.h +4 -3
@@ -22,11 +22,12 @@* Authors: AMD * */ + +#include "dc_features.h" +#ifndef __DISPLAY_MODE_STRUCTS_H__#define __DISPLAY_MODE_STRUCTS_H__ -#define MAX_CLOCK_LIMIT_STATES 9 -typedef struct _vcs_dpi_voltage_scaling_st voltage_scaling_st ;typedef struct _vcs_dpi_soc_bounding_box_st soc_bounding_box_st ;typedef struct _vcs_dpi_ip_params_st ip_params_st ;
@@ -68,7 +69,7 @@ struct _vcs_dpi_voltage_scaling_st { };struct _vcs_dpi_soc_bounding_box_st { -struct _vcs_dpi_voltage_scaling_st clock_limits[MAX_CLOCK_LIMIT_STATES ]; +struct _vcs_dpi_voltage_scaling_st clock_limits[DC__VOLTAGE_STATES ];unsigned int num_states;double sr_exit_time_us;double sr_enter_plus_exit_time_us;
Signature · 6 lines
2.25.2 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx