nikp123 / scrcpy-desktop

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

Desktop mode refuses to display properly or to run a launcher #16

Closed UnsavedTrash closed 1 year ago

UnsavedTrash commented 1 year ago

Desktop OS: Arch Linux Desktop details: RTX 3090, R7-5700x, NVIDIA driver 535.54.03 Mobile OS: GrapheneOS Model: Pixel 7 Pro SCRCPY Version: 2.1

Although the script does set all the right developer options and reboots the phone after the first run, it fails to actually engage a desktop environment. I have tried many configurations and a few different versions of Null keyboard1 as well as many different settings configurations of Taskbar. The secondary screen overlay does show and it gives me a slice of the view but never actually loads Taskbar.

I also get the error Host system has incompatible settings. Sorry about that.

$ ./startscreen.sh 
Host system has incompatible settings. Sorry about that.
payload/stage1.sh: 1 file pushed, 0 skipped. 24.9 MB/s (881 bytes in 0.000s)
payload/stage2.sh: 1 file pushed, 0 skipped. 32.4 MB/s (1247 bytes in 0.000s)
scrcpy 2.1 <https://github.com/Genymobile/scrcpy>
/usr/share/scrcpy/scrcpy-server: 1 file pushed, 0 skipped. 700.6 MB/s (56955 bytes in 0.000s)
-----------------------------------------------------
|                                                   |
|  Please unlock the phone once the screen appears  |
|                                                   |
-----------------------------------------------------
SCRCPY PID: 82832
[server] INFO: Device: [Google] google Pixel 7 Pro (Android 13)
[server] WARN: Display doesn't have FLAG_SUPPORTS_PROTECTED_BUFFERS flag, mirroring can be restricted
INFO: USB device: 2B051FDH300DEP (18d1:4ee7) Google Pixel 7 Pro
INFO: Renderer: opengl
INFO: OpenGL version: 4.6.0 NVIDIA 535.54.03
INFO: Trilinear filtering enabled
INFO: Texture: 1080x2336
[server] INFO: Device screen turned off

The SCRCPY window opens in the standard resolution of the pixel as if I was running SCRCPY unmodified. The only difference being no ability to interact, see any apps, and the bottom third of the screen displays nothing.

image

If I attempt to expand the window it also shows no additional image to the left or right, although in the hovering overlay for the emulated second display when looking at the phone shows much more of the image. Despite the hovering 2nd display showing more of the image it still shows no Taskbar, just the wallpaper.

image

Phone POV image

1 null keyboard is no longer available on google play so the read me may need updating.

nikp123 commented 1 year ago

From the preview it seems that it did load the desktop environment (albeit the stock one), I think scrcpy may be incorrectly capturing the screen. Try to play around with scrcpy flags in order to get it to capture the screen properly.

The "The host system has incompatible settings" is the script not being able to get the native resolution of the phone. Since the code relies on shebang behavior, it is very likely something changed in the android terminal output.

Either way, thanks for the (very detailed) reporting, however I may not be available at the moment because I am studying for an exam.

nikp123 commented 1 year ago

Also please try launching this script with the resolution and density already set: ./startscreen.sh 1920x1080 120

UnsavedTrash commented 1 year ago

running it like that yields identical behavior to what was initially reported.

$ ./startscreen.sh 1920x1080 120
* daemon not running; starting now at tcp:5037
* daemon started successfully
payload/stage1.sh: 1 file pushed, 0 skipped. 5.7 MB/s (881 bytes in 0.000s)
payload/stage2.sh: 1 file pushed, 0 skipped. 7.0 MB/s (1247 bytes in 0.000s)
scrcpy 2.1 <https://github.com/Genymobile/scrcpy>
/usr/share/scrcpy/scrcpy-server: 1 file pushed, 0 skipped. 142.1 MB/s (56955 bytes in 0.000s)
-----------------------------------------------------
|                                                   |
|  Please unlock the phone once the screen appears  |
|                                                   |
-----------------------------------------------------
SCRCPY PID: 5693
[server] INFO: Device: [Google] google Pixel 7 Pro (Android 13)
[server] WARN: Display doesn't have FLAG_SUPPORTS_PROTECTED_BUFFERS flag, mirroring can be restricted
INFO: USB device: 2B051FDH300DEP (18d1:4ee7) Google Pixel 7 Pro
INFO: Renderer: opengl
INFO: OpenGL version: 4.6.0 NVIDIA 535.54.03
INFO: Trilinear filtering enabled
INFO: Texture: 1080x2336
[server] INFO: Device screen turned off
kinostl commented 1 year ago
    ~/scrcpy-desktop    main    ./startscreen.sh     ✔ 
scrcpy 2.1 <https://github.com/Genymobile/scrcpy>
payload/stage1.sh: 1 file push...5.8 MB/s (881 bytes in 0.000s)
payload/stage2.sh: 1 file push....3 MB/s (1247 bytes in 0.000s)
/usr/share/scrcpy/scrcpy-server: 1 file pushed, 0 skipped. 212.0 MB/s (56955 bytes in 0.000s)
-----------------------------------------------------
|                                                   |
|  Please unlock the phone once the screen appears  |
|                                                   |
-----------------------------------------------------
SCRCPY PID: 43660
[server] INFO: Device: [Google] google Pixel 6a (Android 13)
INFO: USB device: 26101JEGR01982 (18d1:4ee7) Google Pixel 6a
[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 23.0.4
INFO: Trilinear filtering enabled
INFO: Texture: 1080x2400
[server] INFO: Device screen turned off

I am also experiencing this issue. It was working the day before yesterday, before I did my weekly computer updates, if that provides any hints.

Mobile OS: Stock Linux OS: Manjaro 6.2.16-2

nikp123 commented 1 year ago

can you give me your /var/log/pacman.log i may find what might be the offending package @kinostl

kinostl commented 1 year ago

@nikp123 Sure thing. It includes a lot, it was a kernel update.

pacman.log

nikp123 commented 1 year ago

you upgraded scrcpy 2.0 -> 2.1, that may be our clue

nikp123 commented 1 year ago

Yep confirmed on scrcpy 2.1, we have the EXACT same issue.

nikp123 commented 1 year ago

It's weird though, sometimes it works and sometimes it doesn't.

nikp123 commented 1 year ago

Ok, narrowing it down a bit. It seems that scrcpy grabs the (wrong?) display. However if you launch a second instance it grabs the correct one.

kinostl commented 1 year ago

Activating a second instance does not fix it for me. image

nikp123 commented 1 year ago

This is an upstream regression, since Android is reporting the correct "virtual resolution" via dumpsys display. Might have to file this over at scrcpy.

nikp123 commented 1 year ago

If you do adb shell 'dumpsys display | grep mDisplayId=' you'll get the active display IDs of your android device. 0 is always your primary, your phone's screen. The other ID is the virtual display, setting it via scrcpy --display $num, it recognizes the screen properly, but it fails to grab its resolution. This may be a bug on scrcpy's part as suggested by my previous comment.

nikp123 commented 1 year ago

There isn't much I can do apart from getting this fixed in upstream?

kinostl commented 1 year ago

For right now the advice to downgrade was useful enough for me. I just confirmed that downgrading fixes it on my end.

nikp123 commented 1 year ago

@kinostl can you try invoking scrcpy manually just to make sure that my behaviour of it fixing itself when running a second instance isn't a fluke. ie:

nikp123 commented 1 year ago

Already filed at https://github.com/Genymobile/scrcpy/issues/4157 Seems that their crop thing is not up to snuff. I'll try making it work with the --crop parameter.

kinostl commented 1 year ago

@nikp123 I don't think I can replicate on my end. image

nikp123 commented 1 year ago

Weird, I guess its a per machine behaviour.

nikp123 commented 1 year ago

Already filed at Genymobile/scrcpy#4157 Seems that their crop thing is not up to snuff. I'll try making it work with the --crop parameter.

--crop doesn't really help, it's still the wrong display resolution. We'll have to wait for an update from upstream.

nikp123 commented 1 year ago

Seems to be fixed in a future release, we just need to wait for it to get released.

UnsavedTrash commented 1 year ago

I can also confirm that the downgrade to scrcpy 2.0.1 fixed the issue for me.

nikp123 commented 1 year ago

Scrcpy 2.1.1 fixes this. Closing.