Skip to content
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

Device is found but no screen displayed (Fedora, SDL 2.0.24) #3431

Open
luckyvictor opened this issue Aug 11, 2022 · 39 comments
Open

Device is found but no screen displayed (Fedora, SDL 2.0.24) #3431

luckyvictor opened this issue Aug 11, 2022 · 39 comments

Comments

@luckyvictor
Copy link

I have had USB debug enabled, and windows can find my device. Scrcpy can also find my device, however it never shows a pop up screen of my device screen, below is everything it outputs before the cmd closes itself.

scrcpy-ser... file pushed, 0 skipped. 17.8 MB/s (41159 bytes in 0.002s)
[server] INFO: Device: OPPO CPH1919 (Android 11)

Sorry it seems to be a very simple problem, but i don find any thing here or google, I guess nobody experience such problem.

Environment

  • OS: [Windows 10]
  • scrcpy version: [1.24]
  • installation method: [zip/exe]
  • device model: OPPO CPH1919
  • Android version: [11]
@rom1v
Copy link
Collaborator

rom1v commented Aug 11, 2022

Try with a lower resolution (scrcpy -m1024) or with another encoder.

@luckyvictor
Copy link
Author

tried lower resolution, doesn't work.
tried 3 encoders, none of them work as well
scrcpy --encoder 'OMX.qcom.video.encoder.avc'
scrcpy --encoder 'c2.android.avc.encoder'
scrcpy --encoder 'OMX.google.h264.encoder'

I used another software named Vysor and I can see my android screen on my PC, so pretty sure my PC is ready, just some settings in Scrcpy has not been configured correctly.

@Astrosp
Copy link

Astrosp commented Aug 12, 2022

would you share screenshot...

@luckyvictor
Copy link
Author

image

@luckyvictor
Copy link
Author

any one has any suggestion?

@rom1v
Copy link
Collaborator

rom1v commented Aug 16, 2022

Does it record with screenrecord?

adb shell screenrecord /sdcard/file.mp4
adb pull /sdcard/file.mp4

@o-data
Copy link

o-data commented Aug 19, 2022

What driver did you use @luckyvictor ? SCRCPY can't find my Oppo device

@luckyvictor
Copy link
Author

how to do the screenrecord? is it under scrcpy?

@luckyvictor
Copy link
Author

I don't what driver, it just finds it, I am using windows 10.

@yunopie
Copy link

yunopie commented Aug 26, 2022

I have similar issues. The output thinks it is working, but the picture doesnt appear.
Tried the different encoders and lower resolution.

OS: Fedora 36
scrcpy version: [1.24]
installation method: [dnf copr zeno/scrcpy]
device model: motorola moto g(6)
Android version: [9]

This just started the past week when I updated booted previous (5.18.17) kernel and still didnt work. Today i updated to 5.18.19 and that didnt help.

@yunopie
Copy link

yunopie commented Aug 27, 2022

There were recently SDL2 and mesa package updates .. i wonder if thats what caused this issue

@jremond
Copy link

jremond commented Aug 28, 2022

I have similar issues. The output thinks it is working, but the picture doesnt appear. Tried the different encoders and lower resolution.

OS: Fedora 36 scrcpy version: [1.24] installation method: [dnf copr zeno/scrcpy] device model: motorola moto g(6) Android version: [9]

This just started the past week when I updated booted previous (5.18.17) kernel and still didnt work. Today i updated to 5.18.19 and that didnt help.

Same issue for me,
OS: Fedora 36
scrcpy version: [1.24]
installation method: [dnf copr zeno/scrcpy]
device model: Xiaomi Mi A2 Lite
Android version: [10]

-> scrcpy 
scrcpy 1.24 <https://github.com/Genymobile/scrcpy>
WARN: Could not disable minimize on focus loss
/usr/share/scrcpy/scrcpy-server: 1 file pushed, 0 skipped. 540.5 MB/s (41159 bytes in 0.000s)
[server] INFO: Device: Xiaomi Mi A2 Lite (Android 10)
INFO: Renderer: opengl
INFO: OpenGL version: 4.6 (Compatibility Profile) Mesa 22.1.7
INFO: Trilinear filtering enabled
INFO: Initial texture: 1080x2280

@jremond
Copy link

jremond commented Aug 28, 2022

Does it record with screenrecord?

adb shell screenrecord /sdcard/file.mp4
adb pull /sdcard/file.mp4

screenrecord works for me, I can read the mp4 file on my computer without issue

@rom1v
Copy link
Collaborator

rom1v commented Aug 28, 2022

@jremond Try with another encoder: https://github.com/Genymobile/scrcpy#encoder

@jremond
Copy link

jremond commented Aug 28, 2022

@jremond Try with another encoder: https://github.com/Genymobile/scrcpy#encoder

[server] ERROR: Try to use one of the available encoders:
[server] ERROR:     scrcpy --encoder 'OMX.qcom.video.encoder.avc'
[server] ERROR:     scrcpy --encoder 'c2.android.avc.encoder'
[server] ERROR:     scrcpy --encoder 'OMX.google.h264.encoder'

Trying with all 3 encoders still fails, no window.

scrcpy -r file.mp4

does work but I still don't see any window on my computer.

@rom1v
Copy link
Collaborator

rom1v commented Aug 28, 2022

Does the recorded file work?

@jremond
Copy link

jremond commented Aug 28, 2022

Yes, I did some actions using the phone directly and the video shows everything correctly.
It does seem like it's only the scrcpy window that is missing.

@rom1v
Copy link
Collaborator

rom1v commented Aug 28, 2022

Then do not use the COPR package, but install manually: https://github.com/Genymobile/scrcpy/blob/master/BUILD.md#simple

@jremond
Copy link

jremond commented Aug 28, 2022

Same issue with a manual install, I did retry all the steps (3 different encoders, scrcpy -r command)
Still no window showing up.

@genodeftest
Copy link

genodeftest commented Aug 29, 2022

I can confirm this issue on Fedora 36 with two different almost-stock android phones (on Android 9 and 11) and the following software installed:

SDL2-2.24.0-1.fc36.x86_64
android-tools-31.0.2-3.fc36.x86_64
ffmpeg-libs-5.0.1-3.fc36.x86_64
libavdevice-5.0.1-3.fc36.x86_64
glibc-2.35-15.fc36.x86_64
libusb1-1.0.25-8.fc36.x86_64

After downgrading SDL2 to SDL2-2.0.20-3.fc36.x86_64 by using dnf downgrade SDL2, scrcpy works fine again. As far as I remember, SDL2-2.0.22-3.fc36.x86_64 also worked fine. The update to 2.24.0 has been pushed to Fedora's stable repositories on 2022-08-23

I don't know how/whether SDL2 is being used and/or updated on Windows but this may help @yunopie and @jremond as a first workaround.

I have some experience in debugging using gdb, so if you need some more info please tell me (though it may take some time).

PS: If you wonder how I isolated SDL2, here is the Fedora-specific description how I found out: I did not remember that I updated scrcpy lately (dnf info update scrcpy | less will help you remember when the last update has been installed). I also remembered that I did not update Android on the two phones lately, so it had to be some configuration (don't remember changing any configuration lately) or other dependency on my computer. Getting dependencies of scrcpy can be done with rpmreaper scrcpy (press the r key) or dnf repoquery --requires --resolve scrcpy. Then I tried downgrading them. SDL2 was the only package updated lately so it could be downgraded and that worked around this issue for me.

@genodeftest
Copy link

Possibly related, on Linux:

Possibly related, on Windows:

@jremond
Copy link

jremond commented Aug 29, 2022

dnf downgrade SDL2-2.0.20-3.fc36.x86_64 solves the problem for me, thanks @genodeftest !

@yunopie
Copy link

yunopie commented Aug 29, 2022

using dnf downgrade SDL2, scrcpy works fine again.

Can confirm.
The dnf downgrade of SDL2 fixed the window not showing up.

Im even on 5.19.4 kernel

@rom1v rom1v changed the title Device is found but no screen displayed Device is found but no screen displayed (Fedora, SDL 2.0.24) Aug 29, 2022
@huang-jy
Copy link

Just adding that

SDL_VIDEODRIVER=x11 scrcpy

worked for me, without having to downgrade any packages

@yunopie
Copy link

yunopie commented Aug 30, 2022

I updated my SDL2 back to SDL2-2.24.0-1.fc36.x86_64
to try using the variable

SDL_VIDEODRIVER=x11

I updated the scrcpy.desktop file so it can launch it again.

Exec=bash -c "SDL_VIDEODRIVER=x11 scrcpy -m 740"

@luckyvictor
Copy link
Author

so for my original problem, which is on windows, what would be the solution please?

@rom1v
Copy link
Collaborator

rom1v commented Aug 31, 2022

how to do the screenrecord? is it under scrcpy?

Nope, open a terminal (click on open_a_terminal_here.bat from the scrcpy folder), and execute the commands from #3431 (comment)

@luckyvictor
Copy link
Author

/system/bin/sh: screenrecord: inaccessible or not found

this is the error i have

@rom1v
Copy link
Collaborator

rom1v commented Aug 31, 2022

Weird, all Android ROMs are expected to have screenrecord available.

@sgros
Copy link

sgros commented Sep 3, 2022

/system/bin/sh: screenrecord: inaccessible or not found

this is the error i have

This is the same error I'm getting when trying 'adb shell screenrecord'. This is Huawei P30 Pro, if that matters.

@fernandoherreradelasheras

This issue happening Fedora 36 is a bug on SDL2 2.24.0 when using wayland and compiled with libdecor support. I have reported it here: libsdl-org/SDL#6204

TLDR: SDL_WaitEvent() blocks and doesn't process SDL_USEREVENTs pushed before the window is shown (and in general, the libdecor_dispatch call there breaks heavily user events)

A workaround would be using SDL_PollEvent() instead.

@winkelnp
Copy link

Same issue happening with my Fairphone4 with Android 11 on Fedora 36 GNOME with Wayland

@derino
Copy link

derino commented Oct 20, 2022

Had the same problem. Changing the encoder as suggested above, but also installing these multimedia codecs solved the problem.

@gilice
Copy link

gilice commented Nov 6, 2022

Hey! For me, on NixOs the solution to this same issue was very weird: sudo scrcpy works, but simply srcpy didn't.

@genodeftest
Copy link

Hey! For me, on NixOs the solution to this same issue was very weird: sudo scrcpy works, but simply srcpy didn't.

Please don't run scrcpy with sudo. You should avoid running any application with higher privileges as it would weaken security and safety concepts of your operating system. Scrcpy for example runs video codecs which are used as an attack surface sometimes.

@gilice
Copy link

gilice commented Nov 11, 2022

While that is good advice in general, it is what works for me. I didn't have time to debug it properly by reading dmesg yet, maybe I'll update this comment if I find out the cause.

@masiv1001
Copy link

Can't downgrade (running Fedora 38), SDL_VIDEODRIVER=x11 scrcpy does not work. Installed media codecs as suggested above but still not working.

@genodeftest
Copy link

The fedora issue described above was fixed before SDL2 version 2.26.0, so it has been fixed almost a year ago, which I can confirm on my machine (even with very old hardware that only supports OpenGL 2.1). On Fedora 38, you should not be able to run a version older than that, so the issue you are seeing is something different. I recommend you try without SDL_VIDEODRIVER=x11 and if that does not help, I recommend opening a new issue. Also, please provide a lot more information, i.e., which software versions you are running (of scrcpy, SDL2, android-tools, ffmpeg-libs, libavdevice, mesa), on which interface you are connected (USB?) and the output of scrcpy from a shell.

Anyway, most of this thread has diverged a lot from the first comment, so I suggest this thread should be closed.

@ZararSW
Copy link

ZararSW commented Jun 28, 2024

your screen must have been turned off from the cmd you can try "ctrl + shift + o" to turn the screen on . it worked for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests