• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2 ** Copyright 2013, The Android Open Source Project
3 **
4 ** Licensed under the Apache License, Version 2.0 (the "License");
5 ** you may not use this file except in compliance with the License.
6 ** You may obtain a copy of the License at
7 **
8 **     http://www.apache.org/licenses/LICENSE-2.0
9 **
10 ** Unless required by applicable law or agreed to in writing, software
11 ** distributed under the License is distributed on an "AS IS" BASIS,
12 ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 ** See the License for the specific language governing permissions and
14 ** limitations under the License.
15 */
16 
17 // This source file is automatically generated
18 
19 package android.opengl;
20 
21 import android.annotation.NonNull;
22 import android.hardware.SyncFence;
23 import android.os.ParcelFileDescriptor;
24 import android.util.Log;
25 
26 /**
27  * EGL Extensions
28  */
29 public class EGLExt {
30 
31     // EGL_KHR_create_context
32     public static final int EGL_CONTEXT_MAJOR_VERSION_KHR   = 0x3098;
33     public static final int EGL_CONTEXT_MINOR_VERSION_KHR   = 0x30FB;
34     public static final int EGL_CONTEXT_FLAGS_KHR           = 0x30FC;
35     public static final int EGL_OPENGL_ES3_BIT_KHR          = 0x0040;
36     public static final int EGL_RECORDABLE_ANDROID          = 0x3142;
37 
38     // EGL_ANDROID_native_fence_sync
39     public static final int EGL_SYNC_NATIVE_FENCE_ANDROID     = 0x3144;
40     public static final int EGL_SYNC_NATIVE_FENCE_FD_ANDROID  = 0x3145;
41     public static final int EGL_SYNC_NATIVE_FENCE_SIGNALED_ANDROID = 0x3146;
42     public static final int EGL_NO_NATIVE_FENCE_FD_ANDROID    = -1;
43 
_nativeClassInit()44     native private static void _nativeClassInit();
45     static {
_nativeClassInit()46         _nativeClassInit();
47     }
48 
49     /**
50      * Retrieves the SyncFence for an EGLSync created with EGL_SYNC_NATIVE_FENCE_ANDROID
51      *
52      * See <a href="https://www.khronos.org/registry/EGL/extensions/ANDROID/EGL_ANDROID_native_fence_sync.txt">
53      *     EGL_ANDROID_native_fence_sync</a> extension for more details
54      * @param display The EGLDisplay connection
55      * @param sync The EGLSync to fetch the SyncFence from
56      * @return A SyncFence representing the native fence.
57      *       * If <sync> is not a valid sync object for <display>,
58      *         an {@link SyncFence#isValid() invalid} SyncFence is returned and an EGL_BAD_PARAMETER
59      *         error is generated.
60      *       * If the EGL_SYNC_NATIVE_FENCE_FD_ANDROID attribute of <sync> is
61      *         EGL_NO_NATIVE_FENCE_FD_ANDROID, an {@link SyncFence#isValid() invalid} SyncFence is
62      *         returned and an EGL_BAD_PARAMETER error is generated.
63      *       * If <display> does not match the display passed to eglCreateSync
64      *         when <sync> was created, the behaviour is undefined.
65      */
eglDupNativeFenceFDANDROID(@onNull EGLDisplay display, @NonNull EGLSync sync)66     public static @NonNull SyncFence eglDupNativeFenceFDANDROID(@NonNull EGLDisplay display,
67             @NonNull EGLSync sync) {
68         int fd = eglDupNativeFenceFDANDROIDImpl(display, sync);
69         Log.d("EGL", "eglDupNativeFence returned " + fd);
70         if (fd >= 0) {
71             return SyncFence.create(ParcelFileDescriptor.adoptFd(fd));
72         } else {
73             return SyncFence.createEmpty();
74         }
75     }
76 
eglDupNativeFenceFDANDROIDImpl(EGLDisplay display, EGLSync sync)77     private static native int eglDupNativeFenceFDANDROIDImpl(EGLDisplay display, EGLSync sync);
78 
79     // C function EGLBoolean eglPresentationTimeANDROID ( EGLDisplay dpy, EGLSurface sur, EGLnsecsANDROID time )
80 
eglPresentationTimeANDROID( EGLDisplay dpy, EGLSurface sur, long time )81     public static native boolean eglPresentationTimeANDROID(
82         EGLDisplay dpy,
83         EGLSurface sur,
84         long time
85     );
86 
87 }
88