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

Commit 2ce2f517 authored by Yiwei Zhang's avatar Yiwei Zhang Committed by Android (Google) Code Review
Browse files

Merge changes Ib48777df,Ie08aa85d into pi-dev

* changes:
  Implement Display Layer Stats V0.1
  Implement Display Layer Stats
parents 63e3a5e6 7c64f17b
Loading
Loading
Loading
Loading
+27 −0
Original line number Original line Diff line number Diff line
@@ -234,6 +234,33 @@ std::string decodeColorMode(ColorMode colorMode) {
    return android::base::StringPrintf("Unknown color mode %d", colorMode);
    return android::base::StringPrintf("Unknown color mode %d", colorMode);
}
}


std::string decodeColorTransform(android_color_transform colorTransform) {
    switch (colorTransform) {
        case HAL_COLOR_TRANSFORM_IDENTITY:
            return std::string("Identity");

        case HAL_COLOR_TRANSFORM_ARBITRARY_MATRIX:
            return std::string("Arbitrary matrix");

        case HAL_COLOR_TRANSFORM_VALUE_INVERSE:
            return std::string("Inverse value");

        case HAL_COLOR_TRANSFORM_GRAYSCALE:
            return std::string("Grayscale");

        case HAL_COLOR_TRANSFORM_CORRECT_PROTANOPIA:
            return std::string("Correct protanopia");

        case HAL_COLOR_TRANSFORM_CORRECT_DEUTERANOPIA:
            return std::string("Correct deuteranopia");

        case HAL_COLOR_TRANSFORM_CORRECT_TRITANOPIA:
            return std::string("Correct tritanopia");
    }

    return android::base::StringPrintf("Unknown color transform %d", colorTransform);
}

// Converts a PixelFormat to a human-readable string.  Max 11 chars.
// Converts a PixelFormat to a human-readable string.  Max 11 chars.
// (Could use a table of prefab String8 objects.)
// (Could use a table of prefab String8 objects.)
std::string decodePixelFormat(android::PixelFormat format) {
std::string decodePixelFormat(android::PixelFormat format) {
+1 −0
Original line number Original line Diff line number Diff line
@@ -30,5 +30,6 @@ std::string decodeTransfer(android_dataspace dataspace);
std::string decodeRange(android_dataspace dataspace);
std::string decodeRange(android_dataspace dataspace);
std::string dataspaceDetails(android_dataspace dataspace);
std::string dataspaceDetails(android_dataspace dataspace);
std::string decodeColorMode(android::ui::ColorMode colormode);
std::string decodeColorMode(android::ui::ColorMode colormode);
std::string decodeColorTransform(android_color_transform colorTransform);
std::string decodePixelFormat(android::PixelFormat format);
std::string decodePixelFormat(android::PixelFormat format);
std::string to_string(const android::Rect& rect);
std::string to_string(const android::Rect& rect);
+1 −0
Original line number Original line Diff line number Diff line
@@ -105,6 +105,7 @@ filegroup {
        "Layer.cpp",
        "Layer.cpp",
        "LayerProtoHelper.cpp",
        "LayerProtoHelper.cpp",
        "LayerRejecter.cpp",
        "LayerRejecter.cpp",
        "LayerStats.cpp",
        "LayerVector.cpp",
        "LayerVector.cpp",
        "MessageQueue.cpp",
        "MessageQueue.cpp",
        "MonitoredProducer.cpp",
        "MonitoredProducer.cpp",
+11 −0
Original line number Original line Diff line number Diff line
@@ -97,6 +97,7 @@ DisplayDevice::DisplayDevice(
      mPowerMode(initialPowerMode),
      mPowerMode(initialPowerMode),
      mActiveConfig(0),
      mActiveConfig(0),
      mActiveColorMode(ColorMode::NATIVE),
      mActiveColorMode(ColorMode::NATIVE),
      mColorTransform(HAL_COLOR_TRANSFORM_IDENTITY),
      mDisplayHasWideColor(supportWideColor),
      mDisplayHasWideColor(supportWideColor),
      mDisplayHasHdr(supportHdr)
      mDisplayHasHdr(supportHdr)
{
{
@@ -267,6 +268,16 @@ ColorMode DisplayDevice::getActiveColorMode() const {
    return mActiveColorMode;
    return mActiveColorMode;
}
}


void DisplayDevice::setColorTransform(const mat4& transform) {
    const bool isIdentity = (transform == mat4());
    mColorTransform =
            isIdentity ? HAL_COLOR_TRANSFORM_IDENTITY : HAL_COLOR_TRANSFORM_ARBITRARY_MATRIX;
}

android_color_transform_t DisplayDevice::getColorTransform() const {
    return mColorTransform;
}

void DisplayDevice::setCompositionDataSpace(android_dataspace dataspace) {
void DisplayDevice::setCompositionDataSpace(android_dataspace dataspace) {
    ANativeWindow* const window = mNativeWindow.get();
    ANativeWindow* const window = mNativeWindow.get();
    native_window_set_buffers_data_space(window, dataspace);
    native_window_set_buffers_data_space(window, dataspace);
+6 −0
Original line number Original line Diff line number Diff line
@@ -21,6 +21,8 @@


#include <stdlib.h>
#include <stdlib.h>


#include <math/mat4.h>

#include <ui/Region.h>
#include <ui/Region.h>


#include <binder/IBinder.h>
#include <binder/IBinder.h>
@@ -163,6 +165,8 @@ public:


    ui::ColorMode getActiveColorMode() const;
    ui::ColorMode getActiveColorMode() const;
    void setActiveColorMode(ui::ColorMode mode);
    void setActiveColorMode(ui::ColorMode mode);
    android_color_transform_t getColorTransform() const;
    void setColorTransform(const mat4& transform);
    void setCompositionDataSpace(android_dataspace dataspace);
    void setCompositionDataSpace(android_dataspace dataspace);


    /* ------------------------------------------------------------------------
    /* ------------------------------------------------------------------------
@@ -237,6 +241,8 @@ private:
    int mActiveConfig;
    int mActiveConfig;
    // current active color mode
    // current active color mode
    ui::ColorMode mActiveColorMode;
    ui::ColorMode mActiveColorMode;
    // Current color transform
    android_color_transform_t mColorTransform;


    // Need to know if display is wide-color capable or not.
    // Need to know if display is wide-color capable or not.
    // Initialized by SurfaceFlinger when the DisplayDevice is created.
    // Initialized by SurfaceFlinger when the DisplayDevice is created.
Loading