blob: 31104a0d0a087e83aeeabf3fe5416766c62eb180 [file] [log] [blame]
Jesse Hall0c79d802013-04-30 13:46:28 -07001/*
Jesse Hall0c79d802013-04-30 13:46:28 -07002** 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
19package android.opengl;
20
John Reck1ce46f72022-02-10 14:22:57 -050021import android.annotation.NonNull;
22import android.hardware.SyncFence;
23import android.os.ParcelFileDescriptor;
24import android.util.Log;
25
Jesse Hall0c79d802013-04-30 13:46:28 -070026/**
27 * EGL Extensions
28 */
29public 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;
Kalle Raitaebce2a72017-01-12 10:26:05 -080036 public static final int EGL_RECORDABLE_ANDROID = 0x3142;
Jesse Hall0c79d802013-04-30 13:46:28 -070037
John Reck1ce46f72022-02-10 14:22:57 -050038 // 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
Jesse Hall0c79d802013-04-30 13:46:28 -070044 native private static void _nativeClassInit();
45 static {
46 _nativeClassInit();
47 }
48
John Reck1ce46f72022-02-10 14:22:57 -050049 /**
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 */
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
77 private static native int eglDupNativeFenceFDANDROIDImpl(EGLDisplay display, EGLSync sync);
Elliott Hughes5e283de2024-01-24 15:07:30 -080078
79 // C function EGLBoolean eglPresentationTimeANDROID ( EGLDisplay dpy, EGLSurface sur, EGLnsecsANDROID time )
80
81 public static native boolean eglPresentationTimeANDROID(
82 EGLDisplay dpy,
83 EGLSurface sur,
84 long time
85 );
86
Jesse Hall0c79d802013-04-30 13:46:28 -070087}