View | Details | Raw Unified | Return to bug 519
Collapse All | Expand All

(-)../../Applications/JOGLGIT/jogl/src/jogl/classes/jogamp/opengl/GLContextImpl.java (-6 / +23 lines)
Lines 105-110 Link Here
105
  protected static final HashMap<String, ProcAddressTable> mappedGLProcAddress;
105
  protected static final HashMap<String, ProcAddressTable> mappedGLProcAddress;
106
  protected static final HashMap<String, ProcAddressTable> mappedGLXProcAddress;
106
  protected static final HashMap<String, ProcAddressTable> mappedGLXProcAddress;
107
107
108
  private boolean surfaceLocking = true;
109
108
  static {
110
  static {
109
      mappedContextTypeObjectLock = new Object();
111
      mappedContextTypeObjectLock = new Object();
110
      mappedExtensionAvailabilityCache = new HashMap<String, ExtensionAvailabilityCache>();
112
      mappedExtensionAvailabilityCache = new HashMap<String, ExtensionAvailabilityCache>();
Lines 222-228 Link Here
222
      }
224
      }
223
      lock.lock();
225
      lock.lock();
224
  }
226
  }
225
    
227
228
  public boolean isSurfaceLocking() {
229
    return surfaceLocking;
230
  }
231
232
  public void setSurfaceLocking( boolean aSurfaceLocking ) {
233
    surfaceLocking = aSurfaceLocking;
234
  }
235
226
  public abstract Object getPlatformGLExtensions();
236
  public abstract Object getPlatformGLExtensions();
227
237
228
  // Note: the surface is locked within [makeCurrent .. swap .. release]
238
  // Note: the surface is locked within [makeCurrent .. swap .. release]
Lines 432-438 Link Here
432
  // Note: the surface is locked within [makeCurrent .. swap .. release]
442
  // Note: the surface is locked within [makeCurrent .. swap .. release]
433
  protected final int makeCurrentLocking() throws GLException {
443
  protected final int makeCurrentLocking() throws GLException {
434
    boolean exceptionOccurred = false;
444
    boolean exceptionOccurred = false;
435
    int lockRes = drawable.lockSurface();
445
    int lockRes = 0;
446
    if ( surfaceLocking ) {
447
      lockRes = drawable.lockSurface();
448
    }else{
449
      lockRes = NativeSurface.LOCK_SUCCESS;
450
    }
436
    try {
451
    try {
437
      if (NativeSurface.LOCK_SURFACE_NOT_READY == lockRes) {
452
      if (NativeSurface.LOCK_SURFACE_NOT_READY == lockRes) {
438
        return CONTEXT_NOT_CURRENT;
453
        return CONTEXT_NOT_CURRENT;
Lines 469-478 Link Here
469
      }
484
      }
470
    } finally {
485
    } finally {
471
      if (exceptionOccurred) {
486
      if (exceptionOccurred) {
472
        drawable.unlockSurface();
487
        if ( surfaceLocking ) {
473
      }
474
    }
475
  }
488
          drawable.unlockSurface();
489
        }
490
      }
491
    }
492
  }
476
  protected abstract void makeCurrentImpl(boolean newCreatedContext) throws GLException;
493
  protected abstract void makeCurrentImpl(boolean newCreatedContext) throws GLException;
477
  protected abstract boolean createImpl() throws GLException ;
494
  protected abstract boolean createImpl() throws GLException ;
478
495
(-)../../Applications/JOGLGIT/jogl/src/jogl/classes/jogamp/opengl/GLPbufferImpl.java (+1 lines)
Lines 83-88 Link Here
83
    this.pbufferDrawable = pbufferDrawable;
83
    this.pbufferDrawable = pbufferDrawable;
84
    context = (GLContextImpl) pbufferDrawable.createContext(parentContext);
84
    context = (GLContextImpl) pbufferDrawable.createContext(parentContext);
85
    context.setSynchronized(true);
85
    context.setSynchronized(true);
86
    context.setSurfaceLocking( false );
86
  }
87
  }
87
88
88
  public GLContext createContext(GLContext shareWith) {
89
  public GLContext createContext(GLContext shareWith) {
(-)../../Applications/JOGLGIT/jogl/src/nativewindow/classes/jogamp/nativewindow/x11/X11Util.java (-7 / +13 lines)
Lines 37-51 Link Here
37
import jogamp.nativewindow.Debug;
37
import jogamp.nativewindow.Debug;
38
import jogamp.nativewindow.NWJNILibLoader;
38
import jogamp.nativewindow.NWJNILibLoader;
39
39
40
import javax.media.nativewindow.*;
40
import javax.media.nativewindow.AbstractGraphicsDevice;
41
41
import javax.media.nativewindow.NativeWindowException;
42
import javax.media.nativewindow.NativeWindowFactory;
43
import javax.media.nativewindow.ToolkitLock;
44
import javax.media.nativewindow.util.Point;
42
import java.nio.Buffer;
45
import java.nio.Buffer;
43
import java.nio.IntBuffer;
46
import java.nio.IntBuffer;
44
import java.nio.ShortBuffer;
47
import java.nio.ShortBuffer;
45
import java.security.AccessController;
48
import java.security.AccessController;
46
import java.util.ArrayList;
49
import java.util.ArrayList;
47
import java.util.List;
50
import java.util.List;
48
import javax.media.nativewindow.util.Point;
49
51
50
/**
52
/**
51
 * Contains a thread safe X11 utility to retrieve display connections.
53
 * Contains a thread safe X11 utility to retrieve display connections.
Lines 496-509 Link Here
496
        }
498
        }
497
    }
499
    }
498
500
499
    public static int XSync(long display, boolean discard) {
501
    public static int XSync( long display, boolean discard, boolean lock ) {
502
      if ( lock ) {
500
        lockDefaultToolkit(display);
503
        lockDefaultToolkit(display);
501
        try {
504
      }
505
      try {
502
            return X11Lib.XSync(display, discard);
506
            return X11Lib.XSync(display, discard);
503
        } finally {
507
        } finally {
504
            unlockDefaultToolkit(display);
508
        if ( lock ) {
509
          unlockDefaultToolkit(display);
505
        }
510
        }
506
    }
511
      }
512
    }
507
513
508
    public static void XSynchronize(long display, boolean onoff) {
514
    public static void XSynchronize(long display, boolean onoff) {
509
        lockDefaultToolkit(display);
515
        lockDefaultToolkit(display);
(-)../../Applications/JOGLGIT/jogl/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXContext.java (-10 / +19 lines)
Lines 40-59 Link Here
40
40
41
package jogamp.opengl.x11.glx;
41
package jogamp.opengl.x11.glx;
42
42
43
import java.nio.*;
44
import java.util.*;
45
46
import javax.media.opengl.*;
47
import javax.media.nativewindow.*;
48
import javax.media.nativewindow.x11.X11GraphicsDevice;
49
50
import com.jogamp.common.nio.Buffers;
43
import com.jogamp.common.nio.Buffers;
51
import com.jogamp.common.util.VersionNumber;
44
import com.jogamp.common.util.VersionNumber;
52
import jogamp.opengl.*;
53
import com.jogamp.gluegen.runtime.ProcAddressTable;
45
import com.jogamp.gluegen.runtime.ProcAddressTable;
54
import com.jogamp.gluegen.runtime.opengl.GLProcAddressResolver;
46
import com.jogamp.gluegen.runtime.opengl.GLProcAddressResolver;
55
import jogamp.nativewindow.x11.X11Util;
47
import jogamp.nativewindow.x11.X11Util;
48
import jogamp.opengl.GLContextImpl;
49
import jogamp.opengl.GLContextShareSet;
50
import jogamp.opengl.GLDrawableFactoryImpl;
51
import jogamp.opengl.GLDrawableImpl;
56
52
53
import javax.media.nativewindow.AbstractGraphicsConfiguration;
54
import javax.media.nativewindow.AbstractGraphicsDevice;
55
import javax.media.nativewindow.NativeSurface;
56
import javax.media.nativewindow.x11.X11GraphicsDevice;
57
import javax.media.opengl.GLCapabilitiesImmutable;
58
import javax.media.opengl.GLContext;
59
import javax.media.opengl.GLException;
60
import javax.media.opengl.GLProfile;
61
import java.nio.ByteBuffer;
62
import java.nio.IntBuffer;
63
import java.util.HashMap;
64
import java.util.Map;
65
57
public abstract class X11GLXContext extends GLContextImpl {
66
public abstract class X11GLXContext extends GLContextImpl {
58
  protected static final boolean TRACE_CONTEXT_CURRENT = false; // true;
67
  protected static final boolean TRACE_CONTEXT_CURRENT = false; // true;
59
68
Lines 246-254 Link Here
246
    try {
255
    try {
247
        // critical path, a remote display might not support this command,
256
        // critical path, a remote display might not support this command,
248
        // hence we need to catch the X11 Error within this block.
257
        // hence we need to catch the X11 Error within this block.
249
        X11Util.XSync(display, false);
258
        X11Util.XSync(display, false, isSurfaceLocking() );
250
        ctx = _glXExt.glXCreateContextAttribsARB(display, config.getFBConfig(), share, direct, attribs);
259
        ctx = _glXExt.glXCreateContextAttribsARB(display, config.getFBConfig(), share, direct, attribs);
251
        X11Util.XSync(display, false);
260
        X11Util.XSync(display, false, isSurfaceLocking() );
252
    } catch (RuntimeException re) {
261
    } catch (RuntimeException re) {
253
        if(DEBUG) {
262
        if(DEBUG) {
254
          Throwable t = new Throwable("Info: X11GLXContext.createContextARBImpl glXCreateContextAttribsARB failed with "+getGLVersion(major, minor, ctp, "@creation"), re);
263
          Throwable t = new Throwable("Info: X11GLXContext.createContextARBImpl glXCreateContextAttribsARB failed with "+getGLVersion(major, minor, ctp, "@creation"), re);

Return to bug 519