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

Commit 189021b4 authored by Peiyong Lin's avatar Peiyong Lin
Browse files

Partially revert "[HWUI] Implement legacy color mode."

Reason for partially revert: Step back a little bit to think about how we want
to move the view system forward.

This patch removes the legacy mode we have added, as well as move color type
and color space of the surface to SkiaPipeline.

BUG: 111436479
BUG: 113530681
Test: Build, flash, boot and check dumpsys SurfaceFlinger

Change-Id: I1ab7b88d41347284d87649618e5a15f5c6bcf8fe
parent 043a3a71
Loading
Loading
Loading
Loading
+0 −13
Original line number Diff line number Diff line
@@ -61,18 +61,6 @@ DisplayInfo QueryDisplayInfo() {
    return displayInfo;
}

void QueryCompositionPreference(ui::Dataspace* dataSpace,
                                ui::PixelFormat* pixelFormat) {
    if (Properties::isolatedProcess) {
        *dataSpace = ui::Dataspace::V0_SRGB;
        *pixelFormat = ui::PixelFormat::RGBA_8888;
    }

    status_t status =
            SurfaceComposerClient::getCompositionPreference(dataSpace, pixelFormat);
    LOG_ALWAYS_FATAL_IF(status, "Failed to get composition preference, error %d", status);
}

DeviceInfo::DeviceInfo() {
#if HWUI_NULL_GPU
        mMaxTextureSize = NULL_GPU_MAX_TEXTURE_SIZE;
@@ -80,7 +68,6 @@ DeviceInfo::DeviceInfo() {
        mMaxTextureSize = -1;
#endif
    mDisplayInfo = QueryDisplayInfo();
    QueryCompositionPreference(&mTargetDataSpace, &mTargetPixelFormat);
}

int DeviceInfo::maxTextureSize() const {
+0 −8
Original line number Diff line number Diff line
@@ -17,7 +17,6 @@
#define DEVICEINFO_H

#include <ui/DisplayInfo.h>
#include <ui/GraphicTypes.h>

#include "utils/Macros.h"

@@ -37,9 +36,6 @@ public:
    // this value is only valid after the GPU has been initialized and there is a valid graphics
    // context or if you are using the HWUI_NULL_GPU
    int maxTextureSize() const;

    ui::Dataspace getTargetDataSpace() const { return mTargetDataSpace; }
    ui::PixelFormat getTargetPixelFormat() const { return mTargetPixelFormat; }
    const DisplayInfo& displayInfo() const { return mDisplayInfo; }

private:
@@ -50,10 +46,6 @@ private:

    int mMaxTextureSize;
    DisplayInfo mDisplayInfo;

    // TODO(lpy) Replace below with android_ prefix types.
    ui::Dataspace mTargetDataSpace;
    ui::PixelFormat mTargetPixelFormat;
};

} /* namespace uirenderer */
+6 −8
Original line number Diff line number Diff line
@@ -167,6 +167,12 @@ bool SkiaOpenGLPipeline::setSurface(Surface* surface, SwapBehavior swapBehavior,
        mEglSurface = mEglManager.createSurface(surface, colorMode);
    }

    if (colorMode == ColorMode::SRGB) {
        mSurfaceColorType = SkColorType::kN32_SkColorType;
    } else if (colorMode == ColorMode::WideColorGamut) {
        mSurfaceColorType = SkColorType::kRGBA_F16_SkColorType;
    }

    if (mEglSurface != EGL_NO_SURFACE) {
        const bool preserveBuffer = (swapBehavior != SwapBehavior::kSwap_discardBuffer);
        mBufferPreserved = mEglManager.setPreserveBuffer(mEglSurface, preserveBuffer);
@@ -184,14 +190,6 @@ bool SkiaOpenGLPipeline::isContextReady() {
    return CC_LIKELY(mEglManager.hasEglContext());
}

SkColorType SkiaOpenGLPipeline::getSurfaceColorType() const {
    return mEglManager.getSurfaceColorType();
}

sk_sp<SkColorSpace> SkiaOpenGLPipeline::getSurfaceColorSpace() {
    return mEglManager.getSurfaceColorSpace();
}

void SkiaOpenGLPipeline::invokeFunctor(const RenderThread& thread, Functor* functor) {
    DrawGlInfo::Mode mode = DrawGlInfo::kModeProcessNoContext;
    if (thread.eglManager().hasEglContext()) {
+0 −2
Original line number Diff line number Diff line
@@ -47,8 +47,6 @@ public:
    void onStop() override;
    bool isSurfaceReady() override;
    bool isContextReady() override;
    SkColorType getSurfaceColorType() const override;
    sk_sp<SkColorSpace> getSurfaceColorSpace() override;

    static void invokeFunctor(const renderthread::RenderThread& thread, Functor* functor);

+5 −0
Original line number Diff line number Diff line
@@ -48,6 +48,9 @@ public:
    bool createOrUpdateLayer(RenderNode* node, const DamageAccumulator& damageAccumulator,
                             ErrorHandler* errorHandler) override;

    SkColorType getSurfaceColorType() const { return mSurfaceColorType; }
    sk_sp<SkColorSpace> getSurfaceColorSpace() override { return mSurfaceColorSpace; }

    void renderFrame(const LayerUpdateQueue& layers, const SkRect& clip,
                     const std::vector<sp<RenderNode>>& nodes, bool opaque,
                     const Rect& contentDrawBounds, sk_sp<SkSurface> surface);
@@ -106,6 +109,8 @@ protected:
    void dumpResourceCacheUsage() const;

    renderthread::RenderThread& mRenderThread;
    SkColorType mSurfaceColorType;
    sk_sp<SkColorSpace> mSurfaceColorSpace;

private:
    void renderFrameImpl(const LayerUpdateQueue& layers, const SkRect& clip,
Loading