summaryrefslogtreecommitdiffstats
path: root/make/config/nativewindow/x11-CustomJavaCode.java
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2013-11-04 15:07:14 +0100
committerSven Gothel <[email protected]>2013-11-04 15:07:14 +0100
commit613e33ee8ffc1f2b9c5db1e1b5bb5253a159ed6d (patch)
tree761c21e05e274bcea3852406fdbc63c25f266b10 /make/config/nativewindow/x11-CustomJavaCode.java
parent7433e513c1f109f75aa34c224b1f5f14b612cba8 (diff)
Bug 888 - Validate CPU Runtime Performance: X11GLXGraphicsConfiguration.GLXFBConfig2GLCapabilities(..)
X11GLXGraphicsConfiguration.GLXFBConfig2GLCapabilities(..) ran over all FB configs and for each it grabbed native config values separately. Fetching them in bulk mode saves around 7% of this function's cost. Also reuse XRenderPictFormat instance for 'XRenderDirectFormat XRenderFindVisualFormat(..)' call, saving a few NIO creation cycles w/ StructAccessor. Biggest savior is X11GLXGraphicsConfigurationFactory.chooseGraphicsConfigurationFBConfig()'s fast path w/o chooser and usable 1st FBConfig. Here we only issue 'GLXFBConfig2GLCapabilities(..)' on the first valid entry. Test w/ 50 X11GLXGraphicsConfigurationFactory.chooseGraphicsConfigurationFBConfig() invocations: - pre change: 1.708 ms - post change: 650 ms Time is no spent almost solely on native glXChooseFBConfig (546ms).
Diffstat (limited to 'make/config/nativewindow/x11-CustomJavaCode.java')
-rw-r--r--make/config/nativewindow/x11-CustomJavaCode.java15
1 files changed, 15 insertions, 0 deletions
diff --git a/make/config/nativewindow/x11-CustomJavaCode.java b/make/config/nativewindow/x11-CustomJavaCode.java
index 4240c5e2f..d1e011184 100644
--- a/make/config/nativewindow/x11-CustomJavaCode.java
+++ b/make/config/nativewindow/x11-CustomJavaCode.java
@@ -1,4 +1,19 @@
+ /** Interface to C language function: <br> <code> XRenderPictFormat * XRenderFindVisualFormat(Display * dpy, const Visual * visual); </code> */
+ public static boolean XRenderFindVisualFormat(long dpy, long visual, XRenderPictFormat dest) {
+ if( dest == null ) {
+ throw new RuntimeException("dest is null");
+ }
+ final ByteBuffer destBuffer = dest.getBuffer();
+ if( !Buffers.isDirect(destBuffer) ) {
+ throw new RuntimeException("dest buffer is not direct");
+ }
+ return XRenderFindVisualFormat1(dpy, visual, destBuffer);
+ }
+ /** Entry point to C language function: <code> XVisualInfo * XGetVisualInfo(Display * , long, XVisualInfo * , int * ); </code> */
+ private static native boolean XRenderFindVisualFormat1(long dpy, long visual, ByteBuffer xRenderPictFormat);
+
+
/** Interface to C language function: <br> <code> XVisualInfo * XGetVisualInfo(Display * , long, XVisualInfo * , int * ); </code> */
public static XVisualInfo[] XGetVisualInfo(long arg0, long arg1, XVisualInfo arg2, int[] arg3, int arg3_offset)
{