| Jesse Hall | 0c79d80 | 2013-04-30 13:46:28 -0700 | [diff] [blame] | 1 | /* |
| Jesse Hall | 0c79d80 | 2013-04-30 13:46:28 -0700 | [diff] [blame] | 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 | |
| John Reck | 1ce46f7 | 2022-02-10 14:22:57 -0500 | [diff] [blame] | 21 | import android.annotation.NonNull; |
| 22 | import android.hardware.SyncFence; |
| 23 | import android.os.ParcelFileDescriptor; |
| 24 | import android.util.Log; |
| 25 | |
| Jesse Hall | 0c79d80 | 2013-04-30 13:46:28 -0700 | [diff] [blame] | 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; |
| Kalle Raita | ebce2a7 | 2017-01-12 10:26:05 -0800 | [diff] [blame] | 36 | public static final int EGL_RECORDABLE_ANDROID = 0x3142; |
| Jesse Hall | 0c79d80 | 2013-04-30 13:46:28 -0700 | [diff] [blame] | 37 | |
| John Reck | 1ce46f7 | 2022-02-10 14:22:57 -0500 | [diff] [blame] | 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 | |
| Jesse Hall | 0c79d80 | 2013-04-30 13:46:28 -0700 | [diff] [blame] | 44 | native private static void _nativeClassInit(); |
| 45 | static { |
| 46 | _nativeClassInit(); |
| 47 | } |
| 48 | |
| John Reck | 1ce46f7 | 2022-02-10 14:22:57 -0500 | [diff] [blame] | 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 | */ |
| 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 Hughes | 5e283de | 2024-01-24 15:07:30 -0800 | [diff] [blame] | 78 | |
| 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 Hall | 0c79d80 | 2013-04-30 13:46:28 -0700 | [diff] [blame] | 87 | } |