All of lore.kernel.org
 help / color / mirror / Atom feed
From: bugzilla-daemon@freedesktop.org
To: dri-devel@lists.freedesktop.org
Subject: [Bug 102646] Screen flickering under amdgpu-experimental [buggy auto power profile]
Date: Wed, 20 Mar 2019 16:59:00 +0000	[thread overview]
Message-ID: <bug-102646-502-ro3g6e9sAi@http.bugs.freedesktop.org/> (raw)
In-Reply-To: <bug-102646-502@http.bugs.freedesktop.org/>


[-- Attachment #1.1: Type: text/plain, Size: 4441 bytes --]

https://bugs.freedesktop.org/show_bug.cgi?id=102646

--- 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 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=6    # The gpu core p-state at which we should jump up to
> memory p-state 2
> CORE_P_STATE_DOWN=1  # The gpu core p-state at which we should drop down to
> low memory p-state
> UP_DELAY=2           # in seconds. How long to stay in low memory p-state
> before checking whether we can jump up to 2.
> DOWN_DELAY=10        # in seconds. How long to stay in memory p-state 2
> before checking whether we can drop down to low.
> SLEEP_INTERVAL=1     # in seconds. How frequently we should poll the core
> p-state.
> LOW_MEM_STATE=0      # Choose between 0 & 1
> 
> # Sysfs paths here are hardcoded for one amdgpu card at card0; adjust as
> needed.
> FILE_PERF_LEVEL=/sys/class/drm/card0/device/power_dpm_force_performance_level
> FILE_MEM_P_STATE=/sys/class/drm/card0/device/pp_dpm_mclk
> FILE_CORE_P_STATE=/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-state
> 
> CORE_P_STATE="$(grep -F '*' $FILE_CORE_P_STATE)"
> CORE_P_STATE=${CORE_P_STATE:0:1}
> 
> if [ "$CORE_P_STATE" -ge "$CORE_P_STATE_UP" ]; then
>   MEM_P_STATE=2
> else
>   MEM_P_STATE=$LOW_MEM_STATE
> fi
> 
> echo "$MEM_P_STATE" > "$FILE_MEM_P_STATE"
> PROPOSED_MEM_P_STATE=$MEM_P_STATE
>   
> function check_core_p_state {
> 
>   CORE_P_STATE="$(grep -F '*' $FILE_CORE_P_STATE)"
>   CORE_P_STATE=${CORE_P_STATE:0:1}
> 
> # Propose what the corresponding memory p-state should be
>   OLD_PROPOSED_MEM_P_STATE=$PROPOSED_MEM_P_STATE
>   PROPOSED_MEM_P_STATE=$MEM_P_STATE
>   if [ "$CORE_P_STATE" -ge "$CORE_P_STATE_UP" ]; then
>     PROPOSED_MEM_P_STATE=2
>   elif [ "$CORE_P_STATE" -le "$CORE_P_STATE_DOWN" ]; then
>     PROPOSED_MEM_P_STATE=$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.    
>     if [ "$PROPOSED_MEM_P_STATE" -ne "$OLD_PROPOSED_MEM_P_STATE" ]; then
>       if [ "$PROPOSED_MEM_P_STATE" -eq 2 ]; then
>         CHANGE_COUNTDOWN=$UP_DELAY
>       else
>         CHANGE_COUNTDOWN=$DOWN_DELAY
>       fi
>     fi
>     (( CHANGE_COUNTDOWN = $CHANGE_COUNTDOWN - $SLEEP_INTERVAL ))
>       
>     if [ $CHANGE_COUNTDOWN -le 0 ]; then
> #   The countdown has reached 0 so change the memory p-state.
>       MEM_P_STATE=$PROPOSED_MEM_P_STATE
>       echo "$MEM_P_STATE" > "$FILE_MEM_P_STATE"
>     fi
> #  else
> #   we don't want to change.  
>   fi
> 
> #    echo "Old  Prop  Mem  Core  Countdown"
> #    echo "  $OLD_PROPOSED_MEM_P_STATE     $PROPOSED_MEM_P_STATE   
> $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

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.

[-- Attachment #1.2: Type: text/html, Size: 5976 bytes --]

[-- Attachment #2: Type: text/plain, Size: 159 bytes --]

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  parent reply	other threads:[~2019-03-20 16:59 UTC|newest]

Thread overview: 124+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-10 17:06 [Bug 102646] Screen flickering under amdgpu-experimental (buffer corruptions?) bugzilla-daemon
2017-09-10 17:25 ` bugzilla-daemon
2017-09-11  0:02 ` bugzilla-daemon
2017-09-11  0:20 ` bugzilla-daemon
2017-09-11  0:25 ` bugzilla-daemon
2017-09-12 21:52 ` bugzilla-daemon
2017-09-12 21:53 ` bugzilla-daemon
2017-09-12 21:57 ` bugzilla-daemon
2017-09-13  2:47 ` bugzilla-daemon
2017-09-13  2:52 ` bugzilla-daemon
2017-09-13 13:29 ` bugzilla-daemon
2017-09-14 18:37 ` bugzilla-daemon
2017-09-15 15:38 ` bugzilla-daemon
2017-09-17  0:15 ` bugzilla-daemon
2017-09-17  0:22 ` bugzilla-daemon
2017-10-02 14:14 ` bugzilla-daemon
2017-10-03 20:44 ` bugzilla-daemon
2017-10-03 20:53 ` bugzilla-daemon
2017-10-21  1:54 ` bugzilla-daemon
2017-11-29 23:03 ` bugzilla-daemon
2017-12-14  4:06 ` bugzilla-daemon
2017-12-16 18:35 ` [Bug 102646] Screen flickering under amdgpu-experimental [buggy auto power profile] bugzilla-daemon
2017-12-16 18:37 ` [Bug 102646] [dc] " bugzilla-daemon
2017-12-20 20:22 ` bugzilla-daemon
2017-12-20 20:29 ` bugzilla-daemon
2018-01-30 19:26 ` bugzilla-daemon
2018-03-05  7:10 ` bugzilla-daemon
2018-03-05  7:13 ` bugzilla-daemon
2018-03-13 16:29 ` bugzilla-daemon
2018-03-13 18:05 ` bugzilla-daemon
2018-03-13 19:01 ` bugzilla-daemon
2018-04-22 15:45 ` bugzilla-daemon
2018-05-01 19:30 ` [Bug 102646] " bugzilla-daemon
2018-06-25 18:09 ` bugzilla-daemon
2018-09-06 12:06 ` bugzilla-daemon
2018-10-27  7:40 ` bugzilla-daemon
2018-10-28 18:45 ` bugzilla-daemon
2018-10-29 15:41 ` bugzilla-daemon
2018-10-29 17:57 ` bugzilla-daemon
2018-10-29 18:38 ` bugzilla-daemon
2018-10-31 19:08 ` bugzilla-daemon
2018-10-31 22:57 ` bugzilla-daemon
2018-10-31 23:06 ` bugzilla-daemon
2018-11-01 16:52 ` bugzilla-daemon
2018-11-17 14:00 ` bugzilla-daemon
2018-11-18 17:36 ` bugzilla-daemon
2018-11-18 18:12 ` bugzilla-daemon
2018-11-18 18:38 ` bugzilla-daemon
2018-11-18 18:47 ` bugzilla-daemon
2018-11-18 22:54 ` bugzilla-daemon
2018-11-18 23:16 ` bugzilla-daemon
2018-11-21 11:34 ` bugzilla-daemon
2018-11-21 11:34 ` bugzilla-daemon
2018-11-23 19:35 ` bugzilla-daemon
2018-11-29 11:01 ` bugzilla-daemon
2018-11-29 20:52 ` bugzilla-daemon
2018-11-29 22:40 ` bugzilla-daemon
2018-11-30  1:25 ` bugzilla-daemon
2018-11-30  1:26 ` bugzilla-daemon
2018-11-30  4:10 ` bugzilla-daemon
2018-11-30  9:24 ` bugzilla-daemon
2018-12-02  9:17 ` bugzilla-daemon
2018-12-11 11:53 ` bugzilla-daemon
2018-12-25 22:56 ` bugzilla-daemon
2018-12-31 12:49 ` bugzilla-daemon
2018-12-31 12:49 ` bugzilla-daemon
2018-12-31 15:10 ` bugzilla-daemon
2019-01-03 11:49 ` bugzilla-daemon
2019-01-11  9:35 ` bugzilla-daemon
2019-01-21 16:46 ` bugzilla-daemon
2019-02-06 13:44 ` bugzilla-daemon
2019-03-10  9:36 ` bugzilla-daemon
2019-03-10  9:38 ` bugzilla-daemon
2019-03-15 17:12 ` bugzilla-daemon
2019-03-19 20:12 ` bugzilla-daemon
2019-03-20 14:56 ` bugzilla-daemon
2019-03-20 14:57 ` bugzilla-daemon
2019-03-20 16:59 ` bugzilla-daemon [this message]
2019-03-20 17:02 ` bugzilla-daemon
2019-03-27 19:03 ` bugzilla-daemon
2019-03-30  1:41 ` bugzilla-daemon
2019-03-30  4:07 ` bugzilla-daemon
2019-04-04 13:47 ` bugzilla-daemon
2019-04-12  1:15 ` bugzilla-daemon
2019-04-12  1:19 ` bugzilla-daemon
2019-04-12  9:38 ` bugzilla-daemon
2019-04-12 13:47 ` bugzilla-daemon
2019-04-17 14:22 ` bugzilla-daemon
2019-04-18  0:40 ` bugzilla-daemon
2019-04-25  8:14 ` bugzilla-daemon
2019-05-12  4:46 ` bugzilla-daemon
2019-05-12  4:47 ` bugzilla-daemon
2019-05-12  4:50 ` bugzilla-daemon
2019-05-12  9:17 ` bugzilla-daemon
2019-05-12 21:42 ` bugzilla-daemon
2019-05-13 13:57 ` bugzilla-daemon
2019-05-13 14:19 ` bugzilla-daemon
2019-05-13 23:59 ` bugzilla-daemon
2019-06-07 13:56 ` bugzilla-daemon
2019-06-13 23:19 ` bugzilla-daemon
2019-06-17  2:58 ` bugzilla-daemon
2019-06-17 10:27 ` bugzilla-daemon
2019-06-17 13:55 ` bugzilla-daemon
2019-08-05 22:11 ` bugzilla-daemon
2019-08-05 22:11 ` bugzilla-daemon
2019-08-05 23:16 ` bugzilla-daemon
2019-08-06  0:51 ` bugzilla-daemon
2019-08-06 18:54 ` bugzilla-daemon
2019-08-11  5:39 ` bugzilla-daemon
2019-08-12  4:01 ` bugzilla-daemon
2019-08-13 21:26 ` bugzilla-daemon
2019-08-16 20:57 ` bugzilla-daemon
2019-08-17  7:29 ` bugzilla-daemon
2019-08-19  8:45 ` bugzilla-daemon
2019-08-19 11:05 ` bugzilla-daemon
2019-08-19 11:17 ` bugzilla-daemon
2019-08-19 11:20 ` bugzilla-daemon
2019-08-19 11:25 ` bugzilla-daemon
2019-08-19 11:41 ` bugzilla-daemon
2019-08-19 15:01 ` bugzilla-daemon
2019-08-23 10:57 ` bugzilla-daemon
2019-08-23 12:14 ` bugzilla-daemon
2019-09-19  8:40 ` bugzilla-daemon
2019-11-19  8:24 ` bugzilla-daemon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-102646-502-ro3g6e9sAi@http.bugs.freedesktop.org/ \
    --to=bugzilla-daemon@freedesktop.org \
    --cc=dri-devel@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.