DC Patches April 16, 2020
cover DC Patches April 16, 2020
This DC patchset brings improvements in multiple areas. In summary, we highlight:
* Improvements on:
- DM color management
- Backlight panel
* Fixes on:
- Suspend issues
- Virtual signal dsc setup
- HDR visual confirm
Anthony Koo (4):
drm/amd/display: make all backlight calls link based drm/amd/display: move panel power seq to new panel struct drm/amd/display: destroy panel on link destruct drm/amd/display: change from panel to panel cntl
Aric Cyr (3):
drm/amd/display: Fix HDR visual confirm
drm/amd/display: Update MPCC if requested
drm/amd/display: 3.2.81
Aurabindo Pillai (1):
drm/amd/display: DispalyPort: Write OUI only if panel supports it
Dale Zhao (1):
drm/amd/display: Correct updating logic of dcn21's pipe VM flags
Dmytro Laktyushkin (2):
drm/amd/display: fix stream setting for diags on silicon drm/amd/display: fix virtual signal dsc setup
Haiyi Zhou (1):
drm/amd/display: Change infopacket type programming
Jaehyun Chung (1):
drm/amd/display: Add HW rotation cursor changes to dcn10
Jinze Xu (1):
drm/amd/display: Workaround to disable YCbCr
Joshua Aberback (1):
drm/amd/display: Force watermark value propagation
Nicholas Kazlauskas (4):
drm/amd/display: Check ramp != NULL before applying lut1d for degamma drm/amd/display: Avoid NULL pointer in set_backlight when ABM is NULL drm/amd/display: Use the correct input TF for video formats drm/amd/display: Factor in immediate flip support into DLG
calculations
Paul Hsieh (1):
drm/amd/display: dmcu wait loop calculation is incorrect in RV
Rodrigo Siqueira (1):
drm/amd/display: Fix green screen issue after suspend
Stylon Wang (2):
drm/amd/display: Support plane-level gamut remap in DM drm/amd/display: Adjust refactored dm for color management only
Sung Lee (3):
drm/amd/display: Set meta_chunk_value to 0 in DML if DCC disabled in
DCN2.1
drm/amd/display: Cast int to float before division drm/amd/display: Cap certain DML values for Low Pix Clk on DCN2.1
Wenjing Liu (1):
drm/amd/display: add optc get crc support for timings with ODM/DSC
Wyatt Wood (6):
drm/amd/display: Add user backlight level reg write drm/amd/display: Move enable fractional pwm call drm/amd/display: Remove byte swapping for dmcub abm config table drm/amd/display: Add SetBacklight call to abm on dmcub drm/amd/display: Unify psr feature flags drm/amd/display: Various fixes for PSR on DMCUB
Xiaodong Yan (1):
drm/amd/display: blank dp stream before re-train the link
Yongqiang Sun (1):
drm/amd/display: access ABM from stream resource.
.../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 99 +++++++++------ .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h | 2 +- .../amd/display/amdgpu_dm/amdgpu_dm_color.c | 25 +++- .../amd/display/amdgpu_dm/amdgpu_dm_debugfs.c | 10 +- .../gpu/drm/amd/display/dc/clk_mgr/clk_mgr.c | 2 +- .../dc/clk_mgr/dcn10/rv1_clk_mgr_vbios_smu.c | 3 - drivers/gpu/drm/amd/display/dc/core/dc.c | 28 +---- drivers/gpu/drm/amd/display/dc/core/dc_link.c | 104 ++++++++++++---- .../gpu/drm/amd/display/dc/core/dc_link_dp.c | 29 ++++- .../drm/amd/display/dc/core/dc_link_hwss.c | 2 +- drivers/gpu/drm/amd/display/dc/core/dc_sink.c | 1 + drivers/gpu/drm/amd/display/dc/dc.h | 9 +- drivers/gpu/drm/amd/display/dc/dc_dp_types.h | 6 + drivers/gpu/drm/amd/display/dc/dc_link.h | 24 +++- drivers/gpu/drm/amd/display/dc/dc_stream.h | 2 - drivers/gpu/drm/amd/display/dc/dce/Makefile | 2 +- drivers/gpu/drm/amd/display/dc/dce/dce_abm.c | 4 +- .../gpu/drm/amd/display/dc/dce/dce_hwseq.h | 65 +++------- .../drm/amd/display/dc/dce/dce_panel_cntl.c | 105 ++++++++++++++++ .../drm/amd/display/dc/dce/dce_panel_cntl.h | 117 ++++++++++++++++++ drivers/gpu/drm/amd/display/dc/dce/dmub_abm.c | 38 +++--- drivers/gpu/drm/amd/display/dc/dce/dmub_psr.c | 58 +++++++-- .../amd/display/dc/dce100/dce100_resource.c | 31 +++++ .../display/dc/dce110/dce110_hw_sequencer.c | 43 ++----- .../display/dc/dce110/dce110_hw_sequencer.h | 4 - .../amd/display/dc/dce110/dce110_resource.c | 31 +++++ .../amd/display/dc/dce112/dce112_resource.c | 31 +++++ .../amd/display/dc/dce120/dce120_resource.c | 31 +++++ .../drm/amd/display/dc/dce80/dce80_resource.c | 31 +++++ .../gpu/drm/amd/display/dc/dcn10/dcn10_hubp.c | 18 ++- .../amd/display/dc/dcn10/dcn10_hw_sequencer.c | 20 +-- .../gpu/drm/amd/display/dc/dcn10/dcn10_init.c | 2 - .../gpu/drm/amd/display/dc/dcn10/dcn10_optc.h | 7 +- .../drm/amd/display/dc/dcn10/dcn10_resource.c | 31 +++++ .../drm/amd/display/dc/dcn20/dcn20_hwseq.c | 8 +- .../gpu/drm/amd/display/dc/dcn20/dcn20_init.c | 2 - .../gpu/drm/amd/display/dc/dcn20/dcn20_optc.c | 14 ++- .../gpu/drm/amd/display/dc/dcn20/dcn20_optc.h | 7 ++ .../drm/amd/display/dc/dcn20/dcn20_resource.c | 33 ++++- .../gpu/drm/amd/display/dc/dcn21/dcn21_init.c | 2 - .../drm/amd/display/dc/dcn21/dcn21_resource.c | 38 +++++- .../dc/dml/dcn21/display_mode_vba_21.c | 4 +- .../dc/dml/dcn21/display_rq_dlg_calc_21.c | 17 ++- .../gpu/drm/amd/display/dc/inc/core_types.h | 3 + drivers/gpu/drm/amd/display/dc/inc/hw/abm.h | 2 +- .../gpu/drm/amd/display/dc/inc/hw/dchubbub.h | 2 + .../drm/amd/display/dc/inc/hw/panel_cntl.h | 53 ++++++++ .../amd/display/dc/inc/hw/timing_generator.h | 3 + .../amd/display/dc/inc/hw_sequencer_private.h | 2 - .../gpu/drm/amd/display/dmub/inc/dmub_cmd.h | 6 + .../drm/amd/display/dmub/inc/dmub_cmd_dal.h | 1 + .../amd/display/modules/color/color_gamma.c | 2 +- .../amd/display/modules/freesync/freesync.c | 101 +++++++++++++-- .../amd/display/modules/inc/mod_freesync.h | 3 + .../drm/amd/display/modules/inc/mod_shared.h | 5 +- .../display/modules/info_packet/info_packet.c | 3 +- .../amd/display/modules/power/power_helpers.c | 74 ++++++----- 57 files changed, 1089 insertions(+), 311 deletions(-) create mode 100644 drivers/gpu/drm/amd/display/dc/dce/dce_panel_cntl.c create mode 100644 drivers/gpu/drm/amd/display/dc/dce/dce_panel_cntl.h create mode 100644 drivers/gpu/drm/amd/display/dc/inc/hw/panel_cntl.h
Signature · 6 lines
2.26.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 1/35 drm/amd/display: Correct updating logic of dcn21's pipe VM flags
From: Dale Zhao <[email protected]>
[Why]:
Renoir's pipe VM flags are not correctly updated if pipe strategy has changed during some scenarios. It will result in watermarks mistakenly calculation, thus underflow and garbage appear.
[How]:
Correctly update pipe VM flags to pipes which have been populated.
--- drivers/gpu/drm/amd/display/dc/dcn21/dcn21_resource.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)
drivers/gpu/drm/amd/display/dc/dcn21/dcn21_resource.c +1 -5
@@ -1709,12 +1709,8 @@ static int dcn21_populate_dml_pipes_from_context( {uint32_t pipe_cnt =dcn20_populate_dml_pipes_from_context (dc, context, pipes);int i; -struct resource_context *res_ctx = &context->res_ctx; -for (i =0 ; i < dc->res_pool->pipe_count; i++) { - -if (!res_ctx->pipe_ctx[i].stream) -continue ; +for (i =0 ; i < pipe_cnt; i++) { pipes[i].pipe.src.hostvm =1 ; pipes[i].pipe.src.gpuvm =1 ;
Signature · 6 lines
2.26.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 2/35 drm/amd/display: Add user backlight level reg write
In reply to Rodrigo SiqueiraFrom: Wyatt Wood <[email protected]>
[Why]
Porting abm from dmcu to dmcub missed one register write.
[How]
Add this register write in the SetBacklightLevel sequence.
--- drivers/gpu/drm/amd/display/dc/dce/dmub_abm.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/gpu/drm/amd/display/dc/dce/dmub_abm.c +2 -0
@@ -136,6 +136,8 @@ static void dmcub_set_backlight_level(dmub_abm_set_pipe (&dce_abm->base, otg_inst); +REG_UPDATE (BL1_PWM_USER_LEVEL ,BL1_PWM_USER_LEVEL , backlight_pwm_u16_16); +if (otg_inst ==0 ) frame_ramp =0 ;
Signature · 6 lines
2.26.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 3/35 drm/amd/display: Move enable fractional pwm call
In reply to Rodrigo SiqueiraFrom: Wyatt Wood <[email protected]>
[Why]
Dmcu init fw call has some logic to initialize abm values. Since this doesn't exist on dmcub, must find a proper place for it in the abm sequence.
[How]
Move enable fractional pwm call.
--- 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
@@ -161,6 +161,21 @@ static void dmcub_set_backlight_level(REG_WRITE (BIOS_SCRATCH_2 , s2); } +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 void dmub_abm_init (struct abm *abm) {struct dce_abm *dce_abm =TO_DMUB_ABM (abm);
@@ -199,6 +214,8 @@ static void dmub_abm_init(struct abm *abm)ABM1_HG_REG_READ_MISSED_FRAME_CLEAR ,1 ,ABM1_LS_REG_READ_MISSED_FRAME_CLEAR ,1 , ABM1_BL_REG_READ_MISSED_FRAME_CLEAR, 1); + +dmub_abm_enable_fractional_pwm (abm->ctx); }static unsigned int dmub_abm_get_current_backlight (struct abm *abm)
@@ -259,28 +276,11 @@ 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
Signature · 6 lines
2.26.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 4/35 drm/amd/display: Force watermark value propagation
In reply to Rodrigo SiqueiraFrom: Joshua Aberback <[email protected]>
[Why]
The HUBBUB watermark registers are in an area that cannot be power gated, but the HUBP copies of the watermark values are in areas that can be power gated. When we power on a pipe, it will not automatically take the HUBBUB values, we need to force propagation by writing to a watermark register.
[How]
- new HUBBUB function to re-write current value in a WM register
- touch WM register after enabling the plane in program_pipe
--- drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c | 5 ++++- drivers/gpu/drm/amd/display/dc/inc/hw/dchubbub.h | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c +4 -1
@@ -1478,8 +1478,11 @@ static void dcn20_program_pipe(if (pipe_ctx->update_flags.bits.odm) hws->funcs.update_odm (dc, context, pipe_ctx); -if (pipe_ctx->update_flags.bits.enable) +if (pipe_ctx->update_flags.bits.enable) {dcn20_enable_plane (dc, pipe_ctx, context); +if (dc->res_pool->hubbub->funcs->force_wm_propagate_to_pipes) + dc->res_pool->hubbub->funcs->force_wm_propagate_to_pipes (dc->res_pool->hubbub); + }if (pipe_ctx->update_flags.raw || pipe_ctx->plane_state->update_flags.raw || pipe_ctx->stream->update_flags.raw)dcn20_update_dchubp_dpp (dc, pipe_ctx, context);
drivers/gpu/drm/amd/display/dc/inc/hw/dchubbub.h +2 -0
@@ -144,6 +144,8 @@ struct hubbub_funcs {void (*allow_self_refresh_control)(struct hubbub *hubbub,bool allow);void (*apply_DEDCN21_147_wa)(struct hubbub *hubbub); + +void (*force_wm_propagate_to_pipes)(struct hubbub *hubbub); };struct hubbub {
Signature · 6 lines
2.26.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 5/35 drm/amd/display: Remove byte swapping for dmcub abm config table
In reply to Rodrigo SiqueiraFrom: Wyatt Wood <[email protected]>
[Why]
Since x86 and dmcub are both little endian, byte swapping isn't necessary. Dmcu requires byte swapping as it is big endian.
[How]
Add flag to function definitions to determine if byte swapping is necessary.
--- .../amd/display/modules/power/power_helpers.c | 74 +++++++++---------- 1 file changed, 36 insertions(+), 38 deletions(-)
drivers/gpu/drm/amd/display/modules/power/power_helpers.c +36 -38
@@ -240,7 +240,7 @@ static void fill_backlight_transform_table(struct dmcu_iram_parameters params, }static void fill_backlight_transform_table_v_2_2 (struct dmcu_iram_parameters params, -struct iram_table_v_2_2 *table) +struct iram_table_v_2_2 *table,bool big_endian) {unsigned int i;unsigned int num_entries =NUM_BL_CURVE_SEGS ;
@@ -264,10 +264,10 @@ static void fill_backlight_transform_table_v_2_2(struct dmcu_iram_parameters par lut_index = (params.backlight_lut_array_size -1 ) * i / (num_entries -1 );ASSERT (lut_index < params.backlight_lut_array_size); - table->backlight_thresholds[i] = -cpu_to_be16 (DIV_ROUNDUP ((i *65536 ), num_entries)); - table->backlight_offsets[i] = -cpu_to_be16 (params.backlight_lut_array[lut_index]); + table->backlight_thresholds[i] = (big_endian) ? +cpu_to_be16 (DIV_ROUNDUP ((i *65536 ), num_entries)) :DIV_ROUNDUP ((i *65536 ), num_entries); + table->backlight_offsets[i] = (big_endian) ? +cpu_to_be16 (params.backlight_lut_array[lut_index]) : params.backlight_lut_array[lut_index]; } }
@@ -587,18 +587,16 @@ void fill_iram_v_2_2(struct iram_table_v_2_2 *ram_table, struct dmcu_iram_parame ram_table->crgb_slope[7 ] =cpu_to_be16 (0x1910 );fill_backlight_transform_table_v_2_2 ( - params, ram_table); + params, ram_table, true); } -void fill_iram_v_2_3 (struct iram_table_v_2_2 *ram_table,struct dmcu_iram_parameters params) +void fill_iram_v_2_3 (struct iram_table_v_2_2 *ram_table,struct dmcu_iram_parameters params,bool big_endian) {unsigned int i, j;unsigned int set = params.set; ram_table->flags =0x0 ; - - ram_table->min_abm_backlight = -cpu_to_be16 (params.min_abm_backlight); + ram_table->min_abm_backlight = (big_endian) ?cpu_to_be16 (params.min_abm_backlight) : params.min_abm_backlight;for (i =0 ; i <NUM_AGGR_LEVEL ; i++) { ram_table->hybrid_factor[i] = abm_settings[set][i].brightness_gain;
@@ -622,33 +620,33 @@ void fill_iram_v_2_3(struct iram_table_v_2_2 *ram_table, struct dmcu_iram_parame ram_table->iir_curve[4 ] =0x65 ;//Gamma 2.2 - ram_table->crgb_thresh[0 ] =cpu_to_be16 (0x127c ); - ram_table->crgb_thresh[1 ] =cpu_to_be16 (0x151b ); - ram_table->crgb_thresh[2 ] =cpu_to_be16 (0x17d5 ); - ram_table->crgb_thresh[3 ] =cpu_to_be16 (0x1a56 ); - ram_table->crgb_thresh[4 ] =cpu_to_be16 (0x1c83 ); - ram_table->crgb_thresh[5 ] =cpu_to_be16 (0x1e72 ); - ram_table->crgb_thresh[6 ] =cpu_to_be16 (0x20f0 ); - ram_table->crgb_thresh[7 ] =cpu_to_be16 (0x232b ); - ram_table->crgb_offset[0 ] =cpu_to_be16 (0x2999 ); - ram_table->crgb_offset[1 ] =cpu_to_be16 (0x3999 ); - ram_table->crgb_offset[2 ] =cpu_to_be16 (0x4666 ); - ram_table->crgb_offset[3 ] =cpu_to_be16 (0x5999 ); - ram_table->crgb_offset[4 ] =cpu_to_be16 (0x6333 ); - ram_table->crgb_offset[5 ] =cpu_to_be16 (0x7800 ); - ram_table->crgb_offset[6 ] =cpu_to_be16 (0x8c00 ); - ram_table->crgb_offset[7 ] =cpu_to_be16 (0xa000 ); - ram_table->crgb_slope[0 ] =cpu_to_be16 (0x3609 ); - ram_table->crgb_slope[1 ] =cpu_to_be16 (0x2dfa ); - ram_table->crgb_slope[2 ] =cpu_to_be16 (0x27ea ); - ram_table->crgb_slope[3 ] =cpu_to_be16 (0x235d ); - ram_table->crgb_slope[4 ] =cpu_to_be16 (0x2042 ); - ram_table->crgb_slope[5 ] =cpu_to_be16 (0x1dc3 ); - ram_table->crgb_slope[6 ] =cpu_to_be16 (0x1b1a ); - ram_table->crgb_slope[7 ] =cpu_to_be16 (0x1910 ); + ram_table->crgb_thresh[0 ] = (big_endian) ?cpu_to_be16 (0x127c ) :0x127c ; + ram_table->crgb_thresh[1 ] = (big_endian) ?cpu_to_be16 (0x151b ) :0x151b ; + ram_table->crgb_thresh[2 ] = (big_endian) ?cpu_to_be16 (0x17d5 ) :0x17d5 ; + ram_table->crgb_thresh[3 ] = (big_endian) ?cpu_to_be16 (0x1a56 ) :0x1a56 ; + ram_table->crgb_thresh[4 ] = (big_endian) ?cpu_to_be16 (0x1c83 ) :0x1c83 ; + ram_table->crgb_thresh[5 ] = (big_endian) ?cpu_to_be16 (0x1e72 ) :0x1e72 ; + ram_table->crgb_thresh[6 ] = (big_endian) ?cpu_to_be16 (0x20f0 ) :0x20f0 ; + ram_table->crgb_thresh[7 ] = (big_endian) ?cpu_to_be16 (0x232b ) :0x232b ; + ram_table->crgb_offset[0 ] = (big_endian) ?cpu_to_be16 (0x2999 ) :0x2999 ; + ram_table->crgb_offset[1 ] = (big_endian) ?cpu_to_be16 (0x3999 ) :0x3999 ; + ram_table->crgb_offset[2 ] = (big_endian) ?cpu_to_be16 (0x4666 ) :0x4666 ; + ram_table->crgb_offset[3 ] = (big_endian) ?cpu_to_be16 (0x5999 ) :0x5999 ; + ram_table->crgb_offset[4 ] = (big_endian) ?cpu_to_be16 (0x6333 ) :0x6333 ; + ram_table->crgb_offset[5 ] = (big_endian) ?cpu_to_be16 (0x7800 ) :0x7800 ; + ram_table->crgb_offset[6 ] = (big_endian) ?cpu_to_be16 (0x8c00 ) :0x8c00 ; + ram_table->crgb_offset[7 ] = (big_endian) ?cpu_to_be16 (0xa000 ) :0xa000 ; + ram_table->crgb_slope[0 ] = (big_endian) ?cpu_to_be16 (0x3609 ) :0x3609 ; + ram_table->crgb_slope[1 ] = (big_endian) ?cpu_to_be16 (0x2dfa ) :0x2dfa ; + ram_table->crgb_slope[2 ] = (big_endian) ?cpu_to_be16 (0x27ea ) :0x27ea ; + ram_table->crgb_slope[3 ] = (big_endian) ?cpu_to_be16 (0x235d ) :0x235d ; + ram_table->crgb_slope[4 ] = (big_endian) ?cpu_to_be16 (0x2042 ) :0x2042 ; + ram_table->crgb_slope[5 ] = (big_endian) ?cpu_to_be16 (0x1dc3 ) :0x1dc3 ; + ram_table->crgb_slope[6 ] = (big_endian) ?cpu_to_be16 (0x1b1a ) :0x1b1a ; + ram_table->crgb_slope[7 ] = (big_endian) ?cpu_to_be16 (0x1910 ) :0x1910 ;fill_backlight_transform_table_v_2_2 ( - params, ram_table); + params, ram_table, big_endian); } bool dmub_init_abm_config(struct abm *abm,
@@ -662,7 +660,7 @@ bool dmub_init_abm_config(struct abm *abm,memset (&ram_table,0 ,sizeof (ram_table)); -fill_iram_v_2_3 ((struct iram_table_v_2_2 *)ram_table, params); +fill_iram_v_2_3 ((struct iram_table_v_2_2 *)ram_table, params, false); result = abm->funcs->init_abm_config ( abm, (char *)(&ram_table),IRAM_RESERVE_AREA_START_V2_2 );
@@ -684,11 +682,11 @@ bool dmcu_load_iram(struct dmcu *dmcu,memset (&ram_table,0 ,sizeof (ram_table));if (dmcu->dmcu_version.abm_version ==0x24 ) { -fill_iram_v_2_3 ((struct iram_table_v_2_2 *)ram_table, params); +fill_iram_v_2_3 ((struct iram_table_v_2_2 *)ram_table, params, true); 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); +fill_iram_v_2_3 ((struct iram_table_v_2_2 *)ram_table, params, true); result = dmcu->funcs->load_iram ( dmcu,0 , (char *)(&ram_table),IRAM_RESERVE_AREA_START_V2_2 );
Signature · 6 lines
2.26.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Re: [PATCH 05/35] drm/amd/display: Remove byte swapping for dmcub abm config table
[AMD Public Use]
I would drop this patch unless it only applies to APUs. On Linux, people may run the driver on big endian systems.
Alex
________________________________
From: amd-gfx <[email protected]> on behalf of Rodrigo Siqueira <[email protected]>
Sent: Thursday, April 16, 2020 7:40 PM
To: [email protected] <[email protected]>
Cc: Li, Sun peng (Leo) <[email protected]>; Wentland, Harry <[email protected]>; Siqueira, Rodrigo <[email protected]>; Wood, Wyatt <[email protected]>; Lakha, Bhawanpreet <[email protected]>; Koo, Anthony <[email protected]>
Subject: [PATCH 05/35] drm/amd/display: Remove byte swapping for dmcub abm config table
From: Wyatt Wood <[email protected]>
[Why]
Since x86 and dmcub are both little endian, byte swapping isn't necessary. Dmcu requires byte swapping as it is big endian.
[How]
Add flag to function definitions to determine if byte swapping is necessary.
--- .../amd/display/modules/power/power_helpers.c | 74 +++++++++---------- 1 file changed, 36 insertions(+), 38 deletions(-)
drivers/gpu/drm/amd/display/modules/power/power_helpers.c +36 -38
@@ -240,7 +240,7 @@ static void fill_backlight_transform_table(struct dmcu_iram_parameters params, }static void fill_backlight_transform_table_v_2_2 (struct dmcu_iram_parameters params, -struct iram_table_v_2_2 *table) +struct iram_table_v_2_2 *table,bool big_endian) {unsigned int i;unsigned int num_entries =NUM_BL_CURVE_SEGS ;
@@ -264,10 +264,10 @@ static void fill_backlight_transform_table_v_2_2(struct dmcu_iram_parameters par lut_index = (params.backlight_lut_array_size -1 ) * i / (num_entries -1 );ASSERT (lut_index < params.backlight_lut_array_size); - table->backlight_thresholds[i] = -cpu_to_be16 (DIV_ROUNDUP ((i *65536 ), num_entries)); - table->backlight_offsets[i] = -cpu_to_be16 (params.backlight_lut_array[lut_index]); + table->backlight_thresholds[i] = (big_endian) ? +cpu_to_be16 (DIV_ROUNDUP ((i *65536 ), num_entries)) :DIV_ROUNDUP ((i *65536 ), num_entries); + table->backlight_offsets[i] = (big_endian) ? +cpu_to_be16 (params.backlight_lut_array[lut_index]) : params.backlight_lut_array[lut_index]; } }
@@ -587,18 +587,16 @@ void fill_iram_v_2_2(struct iram_table_v_2_2 *ram_table, struct dmcu_iram_parame ram_table->crgb_slope[7 ] =cpu_to_be16 (0x1910 );fill_backlight_transform_table_v_2_2 ( - params, ram_table); + params, ram_table, true); } -void fill_iram_v_2_3 (struct iram_table_v_2_2 *ram_table,struct dmcu_iram_parameters params) +void fill_iram_v_2_3 (struct iram_table_v_2_2 *ram_table,struct dmcu_iram_parameters params,bool big_endian) {unsigned int i, j;unsigned int set = params.set; ram_table->flags =0x0 ; - - ram_table->min_abm_backlight = -cpu_to_be16 (params.min_abm_backlight); + ram_table->min_abm_backlight = (big_endian) ?cpu_to_be16 (params.min_abm_backlight) : params.min_abm_backlight;for (i =0 ; i <NUM_AGGR_LEVEL ; i++) { ram_table->hybrid_factor[i] = abm_settings[set][i].brightness_gain;
@@ -622,33 +620,33 @@ void fill_iram_v_2_3(struct iram_table_v_2_2 *ram_table, struct dmcu_iram_parame ram_table->iir_curve[4 ] =0x65 ;//Gamma 2.2 - ram_table->crgb_thresh[0 ] =cpu_to_be16 (0x127c ); - ram_table->crgb_thresh[1 ] =cpu_to_be16 (0x151b ); - ram_table->crgb_thresh[2 ] =cpu_to_be16 (0x17d5 ); - ram_table->crgb_thresh[3 ] =cpu_to_be16 (0x1a56 ); - ram_table->crgb_thresh[4 ] =cpu_to_be16 (0x1c83 ); - ram_table->crgb_thresh[5 ] =cpu_to_be16 (0x1e72 ); - ram_table->crgb_thresh[6 ] =cpu_to_be16 (0x20f0 ); - ram_table->crgb_thresh[7 ] =cpu_to_be16 (0x232b ); - ram_table->crgb_offset[0 ] =cpu_to_be16 (0x2999 ); - ram_table->crgb_offset[1 ] =cpu_to_be16 (0x3999 ); - ram_table->crgb_offset[2 ] =cpu_to_be16 (0x4666 ); - ram_table->crgb_offset[3 ] =cpu_to_be16 (0x5999 ); - ram_table->crgb_offset[4 ] =cpu_to_be16 (0x6333 ); - ram_table->crgb_offset[5 ] =cpu_to_be16 (0x7800 ); - ram_table->crgb_offset[6 ] =cpu_to_be16 (0x8c00 ); - ram_table->crgb_offset[7 ] =cpu_to_be16 (0xa000 ); - ram_table->crgb_slope[0 ] =cpu_to_be16 (0x3609 ); - ram_table->crgb_slope[1 ] =cpu_to_be16 (0x2dfa ); - ram_table->crgb_slope[2 ] =cpu_to_be16 (0x27ea ); - ram_table->crgb_slope[3 ] =cpu_to_be16 (0x235d ); - ram_table->crgb_slope[4 ] =cpu_to_be16 (0x2042 ); - ram_table->crgb_slope[5 ] =cpu_to_be16 (0x1dc3 ); - ram_table->crgb_slope[6 ] =cpu_to_be16 (0x1b1a ); - ram_table->crgb_slope[7 ] =cpu_to_be16 (0x1910 ); + ram_table->crgb_thresh[0 ] = (big_endian) ?cpu_to_be16 (0x127c ) :0x127c ; + ram_table->crgb_thresh[1 ] = (big_endian) ?cpu_to_be16 (0x151b ) :0x151b ; + ram_table->crgb_thresh[2 ] = (big_endian) ?cpu_to_be16 (0x17d5 ) :0x17d5 ; + ram_table->crgb_thresh[3 ] = (big_endian) ?cpu_to_be16 (0x1a56 ) :0x1a56 ; + ram_table->crgb_thresh[4 ] = (big_endian) ?cpu_to_be16 (0x1c83 ) :0x1c83 ; + ram_table->crgb_thresh[5 ] = (big_endian) ?cpu_to_be16 (0x1e72 ) :0x1e72 ; + ram_table->crgb_thresh[6 ] = (big_endian) ?cpu_to_be16 (0x20f0 ) :0x20f0 ; + ram_table->crgb_thresh[7 ] = (big_endian) ?cpu_to_be16 (0x232b ) :0x232b ; + ram_table->crgb_offset[0 ] = (big_endian) ?cpu_to_be16 (0x2999 ) :0x2999 ; + ram_table->crgb_offset[1 ] = (big_endian) ?cpu_to_be16 (0x3999 ) :0x3999 ; + ram_table->crgb_offset[2 ] = (big_endian) ?cpu_to_be16 (0x4666 ) :0x4666 ; + ram_table->crgb_offset[3 ] = (big_endian) ?cpu_to_be16 (0x5999 ) :0x5999 ; + ram_table->crgb_offset[4 ] = (big_endian) ?cpu_to_be16 (0x6333 ) :0x6333 ; + ram_table->crgb_offset[5 ] = (big_endian) ?cpu_to_be16 (0x7800 ) :0x7800 ; + ram_table->crgb_offset[6 ] = (big_endian) ?cpu_to_be16 (0x8c00 ) :0x8c00 ; + ram_table->crgb_offset[7 ] = (big_endian) ?cpu_to_be16 (0xa000 ) :0xa000 ; + ram_table->crgb_slope[0 ] = (big_endian) ?cpu_to_be16 (0x3609 ) :0x3609 ; + ram_table->crgb_slope[1 ] = (big_endian) ?cpu_to_be16 (0x2dfa ) :0x2dfa ; + ram_table->crgb_slope[2 ] = (big_endian) ?cpu_to_be16 (0x27ea ) :0x27ea ; + ram_table->crgb_slope[3 ] = (big_endian) ?cpu_to_be16 (0x235d ) :0x235d ; + ram_table->crgb_slope[4 ] = (big_endian) ?cpu_to_be16 (0x2042 ) :0x2042 ; + ram_table->crgb_slope[5 ] = (big_endian) ?cpu_to_be16 (0x1dc3 ) :0x1dc3 ; + ram_table->crgb_slope[6 ] = (big_endian) ?cpu_to_be16 (0x1b1a ) :0x1b1a ; + ram_table->crgb_slope[7 ] = (big_endian) ?cpu_to_be16 (0x1910 ) :0x1910 ;fill_backlight_transform_table_v_2_2 ( - params, ram_table); + params, ram_table, big_endian); } bool dmub_init_abm_config(struct abm *abm,
@@ -662,7 +660,7 @@ bool dmub_init_abm_config(struct abm *abm,memset (&ram_table,0 ,sizeof (ram_table)); -fill_iram_v_2_3 ((struct iram_table_v_2_2 *)ram_table, params); +fill_iram_v_2_3 ((struct iram_table_v_2_2 *)ram_table, params, false); result = abm->funcs->init_abm_config ( abm, (char *)(&ram_table),IRAM_RESERVE_AREA_START_V2_2 );
@@ -684,11 +682,11 @@ bool dmcu_load_iram(struct dmcu *dmcu,memset (&ram_table,0 ,sizeof (ram_table));if (dmcu->dmcu_version.abm_version ==0x24 ) { -fill_iram_v_2_3 ((struct iram_table_v_2_2 *)ram_table, params); +fill_iram_v_2_3 ((struct iram_table_v_2_2 *)ram_table, params, true); 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); +fill_iram_v_2_3 ((struct iram_table_v_2_2 *)ram_table, params, true); result = dmcu->funcs->load_iram ( dmcu,0 , (char *)(&ram_table),IRAM_RESERVE_AREA_START_V2_2 );
--
2.26.0
_______________________________________________
amd-gfx mailing list
[email protected]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=02%7C01%7Calexander.deucher%40amd.com%7C71bc54a1a7b7444439c208d7e25fab51%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637226772877797082&sdata=sa4MJoUY%2FjVgW3f4Qx1N4KYpFY3QyqZPWVDbRoUmTxs%3D&reserved=0
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Re: [PATCH 05/35] drm/amd/display: Remove byte swapping for dmcub abm config table
Agreed, just wanted to reply as well since I think something is not correctly understood here.
The cpu_to_be16() and be16_to_cpu() functions work different depending on which architecture/endianess your are.
So they should be a NO-OP on x86 if everything is done right.
Christian.
Am 17.04.20 um 04:32 schrieb Deucher, Alexander:
Quoted 199 lines
[AMD Public Use]
I would drop this patch unless it only applies to APUs. On Linux, people may run the driver on big endian systems.
Alex
------------------------------------------------------------------------
*From:* amd-gfx <[email protected]> on behalf of Rodrigo Siqueira <[email protected]>
*Sent:* Thursday, April 16, 2020 7:40 PM
*To:* [email protected] <[email protected]>
*Cc:* Li, Sun peng (Leo) <[email protected]>; Wentland, Harry <[email protected]>; Siqueira, Rodrigo <[email protected]>; Wood, Wyatt <[email protected]>; Lakha, Bhawanpreet <[email protected]>; Koo, Anthony <[email protected]> *Subject:* [PATCH 05/35] drm/amd/display: Remove byte swapping for dmcub abm config table
From: Wyatt Wood <[email protected]>[Why]
Since x86 and dmcub are both little endian, byte swapping isn't necessary. Dmcu requires byte swapping as it is big endian.[How]
Add flag to function definitions to determine if byte swapping is necessary.Signed-off-by Wyatt Wood <[email protected]>Reviewed-by Anthony Koo <[email protected]>Acked-by Rodrigo Siqueira <[email protected]>---
.../amd/display/modules/power/power_helpers.c | 74 +++++++++----------1 file changed, 36 insertions(+), 38 deletions(-)drivers/gpu/drm/amd/display/modules/power/power_helpers.c +1
-1@@ -240,7 +240,7 @@ static void fill_backlight_transform_table(struct dmcu_iram_parameters params, } static void fill_backlight_transform_table_v_2_2(struct dmcu_iram_parameters params, - struct iram_table_v_2_2 *table) + struct iram_table_v_2_2 *table, bool big_endian) { unsigned int i;unsigned int
num_entries=NUM_BL_CURVE_SEGS;drivers/gpu/drm/amd/display/modules/power/power_helpers.c +0
-0@@ -264,10 +264,10 @@ static voidfill_backlight_transform_table_v_2_2(struct
dmcu_iram_parametersparlut_index= (params.backlight_lut_array_size - 1) * i / (num_entries- 1);ASSERT(lut_index < params.backlight_lut_array_size);- table->backlight_thresholds[i] =
-cpu_to_be16(DIV_ROUNDUP((i * 65536), num_entries));
- table->backlight_offsets[i] =
-cpu_to_be16(params.backlight_lut_array[lut_index]); + table->backlight_thresholds[i] = (big_endian) ? +cpu_to_be16(DIV_ROUNDUP((i * 65536), num_entries)):DIV_ROUNDUP((i * 65536), num_entries); + table->backlight_offsets[i] = (big_endian) ?
+cpu_to_be16(params.backlight_lut_array[lut_index]):
params.backlight_lut_array[lut_index];
}
}drivers/gpu/drm/amd/display/modules/power/power_helpers.c +0
-0@@ -587,18 +587,16 @@ void fill_iram_v_2_2(struct iram_table_v_2_2 *ram_table, struct dmcu_iram_parame ram_table->crgb_slope[7] = cpu_to_be16(0x1910);fill_backlight_transform_table_v_2_2(
- params,ram_table);
+ params,ram_table, true);
}-void
fill_iram_v_2_3(struct iram_table_v_2_2 *ram_table, struct dmcu_iram_parameters params)
+voidfill_iram_v_2_3(struct iram_table_v_2_2 *ram_table, struct dmcu_iram_parameters params, bool big_endian)
{
unsigned int i, j;
unsigned int set = params.set;
ram_table->flags=0x0;
-
-ram_table->min_abm_backlight=
-cpu_to_be16(params.min_abm_backlight);
+ram_table->min_abm_backlight= (big_endian) ?cpu_to_be16(params.min_abm_backlight): params.min_abm_backlight;for (i = 0; i <
NUM_AGGR_LEVEL; i++) { ram_table->hybrid_factor[i] = abm_settings[set][i].brightness_gain;drivers/gpu/drm/amd/display/modules/power/power_helpers.c +6
-24@@ -622,33 +620,33 @@ void fill_iram_v_2_3(struct iram_table_v_2_2 *ram_table, struct dmcu_iram_parame ram_table->iir_curve[4] = 0x65; //Gamma 2.2 - ram_table->crgb_thresh[0] = cpu_to_be16(0x127c); - ram_table->crgb_thresh[1] = cpu_to_be16(0x151b); - ram_table->crgb_thresh[2] = cpu_to_be16(0x17d5); - ram_table->crgb_thresh[3] = cpu_to_be16(0x1a56); - ram_table->crgb_thresh[4] = cpu_to_be16(0x1c83); - ram_table->crgb_thresh[5] = cpu_to_be16(0x1e72); - ram_table->crgb_thresh[6] = cpu_to_be16(0x20f0); - ram_table->crgb_thresh[7] = cpu_to_be16(0x232b); - ram_table->crgb_offset[0] = cpu_to_be16(0x2999); - ram_table->crgb_offset[1] = cpu_to_be16(0x3999); - ram_table->crgb_offset[2] = cpu_to_be16(0x4666); - ram_table->crgb_offset[3] = cpu_to_be16(0x5999); - ram_table->crgb_offset[4] = cpu_to_be16(0x6333); - ram_table->crgb_offset[5] = cpu_to_be16(0x7800); - ram_table->crgb_offset[6] = cpu_to_be16(0x8c00); - ram_table->crgb_offset[7] = cpu_to_be16(0xa000); - ram_table->crgb_slope[0] = cpu_to_be16(0x3609); - ram_table->crgb_slope[1] = cpu_to_be16(0x2dfa); - ram_table->crgb_slope[2] = cpu_to_be16(0x27ea); - ram_table->crgb_slope[3] = cpu_to_be16(0x235d); - ram_table->crgb_slope[4] = cpu_to_be16(0x2042); - ram_table->crgb_slope[5] = cpu_to_be16(0x1dc3); - ram_table->crgb_slope[6] = cpu_to_be16(0x1b1a); - ram_table->crgb_slope[7] = cpu_to_be16(0x1910); + ram_table->crgb_thresh[0] = (big_endian) ? cpu_to_be16(0x127c) :0x127c ; + ram_table->crgb_thresh[1] = (big_endian) ? cpu_to_be16(0x151b) :0x151b ; + ram_table->crgb_thresh[2] = (big_endian) ? cpu_to_be16(0x17d5) :0x17d5 ; + ram_table->crgb_thresh[3] = (big_endian) ? cpu_to_be16(0x1a56) :0x1a56 ; + ram_table->crgb_thresh[4] = (big_endian) ? cpu_to_be16(0x1c83) :0x1c83 ; + ram_table->crgb_thresh[5] = (big_endian) ? cpu_to_be16(0x1e72):
0x1e72;
+ ram_table->crgb_thresh[6] = (big_endian) ?cpu_to_be16(0x20f0):0x20f0;
+ ram_table->crgb_thresh[7] = (big_endian) ?cpu_to_be16(0x232b):0x232b;
+ ram_table->crgb_offset[0] = (big_endian) ?cpu_to_be16(0x2999):0x2999;
+ ram_table->crgb_offset[1] = (big_endian) ?cpu_to_be16(0x3999):0x3999;
+ ram_table->crgb_offset[2] = (big_endian) ?cpu_to_be16(0x4666):0x4666;
+ ram_table->crgb_offset[3] = (big_endian) ?cpu_to_be16(0x5999):0x5999;
+ ram_table->crgb_offset[4] = (big_endian) ?cpu_to_be16(0x6333):0x6333;
+ ram_table->crgb_offset[5] = (big_endian) ?cpu_to_be16(0x7800):0x7800;
+ ram_table->crgb_offset[6] = (big_endian) ?cpu_to_be16(0x8c00):0x8c00;
+ ram_table->crgb_offset[7] = (big_endian) ?cpu_to_be16(0xa000):0xa000;
+ ram_table->crgb_slope[0] = (big_endian) ?cpu_to_be16(0x3609):0x3609;
+ ram_table->crgb_slope[1] = (big_endian) ?cpu_to_be16(0x2dfa):0x2dfa;
+ ram_table->crgb_slope[2] = (big_endian) ?cpu_to_be16(0x27ea):0x27ea;
+ ram_table->crgb_slope[3] = (big_endian) ?cpu_to_be16(0x235d):0x235d;
+ ram_table->crgb_slope[4] = (big_endian) ?cpu_to_be16(0x2042):0x2042;
+ ram_table->crgb_slope[5] = (big_endian) ?cpu_to_be16(0x1dc3):0x1dc3;
+ ram_table->crgb_slope[6] = (big_endian) ?cpu_to_be16(0x1b1a):0x1b1a;
+ ram_table->crgb_slope[7] = (big_endian) ?cpu_to_be16(0x1910):0x1910;
fill_backlight_transform_table_v_2_2( - params, ram_table);
+ params,ram_table,big_endian); }bool dmub_init_abm_config(struct abm *abm,
drivers/gpu/drm/amd/display/modules/power/power_helpers.c +1
-1@@ -662,7 +660,7 @@ bool dmub_init_abm_config(struct abm *abm, memset(&ram_table, 0, sizeof(ram_table)); - fill_iram_v_2_3((struct iram_table_v_2_2 *)ram_table, params); + fill_iram_v_2_3((struct iram_table_v_2_2 *)ram_table, params, false);result = abm->funcs->init_abm_config(
abm, (char *)(&ram_table),IRAM_RESERVE_AREA_START_V2_2);drivers/gpu/drm/amd/display/modules/power/power_helpers.c +1
-1@@ -684,11 +682,11 @@ bool dmcu_load_iram(struct dmcu *dmcu, memset(&ram_table, 0, sizeof(ram_table)); if (dmcu->dmcu_version.abm_version == 0x24) { - fill_iram_v_2_3((struct iram_table_v_2_2 *)ram_table, params); + fill_iram_v_2_3((struct iram_table_v_2_2 *)ram_table, params, true);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((structiram_table_v_2_2*)ram_table,
params);
+ fill_iram_v_2_3((structiram_table_v_2_2*)ram_table,
params, true);
Quoted 14 lines
result = dmcu->funcs->load_iram(
dmcu, 0, (char *)(&ram_table),IRAM_RESERVE_AREA_START_V2_2);Signature · 11 lines
2.26.0 _______________________________________________ amd-gfx mailing list [email protected] https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=02%7C01%7Calexander.deucher%40amd.com%7C71bc54a1a7b7444439c208d7e25fab51%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637226772877797082&sdata=sa4MJoUY%2FjVgW3f4Qx1N4KYpFY3QyqZPWVDbRoUmTxs%3D&reserved=0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Re: [PATCH 05/35] drm/amd/display: Remove byte swapping for dmcub abm config table
Quoted 7 lines · Christian König
Agreed, just wanted to reply as well since I think something is not correctly understood here.
The
cpu_to_be16()andbe16_to_cpu()functions work different depending on which architecture/endianess your are.So they should be a NO-OP on x86 if everything is done right.
The *b*e macros aren't NOPs on little endian architectures like x86, they are on big endian architectures. Vice versa for the *l*e macros.
Signature · 6 lines
Earthling Michel Dänzer | https://redhat.com Libre software enthusiast | Mesa and X developer _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Christian König
maintainerRe: [PATCH 05/35] drm/amd/display: Remove byte swapping for dmcub abm config table
Am 17.04.20 um 12:43 schrieb Michel Dänzer:
Quoted 10 lines · Christian König
Quoted 7 lines
Agreed, just wanted to reply as well since I think something is not correctly understood here.
The
cpu_to_be16()andbe16_to_cpu()functions work different depending on which architecture/endianess your are.So they should be a NO-OP on x86 if everything is done right.
The *b*e macros aren't NOPs on little endian architectures like x86, they are on big endian architectures. Vice versa for the *l*e macros.
Yeah, that's what I meant with "if everything is done right" :)
I usually can't remember what does what with those functions.
Christian.
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Re: [PATCH 05/35] drm/amd/display: Remove byte swapping for dmcub abm config table
Quoted 9 lines · Christian König
Am 17.04.20 um 12:43 schrieb Michel Dänzer:
Quoted 8 lines · Christian König
Quoted 7 lines
Agreed, just wanted to reply as well since I think something is not correctly understood here.
The
cpu_to_be16()andbe16_to_cpu()functions work different depending on which architecture/endianess your are.So they should be a NO-OP on x86 if everything is done right.
Quoted 8 lines
Quoted 2 lines
The *b*e macros aren't NOPs on little endian architectures like x86, they are on big endian architectures. Vice versa for the *l*e macros.
Yeah, that's what I meant with "if everything is done right" :)
I usually can't remember what does what with those functions.
Christian.
I think key here is that dmcub FW is little endian, whereas the old dmcu FW was big endian. Hence we had the cpu_to_be conversion here for the old dmcu.
Now it looks like we want to reuse the same function for dmcub calls and hence need to ensure we're not converting values to big-endian.
The big_endian parameter is specifying the endianness of the FW.
The right approach would be to do cpu_to_be for dmcu and cpu_to_le for dmcub.
Harry
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Re: [PATCH 05/35] drm/amd/display: Remove byte swapping for dmcub abm config table
Am 17.04.20 um 17:40 schrieb Harry Wentland:
Quoted 21 lines · Christian König
Quoted 8 lines
Am 17.04.20 um 12:43 schrieb Michel Dänzer:
Quoted 7 lines · Christian König
Quoted 6 lines
Agreed, just wanted to reply as well since I think something is not correctly understood here.
The
cpu_to_be16()andbe16_to_cpu()functions work different depending on which architecture/endianess your are.Quoted 8 lines
Quoted 3 lines
Quoted 1 line
So they should be a NO-OP on x86 if everything is done right.
The *b*e macros aren't NOPs on little endian architectures like x86, they are on big endian architectures. Vice versa for the *l*e macros.
Yeah, that's what I meant with "if everything is done right" :)
I usually can't remember what does what with those functions.
Christian.
I think key here is that dmcub FW is little endian, whereas the old dmcu FW was big endian. Hence we had the
cpu_to_beconversion here for the old dmcu.
Quoted 7 lines
Now it looks like we want to reuse the same function for dmcub calls and hence need to ensure we're not converting values to big-endian.
The
big_endianparameter is specifying the endianness of the FW.The right approach would be to do
cpu_to_befor dmcu andcpu_to_lefor dmcub.
Thanks for the explanation, that makes it much more clear what should happen here.
Christian.
Quoted 6 lines
Harry
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Re: [PATCH 05/35] drm/amd/display: Remove byte swapping for dmcub abm config table
In reply to Christian KönigHi,
Wyatt made the below patch for fixing this issue. I can apply it on top of this patchset if you all agree.
[Why]
Current code does not guarantee the correct endianness of memory being copied to fw, specifically in the case where cpu isn't little endian.
[How]
Windows and Diags are always little endian, so we define a macro that does nothing. Linux already defines this macro and will do the correct endianness conversion.
--- .../amd/display/modules/power/power_helpers.c | 58 ++++++++++--------- 1 file changed, 31 insertions(+), 27 deletions(-)
drivers/gpu/drm/amd/display/modules/power/power_helpers.c +31 -27
@@ -265,9 +265,11 @@ static void fill_backlight_transform_table_v_2_2(struct dmcu_iram_parameters parASSERT (lut_index < params.backlight_lut_array_size); table->backlight_thresholds[i] = (big_endian) ? -cpu_to_be16 (DIV_ROUNDUP ((i *65536 ), num_entries)) :DIV_ROUNDUP ((i *65536 ), num_entries); +cpu_to_be16 (DIV_ROUNDUP ((i *65536 ), num_entries)) : +cpu_to_le16 (DIV_ROUNDUP ((i *65536 ), num_entries)); table->backlight_offsets[i] = (big_endian) ? -cpu_to_be16 (params.backlight_lut_array[lut_index]) : params.backlight_lut_array[lut_index]; +cpu_to_be16 (params.backlight_lut_array[lut_index]) : +cpu_to_le16 (params.backlight_lut_array[lut_index]); } }
@@ -596,7 +598,9 @@ void fill_iram_v_2_3(struct iram_table_v_2_2 *ram_table, struct dmcu_iram_parameunsigned int set = params.set; ram_table->flags =0x0 ; - ram_table->min_abm_backlight = (big_endian) ?cpu_to_be16 (params.min_abm_backlight) : params.min_abm_backlight; + ram_table->min_abm_backlight = (big_endian) ? +cpu_to_be16 (params.min_abm_backlight) : +cpu_to_le16 (params.min_abm_backlight);for (i =0 ; i <NUM_AGGR_LEVEL ; i++) { ram_table->hybrid_factor[i] = abm_settings[set][i].brightness_gain;
@@ -620,30 +624,30 @@ void fill_iram_v_2_3(struct iram_table_v_2_2 *ram_table, struct dmcu_iram_parame ram_table->iir_curve[4 ] =0x65 ;//Gamma 2.2 - ram_table->crgb_thresh[0 ] = (big_endian) ?cpu_to_be16 (0x127c ) :0x127c ; - ram_table->crgb_thresh[1 ] = (big_endian) ?cpu_to_be16 (0x151b ) :0x151b ; - ram_table->crgb_thresh[2 ] = (big_endian) ?cpu_to_be16 (0x17d5 ) :0x17d5 ; - ram_table->crgb_thresh[3 ] = (big_endian) ?cpu_to_be16 (0x1a56 ) :0x1a56 ; - ram_table->crgb_thresh[4 ] = (big_endian) ?cpu_to_be16 (0x1c83 ) :0x1c83 ; - ram_table->crgb_thresh[5 ] = (big_endian) ?cpu_to_be16 (0x1e72 ) :0x1e72 ; - ram_table->crgb_thresh[6 ] = (big_endian) ?cpu_to_be16 (0x20f0 ) :0x20f0 ; - ram_table->crgb_thresh[7 ] = (big_endian) ?cpu_to_be16 (0x232b ) :0x232b ; - ram_table->crgb_offset[0 ] = (big_endian) ?cpu_to_be16 (0x2999 ) :0x2999 ; - ram_table->crgb_offset[1 ] = (big_endian) ?cpu_to_be16 (0x3999 ) :0x3999 ; - ram_table->crgb_offset[2 ] = (big_endian) ?cpu_to_be16 (0x4666 ) :0x4666 ; - ram_table->crgb_offset[3 ] = (big_endian) ?cpu_to_be16 (0x5999 ) :0x5999 ; - ram_table->crgb_offset[4 ] = (big_endian) ?cpu_to_be16 (0x6333 ) :0x6333 ; - ram_table->crgb_offset[5 ] = (big_endian) ?cpu_to_be16 (0x7800 ) :0x7800 ; - ram_table->crgb_offset[6 ] = (big_endian) ?cpu_to_be16 (0x8c00 ) :0x8c00 ; - ram_table->crgb_offset[7 ] = (big_endian) ?cpu_to_be16 (0xa000 ) :0xa000 ; - ram_table->crgb_slope[0 ] = (big_endian) ?cpu_to_be16 (0x3609 ) :0x3609 ; - ram_table->crgb_slope[1 ] = (big_endian) ?cpu_to_be16 (0x2dfa ) :0x2dfa ; - ram_table->crgb_slope[2 ] = (big_endian) ?cpu_to_be16 (0x27ea ) :0x27ea ; - ram_table->crgb_slope[3 ] = (big_endian) ?cpu_to_be16 (0x235d ) :0x235d ; - ram_table->crgb_slope[4 ] = (big_endian) ?cpu_to_be16 (0x2042 ) :0x2042 ; - ram_table->crgb_slope[5 ] = (big_endian) ?cpu_to_be16 (0x1dc3 ) :0x1dc3 ; - ram_table->crgb_slope[6 ] = (big_endian) ?cpu_to_be16 (0x1b1a ) :0x1b1a ; - ram_table->crgb_slope[7 ] = (big_endian) ?cpu_to_be16 (0x1910 ) :0x1910 ; + ram_table->crgb_thresh[0 ] = (big_endian) ?cpu_to_be16 (0x127c ) :cpu_to_le16 (0x127c ); + ram_table->crgb_thresh[1 ] = (big_endian) ?cpu_to_be16 (0x151b ) :cpu_to_le16 (0x151b ); + ram_table->crgb_thresh[2 ] = (big_endian) ?cpu_to_be16 (0x17d5 ) :cpu_to_le16 (0x17d5 ); + ram_table->crgb_thresh[3 ] = (big_endian) ?cpu_to_be16 (0x1a56 ) :cpu_to_le16 (0x1a56 ); + ram_table->crgb_thresh[4 ] = (big_endian) ?cpu_to_be16 (0x1c83 ) :cpu_to_le16 (0x1c83 ); + ram_table->crgb_thresh[5 ] = (big_endian) ?cpu_to_be16 (0x1e72 ) :cpu_to_le16 (0x1e72 ); + ram_table->crgb_thresh[6 ] = (big_endian) ?cpu_to_be16 (0x20f0 ) :cpu_to_le16 (0x20f0 ); + ram_table->crgb_thresh[7 ] = (big_endian) ?cpu_to_be16 (0x232b ) :cpu_to_le16 (0x232b ); + ram_table->crgb_offset[0 ] = (big_endian) ?cpu_to_be16 (0x2999 ) :cpu_to_le16 (0x2999 ); + ram_table->crgb_offset[1 ] = (big_endian) ?cpu_to_be16 (0x3999 ) :cpu_to_le16 (0x3999 ); + ram_table->crgb_offset[2 ] = (big_endian) ?cpu_to_be16 (0x4666 ) :cpu_to_le16 (0x4666 ); + ram_table->crgb_offset[3 ] = (big_endian) ?cpu_to_be16 (0x5999 ) :cpu_to_le16 (0x5999 ); + ram_table->crgb_offset[4 ] = (big_endian) ?cpu_to_be16 (0x6333 ) :cpu_to_le16 (0x6333 ); + ram_table->crgb_offset[5 ] = (big_endian) ?cpu_to_be16 (0x7800 ) :cpu_to_le16 (0x7800 ); + ram_table->crgb_offset[6 ] = (big_endian) ?cpu_to_be16 (0x8c00 ) :cpu_to_le16 (0x8c00 ); + ram_table->crgb_offset[7 ] = (big_endian) ?cpu_to_be16 (0xa000 ) :cpu_to_le16 (0xa000 ); + ram_table->crgb_slope[0 ] = (big_endian) ?cpu_to_be16 (0x3609 ) :cpu_to_le16 (0x3609 ); + ram_table->crgb_slope[1 ] = (big_endian) ?cpu_to_be16 (0x2dfa ) :cpu_to_le16 (0x2dfa ); + ram_table->crgb_slope[2 ] = (big_endian) ?cpu_to_be16 (0x27ea ) :cpu_to_le16 (0x27ea ); + ram_table->crgb_slope[3 ] = (big_endian) ?cpu_to_be16 (0x235d ) :cpu_to_le16 (0x235d ); + ram_table->crgb_slope[4 ] = (big_endian) ?cpu_to_be16 (0x2042 ) :cpu_to_le16 (0x2042 ); + ram_table->crgb_slope[5 ] = (big_endian) ?cpu_to_be16 (0x1dc3 ) :cpu_to_le16 (0x1dc3 ); + ram_table->crgb_slope[6 ] = (big_endian) ?cpu_to_be16 (0x1b1a ) :cpu_to_le16 (0x1b1a ); + ram_table->crgb_slope[7 ] = (big_endian) ?cpu_to_be16 (0x1910 ) :cpu_to_le16 (0x1910 );fill_backlight_transform_table_v_2_2 ( params, ram_table, big_endian);
Signature · 1 line
2.26.0
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Christian König
maintainerRe: [PATCH 05/35] drm/amd/display: Remove byte swapping for dmcub abm config table
Am 17.04.20 um 23:43 schrieb Rodrigo Siqueira:
Quoted 93 lines
Hi,
Wyatt made the below patch for fixing this issue. I can apply it on top of this patchset if you all agree.
[Why]
Current code does not guarantee the correct endianness of memory being copied to fw, specifically in the case where cpu isn't little endian.[How]
Windows and Diags are always little endian, so we define a macro that does nothing. Linux already defines this macro and will do the correct endianness conversion.Signed-off-by Wyatt Wood <[email protected]>Reviewed-by Harry Wentland <[email protected]>Acked-by Anthony Koo <[email protected]>Acked-by Rodrigo Siqueira <[email protected]>--- .../amd/display/modules/power/power_helpers.c | 58 ++++++++++--------- 1 file changed, 31 insertions(+), 27 deletions(-)drivers/gpu/drm/amd/display/modules/power/power_helpers.c +21
-27@@ -265,9 +265,11 @@ static void fill_backlight_transform_table_v_2_2(struct dmcu_iram_parameters parASSERT (lut_index < params.backlight_lut_array_size); table->backlight_thresholds[i] = (big_endian) ? -cpu_to_be16 (DIV_ROUNDUP ((i *65536 ), num_entries)) :DIV_ROUNDUP ((i *65536 ), num_entries); +cpu_to_be16 (DIV_ROUNDUP ((i *65536 ), num_entries)) : +cpu_to_le16 (DIV_ROUNDUP ((i *65536 ), num_entries)); table->backlight_offsets[i] = (big_endian) ? -cpu_to_be16 (params.backlight_lut_array[lut_index]) : params.backlight_lut_array[lut_index]; +cpu_to_be16 (params.backlight_lut_array[lut_index]) : +cpu_to_le16 (params.backlight_lut_array[lut_index]); } }@@ -596,7 +598,9 @@ void fill_iram_v_2_3(struct iram_table_v_2_2 *ram_table, struct dmcu_iram_parameunsigned int set = params.set; ram_table->flags =0x0 ; - ram_table->min_abm_backlight = (big_endian) ?cpu_to_be16 (params.min_abm_backlight) : params.min_abm_backlight; + ram_table->min_abm_backlight = (big_endian) ? +cpu_to_be16 (params.min_abm_backlight) : +cpu_to_le16 (params.min_abm_backlight);for (i =0 ; i <NUM_AGGR_LEVEL ; i++) { ram_table->hybrid_factor[i] = abm_settings[set][i].brightness_gain;@@ -620,30 +624,30 @@ void fill_iram_v_2_3(struct iram_table_v_2_2 *ram_table, struct dmcu_iram_parame ram_table->iir_curve[4 ] =0x65 ;//Gamma 2.2 - ram_table->crgb_thresh[0 ] = (big_endian) ?cpu_to_be16 (0x127c ) :0x127c ; - ram_table->crgb_thresh[1 ] = (big_endian) ?cpu_to_be16 (0x151b ) :0x151b ; - ram_table->crgb_thresh[2 ] = (big_endian) ?cpu_to_be16 (0x17d5 ) :0x17d5 ; - ram_table->crgb_thresh[3 ] = (big_endian) ?cpu_to_be16 (0x1a56 ) :0x1a56 ; - ram_table->crgb_thresh[4 ] = (big_endian) ?cpu_to_be16 (0x1c83 ) :0x1c83 ; - ram_table->crgb_thresh[5 ] = (big_endian) ?cpu_to_be16 (0x1e72 ) :0x1e72 ; - ram_table->crgb_thresh[6 ] = (big_endian) ?cpu_to_be16 (0x20f0 ) :0x20f0 ; - ram_table->crgb_thresh[7 ] = (big_endian) ?cpu_to_be16 (0x232b ) :0x232b ; - ram_table->crgb_offset[0 ] = (big_endian) ?cpu_to_be16 (0x2999 ) :0x2999 ; - ram_table->crgb_offset[1 ] = (big_endian) ?cpu_to_be16 (0x3999 ) :0x3999 ; - ram_table->crgb_offset[2 ] = (big_endian) ?cpu_to_be16 (0x4666 ) :0x4666 ; - ram_table->crgb_offset[3 ] = (big_endian) ?cpu_to_be16 (0x5999 ) :0x5999 ; - ram_table->crgb_offset[4 ] = (big_endian) ?cpu_to_be16 (0x6333 ) :0x6333 ; - ram_table->crgb_offset[5 ] = (big_endian) ?cpu_to_be16 (0x7800 ) :0x7800 ; - ram_table->crgb_offset[6 ] = (big_endian) ?cpu_to_be16 (0x8c00 ) :0x8c00 ; - ram_table->crgb_offset[7 ] = (big_endian) ?cpu_to_be16 (0xa000 ) :0xa000 ; - ram_table->crgb_slope[0 ] = (big_endian) ?cpu_to_be16 (0x3609 ) :0x3609 ; - ram_table->crgb_slope[1 ] = (big_endian) ?cpu_to_be16 (0x2dfa ) :0x2dfa ; - ram_table->crgb_slope[2 ] = (big_endian) ?cpu_to_be16 (0x27ea ) :0x27ea ; - ram_table->crgb_slope[3 ] = (big_endian) ?cpu_to_be16 (0x235d ) :0x235d ; - ram_table->crgb_slope[4 ] = (big_endian) ?cpu_to_be16 (0x2042 ) :0x2042 ; - ram_table->crgb_slope[5 ] = (big_endian) ?cpu_to_be16 (0x1dc3 ) :0x1dc3 ; - ram_table->crgb_slope[6 ] = (big_endian) ?cpu_to_be16 (0x1b1a ) :0x1b1a ; - ram_table->crgb_slope[7 ] = (big_endian) ?cpu_to_be16 (0x1910 ) :0x1910 ; + ram_table->crgb_thresh[0 ] = (big_endian) ?cpu_to_be16 (0x127c ) :cpu_to_le16 (0x127c ); + ram_table->crgb_thresh[1 ] = (big_endian) ?cpu_to_be16 (0x151b ) :cpu_to_le16 (0x151b ); + ram_table->crgb_thresh[2 ] = (big_endian) ?cpu_to_be16 (0x17d5 ) :cpu_to_le16 (0x17d5 ); + ram_table->crgb_thresh[3 ] = (big_endian) ?cpu_to_be16 (0x1a56 ) :cpu_to_le16 (0x1a56 ); + ram_table->crgb_thresh[4 ] = (big_endian) ?cpu_to_be16 (0x1c83 ) :cpu_to_le16 (0x1c83 ); + ram_table->crgb_thresh[5 ] = (big_endian) ?cpu_to_be16 (0x1e72 ) :cpu_to_le16 (0x1e72 ); + ram_table->crgb_thresh[6 ] = (big_endian) ?cpu_to_be16 (0x20f0 ) :cpu_to_le16 (0x20f0 ); + ram_table->crgb_thresh[7 ] = (big_endian) ?cpu_to_be16 (0x232b ) :cpu_to_le16 (0x232b ); + ram_table->crgb_offset[0 ] = (big_endian) ?cpu_to_be16 (0x2999 ) :cpu_to_le16 (0x2999 ); + ram_table->crgb_offset[1 ] = (big_endian) ?cpu_to_be16 (0x3999 ) :cpu_to_le16 (0x3999 ); + ram_table->crgb_offset[2 ] = (big_endian) ?cpu_to_be16 (0x4666 ) :cpu_to_le16 (0x4666 ); + ram_table->crgb_offset[3 ] = (big_endian) ?cpu_to_be16 (0x5999 ) :cpu_to_le16 (0x5999 ); + ram_table->crgb_offset[4 ] = (big_endian) ?cpu_to_be16 (0x6333 ) :cpu_to_le16 (0x6333 ); + ram_table->crgb_offset[5 ] = (big_endian) ?cpu_to_be16 (0x7800 ) :cpu_to_le16 (0x7800 );
drivers/gpu/drm/amd/display/modules/power/power_helpers.c void fill_iram_v_2_3(struct iram_table_v_2_2 *ram_table, struct dmcu_iram_parame · line 650
Quoted 10 lines
drivers/gpu/drm/amd/display/modules/power/power_helpers.c +10
-0+ ram_table->crgb_offset[6 ] = (big_endian) ?cpu_to_be16 (0x8c00 ) :cpu_to_le16 (0x8c00 ); + ram_table->crgb_offset[7 ] = (big_endian) ?cpu_to_be16 (0xa000 ) :cpu_to_le16 (0xa000 ); + ram_table->crgb_slope[0 ] = (big_endian) ?cpu_to_be16 (0x3609 ) :cpu_to_le16 (0x3609 ); + ram_table->crgb_slope[1 ] = (big_endian) ?cpu_to_be16 (0x2dfa ) :cpu_to_le16 (0x2dfa ); + ram_table->crgb_slope[2 ] = (big_endian) ?cpu_to_be16 (0x27ea ) :cpu_to_le16 (0x27ea ); + ram_table->crgb_slope[3 ] = (big_endian) ?cpu_to_be16 (0x235d ) :cpu_to_le16 (0x235d ); + ram_table->crgb_slope[4 ] = (big_endian) ?cpu_to_be16 (0x2042 ) :cpu_to_le16 (0x2042 ); + ram_table->crgb_slope[5 ] = (big_endian) ?cpu_to_be16 (0x1dc3 ) :cpu_to_le16 (0x1dc3 ); + ram_table->crgb_slope[6 ] = (big_endian) ?cpu_to_be16 (0x1b1a ) :cpu_to_le16 (0x1b1a ); + ram_table->crgb_slope[7 ] = (big_endian) ?cpu_to_be16 (0x1910 ) :cpu_to_le16 (0x1910 );
That you have to duplicate the values is rather ugly here.
Since this is all in one file maybe come up with a helper for this? E.g. conditional_bswap16(big_endian, value)
Regards,
Christian.
drivers/gpu/drm/amd/display/modules/power/power_helpers.c void fill_iram_v_2_3(struct iram_table_v_2_2 *ram_table, struct dmcu_iram_parame · line 653
Quoted 3 lines
drivers/gpu/drm/amd/display/modules/power/power_helpers.c +0
-0fill_backlight_transform_table_v_2_2 ( params, ram_table, big_endian);
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Re: [PATCH 05/35] drm/amd/display: Remove byte swapping for dmcub abm config table
Quoted 102 lines · Christian König
Am 17.04.20 um 23:43 schrieb Rodrigo Siqueira:
Quoted 88 lines
Hi,
Wyatt made the below patch for fixing this issue. I can apply it on top of this patchset if you all agree.
[Why]
Current code does not guarantee the correct endianness of memory being copied to fw, specifically in the case where cpu isn't little endian.[How]
Windows and Diags are always little endian, so we define a macro that does nothing. Linux already defines this macro and will do the correct endianness conversion.Signed-off-by Wyatt Wood <[email protected]>Reviewed-by Harry Wentland <[email protected]>Acked-by Anthony Koo <[email protected]>Acked-by Rodrigo Siqueira <[email protected]>--- .../amd/display/modules/power/power_helpers.c | 58 ++++++++++--------- 1 file changed, 31 insertions(+), 27 deletions(-)drivers/gpu/drm/amd/display/modules/power/power_helpers.c +21
-27@@ -265,9 +265,11 @@ static void fill_backlight_transform_table_v_2_2(struct dmcu_iram_parameters parASSERT (lut_index < params.backlight_lut_array_size); table->backlight_thresholds[i] = (big_endian) ? -cpu_to_be16 (DIV_ROUNDUP ((i *65536 ), num_entries)) :DIV_ROUNDUP ((i *65536 ), num_entries); +cpu_to_be16 (DIV_ROUNDUP ((i *65536 ), num_entries)) : +cpu_to_le16 (DIV_ROUNDUP ((i *65536 ), num_entries)); table->backlight_offsets[i] = (big_endian) ? -cpu_to_be16 (params.backlight_lut_array[lut_index]) : params.backlight_lut_array[lut_index]; +cpu_to_be16 (params.backlight_lut_array[lut_index]) : +cpu_to_le16 (params.backlight_lut_array[lut_index]); } }@@ -596,7 +598,9 @@ void fill_iram_v_2_3(struct iram_table_v_2_2 *ram_table, struct dmcu_iram_parameunsigned int set = params.set; ram_table->flags =0x0 ; - ram_table->min_abm_backlight = (big_endian) ?cpu_to_be16 (params.min_abm_backlight) : params.min_abm_backlight; + ram_table->min_abm_backlight = (big_endian) ? +cpu_to_be16 (params.min_abm_backlight) : +cpu_to_le16 (params.min_abm_backlight);for (i =0 ; i <NUM_AGGR_LEVEL ; i++) { ram_table->hybrid_factor[i] = abm_settings[set][i].brightness_gain;@@ -620,30 +624,30 @@ void fill_iram_v_2_3(struct iram_table_v_2_2 *ram_table, struct dmcu_iram_parame ram_table->iir_curve[4 ] =0x65 ;//Gamma 2.2 - ram_table->crgb_thresh[0 ] = (big_endian) ?cpu_to_be16 (0x127c ) :0x127c ; - ram_table->crgb_thresh[1 ] = (big_endian) ?cpu_to_be16 (0x151b ) :0x151b ; - ram_table->crgb_thresh[2 ] = (big_endian) ?cpu_to_be16 (0x17d5 ) :0x17d5 ; - ram_table->crgb_thresh[3 ] = (big_endian) ?cpu_to_be16 (0x1a56 ) :0x1a56 ; - ram_table->crgb_thresh[4 ] = (big_endian) ?cpu_to_be16 (0x1c83 ) :0x1c83 ; - ram_table->crgb_thresh[5 ] = (big_endian) ?cpu_to_be16 (0x1e72 ) :0x1e72 ; - ram_table->crgb_thresh[6 ] = (big_endian) ?cpu_to_be16 (0x20f0 ) :0x20f0 ; - ram_table->crgb_thresh[7 ] = (big_endian) ?cpu_to_be16 (0x232b ) :0x232b ; - ram_table->crgb_offset[0 ] = (big_endian) ?cpu_to_be16 (0x2999 ) :0x2999 ; - ram_table->crgb_offset[1 ] = (big_endian) ?cpu_to_be16 (0x3999 ) :0x3999 ; - ram_table->crgb_offset[2 ] = (big_endian) ?cpu_to_be16 (0x4666 ) :0x4666 ; - ram_table->crgb_offset[3 ] = (big_endian) ?cpu_to_be16 (0x5999 ) :0x5999 ; - ram_table->crgb_offset[4 ] = (big_endian) ?cpu_to_be16 (0x6333 ) :0x6333 ; - ram_table->crgb_offset[5 ] = (big_endian) ?cpu_to_be16 (0x7800 ) :0x7800 ; - ram_table->crgb_offset[6 ] = (big_endian) ?cpu_to_be16 (0x8c00 ) :0x8c00 ; - ram_table->crgb_offset[7 ] = (big_endian) ?cpu_to_be16 (0xa000 ) :0xa000 ; - ram_table->crgb_slope[0 ] = (big_endian) ?cpu_to_be16 (0x3609 ) :0x3609 ; - ram_table->crgb_slope[1 ] = (big_endian) ?cpu_to_be16 (0x2dfa ) :0x2dfa ; - ram_table->crgb_slope[2 ] = (big_endian) ?cpu_to_be16 (0x27ea ) :0x27ea ; - ram_table->crgb_slope[3 ] = (big_endian) ?cpu_to_be16 (0x235d ) :0x235d ; - ram_table->crgb_slope[4 ] = (big_endian) ?cpu_to_be16 (0x2042 ) :0x2042 ; - ram_table->crgb_slope[5 ] = (big_endian) ?cpu_to_be16 (0x1dc3 ) :0x1dc3 ; - ram_table->crgb_slope[6 ] = (big_endian) ?cpu_to_be16 (0x1b1a ) :0x1b1a ; - ram_table->crgb_slope[7 ] = (big_endian) ?cpu_to_be16 (0x1910 ) :0x1910 ; + ram_table->crgb_thresh[0 ] = (big_endian) ?cpu_to_be16 (0x127c ) :cpu_to_le16 (0x127c ); + ram_table->crgb_thresh[1 ] = (big_endian) ?cpu_to_be16 (0x151b ) :cpu_to_le16 (0x151b ); + ram_table->crgb_thresh[2 ] = (big_endian) ?cpu_to_be16 (0x17d5 ) :cpu_to_le16 (0x17d5 ); + ram_table->crgb_thresh[3 ] = (big_endian) ?cpu_to_be16 (0x1a56 ) :cpu_to_le16 (0x1a56 ); + ram_table->crgb_thresh[4 ] = (big_endian) ?cpu_to_be16 (0x1c83 ) :cpu_to_le16 (0x1c83 ); + ram_table->crgb_thresh[5 ] = (big_endian) ?cpu_to_be16 (0x1e72 ) :cpu_to_le16 (0x1e72 ); + ram_table->crgb_thresh[6 ] = (big_endian) ?cpu_to_be16 (0x20f0 ) :cpu_to_le16 (0x20f0 ); + ram_table->crgb_thresh[7 ] = (big_endian) ?cpu_to_be16 (0x232b ) :cpu_to_le16 (0x232b ); + ram_table->crgb_offset[0 ] = (big_endian) ?cpu_to_be16 (0x2999 ) :cpu_to_le16 (0x2999 ); + ram_table->crgb_offset[1 ] = (big_endian) ?cpu_to_be16 (0x3999 ) :cpu_to_le16 (0x3999 ); + ram_table->crgb_offset[2 ] = (big_endian) ?cpu_to_be16 (0x4666 ) :cpu_to_le16 (0x4666 ); + ram_table->crgb_offset[3 ] = (big_endian) ?cpu_to_be16 (0x5999 ) :cpu_to_le16 (0x5999 ); + ram_table->crgb_offset[4 ] = (big_endian) ?cpu_to_be16 (0x6333 ) :cpu_to_le16 (0x6333 ); + ram_table->crgb_offset[5 ] = (big_endian) ?cpu_to_be16 (0x7800 ) :cpu_to_le16 (0x7800 );drivers/gpu/drm/amd/display/modules/power/power_helpers.c void fill_iram_v_2_3(struct iram_table_v_2_2 *ram_table, struct dmcu_iram_parame · line 649
Quoted 10 lines
drivers/gpu/drm/amd/display/modules/power/power_helpers.c +10
-0+ ram_table->crgb_offset[6 ] = (big_endian) ?cpu_to_be16 (0x8c00 ) :cpu_to_le16 (0x8c00 ); + ram_table->crgb_offset[7 ] = (big_endian) ?cpu_to_be16 (0xa000 ) :cpu_to_le16 (0xa000 ); + ram_table->crgb_slope[0 ] = (big_endian) ?cpu_to_be16 (0x3609 ) :cpu_to_le16 (0x3609 ); + ram_table->crgb_slope[1 ] = (big_endian) ?cpu_to_be16 (0x2dfa ) :cpu_to_le16 (0x2dfa ); + ram_table->crgb_slope[2 ] = (big_endian) ?cpu_to_be16 (0x27ea ) :cpu_to_le16 (0x27ea ); + ram_table->crgb_slope[3 ] = (big_endian) ?cpu_to_be16 (0x235d ) :cpu_to_le16 (0x235d ); + ram_table->crgb_slope[4 ] = (big_endian) ?cpu_to_be16 (0x2042 ) :cpu_to_le16 (0x2042 ); + ram_table->crgb_slope[5 ] = (big_endian) ?cpu_to_be16 (0x1dc3 ) :cpu_to_le16 (0x1dc3 ); + ram_table->crgb_slope[6 ] = (big_endian) ?cpu_to_be16 (0x1b1a ) :cpu_to_le16 (0x1b1a ); + ram_table->crgb_slope[7 ] = (big_endian) ?cpu_to_be16 (0x1910 ) :cpu_to_le16 (0x1910 );That you have to duplicate the values is rather ugly here.
Quoted 2 lines
Since this is all in one file maybe come up with a helper for this? E.g.
conditional_bswap16(big_endian, value)
I'm going to prepare a patch with your suggestion.
Thanks
Quoted 6 lines
Regards,
Christian.Quoted 2 lines
drivers/gpu/drm/amd/display/modules/power/power_helpers.c +0
-0fill_backlight_transform_table_v_2_2 ( params, ram_table, big_endian);
Signature · 2 lines
Rodrigo Siqueira https://siqueira.tech
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 6/35 drm/amd/display: Add SetBacklight call to abm on dmcub
In reply to Rodrigo SiqueiraFrom: Wyatt Wood <[email protected]>
[Why]
Set backlight calls to firmware are are being prevented by dmcu == null check. Dmcu is expected to be null in this case.
[How]
Only prevent call if dmcu and abm are null. Also rename variable 'use_smooth_brightness' to 'fw_set_brightness' as it's more appropriate.
--- drivers/gpu/drm/amd/display/dc/core/dc_link.c | 10 +++++----- drivers/gpu/drm/amd/display/dc/dce/dce_abm.c | 4 ++-- drivers/gpu/drm/amd/display/dc/dce/dmub_abm.c | 2 +- drivers/gpu/drm/amd/display/dc/inc/hw/abm.h | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc_link.c +5 -5
@@ -2455,16 +2455,16 @@ bool dc_link_set_backlight_level(const struct dc_link *link,struct abm *abm = dc->res_pool->abm;struct dmcu *dmcu = dc->res_pool->dmcu;unsigned int controller_id =0 ; -bool use_smooth_brightness = true; +bool fw_set_brightness = true;int i;DC_LOGGER_INIT (link->ctx->logger); -if ((dmcu ==NULL ) || - (abm ==NULL ) || +if ((dmcu ==NULL && abm ==NULL ) || (abm->funcs->set_backlight_level_pwm ==NULL ))return false; - use_smooth_brightness = dmcu->funcs->is_dmcu_initialized (dmcu); +if (dmcu) + fw_set_brightness = dmcu->funcs->is_dmcu_initialized (dmcu);DC_LOG_BACKLIGHT ("New Backlight level: %d (0x%X)\n" , backlight_pwm_u16_16, backlight_pwm_u16_16);
@@ -2496,7 +2496,7 @@ bool dc_link_set_backlight_level(const struct dc_link *link, backlight_pwm_u16_16, frame_ramp, controller_id, - use_smooth_brightness); + fw_set_brightness); }return true;
drivers/gpu/drm/amd/display/dc/dce/dce_abm.c +2 -2
@@ -420,7 +420,7 @@ static bool dce_abm_set_backlight_level_pwm(unsigned int backlight_pwm_u16_16, unsigned int frame_ramp, unsigned int controller_id, - bool use_smooth_brightness) + bool fw_set_brightness) { struct dce_abm *abm_dce = TO_DCE_ABM(abm);
@@ -428,7 +428,7 @@ static bool dce_abm_set_backlight_level_pwm( backlight_pwm_u16_16, backlight_pwm_u16_16);/* If DMCU is in reset state, DMCU is uninitialized */ -if (use_smooth_brightness) +if (fw_set_brightness) dmcu_set_backlight_level(abm_dce, backlight_pwm_u16_16, frame_ramp,
drivers/gpu/drm/amd/display/dc/dce/dmub_abm.c +1 -1
@@ -338,7 +338,7 @@ static bool dmub_abm_set_backlight_level_pwm(unsigned int backlight_pwm_u16_16, unsigned int frame_ramp, unsigned int otg_inst, - bool use_smooth_brightness) + bool fw_set_brightness) { struct dce_abm *dce_abm = TO_DMUB_ABM(abm);
drivers/gpu/drm/amd/display/dc/inc/hw/abm.h +1 -1
@@ -56,7 +56,7 @@ struct abm_funcs {unsigned int backlight_pwm_u16_16, unsigned int frame_ramp, unsigned int controller_id, - bool use_smooth_brightness); + bool fw_set_brightness);unsigned int (*get_current_backlight)(struct abm *abm);unsigned int (*get_target_backlight)(struct abm *abm);
Signature · 6 lines
2.26.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 7/35 drm/amd/display: Support plane-level gamut remap in DM
In reply to Rodrigo SiqueiraFrom: Stylon Wang <[email protected]>
[Why]
Plane-level gamut remap is not enabled in DM, which is necessary to support CTM as a plane-level property.
[How]
Enable gamut remap in DM.
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +3 -0
@@ -6728,6 +6728,7 @@ static void amdgpu_dm_commit_planes(struct drm_atomic_state *state,if (new_pcrtc_state->color_mgmt_changed) { bundle->surface_updates[planes_count].gamma = dc_plane->gamma_correction; bundle->surface_updates[planes_count].in_transfer_func = dc_plane->in_transfer_func; + bundle->surface_updates[planes_count].gamut_remap_matrix = &dc_plane->gamut_remap_matrix; } fill_dc_scaling_info(new_plane_state,
@@ -8173,6 +8174,8 @@ dm_determine_update_type_for_commit(struct amdgpu_display_manager *dm, new_dm_plane_state->dc_state->gamma_correction; bundle->surface_updates[num_plane].in_transfer_func = new_dm_plane_state->dc_state->in_transfer_func; + bundle->surface_updates[num_plane].gamut_remap_matrix = + &new_dm_plane_state->dc_state->gamut_remap_matrix; bundle->stream_update.gamut_remap = &new_dm_crtc_state->stream->gamut_remap_matrix; bundle->stream_update.output_csc_transform =
Signature · 6 lines
2.26.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 8/35 drm/amd/display: Unify psr feature flags
In reply to Rodrigo SiqueiraFrom: Wyatt Wood <[email protected]>
[Why]
As it stands, psr has feature flags in dm, stream, and link. Most are not defined well enough, and different dm layers have different uses for these same flags.
[How]
We define a new structure called psr_settings in dc_link that will hold the following psr feature flags:
psr_feature_enable - psr is supported psr_allow_active - psr is currently active psr_version - internal psr version supported psr_frame_capture_indication_req psr_sdp_transmit_line_num_deadline
The last two flags were moved out of the power module for the purposes of consolidating psr flags. Their use is already well-defined.
Psr caps reported by sink will also be stored in dc_link, in dpcd_caps.psr_caps.
--- .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 35 +++++++++++-------- .../gpu/drm/amd/display/dc/clk_mgr/clk_mgr.c | 2 +- drivers/gpu/drm/amd/display/dc/core/dc.c | 2 ++ drivers/gpu/drm/amd/display/dc/core/dc_link.c | 19 +++++----- .../gpu/drm/amd/display/dc/core/dc_link_dp.c | 2 +- drivers/gpu/drm/amd/display/dc/dc.h | 1 + drivers/gpu/drm/amd/display/dc/dc_dp_types.h | 6 ++++ drivers/gpu/drm/amd/display/dc/dc_link.h | 21 +++++++++-- drivers/gpu/drm/amd/display/dc/dc_stream.h | 2 -- drivers/gpu/drm/amd/display/dc/dce/dmub_psr.c | 13 ++++--- .../display/dc/dce110/dce110_hw_sequencer.c | 4 +-- .../drm/amd/display/dmub/inc/dmub_cmd_dal.h | 1 + .../display/modules/info_packet/info_packet.c | 3 +- 13 files changed, 72 insertions(+), 39 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +20 -15
@@ -4412,14 +4412,10 @@ create_stream_for_sink(struct amdgpu_dm_connector *aconnector,if (stream->signal ==SIGNAL_TYPE_HDMI_TYPE_A )mod_build_hf_vsif_infopacket (stream, &stream->vsp_infopacket, false, false); -if (stream->link->psr_feature_enabled) { +if (stream->link->psr_settings.psr_feature_enabled) {struct dc *core_dc = stream->link->ctx->dc;if (dc_is_dmcu_initialized (core_dc)) { -struct dmcu *dmcu = core_dc->res_pool->dmcu; - - stream->psr_version = dmcu->dmcu_version.psr_version; -// // should decide stream support vsc sdp colorimetry capability // before building vsc info packet
@@ -6919,7 +6915,7 @@ static void amdgpu_dm_commit_planes(struct drm_atomic_state *state, }mutex_lock (&dm->dc_lock);if ((acrtc_state->update_type >UPDATE_TYPE_FAST ) && - acrtc_state->stream->link->psr_allow_active) + acrtc_state->stream->link->psr_settings.psr_allow_active)amdgpu_dm_psr_disable (acrtc_state->stream); dc_commit_updates_for_stream(dm->dc,
@@ -6930,12 +6926,12 @@ static void amdgpu_dm_commit_planes(struct drm_atomic_state *state, dc_state);if ((acrtc_state->update_type >UPDATE_TYPE_FAST ) && - acrtc_state->stream->psr_version && - !acrtc_state->stream->link->psr_feature_enabled) + acrtc_state->stream->link->psr_settings.psr_version !=PSR_VERSION_UNSUPPORTED && + !acrtc_state->stream->link->psr_settings.psr_feature_enabled)amdgpu_dm_link_setup_psr (acrtc_state->stream);else if ((acrtc_state->update_type ==UPDATE_TYPE_FAST ) && - acrtc_state->stream->link->psr_feature_enabled && - !acrtc_state->stream->link->psr_allow_active) { + acrtc_state->stream->link->psr_settings.psr_feature_enabled && + !acrtc_state->stream->link->psr_settings.psr_allow_active) {amdgpu_dm_psr_enable (acrtc_state->stream); }
@@ -7249,7 +7245,7 @@ static void amdgpu_dm_atomic_commit_tail(struct drm_atomic_state *state)DRM_DEBUG_DRIVER ("Atomic commit: RESET. crtc id %d:[%p]\n" , acrtc->crtc_id, acrtc);/* i.e. reset mode */ if (dm_old_crtc_state->stream) { -if (dm_old_crtc_state->stream->link->psr_allow_active) +if (dm_old_crtc_state->stream->link->psr_settings.psr_allow_active)amdgpu_dm_psr_disable (dm_old_crtc_state->stream);remove_stream (adev, acrtc, dm_old_crtc_state->stream);
@@ -8699,8 +8695,17 @@ static void amdgpu_dm_set_psr_caps(struct dc_link *link)return ;if (dm_helpers_dp_read_dpcd (NULL , link,DP_PSR_SUPPORT , dpcd_data,sizeof (dpcd_data))) { - link->psr_feature_enabled = dpcd_data[0 ] ? true:false; -DRM_INFO ("PSR support:%d\n" , link->psr_feature_enabled); + link->dpcd_caps.psr_caps.psr_version = dpcd_data[0 ]; + +if (dpcd_data[0 ] ==0 ) { + link->psr_settings.psr_version =PSR_VERSION_UNSUPPORTED ; + link->psr_settings.psr_feature_enabled = false; + }else { + link->psr_settings.psr_version =PSR_VERSION_1 ; + link->psr_settings.psr_feature_enabled = true; + } + +DRM_INFO ("PSR support:%d\n" , link->psr_settings.psr_feature_enabled); } }
@@ -8724,7 +8729,7 @@ static bool amdgpu_dm_link_setup_psr(struct dc_stream_state *stream) link = stream->link; dc = link->ctx->dc; - psr_config.psr_version = dc->res_pool->dmcu->dmcu_version.psr_version; + psr_config.psr_version = link->dpcd_caps.psr_caps.psr_version;if (psr_config.psr_version >0 ) { psr_config.psr_exit_link_training_required =0x1 ;
@@ -8736,7 +8741,7 @@ static bool amdgpu_dm_link_setup_psr(struct dc_stream_state *stream) ret =dc_link_setup_psr (link, stream, &psr_config, &psr_context); } -DRM_DEBUG_DRIVER ("PSR link: %d\n" , link->psr_feature_enabled); +DRM_DEBUG_DRIVER ("PSR link: %d\n" , link->psr_settings.psr_feature_enabled);return ret; }
drivers/gpu/drm/amd/display/dc/clk_mgr/clk_mgr.c +1 -1
@@ -90,7 +90,7 @@ void clk_mgr_exit_optimized_pwr_state(const struct dc *dc, struct clk_mgr *clk_m dc->hwss.exit_optimized_pwr_state (dc, dc->current_state);if (edp_link) { - clk_mgr->psr_allow_active_cache = edp_link->psr_allow_active; + clk_mgr->psr_allow_active_cache = edp_link->psr_settings.psr_allow_active;dc_link_set_psr_allow_active (edp_link, false, false); }
drivers/gpu/drm/amd/display/dc/core/dc.c +2 -0
@@ -66,6 +66,8 @@#include "dce/dce_i2c.h" +#include "dmub/inc/dmub_cmd_dal.h" +#define CTX \ dc->ctx
drivers/gpu/drm/amd/display/dc/core/dc_link.c +11 -8
@@ -46,6 +46,7 @@#include "dmcu.h" #include "hw/clk_mgr.h" #include "dce/dmub_psr.h" +#include "dmub/inc/dmub_cmd_dal.h" #define DC_LOGGER_INIT (logger)
@@ -1529,6 +1530,8 @@ static bool dc_link_construct(struct dc_link *link,*/ program_hpd_filter (link); + link->psr_settings.psr_version =PSR_VERSION_UNSUPPORTED ; +return true; device_tag_fail: link->link_enc->funcs->destroy (&link->link_enc);
@@ -2521,12 +2524,12 @@ bool dc_link_set_psr_allow_active(struct dc_link *link, bool allow_active, boolstruct dmcu *dmcu = dc->res_pool->dmcu;struct dmub_psr *psr = dc->res_pool->psr; -if (psr !=NULL && link->psr_feature_enabled) +if (psr !=NULL && link->psr_settings.psr_feature_enabled) psr->funcs->psr_enable (psr, allow_active); -else if ((dmcu !=NULL && dmcu->funcs->is_dmcu_initialized (dmcu)) && link->psr_feature_enabled) +else if ((dmcu !=NULL && dmcu->funcs->is_dmcu_initialized (dmcu)) && link->psr_settings.psr_feature_enabled) dmcu->funcs->set_psr_enable (dmcu, allow_active, wait); - link->psr_allow_active = allow_active; + link->psr_settings.psr_allow_active = allow_active;return true; }
@@ -2537,9 +2540,9 @@ bool dc_link_get_psr_state(const struct dc_link *link, uint32_t *psr_state)struct dmcu *dmcu = dc->res_pool->dmcu;struct dmub_psr *psr = dc->res_pool->psr; -if (psr !=NULL && link->psr_feature_enabled) +if (psr !=NULL && link->psr_settings.psr_feature_enabled) psr->funcs->psr_get_state (psr, psr_state); -else if (dmcu !=NULL && link->psr_feature_enabled) +else if (dmcu !=NULL && link->psr_settings.psr_feature_enabled) dmcu->funcs->get_psr_state (dmcu, psr_state);return true;
@@ -2710,14 +2713,14 @@ bool dc_link_setup_psr(struct dc_link *link, psr_context->frame_delay =0 ;if (psr) - link->psr_feature_enabled = psr->funcs->psr_copy_settings (psr, link, psr_context); + link->psr_settings.psr_feature_enabled = psr->funcs->psr_copy_settings (psr, link, psr_context);else - link->psr_feature_enabled = dmcu->funcs->setup_psr (dmcu, link, psr_context); + link->psr_settings.psr_feature_enabled = dmcu->funcs->setup_psr (dmcu, link, psr_context);/* psr_enabled == 0 indicates setup_psr did not succeed, but this * should not happen since firmware should be running at this point */ -if (link->psr_feature_enabled ==0 ) +if (link->psr_settings.psr_feature_enabled ==0 )ASSERT (0 );return true;
drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c +1 -1
@@ -2417,7 +2417,7 @@ static bool handle_hpd_irq_psr_sink(struct dc_link *link) {union dpcd_psr_configuration psr_configuration; -if (!link->psr_feature_enabled) +if (!link->psr_settings.psr_feature_enabled)return false; dm_helpers_dp_read_dpcd(
drivers/gpu/drm/amd/display/dc/dc.h +1 -0
@@ -990,6 +990,7 @@ struct dpcd_caps {union dpcd_fec_capability fec_cap;struct dpcd_dsc_capabilities dsc_caps;struct dc_lttpr_caps lttpr_caps; +struct psr_caps psr_caps; };
drivers/gpu/drm/amd/display/dc/dc_dp_types.h +6 -0
@@ -740,5 +740,11 @@ struct dpcd_dsc_capabilities { union dpcd_dsc_ext_capabilities dsc_ext_caps; }; +/* These parameters are from PSR capabilities reported by Sink DPCD */ +struct psr_caps { +unsigned char psr_version; +unsigned int psr_rfb_setup_time; +bool psr_exit_link_training_required; +};#endif /* DC_DP_TYPES_H */
drivers/gpu/drm/amd/display/dc/dc_link.h +19 -2
@@ -29,6 +29,7 @@#include "dc.h" #include "dc_types.h" #include "grph_object_defs.h" +#include "dmub/inc/dmub_cmd_dal.h" enum dc_link_fec_state { dc_link_fec_not_ready,
@@ -66,6 +67,22 @@ struct time_stamp {struct link_trace {struct time_stamp time_stamp; }; + +/* PSR feature flags */ +struct psr_settings { +bool psr_feature_enabled;// PSR is supported by sink +bool psr_allow_active;// PSR is currently active +enum psr_version psr_version;// Internal PSR version, determined based on DPCD + +/* These parameters are calculated in Driver, +* based on display timing and Sink capabilities. +* If VBLANK region is too small and Sink takes a long time +* to set up RFB, it may take an extra frame to enter PSR state. +*/ +bool psr_frame_capture_indication_req; +unsigned int psr_sdp_transmit_line_num_deadline; +}; +/* * A link contains one or more sinks and their connected status. * The currently active signal type (HDMI, DP-SST, DP-MST) is also reported.
@@ -130,10 +147,10 @@ struct dc_link {struct hdcp_caps hdcp_caps;#endif enum edp_revision edp_revision; -bool psr_feature_enabled; -bool psr_allow_active;union dpcd_sink_ext_caps dpcd_sink_ext_caps; +struct psr_settings psr_settings; +/* MST record stream using this link */ struct link_flags {bool dp_keep_receiver_powered;
drivers/gpu/drm/amd/display/dc/dc_stream.h +0 -2
@@ -167,8 +167,6 @@ struct dc_stream_state {/* TODO: custom INFO packets */ /* TODO: ABM info (DMCU) */ -/* PSR info */ -unsigned char psr_version;/* TODO: CEA VIC */ /* DMCU info */
drivers/gpu/drm/amd/display/dc/dce/dmub_psr.c +6 -7
@@ -53,16 +53,15 @@ static bool dmub_psr_set_version(struct dmub_psr *dmub, struct dc_stream_state *union dmub_rb_cmd cmd;struct dc_context *dc = dmub->ctx; +if (stream->link->psr_settings.psr_version ==PSR_VERSION_UNSUPPORTED ) +return false; + cmd.psr_set_version.header.type =DMUB_CMD__PSR ; cmd.psr_set_version.header.sub_type =DMUB_CMD__PSR_SET_VERSION ; + cmd.psr_set_version.psr_set_version_data.version = stream->link->psr_settings.psr_version; + cmd.psr_set_version.header.payload_bytes =sizeof (struct dmub_cmd_psr_set_version_data ); -if (stream->psr_version ==0x0 )// Unsupported -return false; -else if (stream->psr_version ==0x1 ) - cmd.psr_set_version.psr_set_version_data.version =PSR_VERSION_1 ; - cmd.psr_enable.header.payload_bytes =sizeof (struct dmub_cmd_psr_set_version_data ); - -dc_dmub_srv_cmd_queue (dc->dmub_srv, &cmd.psr_enable.header); +dc_dmub_srv_cmd_queue (dc->dmub_srv, &cmd.psr_set_version.header);dc_dmub_srv_cmd_execute (dc->dmub_srv);dc_dmub_srv_wait_idle (dc->dmub_srv);
drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c +2 -2
@@ -1432,7 +1432,7 @@ static enum dc_status apply_single_controller_ctx_to_hw( pipe_ctx->plane_res.scl_data.lb_params.alpha_en = pipe_ctx->bottom_pipe !=0 ; - pipe_ctx->stream->link->psr_feature_enabled = false; + pipe_ctx->stream->link->psr_settings.psr_feature_enabled = false;return DC_OK ; }
@@ -1838,7 +1838,7 @@ static bool should_enable_fbc(struct dc *dc,return false;/* PSR should not be enabled */ -if (pipe_ctx->stream->link->psr_feature_enabled) +if (pipe_ctx->stream->link->psr_settings.psr_feature_enabled)return false;/* Nothing to compress */
drivers/gpu/drm/amd/display/dmub/inc/dmub_cmd_dal.h +1 -0
@@ -41,6 +41,7 @@ enum dmub_cmd_psr_type {enum psr_version {PSR_VERSION_1 =0 , +PSR_VERSION_UNSUPPORTED =0xFFFFFFFF , };enum dmub_cmd_abm_type {
drivers/gpu/drm/amd/display/modules/info_packet/info_packet.c +2 -1
@@ -29,6 +29,7 @@#include "mod_shared.h" #include "mod_freesync.h" #include "dc.h" +#include "dmub/inc/dmub_cmd_dal.h" enum vsc_packet_revision { vsc_packet_undefined =0 ,
@@ -144,7 +145,7 @@ void mod_build_vsc_infopacket(const struct dc_stream_state *stream, }/*VSC packet set to 2 when DP revision >= 1.2*/ -if (stream->psr_version !=0 ) +if (stream->link->psr_settings.psr_version !=PSR_VERSION_UNSUPPORTED ) vsc_packet_revision = vsc_packet_rev2;/* Update to revision 5 for extended colorimetry support */
Signature · 6 lines
2.26.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 9/35 drm/amd/display: Check ramp != NULL before applying lut1d for degamma
In reply to Rodrigo SiqueiraFrom: Nicholas Kazlauskas <[email protected]>
[Why]
A NULL ramp is a valid configuration for passing into mod_color_calculate_degamma_params but we'll hit a NULL pointer if we do so.
We need this in order to get the right transfer function to do degamma on NV12 formats where we aren't supplied with a custom user degamma.
[How]
Add the NULL check.
--- drivers/gpu/drm/amd/display/modules/color/color_gamma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/display/modules/color/color_gamma.c +1 -1
@@ -1902,7 +1902,7 @@ bool mod_color_calculate_degamma_params(struct dc_transfer_func *input_tf, -if (ramp->type ==GAMMA_CUSTOM ) +if (ramp && ramp->type ==GAMMA_CUSTOM )apply_lut_1d (ramp,MAX_HW_POINTS , tf_pts); ret = true;
Signature · 6 lines
2.26.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 10/35 drm/amd/display: Workaround to disable YCbCr
In reply to Rodrigo SiqueiraFrom: Jinze Xu <[email protected]>
[Why]
Some mst dock can't translate DP to HDMI properly.
[How]
Bypass YCbCr timings on specific MST device.
--- drivers/gpu/drm/amd/display/dc/core/dc_sink.c | 1 + drivers/gpu/drm/amd/display/dc/dc.h | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/core/dc_sink.c +1 -0
@@ -54,6 +54,7 @@ static bool dc_sink_construct(struct dc_sink *sink, const struct dc_sink_init_da sink->ctx = link->ctx; sink->dongle_max_pix_clk = init_params->dongle_max_pix_clk; sink->converter_disable_audio = init_params->converter_disable_audio; + sink->is_mst_legacy = init_params->sink_is_legacy; sink->dc_container_id =NULL ; sink->sink_id = init_params->link->ctx->dc_sink_id_count;// increment dc_sink_id_count because we don't want two sinks with same ID
drivers/gpu/drm/amd/display/dc/dc.h +2 -1
@@ -1079,7 +1079,7 @@ struct dc_sink {void *priv;struct stereo_3d_features features_3d[TIMING_3D_FORMAT_MAX ];bool converter_disable_audio; - +bool is_mst_legacy;struct dc_sink_dsc_caps dsc_caps;struct dc_sink_fec_caps fec_caps;
@@ -1106,6 +1106,7 @@ struct dc_sink_init_data {struct dc_link *link;uint32_t dongle_max_pix_clk;bool converter_disable_audio; +bool sink_is_legacy; };struct dc_sink *dc_sink_create (const struct dc_sink_init_data *init_params);
Signature · 6 lines
2.26.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 11/35 drm/amd/display: add optc get crc support for timings with ODM/DSC
In reply to Rodrigo SiqueiraFrom: Wenjing Liu <[email protected]>
[why]
Optc needs to know if timing is enabled with ODM or DSC before computing crc. Otherwise value computed will be inaccurate. Before this change, the CRC computed without ODM is not equal to the CRC computed with ODM for the same timing. This is unexpected as we are driving the same timing despite of the underlaying hardware setup to achieve it. This is caused by missing hardware programming sequence to support it.
[how]
Add the new programming sequence based on hardware guide.
--- drivers/gpu/drm/amd/display/dc/core/dc.c | 5 ++++- drivers/gpu/drm/amd/display/dc/dcn10/dcn10_optc.h | 7 ++++++- drivers/gpu/drm/amd/display/dc/dcn20/dcn20_optc.c | 14 +++++++++++++- drivers/gpu/drm/amd/display/dc/dcn20/dcn20_optc.h | 7 +++++++ .../drm/amd/display/dc/inc/hw/timing_generator.h | 3 +++ 5 files changed, 33 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc.c +4 -1
@@ -350,7 +350,7 @@ bool dc_stream_configure_crc(struct dc *dc, struct dc_stream_state *stream,for (i =0 ; i <MAX_PIPES ; i++) { pipe = &dc->current_state->res_ctx.pipe_ctx[i]; -if (pipe->stream == stream) +if (pipe->stream == stream && !pipe->top_pipe && !pipe->prev_odm_pipe)break ; }/* Stream not found */
@@ -367,6 +367,9 @@ bool dc_stream_configure_crc(struct dc *dc, struct dc_stream_state *stream, param.windowb_x_end = pipe->stream->timing.h_addressable; param.windowb_y_end = pipe->stream->timing.v_addressable; + param.dsc_mode = pipe->stream->timing.flags.DSC ?1 :0 ; + param.odm_mode = pipe->next_odm_pipe ?1 :0 ; +/* Default to the union of both windows */ param.selection =UNION_WINDOW_A_B ; param.continuous_mode = continuous;
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_optc.h +6 -1
@@ -158,6 +158,7 @@ struct dcn_optc_registers {uint32_t OTG_GSL_WINDOW_Y ;uint32_t OTG_VUPDATE_KEEPOUT ;uint32_t OTG_CRC_CNTL ; +uint32_t OTG_CRC_CNTL2 ;uint32_t OTG_CRC0_DATA_RG ;uint32_t OTG_CRC0_DATA_B ;uint32_t OTG_CRC0_WINDOWA_X_CONTROL ;
@@ -475,7 +476,11 @@ struct dcn_optc_registers {type OPTC_DSC_SLICE_WIDTH ;\type OPTC_SEGMENT_WIDTH ;\type OPTC_DWB0_SOURCE_SELECT ;\ -type OPTC_DWB1_SOURCE_SELECT ; +type OPTC_DWB1_SOURCE_SELECT ;\ +type OTG_CRC_DSC_MODE ;\ +type OTG_CRC_DATA_STREAM_COMBINE_MODE ;\ +type OTG_CRC_DATA_STREAM_SPLIT_MODE ;\ +type OTG_CRC_DATA_FORMAT ;
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_optc.c +13 -1
@@ -409,6 +409,18 @@ void optc2_program_manual_trigger(struct timing_generator *optc) OTG_TRIGA_MANUAL_TRIG, 1); } +bool optc2_configure_crc (struct timing_generator *optc, +const struct crc_params *params) +{ +struct optc *optc1 =DCN10TG_FROM_TG (optc); + +REG_SET_2 (OTG_CRC_CNTL2 ,0 , +OTG_CRC_DSC_MODE , params->dsc_mode, +OTG_CRC_DATA_STREAM_COMBINE_MODE , params->odm_mode); + +return optc1_configure_crc (optc, params); +} +static struct timing_generator_funcs dcn20_tg_funcs = { .validate_timing = optc1_validate_timing, .program_timing = optc1_program_timing,
@@ -452,7 +464,7 @@ static struct timing_generator_funcs dcn20_tg_funcs = { .clear_optc_underflow = optc1_clear_optc_underflow, .setup_global_swap_lock = NULL, .get_crc = optc1_get_crc, - .configure_crc = optc1_configure_crc, + .configure_crc = optc2_configure_crc, .set_dsc_config = optc2_set_dsc_config, .set_dwb_source = optc2_set_dwb_source, .set_odm_bypass = optc2_set_odm_bypass,
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_optc.h +7 -0
@@ -36,6 +36,7 @@SRI (OTG_GSL_WINDOW_Y ,OTG , inst),\SRI (OTG_VUPDATE_KEEPOUT ,OTG , inst),\SRI (OTG_DSC_START_POSITION ,OTG , inst),\ +SRI (OTG_CRC_CNTL2 ,OTG , inst),\SRI (OPTC_DATA_FORMAT_CONTROL ,ODM , inst),\SRI (OPTC_BYTES_PER_PIXEL ,ODM , inst),\ SRI(OPTC_WIDTH_CONTROL, ODM, inst),\
@@ -62,6 +63,10 @@SF (OTG0_OTG_GSL_CONTROL ,OTG_MASTER_UPDATE_LOCK_GSL_EN , mask_sh), \SF (OTG0_OTG_DSC_START_POSITION ,OTG_DSC_START_POSITION_X , mask_sh), \SF (OTG0_OTG_DSC_START_POSITION ,OTG_DSC_START_POSITION_LINE_NUM , mask_sh),\ +SF (OTG0_OTG_CRC_CNTL2 ,OTG_CRC_DSC_MODE , mask_sh),\ +SF (OTG0_OTG_CRC_CNTL2 ,OTG_CRC_DATA_STREAM_COMBINE_MODE , mask_sh),\ +SF (OTG0_OTG_CRC_CNTL2 ,OTG_CRC_DATA_STREAM_SPLIT_MODE , mask_sh),\ +SF (OTG0_OTG_CRC_CNTL2 ,OTG_CRC_DATA_FORMAT , mask_sh),\SF (ODM0_OPTC_DATA_SOURCE_SELECT ,OPTC_SEG0_SRC_SEL , mask_sh),\SF (ODM0_OPTC_DATA_SOURCE_SELECT ,OPTC_SEG1_SRC_SEL , mask_sh),\ SF(ODM0_OPTC_DATA_SOURCE_SELECT, OPTC_NUM_OF_INPUT_SEGMENT, mask_sh),\
@@ -109,4 +114,6 @@ void optc2_lock_doublebuffer_enable(struct timing_generator *optc);void optc2_setup_manual_trigger (struct timing_generator *optc);void optc2_program_manual_trigger (struct timing_generator *optc);bool optc2_is_two_pixels_per_containter (const struct dc_crtc_timing *timing); +bool optc2_configure_crc (struct timing_generator *optc, +const struct crc_params *params);#endif /* __DC_OPTC_DCN20_H__ */
drivers/gpu/drm/amd/display/dc/inc/hw/timing_generator.h +3 -0
@@ -117,6 +117,9 @@ struct crc_params {enum crc_selection selection; +uint8_t dsc_mode; +uint8_t odm_mode; +bool continuous_mode;bool enable; };
Signature · 6 lines
2.26.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 12/35 drm/amd/display: Set meta_chunk_value to 0 in DML if DCC disabled in DCN2.1
In reply to Rodrigo SiqueiraFrom: Sung Lee <[email protected]>
[WHY]:
Calculating refcyc_per_meta_chunk_vblank_l when DCC is disabled may lead to a large number causing an assert to get hit. In VBA, this value is 0 when DCC is disabled.
[HOW]:
Set value to 0 to avoid hitting the assert.
--- .../drm/amd/display/dc/dml/dcn21/display_rq_dlg_calc_21.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/dml/dcn21/display_rq_dlg_calc_21.c +4 -1
@@ -1500,9 +1500,12 @@ static void dml_rq_dlg_get_dlg_params( < (unsigned int)dml_pow(2, 13)); } - disp_dlg_regs->refcyc_per_meta_chunk_vblank_l = +if (src->dcc) + disp_dlg_regs->refcyc_per_meta_chunk_vblank_l = (unsigned int ) (dst_y_per_row_vblank * (double ) htotal * ref_freq_to_pix_freq / (double ) meta_chunks_per_row_ub_l); +else + disp_dlg_regs->refcyc_per_meta_chunk_vblank_l =0 ;ASSERT (disp_dlg_regs->refcyc_per_meta_chunk_vblank_l < (unsigned int )dml_pow (2 ,13 )); disp_dlg_regs->refcyc_per_meta_chunk_vblank_c =
Signature · 6 lines
2.26.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 13/35 drm/amd/display: Cast int to float before division
In reply to Rodrigo SiqueiraFrom: Sung Lee <[email protected]>
[Why]:
Some inputs to dml_ceil have it dividied by int which causes a truncation. This loss of precision means the ceil function becomes redundant and does not round up.
[How]:
Cast parameter to float before division.
--- .../gpu/drm/amd/display/dc/dml/dcn21/display_mode_vba_21.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/dc/dml/dcn21/display_mode_vba_21.c +2 -2
@@ -5944,7 +5944,7 @@ static void CalculateMetaAndPTETimes( * PixelPTEReqHeightY[k]; } dpte_groups_per_row_luma_ub =dml_ceil ( - dpte_row_width_luma_ub[k] / dpte_group_width_luma, + (float ) dpte_row_width_luma_ub[k] / dpte_group_width_luma,1 ); time_per_pte_group_nom_luma[k] =DST_Y_PER_PTE_ROW_NOM_L [k] * HTotal[k] / PixelClock[k] / dpte_groups_per_row_luma_ub;
@@ -5968,7 +5968,7 @@ static void CalculateMetaAndPTETimes( * PixelPTEReqHeightC[k]; } dpte_groups_per_row_chroma_ub =dml_ceil ( - dpte_row_width_chroma_ub[k] + (float ) dpte_row_width_chroma_ub[k] / dpte_group_width_chroma,1 ); time_per_pte_group_nom_chroma[k] =DST_Y_PER_PTE_ROW_NOM_C [k]
Signature · 6 lines
2.26.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 14/35 drm/amd/display: fix stream setting for diags on silicon
In reply to Rodrigo SiqueiraFrom: Dmytro Laktyushkin <[email protected]>
We need to set up stream even with virtual displays when running diags.
--- drivers/gpu/drm/amd/display/dc/core/dc_link.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc_link.c +2 -2
@@ -3067,7 +3067,7 @@ void core_link_enable_stream(enum dc_status status;DC_LOGGER_INIT (pipe_ctx->stream->ctx->logger); -if (!IS_FPGA_MAXIMUS_DC (dc->ctx->dce_environment) && +if (!IS_DIAG_DC (dc->ctx->dce_environment) &&dc_is_virtual_signal (pipe_ctx->stream->signal))return ;
@@ -3217,7 +3217,7 @@ void core_link_disable_stream(struct pipe_ctx *pipe_ctx)struct dc_stream_state *stream = pipe_ctx->stream;struct dc_link *link = stream->sink->link; -if (!IS_FPGA_MAXIMUS_DC (dc->ctx->dce_environment) && +if (!IS_DIAG_DC (dc->ctx->dce_environment) &&dc_is_virtual_signal (pipe_ctx->stream->signal))return ;
Signature · 6 lines
2.26.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 15/35 drm/amd/display: Avoid NULL pointer in set_backlight when ABM is NULL
In reply to Rodrigo SiqueiraFrom: Nicholas Kazlauskas <[email protected]>
[Why]
On ASIC without ABM support (most dGPU) we run into a null pointer dereference when attempting to set the backlight level.
[How]
This function requires ABM, so fix up the condition to only allow DMCU to be optional.
--- drivers/gpu/drm/amd/display/dc/core/dc_link.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc_link.c +1 -2
@@ -2462,8 +2462,7 @@ bool dc_link_set_backlight_level(const struct dc_link *link,int i;DC_LOGGER_INIT (link->ctx->logger); -if ((dmcu ==NULL && abm ==NULL ) || - (abm->funcs->set_backlight_level_pwm ==NULL )) +if (abm ==NULL || (abm->funcs->set_backlight_level_pwm ==NULL ))return false;if (dmcu)
Signature · 6 lines
2.26.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 16/35 drm/amd/display: Change infopacket type programming
In reply to Rodrigo SiqueiraFrom: Haiyi Zhou <[email protected]>
[Why]
Certain displays may experience blanking if infopacket max range does not equal nominal refresh rate.
[How]
Add additional infopacket versions to program range to full or forced range in freesync states.
This does not change the vrr logic.
--- .../amd/display/modules/freesync/freesync.c | 101 ++++++++++++++++-- .../amd/display/modules/inc/mod_freesync.h | 3 + .../drm/amd/display/modules/inc/mod_shared.h | 5 +- 3 files changed, 99 insertions(+), 10 deletions(-)
drivers/gpu/drm/amd/display/modules/freesync/freesync.c +93 -8
@@ -443,7 +443,7 @@ static bool vrr_settings_require_update(struct core_freesync *core_freesync,return true; }else if (in_vrr->state ==VRR_STATE_ACTIVE_FIXED && in_vrr->fixed.target_refresh_in_uhz != - in_config->min_refresh_in_uhz) { + in_config->fixed_refresh_in_uhz) {return true; }else if (in_vrr->min_refresh_in_uhz != min_refresh_in_uhz) {return true;
@@ -491,7 +491,7 @@ bool mod_freesync_get_v_position(struct mod_freesync *mod_freesync,return false; } -static void build_vrr_infopacket_data (const struct mod_vrr_params *vrr, +static void build_vrr_infopacket_data_v1 (const struct mod_vrr_params *vrr,struct dc_info_packet *infopacket) {/* PB1 = 0x1A (24bit AMD IEEE OUI (0x00001A) - Byte 0) */
@@ -523,14 +523,74 @@ static void build_vrr_infopacket_data(const struct mod_vrr_params *vrr, vrr->state == VRR_STATE_ACTIVE_FIXED) infopacket->sb[6 ] |=0x04 ; +// For v1 & 2 infoframes program nominal if non-fs mode, otherwise full range /* PB7 = FreeSync Minimum refresh rate (Hz) */ - infopacket->sb[7 ] = (unsigned char )((vrr->min_refresh_in_uhz +500000 ) /1000000 ); +if (vrr->state ==VRR_STATE_ACTIVE_VARIABLE || + vrr->state ==VRR_STATE_ACTIVE_FIXED ) { + infopacket->sb[7 ] = (unsigned char )((vrr->min_refresh_in_uhz +500000 ) /1000000 ); + }else { + infopacket->sb[7 ] = (unsigned char )((vrr->max_refresh_in_uhz +500000 ) /1000000 ); + }/* PB8 = FreeSync Maximum refresh rate (Hz) * Note: We should never go above the field rate of the mode timing set. */ infopacket->sb[8 ] = (unsigned char )((vrr->max_refresh_in_uhz +500000 ) /1000000 ); +//FreeSync HDR + infopacket->sb[9 ] =0 ; + infopacket->sb[10 ] =0 ; +} + +static void build_vrr_infopacket_data_v3 (const struct mod_vrr_params *vrr, +struct dc_info_packet *infopacket) +{ +/* PB1 = 0x1A (24bit AMD IEEE OUI (0x00001A) - Byte 0) */ + infopacket->sb[1 ] =0x1A ; + +/* PB2 = 0x00 (24bit AMD IEEE OUI (0x00001A) - Byte 1) */ + infopacket->sb[2 ] =0x00 ; + +/* PB3 = 0x00 (24bit AMD IEEE OUI (0x00001A) - Byte 2) */ + infopacket->sb[3 ] =0x00 ; + +/* PB4 = Reserved */ + +/* PB5 = Reserved */ + +/* PB6 = [Bits 7:3 = Reserved] */ + +/* PB6 = [Bit 0 = FreeSync Supported] */ +if (vrr->state !=VRR_STATE_UNSUPPORTED ) + infopacket->sb[6 ] |=0x01 ; + +/* PB6 = [Bit 1 = FreeSync Enabled] */ +if (vrr->state !=VRR_STATE_DISABLED && + vrr->state !=VRR_STATE_UNSUPPORTED ) + infopacket->sb[6 ] |=0x02 ; + +/* PB6 = [Bit 2 = FreeSync Active] */ +if (vrr->state ==VRR_STATE_ACTIVE_VARIABLE || + vrr->state ==VRR_STATE_ACTIVE_FIXED ) + infopacket->sb[6 ] |=0x04 ; + +if (vrr->state ==VRR_STATE_ACTIVE_FIXED ) { +/* PB7 = FreeSync Minimum refresh rate (Hz) */ + infopacket->sb[7 ] = (unsigned char )((vrr->fixed_refresh_in_uhz +500000 ) /1000000 ); +/* PB8 = FreeSync Maximum refresh rate (Hz) */ + infopacket->sb[8 ] = (unsigned char )((vrr->fixed_refresh_in_uhz +500000 ) /1000000 ); + }else if (vrr->state ==VRR_STATE_ACTIVE_VARIABLE ) { +/* PB7 = FreeSync Minimum refresh rate (Hz) */ + infopacket->sb[7 ] = (unsigned char )((vrr->min_refresh_in_uhz +500000 ) /1000000 ); +/* PB8 = FreeSync Maximum refresh rate (Hz) */ + infopacket->sb[8 ] = (unsigned char )((vrr->max_refresh_in_uhz +500000 ) /1000000 ); + }else { +// Non-fs case, program nominal range +/* PB7 = FreeSync Minimum refresh rate (Hz) */ + infopacket->sb[7 ] = (unsigned char )((vrr->max_refresh_in_uhz +500000 ) /1000000 ); +/* PB8 = FreeSync Maximum refresh rate (Hz) */ + infopacket->sb[8 ] = (unsigned char )((vrr->max_refresh_in_uhz +500000 ) /1000000 ); + }//FreeSync HDR infopacket->sb[9 ] =0 ;
@@ -678,7 +738,7 @@ static void build_vrr_infopacket_v1(enum signal_type signal,unsigned int payload_size =0 ;build_vrr_infopacket_header_v1 (signal, infopacket, &payload_size); -build_vrr_infopacket_data (vrr, infopacket); +build_vrr_infopacket_data_v1 (vrr, infopacket);build_vrr_infopacket_checksum (&payload_size, infopacket); infopacket->valid = true;
@@ -692,7 +752,24 @@ static void build_vrr_infopacket_v2(enum signal_type signal,unsigned int payload_size =0 ;build_vrr_infopacket_header_v2 (signal, infopacket, &payload_size); -build_vrr_infopacket_data (vrr, infopacket); +build_vrr_infopacket_data_v1 (vrr, infopacket); + +build_vrr_infopacket_fs2_data (app_tf, infopacket); + +build_vrr_infopacket_checksum (&payload_size, infopacket); + + infopacket->valid = true; +} + +static void build_vrr_infopacket_v3 (enum signal_type signal, +const struct mod_vrr_params *vrr, +enum color_transfer_func app_tf, +struct dc_info_packet *infopacket) +{ +unsigned int payload_size =0 ; + +build_vrr_infopacket_header_v2 (signal, infopacket, &payload_size); +build_vrr_infopacket_data_v3 (vrr, infopacket);build_vrr_infopacket_fs2_data (app_tf, infopacket);
@@ -717,11 +794,14 @@ void mod_freesync_build_vrr_infopacket(struct mod_freesync *mod_freesync,return ;switch (packet_type) { -case PACKET_TYPE_FS2 : +case PACKET_TYPE_FS_V3 : +build_vrr_infopacket_v3 (stream->signal, vrr, app_tf, infopacket); +break ; +case PACKET_TYPE_FS_V2 :build_vrr_infopacket_v2 (stream->signal, vrr, app_tf, infopacket);break ;case PACKET_TYPE_VRR : -case PACKET_TYPE_FS1 : +case PACKET_TYPE_FS_V1 :default :build_vrr_infopacket_v1 (stream->signal, vrr, infopacket); }
@@ -793,6 +873,11 @@ void mod_freesync_build_vrr_params(struct mod_freesync *mod_freesync,calc_duration_in_us_from_refresh_in_uhz ( (unsigned int )max_refresh_in_uhz); +if (in_config->state ==VRR_STATE_ACTIVE_FIXED ) + in_out_vrr->fixed_refresh_in_uhz = in_config->fixed_refresh_in_uhz; +else + in_out_vrr->fixed_refresh_in_uhz =0 ; + refresh_range = in_out_vrr->max_refresh_in_uhz - in_out_vrr->min_refresh_in_uhz;
@@ -843,7 +928,7 @@ void mod_freesync_build_vrr_params(struct mod_freesync *mod_freesync, in_out_vrr->min_refresh_in_uhz); }else if (in_out_vrr->state ==VRR_STATE_ACTIVE_FIXED ) { in_out_vrr->fixed.target_refresh_in_uhz = - in_out_vrr->min_refresh_in_uhz; + in_out_vrr->fixed_refresh_in_uhz;if (in_out_vrr->fixed.ramping_active && in_out_vrr->fixed.fixed_active) {/* Do not update vtotals if ramping is already active
drivers/gpu/drm/amd/display/modules/inc/mod_freesync.h +3 -0
@@ -83,6 +83,8 @@ struct mod_freesync_config {bool btr;unsigned int min_refresh_in_uhz;unsigned int max_refresh_in_uhz; +unsigned int fixed_refresh_in_uhz; + };struct mod_vrr_params_btr {
@@ -112,6 +114,7 @@ struct mod_vrr_params {uint32_t max_duration_in_us;uint32_t max_refresh_in_uhz;uint32_t min_duration_in_us; +uint32_t fixed_refresh_in_uhz;struct dc_crtc_timing_adjust adjust;
drivers/gpu/drm/amd/display/modules/inc/mod_shared.h +3 -2
@@ -40,8 +40,9 @@ enum color_transfer_func {enum vrr_packet_type {PACKET_TYPE_VRR , -PACKET_TYPE_FS1 , -PACKET_TYPE_FS2 , +PACKET_TYPE_FS_V1 , +PACKET_TYPE_FS_V2 , +PACKET_TYPE_FS_V3 ,PACKET_TYPE_VTEM };
Signature · 6 lines
2.26.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 17/35 drm/amd/display: Use the correct input TF for video formats
In reply to Rodrigo SiqueiraFrom: Nicholas Kazlauskas <[email protected]>
[Why]
Color blending for NV12 formats is incorrect because we're using the predefined SRGB degamma.
[How]
Calculate the correct input transfer function for degamma from the color module depending on what the actual surface format is.
--- .../amd/display/amdgpu_dm/amdgpu_dm_color.c | 22 ++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_color.c +19 -3
@@ -420,9 +420,21 @@ int amdgpu_dm_update_plane_color_mgmt(struct dm_crtc_state *crtc, {const struct drm_color_lut *degamma_lut;struct dc_plane_state *dc_plane_state = plane->dc_state; +enum dc_transfer_func_predefined tf =TRANSFER_FUNCTION_SRGB ;uint32_t degamma_size;int r; +/* Get the correct base transfer function for implicit degamma. */ +switch (dc_plane_state->format) { +case SURFACE_PIXEL_FORMAT_VIDEO_420_YCbCr: +case SURFACE_PIXEL_FORMAT_VIDEO_420_YCrCb: +/* DC doesn't have a transfer function for BT601 specifically. */ + tf =TRANSFER_FUNCTION_BT709 ; +break ; +default : +break ; + } +if (crtc->cm_has_degamma) { degamma_lut =__extract_blob_lut (crtc->base.degamma_lut, °amma_size);
@@ -456,8 +468,7 @@ int amdgpu_dm_update_plane_color_mgmt(struct dm_crtc_state *crtc,* map these to the atomic one instead. */ if (crtc->cm_is_degamma_srgb) - dc_plane_state->in_transfer_func->tf = -TRANSFER_FUNCTION_SRGB ; + dc_plane_state->in_transfer_func->tf = tf;else dc_plane_state->in_transfer_func->tf =TRANSFER_FUNCTION_LINEAR ;
@@ -472,7 +483,12 @@ int amdgpu_dm_update_plane_color_mgmt(struct dm_crtc_state *crtc,* in linear space. Assume that the input is sRGB. */ dc_plane_state->in_transfer_func->type =TF_TYPE_PREDEFINED ; - dc_plane_state->in_transfer_func->tf =TRANSFER_FUNCTION_SRGB ; + dc_plane_state->in_transfer_func->tf = tf; + +if (tf !=TRANSFER_FUNCTION_SRGB && + !mod_color_calculate_degamma_params ( + dc_plane_state->in_transfer_func,NULL , false)) +return -ENOMEM ; }else {/* ...Otherwise we can just bypass the DGM block. */ dc_plane_state->in_transfer_func->type =TF_TYPE_BYPASS ;
Signature · 6 lines
2.26.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 18/35 drm/amd/display: Fix HDR visual confirm
In reply to Rodrigo SiqueiraFrom: Aric Cyr <[email protected]>
Some cases were incorrectly reporting the wrong visual confirm, even though they were working as expected.
--- .../amd/display/dc/dcn10/dcn10_hw_sequencer.c | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-)
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c +10 -10
@@ -2130,25 +2130,25 @@ void dcn10_get_surface_visual_confirm_color(switch (pipe_ctx->plane_res.scl_data.format) {case PIXEL_FORMAT_ARGB8888 : -/* set boarder color to red */ +/* set border color to red */ color->color_r_cr = color_value;break ;case PIXEL_FORMAT_ARGB2101010 : -/* set boarder color to blue */ +/* set border color to blue */ color->color_b_cb = color_value;break ;case PIXEL_FORMAT_420BPP8 : -/* set boarder color to green */ +/* set border color to green */ color->color_g_y = color_value;break ;case PIXEL_FORMAT_420BPP10 : -/* set boarder color to yellow */ +/* set border color to yellow */ color->color_g_y = color_value; color->color_r_cr = color_value;break ;case PIXEL_FORMAT_FP16 : -/* set boarder color to white */ +/* set border color to white */ color->color_r_cr = color_value; color->color_b_cb = color_value; color->color_g_y = color_value;
@@ -2173,25 +2173,25 @@ void dcn10_get_hdr_visual_confirm_color(switch (top_pipe_ctx->plane_res.scl_data.format) {case PIXEL_FORMAT_ARGB2101010 :if (top_pipe_ctx->stream->out_transfer_func->tf ==TRANSFER_FUNCTION_PQ ) { -/* HDR10, ARGB2101010 - set boarder color to red */ +/* HDR10, ARGB2101010 - set border color to red */ color->color_r_cr = color_value; }else if (top_pipe_ctx->stream->out_transfer_func->tf ==TRANSFER_FUNCTION_GAMMA22 ) { -/* FreeSync 2 ARGB2101010 - set boarder color to pink */ +/* FreeSync 2 ARGB2101010 - set border color to pink */ color->color_r_cr = color_value; color->color_b_cb = color_value; }break ;case PIXEL_FORMAT_FP16 :if (top_pipe_ctx->stream->out_transfer_func->tf ==TRANSFER_FUNCTION_PQ ) { -/* HDR10, FP16 - set boarder color to blue */ +/* HDR10, FP16 - set border color to blue */ color->color_b_cb = color_value; }else if (top_pipe_ctx->stream->out_transfer_func->tf ==TRANSFER_FUNCTION_GAMMA22 ) { -/* FreeSync 2 HDR - set boarder color to green */ +/* FreeSync 2 HDR - set border color to green */ color->color_g_y = color_value; }break ;default : -/* SDR - set boarder color to Gray */ +/* SDR - set border color to Gray */ color->color_r_cr = color_value/2 ; color->color_b_cb = color_value/2 ; color->color_g_y = color_value/2 ;
Signature · 6 lines
2.26.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 19/35 drm/amd/display: Update MPCC if requested
In reply to Rodrigo SiqueiraFrom: Aric Cyr <[email protected]>
Don't skip MPCC tree updates if requested.
--- drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c +2 -1
@@ -2175,7 +2175,8 @@ void dcn20_update_mpcc(struct dc *dc, struct pipe_ctx *pipe_ctx) mpcc_id = hubp->inst;/* If there is no full update, don't need to touch MPC tree*/ -if (!pipe_ctx->plane_state->update_flags.bits.full_update) { +if (!pipe_ctx->plane_state->update_flags.bits.full_update && + !pipe_ctx->update_flags.bits.mpcc) { mpc->funcs->update_blending (mpc, &blnd_cfg, mpcc_id);return ; }
Signature · 6 lines
2.26.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 20/35 drm/amd/display: 3.2.81
In reply to Rodrigo SiqueiraFrom: 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
@@ -42,7 +42,7 @@#include "inc/hw/dmcu.h" #include "dml/display_mode_lib.h" -#define DC_VER "3.2.80" +#define DC_VER "3.2.81"#define MAX_SURFACES 3#define MAX_PLANES 6
Signature · 6 lines
2.26.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 21/35 drm/amd/display: Various fixes for PSR on DMCUB
In reply to Rodrigo SiqueiraFrom: Wyatt Wood <[email protected]>
[Why]
- Driver does not recognize new definitions of psr states.
- Internal tool is required for checking if psr is active.
[How]
- Parse psr state correctly so that driver will recognize psr state.
- Add visual confirmation that psr is active using existing mechanisms.
--- drivers/gpu/drm/amd/display/dc/dc.h | 1 + drivers/gpu/drm/amd/display/dc/dce/dmub_psr.c | 45 ++++++++++++++++++- .../gpu/drm/amd/display/dmub/inc/dmub_cmd.h | 6 +++ 3 files changed, 51 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/dc.h +1 -0
@@ -241,6 +241,7 @@ enum visual_confirm {VISUAL_CONFIRM_SURFACE =1 ,VISUAL_CONFIRM_HDR =2 ,VISUAL_CONFIRM_MPCTREE =4 , + VISUAL_CONFIRM_PSR = 5, }; enum dcc_option {
drivers/gpu/drm/amd/display/dc/dce/dmub_psr.c +44 -1
69 lines not on this page · raw message
drivers/gpu/drm/amd/display/dmub/inc/dmub_cmd.h +6 -0
@@ -215,6 +215,11 @@ struct dmub_rb_cmd_dpphy_init {uint8_t reserved[60 ]; }; +struct dmub_psr_debug_flags { +uint8_t visual_confirm :1 ; +uint8_t reserved :7 ; +}; +struct dmub_cmd_psr_copy_settings_data {uint16_t psr_level;uint8_t dpp_inst;
@@ -228,6 +233,7 @@ struct dmub_cmd_psr_copy_settings_data {uint8_t smu_optimizations_en;uint8_t frame_delay;uint8_t frame_cap_ind; +struct dmub_psr_debug_flags debug; };struct dmub_rb_cmd_psr_copy_settings {
Signature · 6 lines
2.26.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 22/35 drm/amd/display: Cap certain DML values for Low Pix Clk on DCN2.1
In reply to Rodrigo SiqueiraFrom: Sung Lee <[email protected]>
[WHY]
In certain conditions with low pixel clock, some values in DML may go past the max due to margining for latency hiding. This causes assertions to get hit.
[HOW]
If the pixel clock is low and some values are high, cap it to the max.
--- .../display/dc/dml/dcn21/display_rq_dlg_calc_21.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/dc/dml/dcn21/display_rq_dlg_calc_21.c +10 -2
@@ -1490,13 +1490,21 @@ static void dml_rq_dlg_get_dlg_params( disp_dlg_regs->refcyc_per_pte_group_vblank_l = (unsigned int ) (dst_y_per_row_vblank * (double ) htotal * ref_freq_to_pix_freq / (double ) dpte_groups_per_row_ub_l); -ASSERT (disp_dlg_regs->refcyc_per_pte_group_vblank_l < (unsigned int )dml_pow (2 ,13 )); +if ((refclk_freq_in_mhz / ref_freq_to_pix_freq <28 ) && + disp_dlg_regs->refcyc_per_pte_group_vblank_l >= (unsigned int )dml_pow (2 ,13 )) + disp_dlg_regs->refcyc_per_pte_group_vblank_l = (1 <<13 ) -1 ; +else +ASSERT (disp_dlg_regs->refcyc_per_pte_group_vblank_l < (unsigned int )dml_pow (2 ,13 ));if (dual_plane) { disp_dlg_regs->refcyc_per_pte_group_vblank_c = (unsigned int ) (dst_y_per_row_vblank * (double ) htotal * ref_freq_to_pix_freq / (double ) dpte_groups_per_row_ub_c); -ASSERT (disp_dlg_regs->refcyc_per_pte_group_vblank_c +if ((refclk_freq_in_mhz / ref_freq_to_pix_freq <28 ) && + disp_dlg_regs->refcyc_per_pte_group_vblank_c >= (unsigned int )dml_pow (2 ,13 )) + disp_dlg_regs->refcyc_per_pte_group_vblank_c = (1 <<13 ) -1 ; +else +ASSERT (disp_dlg_regs->refcyc_per_pte_group_vblank_c < (unsigned int )dml_pow (2 ,13 )); }
Signature · 6 lines
2.26.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 23/35 drm/amd/display: make all backlight calls link based
In reply to Rodrigo SiqueiraFrom: Anthony Koo <[email protected]>
[Why]
Backlight adjustment is tied to a specific display. So make the calls target a link rather than making it a global state.
[How]
make all backlight calls link based
--- .../amd/display/amdgpu_dm/amdgpu_dm_debugfs.c | 10 ++++--- drivers/gpu/drm/amd/display/dc/core/dc.c | 21 ------------- drivers/gpu/drm/amd/display/dc/core/dc_link.c | 30 +++++++++++++++---- drivers/gpu/drm/amd/display/dc/dc.h | 2 -- drivers/gpu/drm/amd/display/dc/dc_link.h | 2 ++ 5 files changed, 33 insertions(+), 32 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c +6 -4
@@ -1228,8 +1228,9 @@ static int current_backlight_read(struct seq_file *m, void *data)struct drm_info_node *node = (struct drm_info_node *)m->private;struct drm_device *dev = node->minor->dev;struct amdgpu_device *adev = dev->dev_private; -struct dc *dc = adev->dm.dc; -unsigned int backlight =dc_get_current_backlight_pwm (dc); +struct amdgpu_display_manager *dm = &adev->dm; + +unsigned int backlight =dc_link_get_backlight_level (dm->backlight_link);seq_printf (m,"0x%x\n" , backlight);return 0 ;
@@ -1245,8 +1246,9 @@ static int target_backlight_read(struct seq_file *m, void *data)struct drm_info_node *node = (struct drm_info_node *)m->private;struct drm_device *dev = node->minor->dev;struct amdgpu_device *adev = dev->dev_private; -struct dc *dc = adev->dm.dc; -unsigned int backlight =dc_get_target_backlight_pwm (dc); +struct amdgpu_display_manager *dm = &adev->dm; + +unsigned int backlight =dc_link_get_target_backlight_pwm (dm->backlight_link);seq_printf (m,"0x%x\n" , backlight);return 0 ;
drivers/gpu/drm/amd/display/dc/core/dc.c +0 -21
@@ -2646,33 +2646,12 @@ void dc_set_power_state(void dc_resume (struct dc *dc) { -uint32_t i;for (i =0 ; i < dc->link_count; i++)core_link_resume (dc->links[i]); } -unsigned int dc_get_current_backlight_pwm (struct dc *dc) -{ -struct abm *abm = dc->res_pool->abm; - -if (abm) -return abm->funcs->get_current_backlight (abm); - -return 0 ; -} - -unsigned int dc_get_target_backlight_pwm (struct dc *dc) -{ -struct abm *abm = dc->res_pool->abm; - -if (abm) -return abm->funcs->get_target_backlight (abm); - -return 0 ; -} -bool dc_is_dmcu_initialized (struct dc *dc) {struct dmcu *dmcu = dc->res_pool->dmcu;
drivers/gpu/drm/amd/display/dc/core/dc_link.c +25 -5
@@ -2450,6 +2450,16 @@ int dc_link_get_backlight_level(const struct dc_link *link)return (int ) abm->funcs->get_current_backlight (abm); } +int dc_link_get_target_backlight_pwm (const struct dc_link *link) +{ +struct abm *abm = link->ctx->dc->res_pool->abm; + +if (abm ==NULL || abm->funcs->get_target_backlight ==NULL ) +return DC_ERROR_UNEXPECTED ; + +return (int ) abm->funcs->get_target_backlight (abm); +} +bool dc_link_set_backlight_level (const struct dc_link *link,uint32_t backlight_pwm_u16_16,uint32_t frame_ramp)
@@ -2507,14 +2517,24 @@ bool dc_link_set_backlight_level(const struct dc_link *link,bool dc_link_set_abm_disable (const struct dc_link *link) {struct dc *dc = link->ctx->dc; -struct abm *abm = dc->res_pool->abm; +struct abm *abm =NULL ; +bool success = false; +int i; -if ((abm ==NULL ) || (abm->funcs->set_backlight_level_pwm ==NULL )) -return false; +for (i =0 ; i <MAX_PIPES ; i++) { +struct pipe_ctx pipe_ctx = dc->current_state->res_ctx.pipe_ctx[i]; +struct dc_stream_state *stream = pipe_ctx.stream; + +if (stream && stream->link == link) { + abm = pipe_ctx.stream_res.abm; +break ; + } + } - abm->funcs->set_abm_immediate_disable (abm); +if (abm) + success = abm->funcs->set_abm_immediate_disable (abm); -return true; +return success; }bool dc_link_set_psr_allow_active (struct dc_link *link,bool allow_active,bool wait)
drivers/gpu/drm/amd/display/dc/dc.h +0 -2
@@ -1139,8 +1139,6 @@ void dc_set_power_state(struct dc *dc, enum dc_acpi_cm_power_state power_state);void dc_resume (struct dc *dc); -unsigned int dc_get_current_backlight_pwm (struct dc *dc); -unsigned int dc_get_target_backlight_pwm (struct dc *dc);#if defined(CONFIG_DRM_AMD_DC_HDCP )/*
drivers/gpu/drm/amd/display/dc/dc_link.h +2 -0
@@ -217,6 +217,8 @@ bool dc_link_set_default_brightness_aux(struct dc_link *link);int dc_link_get_backlight_level (const struct dc_link *dc_link); +int dc_link_get_target_backlight_pwm (const struct dc_link *link); +bool dc_link_set_abm_disable (const struct dc_link *dc_link);bool dc_link_set_psr_allow_active (struct dc_link *dc_link,bool enable,bool wait);
Signature · 6 lines
2.26.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 24/35 drm/amd/display: move panel power seq to new panel struct
In reply to Rodrigo SiqueiraFrom: Anthony Koo <[email protected]>
[Why]
panel power sequencer is currently just sitting in hwseq but it really it tied to internal panels
[How]
make a new panel struct to contain power sequencer code
--- drivers/gpu/drm/amd/display/dc/core/dc_link.c | 22 ++++ drivers/gpu/drm/amd/display/dc/dc_link.h | 1 + drivers/gpu/drm/amd/display/dc/dce/Makefile | 2 +- .../gpu/drm/amd/display/dc/dce/dce_hwseq.h | 65 +++------- .../gpu/drm/amd/display/dc/dce/dce_panel.c | 105 ++++++++++++++++ .../gpu/drm/amd/display/dc/dce/dce_panel.h | 117 ++++++++++++++++++ .../amd/display/dc/dce100/dce100_resource.c | 31 +++++ .../display/dc/dce110/dce110_hw_sequencer.c | 37 +----- .../display/dc/dce110/dce110_hw_sequencer.h | 4 - .../amd/display/dc/dce110/dce110_resource.c | 31 +++++ .../amd/display/dc/dce112/dce112_resource.c | 31 +++++ .../amd/display/dc/dce120/dce120_resource.c | 31 +++++ .../drm/amd/display/dc/dce80/dce80_resource.c | 31 +++++ .../gpu/drm/amd/display/dc/dcn10/dcn10_init.c | 2 - .../drm/amd/display/dc/dcn10/dcn10_resource.c | 31 +++++ .../gpu/drm/amd/display/dc/dcn20/dcn20_init.c | 2 - .../drm/amd/display/dc/dcn20/dcn20_resource.c | 31 +++++ .../gpu/drm/amd/display/dc/dcn21/dcn21_init.c | 2 - .../drm/amd/display/dc/dcn21/dcn21_resource.c | 32 +++++ .../gpu/drm/amd/display/dc/inc/core_types.h | 3 + drivers/gpu/drm/amd/display/dc/inc/hw/panel.h | 53 ++++++++ .../amd/display/dc/inc/hw_sequencer_private.h | 2 - 22 files changed, 572 insertions(+), 94 deletions(-) create mode 100644 drivers/gpu/drm/amd/display/dc/dce/dce_panel.c create mode 100644 drivers/gpu/drm/amd/display/dc/dce/dce_panel.h create mode 100644 drivers/gpu/drm/amd/display/dc/inc/hw/panel.h
drivers/gpu/drm/amd/display/dc/core/dc_link.c +22 -0
@@ -47,6 +47,7 @@#include "hw/clk_mgr.h" #include "dce/dmub_psr.h" #include "dmub/inc/dmub_cmd_dal.h" +#include "inc/hw/panel.h" #define DC_LOGGER_INIT (logger)
@@ -1355,6 +1356,7 @@ static bool dc_link_construct(struct dc_link *link,struct ddc_service_init_data ddc_service_init_data = { {0 } };struct dc_context *dc_ctx = init_params->ctx;struct encoder_init_data enc_init_data = {0 }; +struct panel_init_data panel_init_data = {0 };struct integrated_info info = {{{0 }}};struct dc_bios *bios = init_params->dc->ctx->dc_bios;const struct dc_vbios_funcs *bp_funcs = bios->funcs;
@@ -1425,6 +1427,7 @@ static bool dc_link_construct(struct dc_link *link, link->irq_source_hpd_rx =dal_irq_get_rx_source (link->hpd_gpio); } +break ;case CONNECTOR_ID_LVDS : link->connector_signal =SIGNAL_TYPE_LVDS ;
@@ -1454,6 +1457,22 @@ static bool dc_link_construct(struct dc_link *link, link->ddc_hw_inst =dal_ddc_get_line (dal_ddc_service_get_ddc_pin (link->ddc)); + +if (link->dc->res_pool->funcs->panel_create && + (link->link_id.id ==CONNECTOR_ID_EDP || + link->link_id.id ==CONNECTOR_ID_LVDS )) { + panel_init_data.ctx = dc_ctx; + panel_init_data.inst =0 ; + link->panel = + link->dc->res_pool->funcs->panel_create ( + &panel_init_data); + +if (link->panel ==NULL ) { +DC_ERROR ("Failed to create link panel!\n" ); + goto panel_create_fail; + } + } + enc_init_data.ctx = dc_ctx; bp_funcs->get_src_obj (dc_ctx->dc_bios, link->link_id,0 , &enc_init_data.encoder);
@@ -1536,6 +1555,9 @@ static bool dc_link_construct(struct dc_link *link, device_tag_fail: link->link_enc->funcs->destroy (&link->link_enc); link_enc_create_fail: +if (link->panel !=NULL ) + link->panel->funcs->destroy (&link->panel); +panel_create_fail:dal_ddc_service_destroy (&link->ddc); ddc_create_fail: create_fail:
drivers/gpu/drm/amd/display/dc/dc_link.h +1 -0
@@ -135,6 +135,7 @@ struct dc_link {struct dc_context *ctx; +struct panel *panel;struct link_encoder *link_enc;struct graphics_object_id link_id;union ddi_channel_mapping ddi_channel_mapping;
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 dmub_abm.o +dce_i2c.o dce_i2c_hw.o dce_i2c_sw.o dmub_psr.o dmub_abm.o dce_panel.o AMD_DAL_DCE = $(addprefix $(AMDDALPATH)/dc/dce/,$(DCE))
drivers/gpu/drm/amd/display/dc/dce/dce_hwseq.h +15 -50
163 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/dce/dce_panel.c new file +105 -0
105 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/dce/dce_panel.h new file +117 -0
117 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/dce100/dce100_resource.c +31 -0
@@ -46,6 +46,7 @@#include "dce/dce_audio.h" #include "dce/dce_hwseq.h" #include "dce100/dce100_hw_sequencer.h" +#include "dce/dce_panel.h" #include "reg_helper.h"
@@ -249,6 +250,18 @@ static const struct dce_stream_encoder_mask se_mask = {SE_COMMON_MASK_SH_LIST_DCE80_100 (_MASK) }; +static const struct dce_panel_registers panel_regs[] = { + {DCE_PANEL_REG_LIST () } +}; + +static const struct dce_panel_shift panel_shift = { +DCE_PANEL_MASK_SH_LIST (__SHIFT) +}; + +static const struct dce_panel_mask panel_mask = { +DCE_PANEL_MASK_SH_LIST (_MASK) +}; +#define opp_regs (id)\ [id] = {\ OPP_DCE_100_REG_LIST(id),\
@@ -627,6 +640,23 @@ struct link_encoder *dce100_link_encoder_create(return &enc110->base; } +static struct panel *dce100_panel_create (const struct panel_init_data *init_data) +{ +struct dce_panel *panel = +kzalloc (sizeof (struct dce_panel ),GFP_KERNEL ); + +if (!panel) +return NULL ; + +dce_panel_construct (panel, + init_data, + &panel_regs[init_data->inst], + &panel_shift, + &panel_mask); + +return &panel->base; +} +struct output_pixel_processor *dce100_opp_create (struct dc_context *ctx,uint32_t inst)
@@ -943,6 +973,7 @@ struct stream_encoder *dce100_find_first_free_match_stream_enc_for_link(static const struct resource_funcs dce100_res_pool_funcs = { .destroy = dce100_destroy_resource_pool, .link_enc_create = dce100_link_encoder_create, + .panel_create = dce100_panel_create, .validate_bandwidth = dce100_validate_bandwidth, .validate_plane = dce100_validate_plane, .add_stream_to_ctx = dce100_add_stream_to_ctx,
drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c +6 -31
@@ -53,6 +53,7 @@#include "abm.h" #include "audio.h" #include "reg_helper.h" +#include "panel.h" /* include DCE11 register header files */ #include "dce/dce_11_0_d.h"
@@ -695,31 +696,6 @@ void dce110_enable_stream(struct pipe_ctx *pipe_ctx) -} - -/*todo: cloned in stream enc, fix*/ -bool dce110_is_panel_backlight_on (struct dc_link *link) -{ -struct dc_context *ctx = link->ctx; -struct dce_hwseq *hws = ctx->dc->hwseq; -uint32_t value; - -REG_GET (LVTMA_PWRSEQ_CNTL ,LVTMA_BLON , &value); - -return value; -} - -bool dce110_is_panel_powered_on (struct dc_link *link) -{ -struct dc_context *ctx = link->ctx; -struct dce_hwseq *hws = ctx->dc->hwseq; -uint32_t pwr_seq_state, dig_on, dig_on_ovrd; - -REG_GET (LVTMA_PWRSEQ_STATE ,LVTMA_PWRSEQ_TARGET_STATE_R , &pwr_seq_state); - -REG_GET_2 (LVTMA_PWRSEQ_CNTL ,LVTMA_DIGON , &dig_on,LVTMA_DIGON_OVRD , &dig_on_ovrd); - -return (pwr_seq_state ==1 ) || (dig_on ==1 && dig_on_ovrd ==1 ); } static enum bp_result link_transmitter_control(
@@ -810,7 +786,6 @@ void dce110_edp_power_control( bool power_up) {struct dc_context *ctx = link->ctx; -struct dce_hwseq *hwseq = ctx->dc->hwseq;struct bp_transmitter_control cntl = {0 };enum bp_result bp_result;
@@ -821,7 +796,10 @@ void dce110_edp_power_control(return ; } -if (power_up != hwseq->funcs.is_panel_powered_on (link)) { +if (link->panel) +return ; + +if (power_up != link->panel->funcs->is_panel_powered_on (link->panel)) {/* Send VBIOS command to prompt eDP panel power */ if (power_up) {unsigned long long current_ts =dm_get_timestamp (ctx);
@@ -892,7 +870,6 @@ void dce110_edp_backlight_control( bool enable) {struct dc_context *ctx = link->ctx; -struct dce_hwseq *hws = ctx->dc->hwseq;struct bp_transmitter_control cntl = {0 }; if (dal_graphics_object_id_get_connector_id(link->link_enc->connector)
@@ -901,7 +878,7 @@ void dce110_edp_backlight_control(return ; } -if (enable && hws->funcs.is_panel_backlight_on (link)) { +if (enable && link->panel && link->panel->funcs->is_panel_backlight_on (link->panel)) {DC_LOG_HW_RESUME_S3 ("%s: panel already powered up. Do nothing.\n" , __func__);
@@ -2784,8 +2761,6 @@ static const struct hwseq_private_funcs dce110_private_funcs = { .disable_stream_gating = NULL, .enable_stream_gating = NULL, .edp_backlight_control = dce110_edp_backlight_control, - .is_panel_backlight_on = dce110_is_panel_backlight_on, - .is_panel_powered_on = dce110_is_panel_powered_on, };void dce110_hw_sequencer_construct (struct dc *dc)
drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.h +0 -4
@@ -85,9 +85,5 @@ void dce110_edp_wait_for_hpd_ready(struct dc_link *link, bool power_up); -bool dce110_is_panel_backlight_on (struct dc_link *link); - -bool dce110_is_panel_powered_on (struct dc_link *link); -#endif /* __DC_HWSS_DCE110_H__ */
drivers/gpu/drm/amd/display/dc/dce110/dce110_resource.c +31 -0
@@ -53,6 +53,7 @@#include "dce/dce_abm.h" #include "dce/dce_dmcu.h" #include "dce/dce_i2c.h" +#include "dce/dce_panel.h" #define DC_LOGGER \ dc->ctx->logger
@@ -275,6 +276,18 @@ static const struct dce_stream_encoder_mask se_mask = { SE_COMMON_MASK_SH_LIST_DCE110(_MASK) }; +static const struct dce_panel_registers panel_regs[] = { + {DCE_PANEL_REG_LIST () } +}; + +static const struct dce_panel_shift panel_shift = { +DCE_PANEL_MASK_SH_LIST (__SHIFT) +}; + +static const struct dce_panel_mask panel_mask = { +DCE_PANEL_MASK_SH_LIST (_MASK) +}; +static const struct dce110_aux_registers_shift aux_shift = {DCE_AUX_MASK_SH_LIST (__SHIFT) };
@@ -673,6 +686,23 @@ static struct link_encoder *dce110_link_encoder_create(return &enc110->base; } +static struct panel *dce110_panel_create (const struct panel_init_data *init_data) +{ +struct dce_panel *panel = +kzalloc (sizeof (struct dce_panel ),GFP_KERNEL ); + +if (!panel) +return NULL ; + +dce_panel_construct (panel, + init_data, + &panel_regs[init_data->inst], + &panel_shift, + &panel_mask); + +return &panel->base; +} +static struct output_pixel_processor *dce110_opp_create (struct dc_context *ctx,uint32_t inst)
@@ -1203,6 +1233,7 @@ struct stream_encoder *dce110_find_first_free_match_stream_enc_for_link(static const struct resource_funcs dce110_res_pool_funcs = { .destroy = dce110_destroy_resource_pool, .link_enc_create = dce110_link_encoder_create, + .panel_create = dce110_panel_create, .validate_bandwidth = dce110_validate_bandwidth, .validate_plane = dce110_validate_plane, .acquire_idle_pipe_for_layer = dce110_acquire_underlay,
drivers/gpu/drm/amd/display/dc/dce112/dce112_resource.c +31 -0
@@ -51,6 +51,7 @@#include "dce/dce_dmcu.h" #include "dce/dce_aux.h" #include "dce/dce_i2c.h" +#include "dce/dce_panel.h" #include "reg_helper.h"
@@ -238,6 +239,18 @@ static const struct dce110_link_enc_aux_registers link_enc_aux_regs[] = {aux_regs (5 ) }; +static const struct dce_panel_registers panel_regs[] = { + {DCE_PANEL_REG_LIST () } +}; + +static const struct dce_panel_shift panel_shift = { +DCE_PANEL_MASK_SH_LIST (__SHIFT) +}; + +static const struct dce_panel_mask panel_mask = { +DCE_PANEL_MASK_SH_LIST (_MASK) +}; +#define hpd_regs (id)\ [id] = {\ HPD_REG_LIST(id)\
@@ -631,6 +644,23 @@ struct link_encoder *dce112_link_encoder_create(return &enc110->base; } +static struct panel *dce112_panel_create (const struct panel_init_data *init_data) +{ +struct dce_panel *panel = +kzalloc (sizeof (struct dce_panel ),GFP_KERNEL ); + +if (!panel) +return NULL ; + +dce_panel_construct (panel, + init_data, + &panel_regs[init_data->inst], + &panel_shift, + &panel_mask); + +return &panel->base; +} +static struct input_pixel_processor *dce112_ipp_create (struct dc_context *ctx,uint32_t inst) {
@@ -1021,6 +1051,7 @@ static void dce112_destroy_resource_pool(struct resource_pool **pool)static const struct resource_funcs dce112_res_pool_funcs = { .destroy = dce112_destroy_resource_pool, .link_enc_create = dce112_link_encoder_create, + .panel_create = dce112_panel_create, .validate_bandwidth = dce112_validate_bandwidth, .validate_plane = dce100_validate_plane, .add_stream_to_ctx = dce112_add_stream_to_ctx,
drivers/gpu/drm/amd/display/dc/dce120/dce120_resource.c +31 -0
@@ -44,6 +44,7 @@#include "dce/dce_clock_source.h" #include "dce/dce_ipp.h" #include "dce/dce_mem_input.h" +#include "dce/dce_panel.h" #include "dce110/dce110_hw_sequencer.h" #include "dce120/dce120_hw_sequencer.h"
@@ -293,6 +294,18 @@ static const struct dce_stream_encoder_mask se_mask = { SE_COMMON_MASK_SH_LIST_DCE120(_MASK) }; +static const struct dce_panel_registers panel_regs[] = { + {DCE_PANEL_REG_LIST () } +}; + +static const struct dce_panel_shift panel_shift = { +DCE_PANEL_MASK_SH_LIST (__SHIFT) +}; + +static const struct dce_panel_mask panel_mask = { +DCE_PANEL_MASK_SH_LIST (_MASK) +}; +static const struct dce110_aux_registers_shift aux_shift = {DCE12_AUX_MASK_SH_LIST (__SHIFT) };
@@ -715,6 +728,23 @@ static struct link_encoder *dce120_link_encoder_create(return &enc110->base; } +static struct panel *dce120_panel_create (const struct panel_init_data *init_data) +{ +struct dce_panel *panel = +kzalloc (sizeof (struct dce_panel ),GFP_KERNEL ); + +if (!panel) +return NULL ; + +dce_panel_construct (panel, + init_data, + &panel_regs[init_data->inst], + &panel_shift, + &panel_mask); + +return &panel->base; +} +static struct input_pixel_processor *dce120_ipp_create (struct dc_context *ctx,uint32_t inst) {
@@ -880,6 +910,7 @@ static void dce120_destroy_resource_pool(struct resource_pool **pool)static const struct resource_funcs dce120_res_pool_funcs = { .destroy = dce120_destroy_resource_pool, .link_enc_create = dce120_link_encoder_create, + .panel_create = dce120_panel_create, .validate_bandwidth = dce112_validate_bandwidth, .validate_plane = dce100_validate_plane, .add_stream_to_ctx = dce112_add_stream_to_ctx,
drivers/gpu/drm/amd/display/dc/dce80/dce80_resource.c +31 -0
@@ -50,6 +50,7 @@#include "dce/dce_hwseq.h" #include "dce80/dce80_hw_sequencer.h" #include "dce100/dce100_resource.h" +#include "dce/dce_panel.h" #include "reg_helper.h"
@@ -266,6 +267,18 @@ static const struct dce_stream_encoder_mask se_mask = {SE_COMMON_MASK_SH_LIST_DCE80_100 (_MASK) }; +static const struct dce_panel_registers panel_regs[] = { + {DCE_PANEL_REG_LIST () } +}; + +static const struct dce_panel_shift panel_shift = { +DCE_PANEL_MASK_SH_LIST (__SHIFT) +}; + +static const struct dce_panel_mask panel_mask = { +DCE_PANEL_MASK_SH_LIST (_MASK) +}; +#define opp_regs (id)\ [id] = {\ OPP_DCE_80_REG_LIST(id),\
@@ -728,6 +741,23 @@ struct link_encoder *dce80_link_encoder_create(return &enc110->base; } +static struct panel *dce80_panel_create (const struct panel_init_data *init_data) +{ +struct dce_panel *panel = +kzalloc (sizeof (struct dce_panel ),GFP_KERNEL ); + +if (!panel) +return NULL ; + +dce_panel_construct (panel, + init_data, + &panel_regs[init_data->inst], + &panel_shift, + &panel_mask); + +return &panel->base; +} + struct clock_source *dce80_clock_source_create( struct dc_context *ctx, struct dc_bios *bios,
@@ -909,6 +939,7 @@ static void dce80_destroy_resource_pool(struct resource_pool **pool)static const struct resource_funcs dce80_res_pool_funcs = { .destroy = dce80_destroy_resource_pool, .link_enc_create = dce80_link_encoder_create, + .panel_create = dce80_panel_create, .validate_bandwidth = dce80_validate_bandwidth, .validate_plane = dce100_validate_plane, .add_stream_to_ctx = dce100_add_stream_to_ctx,
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_init.c +0 -2
@@ -87,8 +87,6 @@ static const struct hwseq_private_funcs dcn10_private_funcs = { .reset_hw_ctx_wrap = dcn10_reset_hw_ctx_wrap, .enable_stream_timing = dcn10_enable_stream_timing, .edp_backlight_control = dce110_edp_backlight_control, - .is_panel_backlight_on = dce110_is_panel_backlight_on, - .is_panel_powered_on = dce110_is_panel_powered_on, .disable_stream_gating = NULL, .enable_stream_gating = NULL, .setup_vupdate_interrupt = dcn10_setup_vupdate_interrupt,
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_resource.c +31 -0
@@ -51,6 +51,7 @@#include "dce112/dce112_resource.h" #include "dcn10_hubp.h" #include "dcn10_hubbub.h" +#include "dce/dce_panel.h" #include "soc15_hw_ip.h" #include "vega10_ip_offset.h"
@@ -321,6 +322,18 @@ static const struct dcn10_link_enc_mask le_mask = { LINK_ENCODER_MASK_SH_LIST_DCN10(_MASK) }; +static const struct dce_panel_registers panel_regs[] = { + {DCN_PANEL_REG_LIST () } +}; + +static const struct dce_panel_shift panel_shift = { +DCE_PANEL_MASK_SH_LIST (__SHIFT) +}; + +static const struct dce_panel_mask panel_mask = { +DCE_PANEL_MASK_SH_LIST (_MASK) +}; +static const struct dce110_aux_registers_shift aux_shift = {DCN10_AUX_MASK_SH_LIST (__SHIFT) };
@@ -807,6 +820,23 @@ struct link_encoder *dcn10_link_encoder_create(return &enc10->base; } +static struct panel *dcn10_panel_create (const struct panel_init_data *init_data) +{ +struct dce_panel *panel = +kzalloc (sizeof (struct dce_panel ),GFP_KERNEL ); + +if (!panel) +return NULL ; + +dce_panel_construct (panel, + init_data, + &panel_regs[init_data->inst], + &panel_shift, + &panel_mask); + +return &panel->base; +} + struct clock_source *dcn10_clock_source_create( struct dc_context *ctx, struct dc_bios *bios,
@@ -1291,6 +1321,7 @@ static const struct dc_cap_funcs cap_funcs = {static const struct resource_funcs dcn10_res_pool_funcs = { .destroy = dcn10_destroy_resource_pool, .link_enc_create = dcn10_link_encoder_create, + .panel_create = dcn10_panel_create, .validate_bandwidth = dcn_validate_bandwidth, .acquire_idle_pipe_for_layer = dcn10_acquire_idle_pipe_for_layer, .validate_plane = dcn10_validate_plane,
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_init.c +0 -2
@@ -97,8 +97,6 @@ static const struct hwseq_private_funcs dcn20_private_funcs = { .reset_hw_ctx_wrap = dcn20_reset_hw_ctx_wrap, .enable_stream_timing = dcn20_enable_stream_timing, .edp_backlight_control = dce110_edp_backlight_control, - .is_panel_backlight_on = dce110_is_panel_backlight_on, - .is_panel_powered_on = dce110_is_panel_powered_on, .disable_stream_gating = dcn20_disable_stream_gating, .enable_stream_gating = dcn20_enable_stream_gating, .setup_vupdate_interrupt = dcn20_setup_vupdate_interrupt,
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c +31 -0
@@ -61,6 +61,7 @@#include "dcn20_dccg.h" #include "dcn20_vmid.h" #include "dc_link_ddc.h" +#include "dce/dce_panel.h" #include "navi10_ip_offset.h"
@@ -687,6 +688,18 @@ static const struct dcn10_link_enc_mask le_mask = {DPCS_DCN2_MASK_SH_LIST (_MASK) }; +static const struct dce_panel_registers panel_regs[] = { + {DCN_PANEL_REG_LIST () } +}; + +static const struct dce_panel_shift panel_shift = { +DCE_PANEL_MASK_SH_LIST (__SHIFT) +}; + +static const struct dce_panel_mask panel_mask = { +DCE_PANEL_MASK_SH_LIST (_MASK) +}; +#define ipp_regs (id)\ [id] = {\ IPP_REG_LIST_DCN20(id),\
@@ -1289,6 +1302,23 @@ struct link_encoder *dcn20_link_encoder_create(return &enc20->enc10.base; } +static struct panel *dcn20_panel_create (const struct panel_init_data *init_data) +{ +struct dce_panel *panel = +kzalloc (sizeof (struct dce_panel ),GFP_KERNEL ); + +if (!panel) +return NULL ; + +dce_panel_construct (panel, + init_data, + &panel_regs[init_data->inst], + &panel_shift, + &panel_mask); + +return &panel->base; +} + struct clock_source *dcn20_clock_source_create( struct dc_context *ctx, struct dc_bios *bios,
@@ -3189,6 +3219,7 @@ enum dc_status dcn20_patch_unknown_plane_state(struct dc_plane_state *plane_statstatic struct resource_funcs dcn20_res_pool_funcs = { .destroy = dcn20_destroy_resource_pool, .link_enc_create = dcn20_link_encoder_create, + .panel_create = dcn20_panel_create, .validate_bandwidth = dcn20_validate_bandwidth, .acquire_idle_pipe_for_layer = dcn20_acquire_idle_pipe_for_layer, .add_stream_to_ctx = dcn20_add_stream_to_ctx,
drivers/gpu/drm/amd/display/dc/dcn21/dcn21_init.c +0 -2
@@ -106,8 +106,6 @@ static const struct hwseq_private_funcs dcn21_private_funcs = { .reset_hw_ctx_wrap = dcn20_reset_hw_ctx_wrap, .enable_stream_timing = dcn20_enable_stream_timing, .edp_backlight_control = dce110_edp_backlight_control, - .is_panel_backlight_on = dce110_is_panel_backlight_on, - .is_panel_powered_on = dce110_is_panel_powered_on, .disable_stream_gating = dcn20_disable_stream_gating, .enable_stream_gating = dcn20_enable_stream_gating, .setup_vupdate_interrupt = dcn20_setup_vupdate_interrupt,
drivers/gpu/drm/amd/display/dc/dcn21/dcn21_resource.c +32 -0
@@ -61,6 +61,7 @@#include "dcn21_hubbub.h" #include "dcn10/dcn10_resource.h" #include "dce110/dce110_resource.h" +#include "dce/dce_panel.h" #include "dcn20/dcn20_dwb.h" #include "dcn20/dcn20_mmhubbub.h"
@@ -1606,6 +1607,18 @@ static const struct dcn10_link_enc_registers link_enc_regs[] = { link_regs(4, E), }; +static const struct dce_panel_registers panel_regs[] = { + {DCN_PANEL_REG_LIST () } +}; + +static const struct dce_panel_shift panel_shift = { +DCE_PANEL_MASK_SH_LIST (__SHIFT) +}; + +static const struct dce_panel_mask panel_mask = { +DCE_PANEL_MASK_SH_LIST (_MASK) +}; +#define aux_regs (id)\ [id] = {\ DCN2_AUX_REG_LIST(id)\
@@ -1691,6 +1704,24 @@ static struct link_encoder *dcn21_link_encoder_create(return &enc21->enc10.base; } + +static struct panel *dcn21_panel_create (const struct panel_init_data *init_data) +{ +struct dce_panel *panel = +kzalloc (sizeof (struct dce_panel ),GFP_KERNEL ); + +if (!panel) +return NULL ; + +dce_panel_construct (panel, + init_data, + &panel_regs[init_data->inst], + &panel_shift, + &panel_mask); + +return &panel->base; +} +#define CTX ctx#define REG (reg_name) \
@@ -1735,6 +1766,7 @@ enum dc_status dcn21_patch_unknown_plane_state(struct dc_plane_state *plane_statstatic struct resource_funcs dcn21_res_pool_funcs = { .destroy = dcn21_destroy_resource_pool, .link_enc_create = dcn21_link_encoder_create, + .panel_create = dcn21_panel_create, .validate_bandwidth = dcn21_validate_bandwidth, .populate_dml_pipes = dcn21_populate_dml_pipes_from_context, .add_stream_to_ctx = dcn20_add_stream_to_ctx,
drivers/gpu/drm/amd/display/dc/inc/core_types.h +3 -0
@@ -38,6 +38,7 @@#endif #include "dwb.h" #include "mcif_wb.h" +#include "panel.h" #define MAX_CLOCK_SOURCES 7
@@ -92,6 +93,8 @@ struct clk_bw_params;struct resource_funcs {void (*destroy)(struct resource_pool **pool);void (*link_init)(struct dc_link *link); +struct panel *(*panel_create)( +const struct panel_init_data *panel_init_data);struct link_encoder *(*link_enc_create)(const struct encoder_init_data *init); bool (*validate_bandwidth)(
drivers/gpu/drm/amd/display/dc/inc/hw/panel.h new file +53 -0
53 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/inc/hw_sequencer_private.h +0 -2
@@ -100,8 +100,6 @@ struct hwseq_private_funcs { struct dc *dc);void (*edp_backlight_control)(struct dc_link *link,bool enable); -bool (*is_panel_backlight_on)(struct dc_link *link); -bool (*is_panel_powered_on)(struct dc_link *link);void (*setup_vupdate_interrupt)(struct dc *dc,struct pipe_ctx *pipe_ctx);bool (*did_underflow_occur)(struct dc *dc,struct pipe_ctx *pipe_ctx);
Signature · 6 lines
2.26.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 25/35 drm/amd/display: dmcu wait loop calculation is incorrect in RV
In reply to Rodrigo SiqueiraFrom: Paul Hsieh <[email protected]>
[Why]
Driver already get display clock from SMU base on MHz, but driver read again and mutiple 1000 cause wait loop value is overflow.
[How]
remove coding error
--- .../drm/amd/display/dc/clk_mgr/dcn10/rv1_clk_mgr_vbios_smu.c | 3 --- 1 file changed, 3 deletions(-)
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn10/rv1_clk_mgr_vbios_smu.c +0 -3
@@ -97,9 +97,6 @@ int rv1_vbios_smu_set_dispclk(struct clk_mgr_internal *clk_mgr, int requested_di VBIOSSMC_MSG_SetDispclkFreq, requested_dispclk_khz / 1000); -/* Actual dispclk set is returned in the parameter register */ - actual_dispclk_set_mhz =REG_READ (MP1_SMN_C2PMSG_83 ) *1000 ; -if (!IS_FPGA_MAXIMUS_DC (dc->ctx->dce_environment)) {if (dmcu && dmcu->funcs->is_dmcu_initialized (dmcu)) {if (clk_mgr->dfs_bypass_disp_clk != actual_dispclk_set_mhz)
Signature · 6 lines
2.26.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 26/35 drm/amd/display: destroy panel on link destruct
In reply to Rodrigo SiqueiraFrom: Anthony Koo <[email protected]>
[Why]
without destroy it is causing a memory leak
[How]
destroy panel on link destruct
--- drivers/gpu/drm/amd/display/dc/core/dc_link.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/gpu/drm/amd/display/dc/core/dc_link.c +3 -0
@@ -88,6 +88,9 @@ static void dc_link_destruct(struct dc_link *link)if (link->ddc)dal_ddc_service_destroy (&link->ddc); +if (link->panel) + link->panel->funcs->destroy (&link->panel); +if (link->link_enc) link->link_enc->funcs->destroy (&link->link_enc);
Signature · 6 lines
2.26.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 27/35 drm/amd/display: fix virtual signal dsc setup
In reply to Rodrigo SiqueiraFrom: Dmytro Laktyushkin <[email protected]>
This prevents dpcd access on virtual links.
--- drivers/gpu/drm/amd/display/dc/core/dc_link_hwss.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/core/dc_link_hwss.c +1 -1
@@ -400,7 +400,7 @@ static bool dp_set_dsc_on_rx(struct pipe_ctx *pipe_ctx, bool enable)struct dc_stream_state *stream = pipe_ctx->stream;bool result = false; -if (IS_FPGA_MAXIMUS_DC (dc->ctx->dce_environment)) +if (dc_is_virtual_signal (stream->signal) ||IS_FPGA_MAXIMUS_DC (dc->ctx->dce_environment)) result = true;else result =dm_helpers_dp_write_dsc_enable (dc->ctx, stream, enable);
Signature · 6 lines
2.26.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 28/35 drm/amd/display: Factor in immediate flip support into DLG calculations
In reply to Rodrigo SiqueiraFrom: Nicholas Kazlauskas <[email protected]>
[Why]
We expect to be able to perform immediate flipping without having to recalculate and update all the watermarks.
There are certain usecases today (1080p @ 90deg, 2160p @ 90deg) such that we get a urgency value of 0 for frac_urg_bw_flip because we're explicitly passing in a value of "false" for requiring immediate flip support into the DLG calculation.
[How]
Always pass in true into the calculation. With this we get a correct non-zero value for frac_urg_bw_flip.
--- drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c +1 -1
@@ -3033,7 +3033,7 @@ void dcn20_calculate_dlg_params( pipe_idx, cstate_en, context->bw_ctx.bw.dcn.clk.p_state_change_support, - false, false, false); + false, false, true); context->bw_ctx.dml.funcs.rq_dlg_get_rq_reg(&context->bw_ctx.dml, &context->res_ctx.pipe_ctx[i].rq_regs,
Signature · 6 lines
2.26.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 29/35 drm/amd/display: Add HW rotation cursor changes to dcn10
In reply to Rodrigo SiqueiraFrom: Jaehyun Chung <[email protected]>
[Why]
HW rotation was enabled in DAL3 but hubp cursor calculations for HW roation were only added to dcn20.
[How]
Add hubp cursor position calculation changes to dcn10.
--- .../gpu/drm/amd/display/dc/dcn10/dcn10_hubp.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hubp.c +13 -5
@@ -1139,6 +1139,8 @@ void hubp1_cursor_set_position(int src_y_offset = pos->y - pos->y_hotspot - param->viewport.y;int x_hotspot = pos->x_hotspot;int y_hotspot = pos->y_hotspot; +int cursor_height = (int )hubp->curs_attr.height; +int cursor_width = (int )hubp->curs_attr.width;uint32_t dst_x_offset;uint32_t cur_en = pos->enable ?1 :0 ;
@@ -1152,10 +1154,16 @@ void hubp1_cursor_set_position(if (hubp->curs_attr.address.quad_part ==0 )return ; +// Rotated cursor width/height and hotspots tweaks for offset calculation if (param->rotation ==ROTATION_ANGLE_90 || param->rotation ==ROTATION_ANGLE_270 ) { - src_x_offset = pos->y - pos->y_hotspot - param->viewport.x; - y_hotspot = pos->x_hotspot; - x_hotspot = pos->y_hotspot; +swap (cursor_height, cursor_width); +if (param->rotation ==ROTATION_ANGLE_90 ) { + src_x_offset = pos->x - pos->y_hotspot - param->viewport.x; + src_y_offset = pos->y - pos->x_hotspot - param->viewport.y; + } + }else if (param->rotation ==ROTATION_ANGLE_180 ) { + src_x_offset = pos->x - param->viewport.x; + src_y_offset = pos->y - param->viewport.y; }if (param->mirror) {
@@ -1177,13 +1185,13 @@ void hubp1_cursor_set_position(if (src_x_offset >= (int )param->viewport.width) cur_en =0 ;/* not visible beyond right edge*/ -if (src_x_offset + (int )hubp->curs_attr.width <=0 ) +if (src_x_offset + cursor_width <=0 ) cur_en =0 ;/* not visible beyond left edge*/ if (src_y_offset >= (int )param->viewport.height) cur_en =0 ;/* not visible beyond bottom edge*/ -if (src_y_offset + (int )hubp->curs_attr.height <=0 ) +if (src_y_offset + cursor_height <=0 ) cur_en =0 ;/* not visible beyond top edge*/ if (cur_en &®_READ (CURSOR_SURFACE_ADDRESS ) ==0 )
Signature · 6 lines
2.26.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 30/35 drm/amd/display: change from panel to panel cntl
In reply to Rodrigo SiqueiraFrom: Anthony Koo <[email protected]>
[Why]
it doesn't represent panel specifically, it's more like the control logic for the panel
[How]
change from panel to panel cntl to make it a bit more clear
---
drivers/gpu/drm/amd/display/dc/core/dc_link.c | 34 ++++----
drivers/gpu/drm/amd/display/dc/dc_link.h | 2 +-
drivers/gpu/drm/amd/display/dc/dce/Makefile | 2 +-
.../dc/dce/{dce_panel.c => dce_panel_cntl.c} | 64 +++++++-------
.../dc/dce/{dce_panel.h => dce_panel_cntl.h} | 86 +++++++++----------
.../amd/display/dc/dce100/dce100_resource.c | 34 ++++----
.../display/dc/dce110/dce110_hw_sequencer.c | 10 ++-
.../amd/display/dc/dce110/dce110_resource.c | 34 ++++----
.../amd/display/dc/dce112/dce112_resource.c | 34 ++++----
.../amd/display/dc/dce120/dce120_resource.c | 34 ++++----
.../drm/amd/display/dc/dce80/dce80_resource.c | 34 ++++----
.../drm/amd/display/dc/dcn10/dcn10_resource.c | 34 ++++----
.../drm/amd/display/dc/dcn20/dcn20_resource.c | 34 ++++----
.../drm/amd/display/dc/dcn21/dcn21_resource.c | 34 ++++----
.../gpu/drm/amd/display/dc/inc/core_types.h | 6 +-
.../dc/inc/hw/{panel.h => panel_cntl.h} | 24 +++---
16 files changed, 251 insertions(+), 249 deletions(-)
rename drivers/gpu/drm/amd/display/dc/dce/{dce_panel.c => dce_panel_cntl.c} (55%)
rename drivers/gpu/drm/amd/display/dc/dce/{dce_panel.h => dce_panel_cntl.h} (50%)
rename drivers/gpu/drm/amd/display/dc/inc/hw/{panel.h => panel_cntl.h} (75%)drivers/gpu/drm/amd/display/dc/core/dc_link.c +17 -17
@@ -47,7 +47,7 @@#include "hw/clk_mgr.h" #include "dce/dmub_psr.h" #include "dmub/inc/dmub_cmd_dal.h" -#include "inc/hw/panel.h" +#include "inc/hw/panel_cntl.h" #define DC_LOGGER_INIT (logger)
@@ -88,8 +88,8 @@ static void dc_link_destruct(struct dc_link *link)if (link->ddc)dal_ddc_service_destroy (&link->ddc); -if (link->panel) - link->panel->funcs->destroy (&link->panel); +if (link->panel_cntl) + link->panel_cntl->funcs->destroy (&link->panel_cntl);if (link->link_enc) link->link_enc->funcs->destroy (&link->link_enc);
@@ -1359,7 +1359,7 @@ static bool dc_link_construct(struct dc_link *link,struct ddc_service_init_data ddc_service_init_data = { {0 } };struct dc_context *dc_ctx = init_params->ctx;struct encoder_init_data enc_init_data = {0 }; -struct panel_init_data panel_init_data = {0 }; +struct panel_cntl_init_data panel_cntl_init_data = {0 };struct integrated_info info = {{{0 }}};struct dc_bios *bios = init_params->dc->ctx->dc_bios;const struct dc_vbios_funcs *bp_funcs = bios->funcs;
@@ -1461,18 +1461,18 @@ static bool dc_link_construct(struct dc_link *link,dal_ddc_get_line (dal_ddc_service_get_ddc_pin (link->ddc)); -if (link->dc->res_pool->funcs->panel_create && +if (link->dc->res_pool->funcs->panel_cntl_create && (link->link_id.id ==CONNECTOR_ID_EDP || link->link_id.id ==CONNECTOR_ID_LVDS )) { - panel_init_data.ctx = dc_ctx; - panel_init_data.inst =0 ; - link->panel = - link->dc->res_pool->funcs->panel_create ( - &panel_init_data); - -if (link->panel ==NULL ) { -DC_ERROR ("Failed to create link panel!\n" ); - goto panel_create_fail; + panel_cntl_init_data.ctx = dc_ctx; + panel_cntl_init_data.inst =0 ; + link->panel_cntl = + link->dc->res_pool->funcs->panel_cntl_create ( + &panel_cntl_init_data); + +if (link->panel_cntl ==NULL ) { +DC_ERROR ("Failed to create link panel_cntl!\n" ); + goto panel_cntl_create_fail; } }
@@ -1558,9 +1558,9 @@ static bool dc_link_construct(struct dc_link *link, device_tag_fail: link->link_enc->funcs->destroy (&link->link_enc); link_enc_create_fail: -if (link->panel !=NULL ) - link->panel->funcs->destroy (&link->panel); -panel_create_fail: +if (link->panel_cntl !=NULL ) + link->panel_cntl->funcs->destroy (&link->panel_cntl); +panel_cntl_create_fail:dal_ddc_service_destroy (&link->ddc); ddc_create_fail: create_fail:
drivers/gpu/drm/amd/display/dc/dc_link.h +1 -1
@@ -135,7 +135,7 @@ struct dc_link {struct dc_context *ctx; -struct panel *panel; +struct panel_cntl *panel_cntl;struct link_encoder *link_enc;struct graphics_object_id link_id;union ddi_channel_mapping ddi_channel_mapping;
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 dmub_abm.o dce_panel.o +dce_i2c.o dce_i2c_hw.o dce_i2c_sw.o dmub_psr.o dmub_abm.o dce_panel_cntl.o AMD_DAL_DCE = $(addprefix $(AMDDALPATH)/dc/dce/,$(DCE))
drivers/gpu/drm/amd/display/dc/dce/dce_panel_cntl.c renamed from drivers/gpu/drm/amd/display/dc/dce/dce_panel.c +32 -32
108 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/dce/dce_panel_cntl.h renamed from drivers/gpu/drm/amd/display/dc/dce/dce_panel.h +43 -43
129 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/dce100/dce100_resource.c +17 -17
@@ -46,7 +46,7 @@#include "dce/dce_audio.h" #include "dce/dce_hwseq.h" #include "dce100/dce100_hw_sequencer.h" -#include "dce/dce_panel.h" +#include "dce/dce_panel_cntl.h" #include "reg_helper.h"
@@ -250,16 +250,16 @@ static const struct dce_stream_encoder_mask se_mask = { SE_COMMON_MASK_SH_LIST_DCE80_100(_MASK) }; -static const struct dce_panel_registers panel_regs[] = { - {DCE_PANEL_REG_LIST () } +static const struct dce_panel_cntl_registers panel_cntl_regs[] = { + {DCE_PANEL_CNTL_REG_LIST () } }; -static const struct dce_panel_shift panel_shift = { -DCE_PANEL_MASK_SH_LIST (__SHIFT) +static const struct dce_panel_cntl_shift panel_cntl_shift = { +DCE_PANEL_CNTL_MASK_SH_LIST (__SHIFT) }; -static const struct dce_panel_mask panel_mask = { -DCE_PANEL_MASK_SH_LIST (_MASK) +static const struct dce_panel_cntl_mask panel_cntl_mask = { +DCE_PANEL_CNTL_MASK_SH_LIST (_MASK) };#define opp_regs (id)\
@@ -640,21 +640,21 @@ struct link_encoder *dce100_link_encoder_create(return &enc110->base; } -static struct panel *dce100_panel_create (const struct panel_init_data *init_data) +static struct panel_cntl *dce100_panel_cntl_create (const struct panel_cntl_init_data *init_data) { -struct dce_panel *panel = -kzalloc (sizeof (struct dce_panel ),GFP_KERNEL ); +struct dce_panel_cntl *panel_cntl = +kzalloc (sizeof (struct dce_panel_cntl ),GFP_KERNEL ); -if (!panel) +if (!panel_cntl)return NULL ; -dce_panel_construct (panel, +dce_panel_cntl_construct (panel_cntl, init_data, - &panel_regs[init_data->inst], - &panel_shift, - &panel_mask); + &panel_cntl_regs[init_data->inst], + &panel_cntl_shift, + &panel_cntl_mask); -return &panel->base; +return &panel_cntl->base; } struct output_pixel_processor *dce100_opp_create(
@@ -973,7 +973,7 @@ struct stream_encoder *dce100_find_first_free_match_stream_enc_for_link(static const struct resource_funcs dce100_res_pool_funcs = { .destroy = dce100_destroy_resource_pool, .link_enc_create = dce100_link_encoder_create, - .panel_create = dce100_panel_create, + .panel_cntl_create = dce100_panel_cntl_create, .validate_bandwidth = dce100_validate_bandwidth, .validate_plane = dce100_validate_plane, .add_stream_to_ctx = dce100_add_stream_to_ctx,
drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c +6 -4
@@ -53,7 +53,7 @@#include "abm.h" #include "audio.h" #include "reg_helper.h" -#include "panel.h" +#include "panel_cntl.h" /* include DCE11 register header files */ #include "dce/dce_11_0_d.h"
@@ -796,10 +796,11 @@ void dce110_edp_power_control(return ; } -if (link->panel) +if (link->panel_cntl)return ; -if (power_up != link->panel->funcs->is_panel_powered_on (link->panel)) { +if (power_up != + link->panel_cntl->funcs->is_panel_powered_on (link->panel_cntl)) {/* Send VBIOS command to prompt eDP panel power */ if (power_up) {unsigned long long current_ts =dm_get_timestamp (ctx);
@@ -878,7 +879,8 @@ void dce110_edp_backlight_control(return ; } -if (enable && link->panel && link->panel->funcs->is_panel_backlight_on (link->panel)) { +if (enable && link->panel_cntl && + link->panel_cntl->funcs->is_panel_backlight_on (link->panel_cntl)) {DC_LOG_HW_RESUME_S3 ("%s: panel already powered up. Do nothing.\n" , __func__);
drivers/gpu/drm/amd/display/dc/dce110/dce110_resource.c +17 -17
@@ -53,7 +53,7 @@#include "dce/dce_abm.h" #include "dce/dce_dmcu.h" #include "dce/dce_i2c.h" -#include "dce/dce_panel.h" +#include "dce/dce_panel_cntl.h" #define DC_LOGGER \ dc->ctx->logger
@@ -276,16 +276,16 @@ static const struct dce_stream_encoder_mask se_mask = {SE_COMMON_MASK_SH_LIST_DCE110 (_MASK) }; -static const struct dce_panel_registers panel_regs[] = { - {DCE_PANEL_REG_LIST () } +static const struct dce_panel_cntl_registers panel_cntl_regs[] = { + {DCE_PANEL_CNTL_REG_LIST () } }; -static const struct dce_panel_shift panel_shift = { -DCE_PANEL_MASK_SH_LIST (__SHIFT) +static const struct dce_panel_cntl_shift panel_cntl_shift = { +DCE_PANEL_CNTL_MASK_SH_LIST (__SHIFT) }; -static const struct dce_panel_mask panel_mask = { -DCE_PANEL_MASK_SH_LIST (_MASK) +static const struct dce_panel_cntl_mask panel_cntl_mask = { +DCE_PANEL_CNTL_MASK_SH_LIST (_MASK) };static const struct dce110_aux_registers_shift aux_shift = {
@@ -686,21 +686,21 @@ static struct link_encoder *dce110_link_encoder_create(return &enc110->base; } -static struct panel *dce110_panel_create (const struct panel_init_data *init_data) +static struct panel_cntl *dce110_panel_cntl_create (const struct panel_cntl_init_data *init_data) { -struct dce_panel *panel = -kzalloc (sizeof (struct dce_panel ),GFP_KERNEL ); +struct dce_panel_cntl *panel_cntl = +kzalloc (sizeof (struct dce_panel_cntl ),GFP_KERNEL ); -if (!panel) +if (!panel_cntl)return NULL ; -dce_panel_construct (panel, +dce_panel_cntl_construct (panel_cntl, init_data, - &panel_regs[init_data->inst], - &panel_shift, - &panel_mask); + &panel_cntl_regs[init_data->inst], + &panel_cntl_shift, + &panel_cntl_mask); -return &panel->base; +return &panel_cntl->base; } static struct output_pixel_processor *dce110_opp_create(
@@ -1233,7 +1233,7 @@ struct stream_encoder *dce110_find_first_free_match_stream_enc_for_link(static const struct resource_funcs dce110_res_pool_funcs = { .destroy = dce110_destroy_resource_pool, .link_enc_create = dce110_link_encoder_create, - .panel_create = dce110_panel_create, + .panel_cntl_create = dce110_panel_cntl_create, .validate_bandwidth = dce110_validate_bandwidth, .validate_plane = dce110_validate_plane, .acquire_idle_pipe_for_layer = dce110_acquire_underlay,
drivers/gpu/drm/amd/display/dc/dce112/dce112_resource.c +17 -17
@@ -51,7 +51,7 @@#include "dce/dce_dmcu.h" #include "dce/dce_aux.h" #include "dce/dce_i2c.h" -#include "dce/dce_panel.h" +#include "dce/dce_panel_cntl.h" #include "reg_helper.h"
@@ -239,16 +239,16 @@ static const struct dce110_link_enc_aux_registers link_enc_aux_regs[] = { aux_regs(5) }; -static const struct dce_panel_registers panel_regs[] = { - {DCE_PANEL_REG_LIST () } +static const struct dce_panel_cntl_registers panel_cntl_regs[] = { + {DCE_PANEL_CNTL_REG_LIST () } }; -static const struct dce_panel_shift panel_shift = { -DCE_PANEL_MASK_SH_LIST (__SHIFT) +static const struct dce_panel_cntl_shift panel_cntl_shift = { +DCE_PANEL_CNTL_MASK_SH_LIST (__SHIFT) }; -static const struct dce_panel_mask panel_mask = { -DCE_PANEL_MASK_SH_LIST (_MASK) +static const struct dce_panel_cntl_mask panel_cntl_mask = { +DCE_PANEL_CNTL_MASK_SH_LIST (_MASK) };#define hpd_regs (id)\
@@ -644,21 +644,21 @@ struct link_encoder *dce112_link_encoder_create(return &enc110->base; } -static struct panel *dce112_panel_create (const struct panel_init_data *init_data) +static struct panel_cntl *dce112_panel_cntl_create (const struct panel_cntl_init_data *init_data) { -struct dce_panel *panel = -kzalloc (sizeof (struct dce_panel ),GFP_KERNEL ); +struct dce_panel_cntl *panel_cntl = +kzalloc (sizeof (struct dce_panel_cntl ),GFP_KERNEL ); -if (!panel) +if (!panel_cntl)return NULL ; -dce_panel_construct (panel, +dce_panel_cntl_construct (panel_cntl, init_data, - &panel_regs[init_data->inst], - &panel_shift, - &panel_mask); + &panel_cntl_regs[init_data->inst], + &panel_cntl_shift, + &panel_cntl_mask); -return &panel->base; +return &panel_cntl->base; } static struct input_pixel_processor *dce112_ipp_create(
@@ -1051,7 +1051,7 @@ static void dce112_destroy_resource_pool(struct resource_pool **pool)static const struct resource_funcs dce112_res_pool_funcs = { .destroy = dce112_destroy_resource_pool, .link_enc_create = dce112_link_encoder_create, - .panel_create = dce112_panel_create, + .panel_cntl_create = dce112_panel_cntl_create, .validate_bandwidth = dce112_validate_bandwidth, .validate_plane = dce100_validate_plane, .add_stream_to_ctx = dce112_add_stream_to_ctx,
drivers/gpu/drm/amd/display/dc/dce120/dce120_resource.c +17 -17
@@ -44,7 +44,7 @@#include "dce/dce_clock_source.h" #include "dce/dce_ipp.h" #include "dce/dce_mem_input.h" -#include "dce/dce_panel.h" +#include "dce/dce_panel_cntl.h" #include "dce110/dce110_hw_sequencer.h" #include "dce120/dce120_hw_sequencer.h"
@@ -294,16 +294,16 @@ static const struct dce_stream_encoder_mask se_mask = {SE_COMMON_MASK_SH_LIST_DCE120 (_MASK) }; -static const struct dce_panel_registers panel_regs[] = { - {DCE_PANEL_REG_LIST () } +static const struct dce_panel_cntl_registers panel_cntl_regs[] = { + {DCE_PANEL_CNTL_REG_LIST () } }; -static const struct dce_panel_shift panel_shift = { -DCE_PANEL_MASK_SH_LIST (__SHIFT) +static const struct dce_panel_cntl_shift panel_cntl_shift = { +DCE_PANEL_CNTL_MASK_SH_LIST (__SHIFT) }; -static const struct dce_panel_mask panel_mask = { -DCE_PANEL_MASK_SH_LIST (_MASK) +static const struct dce_panel_cntl_mask panel_cntl_mask = { +DCE_PANEL_CNTL_MASK_SH_LIST (_MASK) };static const struct dce110_aux_registers_shift aux_shift = {
@@ -728,21 +728,21 @@ static struct link_encoder *dce120_link_encoder_create(return &enc110->base; } -static struct panel *dce120_panel_create (const struct panel_init_data *init_data) +static struct panel_cntl *dce120_panel_cntl_create (const struct panel_cntl_init_data *init_data) { -struct dce_panel *panel = -kzalloc (sizeof (struct dce_panel ),GFP_KERNEL ); +struct dce_panel_cntl *panel_cntl = +kzalloc (sizeof (struct dce_panel_cntl ),GFP_KERNEL ); -if (!panel) +if (!panel_cntl)return NULL ; -dce_panel_construct (panel, +dce_panel_cntl_construct (panel_cntl, init_data, - &panel_regs[init_data->inst], - &panel_shift, - &panel_mask); + &panel_cntl_regs[init_data->inst], + &panel_cntl_shift, + &panel_cntl_mask); -return &panel->base; +return &panel_cntl->base; } static struct input_pixel_processor *dce120_ipp_create(
@@ -910,7 +910,7 @@ static void dce120_destroy_resource_pool(struct resource_pool **pool)static const struct resource_funcs dce120_res_pool_funcs = { .destroy = dce120_destroy_resource_pool, .link_enc_create = dce120_link_encoder_create, - .panel_create = dce120_panel_create, + .panel_cntl_create = dce120_panel_cntl_create, .validate_bandwidth = dce112_validate_bandwidth, .validate_plane = dce100_validate_plane, .add_stream_to_ctx = dce112_add_stream_to_ctx,
drivers/gpu/drm/amd/display/dc/dce80/dce80_resource.c +17 -17
@@ -50,7 +50,7 @@#include "dce/dce_hwseq.h" #include "dce80/dce80_hw_sequencer.h" #include "dce100/dce100_resource.h" -#include "dce/dce_panel.h" +#include "dce/dce_panel_cntl.h" #include "reg_helper.h"
@@ -267,16 +267,16 @@ static const struct dce_stream_encoder_mask se_mask = { SE_COMMON_MASK_SH_LIST_DCE80_100(_MASK) }; -static const struct dce_panel_registers panel_regs[] = { - {DCE_PANEL_REG_LIST () } +static const struct dce_panel_cntl_registers panel_cntl_regs[] = { + {DCE_PANEL_CNTL_REG_LIST () } }; -static const struct dce_panel_shift panel_shift = { -DCE_PANEL_MASK_SH_LIST (__SHIFT) +static const struct dce_panel_cntl_shift panel_cntl_shift = { +DCE_PANEL_CNTL_MASK_SH_LIST (__SHIFT) }; -static const struct dce_panel_mask panel_mask = { -DCE_PANEL_MASK_SH_LIST (_MASK) +static const struct dce_panel_cntl_mask panel_cntl_mask = { +DCE_PANEL_CNTL_MASK_SH_LIST (_MASK) };#define opp_regs (id)\
@@ -741,21 +741,21 @@ struct link_encoder *dce80_link_encoder_create(return &enc110->base; } -static struct panel *dce80_panel_create (const struct panel_init_data *init_data) +static struct panel_cntl *dce80_panel_cntl_create (const struct panel_cntl_init_data *init_data) { -struct dce_panel *panel = -kzalloc (sizeof (struct dce_panel ),GFP_KERNEL ); +struct dce_panel_cntl *panel_cntl = +kzalloc (sizeof (struct dce_panel_cntl ),GFP_KERNEL ); -if (!panel) +if (!panel_cntl)return NULL ; -dce_panel_construct (panel, +dce_panel_cntl_construct (panel_cntl, init_data, - &panel_regs[init_data->inst], - &panel_shift, - &panel_mask); + &panel_cntl_regs[init_data->inst], + &panel_cntl_shift, + &panel_cntl_mask); -return &panel->base; +return &panel_cntl->base; } struct clock_source *dce80_clock_source_create(
@@ -939,7 +939,7 @@ static void dce80_destroy_resource_pool(struct resource_pool **pool)static const struct resource_funcs dce80_res_pool_funcs = { .destroy = dce80_destroy_resource_pool, .link_enc_create = dce80_link_encoder_create, - .panel_create = dce80_panel_create, + .panel_cntl_create = dce80_panel_cntl_create, .validate_bandwidth = dce80_validate_bandwidth, .validate_plane = dce100_validate_plane, .add_stream_to_ctx = dce100_add_stream_to_ctx,
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_resource.c +17 -17
@@ -51,7 +51,7 @@#include "dce112/dce112_resource.h" #include "dcn10_hubp.h" #include "dcn10_hubbub.h" -#include "dce/dce_panel.h" +#include "dce/dce_panel_cntl.h" #include "soc15_hw_ip.h" #include "vega10_ip_offset.h"
@@ -322,16 +322,16 @@ static const struct dcn10_link_enc_mask le_mask = {LINK_ENCODER_MASK_SH_LIST_DCN10 (_MASK) }; -static const struct dce_panel_registers panel_regs[] = { - {DCN_PANEL_REG_LIST () } +static const struct dce_panel_cntl_registers panel_cntl_regs[] = { + {DCN_PANEL_CNTL_REG_LIST () } }; -static const struct dce_panel_shift panel_shift = { -DCE_PANEL_MASK_SH_LIST (__SHIFT) +static const struct dce_panel_cntl_shift panel_cntl_shift = { +DCE_PANEL_CNTL_MASK_SH_LIST (__SHIFT) }; -static const struct dce_panel_mask panel_mask = { -DCE_PANEL_MASK_SH_LIST (_MASK) +static const struct dce_panel_cntl_mask panel_cntl_mask = { +DCE_PANEL_CNTL_MASK_SH_LIST (_MASK) };static const struct dce110_aux_registers_shift aux_shift = {
@@ -820,21 +820,21 @@ struct link_encoder *dcn10_link_encoder_create(return &enc10->base; } -static struct panel *dcn10_panel_create (const struct panel_init_data *init_data) +static struct panel_cntl *dcn10_panel_cntl_create (const struct panel_cntl_init_data *init_data) { -struct dce_panel *panel = -kzalloc (sizeof (struct dce_panel ),GFP_KERNEL ); +struct dce_panel_cntl *panel_cntl = +kzalloc (sizeof (struct dce_panel_cntl ),GFP_KERNEL ); -if (!panel) +if (!panel_cntl)return NULL ; -dce_panel_construct (panel, +dce_panel_cntl_construct (panel_cntl, init_data, - &panel_regs[init_data->inst], - &panel_shift, - &panel_mask); + &panel_cntl_regs[init_data->inst], + &panel_cntl_shift, + &panel_cntl_mask); -return &panel->base; +return &panel_cntl->base; } struct clock_source *dcn10_clock_source_create(
@@ -1321,7 +1321,7 @@ static const struct dc_cap_funcs cap_funcs = {static const struct resource_funcs dcn10_res_pool_funcs = { .destroy = dcn10_destroy_resource_pool, .link_enc_create = dcn10_link_encoder_create, - .panel_create = dcn10_panel_create, + .panel_cntl_create = dcn10_panel_cntl_create, .validate_bandwidth = dcn_validate_bandwidth, .acquire_idle_pipe_for_layer = dcn10_acquire_idle_pipe_for_layer, .validate_plane = dcn10_validate_plane,
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c +17 -17
@@ -61,7 +61,7 @@#include "dcn20_dccg.h" #include "dcn20_vmid.h" #include "dc_link_ddc.h" -#include "dce/dce_panel.h" +#include "dce/dce_panel_cntl.h" #include "navi10_ip_offset.h"
@@ -688,16 +688,16 @@ static const struct dcn10_link_enc_mask le_mask = { DPCS_DCN2_MASK_SH_LIST(_MASK) }; -static const struct dce_panel_registers panel_regs[] = { - {DCN_PANEL_REG_LIST () } +static const struct dce_panel_cntl_registers panel_cntl_regs[] = { + {DCN_PANEL_CNTL_REG_LIST () } }; -static const struct dce_panel_shift panel_shift = { -DCE_PANEL_MASK_SH_LIST (__SHIFT) +static const struct dce_panel_cntl_shift panel_cntl_shift = { +DCE_PANEL_CNTL_MASK_SH_LIST (__SHIFT) }; -static const struct dce_panel_mask panel_mask = { -DCE_PANEL_MASK_SH_LIST (_MASK) +static const struct dce_panel_cntl_mask panel_cntl_mask = { +DCE_PANEL_CNTL_MASK_SH_LIST (_MASK) };#define ipp_regs (id)\
@@ -1302,21 +1302,21 @@ struct link_encoder *dcn20_link_encoder_create(return &enc20->enc10.base; } -static struct panel *dcn20_panel_create (const struct panel_init_data *init_data) +static struct panel_cntl *dcn20_panel_cntl_create (const struct panel_cntl_init_data *init_data) { -struct dce_panel *panel = -kzalloc (sizeof (struct dce_panel ),GFP_KERNEL ); +struct dce_panel_cntl *panel_cntl = +kzalloc (sizeof (struct dce_panel_cntl ),GFP_KERNEL ); -if (!panel) +if (!panel_cntl)return NULL ; -dce_panel_construct (panel, +dce_panel_cntl_construct (panel_cntl, init_data, - &panel_regs[init_data->inst], - &panel_shift, - &panel_mask); + &panel_cntl_regs[init_data->inst], + &panel_cntl_shift, + &panel_cntl_mask); -return &panel->base; +return &panel_cntl->base; } struct clock_source *dcn20_clock_source_create(
@@ -3219,7 +3219,7 @@ enum dc_status dcn20_patch_unknown_plane_state(struct dc_plane_state *plane_statstatic struct resource_funcs dcn20_res_pool_funcs = { .destroy = dcn20_destroy_resource_pool, .link_enc_create = dcn20_link_encoder_create, - .panel_create = dcn20_panel_create, + .panel_cntl_create = dcn20_panel_cntl_create, .validate_bandwidth = dcn20_validate_bandwidth, .acquire_idle_pipe_for_layer = dcn20_acquire_idle_pipe_for_layer, .add_stream_to_ctx = dcn20_add_stream_to_ctx,
drivers/gpu/drm/amd/display/dc/dcn21/dcn21_resource.c +17 -17
@@ -61,7 +61,7 @@#include "dcn21_hubbub.h" #include "dcn10/dcn10_resource.h" #include "dce110/dce110_resource.h" -#include "dce/dce_panel.h" +#include "dce/dce_panel_cntl.h" #include "dcn20/dcn20_dwb.h" #include "dcn20/dcn20_mmhubbub.h"
@@ -1607,16 +1607,16 @@ static const struct dcn10_link_enc_registers link_enc_regs[] = { link_regs(4, E), }; -static const struct dce_panel_registers panel_regs[] = { - {DCN_PANEL_REG_LIST () } +static const struct dce_panel_cntl_registers panel_cntl_regs[] = { + {DCN_PANEL_CNTL_REG_LIST () } }; -static const struct dce_panel_shift panel_shift = { -DCE_PANEL_MASK_SH_LIST (__SHIFT) +static const struct dce_panel_cntl_shift panel_cntl_shift = { +DCE_PANEL_CNTL_MASK_SH_LIST (__SHIFT) }; -static const struct dce_panel_mask panel_mask = { -DCE_PANEL_MASK_SH_LIST (_MASK) +static const struct dce_panel_cntl_mask panel_cntl_mask = { +DCE_PANEL_CNTL_MASK_SH_LIST (_MASK) };#define aux_regs (id)\
@@ -1705,21 +1705,21 @@ static struct link_encoder *dcn21_link_encoder_create(return &enc21->enc10.base; } -static struct panel *dcn21_panel_create (const struct panel_init_data *init_data) +static struct panel_cntl *dcn21_panel_cntl_create (const struct panel_cntl_init_data *init_data) { -struct dce_panel *panel = -kzalloc (sizeof (struct dce_panel ),GFP_KERNEL ); +struct dce_panel_cntl *panel_cntl = +kzalloc (sizeof (struct dce_panel_cntl ),GFP_KERNEL ); -if (!panel) +if (!panel_cntl)return NULL ; -dce_panel_construct (panel, +dce_panel_cntl_construct (panel_cntl, init_data, - &panel_regs[init_data->inst], - &panel_shift, - &panel_mask); + &panel_cntl_regs[init_data->inst], + &panel_cntl_shift, + &panel_cntl_mask); -return &panel->base; +return &panel_cntl->base; }#define CTX ctx
@@ -1766,7 +1766,7 @@ enum dc_status dcn21_patch_unknown_plane_state(struct dc_plane_state *plane_statstatic struct resource_funcs dcn21_res_pool_funcs = { .destroy = dcn21_destroy_resource_pool, .link_enc_create = dcn21_link_encoder_create, - .panel_create = dcn21_panel_create, + .panel_cntl_create = dcn21_panel_cntl_create, .validate_bandwidth = dcn21_validate_bandwidth, .populate_dml_pipes = dcn21_populate_dml_pipes_from_context, .add_stream_to_ctx = dcn20_add_stream_to_ctx,
drivers/gpu/drm/amd/display/dc/inc/core_types.h +3 -3
@@ -38,7 +38,7 @@#endif #include "dwb.h" #include "mcif_wb.h" -#include "panel.h" +#include "panel_cntl.h" #define MAX_CLOCK_SOURCES 7
@@ -93,8 +93,8 @@ struct clk_bw_params;struct resource_funcs {void (*destroy)(struct resource_pool **pool);void (*link_init)(struct dc_link *link); -struct panel *(*panel_create)( -const struct panel_init_data *panel_init_data); +struct panel_cntl *(*panel_cntl_create)( +const struct panel_cntl_init_data *panel_cntl_init_data);struct link_encoder *(*link_enc_create)(const struct encoder_init_data *init); bool (*validate_bandwidth)(
drivers/gpu/drm/amd/display/dc/inc/hw/panel_cntl.h renamed from drivers/gpu/drm/amd/display/dc/inc/hw/panel.h +12 -12
@@ -21,33 +21,33 @@* */ /* -* panel.h +* panel_cntl.h * * Created on: Oct 6, 2015 * Author: yonsun */ -#ifndef DC_PANEL_H_ -#define DC_PANEL_H_ +#ifndef DC_PANEL_CNTL_H_ +#define DC_PANEL_CNTL_H_ #include "dc_types.h" -struct panel_funcs { -void (*destroy)(struct panel **panel); -void (*hw_init)(struct panel *panel); -bool (*is_panel_backlight_on)(struct panel *panel); -bool (*is_panel_powered_on)(struct panel *panel); +struct panel_cntl_funcs { +void (*destroy)(struct panel_cntl **panel_cntl); +void (*hw_init)(struct panel_cntl *panel_cntl); +bool (*is_panel_backlight_on)(struct panel_cntl *panel_cntl); +bool (*is_panel_powered_on)(struct panel_cntl *panel_cntl); }; -struct panel_init_data { +struct panel_cntl_init_data {struct dc_context *ctx;uint32_t inst; }; -struct panel { -const struct panel_funcs *funcs; +struct panel_cntl { +const struct panel_cntl_funcs *funcs;struct dc_context *ctx;uint32_t inst; }; -#endif /* DC_PANEL_H_ */ +#endif /* DC_PANEL_CNTL_H_ */
Signature · 6 lines
2.26.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 31/35 drm/amd/display: DispalyPort: Write OUI only if panel supports it
In reply to Rodrigo SiqueiraFrom: Aurabindo Pillai <[email protected]>
[why]
Organizational Unit Identifier register is optional, and its presence is published via Down Stream Port Count register. Writing this register when not available will result in errors
[how]
Read this register and continue writing OUI only if the panel has the support advertised.
--- drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c +15 -0
@@ -4218,6 +4218,21 @@ void dp_set_fec_enable(struct dc_link *link, bool enable)void dpcd_set_source_specific_data (struct dc_link *link) {const uint32_t post_oui_delay =30 ;// 30ms +uint8_t dspc =0 ; +enum dc_status ret =DC_ERROR_UNEXPECTED ; + + ret =core_link_read_dpcd (link,DP_DOWN_STREAM_PORT_COUNT , &dspc, +sizeof (dspc)); + +if (ret !=DC_OK ) { +DC_LOG_ERROR ("Error in DP aux read transaction," +" not writing source specific data\n" ); +return ; + } + +/* Return if OUI unsupported */ +if (!(dspc &DP_OUI_SUPPORT )) +return ;if (!link->dc->vendor_signature.is_valid) {struct dpcd_amd_signature amd_signature;
Signature · 6 lines
2.26.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 32/35 drm/amd/display: blank dp stream before re-train the link
In reply to Rodrigo SiqueiraFrom: Xiaodong Yan <[email protected]>
[Why]
When link loss happened, monitor can not light up if only re-train the link.
[How]
Blank all the DP streams on this link before re-train the link, and then unblank the stream
--- drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c +12 -0
@@ -2899,6 +2899,12 @@ bool dc_link_handle_hpd_rx_irq(struct dc_link *link, union hpd_irq_data *out_hpdsizeof (hpd_irq_dpcd_data), "Status: "); +for (i =0 ; i <MAX_PIPES ; i++) { + pipe_ctx = &link->dc->current_state->res_ctx.pipe_ctx[i]; +if (pipe_ctx && pipe_ctx->stream && pipe_ctx->stream->link == link) + link->dc->hwss.blank_stream (pipe_ctx); + } +for (i =0 ; i <MAX_PIPES ; i++) { pipe_ctx = &link->dc->current_state->res_ctx.pipe_ctx[i];if (pipe_ctx && pipe_ctx->stream && pipe_ctx->stream->link == link)
@@ -2918,6 +2924,12 @@ bool dc_link_handle_hpd_rx_irq(struct dc_link *link, union hpd_irq_data *out_hpdif (pipe_ctx->stream->signal ==SIGNAL_TYPE_DISPLAY_PORT_MST )dc_link_reallocate_mst_payload (link); +for (i =0 ; i <MAX_PIPES ; i++) { + pipe_ctx = &link->dc->current_state->res_ctx.pipe_ctx[i]; +if (pipe_ctx && pipe_ctx->stream && pipe_ctx->stream->link == link) + link->dc->hwss.unblank_stream (pipe_ctx, &previous_link_settings); + } + status = false;if (out_link_loss) *out_link_loss = true;
Signature · 6 lines
2.26.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 33/35 drm/amd/display: access ABM from stream resource.
In reply to Rodrigo SiqueiraFrom: Yongqiang Sun <[email protected]>
[Why]
Since ABM resource is mapped to stream res, all the ABM access should via stream res.
[How]
Get ABM instance from stream res instead of resource pool.
--- drivers/gpu/drm/amd/display/dc/core/dc_link.c | 39 +++++++++++-------- 1 file changed, 23 insertions(+), 16 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc_link.c +23 -16
@@ -2465,9 +2465,28 @@ enum dc_status dc_link_validate_mode_timing(return DC_OK ; } +static struct abm *get_abm_from_stream_res (const struct dc_link *link) +{ +int i; +struct dc *dc = link->ctx->dc; +struct abm *abm =NULL ; + +for (i =0 ; i <MAX_PIPES ; i++) { +struct pipe_ctx pipe_ctx = dc->current_state->res_ctx.pipe_ctx[i]; +struct dc_stream_state *stream = pipe_ctx.stream; + +if (stream && stream->link == link) { + abm = pipe_ctx.stream_res.abm; +break ; + } + } +return abm; +} +int dc_link_get_backlight_level (const struct dc_link *link) { -struct abm *abm = link->ctx->dc->res_pool->abm; + +struct abm *abm =get_abm_from_stream_res (link);if (abm ==NULL || abm->funcs->get_current_backlight ==NULL )return DC_ERROR_UNEXPECTED ;
@@ -2477,7 +2496,7 @@ int dc_link_get_backlight_level(const struct dc_link *link)int dc_link_get_target_backlight_pwm (const struct dc_link *link) { -struct abm *abm = link->ctx->dc->res_pool->abm; +struct abm *abm =get_abm_from_stream_res (link);if (abm ==NULL || abm->funcs->get_target_backlight ==NULL )return DC_ERROR_UNEXPECTED ;
@@ -2490,7 +2509,7 @@ bool dc_link_set_backlight_level(const struct dc_link *link, uint32_t frame_ramp) {struct dc *dc = link->ctx->dc; -struct abm *abm = dc->res_pool->abm; +struct abm *abm =get_abm_from_stream_res (link);struct dmcu *dmcu = dc->res_pool->dmcu;unsigned int controller_id =0 ;bool fw_set_brightness = true;
@@ -2541,20 +2560,8 @@ bool dc_link_set_backlight_level(const struct dc_link *link,bool dc_link_set_abm_disable (const struct dc_link *link) { -struct dc *dc = link->ctx->dc; -struct abm *abm =NULL ; +struct abm *abm =get_abm_from_stream_res (link);bool success = false; -int i; - -for (i =0 ; i <MAX_PIPES ; i++) { -struct pipe_ctx pipe_ctx = dc->current_state->res_ctx.pipe_ctx[i]; -struct dc_stream_state *stream = pipe_ctx.stream; - -if (stream && stream->link == link) { - abm = pipe_ctx.stream_res.abm; -break ; - } - }if (abm) success = abm->funcs->set_abm_immediate_disable (abm);
Signature · 6 lines
2.26.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 34/35 drm/amd/display: Adjust refactored dm for color management only
In reply to Rodrigo SiqueiraFrom: Stylon Wang <[email protected]>
[Why]
Commit 4ca3f1217e6106779aea9ebabdd09f695d42f2ff is causing regression from changing the order of call sequence.
[How]
Keep the call sequence and take in extra dm state only if plane-level color management is enabled.
--- .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 23 ++++++++++--------- .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h | 2 +- .../amd/display/amdgpu_dm/amdgpu_dm_color.c | 3 +-- 3 files changed, 14 insertions(+), 14 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +12 -11
@@ -3778,12 +3778,11 @@ fill_dc_plane_info_and_addr(struct amdgpu_device *adev, }static int fill_dc_plane_attributes (struct amdgpu_device *adev, -struct dm_plane_state *dm_plane_state, +struct dc_plane_state *dc_plane_state,struct drm_plane_state *plane_state,struct drm_crtc_state *crtc_state) {struct dm_crtc_state *dm_crtc_state =to_dm_crtc_state (crtc_state); -struct dc_plane_state *dc_plane_state = dm_plane_state->dc_state;const struct amdgpu_framebuffer *amdgpu_fb =to_amdgpu_framebuffer (plane_state->fb);struct dc_scaling_info scaling_info;
@@ -3831,7 +3830,7 @@ static int fill_dc_plane_attributes(struct amdgpu_device *adev,* Always set input transfer function, since plane state is refreshed * every time. */ - ret =amdgpu_dm_update_plane_color_mgmt (dm_crtc_state, dm_plane_state); + ret =amdgpu_dm_update_plane_color_mgmt (dm_crtc_state, dc_plane_state);if (ret)return ret;
@@ -8037,6 +8036,16 @@ static int dm_update_plane_state(struct dc *dc,DRM_DEBUG_DRIVER ("Enabling DRM plane: %d on DRM crtc %d\n" , plane->base.id, new_plane_crtc->base.id); + ret =fill_dc_plane_attributes ( + new_plane_crtc->dev->dev_private, + dc_new_plane_state, + new_plane_state, + new_crtc_state); +if (ret) { +dc_plane_state_release (dc_new_plane_state); +return ret; + } + ret =dm_atomic_get_state (state, &dm_state);if (ret) {dc_plane_state_release (dc_new_plane_state);
@@ -8062,14 +8071,6 @@ static int dm_update_plane_state(struct dc *dc, dm_new_plane_state->dc_state = dc_new_plane_state; - ret =fill_dc_plane_attributes ( - new_plane_crtc->dev->dev_private, - dm_new_plane_state, - new_plane_state, - new_crtc_state); -if (ret) -return ret; -/* Tell DC to do a full surface update every time there * is a plane change. Inefficient, but works for now. */
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h +1 -1
@@ -482,7 +482,7 @@ void amdgpu_dm_update_freesync_caps(struct drm_connector *connector,void amdgpu_dm_init_color_mod (void );int amdgpu_dm_update_crtc_color_mgmt (struct dm_crtc_state *crtc);int amdgpu_dm_update_plane_color_mgmt (struct dm_crtc_state *crtc, -struct dm_plane_state *plane); +struct dc_plane_state *dc_plane_state);void amdgpu_dm_update_connector_after_detect (struct amdgpu_dm_connector *aconnector);
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_color.c +1 -2
@@ -416,10 +416,9 @@ int amdgpu_dm_update_crtc_color_mgmt(struct dm_crtc_state *crtc)* Returns 0 on success. */ int amdgpu_dm_update_plane_color_mgmt (struct dm_crtc_state *crtc, -struct dm_plane_state *plane) +struct dc_plane_state *dc_plane_state) {const struct drm_color_lut *degamma_lut; -struct dc_plane_state *dc_plane_state = plane->dc_state;enum dc_transfer_func_predefined tf =TRANSFER_FUNCTION_SRGB ;uint32_t degamma_size;int r;
Signature · 6 lines
2.26.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 35/35 drm/amd/display: Fix green screen issue after suspend
In reply to Rodrigo Siqueira[why]
We have seen a green screen after resume from suspend in a Raven system connected with two displays (HDMI and DP) on X based system. We noticed that this issue is related to bad DCC metadata from user space which may generate hangs and consequently an underflow on HUBP. After taking a deep look at the code path we realized that after resume we try to restore the commit with the DCC enabled framebuffer but the framebuffer is no longer valid.
[how]
This problem was only reported on Raven based system and after suspend, for this reason, this commit adds a new parameter on fill_plane_dcc_attributes() to give the option of disabling DCC programmatically. In summary, for disabling DCC we first verify if is a Raven system and if it is in suspend; if both conditions are true we disable DCC temporarily, otherwise, it is enabled.
--- .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 38 ++++++++++++++----- 1 file changed, 29 insertions(+), 9 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +29 -9
@@ -3421,7 +3421,8 @@ fill_plane_dcc_attributes(struct amdgpu_device *adev,const union dc_tiling_info *tiling_info, const uint64_t info, struct dc_plane_dcc_param *dcc, - struct dc_plane_address *address) + struct dc_plane_address *address, + bool force_disable_dcc) { struct dc *dc = adev->dm.dc;struct dc_dcc_surface_param input;
@@ -3433,6 +3434,9 @@ fill_plane_dcc_attributes(struct amdgpu_device *adev,memset (&input,0 ,sizeof (input));memset (&output,0 ,sizeof (output)); +if (force_disable_dcc) +return 0 ; +if (!offset)return 0 ;
@@ -3483,7 +3487,8 @@ fill_plane_buffer_attributes(struct amdgpu_device *adev,struct plane_size *plane_size, struct dc_plane_dcc_param *dcc, struct dc_plane_address *address, - bool tmz_surface) + bool tmz_surface, + bool force_disable_dcc) { const struct drm_framebuffer *fb = &afb->base;int ret;
@@ -3591,7 +3596,8 @@ fill_plane_buffer_attributes(struct amdgpu_device *adev, ret =fill_plane_dcc_attributes (adev, afb, format, rotation, plane_size, tiling_info, - tiling_flags, dcc, address); + tiling_flags, dcc, address, + force_disable_dcc);if (ret)return ret; }
@@ -3684,7 +3690,8 @@ fill_dc_plane_info_and_addr(struct amdgpu_device *adev,const uint64_t tiling_flags, struct dc_plane_info *plane_info, struct dc_plane_address *address, - bool tmz_surface) + bool tmz_surface, + bool force_disable_dcc) { const struct drm_framebuffer *fb = plane_state->fb; const struct amdgpu_framebuffer *afb =
@@ -3766,7 +3773,8 @@ fill_dc_plane_info_and_addr(struct amdgpu_device *adev, plane_info->rotation, tiling_flags, &plane_info->tiling_info, &plane_info->plane_size, - &plane_info->dcc, address, tmz_surface); + &plane_info->dcc, address, + tmz_surface, force_disable_dcc);if (ret)return ret;
@@ -3790,6 +3798,7 @@ static int fill_dc_plane_attributes(struct amdgpu_device *adev,uint64_t tiling_flags;int ret;bool tmz_surface = false; +bool force_disable_dcc = false; ret =fill_dc_scaling_info (plane_state, &scaling_info);if (ret)
@@ -3804,10 +3813,12 @@ static int fill_dc_plane_attributes(struct amdgpu_device *adev,if (ret)return ret; + force_disable_dcc = adev->asic_type ==CHIP_RAVEN && adev->in_suspend; ret =fill_dc_plane_info_and_addr (adev, plane_state, tiling_flags, &plane_info, &dc_plane_state->address, - tmz_surface); + tmz_surface, + force_disable_dcc);if (ret)return ret;
@@ -5429,6 +5440,7 @@ static int dm_plane_helper_prepare_fb(struct drm_plane *plane,uint32_t domain;int r;bool tmz_surface = false; +bool force_disable_dcc = false; dm_plane_state_old =to_dm_plane_state (plane->state); dm_plane_state_new =to_dm_plane_state (new_state);
@@ -5489,11 +5501,13 @@ static int dm_plane_helper_prepare_fb(struct drm_plane *plane, dm_plane_state_old->dc_state != dm_plane_state_new->dc_state) {struct dc_plane_state *plane_state = dm_plane_state_new->dc_state; + force_disable_dcc = adev->asic_type ==CHIP_RAVEN && adev->in_suspend;fill_plane_buffer_attributes ( adev, afb, plane_state->format, plane_state->rotation, tiling_flags, &plane_state->tiling_info, &plane_state->plane_size, &plane_state->dcc, - &plane_state->address, tmz_surface); + &plane_state->address, tmz_surface, + force_disable_dcc); }return 0 ;
@@ -6773,7 +6787,12 @@ static void amdgpu_dm_commit_planes(struct drm_atomic_state *state,fill_dc_plane_info_and_addr ( dm->adev, new_plane_state, tiling_flags, &bundle->plane_infos[planes_count], - &bundle->flip_addrs[planes_count].address, tmz_surface); + &bundle->flip_addrs[planes_count].address, tmz_surface, + false); + +DRM_DEBUG_DRIVER ("plane: id=%d dcc_en=%d\n" , + new_plane_state->plane->index, + bundle->plane_infos[planes_count].dcc.enable); bundle->surface_updates[planes_count].plane_info = &bundle->plane_infos[planes_count];
@@ -8196,7 +8215,8 @@ dm_determine_update_type_for_commit(struct amdgpu_display_manager *dm, ret =fill_dc_plane_info_and_addr ( dm->adev, new_plane_state, tiling_flags, plane_info, - &flip_addr->address, tmz_surface); + &flip_addr->address, tmz_surface, + false);if (ret) goto cleanup;
Signature · 6 lines
2.26.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx