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

Commit 77c073bd authored by Rob Carr's avatar Rob Carr Committed by Android (Google) Code Review
Browse files

Merge changes from topic 'surfaceview-without-wm'

* changes:
  Add detachChildren transaction.
  Add deferTransaction variant taking GraphicBufferProducer.
parents 5ebcd56c 9524cb3b
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -155,8 +155,11 @@ public:
    status_t    setLayerStack(const sp<IBinder>& id, uint32_t layerStack);
    status_t    deferTransactionUntil(const sp<IBinder>& id,
            const sp<IBinder>& handle, uint64_t frameNumber);
    status_t    deferTransactionUntil(const sp<IBinder>& id,
            const sp<Surface>& handle, uint64_t frameNumber);
    status_t    reparentChildren(const sp<IBinder>& id,
            const sp<IBinder>& newParentHandle);
    status_t    detachChildren(const sp<IBinder>& id);
    status_t    setOverrideScalingMode(const sp<IBinder>& id,
            int32_t overrideScalingMode);
    status_t    setGeometryAppliesWithResize(const sp<IBinder>& id);
+21 −1
Original line number Diff line number Diff line
@@ -80,11 +80,31 @@ public:
    status_t    setGeometryAppliesWithResize();

    // Defers applying any changes made in this transaction until the Layer
    // identified by handle reaches the given frameNumber
    // identified by handle reaches the given frameNumber. If the Layer identified
    // by handle is removed, then we will apply this transaction regardless of
    // what frame number has been reached.
    status_t deferTransactionUntil(const sp<IBinder>& handle, uint64_t frameNumber);

    // A variant of deferTransactionUntil which identifies the Layer we wait for by
    // Surface instead of Handle. Useful for clients which may not have the
    // SurfaceControl for some of their Surfaces. Otherwise behaves identically.
    status_t deferTransactionUntil(const sp<Surface>& barrier, uint64_t frameNumber);

    // Reparents all children of this layer to the new parent handle.
    status_t reparentChildren(const sp<IBinder>& newParentHandle);

    // Detaches all child surfaces (and their children recursively)
    // from their SurfaceControl.
    // The child SurfaceControl's will not throw exceptions or return errors,
    // but transactions will have no effect.
    // The child surfaces will continue to follow their parent surfaces,
    // and remain eligible for rendering, but their relative state will be
    // frozen. We use this in the WindowManager, in app shutdown/relaunch
    // scenarios, where the app would otherwise clean up its child Surfaces.
    // Sometimes the WindowManager needs to extend their lifetime slightly
    // in order to perform an exit animation or prevent flicker.
    status_t detachChildren();

    // Set an override scaling mode as documented in <system/window.h>
    // the override scaling mode will take precedence over any client
    // specified scaling mode. -1 will clear the override scaling mode.
+6 −1
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@

#include <ui/Region.h>
#include <ui/Rect.h>
#include <gui/IGraphicBufferProducer.h>

namespace android {

@@ -57,6 +58,7 @@ struct layer_state_t {
        eOverrideScalingModeChanged = 0x00000800,
        eGeometryAppliesWithResize  = 0x00001000,
        eReparentChildren           = 0x00002000,
        eDetachChildren             = 0x00004000
    };

    layer_state_t()
@@ -95,10 +97,13 @@ struct layer_state_t {
            matrix22_t      matrix;
            Rect            crop;
            Rect            finalCrop;
            sp<IBinder>     handle;
            sp<IBinder>     barrierHandle;
            sp<IBinder>     reparentHandle;
            uint64_t        frameNumber;
            int32_t         overrideScalingMode;

            sp<IGraphicBufferProducer> barrierGbp;

            // non POD must be last. see write/read
            Region          transparentRegion;
};
+5 −2
Original line number Diff line number Diff line
@@ -39,10 +39,11 @@ status_t layer_state_t::write(Parcel& output) const
            output.writeInplace(sizeof(layer_state_t::matrix22_t))) = matrix;
    output.write(crop);
    output.write(finalCrop);
    output.writeStrongBinder(handle);
    output.writeStrongBinder(barrierHandle);
    output.writeStrongBinder(reparentHandle);
    output.writeUint64(frameNumber);
    output.writeInt32(overrideScalingMode);
    output.writeStrongBinder(IInterface::asBinder(barrierGbp));
    output.write(transparentRegion);
    return NO_ERROR;
}
@@ -68,10 +69,12 @@ status_t layer_state_t::read(const Parcel& input)
    }
    input.read(crop);
    input.read(finalCrop);
    handle = input.readStrongBinder();
    barrierHandle = input.readStrongBinder();
    reparentHandle = input.readStrongBinder();
    frameNumber = input.readUint64();
    overrideScalingMode = input.readInt32();
    barrierGbp =
        interface_cast<IGraphicBufferProducer>(input.readStrongBinder());
    input.read(transparentRegion);
    return NO_ERROR;
}
+42 −1
Original line number Diff line number Diff line
@@ -37,6 +37,7 @@
#include <gui/IGraphicBufferProducer.h>
#include <gui/ISurfaceComposer.h>
#include <gui/ISurfaceComposerClient.h>
#include <gui/Surface.h>
#include <gui/SurfaceComposerClient.h>

#include <private/gui/ComposerService.h>
@@ -167,9 +168,14 @@ public:
    status_t deferTransactionUntil(const sp<SurfaceComposerClient>& client,
            const sp<IBinder>& id, const sp<IBinder>& handle,
            uint64_t frameNumber);
    status_t deferTransactionUntil(const sp<SurfaceComposerClient>& client,
            const sp<IBinder>& id, const sp<Surface>& barrierSurface,
            uint64_t frameNumber);
    status_t reparentChildren(const sp<SurfaceComposerClient>& client,
            const sp<IBinder>& id,
            const sp<IBinder>& newParentHandle);
    status_t detachChildren(const sp<SurfaceComposerClient>& client,
            const sp<IBinder>& id);
    status_t setOverrideScalingMode(const sp<SurfaceComposerClient>& client,
            const sp<IBinder>& id, int32_t overrideScalingMode);
    status_t setGeometryAppliesWithResize(const sp<SurfaceComposerClient>& client,
@@ -438,7 +444,21 @@ status_t Composer::deferTransactionUntil(
        return BAD_INDEX;
    }
    s->what |= layer_state_t::eDeferTransaction;
    s->handle = handle;
    s->barrierHandle = handle;
    s->frameNumber = frameNumber;
    return NO_ERROR;
}

status_t Composer::deferTransactionUntil(
        const sp<SurfaceComposerClient>& client, const sp<IBinder>& id,
        const sp<Surface>& barrierSurface, uint64_t frameNumber) {
    Mutex::Autolock lock(mLock);
    layer_state_t* s = getLayerStateLocked(client, id);
    if (!s) {
        return BAD_INDEX;
    }
    s->what |= layer_state_t::eDeferTransaction;
    s->barrierGbp = barrierSurface->getIGraphicBufferProducer();
    s->frameNumber = frameNumber;
    return NO_ERROR;
}
@@ -457,6 +477,18 @@ status_t Composer::reparentChildren(
    return NO_ERROR;
}

status_t Composer::detachChildren(
        const sp<SurfaceComposerClient>& client,
        const sp<IBinder>& id) {
    Mutex::Autolock lock(mLock);
    layer_state_t* s = getLayerStateLocked(client, id);
    if (!s) {
        return BAD_INDEX;
    }
    s->what |= layer_state_t::eDetachChildren;
    return NO_ERROR;
}

status_t Composer::setOverrideScalingMode(
        const sp<SurfaceComposerClient>& client,
        const sp<IBinder>& id, int32_t overrideScalingMode) {
@@ -776,11 +808,20 @@ status_t SurfaceComposerClient::deferTransactionUntil(const sp<IBinder>& id,
    return getComposer().deferTransactionUntil(this, id, handle, frameNumber);
}

status_t SurfaceComposerClient::deferTransactionUntil(const sp<IBinder>& id,
        const sp<Surface>& barrierSurface, uint64_t frameNumber) {
    return getComposer().deferTransactionUntil(this, id, barrierSurface, frameNumber);
}

status_t SurfaceComposerClient::reparentChildren(const sp<IBinder>& id,
        const sp<IBinder>& newParentHandle) {
    return getComposer().reparentChildren(this, id, newParentHandle);
}

status_t SurfaceComposerClient::detachChildren(const sp<IBinder>& id) {
    return getComposer().detachChildren(this, id);
}

status_t SurfaceComposerClient::setOverrideScalingMode(
        const sp<IBinder>& id, int32_t overrideScalingMode) {
    return getComposer().setOverrideScalingMode(
Loading