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

Commit acaa1f8c authored by Carlos Martinez Romero's avatar Carlos Martinez Romero
Browse files

Clean up multiple warren_buffer flags.

wb_platform_api_improvements
wb_consumer_base_owns_bq
wb_camera3_and_processors

BYPASS_IGBP_IGBC_API_REASON=Used in a comment.

Bug: 342199002
Test: Build and run
Flag: EXEMPT flag cleanup
Change-Id: I109788d58b98147a6c88487d9e70cc0cf0948638
parent 1404bfc7
Loading
Loading
Loading
Loading
+0 −26
Original line number Diff line number Diff line
@@ -259,7 +259,6 @@ static void SurfaceTexture_classInit(JNIEnv* env, jclass clazz)

static void SurfaceTexture_init(JNIEnv* env, jobject thiz, jboolean isDetached, jint texName,
                                jboolean singleBufferMode, jobject weakThiz) {
#if COM_ANDROID_GRAPHICS_LIBGUI_FLAGS(WB_CONSUMER_BASE_OWNS_BQ)
    sp<SurfaceTexture> surfaceTexture;
    if (isDetached) {
        surfaceTexture = new SurfaceTexture(GL_TEXTURE_EXTERNAL_OES, true, !singleBufferMode);
@@ -271,24 +270,6 @@ static void SurfaceTexture_init(JNIEnv* env, jobject thiz, jboolean isDetached,
    if (singleBufferMode) {
        surfaceTexture->setMaxBufferCount(1);
    }
#else
    sp<IGraphicBufferProducer> producer;
    sp<IGraphicBufferConsumer> consumer;
    BufferQueue::createBufferQueue(&producer, &consumer);

    if (singleBufferMode) {
        consumer->setMaxBufferCount(1);
    }

    sp<SurfaceTexture> surfaceTexture;
    if (isDetached) {
        surfaceTexture = new SurfaceTexture(consumer, GL_TEXTURE_EXTERNAL_OES,
                true, !singleBufferMode);
    } else {
        surfaceTexture = new SurfaceTexture(consumer, texName,
                GL_TEXTURE_EXTERNAL_OES, true, !singleBufferMode);
    }
#endif // COM_ANDROID_GRAPHICS_LIBGUI_FLAGS(WB_CONSUMER_BASE_OWNS_BQ)

    if (surfaceTexture == 0) {
        jniThrowException(env, OutOfResourcesException,
@@ -301,7 +282,6 @@ static void SurfaceTexture_init(JNIEnv* env, jobject thiz, jboolean isDetached,
            createProcessUniqueId()));

    // If the current context is protected, inform the producer.
#if COM_ANDROID_GRAPHICS_LIBGUI_FLAGS(WB_CONSUMER_BASE_OWNS_BQ)
    surfaceTexture->setConsumerIsProtected(isProtectedContext());

    SurfaceTexture_setSurfaceTexture(env, thiz, surfaceTexture);
@@ -316,12 +296,6 @@ static void SurfaceTexture_init(JNIEnv* env, jobject thiz, jboolean isDetached,
        return;
    }
    SurfaceTexture_setProducer(env, thiz, igbp);
#else
    consumer->setConsumerIsProtected(isProtectedContext());

    SurfaceTexture_setSurfaceTexture(env, thiz, surfaceTexture);
    SurfaceTexture_setProducer(env, thiz, producer);
#endif // COM_ANDROID_GRAPHICS_LIBGUI_FLAGS(WB_CONSUMER_BASE_OWNS_BQ)
    jclass clazz = env->GetObjectClass(thiz);
    if (clazz == NULL) {
        jniThrowRuntimeException(env,
+2 −17
Original line number Diff line number Diff line
@@ -33,33 +33,22 @@ public:
    static std::tuple<sp<BufferItemConsumer>, sp<Surface>> create(
            uint64_t consumerUsage, int bufferCount = DEFAULT_MAX_BUFFERS,
            bool controlledByApp = false, bool isConsumerSurfaceFlinger = false) {
#if COM_ANDROID_GRAPHICS_LIBGUI_FLAGS(WB_CONSUMER_BASE_OWNS_BQ)
        sp<BufferItemConsumer> bufferItemConsumer =
                sp<BufferItemConsumer>::make(consumerUsage, bufferCount, controlledByApp,
                                             isConsumerSurfaceFlinger);
        return {bufferItemConsumer, bufferItemConsumer->getSurface()};
#else
        sp<IGraphicBufferProducer> igbp;
        sp<IGraphicBufferConsumer> igbc;
        BufferQueue::createBufferQueue(&igbp, &igbc, isConsumerSurfaceFlinger);
        sp<BufferItemConsumer> bufferItemConsumer =
                sp<BufferItemConsumer>::make(igbc, consumerUsage, bufferCount, controlledByApp);
        return {bufferItemConsumer, sp<Surface>::make(igbp, controlledByApp)};
#endif
    }

    BufferItemConsumer(const sp<IGraphicBufferConsumer>& consumer, uint64_t consumerUsage,
                       int bufferCount = -1, bool controlledByApp = false)
          : mConsumer(consumer) {}

#if COM_ANDROID_GRAPHICS_LIBGUI_FLAGS(WB_CONSUMER_BASE_OWNS_BQ)
    BufferItemConsumer(uint64_t consumerUsage, int bufferCount = -1,
                       bool controlledByApp = false, bool isConsumerSurfaceFlinger = false) {
        sp<IGraphicBufferProducer> producer;
        BufferQueue::createBufferQueue(&producer, &mConsumer);
        mSurface = sp<Surface>::make(producer, controlledByApp);
    }
#endif // COM_ANDROID_GRAPHICS_LIBGUI_FLAGS(WB_CONSUMER_BASE_OWNS_BQ)

    status_t setConsumerIsProtected(bool isProtected) {
        return OK;
@@ -111,20 +100,16 @@ public:
        return OK;
    }

#if COM_ANDROID_GRAPHICS_LIBGUI_FLAGS(WB_CONSUMER_BASE_OWNS_BQ)
    // Returns a Surface that can be used as the producer for this consumer.
    sp<Surface> getSurface() const {
        return mSurface;
    }
#endif // COM_ANDROID_GRAPHICS_LIBGUI_FLAGS(WB_CONSUMER_BASE_OWNS_BQ)

private:
    sp<IGraphicBufferConsumer> mConsumer;
#if COM_ANDROID_GRAPHICS_LIBGUI_FLAGS(WB_CONSUMER_BASE_OWNS_BQ)
    // This Surface wraps the IGraphicBufferConsumer created for this
    // ConsumerBase.
    sp<Surface> mSurface;
#endif // COM_ANDROID_GRAPHICS_LIBGUI_FLAGS(WB_CONSUMER_BASE_OWNS_BQ)
};

} // namespace android