Loading core/java/android/view/SurfaceView.java +4 −7 Original line number Diff line number Diff line Loading @@ -1193,11 +1193,9 @@ public class SurfaceView extends View implements ViewRootImpl.SurfaceChangedCall private void setBufferSize(Transaction transaction) { if (mUseBlastAdapter) { mBlastBufferQueue.update(mBlastSurfaceControl, mSurfaceWidth, mSurfaceHeight); mBlastBufferQueue.update(mBlastSurfaceControl, mSurfaceWidth, mSurfaceHeight, mFormat); } else { transaction.setBufferSize(mSurfaceControl, mSurfaceWidth, mSurfaceHeight); transaction.setBufferSize(mSurfaceControl, mSurfaceWidth, mSurfaceHeight); } } Loading Loading @@ -1241,15 +1239,14 @@ public class SurfaceView extends View implements ViewRootImpl.SurfaceChangedCall .setName(name + "(BLAST)") .setLocalOwnerView(this) .setBufferSize(mSurfaceWidth, mSurfaceHeight) .setFormat(mFormat) .setParent(mSurfaceControl) .setFlags(mSurfaceFlags) .setHidden(false) .setBLASTLayer() .setCallsite("SurfaceView.updateSurface") .build(); mBlastBufferQueue = new BLASTBufferQueue(name, mBlastSurfaceControl, mSurfaceWidth, mSurfaceHeight, true /* TODO */); mBlastBufferQueue = new BLASTBufferQueue(name, mBlastSurfaceControl, mSurfaceWidth, mSurfaceHeight, mFormat, true /* TODO */); } else { previousSurfaceControl = mSurfaceControl; mSurfaceControl = builder Loading core/java/android/view/ViewRootImpl.java +8 −6 Original line number Diff line number Diff line Loading @@ -1852,20 +1852,22 @@ public final class ViewRootImpl implements ViewParent, return mBoundsLayer; } Surface getOrCreateBLASTSurface(int width, int height) { Surface getOrCreateBLASTSurface(int width, int height, @Nullable WindowManager.LayoutParams params) { if (!mSurfaceControl.isValid()) { return null; } int format = params == null ? PixelFormat.TRANSLUCENT : params.format; Surface ret = null; if (mBlastBufferQueue == null) { mBlastBufferQueue = new BLASTBufferQueue(mTag, mSurfaceControl, width, height, mEnableTripleBuffering); mBlastBufferQueue = new BLASTBufferQueue(mTag, mSurfaceControl, width, height, format, mEnableTripleBuffering); // We only return the Surface the first time, as otherwise // it hasn't changed and there is no need to update. ret = mBlastBufferQueue.createSurface(); } else { mBlastBufferQueue.update(mSurfaceControl, width, height); mBlastBufferQueue.update(mSurfaceControl, width, height, format); } return ret; Loading Loading @@ -7608,8 +7610,8 @@ public final class ViewRootImpl implements ViewParent, if (!useBLAST()) { mSurface.copyFrom(mSurfaceControl); } else { final Surface blastSurface = getOrCreateBLASTSurface(mSurfaceSize.x, mSurfaceSize.y); final Surface blastSurface = getOrCreateBLASTSurface(mSurfaceSize.x, mSurfaceSize.y, params); // If blastSurface == null that means it hasn't changed since the last time we // called. In this situation, avoid calling transferFrom as we would then // inc the generation ID and cause EGL resources to be recreated. Loading core/jni/android_graphics_BLASTBufferQueue.cpp +7 −6 Original line number Diff line number Diff line Loading @@ -68,7 +68,7 @@ private: }; static jlong nativeCreate(JNIEnv* env, jclass clazz, jstring jName, jlong surfaceControl, jlong width, jlong height, jboolean enableTripleBuffering) { jlong width, jlong height, jint format, jboolean enableTripleBuffering) { String8 str8; if (jName) { const jchar* str16 = env->GetStringCritical(jName, nullptr); Loading @@ -81,7 +81,7 @@ static jlong nativeCreate(JNIEnv* env, jclass clazz, jstring jName, jlong surfac std::string name = str8.string(); sp<BLASTBufferQueue> queue = new BLASTBufferQueue(name, reinterpret_cast<SurfaceControl*>(surfaceControl), width, height, enableTripleBuffering); height, format, enableTripleBuffering); queue->incStrong((void*)nativeCreate); return reinterpret_cast<jlong>(queue.get()); } Loading @@ -104,9 +104,10 @@ static void nativeSetNextTransaction(JNIEnv* env, jclass clazz, jlong ptr, jlong queue->setNextTransaction(transaction); } static void nativeUpdate(JNIEnv*env, jclass clazz, jlong ptr, jlong surfaceControl, jlong width, jlong height) { static void nativeUpdate(JNIEnv* env, jclass clazz, jlong ptr, jlong surfaceControl, jlong width, jlong height, jint format) { sp<BLASTBufferQueue> queue = reinterpret_cast<BLASTBufferQueue*>(ptr); queue->update(reinterpret_cast<SurfaceControl*>(surfaceControl), width, height); queue->update(reinterpret_cast<SurfaceControl*>(surfaceControl), width, height, format); } static void nativeFlushShadowQueue(JNIEnv* env, jclass clazz, jlong ptr) { Loading Loading @@ -139,11 +140,11 @@ static void nativeSetTransactionCompleteCallback(JNIEnv* env, jclass clazz, jlon static const JNINativeMethod gMethods[] = { /* name, signature, funcPtr */ // clang-format off {"nativeCreate", "(Ljava/lang/String;JJJZ)J", (void*)nativeCreate}, {"nativeCreate", "(Ljava/lang/String;JJJIZ)J", (void*)nativeCreate}, {"nativeGetSurface", "(JZ)Landroid/view/Surface;", (void*)nativeGetSurface}, {"nativeDestroy", "(J)V", (void*)nativeDestroy}, {"nativeSetNextTransaction", "(JJ)V", (void*)nativeSetNextTransaction}, {"nativeUpdate", "(JJJJ)V", (void*)nativeUpdate}, {"nativeUpdate", "(JJJJI)V", (void*)nativeUpdate}, {"nativeFlushShadowQueue", "(J)V", (void*)nativeFlushShadowQueue}, {"nativeMergeWithNextTransaction", "(JJJ)V", (void*)nativeMergeWithNextTransaction}, {"nativeSetTransactionCompleteCallback", Loading graphics/java/android/graphics/BLASTBufferQueue.java +15 −6 Original line number Diff line number Diff line Loading @@ -28,11 +28,12 @@ public final class BLASTBufferQueue { public long mNativeObject; // BLASTBufferQueue* private static native long nativeCreate(String name, long surfaceControl, long width, long height, boolean tripleBufferingEnabled); long height, int format, boolean tripleBufferingEnabled); private static native void nativeDestroy(long ptr); private static native Surface nativeGetSurface(long ptr, boolean includeSurfaceControlHandle); 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 nativeUpdate(long ptr, long surfaceControl, long width, long height, int format); private static native void nativeFlushShadowQueue(long ptr); private static native void nativeMergeWithNextTransaction(long ptr, long transactionPtr, long frameNumber); Loading @@ -52,8 +53,9 @@ public final class BLASTBufferQueue { /** Create a new connection with the surface flinger. */ public BLASTBufferQueue(String name, SurfaceControl sc, int width, int height, boolean tripleBufferingEnabled) { mNativeObject = nativeCreate(name, sc.mNativeObject, width, height, tripleBufferingEnabled); @PixelFormat.Format int format, boolean tripleBufferingEnabled) { mNativeObject = nativeCreate(name, sc.mNativeObject, width, height, format, tripleBufferingEnabled); } public void destroy() { Loading Loading @@ -85,8 +87,15 @@ public final class BLASTBufferQueue { nativeSetNextTransaction(mNativeObject, t == null ? 0 : t.mNativeObject); } public void update(SurfaceControl sc, int width, int height) { nativeUpdate(mNativeObject, sc.mNativeObject, width, height); /** * Updates {@link SurfaceControl}, size, and format for a particular BLASTBufferQueue * @param sc The new SurfaceControl that this BLASTBufferQueue will update * @param width The new width for the buffer. * @param height The new height for the buffer. * @param format The new format for the buffer. */ public void update(SurfaceControl sc, int width, int height, @PixelFormat.Format int format) { nativeUpdate(mNativeObject, sc.mNativeObject, width, height, format); } /** Loading services/core/java/com/android/server/wm/WindowManagerService.java +1 −1 Original line number Diff line number Diff line Loading @@ -2339,7 +2339,7 @@ public class WindowManagerService extends IWindowManager.Stub if (shouldRelayout) { Trace.traceBegin(TRACE_TAG_WINDOW_MANAGER, "relayoutWindow: viewVisibility_1"); result = win.relayoutVisibleWindow(result, attrChanges); result = win.relayoutVisibleWindow(result); try { result = createSurfaceControl(outSurfaceControl, result, win, winAnimator); Loading Loading
core/java/android/view/SurfaceView.java +4 −7 Original line number Diff line number Diff line Loading @@ -1193,11 +1193,9 @@ public class SurfaceView extends View implements ViewRootImpl.SurfaceChangedCall private void setBufferSize(Transaction transaction) { if (mUseBlastAdapter) { mBlastBufferQueue.update(mBlastSurfaceControl, mSurfaceWidth, mSurfaceHeight); mBlastBufferQueue.update(mBlastSurfaceControl, mSurfaceWidth, mSurfaceHeight, mFormat); } else { transaction.setBufferSize(mSurfaceControl, mSurfaceWidth, mSurfaceHeight); transaction.setBufferSize(mSurfaceControl, mSurfaceWidth, mSurfaceHeight); } } Loading Loading @@ -1241,15 +1239,14 @@ public class SurfaceView extends View implements ViewRootImpl.SurfaceChangedCall .setName(name + "(BLAST)") .setLocalOwnerView(this) .setBufferSize(mSurfaceWidth, mSurfaceHeight) .setFormat(mFormat) .setParent(mSurfaceControl) .setFlags(mSurfaceFlags) .setHidden(false) .setBLASTLayer() .setCallsite("SurfaceView.updateSurface") .build(); mBlastBufferQueue = new BLASTBufferQueue(name, mBlastSurfaceControl, mSurfaceWidth, mSurfaceHeight, true /* TODO */); mBlastBufferQueue = new BLASTBufferQueue(name, mBlastSurfaceControl, mSurfaceWidth, mSurfaceHeight, mFormat, true /* TODO */); } else { previousSurfaceControl = mSurfaceControl; mSurfaceControl = builder Loading
core/java/android/view/ViewRootImpl.java +8 −6 Original line number Diff line number Diff line Loading @@ -1852,20 +1852,22 @@ public final class ViewRootImpl implements ViewParent, return mBoundsLayer; } Surface getOrCreateBLASTSurface(int width, int height) { Surface getOrCreateBLASTSurface(int width, int height, @Nullable WindowManager.LayoutParams params) { if (!mSurfaceControl.isValid()) { return null; } int format = params == null ? PixelFormat.TRANSLUCENT : params.format; Surface ret = null; if (mBlastBufferQueue == null) { mBlastBufferQueue = new BLASTBufferQueue(mTag, mSurfaceControl, width, height, mEnableTripleBuffering); mBlastBufferQueue = new BLASTBufferQueue(mTag, mSurfaceControl, width, height, format, mEnableTripleBuffering); // We only return the Surface the first time, as otherwise // it hasn't changed and there is no need to update. ret = mBlastBufferQueue.createSurface(); } else { mBlastBufferQueue.update(mSurfaceControl, width, height); mBlastBufferQueue.update(mSurfaceControl, width, height, format); } return ret; Loading Loading @@ -7608,8 +7610,8 @@ public final class ViewRootImpl implements ViewParent, if (!useBLAST()) { mSurface.copyFrom(mSurfaceControl); } else { final Surface blastSurface = getOrCreateBLASTSurface(mSurfaceSize.x, mSurfaceSize.y); final Surface blastSurface = getOrCreateBLASTSurface(mSurfaceSize.x, mSurfaceSize.y, params); // If blastSurface == null that means it hasn't changed since the last time we // called. In this situation, avoid calling transferFrom as we would then // inc the generation ID and cause EGL resources to be recreated. Loading
core/jni/android_graphics_BLASTBufferQueue.cpp +7 −6 Original line number Diff line number Diff line Loading @@ -68,7 +68,7 @@ private: }; static jlong nativeCreate(JNIEnv* env, jclass clazz, jstring jName, jlong surfaceControl, jlong width, jlong height, jboolean enableTripleBuffering) { jlong width, jlong height, jint format, jboolean enableTripleBuffering) { String8 str8; if (jName) { const jchar* str16 = env->GetStringCritical(jName, nullptr); Loading @@ -81,7 +81,7 @@ static jlong nativeCreate(JNIEnv* env, jclass clazz, jstring jName, jlong surfac std::string name = str8.string(); sp<BLASTBufferQueue> queue = new BLASTBufferQueue(name, reinterpret_cast<SurfaceControl*>(surfaceControl), width, height, enableTripleBuffering); height, format, enableTripleBuffering); queue->incStrong((void*)nativeCreate); return reinterpret_cast<jlong>(queue.get()); } Loading @@ -104,9 +104,10 @@ static void nativeSetNextTransaction(JNIEnv* env, jclass clazz, jlong ptr, jlong queue->setNextTransaction(transaction); } static void nativeUpdate(JNIEnv*env, jclass clazz, jlong ptr, jlong surfaceControl, jlong width, jlong height) { static void nativeUpdate(JNIEnv* env, jclass clazz, jlong ptr, jlong surfaceControl, jlong width, jlong height, jint format) { sp<BLASTBufferQueue> queue = reinterpret_cast<BLASTBufferQueue*>(ptr); queue->update(reinterpret_cast<SurfaceControl*>(surfaceControl), width, height); queue->update(reinterpret_cast<SurfaceControl*>(surfaceControl), width, height, format); } static void nativeFlushShadowQueue(JNIEnv* env, jclass clazz, jlong ptr) { Loading Loading @@ -139,11 +140,11 @@ static void nativeSetTransactionCompleteCallback(JNIEnv* env, jclass clazz, jlon static const JNINativeMethod gMethods[] = { /* name, signature, funcPtr */ // clang-format off {"nativeCreate", "(Ljava/lang/String;JJJZ)J", (void*)nativeCreate}, {"nativeCreate", "(Ljava/lang/String;JJJIZ)J", (void*)nativeCreate}, {"nativeGetSurface", "(JZ)Landroid/view/Surface;", (void*)nativeGetSurface}, {"nativeDestroy", "(J)V", (void*)nativeDestroy}, {"nativeSetNextTransaction", "(JJ)V", (void*)nativeSetNextTransaction}, {"nativeUpdate", "(JJJJ)V", (void*)nativeUpdate}, {"nativeUpdate", "(JJJJI)V", (void*)nativeUpdate}, {"nativeFlushShadowQueue", "(J)V", (void*)nativeFlushShadowQueue}, {"nativeMergeWithNextTransaction", "(JJJ)V", (void*)nativeMergeWithNextTransaction}, {"nativeSetTransactionCompleteCallback", Loading
graphics/java/android/graphics/BLASTBufferQueue.java +15 −6 Original line number Diff line number Diff line Loading @@ -28,11 +28,12 @@ public final class BLASTBufferQueue { public long mNativeObject; // BLASTBufferQueue* private static native long nativeCreate(String name, long surfaceControl, long width, long height, boolean tripleBufferingEnabled); long height, int format, boolean tripleBufferingEnabled); private static native void nativeDestroy(long ptr); private static native Surface nativeGetSurface(long ptr, boolean includeSurfaceControlHandle); 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 nativeUpdate(long ptr, long surfaceControl, long width, long height, int format); private static native void nativeFlushShadowQueue(long ptr); private static native void nativeMergeWithNextTransaction(long ptr, long transactionPtr, long frameNumber); Loading @@ -52,8 +53,9 @@ public final class BLASTBufferQueue { /** Create a new connection with the surface flinger. */ public BLASTBufferQueue(String name, SurfaceControl sc, int width, int height, boolean tripleBufferingEnabled) { mNativeObject = nativeCreate(name, sc.mNativeObject, width, height, tripleBufferingEnabled); @PixelFormat.Format int format, boolean tripleBufferingEnabled) { mNativeObject = nativeCreate(name, sc.mNativeObject, width, height, format, tripleBufferingEnabled); } public void destroy() { Loading Loading @@ -85,8 +87,15 @@ public final class BLASTBufferQueue { nativeSetNextTransaction(mNativeObject, t == null ? 0 : t.mNativeObject); } public void update(SurfaceControl sc, int width, int height) { nativeUpdate(mNativeObject, sc.mNativeObject, width, height); /** * Updates {@link SurfaceControl}, size, and format for a particular BLASTBufferQueue * @param sc The new SurfaceControl that this BLASTBufferQueue will update * @param width The new width for the buffer. * @param height The new height for the buffer. * @param format The new format for the buffer. */ public void update(SurfaceControl sc, int width, int height, @PixelFormat.Format int format) { nativeUpdate(mNativeObject, sc.mNativeObject, width, height, format); } /** Loading
services/core/java/com/android/server/wm/WindowManagerService.java +1 −1 Original line number Diff line number Diff line Loading @@ -2339,7 +2339,7 @@ public class WindowManagerService extends IWindowManager.Stub if (shouldRelayout) { Trace.traceBegin(TRACE_TAG_WINDOW_MANAGER, "relayoutWindow: viewVisibility_1"); result = win.relayoutVisibleWindow(result, attrChanges); result = win.relayoutVisibleWindow(result); try { result = createSurfaceControl(outSurfaceControl, result, win, winAnimator); Loading