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

Commit 72d1772e authored by Courtney Goeltzenleuchter's avatar Courtney Goeltzenleuchter Committed by Android (Google) Code Review
Browse files

Merge changes Iea048eaa,I5c246571 into nyc-mr1-dev

* changes:
  Add support for multiple color modes
  Remove unused DisplayInfo structure
parents 3717b164 fad9d8cd
Loading
Loading
Loading
Loading
+21 −0
Original line number Diff line number Diff line
@@ -359,6 +359,27 @@ std::shared_ptr<const HWC2::Display::Config>
    return config;
}

std::vector<int32_t> HWComposer::getColorModes(int32_t displayId) const {
    std::vector<int32_t> modes;

    if (!isValidDisplay(displayId)) {
        ALOGE("getColorModes: Attempted to access invalid display %d",
                displayId);
        return modes;
    }
    const std::shared_ptr<HWC2::Display>& hwcDisplay =
            mDisplayData[displayId].hwcDisplay;

    auto error = hwcDisplay->getColorModes(&modes);
    if (error != HWC2::Error::None) {
        ALOGE("getColorModes failed for display %d: %s (%d)", displayId,
                to_string(error).c_str(), static_cast<int32_t>(error));
        return std::vector<int32_t>();
    }

    return modes;
}

void HWComposer::setVsyncEnabled(int32_t disp, HWC2::Vsync enabled) {
    if (disp < 0 || disp >= HWC_DISPLAY_VIRTUAL) {
        ALOGD("setVsyncEnabled: Ignoring for virtual display %d", disp);
+2 −9
Original line number Diff line number Diff line
@@ -137,15 +137,6 @@ public:

    void setVsyncEnabled(int32_t disp, HWC2::Vsync enabled);

    struct DisplayConfig {
        uint32_t width;
        uint32_t height;
        float xdpi;
        float ydpi;
        nsecs_t refresh;
        int colorTransform;
    };

    // Query display parameters.  Pass in a display index (e.g.
    // HWC_DISPLAY_PRIMARY).
    nsecs_t getRefreshTimestamp(int32_t disp) const;
@@ -158,6 +149,8 @@ public:
    std::shared_ptr<const HWC2::Display::Config>
            getActiveConfig(int32_t displayId) const;

    std::vector<int32_t> getColorModes(int32_t displayId) const;

    // for debugging ----------------------------------------------------------
    void dump(String8& out) const;

+12 −4
Original line number Diff line number Diff line
@@ -614,9 +614,6 @@ status_t SurfaceFlinger::getDisplayConfigs(const sp<IBinder>& display,
        info.fps = 1e9 / hwConfig->getVsyncPeriod();
        info.appVsyncOffset = VSYNC_EVENT_PHASE_OFFSET_NS;

        // TODO: Hook this back up
        info.colorTransform = 0;

        // This is how far in advance a buffer must be queued for
        // presentation at a given time.  If you want a buffer to appear
        // on the screen at time N, you must submit the buffer before
@@ -635,8 +632,19 @@ status_t SurfaceFlinger::getDisplayConfigs(const sp<IBinder>& display,
        // All non-virtual displays are currently considered secure.
        info.secure = true;

        // DisplayManager expects each color mode to be its own display
        // info record.
        std::vector<int32_t> modes = getHwComposer().getColorModes(type);

        if (modes.size() == 0) {
            info.colorTransform = 0;
            configs->push_back(info);
        }
        for (int32_t mode : modes) {
            info.colorTransform = mode;
            configs->push_back(info);
        }
    }

    return NO_ERROR;
}