Bug 482868 - Broken rendering with OpenGL compositing on i915
Summary: Broken rendering with OpenGL compositing on i915
Status: RESOLVED FIXED
Alias: None
Product: kwin
Classification: Plasma
Component: compositing (show other bugs)
Version: 6.0.1
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-03-08 12:47 UTC by Balló György
Modified: 2024-06-26 12:44 UTC (History)
6 users (show)

See Also:
Latest Commit:
Version Fixed In: 6.1.1


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Balló György 2024-03-08 12:47:13 UTC
There are a lot of rendering issues (e.g. white rectangles) with the default OpenGL compositor using the i915 mesa driver, because the shader exceeds the hardware limits of Intel's Gen3 GPUs:

kwin_wayland[1576]: kwin_scene_opengl: 0x2: GL_INVALID_OPERATION in glUseProgram(program 7 not linked)
kwin_wayland[1576]: kwin_scene_opengl: 0x2: GL_INVALID_ENUM in glTexStorage2D(internalformat = GL_R8)
kwin_wayland[1576]: kwin_scene_opengl: 0x2: GL_INVALID_OPERATION in glTexSubImage2D(invalid texture level 0)
kwin_wayland[1576]: kwin_scene_opengl: 0x2: GL_INVALID_OPERATION in glUseProgram(program 7 not linked)
kwin_wayland[1576]: kwin_scene_opengl: Failed to link shader: 
                                              "error: Exceeded max ALU instructions (163/64)\x00"
kwin_wayland[1576]: kwin_scene_opengl: 0x2: GL_INVALID_OPERATION in glUseProgram(program 22 not linked)
kwin_wayland[1576]: kwin_scene_opengl: 0x2: GL_INVALID_OPERATION in glGetUniformLocation(program not linked)
kwin_wayland[1576]: Failed to link shader program: error: Exceeded max ALU instructions (86/64)
kwin_wayland[1576]: Failed to build graphics pipeline state
kwin_wayland[1576]: kwin_scene_opengl: Failed to link shader: 
                                              "error: Exceeded max ALU instructions (162/64)\x00"

kwin_x11[3334]: kwin_scene_opengl: 0x2: GL_INVALID_OPERATION in glUseProgram(program 4 not linked)
kwin_x11[3334]: kwin_scene_opengl: 0x2: GL_INVALID_ENUM in glTexStorage2D(internalformat = GL_R8)
kwin_x11[3334]: kwin_scene_opengl: 0x2: GL_INVALID_OPERATION in glTexSubImage2D(invalid texture level 0)
kwin_x11[3334]: kwin_scene_opengl: 0x2: GL_INVALID_OPERATION in glUseProgram(program 4 not linked)
kwin_x11[3334]: Failed to link shader program: error: Exceeded max ALU instructions (86/64)
kwin_x11[3334]: Failed to build graphics pipeline state
kwin_x11[3334]: kwin_scene_opengl: 0x2: GL_INVALID_OPERATION in glUseProgram(program 19 not linked)
kwin_x11[3334]: kwin_scene_opengl: 0x2: GL_INVALID_OPERATION in glUseProgram(program 25 not linked)
kwin_x11[3334]: Failed to link shader program: error: Exceeded max ALU instructions (86/64)
kwin_x11[3334]: Failed to build graphics pipeline state
kwin_x11[3334]: kwin_scene_opengl: 0x2: GL_INVALID_OPERATION in glUseProgram(program 19 not linked)
kwin_x11[3334]: Failed to link shader program: error: Exceeded max nr indirect texture lookups (5/4)
kwin_x11[3334]: Failed to build graphics pipeline state
kwin_x11[3334]: Failed to link shader program: error: Exceeded max nr indirect texture lookups (5/4)
kwin_x11[3334]: Failed to build graphics pipeline state
kwin_x11[3334]: Failed to link shader program: error: Exceeded max ALU instructions (86/64)
kwin_x11[3334]: Failed to build graphics pipeline state
kwin_x11[3334]: kwin_scene_opengl: 0x2: GL_INVALID_OPERATION in glUseProgram(program 19 not linked)
kwin_x11[3334]: Failed to link shader program: error: Exceeded max nr indirect texture lookups (5/4)
kwin_x11[3334]: Failed to build graphics pipeline state
kwin_x11[3334]: Failed to link shader program: error: Exceeded max nr indirect texture lookups (5/4)
kwin_x11[3334]: Failed to build graphics pipeline state
kwin_x11[3334]: Failed to link shader program: error: Exceeded max ALU instructions (86/64)
kwin_x11[3334]: Failed to build graphics pipeline state
kwin_x11[3334]: kwin_scene_opengl: 0x2: GL_INVALID_OPERATION in glUseProgram(program 19 not linked)
kwin_x11[3334]: kwin_scene_opengl: 0x2: GL_INVALID_OPERATION in glUseProgram(program 25 not linked)
kwin_x11[3334]: Failed to link shader program: error: Exceeded max nr indirect texture lookups (5/4)
kwin_x11[3334]: Failed to build graphics pipeline state

It happens on both Wayland and X11. KWin should either use less complex shaders, or should fallback to "QPainter" backend on Wayland, and "No Compositing" on X11.
Comment 1 Balló György 2024-03-17 11:21:28 UTC
Want to mention that KWin 5 worked fine on this hardware when I set the QT_QUICK_BACKEND=software environment variable. With KWin 6, this no longer works, and complex shaders are used even if this environment variable is set.
Comment 2 Zamundaaa 2024-03-18 16:32:41 UTC
Having a "limited opengl" mode is probably not feasible, but we can try to compile a shader with all the features used in compositing and fall back to CPU rendering if that fails
Comment 3 rachid 2024-06-25 09:01:13 UTC
This still happens on the lasted 6.1.0 version (Gentoo) with the same issues.
Comment 4 Bug Janitor Service 2024-06-25 11:45:50 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kwin/-/merge_requests/5991
Comment 5 Zamundaaa 2024-06-25 13:57:23 UTC
Git commit 5a0ecdba333dba233d54124909028971260b0f78 by Xaver Hugl.
Committed on 25/06/2024 at 13:49.
Pushed by zamundaaa into branch 'master'.

opengl/eglcontext: bail out early if we can't use complex shaders

Some old hardware is very limited in the amount of instructions it can support.
In order to not have KWin fail to composite, reject using hardware acceleration
in this case and fall back to llvmpipe or QPainter

M  +10   -1    src/opengl/openglcontext.cpp

https://invent.kde.org/plasma/kwin/-/commit/5a0ecdba333dba233d54124909028971260b0f78
Comment 6 Zamundaaa 2024-06-25 14:10:36 UTC
Git commit b819606a740e44cf689781175fab7cf7731f162c by Xaver Hugl.
Committed on 25/06/2024 at 13:59.
Pushed by zamundaaa into branch 'Plasma/6.1'.

opengl/eglcontext: bail out early if we can't use complex shaders

Some old hardware is very limited in the amount of instructions it can support.
In order to not have KWin fail to composite, reject using hardware acceleration
in this case and fall back to llvmpipe or QPainter


(cherry picked from commit 5a0ecdba333dba233d54124909028971260b0f78)

Co-authored-by: Xaver Hugl <xaver.hugl@gmail.com>

M  +10   -1    src/opengl/openglcontext.cpp

https://invent.kde.org/plasma/kwin/-/commit/b819606a740e44cf689781175fab7cf7731f162c