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

Cycling windowed / full-screen hangs X desktop on Raspberry Pi #1607

Open
MV10 opened this issue Jul 13, 2023 · 0 comments
Open

Cycling windowed / full-screen hangs X desktop on Raspberry Pi #1607

MV10 opened this issue Jul 13, 2023 · 0 comments

Comments

@MV10
Copy link
Contributor

MV10 commented Jul 13, 2023

Consistent, reproducible hang on the Raspberry Pi.

Running .NET 6, OpenTK 4.7.7 and 32-bit Raspbian Bullseye -- minimal repro code below just clears the screen and toggles back and forth between WindowState.Normal and WindowState.Fullscreen on spacebar keypresses. Sometimes I can get through two cycles (windowed, full, windowed, full), other times only one cycle. After that X is unresponsive, although the mouse works and I can connect over SSH. I ran pidof and found the PID for my test program and killed that, but X remains unresponsive. I have to reboot over SSH.

Since the GLFW redist doesn't include arm32 / armhf libraries, originally I was building GLFW locally according to advice from 2021 on the Pi forums. However, I also uninstalled that and ran the sudo apt install libglfw3 version, and both seem to behave identically. (And I see no indication there is anything wrong running the APT version, maybe they addressed it in the Bullseye release.)

Microsoft followed up on my VS bug report and found a work-around allowing remote-debug over SSH (their script incorrectly downloads the 64-bit debug client), so now I'm able to run a debug build of OpenTK if somebody wants me to look for anything in particular.

Minimal repro:

internal class Program
{
    static void Main(string[] args)
    {
        var gameCfg = new GameWindowSettings();
        
        var nativeCfg = new NativeWindowSettings
        {
            Title = "Test",
            Size = (960, 540),
            API = ContextAPI.OpenGLES,
            APIVersion = new Version(3, 2),
            Profile = ContextProfile.Core,
        };

        var win = new BugWindow(gameCfg, nativeCfg);
        win.Focus();
        win.Run();
        win.Dispose();
    }
}
public class BugWindow : GameWindow
{
    public BugWindow(GameWindowSettings gameSettings, NativeWindowSettings nativeSettings)
        : base(gameSettings, nativeSettings)
    { }

    protected override void OnLoad()
    {
        base.OnLoad();
        GL.ClearColor(0f, 0f, 1f, 1f);
    }

    protected override void OnRenderFrame(FrameEventArgs args)
    {
        base.OnRenderFrame(args);
        GL.Clear(ClearBufferMask.ColorBufferBit);
        Context.SwapBuffers();
    }

    protected override void OnResize(ResizeEventArgs e)
    {
        base.OnResize(e);
        GL.Viewport(0, 0, e.Width, e.Height);
    }

    protected override void OnUpdateFrame(FrameEventArgs e)
    {
        base.OnUpdateFrame(e);

        var input = KeyboardState;

        if (input.IsKeyReleased(Keys.Escape))
        {
            Close();
            return;
        }

        if (input.IsKeyReleased(Keys.Space))
        {
            WindowState = (WindowState == WindowState.Fullscreen) ? WindowState.Normal : WindowState.Fullscreen;
        }
    }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants