From 8e963a5a6016d246184ed65906f9d103e92b17e2 Mon Sep 17 00:00:00 2001 From: Sascha Haeberling Date: Tue, 6 Aug 2013 11:43:02 -0700 Subject: This removes all non-Camera stuff from Camera2. Note: Camera2 is a clone of Gallery2 right now. Note 2: I will bring .mk files back later. Change-Id: Ida958654296f5ebaacb6bb0ff59d52a7c37ce6fc --- jni/jni_egl_fence.cpp | 78 --------------------------------------------------- 1 file changed, 78 deletions(-) delete mode 100644 jni/jni_egl_fence.cpp (limited to 'jni/jni_egl_fence.cpp') diff --git a/jni/jni_egl_fence.cpp b/jni/jni_egl_fence.cpp deleted file mode 100644 index cf15e2f5d..000000000 --- a/jni/jni_egl_fence.cpp +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright (C) 2012 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "jni_egl_fence.h" - -#include -#include -#include -#include - -#define ALOGE(...) __android_log_print(ANDROID_LOG_ERROR,"egl_fence",__VA_ARGS__) - -typedef EGLSyncKHR EGLAPIENTRY (*TypeEglCreateSyncKHR)(EGLDisplay dpy, - EGLenum type, const EGLint *attrib_list); -typedef EGLBoolean EGLAPIENTRY (*TypeEglDestroySyncKHR)(EGLDisplay dpy, - EGLSyncKHR sync); -typedef EGLint EGLAPIENTRY (*TypeEglClientWaitSyncKHR)(EGLDisplay dpy, - EGLSyncKHR sync, EGLint flags, EGLTimeKHR timeout); -static TypeEglCreateSyncKHR FuncEglCreateSyncKHR = NULL; -static TypeEglClientWaitSyncKHR FuncEglClientWaitSyncKHR = NULL; -static TypeEglDestroySyncKHR FuncEglDestroySyncKHR = NULL; -static bool initialized = false; -static bool egl_khr_fence_sync_supported = false; - -bool IsEglKHRFenceSyncSupported() { - if (!initialized) { - EGLDisplay display = eglGetCurrentDisplay(); - const char* eglExtensions = eglQueryString(eglGetCurrentDisplay(), EGL_EXTENSIONS); - if (eglExtensions && strstr(eglExtensions, "EGL_KHR_fence_sync")) { - FuncEglCreateSyncKHR = (TypeEglCreateSyncKHR) eglGetProcAddress("eglCreateSyncKHR"); - FuncEglClientWaitSyncKHR = (TypeEglClientWaitSyncKHR) eglGetProcAddress("eglClientWaitSyncKHR"); - FuncEglDestroySyncKHR = (TypeEglDestroySyncKHR) eglGetProcAddress("eglDestroySyncKHR"); - if (FuncEglCreateSyncKHR != NULL && FuncEglClientWaitSyncKHR != NULL - && FuncEglDestroySyncKHR != NULL) { - egl_khr_fence_sync_supported = true; - } - } - initialized = true; - } - return egl_khr_fence_sync_supported; -} - -void -Java_com_android_gallery3d_photoeditor_FilterStack_nativeEglSetFenceAndWait(JNIEnv* env, - jobject thiz) { - if (!IsEglKHRFenceSyncSupported()) return; - EGLDisplay display = eglGetCurrentDisplay(); - - // Create a egl fence and wait for egl to return it. - // Additional reference on egl fence sync can be found in: - // http://www.khronos.org/registry/vg/extensions/KHR/EGL_KHR_fence_sync.txt - EGLSyncKHR fence = FuncEglCreateSyncKHR(display, EGL_SYNC_FENCE_KHR, NULL); - if (fence == EGL_NO_SYNC_KHR) { - return; - } - - EGLint result = FuncEglClientWaitSyncKHR(display, - fence, - EGL_SYNC_FLUSH_COMMANDS_BIT_KHR, - EGL_FOREVER_KHR); - if (result == EGL_FALSE) { - ALOGE("EGL FENCE: error waiting for fence: %#x", eglGetError()); - } - FuncEglDestroySyncKHR(display, fence); -} -- cgit v1.2.3