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

Commit 281e8113 authored by Courtney Goeltzenleuchter's avatar Courtney Goeltzenleuchter
Browse files

Communicate composition buffer dataspace to HWC

Test: adb shell dumpsys SurfaceFlinger
      look for dataspace info in DisplayDevice section
Bug: 63146977
Change-Id: If427171994fbc91faacf5bad9cc736ddfbd35ec3
(cherry picked from commit 79d27244)
parent 3329c085
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -442,6 +442,11 @@ void DisplayDevice::setActiveColorMode(android_color_mode_t mode) {
android_color_mode_t DisplayDevice::getActiveColorMode() const {
    return mActiveColorMode;
}

void DisplayDevice::setCompositionDataSpace(android_dataspace dataspace) {
    ANativeWindow* const window = mNativeWindow.get();
    native_window_set_buffers_data_space(window, dataspace);
}
#endif

// ----------------------------------------------------------------------------
+1 −0
Original line number Diff line number Diff line
@@ -189,6 +189,7 @@ public:
#ifdef USE_HWC2
    android_color_mode_t getActiveColorMode() const;
    void setActiveColorMode(android_color_mode_t mode);
    void setCompositionDataSpace(android_dataspace dataspace);
#endif

    /* ------------------------------------------------------------------------
+7 −7
Original line number Diff line number Diff line
@@ -106,12 +106,6 @@ status_t FramebufferSurface::advanceFrame() {
    if (result != NO_ERROR) {
        ALOGE("error latching next FramebufferSurface buffer: %s (%d)",
                strerror(-result), result);
        return result;
    }
    result = mHwc.setClientTarget(mDisplayType, slot,
            acquireFence, buf, dataspace);
    if (result != NO_ERROR) {
        ALOGE("error posting framebuffer: %d", result);
    }
    return result;
#else
@@ -182,7 +176,13 @@ status_t FramebufferSurface::nextBuffer(sp<GraphicBuffer>& outBuffer, sp<Fence>&
#else
    outBuffer = mCurrentBuffer;
#endif
    return NO_ERROR;
    status_t result =
            mHwc.setClientTarget(mDisplayType, outSlot, outFence, outBuffer, outDataspace);
    if (result != NO_ERROR) {
        ALOGE("error posting framebuffer: %d", result);
    }

    return result;
}

#ifndef USE_HWC2
+3 −0
Original line number Diff line number Diff line
@@ -383,6 +383,7 @@ void SurfaceFlinger::bootFinished()
#ifdef USE_HWC2
        sp<DisplayDevice> hw(getDisplayDevice(mBuiltinDisplays[DisplayDevice::DISPLAY_PRIMARY]));
        if (hw->getWideColorSupport()) {
            hw->setCompositionDataSpace(HAL_DATASPACE_V0_SRGB);
            setActiveColorModeInternal(hw, HAL_COLOR_MODE_SRGB);
        }
#endif
@@ -1222,6 +1223,7 @@ void SurfaceFlinger::createDefaultDisplayDevice() {
                                             hasWideColorModes && hasWideColorDisplay);
    mDisplays.add(token, hw);
    setActiveColorModeInternal(hw, HAL_COLOR_MODE_NATIVE);
    hw->setCompositionDataSpace(HAL_DATASPACE_UNKNOWN);
}

void SurfaceFlinger::onHotplugReceived(HWComposer* composer, int32_t disp, bool connected) {
@@ -1871,6 +1873,7 @@ void SurfaceFlinger::setUpHWComposer() {
            // To achieve this we suppress color mode changes until after the boot animation
            if (mBootFinished) {
                setActiveColorModeInternal(displayDevice, newColorMode);
                displayDevice->setCompositionDataSpace(newDataSpace);
            }
        }
    }