-
-
Notifications
You must be signed in to change notification settings - Fork 10.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support refresh rates over 60 FPS in NewDisplayCapture #5505
base: dev
Are you sure you want to change the base?
Conversation
I think we could make the refresh rate of the virtual display an adjustable option for users. |
Thank you 👍 However, in practice, I never get more than 60fps:
Whereas I get 120fps if I mirror the main display.
Instead, we could add a new
|
diff --git a/server/src/main/java/com/genymobile/scrcpy/video/NewDisplayCapture.java b/server/src/main/java/com/genymobile/scrcpy/video/NewDisplayCapture.java
index cadba8f1..f8d9fa05 100644
--- a/server/src/main/java/com/genymobile/scrcpy/video/NewDisplayCapture.java
+++ b/server/src/main/java/com/genymobile/scrcpy/video/NewDisplayCapture.java
@@ -183,7 +183,7 @@ public class NewDisplayCapture extends SurfaceCapture {
// If not do so, the refresh rate of the virtual display will be limited to 60.
// https://android.googlesource.com/platform/frameworks/base/+/6c57176e9a2882eff03c5b3f3cccfd988d38488d
// https://android.googlesource.com/platform/frameworks/base/+/6c57176e9a2882eff03c5b3f3cccfd988d38488d/services/core/java/com/android/server/display/VirtualDisplayAdapter.java#562
- if (maxFps > 60 && Build.VERSION.SDK_INT >= AndroidVersions.API_34_ANDROID_14) {
+ if (Build.VERSION.SDK_INT >= AndroidVersions.API_34_ANDROID_14) { Since my monitor doesn’t support 120Hz, I removed the condition and tested with
I agree with this approach. 👍 |
I'm not sure to understand, even without setting |
diff --git a/server/src/main/java/com/genymobile/scrcpy/video/NewDisplayCapture.java b/server/src/main/java/com/genymobile/scrcpy/video/NewDisplayCapture.java
index cadba8f1..f7dc49c0 100644
--- a/server/src/main/java/com/genymobile/scrcpy/video/NewDisplayCapture.java
+++ b/server/src/main/java/com/genymobile/scrcpy/video/NewDisplayCapture.java
@@ -183,11 +183,11 @@ public class NewDisplayCapture extends SurfaceCapture {
// If not do so, the refresh rate of the virtual display will be limited to 60.
// https://android.googlesource.com/platform/frameworks/base/+/6c57176e9a2882eff03c5b3f3cccfd988d38488d
// https://android.googlesource.com/platform/frameworks/base/+/6c57176e9a2882eff03c5b3f3cccfd988d38488d/services/core/java/com/android/server/display/VirtualDisplayAdapter.java#562
- if (maxFps > 60 && Build.VERSION.SDK_INT >= AndroidVersions.API_34_ANDROID_14) {
+ if (Build.VERSION.SDK_INT >= AndroidVersions.API_34_ANDROID_14) {
VirtualDisplayConfig.Builder builder = new VirtualDisplayConfig.Builder("scrcpy", displaySize.getWidth(), displaySize.getHeight(), dpi);
builder.setFlags(flags);
builder.setSurface(surface);
- builder.setRequestedRefreshRate(maxFps);
+ builder.setRequestedRefreshRate(24);
virtualDisplay = ServiceManager.getDisplayManager().createNewVirtualDisplay(builder.build()); I did make a mistake. Now, I directly set the refresh rate to 24 and tested using |
I implemented that on branch However, I will not merge it, because the virtual display rate feature in Android is very unstable/experimental (tested on Pixel 8):
So a scrcpy feature to configure the virtual display rate would be basically broken, it would just "not work" as expected. I keep the branch for later if the situation improves. |
When
maxFps
exceeds 60, use thesetRequestedRefreshRate
method to configure the refresh rate for the virtual display.Otherwise, the refresh rate will default to a maximum of 60 FPS.
Related Android commit
Code limiting the frame rate to 60 FPS