Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/amd/display: Add events log to trace OPTC lock and unlock

As an attempt to offer more DCN debug tools for cases where the OPTC can
hang, this commit introduces a trace event responsible for showing OPTC
status when it requests lock and unlock.

Tested-by: Mark Broadworth <mark.broadworth@amd.com>
Reviewed-by: Aurabindo Pillai <Aurabindo.Pillai@amd.com>
Acked-by: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Signed-off-by: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

authored by

Rodrigo Siqueira and committed by
Alex Deucher
f1943a51 6be153dc

+80
+64
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_trace.h
··· 37 37 #include <drm/drm_framebuffer.h> 38 38 #include <drm/drm_encoder.h> 39 39 #include <drm/drm_atomic.h> 40 + #include "dcn10/dcn10_optc.h" 40 41 41 42 #include "dc/inc/core_types.h" 42 43 ··· 660 659 __entry->recursion_depth, 661 660 __entry->function, 662 661 __entry->line 662 + ) 663 + ); 664 + 665 + TRACE_EVENT(dcn_optc_lock_unlock_state, 666 + TP_PROTO(const struct optc *optc_state, int instance, bool lock, const char *function, const int line), 667 + TP_ARGS(optc_state, instance, lock, function, line), 668 + 669 + TP_STRUCT__entry( 670 + __field(const char *, function) 671 + __field(int, instance) 672 + __field(bool, lock) 673 + __field(int, line) 674 + __field(int, opp_count) 675 + __field(int, max_h_total) 676 + __field(int, max_v_total) 677 + __field(int, min_h_blank) 678 + __field(int, min_h_sync_width) 679 + __field(int, min_v_sync_width) 680 + __field(int, min_v_blank) 681 + __field(int, min_v_blank_interlace) 682 + __field(int, vstartup_start) 683 + __field(int, vupdate_offset) 684 + __field(int, vupdate_width) 685 + __field(int, vready_offset) 686 + ), 687 + TP_fast_assign( 688 + __entry->function = function; 689 + __entry->instance = instance; 690 + __entry->lock = lock; 691 + __entry->line = line; 692 + __entry->opp_count = optc_state->opp_count; 693 + __entry->max_h_total = optc_state->max_h_total; 694 + __entry->max_v_total = optc_state->max_v_total; 695 + __entry->min_h_blank = optc_state->min_h_blank; 696 + __entry->min_h_sync_width = optc_state->min_h_sync_width; 697 + __entry->min_v_sync_width = optc_state->min_v_sync_width; 698 + __entry->min_v_blank = optc_state->min_v_blank; 699 + __entry->min_v_blank_interlace = optc_state->min_v_blank_interlace; 700 + __entry->vstartup_start = optc_state->vstartup_start; 701 + __entry->vupdate_offset = optc_state->vupdate_offset; 702 + __entry->vupdate_width = optc_state->vupdate_width; 703 + __entry->vready_offset = optc_state->vupdate_offset; 704 + ), 705 + TP_printk("%s: %s()+%d: optc_instance=%d opp_count=%d max_h_total=%d max_v_total=%d " 706 + "min_h_blank=%d min_h_sync_width=%d min_v_sync_width=%d min_v_blank=%d " 707 + "min_v_blank_interlace=%d vstartup_start=%d vupdate_offset=%d vupdate_width=%d " 708 + "vready_offset=%d", 709 + __entry->lock ? "Lock" : "Unlock", 710 + __entry->function, 711 + __entry->line, 712 + __entry->instance, 713 + __entry->opp_count, 714 + __entry->max_h_total, 715 + __entry->max_v_total, 716 + __entry->min_h_blank, 717 + __entry->min_h_sync_width, 718 + __entry->min_v_sync_width, 719 + __entry->min_v_blank, 720 + __entry->min_v_blank_interlace, 721 + __entry->vstartup_start, 722 + __entry->vupdate_offset, 723 + __entry->vupdate_width, 724 + __entry->vready_offset 663 725 ) 664 726 ); 665 727
+2
drivers/gpu/drm/amd/display/dc/dc_trace.h
··· 40 40 41 41 #define TRACE_DCN_FPU(begin, function, line, ref_count) \ 42 42 trace_dcn_fpu(begin, function, line, ref_count) 43 + #define TRACE_OPTC_LOCK_UNLOCK_STATE(optc, inst, lock) \ 44 + trace_dcn_optc_lock_unlock_state(optc, inst, lock, __func__, __LINE__)
+5
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_optc.c
··· 27 27 #include "reg_helper.h" 28 28 #include "dcn10_optc.h" 29 29 #include "dc.h" 30 + #include "dc_trace.h" 30 31 31 32 #define REG(reg)\ 32 33 optc1->tg_regs->reg ··· 658 657 REG_WAIT(OTG_MASTER_UPDATE_LOCK, 659 658 UPDATE_LOCK_STATUS, 1, 660 659 1, 10); 660 + 661 + TRACE_OPTC_LOCK_UNLOCK_STATE(optc1, optc->inst, true); 661 662 } 662 663 663 664 void optc1_unlock(struct timing_generator *optc) ··· 668 665 669 666 REG_SET(OTG_MASTER_UPDATE_LOCK, 0, 670 667 OTG_MASTER_UPDATE_LOCK, 0); 668 + 669 + TRACE_OPTC_LOCK_UNLOCK_STATE(optc1, optc->inst, false); 671 670 } 672 671 673 672 void optc1_get_position(struct timing_generator *optc,
+9
drivers/gpu/drm/amd/display/dc/dcn30/dcn30_optc.c
··· 30 30 #include "dc_dmub_srv.h" 31 31 32 32 #include "dml/dcn30/dcn30_fpu.h" 33 + #include "dc_trace.h" 33 34 34 35 #define REG(reg)\ 35 36 optc1->tg_regs->reg ··· 59 58 REG_WAIT(OTG_MASTER_UPDATE_LOCK, 60 59 UPDATE_LOCK_STATUS, 1, 61 60 1, 10); 61 + 62 + TRACE_OPTC_LOCK_UNLOCK_STATE(optc1, optc->inst, true); 62 63 } 63 64 64 65 void optc3_lock_doublebuffer_enable(struct timing_generator *optc) ··· 96 93 MASTER_UPDATE_LOCK_VUPDATE_KEEPOUT_START_OFFSET, 0, 97 94 MASTER_UPDATE_LOCK_VUPDATE_KEEPOUT_END_OFFSET, 100, 98 95 OTG_MASTER_UPDATE_LOCK_VUPDATE_KEEPOUT_EN, 1); 96 + 97 + TRACE_OPTC_LOCK_UNLOCK_STATE(optc1, optc->inst, true); 99 98 } 100 99 101 100 void optc3_lock_doublebuffer_disable(struct timing_generator *optc) ··· 113 108 114 109 REG_UPDATE(OTG_GLOBAL_CONTROL2, GLOBAL_UPDATE_LOCK_EN, 0); 115 110 REG_UPDATE(OTG_GLOBAL_CONTROL0, MASTER_UPDATE_LOCK_DB_EN, 0); 111 + 112 + TRACE_OPTC_LOCK_UNLOCK_STATE(optc1, optc->inst, true); 116 113 } 117 114 118 115 void optc3_lock(struct timing_generator *optc) ··· 129 122 REG_WAIT(OTG_MASTER_UPDATE_LOCK, 130 123 UPDATE_LOCK_STATUS, 1, 131 124 1, 10); 125 + 126 + TRACE_OPTC_LOCK_UNLOCK_STATE(optc1, optc->inst, true); 132 127 } 133 128 134 129 void optc3_set_out_mux(struct timing_generator *optc, enum otg_out_mux_dest dest)