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

Commit 4b5fbdb1 authored by Dan Stoza's avatar Dan Stoza
Browse files

libgui: Make IGraphicBufferConsumer a SafeInterface

Converts IGraphicBufferConsumer to be a SafeInterface such that all
parceling/unparceling is done automatically.

Test: libgui_tests + manual testing
Change-Id: Ica5f5f5c3e6b5735f0f1327a50cefe8f3f6f0feb
parent 1af8a880
Loading
Loading
Loading
Loading
+16 −1
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@
#include <gui/OccupancyTracker.h>

#include <binder/IInterface.h>
#include <binder/SafeInterface.h>

#include <EGL/egl.h>
#include <EGL/eglext.h>
@@ -132,6 +133,17 @@ public:
    virtual status_t releaseBuffer(int buf, uint64_t frameNumber, EGLDisplay display,
                                   EGLSyncKHR fence, const sp<Fence>& releaseFence) = 0;

    status_t releaseHelper(int buf, uint64_t frameNumber, const sp<Fence>& releaseFence) {
        return releaseBuffer(buf, frameNumber, EGL_NO_DISPLAY, EGL_NO_SYNC_KHR, releaseFence);
    }
    // This is explicitly *not* the actual signature of IGBC::releaseBuffer, but:
    //     1) We have no easy way to send the EGL objects across Binder
    //     2) This has always been broken, probably because
    //     3) IGBC is rarely remoted
    // For now, we will choose to bury our heads in the sand and ignore this problem until such time
    // as we can finally finish converting away from EGL sync to native Android sync
    using ReleaseBuffer = decltype(&IGraphicBufferConsumer::releaseHelper);

    // consumerConnect connects a consumer to the BufferQueue. Only one consumer may be connected,
    // and when that consumer disconnects the BufferQueue is placed into the "abandoned" state,
    // causing most interactions with the BufferQueue by the producer to fail. controlledByApp
@@ -262,8 +274,11 @@ public:
    }
};

class BnGraphicBufferConsumer : public BnInterface<IGraphicBufferConsumer> {
class BnGraphicBufferConsumer : public SafeBnInterface<IGraphicBufferConsumer> {
public:
    BnGraphicBufferConsumer()
          : SafeBnInterface<IGraphicBufferConsumer>("BnGraphicBufferConsumer") {}

    status_t onTransact(uint32_t code, const Parcel& data, Parcel* reply,
                        uint32_t flags = 0) override;
};
+118 −377

File changed.

Preview size limit exceeded, changes collapsed.