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

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

Merge changes Iec262e51,Ia1143903,I753deb9a,Icef8ee6c,I96266db8, ...

* changes:
  Use wide color modes with external displays
  Allow a primary display disconnect
  Determine displayType in SurfaceFlinger
  Eliminate duplicate device creation code
  Move hotplug processing to the main thread
  Create processDisplayChangesLocked
parents 74fade77 c520831f
Loading
Loading
Loading
Loading
+0 −14
Original line number Diff line number Diff line
@@ -127,20 +127,6 @@ DisplayDevice::DisplayDevice(
    mPowerMode = (mType >= DisplayDevice::DISPLAY_VIRTUAL) ?
                  HWC_POWER_MODE_NORMAL : HWC_POWER_MODE_OFF;

    // Name the display.  The name will be replaced shortly if the display
    // was created with createDisplay().
    switch (mType) {
        case DISPLAY_PRIMARY:
            mDisplayName = "Built-in Screen";
            break;
        case DISPLAY_EXTERNAL:
            mDisplayName = "HDMI Screen";
            break;
        default:
            mDisplayName = "Virtual Screen";    // e.g. Overlay #n
            break;
    }

    // initialize the display orientation transform.
    setProjection(DisplayState::eOrientationDefault, mViewport, mFrame);

+4 −0
Original line number Diff line number Diff line
@@ -76,6 +76,10 @@ FramebufferSurface::FramebufferSurface(HWComposer& hwc, int disp,
            SurfaceFlinger::maxFrameBufferAcquiredBuffers - 1);
}

void FramebufferSurface::resizeBuffers(const uint32_t width, const uint32_t height) {
    mConsumer->setDefaultBufferSize(width, height);
}

status_t FramebufferSurface::beginFrame(bool /*mustRecompose*/) {
    return NO_ERROR;
}
+1 −3
Original line number Diff line number Diff line
@@ -46,9 +46,7 @@ public:
    virtual void onFrameCommitted();
    virtual void dumpAsString(String8& result) const;

    // Cannot resize a buffers in a FramebufferSurface. Only works with virtual
    // displays.
    virtual void resizeBuffers(const uint32_t /*w*/, const uint32_t /*h*/) { };
    virtual void resizeBuffers(const uint32_t width, const uint32_t height);

    virtual const sp<Fence>& getClientTargetAcquireFence() const override;

+2 −18
Original line number Diff line number Diff line
@@ -52,24 +52,13 @@ namespace {
class ComposerCallbackBridge : public Hwc2::IComposerCallback {
public:
    ComposerCallbackBridge(ComposerCallback* callback, int32_t sequenceId)
            : mCallback(callback), mSequenceId(sequenceId),
              mHasPrimaryDisplay(false) {}
            : mCallback(callback), mSequenceId(sequenceId) {}

    Return<void> onHotplug(Hwc2::Display display,
                           IComposerCallback::Connection conn) override
    {
        HWC2::Connection connection = static_cast<HWC2::Connection>(conn);
        if (!mHasPrimaryDisplay) {
            LOG_ALWAYS_FATAL_IF(connection != HWC2::Connection::Connected,
                    "Initial onHotplug callback should be "
                    "primary display connected");
            mHasPrimaryDisplay = true;
            mCallback->onHotplugReceived(mSequenceId, display,
                                         connection, true);
        } else {
            mCallback->onHotplugReceived(mSequenceId, display,
                                         connection, false);
        }
        mCallback->onHotplugReceived(mSequenceId, display, connection);
        return Void();
    }

@@ -85,12 +74,9 @@ public:
        return Void();
    }

    bool HasPrimaryDisplay() { return mHasPrimaryDisplay; }

private:
    ComposerCallback* mCallback;
    int32_t mSequenceId;
    bool mHasPrimaryDisplay;
};

} // namespace anonymous
@@ -117,8 +103,6 @@ void Device::registerCallback(ComposerCallback* callback, int32_t sequenceId) {
    sp<ComposerCallbackBridge> callbackBridge(
            new ComposerCallbackBridge(callback, sequenceId));
    mComposer->registerCallback(callbackBridge);
    LOG_ALWAYS_FATAL_IF(!callbackBridge->HasPrimaryDisplay(),
            "Registered composer callback but didn't get primary display");
}

// Required by HWC2 device
+1 −2
Original line number Diff line number Diff line
@@ -65,8 +65,7 @@ class Layer;
class ComposerCallback {
 public:
    virtual void onHotplugReceived(int32_t sequenceId, hwc2_display_t display,
                                   Connection connection,
                                   bool primaryDisplay) = 0;
                                   Connection connection) = 0;
    virtual void onRefreshReceived(int32_t sequenceId,
                                   hwc2_display_t display) = 0;
    virtual void onVsyncReceived(int32_t sequenceId, hwc2_display_t display,
Loading