logseq / logseq

A privacy-first, open-source platform for knowledge management and collaboration. Download link: http://github.com/logseq/logseq/releases. roadmap: http://trello.com/b/8txSM12G/roadmap
https://logseq.com
GNU Affero General Public License v3.0
30.26k stars 1.77k forks source link

Logseq UI not rendered anymore after Mesa upgrade (Linux), #10031

Open schmittlauch opened 9 months ago

schmittlauch commented 9 months ago

Search first

What Happened?

After a system update, logseq does not display an UI anymore but just a blank window.

Error log in console:

Errors:
link failed but did not provide an info log
[78879:0816/111549.199544:ERROR:shared_context_state.cc(81)] Skia shader compilation error
------------------------
// Vertex SKSL
#extension GL_NV_shader_noperspective_interpolation: require
uniform float4 sk_RTAdjust;uniform float2 uAtlasSizeInv_S0;in float2 inPosition;in half4 inColor;in ushort2 inTextureCoords;noperspective out float2 vTextureCoords_S0;flat out float vTexIndex_S0;noperspective out half4 vinColor_S0;void main() {// Primitive Processor BitmapText
int texIdx = 0;float2 unormTexCoords = float2(inTextureCoords.x, inTextureCoords.y);vTextureCoords_S0 = unormTexCoords * uAtlasSizeInv_S0;vTexIndex_S0 = float(texIdx);vinColor_S0 = inColor;float2 _tmp_1_inPosition = inPosition;sk_Position = inPosition.xy01;}
// Fragment SKSL
#extension GL_NV_shader_noperspective_interpolation: require
#extension GL_EXT_blend_func_extended: require
uniform sampler2D uTextureSampler_0_S0;
noperspective in float2 vTextureCoords_S0;flat in float vTexIndex_S0;noperspective in half4 vinColor_S0;out half4 fsSecondaryColorOut;
void main() {// Stage 0, BitmapText
half4 outputColor_S0;outputColor_S0 = vinColor_S0;half4 texColor;{ texColor = sample(uTextureSampler_0_S0, vTextureCoords_S0); }half4 outputCoverage_S0 = texColor;{ // Xfer Processor: Porter Duff
outputCoverage_S0.a = max(max(outputCoverage_S0.r, outputCoverage_S0.g), outputCoverage_S0.b);fsSecondaryColorOut = outputColor_S0.a * outputCoverage_S0;sk_FragColor = outputColor_S0 * outputCoverage_S0;}}
// Vertex GLSL
#version 300 es

#extension GL_NV_shader_noperspective_interpolation : require
precision mediump float;
precision mediump sampler2D;
uniform highp vec4 sk_RTAdjust;
uniform highp vec2 uAtlasSizeInv_S0;
in highp vec2 inPosition;
in mediump vec4 inColor;
in mediump uvec2 inTextureCoords;
noperspective out highp vec2 vTextureCoords_S0;
flat out highp float vTexIndex_S0;
noperspective out mediump vec4 vinColor_S0;
void main() {
    highp int texIdx = 0;
    highp vec2 unormTexCoords = vec2(float(inTextureCoords.x), float(inTextureCoords.y));
    vTextureCoords_S0 = unormTexCoords * uAtlasSizeInv_S0;
    vTexIndex_S0 = float(texIdx);
    vinColor_S0 = inColor;
    gl_Position = vec4(inPosition, 0.0, 1.0);
    gl_Position = vec4(gl_Position.xy * sk_RTAdjust.xz + gl_Position.ww * sk_RTAdjust.yw, 0.0, gl_Position.w);
}

// Fragment GLSL
#version 300 es

#extension GL_NV_shader_noperspective_interpolation : require
#extension GL_EXT_blend_func_extended : require
precision mediump float;
precision mediump sampler2D;
out mediump vec4 sk_FragColor;
uniform sampler2D uTextureSampler_0_S0;
noperspective in highp vec2 vTextureCoords_S0;
flat in highp float vTexIndex_S0;
noperspective in mediump vec4 vinColor_S0;
out mediump vec4 fsSecondaryColorOut;
void main() {
    mediump vec4 outputColor_S0;
    outputColor_S0 = vinColor_S0;
    mediump vec4 texColor;
    {
        texColor = texture(uTextureSampler_0_S0, vTextureCoords_S0, -0.5);
    }
    mediump vec4 outputCoverage_S0 = texColor;
    {
        outputCoverage_S0.w = max(max(outputCoverage_S0.x, outputCoverage_S0.y), outputCoverage_S0.z);
        fsSecondaryColorOut = outputColor_S0.w * outputCoverage_S0;
        sk_FragColor = outputColor_S0 * outputCoverage_S0;
    }
}

This seems to be the same underlying issue as in https://github.com/vector-im/element-desktop/issues/1029 and is related to Mesa (the system graphics driver) also being upgraded and now having incompatible shaders.

workaround: rm -rf ~/.config/Logseq/GPUCache

It helps to delete the GPU shader cache. It might make sense to ask Electron upstream to handle this condition automatically.

Reproduce the Bug

  1. launch logseq
  2. update system with a breaking Mesa update (in the NixOS case: mesa 22.1.3)
  3. launch logseq via console again, observe empty window and error console output

Expected Behavior

No response

Screenshots

No response

Desktop or Mobile Platform Information

Linux, NixOS, logseq-0.9.6 from nixpkgs

Additional Context

No response

Are you willing to submit a PR? If you know how to fix the bug.

sprocketc commented 9 months ago

Seems related to https://bugs.chromium.org/p/chromium/issues/detail?id=1442633 Marking this as upstream.

jlbribeiro commented 9 months ago

@schmittlauch as a quick workaround until this is fixed, ~launching Logseq using logseq --disable-gpu works for me~. edit: It becomes pretty unresponsive when GPU acceleration is disabled. (Also on NixOS, logseq-0.9.6 from nixpkgs.)

edit:

rm -rf ~/.config/Logseq/GPUCache/

instead; see https://github.com/logseq/logseq/issues/10031#issuecomment-1683867669.

sprocketc commented 9 months ago

workaround: rm -rf ~/.config/Element/GPUCache It helps to delete the GPU shader cache. It might make sense to ask Electron upstream to handle this condition automatically.

@jlbribeiro Did you try clearing the GPU cache as @schmittlauch suggested? You should try that first before disabling gpu acceleration.

jlbribeiro commented 9 months ago

@sprocketc I feel silly. Yesterday I couldn't find Logseq's directory under ~/.config (instructions above refer to Element), so I played with "related" ones... (~/.config/Electron didn't have GPUCache, messed with chromium's (assuming Logseq could possibly be using it under the hood)... That solved some similar issues on Chromium.)

After your comment I went back and found Logseq there, so I'm not sure how I missed it; I probably just searched for lowercase logseq...

Anyway,

rm -rf ~/.config/Logseq/GPUCache/

did fix my issues, thanks for the ping! (And sorry if I added noise to the issue. Edited my comment above.)

lonyelon commented 9 months ago

That works, I didn't check with uppercase either.

gmolyneux commented 6 months ago

I just experienced this on my SUSE Tumbleweed machine using the latest beta appimage build. Exact same issue, exact same cause. @schmittlauch suggestion worked perfectly - thank you! I don't want to add unnecessarily to the subject, but it would be great to see this directory cleaned automatically on startup, thus preventing the issue entirely.

github-actions[bot] commented 2 weeks ago

Hi There! 👋

We haven't seen any activity on this issue in a while :sleeping:, and we just wanted to make sure that it's still relevant. If you're still experiencing this issue, you might find it helpful to update to the latest version of Logseq. The latest version includes bug fixes and new features that may help to resolve this issue, and you can download it from our website. If updating to the latest version doesn't help, please let us know by adding a comment 💬. We're here to help!

If the issue has been resolved or is no longer relevant, that's great news! 🎉 We'll go ahead and close this issue to keep our backlog organized. Please note that this issue will be closed automatically in 20 days if there is no further activity. If you need more time to resolve the issue or provide more information, please just let us know by adding a comment.

Access additional Logseq 🚀 resources:

Thanks for your contributions to Logseq! If you have any other issues or feature requests, please don't hesitate to let us know. We always welcome pull requests too!

schmittlauch commented 2 weeks ago

Upstream reports this as fixed, but does anyone know whether https://chromium-review.googlesource.com/c/angle/angle/+/5189152 has already reached the Electron we use for logseq?