Loading core/jni/android/graphics/SurfaceTexture.cpp +31 −0 Original line number Diff line number Diff line Loading @@ -18,6 +18,8 @@ #include <stdio.h> #include <EGL/egl.h> #include <EGL/eglext.h> #include <GLES2/gl2.h> #include <GLES2/gl2ext.h> Loading @@ -34,6 +36,8 @@ // ---------------------------------------------------------------------------- #define EGL_QCOM_PROTECTED_CONTENT 0x32E0 namespace android { static const char* const OutOfResourcesException = Loading @@ -55,6 +59,28 @@ static int32_t createProcessUniqueId() { return android_atomic_inc(&globalCounter); } // Check whether the current EGL context is protected. static bool isProtectedContext() { EGLDisplay dpy = eglGetCurrentDisplay(); EGLContext ctx = eglGetCurrentContext(); if (dpy == EGL_NO_DISPLAY) { ALOGE("isProtectedSurface: invalid current EGLDisplay"); return false; } if (ctx == EGL_NO_CONTEXT) { ALOGE("isProtectedSurface: invalid current EGLContext"); return false; } EGLint isProtected = EGL_FALSE; // TODO: Change the enum value below when an extension is ratified. eglQueryContext(dpy, ctx, EGL_QCOM_PROTECTED_CONTENT, &isProtected); return isProtected; } // ---------------------------------------------------------------------------- static void SurfaceTexture_setSurfaceTexture(JNIEnv* env, jobject thiz, Loading Loading @@ -263,6 +289,11 @@ static void SurfaceTexture_init(JNIEnv* env, jobject thiz, jboolean isDetached, getpid(), createProcessUniqueId())); // If the current context is protected, inform the producer. if (isProtectedContext()) { consumer->setConsumerUsageBits(GRALLOC_USAGE_PROTECTED); } SurfaceTexture_setSurfaceTexture(env, thiz, surfaceTexture); SurfaceTexture_setProducer(env, thiz, producer); Loading Loading
core/jni/android/graphics/SurfaceTexture.cpp +31 −0 Original line number Diff line number Diff line Loading @@ -18,6 +18,8 @@ #include <stdio.h> #include <EGL/egl.h> #include <EGL/eglext.h> #include <GLES2/gl2.h> #include <GLES2/gl2ext.h> Loading @@ -34,6 +36,8 @@ // ---------------------------------------------------------------------------- #define EGL_QCOM_PROTECTED_CONTENT 0x32E0 namespace android { static const char* const OutOfResourcesException = Loading @@ -55,6 +59,28 @@ static int32_t createProcessUniqueId() { return android_atomic_inc(&globalCounter); } // Check whether the current EGL context is protected. static bool isProtectedContext() { EGLDisplay dpy = eglGetCurrentDisplay(); EGLContext ctx = eglGetCurrentContext(); if (dpy == EGL_NO_DISPLAY) { ALOGE("isProtectedSurface: invalid current EGLDisplay"); return false; } if (ctx == EGL_NO_CONTEXT) { ALOGE("isProtectedSurface: invalid current EGLContext"); return false; } EGLint isProtected = EGL_FALSE; // TODO: Change the enum value below when an extension is ratified. eglQueryContext(dpy, ctx, EGL_QCOM_PROTECTED_CONTENT, &isProtected); return isProtected; } // ---------------------------------------------------------------------------- static void SurfaceTexture_setSurfaceTexture(JNIEnv* env, jobject thiz, Loading Loading @@ -263,6 +289,11 @@ static void SurfaceTexture_init(JNIEnv* env, jobject thiz, jboolean isDetached, getpid(), createProcessUniqueId())); // If the current context is protected, inform the producer. if (isProtectedContext()) { consumer->setConsumerUsageBits(GRALLOC_USAGE_PROTECTED); } SurfaceTexture_setSurfaceTexture(env, thiz, surfaceTexture); SurfaceTexture_setProducer(env, thiz, producer); Loading