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

Commit ceec8caa authored by Sasha McIntosh's avatar Sasha McIntosh
Browse files

Add output type to display mode

Pass output type up to display manager as part of the display mode.

Bug: 424150248
Test: Treehugger
Flag: com.android.graphics.surfaceflinger.flags.connected_display_hdr_v2
Change-Id: I60a30f05a1ce589fd3df20e7e3c2449f39c16e4c
parent 27d3859c
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -2739,6 +2739,7 @@ void SurfaceComposerClient::getDynamicDisplayInfoInternal(gui::DynamicDisplayInf
        outMode.sfVsyncOffset = mode.sfVsyncOffset;
        outMode.presentationDeadline = mode.presentationDeadline;
        outMode.group = mode.group;
        outMode.outputType = static_cast<ui::OutputType>(mode.outputType);
        std::transform(mode.supportedHdrTypes.begin(), mode.supportedHdrTypes.end(),
                       std::back_inserter(outMode.supportedHdrTypes),
                       [](const int32_t& value) { return static_cast<ui::Hdr>(value); });
+1 −0
Original line number Diff line number Diff line
@@ -36,4 +36,5 @@ parcelable DisplayMode {
    long sfVsyncOffset = 0;
    long presentationDeadline = 0;
    int group = -1;
    int outputType = 0;
}
+2 −0
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@
#include <type_traits>

#include <ui/GraphicTypes.h>
#include <ui/OutputType.h>
#include <ui/Size.h>
#include <utils/Flattenable.h>
#include <utils/Timers.h>
@@ -44,6 +45,7 @@ struct DisplayMode {
    nsecs_t sfVsyncOffset = 0;
    nsecs_t presentationDeadline = 0;
    int32_t group = -1;
    ui::OutputType outputType;
};

} // namespace android::ui
+47 −0
Original line number Diff line number Diff line
/*
 * Copyright 2025 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.
 */

#ifndef ANDROID_UI_OUTPUT_TYPE_H
#define ANDROID_UI_OUTPUT_TYPE_H

#include <stdint.h>

namespace android::ui {

// Must be kept in sync with composer3/OutputType.aidl
enum class OutputType : int32_t {
    /**
     * Invalid HDR output type
     */
    OUTPUT_TYPE_INVALID = 0,
    /*
     * Display output format will be chosen by the HAL implementation
     * and will not adjust to match the content format
     */
    OUTPUT_TYPE_SYSTEM = 1,
    /**
     * Display supports SDR output type
     */
    OUTPUT_TYPE_SDR = 2,
    /**
     * Display supports HDR10 output type
     */
    OUTPUT_TYPE_HDR10 = 3,
};

} // namespace android::ui

#endif // ANDROID_UI_OUTPUT_TYPE_H
+4 −4
Original line number Diff line number Diff line
@@ -35,7 +35,7 @@

namespace android {

using aidl::android::hardware::graphics::composer3::OutputType;
namespace composer3 = aidl::android::hardware::graphics::composer3;
namespace hal = android::hardware::graphics::composer::hal;

class DisplayMode;
@@ -115,7 +115,7 @@ public:
            return *this;
        }

        Builder& setHdrOutputType(OutputType type) {
        Builder& setHdrOutputType(composer3::OutputType type) {
            mDisplayMode->mHdrOutputType = type;
            return *this;
        }
@@ -172,7 +172,7 @@ public:
    // without visual interruptions such as a black screen.
    int32_t getGroup() const { return mGroup; }

    OutputType getHdrOutputType() const { return mHdrOutputType; }
    composer3::OutputType getHdrOutputType() const { return mHdrOutputType; }

private:
    explicit DisplayMode(hal::HWConfigId id) : mHwcId(id) {}
@@ -187,7 +187,7 @@ private:
    Dpi mDpi;
    int32_t mGroup = -1;
    std::optional<hal::VrrConfig> mVrrConfig;
    OutputType mHdrOutputType;
    composer3::OutputType mHdrOutputType;
};

inline bool equalsExceptDisplayModeId(const DisplayMode& lhs, const DisplayMode& rhs) {
Loading