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

Raspberry 4/5 colorspace issue on wayland #855

Open
IcoDeveloper opened this issue Feb 5, 2024 · 1 comment
Open

Raspberry 4/5 colorspace issue on wayland #855

IcoDeveloper opened this issue Feb 5, 2024 · 1 comment

Comments

@IcoDeveloper
Copy link

  • Platform:
    Linux raspi5-1 6.1.0-rpi8-rpi-2712 #1 SMP PREEMPT Debian 1:6.1.73-1+rpt1 (2024-01-25) aarch64 GNU/Linux
    (Raspberry OS bookworm)
    pi5 w/4GB, pi4 w/2GB

  • MythTV version:
    master

  • Package version:
    built from source and mythtv-light

  • Component:
    frontend

What steps will reproduce the bug?

Start frontend

How often does it reproduce? Is there a required condition?

always when running on wayland.

What is the expected behaviour?

Mythtv display using a 24-bit display surface (RGBA 8:8:8) which shows smooth color gradients

What do you see instead?

Mythtv display using a 16-bit display surface (RGBA 5:6:5) which shows banding on color gradients; quite noticeable on mythcenter theme for example.
Recording / Video playback is also affected

mythfrontend shows info on the Qt OpenGL surface used in the log and console. expected (and seen when using X11)
CoreContext mythrenderopengl.cpp:430 (DebugFeatures) - OpenGL: Qt OpenGL surface : RGBA: 8:8:8:0 Depth: 0 Stencil: 0

Seen when using wayland:
CoreContext mythrenderopengl.cpp:430 (DebugFeatures) - OpenGL: Qt OpenGL surface : RGBA: 5:6:5:0 Depth: 0 Stencil: 0

Additional information

VLC manages to display videos using full 24-bit colorspace in the same gui session, so it doesn't seem to be a system constraint

@IcoDeveloper
Copy link
Author

I can now confirm that requesting a 24-bit surface works under wayland. However, putting the code in the obvious place in mythrenderopengl.cpp didn't work and resulted in makeCurrent returning eglError 3009.
I suspect the problem is that an openGL context already exists at that point and the default format should be modified before creating a context.

changing the default SurfaceFormat in mythpainterwindowopengl.cpp right at the beginning does work however.

MythPainterWindowOpenGL::MythPainterWindowOpenGL(MythMainWindow *MainWin)
  : MythPainterWindow(MainWin),
    m_parent(MainWin)
{
    bool ok;
    auto envBitsPerPixel = qEnvironmentVariable("MYTHTV_BITS_COLOR");
    int bitsPerPixel;
    if (!envBitsPerPixel.isEmpty())
    {
        bitsPerPixel = envBitsPerPixel.toInt(&ok);
        if (ok)
        {
            LOG(VB_GENERAL, LOG_INFO, LOC + QString("Setting default SurfaceFormat to %1 bits/color").arg(bitsPerPixel));
            QSurfaceFormat defaultFormat;
            defaultFormat.setRedBufferSize(bitsPerPixel);
            defaultFormat.setGreenBufferSize(bitsPerPixel);
            defaultFormat.setBlueBufferSize(bitsPerPixel);
            QSurfaceFormat::setDefaultFormat(defaultFormat);
        }
    }

Starting mythfrontent without the environment variable gets the same RGBA 5:6:5 Surface as before, but
MYTHTV_BITS_COLOR=8 mythfrontend
results in RGBA 8:8:8 and smooth gradients both in the menus and in playback.
This is obviously not intended as an actual fix for the issue but does show that a workaround is feasible

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

1 participant