summaryrefslogtreecommitdiffstats
path: root/src/newt/classes/jogamp
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2019-12-04 19:47:33 +0100
committerSven Gothel <[email protected]>2019-12-04 19:47:33 +0100
commit54d34cb749dd877fffcbb2d33cc3707763b94b7e (patch)
treed52bdc138d77646717e422c5a8b743926be7e6f5 /src/newt/classes/jogamp
parent43dd50a8545f8fde8198091b136aece6f062cb38 (diff)
Bug 1156, Bug 1406: NEWT DRM/GBM WindowDriver.surfaceSwap(): Pass swapInterval to optionally skip VSYNC if 0
Diffstat (limited to 'src/newt/classes/jogamp')
-rw-r--r--src/newt/classes/jogamp/newt/driver/egl/gbm/WindowDriver.java30
1 files changed, 20 insertions, 10 deletions
diff --git a/src/newt/classes/jogamp/newt/driver/egl/gbm/WindowDriver.java b/src/newt/classes/jogamp/newt/driver/egl/gbm/WindowDriver.java
index b5985c66c..75062287d 100644
--- a/src/newt/classes/jogamp/newt/driver/egl/gbm/WindowDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/egl/gbm/WindowDriver.java
@@ -39,6 +39,7 @@ import com.jogamp.newt.Display;
import com.jogamp.newt.event.MouseEvent;
import com.jogamp.opengl.GLCapabilitiesChooser;
import com.jogamp.opengl.GLCapabilitiesImmutable;
+import com.jogamp.opengl.GLContext;
import com.jogamp.opengl.GLException;
import com.jogamp.opengl.egl.EGL;
@@ -288,15 +289,18 @@ public class WindowDriver extends WindowImpl {
final long nativeWindowHandle = getWindowHandle();
final DrmMode d = screen.drmMode;
+ final GLContext ctx = GLContext.getCurrent();
+ final int swapInterval = ctx.getSwapInterval();
+
if(!EGL.eglSwapBuffers(display.getHandle(), eglSurface)) {
throw new GLException("Error swapping buffers, eglError "+toHexString(EGL.eglGetError())+", "+this);
}
if( 0 == lastBO ) {
lastBO = FirstSwapSurface(d.drmFd, d.getCrtcIDs()[0], getX(), getY(), d.getConnectors()[0].getConnector_id(),
- d.getModes()[0], nativeWindowHandle);
+ d.getModes()[0], nativeWindowHandle, swapInterval);
} else {
lastBO = NextSwapSurface(d.drmFd, d.getCrtcIDs()[0], getX(), getY(), d.getConnectors()[0].getConnector_id(),
- d.getModes()[0], nativeWindowHandle, lastBO);
+ d.getModes()[0], nativeWindowHandle, lastBO, swapInterval);
}
return true; // eglSwapBuffers done!
}
@@ -377,27 +381,33 @@ public class WindowDriver extends WindowImpl {
protected static native boolean initIDs();
// private native void reconfigure0(long eglWindowHandle, int x, int y, int width, int height, int flags);
- private long FirstSwapSurface(final int drmFd, final int crtc_id, final int x, final int y, final int connector_id, final drmModeModeInfo drmMode, final long gbmSurface) {
+ private long FirstSwapSurface(final int drmFd, final int crtc_id, final int x, final int y,
+ final int connector_id, final drmModeModeInfo drmMode,
+ final long gbmSurface, final int swapInterval) {
final ByteBuffer bb = drmMode.getBuffer();
if(!Buffers.isDirect(bb)) {
throw new IllegalArgumentException("drmMode's buffer is not direct (NIO)");
}
return FirstSwapSurface0(drmFd, crtc_id, x, y, connector_id,
bb, Buffers.getDirectBufferByteOffset(bb),
- gbmSurface);
+ gbmSurface, swapInterval);
}
- private native long FirstSwapSurface0(int drmFd, int crtc_id, int x, int y, int connector_id, Object mode, int mode_byte_offset,
- long gbmSurface);
+ private native long FirstSwapSurface0(int drmFd, int crtc_id, int x, int y,
+ int connector_id, Object mode, int mode_byte_offset,
+ long gbmSurface, int swapInterval);
- private long NextSwapSurface(final int drmFd, final int crtc_id, final int x, final int y, final int connector_id, final drmModeModeInfo drmMode, final long gbmSurface, final long lastBO) {
+ private long NextSwapSurface(final int drmFd, final int crtc_id, final int x, final int y,
+ final int connector_id, final drmModeModeInfo drmMode,
+ final long gbmSurface, final long lastBO, final int swapInterval) {
final ByteBuffer bb = drmMode.getBuffer();
if(!Buffers.isDirect(bb)) {
throw new IllegalArgumentException("drmMode's buffer is not direct (NIO)");
}
return NextSwapSurface0(drmFd, crtc_id, x, y, connector_id,
bb, Buffers.getDirectBufferByteOffset(bb),
- gbmSurface, lastBO);
+ gbmSurface, lastBO, swapInterval);
}
- private native long NextSwapSurface0(int drmFd, int crtc_id, int x, int y, int connector_id, Object mode, int mode_byte_offset,
- long gbmSurface, long lastBO);
+ private native long NextSwapSurface0(int drmFd, int crtc_id, int x, int y,
+ int connector_id, Object mode, int mode_byte_offset,
+ long gbmSurface, long lastBO, int swapInterval);
}