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

SDL2 2.24.1: SDL_Init() fails on Raspberry Pi 3 with Kernel 5.15 #6421

Closed
michael1413 opened this issue Oct 20, 2022 · 12 comments
Closed

SDL2 2.24.1: SDL_Init() fails on Raspberry Pi 3 with Kernel 5.15 #6421

michael1413 opened this issue Oct 20, 2022 · 12 comments
Assignees
Milestone

Comments

@michael1413
Copy link

The SDL_Init(SDL_INIT_VIDEO) fails on Raspberry Pi 3 with Kernel 5.15.
I get the error message "Unknown touch device id 5, cannot reset"

After running the program "kmscube -c 0", the SDL_Init() works.
In the line from which it works is written drmModeSetCrtc()

With Kernel 5.10 there are no problems.

SDL2 Version 2.24.1
MESA 3d Version 22.2.1

regards,
Michael

@icculus icculus transferred this issue from libsdl-org/SDL-1.2 Oct 20, 2022
@ericcurtin
Copy link
Contributor

Saw the same on Intel machine running Fedora 36, attempting to use kmsdrm for https://github.com/ericcurtin/twincam/

In my case I don't even want to use a touch device, I just want to use SDL to display video.

@slouken slouken added this to the 2.26.0 milestone Nov 1, 2022
@icculus
Copy link
Collaborator

icculus commented Nov 15, 2022

So my assumption is it's trying to add any touch devices it sees at startup; on my laptop with a trackpad, this doesn't seem to find one for whatever reason.

If someone could try this: run the app under a debugger, and set a breakpoint at SDL_touch.c:100, which is this line:

SDL_SetError("Unknown touch device id %d, cannot reset", (int) id);

And then run the program. When that breakpoint triggers, post the backtrace ("bt" command in gdb) here.

@icculus
Copy link
Collaborator

icculus commented Nov 15, 2022

on my laptop with a trackpad, this doesn't seem to find one for whatever reason.

(Also possible that kernel 5.15 is reporting a bogus device, and I am not on that version, which is why I don't see a device, let alone a failure, here.)

@michael1413
Copy link
Author

After running "kmscube -c 0" my touch display works. The touch device is connected via I2C.

@slouken slouken assigned slouken and unassigned icculus Nov 16, 2022
@slouken
Copy link
Collaborator

slouken commented Nov 16, 2022

I think the touch error message is a red herring. The only touch code that runs in this case is in response to udev enumeration, but failure in any of those paths doesn't translate into an initialization failure.

I think the real problem is that SDL is assuming that the CRTC is configured rather than trying to configure it itself. That is for better interoperability with existing display management systems, but is an issue when you are running it for the first time on an unconfigured display.

@icculus
Copy link
Collaborator

icculus commented Nov 16, 2022

Do we want to do something about this for 2.26.0, or is this going to be a significant effort?

@slouken
Copy link
Collaborator

slouken commented Nov 16, 2022

I'll take a look today and see.

@slouken
Copy link
Collaborator

slouken commented Nov 16, 2022

@michael1413, can you provide more information on your setup?

I have a Raspberry Pi 4 running Bullseye with kernel 5.15.76, and I've set it to boot directly to the console. I installed the latest SDL code and am running the testsprite2 program from the SDL test directory. It tells me that it's using kmsdrm and the OpenGL renderer, and runs fine here.

@slouken slouken added the waiting Waiting on user response label Nov 17, 2022
@michael1413
Copy link
Author

I have a Raspberry CM3+ and CM4 running an embedded Linux created with Buildroot.
Kernel is 5.15.76-v7l / SDL2 2.24.2

Renderer: opengles2 Software=0 Accelerated=1, Presentvsync=1 Targettexture=1
Current Mode bpp 32 SDL_PIXELFORMAT_ARGB8888 800 x 1280
INFO: SDL_GetNumVideoDisplays(): 1
INFO: SDL_GetNumDisplayModes: 1
INFO: Mode 0 bpp 32 SDL_PIXELFORMAT_ARGB8888 800 x 1280
Touch Devices = 1

@slouken
Copy link
Collaborator

slouken commented Nov 17, 2022

Any chance I can ssh into an account with sudo permissions to debug? You can send me e-mail at slouken@libsdl.org to coordinate.

@slouken slouken removed the waiting Waiting on user response label Nov 18, 2022
@slouken
Copy link
Collaborator

slouken commented Nov 18, 2022

So the real error is: Failed to find index of mode attached to the CRTC.
This totally makes sense in this context.

@slouken
Copy link
Collaborator

slouken commented Nov 18, 2022

Fixed, thanks!

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

4 participants