Bug 488381

Summary: Java GUI applications black window on Wayland, works on Plasma X11 or Gnome Wayland
Product: [Plasma] kwin Reporter: Tadas Giniotis <kde>
Component: wayland-genericAssignee: KWin default assignee <kwin-bugs-null>
Status: REPORTED ---    
Severity: normal CC: kde, kde
Priority: NOR    
Version First Reported In: 6.0.5   
Target Milestone: ---   
Platform: Fedora RPMs   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:
Attachments: simple java app showing a window with text in it
with gpu acceleration
without gpu acceleration

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?