Bug 488381 - Java GUI applications black window on Wayland, works on Plasma X11 or Gnome Wayland
Summary: Java GUI applications black window on Wayland, works on Plasma X11 or Gnome W...
Status: REPORTED
Alias: None
Product: kwin
Classification: Plasma
Component: wayland-generic (other bugs)
Version First Reported In: 6.0.5
Platform: Fedora RPMs Linux
: NOR normal
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-06-11 20:09 UTC by Tadas Giniotis
Modified: 2024-06-21 11:33 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments
simple java app showing a window with text in it (720 bytes, text/x-java)
2024-06-11 20:09 UTC, Tadas Giniotis
Details
with gpu acceleration (3.50 MB, video/quicktime)
2024-06-21 11:07 UTC, Tadas Giniotis
Details
without gpu acceleration (1.89 MB, video/quicktime)
2024-06-21 11:07 UTC, Tadas Giniotis
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Tadas Giniotis 2024-06-11 20:09:33 UTC
Created attachment 170390 [details]
simple java app showing a window with text in it

SUMMARY
Java GUI application shows a grey or black window instead of the window contents on Plasma Wayland. Works well on Plasma X11 and Gnome Wayland or if GPU acceleration is turned off for the VM.

STEPS TO REPRODUCE
1. run in CLI "java test_window.java" (the file is attached)

OBSERVED RESULT
window titled "MyPanel" opens with a completely black or grey filling, no contents visible. Dragging the window makes it rapidly flicker between grey and black  (still no contents visible though).

EXPECTED RESULT
window titled "MyPanel" opens and the text "Working fine." is clearly visible in the window. Dragging the window goes smoothly, nothing flickers, the contents do not disappear.

SOFTWARE/OS VERSIONS
macOS: Sonoma 14.5
Linux: Fedora 40 aarch64

KDE Plasma Version: 6.0.5
KDE Frameworks Version: 6.3.0
Qt Version: 6.7.1
OpenJDK Runtime Environment (Red_Hat-21.0.3.0.9-1) (build 21.0.3+9)

ADDITIONAL INFORMATION
This is happening in a Fedora 40 aarch64 VM that is run on an Apple M1 Max via UTM (a QEMU frontend, https://mac.getutm.app). The Java version is the latest one provided by the fedora "java" package, though it seems to behave the same with other java versions (e.g. Jetbrains bundled java).

The emulated display card in UTM is "virtio-gpu-gl-pci (GPU Supported)". GPU acceleration is enabled by default.
"Retina mode" (hidpi) is enabled.

Changing the emulated display card in UTM to "virtio-gpu-gl-pci" (without "GPU Supported") fixes the issue, but then the VM lags heavily not being GPU accelerated.
Disabling "Retina mode" does not fix the issue.
Comment 1 David Edmundson 2024-06-21 08:17:23 UTC
Runs here, which unfortunately means there's not a lot we can do right now.
Comment 2 Tadas Giniotis 2024-06-21 11:07:03 UTC
Created attachment 170741 [details]
with gpu acceleration
Comment 3 Tadas Giniotis 2024-06-21 11:07:25 UTC
Created attachment 170742 [details]
without gpu acceleration
Comment 4 Tadas Giniotis 2024-06-21 11:33:13 UTC
Hey David, thanks for the attempt in reproducing it. I can still reproduce it with Plasma 6.1 which just landed in Fedora though.

I have built a barebones VM with KIWI that reproduces the issue - https://ibm.box.com/s/wczaqmga75nccf2cvic5vhmwk0wn3fhw
Networking not needed, so the device can be removed in the configuration.

Steps to reproduce it with the VM:

 1.	Install the latest UTM version from https://mac.getutm.app

 2.	Start UTM

 3.	Press "Create a New Virtual Machine" -> Virtualize -> Linux -> Browse -> Select the downloaded *.qcow2 file -> 
 	-> Continue ->  -> Continue -> Continue -> Continue -> Check "Open VM Settings" -> Save
	
        Select "Network " -> Remove
	Select "Sound" -> Remove -> select "USB drive" -> Delete -> Delete -> select "VirtIO Drive" -> Delete -> Delete

	Under "Devices" select "New..." -> Import... -> Select the downloaded *.qcow2 file

	Select "Display" -> in "Emulated Display Card" select "virtio-gpu-gl-pci (GPU Supported)" -> Save

 4.	Press the "Play" icon on the newly created VM entry.

	Credentials: test / test
	
	Launch terminal -> run "java ~/test.java"

	Observe the broken window like in the "with gpu acceleration" attachment.

Changing the "Emulated Display Card" to "virtio-gpu-pci" (i.e. without HW acceleration) makes the issue go away, like in the "without gpu acceleration" attachment.

My host device is:
  Model Name:	MacBook Pro
  Model Identifier:	MacBookPro18,2
  Chip:	Apple M1 Max

Though I imagine any Apple device with the M chip and integrated graphics should do.

Can you check if you can reproduce it in the VM?