2018年1月1日 星期一

PhpStorm 的 OpenGL 支援


參考
OpenGL Pipeline in Oracle Solaris, Linux and Windows
improving_text_antialiasing_and_gui_performance_in_intellij_idea_on_openjdk_8.md

Minimum Requirements

The OpenGL pipeline will not be enabled if the hardware or drivers do not meet the minimum requirements. If for some reason one of the following requirements is not met, Java 2D will fall back and use the default pipeline (X11 on Oracle Solaris/Linux, GDI/DirectDraw on Windows), which means your application will continue to work correctly, but without the OpenGL acceleration.

The minimum requirements for Oracle Solaris and Linux operating systems are the following:


  •     Hardware accelerated OpenGL/GLX libraries installed and configured properly
  •     OpenGL version 1.2 or higher
  •     GLX version 1.3 or higher
  •     At least one TrueColor visual with an available depth buffer
設定檔 /opt/phpstorm/bin/phpstorm64.vmoptions 加上
-Dsun.java2d.opengl=True

或者在  $IDEA_HOME/bin/idea.properties,加上
##---------------------------------------------------------------------
## Enable the OpenGL-based pipeline, which provides hardware acceleration.
##---------------------------------------------------------------------
sun.java2d.opengl=true


注意: 每次更新後,此設定會被覆蓋,需重新加入此設定

設定 debug level
$ export J2D_TRACE_LEVEL=4
$ phpstorm
[I] GLXGC_FindBestVisual: scn=0
[I] GLXGC_InitGLX
[I] OGLFuncs_OpenLibrary
[I] OGLFuncs_InitPlatformFuncs
[I] OGLFuncs_InitBaseFuncs
[I] OGLFuncs_InitExtFuncs
[I] GLXGC_InitGLX: client GLX version=1.4
[I] GLXGC_InitFBConfig: scn=0 vis=0x0
[V]   candidate fbconfigs:
[V]     id=0x29 db=0 alpha=0 depth=24 stencil=0 valid=true
[V]     id=0xbf db=0 alpha=0 depth=24 stencil=0 valid=false (large depth)
[V]     id=0x74 db=0 alpha=0 depth=24 stencil=0 valid=false (large depth)
[V]     id=0x25 db=0 alpha=0 depth=24 stencil=8 valid=false (large depth)
[V]     id=0xbb db=0 alpha=0 depth=24 stencil=8 valid=false (large depth)
[V]     id=0x70 db=0 alpha=0 depth=24 stencil=8 valid=false (large depth)
[V]     id=0x27 db=1 alpha=0 depth=24 stencil=0 valid=false (large depth)
[V]     id=0xbd db=1 alpha=0 depth=24 stencil=0 valid=false (large depth)
[V]     id=0x72 db=1 alpha=0 depth=24 stencil=0 valid=false (large depth)
[V]     id=0x21 db=1 alpha=0 depth=24 stencil=8 valid=false (large depth)
[V]     id=0x23 db=1 alpha=0 depth=24 stencil=8 valid=false (large depth)
[V]     id=0x22 db=1 alpha=0 depth=24 stencil=8 valid=false (large depth)
[V]     id=0x2a db=0 alpha=8 depth=24 stencil=0 valid=false (large depth)
[V]     id=0xc0 db=0 alpha=8 depth=24 stencil=0 valid=false (large depth)
[V]     id=0x75 db=0 alpha=8 depth=24 stencil=0 valid=false (large depth)
[V]     id=0x26 db=0 alpha=8 depth=24 stencil=8 valid=false (large depth)
[V]     id=0xbc db=0 alpha=8 depth=24 stencil=8 valid=false (large depth)
[V]     id=0x71 db=0 alpha=8 depth=24 stencil=8 valid=false (large depth)
[V]     id=0x28 db=1 alpha=8 depth=24 stencil=0 valid=false (large depth)
[V]     id=0xbe db=1 alpha=8 depth=24 stencil=0 valid=false (large depth)
[V]     id=0x73 db=1 alpha=8 depth=24 stencil=0 valid=false (large depth)
[V]     id=0x24 db=1 alpha=8 depth=24 stencil=8 valid=false (large depth)
[V]     id=0xba db=1 alpha=8 depth=24 stencil=8 valid=false (large depth)
[V]     id=0x6f db=1 alpha=8 depth=24 stencil=8 valid=false (large depth)
[I] GLXGC_FindBestVisual: chose 0x29 as the best visual for screen 0
INFO: The version of libXrender.so is detected as 0.910
[I] GLXGraphicsConfig_getGLXConfigInfo
[I] GLXGC_InitFBConfig: scn=0 vis=0x29
[V]   candidate fbconfigs:
[V]     id=0x29 db=0 alpha=0 depth=24 stencil=0 valid=true
[E] GLXGraphicsConfig_getGLXConfigInfo: could not create shared context
Could not enable OpenGL pipeline for default config on screen 0
XRender pipeline enabled
Error parsing gtk-icon-sizes string: ''
Xrender: INFO: Jules library not installed.

測試,安裝 example
$ java -Dsun.java2d.opengl=True -jar /opt/oracle-jdk-bin-1.8.0.152/demo/jfc/Java2D/Java2Demo.jar

加入 video 的 group 之後。
[I] GLXGC_FindBestVisual: chose 0x29 as the best visual for screen 0
INFO: The version of libXrender.so is detected as 0.910
[I] GLXGraphicsConfig_getGLXConfigInfo
[I] GLXGC_InitFBConfig: scn=0 vis=0x29
[V]   candidate fbconfigs:
[V]     id=0x29 db=0 alpha=0 depth=24 stencil=0 valid=true
[I] OGLContext_IsExtensionAvailable: GL_ARB_fragment_shader=true
[I] OGLContext_IsExtensionAvailable: GL_ARB_multitexture=true
[I] OGLContext_IsExtensionAvailable: GL_ARB_texture_non_power_of_two=true
[I] OGLContext_IsExtensionAvailable: GL_ARB_texture_rectangle=true
[I] OGLContext_IsExtensionAvailable: GL_EXT_framebuffer_object=true
[I] OGLContext_IsExtensionAvailable: GL_ARB_depth_texture=true
[I] OGLContext_IsFBObjectExtensionAvailable: fbobject supported
[I] OGLContext_IsLCDShaderSupportAvailable: LCD text shader supported
[I] OGLContext_IsBIOpShaderSupportAvailable: BufferedImageOp shader supported
[I] OGLContext_IsGradShaderSupportAvailable: Linear/RadialGradientPaint shader supported
[I] OGLContext_IsExtensionAvailable: GL_NV_fragment_program=true
[I] OGLContext_IsExtensionAvailable: GL_NV_fragment_program2=true
[I] OGLContext_IsExtensionAvailable: GL_NV_texture_barrier=true
[I] GLXGraphicsConfig_getGLXConfigInfo: OpenGL version=4.6.0 NVIDIA 387.22
OpenGL pipeline enabled for default config on screen 0
Error parsing gtk-icon-sizes string: ''


$ glxgears
X Error of failed request:  BadValue (integer parameter out of range for operation)
  Major opcode of failed request:  153 (GLX)
  Minor opcode of failed request:  3 (X_GLXCreateContext)
  Value in failed request:  0x0
  Serial number of failed request:  31
  Current serial number in output stream:  32

$ su ajax
密碼:
ajax@localhost ~ $ glxgears
Running synchronized to the vertical refresh.  The framerate should be
approximately the same as the monitor refresh rate.
303 frames in 5.0 seconds = 60.479 FPS

不曉得是否電腦太強了,不論 OpenGL 是否 enable,捲動文字時,並無明顯差別。

另外,
-Dawt.useSystemAAFontSettings=lcd
改成
-Dawt.useSystemAAFontSettings=on


沒有留言:

張貼留言

網誌存檔