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

Commit 5d500492 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge changes Ife4b9b7c,Id05ac58a

* changes:
  blast: Add composer overlay flag to AHardwareBuffer
  blast: create SurfaceControl from Surface parent
parents 717e1ad9 e14cb784
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -31,6 +31,7 @@ namespace { // Anonymous

enum class Tag : uint32_t {
    CREATE_SURFACE = IBinder::FIRST_CALL_TRANSACTION,
    CREATE_WITH_SURFACE_PARENT,
    DESTROY_SURFACE,
    CLEAR_LAYER_FRAME_STATS,
    GET_LAYER_FRAME_STATS,
@@ -57,6 +58,18 @@ public:
                                                                            handle, gbp);
    }

    status_t createWithSurfaceParent(const String8& name, uint32_t width, uint32_t height,
                                     PixelFormat format, uint32_t flags,
                                     const sp<IGraphicBufferProducer>& parent, int32_t windowType,
                                     int32_t ownerUid, sp<IBinder>* handle,
                                     sp<IGraphicBufferProducer>* gbp) override {
        return callRemote<decltype(
                &ISurfaceComposerClient::createWithSurfaceParent)>(Tag::CREATE_WITH_SURFACE_PARENT,
                                                                   name, width, height, format,
                                                                   flags, parent, windowType,
                                                                   ownerUid, handle, gbp);
    }

    status_t destroySurface(const sp<IBinder>& handle) override {
        return callRemote<decltype(&ISurfaceComposerClient::destroySurface)>(Tag::DESTROY_SURFACE,
                                                                             handle);
@@ -92,6 +105,8 @@ status_t BnSurfaceComposerClient::onTransact(uint32_t code, const Parcel& data,
    switch (tag) {
        case Tag::CREATE_SURFACE:
            return callLocal(data, reply, &ISurfaceComposerClient::createSurface);
        case Tag::CREATE_WITH_SURFACE_PARENT:
            return callLocal(data, reply, &ISurfaceComposerClient::createWithSurfaceParent);
        case Tag::DESTROY_SURFACE:
            return callLocal(data, reply, &ISurfaceComposerClient::destroySurface);
        case Tag::CLEAR_LAYER_FRAME_STATS:
+24 −0
Original line number Diff line number Diff line
@@ -972,6 +972,29 @@ sp<SurfaceControl> SurfaceComposerClient::createSurface(
    return s;
}

sp<SurfaceControl> SurfaceComposerClient::createWithSurfaceParent(const String8& name, uint32_t w,
                                                                  uint32_t h, PixelFormat format,
                                                                  uint32_t flags, Surface* parent,
                                                                  int32_t windowType,
                                                                  int32_t ownerUid) {
    sp<SurfaceControl> sur;
    status_t err = mStatus;

    if (mStatus == NO_ERROR) {
        sp<IBinder> handle;
        sp<IGraphicBufferProducer> parentGbp = parent->getIGraphicBufferProducer();
        sp<IGraphicBufferProducer> gbp;

        err = mClient->createWithSurfaceParent(name, w, h, format, flags, parentGbp, windowType,
                                               ownerUid, &handle, &gbp);
        ALOGE_IF(err, "SurfaceComposerClient::createWithSurfaceParent error %s", strerror(-err));
        if (err == NO_ERROR) {
            return new SurfaceControl(this, handle, gbp, true /* owned */);
        }
    }
    return nullptr;
}

status_t SurfaceComposerClient::createSurfaceChecked(
        const String8& name,
        uint32_t w,
@@ -1134,6 +1157,7 @@ status_t SurfaceComposerClient::getDisplayedContentSample(const sp<IBinder>& dis
    return ComposerService::getComposerService()->getDisplayedContentSample(display, maxFrames,
                                                                            timestamp, outStats);
}

// ----------------------------------------------------------------------------

status_t ScreenshotClient::capture(const sp<IBinder>& display, const ui::Dataspace reqDataSpace,
+10 −0
Original line number Diff line number Diff line
@@ -55,6 +55,16 @@ public:
                                   int32_t ownerUid, sp<IBinder>* handle,
                                   sp<IGraphicBufferProducer>* gbp) = 0;

    /*
     * Requires ACCESS_SURFACE_FLINGER permission
     */
    virtual status_t createWithSurfaceParent(const String8& name, uint32_t w, uint32_t h,
                                             PixelFormat format, uint32_t flags,
                                             const sp<IGraphicBufferProducer>& parent,
                                             int32_t windowType, int32_t ownerUid,
                                             sp<IBinder>* handle,
                                             sp<IGraphicBufferProducer>* gbp) = 0;

    /*
     * Requires ACCESS_SURFACE_FLINGER permission
     */
+18 −6
Original line number Diff line number Diff line
@@ -172,6 +172,18 @@ public:
            int32_t ownerUid = -1    // UID of the task
    );

    //! Create a surface
    sp<SurfaceControl> createWithSurfaceParent(
            const String8& name,       // name of the surface
            uint32_t w,                // width in pixel
            uint32_t h,                // height in pixel
            PixelFormat format,        // pixel-format desired
            uint32_t flags = 0,        // usage flags
            Surface* parent = nullptr, // parent
            int32_t windowType = -1,   // from WindowManager.java (STATUS_BAR, INPUT_METHOD, etc.)
            int32_t ownerUid = -1      // UID of the task
    );

    //! Create a virtual display
    static sp<IBinder> createDisplay(const String8& displayName, bool secure);

+11 −0
Original line number Diff line number Diff line
@@ -207,6 +207,17 @@ enum AHardwareBuffer_UsageFlags {
     * AHARDWAREBUFFER_USAGE_GPU_FRAMEBUFFER to avoid this confusion.
     */
    AHARDWAREBUFFER_USAGE_GPU_COLOR_OUTPUT       = AHARDWAREBUFFER_USAGE_GPU_FRAMEBUFFER,
    /**
     * The buffer will be used as a composer HAL overlay layer.
     *
     * This flag is currently only needed when using ASurfaceTransaction_setBuffer
     * to set a buffer. In all other cases, the framework adds this flag
     * internally to buffers that could be presented in a composer overlay.
     * ASurfaceTransaction_setBuffer is special because it uses buffers allocated
     * directly through AHardwareBuffer_allocate instead of buffers allocated
     * by the framework.
     */
    AHARDWAREBUFFER_USAGE_COMPOSER_OVERLAY       = 1ULL << 11,
    /**
     * The buffer is protected from direct CPU access or being read by
     * non-secure hardware, such as video encoders.
Loading