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

Commit 674b937d authored by Kriti Dang's avatar Kriti Dang
Browse files

HDR ouput control native implementation

Bug: 251168514
Test: atest libsurfaceflinger_unittest
Test: atest libgui_test
Change-Id: I76637cd235101e60319ead3bd73a5f826927e3ee
parent e893d3d9
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -2496,6 +2496,20 @@ status_t SurfaceComposerClient::clearBootDisplayMode(const sp<IBinder>& display)
    return statusTFromBinderStatus(status);
}

status_t SurfaceComposerClient::getHdrConversionCapabilities(
        std::vector<gui::HdrConversionCapability>* hdrConversionCapabilities) {
    binder::Status status = ComposerServiceAIDL::getComposerService()->getHdrConversionCapabilities(
            hdrConversionCapabilities);
    return statusTFromBinderStatus(status);
}

status_t SurfaceComposerClient::setHdrConversionStrategy(
        gui::HdrConversionStrategy hdrConversionStrategy) {
    binder::Status status = ComposerServiceAIDL::getComposerService()->setHdrConversionStrategy(
            hdrConversionStrategy);
    return statusTFromBinderStatus(status);
}

status_t SurfaceComposerClient::setOverrideFrameRate(uid_t uid, float frameRate) {
    binder::Status status =
            ComposerServiceAIDL::getComposerService()->setOverrideFrameRate(uid, frameRate);
+25 −0
Original line number Diff line number Diff line
/*
 * Copyright 2022 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package android.gui;

// TODO(b/265277221): use android.hardware.graphics.common.HdrConversionCapability.aidl
/** @hide */
parcelable HdrConversionCapability {
    int sourceType;
    int outputType;
    boolean addsLatency;
}
 No newline at end of file
+25 −0
Original line number Diff line number Diff line
/*
 * Copyright 2022 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package android.gui;

// TODO(b/265277221): use android.hardware.graphics.common.HdrConversionStrategy.aidl
/** @hide */
union HdrConversionStrategy {
    boolean passthrough = true;
    int[] autoAllowedHdrTypes;
    int forceHdrConversion;
}
+22 −0
Original line number Diff line number Diff line
@@ -30,6 +30,8 @@ import android.gui.DisplayStatInfo;
import android.gui.DynamicDisplayInfo;
import android.gui.FrameEvent;
import android.gui.FrameStats;
import android.gui.HdrConversionCapability;
import android.gui.HdrConversionStrategy;
import android.gui.IDisplayEventConnection;
import android.gui.IFpsListener;
import android.gui.IHdrLayerInfoListener;
@@ -161,6 +163,26 @@ interface ISurfaceComposer {
    // TODO(b/213909104) : Add unit tests to verify surface flinger boot time APIs
    boolean getBootDisplayModeSupport();

    /**
     * Gets the HDR conversion capabilities of the device. The conversion capability defines whether
     * conversion from sourceType to outputType is possible (with or without latency).
     *
     * Requires the ACCESS_SURFACE_FLINGER permission.
     */
     List<HdrConversionCapability> getHdrConversionCapabilities();

     /**
      * Sets the HDR conversion strategy of the device.
      *
      * Requires the ACCESS_SURFACE_FLINGER permission.
      */
     void setHdrConversionStrategy(in HdrConversionStrategy hdrConversionStrategy);

     /**
      * Gets whether HDR output conversion operations are supported on the device.
      */
     boolean getHdrOutputConversionSupport();

    /**
     * Switches Auto Low Latency Mode on/off on the connected display, if it is
     * available. This should only be called if the display supports Auto Low
+5 −0
Original line number Diff line number Diff line
@@ -91,6 +91,11 @@ public:
    MOCK_METHOD(binder::Status, setBootDisplayMode, (const sp<IBinder>&, int), (override));
    MOCK_METHOD(binder::Status, clearBootDisplayMode, (const sp<IBinder>&), (override));
    MOCK_METHOD(binder::Status, getBootDisplayModeSupport, (bool*), (override));
    MOCK_METHOD(binder::Status, getHdrConversionCapabilities,
                (std::vector<gui::HdrConversionCapability>*), (override));
    MOCK_METHOD(binder::Status, setHdrConversionStrategy, (const gui::HdrConversionStrategy&),
                (override));
    MOCK_METHOD(binder::Status, getHdrOutputConversionSupport, (bool*), (override));
    MOCK_METHOD(binder::Status, setAutoLowLatencyMode, (const sp<IBinder>&, bool), (override));
    MOCK_METHOD(binder::Status, setGameContentType, (const sp<IBinder>&, bool), (override));
    MOCK_METHOD(binder::Status, captureDisplay,
Loading