You are not logged in.

#1 2025-01-25 15:48:04

seth
Member
Registered: 2012-09-03
Posts: 60,756

Script to manage/interpret/understand amdgpu's stupid feature masks

#!/bin/bash

write() {
    (($2)) && printf "\e[32m${1} \e[34m${3}\n\e[0m" || printf "\e[31m${1} \e[34m${3}\n\e[0m"
}

ppfeaturemask=( PP_SCLK_DPM_MASK PP_MCLK_DPM_MASK PP_PCIE_DPM_MASK PP_SCLK_DEEP_SLEEP_MASK \
                PP_POWER_CONTAINMENT_MASK PP_UVD_HANDSHAKE_MASK PP_SMC_VOLTAGE_CONTROL_MASK \
                PP_VBI_TIME_SUPPORT_MASK PP_ULV_MASK PP_ENABLE_GFX_CG_THRU_SMU PP_CLOCK_STRETCH_MASK \
                PP_OD_FUZZY_FAN_CONTROL_MASK PP_SOCCLK_DPM_MASK PP_DCEFCLK_DPM_MASK PP_OVERDRIVE_MASK \
                PP_GFXOFF_MASK PP_ACG_MASK PP_STUTTER_MODE PP_AVFS_MASKPP_GFX_DCS_MASK )
dcfeaturemask=( DC_FBC_MASK DC_MULTI_MON_PP_MCLK_SWITCH_MASK DC_DISABLE_FRACTIONAL_PWM_MASK DC_PSR_MASK \
                DC_EDP_NO_POWER_SEQUENCING DC_DISABLE_LTTPR_DP1_4A DC_DISABLE_LTTPR_DP2_0 \
                DC_PSR_ALLOW_SMU_OPT DC_PSR_ALLOW_MULTI_DISP_OPT DC_REPLAY_MASK )
dcfcomments=(   'disabled by default' 'enabled by default' 'disabled by default' 'disabled by default for dcn < 3.1' \
                'disabled by default' 'disabled by default' 'disabled by default' 'disabled by default' \
                'disabled by default' 'disabled by default for dcn < 3.1.4' )
dcdebugmask=(   DC_DISABLE_PIPE_SPLIT DC_DISABLE_STUTTER DC_DISABLE_DSC DC_DISABLE_CLOCK_GATING \
                DC_DISABLE_PSR DC_FORCE_SUBVP_MCLK_SWITCH DC_DISABLE_MPO DC_ENABLE_DPIA_TRACE \
                DC_ENABLE_DML2 DC_DISABLE_PSR_SU DC_DISABLE_REPLAY DC_DISABLE_IPS DC_DISABLE_IPS_DYNAMIC \
                DC_DISABLE_IPS2_DYNAMIC DC_FORCE_IPS_ENABLE )
dcdcomments=(   'disable pipe-splitting' 'disable memory stutter mode' 'disable display stream compression' \
                'disable clock gating optimizations' 'disable Panel self refresh v1 and PSR-SU' \
                'force mclk switch in subvp, even if mclk switch in vblank is possible' \
                'disable multi-plane offloading' 'enable trace logging for DPIA' \
                'force usage of DML2, even if the DCN version does not default to it.' 'disable PSR SU' \
                'disable Panel Replay' 'disable all Idle Power States, all the time.' \
                'disable all IPS, all the time, *except* when driver goes into suspend.' \
                'disable IPS2 (IPS1 allowed) if there is an enabled display. Otherwise, enable all IPS.'
                'force enable all IPS, all the time.' )

case $1 in
pp*) # ppfeaturemask
printf "ppfeaturemask: 0x%x\n-----------------\n" $2
for ((i=0; i < ${#ppfeaturemask[@]}; ++i)); do
    write ${ppfeaturemask[i]} $(($2 & (1<<$i)))
done
;;
dcf*) # dcfeaturemask
printf "dcfeaturemask: 0x%x\n-----------------\n" $2
for ((i=0; i < ${#dcfeaturemask[@]}; ++i)); do
    write ${dcfeaturemask[i]} $(($2 & (1<<$i))) "${dcfcomments[i]}"
done
;;
dcd*) # dcdebugmask
printf "dcdebugmask: 0x%x\n-----------------\n" $2
for ((i=0; i < ${#dcdebugmask[@]}; ++i)); do
    write ${dcdebugmask[i]} $(($2 & (1<<$i))) "${dcdcomments[i]}"
done
echo ---------------
printf "\e[34mIf more than one IPS debug bit is set, the lowest bit takes precedence.
For example, if DC_FORCE_IPS_ENABLE and DC_DISABLE_IPS_DYNAMIC are set, then
DC_DISABLE_IPS_DYNAMIC takes precedence.\n\e[0m"
;;
*)
printf "\n$(basename $0) [pp|dcd|dcf 0xnnnnn]|[feature tokens]\n\n"
printf "============================================================"
printf "\n\e[32mppfeaturemask:\e[0m\n"
for token in "$@"; do
    for ((i=0; i < ${#ppfeaturemask[@]}; ++i)); do
        [[ ${ppfeaturemask[i],,} =~ ${token,,} ]] && printf "${ppfeaturemask[i]} \e[34m0x%x\e[0m\n" $((1<<$i))
    done
done
printf "\n\e[32mdcfeaturemask\e[0m\n"
for token in "$@"; do
    for ((i=0; i < ${#dcfeaturemask[@]}; ++i)); do
        [[ ${dcfeaturemask[i],,} =~ ${token,,} ]] && printf "${dcfeaturemask[i]} \e[34m0x%x\e[0m\n" $((1<<$i))
    done
done
printf "\n\e[32mdcdebugmask\e[0m\n"
for token in "$@"; do
    for ((i=0; i < ${#dcdebugmask[@]}; ++i)); do
        [[ ${dcdebugmask[i],,} =~ ${token,,} ]] && printf "${dcdebugmask[i]} \e[34m0x%x\e[0m\n" $((1<<$i))
    done
done
;;
esac

Offline

#2 Yesterday 20:20:45

NuSkool
Member
Registered: 2015-03-23
Posts: 193

Re: Script to manage/interpret/understand amdgpu's stupid feature masks

Thanks for the contribution seth.

I've been helping with testing in:  Issues with Mesa 24.3.x...  https://bbs.archlinux.org/viewtopic.php?id=301798
I'm pretty sure if I knew what I was doing, your script would provide some interesting info.
Unfortunately I'm not in the know, and it's not giving me anything interesting.

I've downloaded the script, called it amd-info, applied the x bit, put it in PATH, and ran it.

Could you possibly fill in what I'm missing to use this with example/s or point to info that would help?

$ amd-info

amd-info [pp|dcd|dcf 0xnnnnn]|[feature tokens]

============================================================
ppfeaturemask:

dcfeaturemask

dcdebugmask

Offline

#3 Yesterday 20:53:48

seth
Member
Registered: 2012-09-03
Posts: 60,756

Re: Script to manage/interpret/understand amdgpu's stupid feature masks

You can either grep for features (try "amd-info gfx" or "amd-info psr") or see what a mask does ("amd-info pp 0xfff73fff")
The output is a short for the usage and then the match for an empty token.

Offline

#4 Yesterday 21:09:03

NuSkool
Member
Registered: 2015-03-23
Posts: 193

Re: Script to manage/interpret/understand amdgpu's stupid feature masks

Very cool, thanks!

I'm guessing this may be really useful in the  'Issues with Mesa 24.3.x...' thread, if the guys doing the actual troubleshooting have any questions about the testers provided results.  ie: Double check our test result reporting?

Maybe also help them with troubleshooting? Not sure if they may already have tools on their end that easily providing these results.

Last edited by NuSkool (Yesterday 21:11:40)

Offline

Board footer

Powered by FluxBB