From mboxrd@z Thu Jan 1 00:00:00 1970
From: bugzilla-daemon@freedesktop.org
Subject: [Bug 102646] Screen flickering under amdgpu-experimental [buggy auto
power profile]
Date: Wed, 20 Mar 2019 14:56:37 +0000
Message-ID:
References:
Mime-Version: 1.0
Content-Type: multipart/mixed; boundary="===============1366814812=="
Return-path:
Received: from culpepper.freedesktop.org (culpepper.freedesktop.org
[131.252.210.165])
by gabe.freedesktop.org (Postfix) with ESMTP id 64809892B9
for ; Wed, 20 Mar 2019 14:56:37 +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
--===============1366814812==
Content-Type: multipart/alternative; boundary="15530937971.3Cbe530.22289"
Content-Transfer-Encoding: 7bit
--15530937971.3Cbe530.22289
Date: Wed, 20 Mar 2019 14:56:37 +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
George Scorer changed:
What |Removed |Added
----------------------------------------------------------------------------
Priority|high |low
Severity|major |minor
--- Comment #70 from George Scorer ---
Building on julien tempel's workaround, here's a somewhat more complex scri=
pt
to manage the memory p-state jumps. It switches between low and high 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.
#!/bin/bash
# Each memory p-state switch causes a screen flicker. Tweak these variables=
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-state 2 b=
efore
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
# 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_l=
evel
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
# check for root privileges
if [ $UID -ne 0 ]
then
echo "Writing to sysfs requires root privileges; relaunch as root"
exit 1
fi
# Set gpu performance level control to manual
# echo "Setting performance level control to manual"
echo "manual" > "$FILE_PERF_LEVEL"
# Read the current core p-state and set a corresponding initial memory p-st=
ate
CORE_P_STATE=3D"$(grep -F '*' $FILE_CORE_P_STATE)"
CORE_P_STATE=3D${CORE_P_STATE:0:1}
if [ "$CORE_P_STATE" -ge "$CORE_P_STATE_UP" ]; then
MEM_P_STATE=3D2
else
MEM_P_STATE=3D$LOW_MEM_STATE
fi
echo "$MEM_P_STATE" > "$FILE_MEM_P_STATE"
PROPOSED_MEM_P_STATE=3D$MEM_P_STATE
function check_core_p_state {
CORE_P_STATE=3D"$(grep -F '*' $FILE_CORE_P_STATE)"
CORE_P_STATE=3D${CORE_P_STATE:0:1}
# 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
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 ))
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
# 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 ""
}
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
}
# always try to fix memory p-state 2 on failure
trap "reset_on_fail" SIGINT SIGTERM
function run_daemon {
while :; do
sleep $SLEEP_INTERVAL
check_core_p_state
done
}
# start the loop
run_daemon
--=20
You are receiving this mail because:
You are the assignee for the bug.=
--15530937971.3Cbe530.22289
Date: Wed, 20 Mar 2019 14:56:37 +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
George Scorer
changed
bug 10264=
6
What |
Removed |
Added |
Priority |
high
|
low
|
Severity |
major
|
minor
|
Comme=
nt # 70
on bug 10264=
6
from George Scorer
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 flickering. I'm not a
bash expert so please excuse the clumsy coding, but this works for me.
#!/bin/bash
# Each memory p-state switch causes a screen flicker. Tweak these variables=
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-state 2 b=
efore
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
# 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_l=
evel
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
# check for root privileges
if [ $UID -ne 0 ]
then
echo "Writing to sysfs requires root privileges; relaunch as root&qu=
ot;
exit 1
fi
# Set gpu performance level control to manual
# echo "Setting performance level control to manual"
echo "manual" > "$FILE_PERF_LEVEL"
# Read the current core p-state and set a corresponding initial memory p-st=
ate
CORE_P_STATE=3D"$(grep -F '*' $FILE_CORE_P_STATE)"
CORE_P_STATE=3D${CORE_P_STATE:0:1}
if [ "$CORE_P_STATE" -ge "$CORE_P_STATE_UP" ]; then
MEM_P_STATE=3D2
else
MEM_P_STATE=3D$LOW_MEM_STATE
fi
echo "$MEM_P_STATE" > "$FILE_MEM_P_STATE"
PROPOSED_MEM_P_STATE=3D$MEM_P_STATE
function check_core_p_state {
CORE_P_STATE=3D"$(grep -F '*' $FILE_CORE_P_STATE)"
CORE_P_STATE=3D${CORE_P_STATE:0:1}
# 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" ]; th=
en
PROPOSED_MEM_P_STATE=3D$LOW_MEM_STATE
fi
if [ "$PROPOSED_MEM_P_STATE" -ne "$MEM_P_STATE" ]; th=
en
# 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_ST=
ATE" ]; 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 ))
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
# 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 ""
}
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
}
# always try to fix memory p-state 2 on failure
trap "reset_on_fail" SIGINT SIGTERM
function run_daemon {
while :; do
sleep $SLEEP_INTERVAL
check_core_p_state
done
}
# start the loop
run_daemon
You are receiving this mail because:
- You are the assignee for the bug.
=
--15530937971.3Cbe530.22289--
--===============1366814812==
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: base64
Content-Disposition: inline
X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KZHJpLWRldmVs
IG1haWxpbmcgbGlzdApkcmktZGV2ZWxAbGlzdHMuZnJlZWRlc2t0b3Aub3JnCmh0dHBzOi8vbGlz
dHMuZnJlZWRlc2t0b3Aub3JnL21haWxtYW4vbGlzdGluZm8vZHJpLWRldmVs
--===============1366814812==--