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

Commit b10800c4 authored by Ramkumar Radhakrishnan's avatar Ramkumar Radhakrishnan Committed by Steve Kondik
Browse files

sf: vds: Allocate display ID for displays composed/copied by HWC

We make VDS responsible for deciding if a display will be composed
by HWC. This is primarily based on the usage flags on the sink
buffer, as well as on the requested display resolution.

With this approach, there are two possible scenarios in which we
make a decision that applies while the display is connected:

1. The display will be composed by HWC, and we use WB to produce
   the final output.
2. The display will be composed by GLES/GPU and HWC has no knowledge
   of this display.

For case 1) we will have a valid display ID and for case 2) we will
have NO_MEMORY as the display ID.

Change-Id: I92b1e8b5973fea1a894caa7588dd95a1e551dd8e
parent a8dd5ccf
Loading
Loading
Loading
Loading
+11 −2
Original line number Diff line number Diff line
@@ -48,14 +48,15 @@ static const char* dbgCompositionTypeStr(DisplaySurface::CompositionType type) {
    }
}

VirtualDisplaySurface::VirtualDisplaySurface(HWComposer& hwc, int32_t dispId,
VirtualDisplaySurface::VirtualDisplaySurface(HWComposer& hwc,
        int32_t &hwcDisplayId,
        const sp<IGraphicBufferProducer>& sink,
        const sp<IGraphicBufferProducer>& bqProducer,
        const sp<IGraphicBufferConsumer>& bqConsumer,
        const String8& name)
:   ConsumerBase(bqConsumer),
    mHwc(hwc),
    mDisplayId(dispId),
    mDisplayId(NO_MEMORY),
    mDisplayName(name),
    mOutputUsage(GRALLOC_USAGE_HW_COMPOSER),
    mProducerSlotSource(0),
@@ -100,6 +101,14 @@ VirtualDisplaySurface::VirtualDisplaySurface(HWComposer& hwc, int32_t dispId,
        !strncasecmp(value, "true", strlen("true")))) {
        mForceHwcCopy = true;
    }

    // Once the mForceHwcCopy flag is set, we can freely allocate an HWC
    // display ID.
    if (mForceHwcCopy &&  mHwc.isVDSEnabled())
        mDisplayId =  mHwc.allocateDisplayId();

    hwcDisplayId = mDisplayId; //update display id for device creation in SF

    mOutputFormat = mDefaultOutputFormat;
    // TODO: need to add the below logs as part of dumpsys output
    VDS_LOGV("creation: sinkFormat: 0x%x sinkUsage: 0x%x mForceHwcCopy: %d",
+7 −2
Original line number Diff line number Diff line
@@ -72,7 +72,7 @@ class VirtualDisplaySurface : public DisplaySurface,
                              public BnGraphicBufferProducer,
                              private ConsumerBase {
public:
    VirtualDisplaySurface(HWComposer& hwc, int32_t dispId,
    VirtualDisplaySurface(HWComposer& hwc, int32_t &hwcDisplayId,
            const sp<IGraphicBufferProducer>& sink,
            const sp<IGraphicBufferProducer>& bqProducer,
            const sp<IGraphicBufferConsumer>& bqConsumer,
@@ -139,7 +139,6 @@ private:
    // Immutable after construction
    //
    HWComposer& mHwc;
    const int32_t mDisplayId;
    const String8 mDisplayName;
    sp<IGraphicBufferProducer> mSource[2]; // indexed by SOURCE_*
    uint32_t mDefaultOutputFormat;
@@ -148,6 +147,12 @@ private:
    // through HWC.
    bool mForceHwcCopy;

    // The display ID is now determined when VDS is initialized. This
    // is done because VDS has all the requisite information to make
    // a call on whether the display is to be composed/copied by HWC
    // or not.
    int32_t mDisplayId;

    //
    // Inter-frame state
    //