-
-
Notifications
You must be signed in to change notification settings - Fork 10.5k
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
Vsync and run problems with example_sdl_opengl3 on RPi4b Bullseye #5065
Comments
In my experience, Have you tried changing your GL driver with If you want to check what you're currently using. Look at |
Hi! I have not tried 'example_glfw_opengl3' just because glfw doesn't allow for easy kmsdrm rendering (no x11, CLI screen) but the SDL backend does. I'll try it after work just to see what happens though. The PiOS is a newly flashed image using the official rpi-imager + update-upgrade. Did I say that 'example_sdl_opengl2' (note 2) is working as expected? I added 'GL_DEPTH_BUFFER_BIT' to my glClear statement and to my eye the vsync looking glitches calmed down somewhat. But not enough still pretty strong. Interestingly, after I switch my program to kmsdrm render and then back again to SDL+imgui the refresh glitches completely disappear. It does that every time I try. So I'm wondering if there's some kms mode setting that is incorrect and that my kmsdrm code somehow fixes. I'm not that savvy on that side of things to know what I would need to check. EDIT: I should add that I'm using a Official Mesa release 21.3.1 built from source. UPDATE: I just put back the Imgui frame counter from the demo code and I see that in the CLI/kmsdrm I'm rendering at ~109 fps, or quite possibly whatever speed it can. Although according to manuals 'SDL_RenderPresent(sdl_renderer);' is meant to wait for monitor vsync refresh before draw flipping so I'm not sure why that's not happening in the first place. UPDATE2: Nah I don't think that solved it. I tried doing that through SDL and cot a refresh clamp for around 60fps but no difference in vsync glitching. |
I know full KMS ( If I were you, I'd try to repro the glitches with a simple Hello Triangle app (with some added animation of course) to try and narrow down whether this is fundamental or coming from a specific pattern in Dear ImGui.
Now knowing about the kmsdrm rendering: You might be seeing this because you aren't using X11. Dear ImGui's loader uses You might try manually applying @ShadowNinja's gl3w patch to Dear ImGui's loader or modify it to use |
Hi and thanks again for the suggestions! |
Here's the video. Sorry its slightly dark. The glitching happens on the whole bottom of the screen not just over the yellow. This shows the Imgui+SDL GUI glitching at startup. https://www.youtube.com/watch?v=9p7AUBnokAk A strange thing is that I tried taking the SD card from the Pi4b and use it with my Pi Zero2W. Booting from that and running the program exactly the same. And on the Zero2W the sync glitching does not happen. |
I figured out what to do! :) I was surprised to see that the X11 mode was RGB and the tty/CLI screen was ARGB. Cheers! |
I almost wonder if it's swapping the buffers but not waiting for vsync so the back buffer is being scanned out while you're still rendering to it. If it was just normal tearing I wouldn't expect things to disappear entirely.
The Zero2W is basically a tiny Pi 3, so it's not quite the same hardware. I wouldn't be surprised if you've found a bug in the driver specific to the VideoCore VI. Did you end up posting your video on the Raspberry Pi forums? |
Yes I did you can see here but no exciting replies yet, https://forums.raspberrypi.com/viewtopic.php?p=1980245#p1980245 |
To anyone else seeing this issue, setting However, editing the Makefile to use OpenGL ES will get it to run without requiring a variable to be set. |
(you may also go to Demo>About Window, and click "Config/Build Information" to obtain a bunch of detailed information that you can paste here)
Version/Branch of Dear ImGui:
fa2b318
Version: fa2b318
Branch: master
Back-end/Renderer/Compiler/OS
Raspberry Pi 4b Bullseye 32bit
Linux raspberrypi 5.10.92-v7l+ #1514 SMP Mon Jan 17 17:38:03 GMT 2022 armv7l GNU/Linux
Back-ends: imgui_impl_sdl.cpp + imgui_impl_opengl3.cpp
Compiler: gcc (Raspbian 10.2.1-6+rpi1) 10.2.1 20210110
My Issue/Question:
I am making an app that runs both on the X11 desktop and without x11 on the tty/cli.
I'm using SDL+imgui and kmsdrm rendering on the cli. This is why I chose the SDL backend as it was 'easy' to do.
I started developing on a Buster version of the RPiOS but am now moving over to test on Bullseye which is going to be the 'supported' OS for me. Imgui was doing fine under Buster but now under Bullseye I'm getting strong what looks like vsync glitching. This didn't happen at all under Buster.
I then tried to compile the Imgui example, example_sdl_opengl3, and building goes ok.
But when running it I get:
Again this Imgui example worked fine under Buster and I'm now wondering if this and my issue might be related?
Standalone, minimal, complete and verifiable example:
Build example_sdl_opengl3 on the above mentioned system and try running.
I'm happy to show my code but I think it might be cleanest start with the imgui example?
Actually might as well post it:
https://github.com/Fredrum/chiaki/blob/rpi02/rpi/src/main.cpp
https://github.com/Fredrum/chiaki/blob/rpi02/rpi/src/gui.cpp
Cheers!
Fred
The text was updated successfully, but these errors were encountered: