JetBrains / JetBrains/JetBrainsRuntime

Window corruption / magenta regions with Java OpenGL rendering enabled

Open
#281 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
2k
Forks
270
Avg merge
1h 18m
Merged PRs (30d)
1

Description

This has been bothering me for quite some time, however never got around to file a report. Eventually here we go.

I am running Asahi Linux (aarch64) and quite often magenta regions appear:

At the beginning, I thought this was a GPU driver bug, but it turned out it isn't. The Asahi developers (who are like the godfathers of reverse engineering and GPU driver hacking) are sure this is a problem in Java itself, which just goes unnoticed because only Asahi uses purple as the "error color" whereas other systems use transparent, so problems like that just don't get recognized easily.

So here is what the Asahi developes say to this:
- From https://github.com/AsahiLinux/linux/issues/72
> Window corruption / magenta regions with Java OpenGL rendering enabled (Java does not double buffer its OpenGL visual so it will always tear/break on any modern system from this decade, just worse on Apple with compression.)

My questions now:
* Can you do something with that information? Like based on the information I give here, can you fix that?
* Will this be fixed as soon as Native Wayland support arrives?
* https://youtrack.jetbrains.com/issue/JBR-3206/Native-Wayland-support
* AFAIK you will then support Vulkan, which is currently being worked on in Asahi as well
* AFAIK (but correct me if I am wrong) until Vulkan support is ready in JBR with Wayland support you will "just" offer software rendering (?) with Wayland, however will the described problem be fixed with JBR Wayland software rendering already?
* Shouldn't this get fixed upstream in OpenJDK itself?
* Do you need more information?

Side note:
In Asahi, JetBrains IntelliJ IDEA needs to be started with

```
-Dsun.java2d.opengl=true
-Dsun.java2d.opengl.fbobject=false
```
set in `Help` -> `Edit Custom VM Options...` for GPU acceleration.

IDE details:
```
IntelliJ IDEA 2023.3.3 (Ultimate Edition)
Build #IU-233.14015.106, built on January 25, 2024
...
Runtime version: 17.0.9+7-b1087.11 aarch64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Linux 6.5.0-asahi-15-1-edge-arch
GC: G1 Young Generation, G1 Old Generation
Memory: 8192M
Cores: 10
Registry:
ide.browser.jcef.gpu.disable=true
scala.erase.compiler.process.jdk.once=false
Non-Bundled Plugins:
com.intellij.properties.bundle.editor (233.11799.172)
org.jetbrains.plugins.hocon (2023.1.0)
com.jetbrains.packagesearch.intellij-plugin (233.11799.196)
com.intellij.ml.llm (233.14015.137)
org.intellij.scala (2023.3.20)
Kotlin: 233.14015.106-IJ
Current Desktop: KDE
```

Contributor guide

Open the contributing guide

Research direction

Start with the reported IntelliJ IDEA setup and the -Dsun.java2d.opengl=true and -Dsun.java2d.opengl.fbobject=false options. Compare the magenta-region reproduction with the Asahi Linux issue and the linked JBR-3206 Native Wayland support discussion. Done means identifying the Java rendering cause and defining whether a fix applies to OpenGL, Wayland software rendering, or upstream OpenJDK.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, linux
Domain
computer-graphics, desktop, operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.