javafxports/openjdk-jfx

HiDPI support does not work on Ubuntu 20 (no scaling)

michael-schnell opened this issue · 3 comments

Running a JavaFX application on Ubuntu 20.04.1 LTS does not scale as expected. The font and other controls are tiny on a 3840 x 2160 screen with a scale factor of 200%. The same application works well on Windows 10 with the same scaling.

Here is an example for Windows 10 that shows a scaling of 2.0.

The example for Ubuntu 20 show that it is not working correctly. You can see that the factor is always 1.0 no matter what is set in the Ubuntu environment. Here you can see the settings.

The debug output shows that the system is "Opting in for HiDPI pixel scaling" (Prism SW Pipeline):

Prism pipeline init order: es2 sw 
Using Double Precision Marlin Rasterizer
Using dirty region optimizations
Not using texture mask for primitives
Not forcing power of 2 sizes for textures
Using hardware CLAMP_TO_ZERO mode
Opting in for HiDPI pixel scaling
Prism pipeline name = com.sun.prism.es2.ES2Pipeline
Loading ES2 native library ... prism_es2
	succeeded.
GLFactory using com.sun.prism.es2.X11GLFactory
(X) Got class = class com.sun.prism.es2.ES2Pipeline
Failed Graphics Hardware Qualifier check.
System GPU doesn't meet the es2 pipe requirement
GraphicsPipeline.createPipeline: error initializing pipeline com.sun.prism.es2.ES2Pipeline
*** Fallback to Prism SW pipeline
Prism pipeline name = com.sun.prism.sw.SWPipeline
(X) Got class = class com.sun.prism.sw.SWPipeline
Initialized prism pipeline: com.sun.prism.sw.SWPipeline
 vsync: true vpipe: false

The same result with GPU usage (using "-Dprism.forceGPU=true"):

Using Double Precision Marlin Rasterizer
Using dirty region optimizations
Not using texture mask for primitives
Not forcing power of 2 sizes for textures
Using hardware CLAMP_TO_ZERO mode
Opting in for HiDPI pixel scaling
Prism pipeline name = com.sun.prism.es2.ES2Pipeline
Loading ES2 native library ... prism_es2
	succeeded.
GLFactory using com.sun.prism.es2.X11GLFactory
(X) Got class = class com.sun.prism.es2.ES2Pipeline
Initialized prism pipeline: com.sun.prism.es2.ES2Pipeline
Maximum supported texture size: 16384
Maximum texture size clamped to 4096
Non power of two texture support = true
Maximum number of vertex attributes = 16
Maximum number of uniform vertex components = 16384
Maximum number of uniform fragment components = 16384
Maximum number of varying components = 128
Maximum number of texture units usable in a vertex shader = 16
Maximum number of texture units usable in a fragment shader = 16
Graphics Vendor: VMware, Inc.
       Renderer: SVGA3D; build: RELEASE;  LLVM;
        Version: 3.3 (Compatibility Profile) Mesa 20.0.8
 vsync: true vpipe: true
ES2ResourceFactory: Prism - createStockShader: FillPgram_Color.frag
new alphas with length = 4096
ES2ResourceFactory: Prism - createStockShader: Texture_Color.frag
ES2ResourceFactory: Prism - createStockShader: Texture_LinearGradient_PAD.frag
ES2ResourceFactory: Prism - createStockShader: Solid_TextureRGB.frag
ES2ResourceFactory: Prism - createStockShader: Solid_TextureFirstPassLCD.frag
ES2ResourceFactory: Prism - createStockShader: Solid_TextureSecondPassLCD.frag

The problem can easily be reproduced by running the attached HelloFXML.zip example from Gluon.

Java Version

openjdk version "11.0.9" 2020-10-20
OpenJDK Runtime Environment GraalVM CE 20.3.0 (build 11.0.9+10-jvmci-20.3-b06)
OpenJDK 64-Bit Server VM GraalVM CE 20.3.0 (build 11.0.9+10-jvmci-20.3-b06, mixed mode, sharing)

Filed also a bug at bugreport.java.com with internal review ID : 9068139

There is a workaround that is mentioned in the related bug JDK-8248126: Set the environment variable GDK_SCALE to the same value as in your Ubuntu UI settings.

The native executable created with Graal can be started for example as follows:
GDK_SCALE=2 target/client/x86_64-linux/HelloFXML