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

Commit 511572b4 authored by Mathias Agopian's avatar Mathias Agopian Committed by Android Git Automerger
Browse files

am 9e2463e7: add/remove displays properly on hotplug events

* commit '9e2463e7':
  add/remove displays properly on hotplug events
parents 69954332 9e2463e7
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -167,6 +167,13 @@ void DisplayDevice::init(EGLConfig config)
    setProjection(DisplayState::eOrientationDefault, mViewport, mFrame);
}

void DisplayDevice::setDisplayName(const String8& displayName) {
    if (!displayName.isEmpty()) {
        // never override the name with an empty name
        mDisplayName = displayName;
    }
}

uint32_t DisplayDevice::getPageFlipCount() const {
    return mPageFlipCount;
}
+1 −3
Original line number Diff line number Diff line
@@ -119,9 +119,7 @@ public:
    }
    inline Rect bounds() const { return getBounds(); }

    void setDisplayName(const String8& displayName) {
        mDisplayName = displayName;
    }
    void setDisplayName(const String8& displayName);
    const String8& getDisplayName() const { return mDisplayName; }

    static EGLBoolean makeCurrent(EGLDisplay dpy,
+6 −1
Original line number Diff line number Diff line
@@ -337,7 +337,12 @@ status_t HWComposer::queryDisplayProperties(int disp) {
        return err;
    }

    mHwc->getDisplayAttributes(mHwc, disp, config, DISPLAY_ATTRIBUTES, values);
    err = mHwc->getDisplayAttributes(mHwc, disp, config, DISPLAY_ATTRIBUTES, values);
    if (err != NO_ERROR) {
        // we can't get this display's info. turn it off.
        mDisplayData[disp].connected = false;
        return err;
    }

    int32_t w = 0, h = 0;
    for (size_t i = 0; i < NUM_DISPLAY_ATTRIBUTES - 1; i++) {
+12 −2
Original line number Diff line number Diff line
@@ -408,10 +408,10 @@ status_t SurfaceFlinger::readyToRun()
        DisplayDevice::DisplayType type((DisplayDevice::DisplayType)i);
        mDefaultDisplays[i] = new BBinder();
        wp<IBinder> token = mDefaultDisplays[i];
        mCurrentState.displays.add(token, DisplayDeviceState(type));

        // set-up the displays that are already connected
        if (mHwc->isConnected(i)) {
        if (mHwc->isConnected(i) || type==DisplayDevice::DISPLAY_PRIMARY) {
            mCurrentState.displays.add(token, DisplayDeviceState(type));
            sp<FramebufferSurface> fbs = new FramebufferSurface(*mHwc, i);
            sp<SurfaceTextureClient> stc = new SurfaceTextureClient(
                        static_cast< sp<ISurfaceTexture> >(fbs->getBufferQueue()));
@@ -688,7 +688,17 @@ void SurfaceFlinger::onHotplugReceived(int type, bool connected) {
        ALOGW("WARNING: EventThread not started, ignoring hotplug");
        return;
    }

    if (uint32_t(type) < DisplayDevice::NUM_DISPLAY_TYPES) {
        Mutex::Autolock _l(mStateLock);
        if (connected == false) {
            mCurrentState.displays.removeItem(mDefaultDisplays[type]);
        } else {
            DisplayDeviceState info((DisplayDevice::DisplayType)type);
            mCurrentState.displays.add(mDefaultDisplays[type], info);
        }
        setTransactionFlags(eDisplayTransactionNeeded);

        // we should only receive DisplayDevice::DisplayType from the vsync callback
        mEventThread->onHotplugReceived(type, connected);
    }