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

Commit 7bd8adbb authored by Chia-I Wu's avatar Chia-I Wu
Browse files

libui: add notes to registerBuffer(buffer_handle_t)

The method is semi-broken on gralloc0 devices.  It calls down to
Gralloc1On0Adapter::managementHook, which will return
GRALLOC1_ERROR_BAD_HANDLE when the handle is received from a remote
process.

Test: make
Change-Id: Ia0ca2b51e38e8afe66a917ca7fe2282db3968f53
parent 64f1fbf9
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -39,7 +39,9 @@ class GraphicBufferMapper : public Singleton<GraphicBufferMapper>
public:
    static inline GraphicBufferMapper& get() { return getInstance(); }

    // This may NOT work on devices without a valid Gralloc2::Mapper.
    status_t registerBuffer(buffer_handle_t handle);

    status_t registerBuffer(const GraphicBuffer* buffer);

    status_t unregisterBuffer(buffer_handle_t handle);
+7 −0
Original line number Diff line number Diff line
@@ -63,7 +63,14 @@ status_t GraphicBufferMapper::registerBuffer(buffer_handle_t handle)
    if (mMapper->valid()) {
        error = static_cast<gralloc1_error_t>(mMapper->retain(handle));
    } else {
        // This always returns GRALLOC1_BAD_HANDLE when handle is from a
        // remote process and mDevice is backed by Gralloc1On0Adapter.
        error = mDevice->retain(handle);
        if (error == GRALLOC1_ERROR_BAD_HANDLE &&
                mDevice->hasCapability(GRALLOC1_CAPABILITY_ON_ADAPTER)) {
            ALOGE("registerBuffer by handle is not supported with "
                  "Gralloc1On0Adapter");
        }
    }

    ALOGW_IF(error != GRALLOC1_ERROR_NONE, "registerBuffer(%p) failed: %d",