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

Configure Feed

Select the types of activity you want to include in your feed.

drm/amd/display: Add a trace event for brightness programming

[Why]
Brightness programming may involve a conversion of a user requested
brightness against what was in a custom brightness curve. The values
might not match what a user programmed.

[How]
Add a new trace event to show specific converted brightness values.

Reviewed-by: Alex Hung <alex.hung@amd.com>
Link: https://lore.kernel.org/r/20250623171114.1156451-2-mario.limonciello@amd.com
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

authored by

Mario Limonciello and committed by
Alex Deucher
009bfc5e 5b852044

+52
+18
Documentation/gpu/amdgpu/debugging.rst
··· 85 85 GPU debugging and diagnostics tool. Please see the umr 86 86 `documentation <https://umr.readthedocs.io/en/main/>`_ for more information 87 87 about its capabilities. 88 + 89 + Debugging backlight brightness 90 + ============================== 91 + Default backlight brightness is intended to be set via the policy advertised 92 + by the firmware. Firmware will often provide different defaults for AC or DC. 93 + Furthermore, some userspace software will save backlight brightness during 94 + the previous boot and attempt to restore it. 95 + 96 + Some firmware also has support for a feature called "Custom Backlight Curves" 97 + where an input value for brightness is mapped along a linearly interpolated 98 + curve of brightness values that better match display characteristics. 99 + 100 + In the event of problems happening with backlight, there is a trace event 101 + that can be enabled at bootup to log every brightness change request. 102 + This can help isolate where the problem is. To enable the trace event add 103 + the following to the kernel command line: 104 + 105 + tp_printk trace_event=amdgpu_dm:amdgpu_dm_brightness:mod:amdgpu trace_buf_size=1M
+8
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
··· 4861 4861 reallow_idle = true; 4862 4862 } 4863 4863 4864 + if (trace_amdgpu_dm_brightness_enabled()) { 4865 + trace_amdgpu_dm_brightness(__builtin_return_address(0), 4866 + user_brightness, 4867 + brightness, 4868 + caps->aux_support, 4869 + power_supply_is_system_supplied() > 0); 4870 + } 4871 + 4864 4872 if (caps->aux_support) { 4865 4873 rc = dc_link_set_backlight_level_nits(link, true, brightness, 4866 4874 AUX_BL_DEFAULT_TRANSITION_TIME_MS);
+26
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_trace.h
··· 726 726 ) 727 727 ); 728 728 729 + TRACE_EVENT(amdgpu_dm_brightness, 730 + TP_PROTO(void *function, u32 user_brightness, u32 converted_brightness, bool aux, bool ac), 731 + TP_ARGS(function, user_brightness, converted_brightness, aux, ac), 732 + TP_STRUCT__entry( 733 + __field(void *, function) 734 + __field(u32, user_brightness) 735 + __field(u32, converted_brightness) 736 + __field(bool, aux) 737 + __field(bool, ac) 738 + ), 739 + TP_fast_assign( 740 + __entry->function = function; 741 + __entry->user_brightness = user_brightness; 742 + __entry->converted_brightness = converted_brightness; 743 + __entry->aux = aux; 744 + __entry->ac = ac; 745 + ), 746 + TP_printk("%ps: brightness requested=%u converted=%u aux=%s power=%s", 747 + (void *)__entry->function, 748 + (u32)__entry->user_brightness, 749 + (u32)__entry->converted_brightness, 750 + (__entry->aux) ? "true" : "false", 751 + (__entry->ac) ? "AC" : "DC" 752 + ) 753 + ); 754 + 729 755 #endif /* _AMDGPU_DM_TRACE_H_ */ 730 756 731 757 #undef TRACE_INCLUDE_PATH