• Home
    • View
    • Login
    This page
    • Normal
    • Export PDF
    • Export Word
    • Attachments
    • Page Information

    Loading...
  1. Dashboard
  2. Wakefield
  3. OpenJDK Project Wakefield - Wayland desktop support for JDK on Linux
  4. Pure Wayland toolkit prototype

Page History

Versions Compared

Old Version 11

changes.mady.by.user Maxim Kartashev

Saved on Sep 21, 2022

compared with

New Version Current

changes.mady.by.user Alexey Ushakov

Saved on Mar 04, 2025

  • Previous Change: Difference between versions 10 and 11
  • View Page History

Key

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

XWayland server provides limited capabilities for X11 desktop applications (see X11 Application Support  and JDK-8269245). In order to get full support of the desktop features, we need to implement a pure Wayland client toolkit for java. Wayland architecture in many ways differs from X11, so we cannot reuse XAWT even for basic capabilities. The new toolkit should be implemented from scratch. Here are some major chunks of work:

 

  • 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 source base can be found in the Wakefield repository (pure_wl_toolkit jdk21.0.1-wayland branch). It uses software rendering loops to draw geometry primitives on Wayland surfaces. It supports the rendering of AWT Frame and Swing JFramehas two rendering pipelines:

  • Pure software loops (enabled by default)
  • Hardware-accelerated rendering using Vulkan
    • Accelerated blitting of the resulting frame (enabled by providing -Dsun.java2d.vulkan=True|true)
    • Complete hardware acceleration including the rendering of all graphics primitives  (enabled by providing -Dsun.java2d.vulkan=True|true -Dsun.java2d.vulkan.accelsd=true)

Complete hardware acceleration is not fully supported so far.

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

Image Removed

The java.awt.Robot functionality is implemented in a somewhat roundabout way because it contradicts several basic principles of Wayland such as not exposing pixels after they have been composited. As a short- to mid-term solution, we intend to run tests in an instance of Weston (one such instance per test) that runs on top of X11. That instance of Weston requires a custom plugin libwakefield.so (source code is under src/java.desktop/share/native/libwakefield). A Java wrapper is available that helps to fire up and tear down Weston and set up WAYLAND_DISPLAY for the test. There is also a sample test test/jdk/java/awt/wakefield/ScreenCapture.java that can be run roughly as follows:

export LIBWAKEFIELD=/.../build/wakefield/libwakefield.so
jtreg -e:XDG_RUNTIME_DIR -e:LIBWAKEFIELD -testjdk:... test/jdk/java/awt/wakefield/

This was verified to work with Weston 9 on Ubuntu 21.10.

Text rendering has been implemented (JDK-8281970)

...


Image Added


Here is an updated build instruction for building jdk21.0.1-wayland branch (on ubunu 24.04):

$ 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 openjdk-21-jdk 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 imagesImage Removed
Keyboard and mouse input has been implemented:
Image Removed

Overview
Content Tools
ThemeBuilder

Terms of Use
• License: GPLv2
• Privacy • Trademarks • Contact Us

Powered by a free Atlassian Confluence Open Source Project License granted to https://www.atlassian.com/software/views/opensource-community-additional-license-offer. Evaluate Confluence today.

  • Kolekti ThemeBuilder Powered by Atlassian Confluence 8.5.23
  • Kolekti ThemeBuilder printed.by.atlassian.confluence
  • Report a bug
  • Atlassian News
Atlassian
Kolekti ThemeBuilder EngineAtlassian Confluence
{"serverDuration": 197, "requestCorrelationId": "25aeefaef358c069"}