Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • Event handling

    • Dispatch native events on EDT, to avoid potential race conditions when the state is updated both from EDT and toolkit thread. See the full proposal here  

  • Graphics devices support

    • Onscreen/offscreen Wayland surface management

    • Adopt OGL pipeline for rendering on Wayland surfaces

    • Implement a new rendering pipeline based on Vulkan (for better performance)

  • java.awt.Robot

    • Sending input events

    • Reading screen data (at least current java application windows)

  • Client-side decorations for windows

    • Swing internal frames rendering code can be reused

  • Hardware acceleration using  Vulkan.

The prototype implementation of the pure Wayland toolkit (JDK-8281970) based on OpneJDK 21 25 source base can be found in the Wakefield repository (jdk21.0.1jdk25-wayland branch). It has two rendering pipelines:

  • Pure software loops (enabled by default)
  • Hardware-accelerated rendering using Vulkan (enabled by providing -Dsun.java2d.vulkan=True|true)

Most of the graphics primitives are supported in hardware-accelerated rendering, so it's possible to run Swing applications on top of it. 

 java -Dawt.toolkit.name=WLToolkit -Dsun.java2d.vulkan=True -jar J2Ddemo.jar

...

SwingSet2.jar


Image Added


Here is an updated build instruction for building jdk25-wayland branch (on ubunu 24.04). You need to have at least JDK24 for bootstrapping:

$ sudo wget -qO- https://packages.lunarg.com/lunarg-signing-key-pub.asc | tee /etc/apt/trusted.gpg.d/lunarg.asc

$ sudo wget -qO /etc/apt/sources.list.d/lunarg-vulkan-noble.list https://packages.lunarg.com/vulkan/lunarg-vulkan-noble.list

$ sudo apt update

$ sudo apt-get -y install file zip unzip autoconf make build-essential libx11-dev libxext-dev libxrender-dev \

libxtst-dev libxt-dev libxrandr-dev libcups2-dev libfontconfig1-dev libasound2-dev libwayland-dev \

 libxkbcommon-x11-0 vulkan-sdk vulkan-utility-libraries-dev

$ sh configure --with-vulkan

$ make images


Here are some performance resuls with RenderPerfTest:

java -Dawt.toolkit.name=WLToolkit -Dsun.java2d.vulkan=True -jar ./dist/RenderPerfTest.jar 
Vulkan rendering enabled: YES
  Presentation enabled: YES
  Accelerated surface data enabled: YES
  Devices:
    *0: AMD Radeon RX 6800 XT (RADV NAVI21)
     1: llvmpipe (LLVM 19.1.1, 256 bits)
#  Using GraphicsConfiguration(s): [0-0][WLVKGraphicsConfig[B8G8R8A8_UNORM, AMD Radeon RX 6800 XT (RADV NAVI21) (DISCRETE_GPU), LEN LEN T27p-10]]

Test NameMedian(FPS) ± Stddev(FPS) Unit
ArgbSurfaceBlitImage54.750 ± 4.797
ClipFlatBox800.360 ± 8.649
ClipFlatOval251.432 ± 23.458
FlatBox812.009 ± 5.980
FlatBoxAA812.466 ± 6.239
FlatOval106.856 ± 0.422
FlatOvalAA49.510 ± 0.134
FlatQuad109.489 ± 7.471
FlatQuadAA22.130 ± 0.227
Image49.331 ± 4.920
ImageAA51.265 ± 3.969
LargeTextGray806.916 ± 9.320
LinGrad3RotatedOval0.189 ± 0.002
LinGrad3RotatedOvalAA49.570 ± 0.136
LinGradRotatedOval218.528 ± 6.911
LinGradRotatedOvalAA51.607 ± 0.170
TextGray219.214 ± 2.097
VolImage824.738 ± 2.505
WiredBubbles107.861 ± 1.979