xref: /linux/Documentation/gpu/amdgpu/display/dc-debug.rst (revision c41028a2a16303e5a59e11338d6ef5475945c79d)
17971fb35SRodrigo Siqueira========================
2e91f8401SRodrigo SiqueiraDisplay Core Debug tools
3e91f8401SRodrigo Siqueira========================
4e91f8401SRodrigo Siqueira
5b2568d68SRodrigo SiqueiraDC Visual Confirmation
6b2568d68SRodrigo Siqueira======================
7b2568d68SRodrigo Siqueira
8b2568d68SRodrigo SiqueiraDisplay core provides a feature named visual confirmation, which is a set of
9b2568d68SRodrigo Siqueirabars added at the scanout time by the driver to convey some specific
10b2568d68SRodrigo Siqueirainformation. In general, you can enable this debug option by using::
11b2568d68SRodrigo Siqueira
12b2568d68SRodrigo Siqueira  echo <N> > /sys/kernel/debug/dri/0/amdgpu_dm_visual_confirm
13b2568d68SRodrigo Siqueira
14b2568d68SRodrigo SiqueiraWhere `N` is an integer number for some specific scenarios that the developer
15b2568d68SRodrigo Siqueirawants to enable, you will see some of these debug cases in the following
16b2568d68SRodrigo Siqueirasubsection.
177971fb35SRodrigo Siqueira
187971fb35SRodrigo SiqueiraMultiple Planes Debug
197971fb35SRodrigo Siqueira---------------------
207971fb35SRodrigo Siqueira
217971fb35SRodrigo SiqueiraIf you want to enable or debug multiple planes in a specific user-space
227971fb35SRodrigo Siqueiraapplication, you can leverage a debug feature named visual confirm. For
237971fb35SRodrigo Siqueiraenabling it, you will need::
247971fb35SRodrigo Siqueira
257971fb35SRodrigo Siqueira  echo 1 > /sys/kernel/debug/dri/0/amdgpu_dm_visual_confirm
267971fb35SRodrigo Siqueira
277971fb35SRodrigo SiqueiraYou need to reload your GUI to see the visual confirmation. When the plane
287971fb35SRodrigo Siqueiraconfiguration changes or a full update occurs there will be a colored bar at
297971fb35SRodrigo Siqueirathe bottom of each hardware plane being drawn on the screen.
307971fb35SRodrigo Siqueira
317971fb35SRodrigo Siqueira* The color indicates the format - For example, red is AR24 and green is NV12
327971fb35SRodrigo Siqueira* The height of the bar indicates the index of the plane
337971fb35SRodrigo Siqueira* Pipe split can be observed if there are two bars with a difference in height
347971fb35SRodrigo Siqueira  covering the same plane
357971fb35SRodrigo Siqueira
367971fb35SRodrigo SiqueiraConsider the video playback case in which a video is played in a specific
377971fb35SRodrigo Siqueiraplane, and the desktop is drawn in another plane. The video plane should
387971fb35SRodrigo Siqueirafeature one or two green bars at the bottom of the video depending on pipe
397971fb35SRodrigo Siqueirasplit configuration.
407971fb35SRodrigo Siqueira
417971fb35SRodrigo Siqueira* There should **not** be any visual corruption
427971fb35SRodrigo Siqueira* There should **not** be any underflow or screen flashes
437971fb35SRodrigo Siqueira* There should **not** be any black screens
447971fb35SRodrigo Siqueira* There should **not** be any cursor corruption
457971fb35SRodrigo Siqueira* Multiple plane **may** be briefly disabled during window transitions or
467971fb35SRodrigo Siqueira  resizing but should come back after the action has finished
47b2568d68SRodrigo Siqueira
48b2568d68SRodrigo SiqueiraPipe Split Debug
49b2568d68SRodrigo Siqueira----------------
50b2568d68SRodrigo Siqueira
51b2568d68SRodrigo SiqueiraSometimes we need to debug if DCN is splitting pipes correctly, and visual
52b2568d68SRodrigo Siqueiraconfirmation is also handy for this case. Similar to the MPO case, you can use
53b2568d68SRodrigo Siqueirathe below command to enable visual confirmation::
54b2568d68SRodrigo Siqueira
55b2568d68SRodrigo Siqueira  echo 1 > /sys/kernel/debug/dri/0/amdgpu_dm_visual_confirm
56b2568d68SRodrigo Siqueira
57b2568d68SRodrigo SiqueiraIn this case, if you have a pipe split, you will see one small red bar at the
58b2568d68SRodrigo Siqueirabottom of the display covering the entire display width and another bar
59b2568d68SRodrigo Siqueiracovering the second pipe. In other words, you will see a bit high bar in the
60b2568d68SRodrigo Siqueirasecond pipe.
6176659755SRodrigo Siqueira
6276659755SRodrigo SiqueiraDTN Debug
6376659755SRodrigo Siqueira=========
6476659755SRodrigo Siqueira
6576659755SRodrigo SiqueiraDC (DCN) provides an extensive log that dumps multiple details from our
6676659755SRodrigo Siqueirahardware configuration. Via debugfs, you can capture those status values by
6776659755SRodrigo Siqueirausing Display Test Next (DTN) log, which can be captured via debugfs by using::
6876659755SRodrigo Siqueira
6976659755SRodrigo Siqueira  cat /sys/kernel/debug/dri/0/amdgpu_dm_dtn_log
7076659755SRodrigo Siqueira
7176659755SRodrigo SiqueiraSince this log is updated accordingly with DCN status, you can also follow the
7276659755SRodrigo Siqueirachange in real-time by using something like::
7376659755SRodrigo Siqueira
7476659755SRodrigo Siqueira  sudo watch -d cat /sys/kernel/debug/dri/0/amdgpu_dm_dtn_log
7576659755SRodrigo Siqueira
7676659755SRodrigo SiqueiraWhen reporting a bug related to DC, consider attaching this log before and
7776659755SRodrigo Siqueiraafter you reproduce the bug.
78*c41028a2SHamza Mahfooz
79*c41028a2SHamza MahfoozDMUB Firmware Debug
80*c41028a2SHamza Mahfooz===================
81*c41028a2SHamza Mahfooz
82*c41028a2SHamza MahfoozSometimes, dmesg logs aren't enough. This is especially true if a feature is
83*c41028a2SHamza Mahfoozimplemented primarily in DMUB firmware. In such cases, all we see in dmesg when
84*c41028a2SHamza Mahfoozan issue arises is some generic timeout error. So, to get more relevant
85*c41028a2SHamza Mahfoozinformation, we can trace DMUB commands by enabling the relevant bits in
86*c41028a2SHamza Mahfooz`amdgpu_dm_dmub_trace_mask`.
87*c41028a2SHamza Mahfooz
88*c41028a2SHamza MahfoozCurrently, we support the tracing of the following groups:
89*c41028a2SHamza Mahfooz
90*c41028a2SHamza MahfoozTrace Groups
91*c41028a2SHamza Mahfooz------------
92*c41028a2SHamza Mahfooz
93*c41028a2SHamza Mahfooz.. csv-table::
94*c41028a2SHamza Mahfooz   :header-rows: 1
95*c41028a2SHamza Mahfooz   :widths: 1, 1
96*c41028a2SHamza Mahfooz   :file: ./trace-groups-table.csv
97*c41028a2SHamza Mahfooz
98*c41028a2SHamza Mahfooz**Note: Not all ASICs support all of the listed trace groups**
99*c41028a2SHamza Mahfooz
100*c41028a2SHamza MahfoozSo, to enable just PSR tracing you can use the following command::
101*c41028a2SHamza Mahfooz
102*c41028a2SHamza Mahfooz  # echo 0x8020 > /sys/kernel/debug/dri/0/amdgpu_dm_dmub_trace_mask
103*c41028a2SHamza Mahfooz
104*c41028a2SHamza MahfoozThen, you need to enable logging trace events to the buffer, which you can do
105*c41028a2SHamza Mahfoozusing the following::
106*c41028a2SHamza Mahfooz
107*c41028a2SHamza Mahfooz  # echo 1 > /sys/kernel/debug/dri/0/amdgpu_dm_dmcub_trace_event_en
108*c41028a2SHamza Mahfooz
109*c41028a2SHamza MahfoozLastly, after you are able to reproduce the issue you are trying to debug,
110*c41028a2SHamza Mahfoozyou can disable tracing and read the trace log by using the following::
111*c41028a2SHamza Mahfooz
112*c41028a2SHamza Mahfooz  # echo 0 > /sys/kernel/debug/dri/0/amdgpu_dm_dmcub_trace_event_en
113*c41028a2SHamza Mahfooz  # cat /sys/kernel/debug/dri/0/amdgpu_dm_dmub_tracebuffer
114*c41028a2SHamza Mahfooz
115*c41028a2SHamza MahfoozSo, when reporting bugs related to features such as PSR and ABM, consider
116*c41028a2SHamza Mahfoozenabling the relevant bits in the mask before reproducing the issue and
117*c41028a2SHamza Mahfoozattach the log that you obtain from the trace buffer in any bug reports that you
118*c41028a2SHamza Mahfoozcreate.
119