nikp123 / scrcpy-desktop

Run an Android desktop environment off of a device using ONLY scrcpy
GNU General Public License v2.0
220 stars 15 forks source link

force_desktop_mode_on_external_displays phone support (OnePlus 6T) #2

Closed mercurytoxic closed 3 years ago

mercurytoxic commented 3 years ago

Mirror stays on the phone, it seems that not all phones support force_desktop_mode_on_external_displays.

scrcpy works well with my OnePlus 6T, but when I try startscreen.sh I get a black screen on the PC and the second screen stays on the device.

$./startscreen.sh 
payload/stage1.sh: 1 file pushed, 0 skipped. 7.2 MB/s (673 bytes in 0.000s)
INFO: scrcpy 1.19 <https://github.com/Genymobile/scrcpy>
payload/stage2.sh: 1 file pushed, 0 skipped. 4.6 MB/s (369 bytes in 0.000s)
/usr/share/scrcpy/scrcpy-server: 1 file pushed, 0 skipped. 276.6 MB/s (37330 bytes in 0.000s)
-----------------------------------------------------
|                                                   |
|  Please unlock the phone once the screen appears  |
|                                                   |
-----------------------------------------------------
SCRCPY PID: 188169
[server] INFO: Device: OnePlus ONEPLUS A6010 (Android 11)
[server] WARN: Display doesn't have FLAG_SUPPORTS_PROTECTED_BUFFERS flag, mirroring can be restricted
INFO: Renderer: opengl
INFO: OpenGL version: 4.6 (Compatibility Profile) Mesa 21.2.1
INFO: Trilinear filtering enabled
INFO: Initial texture: 3760x2880
WARN: Killing the server...
Screenshots
![Screenshot from 2021-10-17 12-27-35](https://user-images.githubusercontent.com/739809/137607055-703401f3-0557-479e-9612-7a1c99971f92.png) ![photo_2021-10-17_12-47-07](https://user-images.githubusercontent.com/739809/137607211-a2f3aefa-c961-4127-8362-143c730fa041.jpg)

When I try it manually, the response is null.

$adb shell settings get global force_desktop_mode_on_external_displays
null

Even though

$adb shell dumpsys display | grep "  Display " 
  Display 0:
  Display 4:

Not sure if this is relevant but in reference to the FLAG_SUPPORTS_PROTECTED_BUFFERS flag, https://developer.android.com/reference/android/view/Display#FLAG_SUPPORTS_PROTECTED_BUFFERS If this flag is not set then the display device may not support compositing protected buffers; the user may see a blank region on the screen instead of the protected content.

If I am correct, maybe I would be useful to include a sanity check for unsupported devices?

mercurytoxic commented 3 years ago

Fixed by manually running : $ adb shell settings put global force_allow_on_external 1 $ adb shell settings put global force_desktop_mode_on_external_displays 1