Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 947fee29 authored by Vishnu Nair's avatar Vishnu Nair
Browse files

Remove legacy disable triple buffering config

The config changes the dequeue limit of BQ (setMaxDequeuedBufferCount) from 2 to 1,  decreasing the default size of the queue from (3 to 2).
Some of the motivations behind this change include:
- not applicable in most scenarios since producers in the system override this
- breaks async mode, not well tested in other scenarios
- simplifying some of the implementation and removes a configuration/flag.

Clients can still manually call setMaxDequeuedBufferCount if they wish.

Test: presubmit
Fixes: 182314340
Change-Id: I724218d14ad106a4b7af69f7eacf97fae3c93923
parent 0b3f22b2
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1296,7 +1296,7 @@ public class SurfaceView extends View implements ViewRootImpl.SurfaceChangedCall
            mBlastBufferQueue.destroy();
        }
        mBlastBufferQueue = new BLASTBufferQueue(name, mBlastSurfaceControl, mSurfaceWidth,
                mSurfaceHeight, mFormat, true /* TODO */);
                mSurfaceHeight, mFormat);
    }

    private void onDrawFinished() {
+1 −5
Original line number Diff line number Diff line
@@ -330,7 +330,6 @@ public final class ViewRootImpl implements ViewParent,

    private boolean mUseBLASTAdapter;
    private boolean mForceDisableBLAST;
    private boolean mEnableTripleBuffering;

    private boolean mFastScrollSoundEffectsEnabled;

@@ -1178,9 +1177,6 @@ public final class ViewRootImpl implements ViewParent,
                if ((res & WindowManagerGlobal.ADD_FLAG_USE_BLAST) != 0) {
                    mUseBLASTAdapter = true;
                }
                if ((res & WindowManagerGlobal.ADD_FLAG_USE_TRIPLE_BUFFERING) != 0) {
                    mEnableTripleBuffering = true;
                }

                if (view instanceof RootViewSurfaceTaker) {
                    mInputQueueCallback =
@@ -1906,7 +1902,7 @@ public final class ViewRootImpl implements ViewParent,
        Surface ret = null;
        if (mBlastBufferQueue == null) {
            mBlastBufferQueue = new BLASTBufferQueue(mTag, mSurfaceControl, width, height,
                    format, mEnableTripleBuffering);
                    format);
            // We only return the Surface the first time, as otherwise
            // it hasn't changed and there is no need to update.
            ret = mBlastBufferQueue.createSurface();
+0 −1
Original line number Diff line number Diff line
@@ -118,7 +118,6 @@ public final class WindowManagerGlobal {

    public static final int ADD_FLAG_IN_TOUCH_MODE = 0x1;
    public static final int ADD_FLAG_APP_VISIBLE = 0x2;
    public static final int ADD_FLAG_USE_TRIPLE_BUFFERING = 0x4;
    public static final int ADD_FLAG_USE_BLAST = 0x8;

    /**
+3 −3
Original line number Diff line number Diff line
@@ -68,7 +68,7 @@ private:
};

static jlong nativeCreate(JNIEnv* env, jclass clazz, jstring jName, jlong surfaceControl,
                          jlong width, jlong height, jint format, jboolean enableTripleBuffering) {
                          jlong width, jlong height, jint format) {
    String8 str8;
    if (jName) {
        const jchar* str16 = env->GetStringCritical(jName, nullptr);
@@ -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, format, enableTripleBuffering);
                                 height, format);
    queue->incStrong((void*)nativeCreate);
    return reinterpret_cast<jlong>(queue.get());
}
@@ -140,7 +140,7 @@ static void nativeSetTransactionCompleteCallback(JNIEnv* env, jclass clazz, jlon
static const JNINativeMethod gMethods[] = {
        /* name, signature, funcPtr */
        // clang-format off
        {"nativeCreate", "(Ljava/lang/String;JJJIZ)J", (void*)nativeCreate},
        {"nativeCreate", "(Ljava/lang/String;JJJI)J", (void*)nativeCreate},
        {"nativeGetSurface", "(JZ)Landroid/view/Surface;", (void*)nativeGetSurface},
        {"nativeDestroy", "(J)V", (void*)nativeDestroy},
        {"nativeSetNextTransaction", "(JJ)V", (void*)nativeSetNextTransaction},
+3 −4
Original line number Diff line number Diff line
@@ -28,7 +28,7 @@ public final class BLASTBufferQueue {
    public long mNativeObject; // BLASTBufferQueue*

    private static native long nativeCreate(String name, long surfaceControl, long width,
            long height, int format, boolean tripleBufferingEnabled);
            long height, int format);
    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);
@@ -53,9 +53,8 @@ public final class BLASTBufferQueue {

    /** Create a new connection with the surface flinger. */
    public BLASTBufferQueue(String name, SurfaceControl sc, int width, int height,
            @PixelFormat.Format int format, boolean tripleBufferingEnabled) {
        mNativeObject = nativeCreate(name, sc.mNativeObject, width, height, format,
                tripleBufferingEnabled);
            @PixelFormat.Format int format) {
        mNativeObject = nativeCreate(name, sc.mNativeObject, width, height, format);
    }

    public void destroy() {
Loading