From: bugzilla-daemon@freedesktop.org
Subject: [Bug 102646] Screen flickering under amdgpu-experimental [buggy auto
power profile]
Date: Wed, 20 Mar 2019 16:59:00 +0000
Message-ID:
References:
Mime-Version: 1.0
Content-Type: multipart/mixed; boundary="===============1908928202=="
Return-path:
Received: from culpepper.freedesktop.org (culpepper.freedesktop.org
[IPv6:2610:10:20:722:a800:ff:fe98:4b55])
by gabe.freedesktop.org (Postfix) with ESMTP id 041226E039
for ; Wed, 20 Mar 2019 16:59:01 +0000 (UTC)
In-Reply-To:
List-Unsubscribe: ,
List-Archive:
List-Post:
List-Help:
List-Subscribe: ,
Errors-To: dri-devel-bounces@lists.freedesktop.org
Sender: "dri-devel"
To: dri-devel@lists.freedesktop.org
List-Id: dri-devel@lists.freedesktop.org
--===============1908928202==
Content-Type: multipart/alternative; boundary="15531011404.B353D96Aa.4360"
Content-Transfer-Encoding: 7bit
--15531011404.B353D96Aa.4360
Date: Wed, 20 Mar 2019 16:59:00 +0000
MIME-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Bugzilla-URL: http://bugs.freedesktop.org/
Auto-Submitted: auto-generated
https://bugs.freedesktop.org/show_bug.cgi?id=3D102646
--- Comment #71 from bmilreu@gmail.com ---
(In reply to George Scorer from comment #70)
> Building on julien tempel's workaround, here's a somewhat more complex
> script to manage the memory p-state jumps. It switches between low and hi=
gh
> memory p-states very reluctantly, so minimizing instances of flickering. =
I'm
> not a bash expert so please excuse the clumsy coding, but this works for =
me.
>=20
> #!/bin/bash
>=20
> # Each memory p-state switch causes a screen flicker. Tweak these variabl=
es
> to match
> # your personal 'flicker aversion' vs efficiency trade-off.
> CORE_P_STATE_UP=3D6 # The gpu core p-state at which we should jump up =
to
> memory p-state 2
> CORE_P_STATE_DOWN=3D1 # The gpu core p-state at which we should drop dow=
n to
> low memory p-state
> UP_DELAY=3D2 # in seconds. How long to stay in low memory p-sta=
te
> before checking whether we can jump up to 2.
> DOWN_DELAY=3D10 # in seconds. How long to stay in memory p-state 2
> before checking whether we can drop down to low.
> SLEEP_INTERVAL=3D1 # in seconds. How frequently we should poll the co=
re
> p-state.
> LOW_MEM_STATE=3D0 # Choose between 0 & 1
>=20
> # Sysfs paths here are hardcoded for one amdgpu card at card0; adjust as
> needed.
> FILE_PERF_LEVEL=3D/sys/class/drm/card0/device/power_dpm_force_performance=
_level
> FILE_MEM_P_STATE=3D/sys/class/drm/card0/device/pp_dpm_mclk
> FILE_CORE_P_STATE=3D/sys/class/drm/card0/device/pp_dpm_sclk
>=20
>=20
> # check for root privileges
> if [ $UID -ne 0 ]
> then
> echo "Writing to sysfs requires root privileges; relaunch as root"
> exit 1
> fi
>=20
> # Set gpu performance level control to manual
> # echo "Setting performance level control to manual"
> echo "manual" > "$FILE_PERF_LEVEL"
>=20
> # Read the current core p-state and set a corresponding initial memory
> p-state
>=20
> CORE_P_STATE=3D"$(grep -F '*' $FILE_CORE_P_STATE)"
> CORE_P_STATE=3D${CORE_P_STATE:0:1}
>=20
> if [ "$CORE_P_STATE" -ge "$CORE_P_STATE_UP" ]; then
> MEM_P_STATE=3D2
> else
> MEM_P_STATE=3D$LOW_MEM_STATE
> fi
>=20
> echo "$MEM_P_STATE" > "$FILE_MEM_P_STATE"
> PROPOSED_MEM_P_STATE=3D$MEM_P_STATE
>=20=20=20
> function check_core_p_state {
>=20
> CORE_P_STATE=3D"$(grep -F '*' $FILE_CORE_P_STATE)"
> CORE_P_STATE=3D${CORE_P_STATE:0:1}
>=20
> # Propose what the corresponding memory p-state should be
> OLD_PROPOSED_MEM_P_STATE=3D$PROPOSED_MEM_P_STATE
> PROPOSED_MEM_P_STATE=3D$MEM_P_STATE
> if [ "$CORE_P_STATE" -ge "$CORE_P_STATE_UP" ]; then
> PROPOSED_MEM_P_STATE=3D2
> elif [ "$CORE_P_STATE" -le "$CORE_P_STATE_DOWN" ]; then
> PROPOSED_MEM_P_STATE=3D$LOW_MEM_STATE
> fi
>=20=20=20
> if [ "$PROPOSED_MEM_P_STATE" -ne "$MEM_P_STATE" ]; then
> # We want to change so determine where we are in the countdown.=20=20=
=20=20
> if [ "$PROPOSED_MEM_P_STATE" -ne "$OLD_PROPOSED_MEM_P_STATE" ]; then
> if [ "$PROPOSED_MEM_P_STATE" -eq 2 ]; then
> CHANGE_COUNTDOWN=3D$UP_DELAY
> else
> CHANGE_COUNTDOWN=3D$DOWN_DELAY
> fi
> fi
> (( CHANGE_COUNTDOWN =3D $CHANGE_COUNTDOWN - $SLEEP_INTERVAL ))
>=20=20=20=20=20=20=20
> if [ $CHANGE_COUNTDOWN -le 0 ]; then
> # The countdown has reached 0 so change the memory p-state.
> MEM_P_STATE=3D$PROPOSED_MEM_P_STATE
> echo "$MEM_P_STATE" > "$FILE_MEM_P_STATE"
> fi
> # else
> # we don't want to change.=20=20
> fi
>=20
> # echo "Old Prop Mem Core Countdown"
> # echo " $OLD_PROPOSED_MEM_P_STATE $PROPOSED_MEM_P_STATE=20=20=20
> $MEM_P_STATE $CORE_P_STATE $CHANGE_COUNTDOWN"
> # echo ""
> }
>=20
> function reset_on_fail {
> echo "Exiting, setting memory p-state to 2"
> echo "manual" > "$FILE_PERF_LEVEL"
> echo "2" > "$FILE_MEM_P_STATE"
> exit 1
> }
>=20
> # always try to fix memory p-state 2 on failure
> trap "reset_on_fail" SIGINT SIGTERM
>=20
> function run_daemon {
> while :; do
> sleep $SLEEP_INTERVAL
> check_core_p_state
> done
> }
>=20
> # start the loop
>=20
> run_daemon
Thanks for the script, it doesn't work 100% of the time but the flickers are
very rare. Good thing about it is that you still save power when idle since=
it
reclocks back. I'd guess similar logic could be used to fix the driver while
still having the feature working, just reclocking less agressively.
--=20
You are receiving this mail because:
You are the assignee for the bug.=
--15531011404.B353D96Aa.4360
Date: Wed, 20 Mar 2019 16:59:00 +0000
MIME-Version: 1.0
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Bugzilla-URL: http://bugs.freedesktop.org/
Auto-Submitted: auto-generated
Comme=
nt # 71
on bug 10264=
6
from bmilreu@gmail.co=
m
(In reply to George Scorer from comment #70)
> Building on julien tempel's workaround, here's a=
somewhat more complex
> script to manage the memory p-state jumps. It switches between low and=
high
> memory p-states very reluctantly, so minimizing instances of flickerin=
g. I'm
> not a bash expert so please excuse the clumsy coding, but this works f=
or me.
>=20
> #!/bin/bash
>=20
> # Each memory p-state switch causes a screen flicker. Tweak these vari=
ables
> to match
> # your personal 'flicker aversion' vs efficiency trade-off.
> CORE_P_STATE_UP=3D6 # The gpu core p-state at which we should jump =
up to
> memory p-state 2
> CORE_P_STATE_DOWN=3D1 # The gpu core p-state at which we should drop =
down to
> low memory p-state
> UP_DELAY=3D2 # in seconds. How long to stay in low memory p-=
state
> before checking whether we can jump up to 2.
> DOWN_DELAY=3D10 # in seconds. How long to stay in memory p-stat=
e 2
> before checking whether we can drop down to low.
> SLEEP_INTERVAL=3D1 # in seconds. How frequently we should poll the=
core
> p-state.
> LOW_MEM_STATE=3D0 # Choose between 0 & 1
>=20
> # Sysfs paths here are hardcoded for one amdgpu card at card0; adjust =
as
> needed.
> FILE_PERF_LEVEL=3D/sys/class/drm/card0/device/power_dpm_force_performa=
nce_level
> FILE_MEM_P_STATE=3D/sys/class/drm/card0/device/pp_dpm_mclk
> FILE_CORE_P_STATE=3D/sys/class/drm/card0/device/pp_dpm_sclk
>=20
>=20
> # check for root privileges
> if [ $UID -ne 0 ]
> then
> echo "Writing to sysfs requires root privileges; relaunch as ro=
ot"
> exit 1
> fi
>=20
> # Set gpu performance level control to manual
> # echo "Setting performance level control to manual"
> echo "manual" > "$FILE_PERF_LEVEL"
>=20
> # Read the current core p-state and set a corresponding initial memory
> p-state
>=20
> CORE_P_STATE=3D"$(grep -F '*' $FILE_CORE_P_STATE)"
> CORE_P_STATE=3D${CORE_P_STATE:0:1}
>=20
> if [ "$CORE_P_STATE" -ge "$CORE_P_STATE_UP" ]; then
> MEM_P_STATE=3D2
> else
> MEM_P_STATE=3D$LOW_MEM_STATE
> fi
>=20
> echo "$MEM_P_STATE" > "$FILE_MEM_P_STATE"
> PROPOSED_MEM_P_STATE=3D$MEM_P_STATE
>=20=20=20
> function check_core_p_state {
>=20
> CORE_P_STATE=3D"$(grep -F '*' $FILE_CORE_P_STATE)"
> CORE_P_STATE=3D${CORE_P_STATE:0:1}
>=20
> # Propose what the corresponding memory p-state should be
> OLD_PROPOSED_MEM_P_STATE=3D$PROPOSED_MEM_P_STATE
> PROPOSED_MEM_P_STATE=3D$MEM_P_STATE
> if [ "$CORE_P_STATE" -ge "$CORE_P_STATE_UP" ]; t=
hen
> PROPOSED_MEM_P_STATE=3D2
> elif [ "$CORE_P_STATE" -le "$CORE_P_STATE_DOWN" =
]; then
> PROPOSED_MEM_P_STATE=3D$LOW_MEM_STATE
> fi
>=20=20=20
> if [ "$PROPOSED_MEM_P_STATE" -ne "$MEM_P_STATE" =
]; then
> # We want to change so determine where we are in the countdown.=20=
=20=20=20
> if [ "$PROPOSED_MEM_P_STATE" -ne "$OLD_PROPOSED_MEM=
_P_STATE" ]; then
> if [ "$PROPOSED_MEM_P_STATE" -eq 2 ]; then
> CHANGE_COUNTDOWN=3D$UP_DELAY
> else
> CHANGE_COUNTDOWN=3D$DOWN_DELAY
> fi
> fi
> (( CHANGE_COUNTDOWN =3D $CHANGE_COUNTDOWN - $SLEEP_INTERVAL ))
>=20=20=20=20=20=20=20
> if [ $CHANGE_COUNTDOWN -le 0 ]; then
> # The countdown has reached 0 so change the memory p-state.
> MEM_P_STATE=3D$PROPOSED_MEM_P_STATE
> echo "$MEM_P_STATE" > "$FILE_MEM_P_STATE"
> fi
> # else
> # we don't want to change.=20=20
> fi
>=20
> # echo "Old Prop Mem Core Countdown"
> # echo " $OLD_PROPOSED_MEM_P_STATE $PROPOSED_MEM_P_STATE=
=20=20=20
> $MEM_P_STATE $CORE_P_STATE $CHANGE_COUNTDOWN"
> # echo ""
> }
>=20
> function reset_on_fail {
> echo "Exiting, setting memory p-state to 2"
> echo "manual" > "$FILE_PERF_LEVEL"
> echo "2" > "$FILE_MEM_P_STATE"
> exit 1
> }
>=20
> # always try to fix memory p-state 2 on failure
> trap "reset_on_fail" SIGINT SIGTERM
>=20
> function run_daemon {
> while :; do
> sleep $SLEEP_INTERVAL
> check_core_p_state
> done
> }
>=20
> # start the loop
>=20
> run_daemon
Thanks for the script, it doesn't work 100% of the time but the flickers are
very rare. Good thing about it is that you still save power when idle since=
it
reclocks back. I'd guess similar logic could be used to fix the driver while
still having the feature working, just reclocking less agressively.
You are receiving this mail because:
- You are the assignee for the bug.
=
--15531011404.B353D96Aa.4360--
--===============1908928202==
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: base64
Content-Disposition: inline
X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KZHJpLWRldmVs
IG1haWxpbmcgbGlzdApkcmktZGV2ZWxAbGlzdHMuZnJlZWRlc2t0b3Aub3JnCmh0dHBzOi8vbGlz
dHMuZnJlZWRlc2t0b3Aub3JnL21haWxtYW4vbGlzdGluZm8vZHJpLWRldmVs
--===============1908928202==--