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

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

Merge "surfaceflinger: support BT2020_ITU_PQ"

parents a2208d67 8d2651e4
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -822,7 +822,7 @@ void BufferLayer::drawWithOpenGL(const RenderArea& renderArea, bool useIdentityT
                              getColor());
    engine.setSourceDataSpace(mCurrentState.dataSpace);

    if (mCurrentState.dataSpace == HAL_DATASPACE_BT2020_PQ &&
    if (mCurrentState.dataSpace == HAL_DATASPACE_BT2020_ITU_PQ &&
        mConsumer->getCurrentApi() == NATIVE_WINDOW_API_MEDIA &&
        getBE().compositionInfo.mBuffer->getPixelFormat() == HAL_PIXEL_FORMAT_RGBA_1010102) {
        engine.setSourceY410BT2020(true);
+2 −1
Original line number Diff line number Diff line
@@ -326,11 +326,12 @@ void GLES20RenderEngine::drawMesh(const Mesh& mesh) {

    if (usesWideColor()) {
        Description wideColorState = mState;
        switch (mDataSpace) {
        switch (int(mDataSpace)) {
            case HAL_DATASPACE_DISPLAY_P3:
                // input matches output
                break;
            case HAL_DATASPACE_BT2020_PQ:
            case HAL_DATASPACE_BT2020_ITU_PQ:
                wideColorState.setColorMatrix(mState.getColorMatrix() * mBt2020ToDisplayP3);
                wideColorState.setInputTransferFunction(Description::TransferFunction::ST2084);
                wideColorState.setOutputTransferFunction(Description::TransferFunction::SRGB);
+9 −3
Original line number Diff line number Diff line
@@ -1816,9 +1816,14 @@ android_dataspace SurfaceFlinger::bestTargetDataSpace(
    if (a == HAL_DATASPACE_V0_SCRGB || b == HAL_DATASPACE_V0_SCRGB) {
        return HAL_DATASPACE_DISPLAY_P3;
    }
    if (!hasHdr && (a == HAL_DATASPACE_BT2020_PQ || b == HAL_DATASPACE_BT2020_PQ)) {
    if (!hasHdr) {
        if (a == HAL_DATASPACE_BT2020_PQ || b == HAL_DATASPACE_BT2020_PQ) {
            return HAL_DATASPACE_DISPLAY_P3;
        }
        if (a == HAL_DATASPACE_BT2020_ITU_PQ || b == HAL_DATASPACE_BT2020_ITU_PQ) {
            return HAL_DATASPACE_DISPLAY_P3;
        }
    }

    return HAL_DATASPACE_V0_SRGB;
}
@@ -1900,7 +1905,8 @@ void SurfaceFlinger::setUpHWComposer() {
                    "display %zd: %d", displayId, result);
        }
        for (auto& layer : displayDevice->getVisibleLayersSortedByZ()) {
            if (layer->getDataSpace() == HAL_DATASPACE_BT2020_PQ &&
            if ((layer->getDataSpace() == HAL_DATASPACE_BT2020_PQ ||
                 layer->getDataSpace() == HAL_DATASPACE_BT2020_ITU_PQ) &&
                    !displayDevice->getHdrSupport()) {
                layer->forceClientComposition(hwcId);
            }