How To Guide Screen refresh rate twinkering

Search This thread

foobar66

Senior Member
Jan 8, 2011
2,137
2,226
Brussels
Google Pixel 6 Pro
Screen refresh rate is controlled by several variables, 3 which I found are:
Code:
# getprop ro.surface_flinger.use_content_detection_for_refresh_rate
This instructs the screen compositor (surface flinger) to look at screen content to control screen refresh rate. 'true' by default; you will need root and Magisk's resetprop to override it, e.g.
Code:
# resetprop ro.surface_flinger.use_content_detection_for_refresh_rate false
But note that that does not stick after reboot, you will need a magisk module to force that upon boot. Add the property to system.prop file in the magisk module top directory.

Then:
Code:
# settings get system min_refresh_rate
0 by default; you can set e.g. to '60'
Code:
# settings put system min_refresh_rate 60
And the peak refresh:
Code:
# settings get system peak_refresh_rate
60 or 120 depending on toggle 'Smooth display' in Settings.

When you use 'Force peak refresh rate' in developer options then:
Code:
# settings list system | grep refresh
min_refresh_rate=120.00001

Weird number by the way. Anyway that forces the driver into 120Hz continuously.

I have personally set min=60, peak=120 and the surface flinger content detection to 'false' ... just to see how this goes for a couple of days.

And finally some other properties related to surface_flinger:
Code:
# indicates whether SurfaceFlinger should use refresh rate switching on the device, e.g. between 60 and 120 Hz (default: true)
ro.surface_flinger.refresh_rate_switching

# value used by the Scheduler to trigger display power inactivity callbacks (default: 1000)
ro.surface_flinger.set_display_power_timer_ms

# used by the Scheduler to trigger touch inactivity callbacks that will switch display to a lower refresh rate (default: 200)
ro.surface_flinger.set_touch_timer_ms
 
Last edited:

foobar66

Senior Member
Jan 8, 2011
2,137
2,226
Brussels
Google Pixel 6 Pro
So far no issues ... all working fine. I have now set the minimum as well to 120 Hz ... just to see how that might affect things ...
LOL ... as expected ... significantly more battery drain keeping the screen to 120 Hz all the time.
But scrolling ... oh so smooth ...

Looking for a middle with increased ground with ro.surface_flinger.set_touch_timer_ms to avoid switching too soon to lower rate (and ro.surface_flinger.use_content_detection_for_refresh_rate=false to avoid switching to lower rate based on content).
 

kevinireland11

Senior Member
Apr 10, 2014
1,072
310
Samsung Galaxy S21
Google Pixel 7
LOL ... as expected ... significantly more battery drain keeping the screen to 120 Hz all the time.
But scrolling ... oh so smooth ...

Looking for a middle with increased ground with ro.surface_flinger.set_touch_timer_ms to avoid switching too soon to lower rate (and ro.surface_flinger.use_content_detection_for_refresh_rate=false to avoid switching to lower rate based on content).
Can min=90? Or will it only run between 60-120?
 

foobar66

Senior Member
Jan 8, 2011
2,137
2,226
Brussels
Google Pixel 6 Pro
Actually, you can see the refresh rate of the screen.
Go to developer settings. There is a toggle there called 'Show refresh rate' ;-)
Tried setting min rate to 90 ... but does not work via this mechanism.
Code:
settings put system min_refresh_rate 90
It switches the minimum rate to 120.
So looks like only 60 and 120 are accepted.

If you set system peak_refresh_rate to 60, then the screen will always be in 60 Hz. That is very clearly visible when scrolling.

When you touch the screen, it seems to immediately switch into 120 HZ as there is of course a possibility that you will start scrolling ... so makes sense. As soon as you lift your finger and the screen content is not moving the frequency is lowered to 60.
 
Last edited:

Laptapper

Senior Member
Jan 17, 2016
2,678
1,955
Screen refresh rate is controlled by several variables, 3 which I found are:
Code:
# getprop ro.surface_flinger.use_content_detection_for_refresh_rate
This instructs the screen compositor (surface flinger) to look at screen content to control screen refresh rate. 'true' by default; you will need root and Magisk's resetprop to override it, e.g.
Code:
# resetprop ro.surface_flinger.use_content_detection_for_refresh_rate false
But note that that does not stick after reboot, you will need a magisk module to force that upon boot. Add the property to system.prop file in the magisk module top directory.

Then:
Code:
# settings get system min_refresh_rate
0 by default; you can set e.g. to '60'
Code:
# settings put system min_refresh_rate 60
And the peak refresh:
Code:
# settings get system peak_refresh_rate
60 or 120 depending on toggle 'Smooth display' in Settings.

When you use 'Force peak refresh rate' in developer options then:
Code:
# settings list system | grep refresh
min_refresh_rate=120.00001

Weird number by the way. Anyway that forces the driver into 120Hz continuously.

I have personally set min=60, peak=120 and the surface flinger content detection to 'false' ... just to see how this goes for a couple of days.

And finally some other properties related to surface_flinger:
Code:
# indicates whether SurfaceFlinger should use refresh rate switching on the device, e.g. between 60 and 120 Hz (default: true)
ro.surface_flinger.refresh_rate_switching

# value used by the Scheduler to trigger display power inactivity callbacks (default: 1000)
ro.surface_flinger.set_display_power_timer_ms

# used by the Scheduler to trigger touch inactivity callbacks that will switch display to a lower refresh rate (default: 200)
ro.surface_flinger.set_touch_timer_ms
Hi, what's your experience with these changings now?
Can you send the exact settings for a script please?
 

73sydney

Account currently disabled
For Samsung devices with high refresh rate displays there is Galaxy Max Hz, that has an adaptive mode (Pixel default from what i understand in the few hours ive been back on Pixel (6 Pro)) and also a screen off low rate, and also per app granular control. So far havent seen an equivalent for Pixel, but hopefully a matter of time
 

73sydney

Account currently disabled
How to get magisk resteprop? I can't find anything about it


Its an applet of magisk, its functions are outlined here:


short version, you could call it via script (post-fs-data.sh OR service.sh - depending on at which point of the boot process you wanted to use it)

boot stages of magisk explained here:


service.sh is preferred (see here for why: https://topjohnwu.github.io/Magisk/guides.html#boot-scripts )


but

as mentioned it would be easier to add it to a system.prop file it the root folder of a magisk module and try that first

and if you were looking to create a magisk module and fiddle, this template by @Zackptg5 is what id recommend and i use:


and his excellent wiki:


A module might be as simple as (i could do it in about 5 minutes, (and it shouldnt take you much more as a 1st timer, as this is a simple module), but people should learn this themselves):

1) Download the MMT- Extended template linked above buy going to the github link, then click (towards top) green Code button, then Download Zip or click here: https://github.com/Zackptg5/MMT-Extended/archive/refs/heads/master.zip

2) Extract the zip somewhere, giving you a folder "MMT-Extended-master"

3) Rename "MMT-Extended-master" to the name of the module youre creating

4) Descend into this folder, delete what you dont need - in this case:

system folder
zygisk folder
changelog.md (unless you plane to update and maintain a changelog)
update.json (unless you plan to submit to a repo)

5) Edit module.prop to set values for the module name etc (remove the update updateJson line if you removed the update.json file)

6) Add a system.prop file in the folder

7) Open with a good text editor (notepad++ is reocmmended) and add the necessary line:

Code:
ro.surface_flinger.use_content_detection_for_refresh_rate false

8) Save the file

9) Select all the contents of the folder, and compress (preferably with anything but WinRAR (as it can create wonlky zip files))

10) Transfer to device, flash via Magisk Manager (NOT TWRP) and test

Only if this way fails would i bother with trying to add the resetprop method buy adding the

Code:
resetprop ro.surface_flinger.use_content_detection_for_refresh_rate false

line in service.sh (created in the folder), usually people would try this way with a delay (sleep <seconds>) to try and change it much later than the resetprop stage in system.prop...timing can sometimes be everything

Magisk modules dont need to be hard and thats a VERY simple one
 
  • Like
Reactions: heni63

heni63

Senior Member
Dec 26, 2017
120
33
I have a Pixel 6a, might it be possible to reduce the Refresh Rate to 30Hz with this method?

Btw: Thank you for sharing your knowledge/findings guys!
 

Top Liked Posts

  • There are no posts matching your filters.
  • 6
    Screen refresh rate is controlled by several variables, 3 which I found are:
    Code:
    # getprop ro.surface_flinger.use_content_detection_for_refresh_rate
    This instructs the screen compositor (surface flinger) to look at screen content to control screen refresh rate. 'true' by default; you will need root and Magisk's resetprop to override it, e.g.
    Code:
    # resetprop ro.surface_flinger.use_content_detection_for_refresh_rate false
    But note that that does not stick after reboot, you will need a magisk module to force that upon boot. Add the property to system.prop file in the magisk module top directory.

    Then:
    Code:
    # settings get system min_refresh_rate
    0 by default; you can set e.g. to '60'
    Code:
    # settings put system min_refresh_rate 60
    And the peak refresh:
    Code:
    # settings get system peak_refresh_rate
    60 or 120 depending on toggle 'Smooth display' in Settings.

    When you use 'Force peak refresh rate' in developer options then:
    Code:
    # settings list system | grep refresh
    min_refresh_rate=120.00001

    Weird number by the way. Anyway that forces the driver into 120Hz continuously.

    I have personally set min=60, peak=120 and the surface flinger content detection to 'false' ... just to see how this goes for a couple of days.

    And finally some other properties related to surface_flinger:
    Code:
    # indicates whether SurfaceFlinger should use refresh rate switching on the device, e.g. between 60 and 120 Hz (default: true)
    ro.surface_flinger.refresh_rate_switching
    
    # value used by the Scheduler to trigger display power inactivity callbacks (default: 1000)
    ro.surface_flinger.set_display_power_timer_ms
    
    # used by the Scheduler to trigger touch inactivity callbacks that will switch display to a lower refresh rate (default: 200)
    ro.surface_flinger.set_touch_timer_ms
    2
    Interesting ...
    2
    So far no issues ... all working fine. I have now set the minimum as well to 120 Hz ... just to see how that might affect things ...
    1
    How to get magisk resteprop? I can't find anything about it


    Its an applet of magisk, its functions are outlined here:


    short version, you could call it via script (post-fs-data.sh OR service.sh - depending on at which point of the boot process you wanted to use it)

    boot stages of magisk explained here:


    service.sh is preferred (see here for why: https://topjohnwu.github.io/Magisk/guides.html#boot-scripts )


    but

    as mentioned it would be easier to add it to a system.prop file it the root folder of a magisk module and try that first

    and if you were looking to create a magisk module and fiddle, this template by @Zackptg5 is what id recommend and i use:


    and his excellent wiki:


    A module might be as simple as (i could do it in about 5 minutes, (and it shouldnt take you much more as a 1st timer, as this is a simple module), but people should learn this themselves):

    1) Download the MMT- Extended template linked above buy going to the github link, then click (towards top) green Code button, then Download Zip or click here: https://github.com/Zackptg5/MMT-Extended/archive/refs/heads/master.zip

    2) Extract the zip somewhere, giving you a folder "MMT-Extended-master"

    3) Rename "MMT-Extended-master" to the name of the module youre creating

    4) Descend into this folder, delete what you dont need - in this case:

    system folder
    zygisk folder
    changelog.md (unless you plane to update and maintain a changelog)
    update.json (unless you plan to submit to a repo)

    5) Edit module.prop to set values for the module name etc (remove the update updateJson line if you removed the update.json file)

    6) Add a system.prop file in the folder

    7) Open with a good text editor (notepad++ is reocmmended) and add the necessary line:

    Code:
    ro.surface_flinger.use_content_detection_for_refresh_rate false

    8) Save the file

    9) Select all the contents of the folder, and compress (preferably with anything but WinRAR (as it can create wonlky zip files))

    10) Transfer to device, flash via Magisk Manager (NOT TWRP) and test

    Only if this way fails would i bother with trying to add the resetprop method buy adding the

    Code:
    resetprop ro.surface_flinger.use_content_detection_for_refresh_rate false

    line in service.sh (created in the folder), usually people would try this way with a delay (sleep <seconds>) to try and change it much later than the resetprop stage in system.prop...timing can sometimes be everything

    Magisk modules dont need to be hard and thats a VERY simple one
    1
    Came across this in my travels today(not tested by me), just linking for interested parties