Loading core/java/android/view/ViewRootImpl.java +13 −6 Original line number Diff line number Diff line Loading @@ -3876,10 +3876,6 @@ public final class ViewRootImpl implements ViewParent, } private void addFrameCallbackIfNeeded() { if (!mNextDrawUseBLASTSyncTransaction) { return; } // Frame callbacks will always occur after submitting draw requests and before // the draw actually occurs. This will ensure that we set the next transaction // for the frame that's about to get drawn and not on a previous frame that. Loading @@ -3887,8 +3883,19 @@ public final class ViewRootImpl implements ViewParent, // This is thread safe since mRtNextFrameReportConsumeWithBlast will only be // modified in onFrameDraw and then again in onFrameComplete. This is to ensure the // next frame completed should be reported with the blast sync transaction. if (mNextDrawUseBLASTSyncTransaction) { registerRtFrameCallback(createFrameDrawingCallback()); mNextDrawUseBLASTSyncTransaction = false; } else if (mReportNextDraw) { registerRtFrameCallback(frame -> { if (mBlastBufferQueue != null) { // If we need to report next draw, wait for adapter to flush its shadow queue // by processing previously queued buffers so that we can submit the // transaction a timely manner. mBlastBufferQueue.flushShadowQueue(); } }); } } private void performDraw() { Loading core/jni/android_graphics_BLASTBufferQueue.cpp +7 −1 Original line number Diff line number Diff line Loading @@ -69,13 +69,19 @@ static void nativeUpdate(JNIEnv*env, jclass clazz, jlong ptr, jlong surfaceContr queue->update(reinterpret_cast<SurfaceControl*>(surfaceControl), width, height); } static void nativeFlushShadowQueue(JNIEnv* env, jclass clazz, jlong ptr) { sp<BLASTBufferQueue> queue = reinterpret_cast<BLASTBufferQueue*>(ptr); queue->flushShadowQueue(); } static const JNINativeMethod gMethods[] = { /* name, signature, funcPtr */ {"nativeCreate", "(Ljava/lang/String;JJJZ)J", (void*)nativeCreate}, {"nativeGetSurface", "(J)Landroid/view/Surface;", (void*)nativeGetSurface}, {"nativeDestroy", "(J)V", (void*)nativeDestroy}, {"nativeSetNextTransaction", "(JJ)V", (void*)nativeSetNextTransaction}, {"nativeUpdate", "(JJJJ)V", (void*)nativeUpdate}}; {"nativeUpdate", "(JJJJ)V", (void*)nativeUpdate}, {"nativeFlushShadowQueue", "(J)V", (void*)nativeFlushShadowQueue}}; int register_android_graphics_BLASTBufferQueue(JNIEnv* env) { int res = jniRegisterNativeMethods(env, "android/graphics/BLASTBufferQueue", Loading graphics/java/android/graphics/BLASTBufferQueue.java +5 −0 Original line number Diff line number Diff line Loading @@ -32,6 +32,7 @@ public final class BLASTBufferQueue { private static native Surface nativeGetSurface(long ptr); private static native void nativeSetNextTransaction(long ptr, long transactionPtr); private static native void nativeUpdate(long ptr, long surfaceControl, long width, long height); private static native void nativeFlushShadowQueue(long ptr); /** Create a new connection with the surface flinger. */ public BLASTBufferQueue(String name, SurfaceControl sc, int width, int height, Loading Loading @@ -69,4 +70,8 @@ public final class BLASTBufferQueue { super.finalize(); } } public void flushShadowQueue() { nativeFlushShadowQueue(mNativeObject); } } Loading
core/java/android/view/ViewRootImpl.java +13 −6 Original line number Diff line number Diff line Loading @@ -3876,10 +3876,6 @@ public final class ViewRootImpl implements ViewParent, } private void addFrameCallbackIfNeeded() { if (!mNextDrawUseBLASTSyncTransaction) { return; } // Frame callbacks will always occur after submitting draw requests and before // the draw actually occurs. This will ensure that we set the next transaction // for the frame that's about to get drawn and not on a previous frame that. Loading @@ -3887,8 +3883,19 @@ public final class ViewRootImpl implements ViewParent, // This is thread safe since mRtNextFrameReportConsumeWithBlast will only be // modified in onFrameDraw and then again in onFrameComplete. This is to ensure the // next frame completed should be reported with the blast sync transaction. if (mNextDrawUseBLASTSyncTransaction) { registerRtFrameCallback(createFrameDrawingCallback()); mNextDrawUseBLASTSyncTransaction = false; } else if (mReportNextDraw) { registerRtFrameCallback(frame -> { if (mBlastBufferQueue != null) { // If we need to report next draw, wait for adapter to flush its shadow queue // by processing previously queued buffers so that we can submit the // transaction a timely manner. mBlastBufferQueue.flushShadowQueue(); } }); } } private void performDraw() { Loading
core/jni/android_graphics_BLASTBufferQueue.cpp +7 −1 Original line number Diff line number Diff line Loading @@ -69,13 +69,19 @@ static void nativeUpdate(JNIEnv*env, jclass clazz, jlong ptr, jlong surfaceContr queue->update(reinterpret_cast<SurfaceControl*>(surfaceControl), width, height); } static void nativeFlushShadowQueue(JNIEnv* env, jclass clazz, jlong ptr) { sp<BLASTBufferQueue> queue = reinterpret_cast<BLASTBufferQueue*>(ptr); queue->flushShadowQueue(); } static const JNINativeMethod gMethods[] = { /* name, signature, funcPtr */ {"nativeCreate", "(Ljava/lang/String;JJJZ)J", (void*)nativeCreate}, {"nativeGetSurface", "(J)Landroid/view/Surface;", (void*)nativeGetSurface}, {"nativeDestroy", "(J)V", (void*)nativeDestroy}, {"nativeSetNextTransaction", "(JJ)V", (void*)nativeSetNextTransaction}, {"nativeUpdate", "(JJJJ)V", (void*)nativeUpdate}}; {"nativeUpdate", "(JJJJ)V", (void*)nativeUpdate}, {"nativeFlushShadowQueue", "(J)V", (void*)nativeFlushShadowQueue}}; int register_android_graphics_BLASTBufferQueue(JNIEnv* env) { int res = jniRegisterNativeMethods(env, "android/graphics/BLASTBufferQueue", Loading
graphics/java/android/graphics/BLASTBufferQueue.java +5 −0 Original line number Diff line number Diff line Loading @@ -32,6 +32,7 @@ public final class BLASTBufferQueue { private static native Surface nativeGetSurface(long ptr); private static native void nativeSetNextTransaction(long ptr, long transactionPtr); private static native void nativeUpdate(long ptr, long surfaceControl, long width, long height); private static native void nativeFlushShadowQueue(long ptr); /** Create a new connection with the surface flinger. */ public BLASTBufferQueue(String name, SurfaceControl sc, int width, int height, Loading Loading @@ -69,4 +70,8 @@ public final class BLASTBufferQueue { super.finalize(); } } public void flushShadowQueue() { nativeFlushShadowQueue(mNativeObject); } }