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

Commit f96aa9e8 authored by Leon Scroggins's avatar Leon Scroggins Committed by Android (Google) Code Review
Browse files

Merge changes from topics "GL_screen_decor", "VK_screen_decor"

* changes:
  Plumb support for rendering A8 in Vulkan
  Plumb through A8 for GL/EGL
  Add COLOR_MODE_A8/ColorMode::A8
  Treat AHARDWAREBUFFER_FORMAT_R8_UNORM as kAlpha_8_SkAlphaType
parents 6b2e02d8 7ccb8a4d
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -304,12 +304,23 @@ public class ActivityInfo extends ComponentInfo implements Parcelable {
     * @see android.R.attr#colorMode
     */
    public static final int COLOR_MODE_HDR = 2;
    // 3 Corresponds to android::uirenderer::ColorMode::Hdr10.
    /**
     * Value of {@link #colorMode} indicating that the activity should use an
     * 8 bit alpha buffer if the presentation display supports it.
     *
     * @see android.R.attr#colorMode
     * @hide
     */
    public static final int COLOR_MODE_A8 = 4;


    /** @hide */
    @IntDef(prefix = { "COLOR_MODE_" }, value = {
            COLOR_MODE_DEFAULT,
            COLOR_MODE_WIDE_COLOR_GAMUT,
            COLOR_MODE_HDR,
            COLOR_MODE_A8,
    })
    @Retention(RetentionPolicy.SOURCE)
    public @interface ColorMode {}
@@ -1682,6 +1693,8 @@ public class ActivityInfo extends ComponentInfo implements Parcelable {
                return "COLOR_MODE_WIDE_COLOR_GAMUT";
            case COLOR_MODE_HDR:
                return "COLOR_MODE_HDR";
            case COLOR_MODE_A8:
                return "COLOR_MODE_A8";
            default:
                return Integer.toString(colorMode);
        }
+3 −2
Original line number Diff line number Diff line
@@ -4910,13 +4910,14 @@ public final class ViewRootImpl implements ViewParent,
        }
    }

    private void updateColorModeIfNeeded(int colorMode) {
    private void updateColorModeIfNeeded(@ActivityInfo.ColorMode int colorMode) {
        if (mAttachInfo.mThreadedRenderer == null) {
            return;
        }
        // TODO: Centralize this sanitization? Why do we let setting bad modes?
        // Alternatively, can we just let HWUI figure it out? Do we need to care here?
        if (!getConfiguration().isScreenWideColorGamut()) {
        if (colorMode != ActivityInfo.COLOR_MODE_A8
                && !getConfiguration().isScreenWideColorGamut()) {
            colorMode = ActivityInfo.COLOR_MODE_DEFAULT;
        }
        mAttachInfo.mThreadedRenderer.setColorMode(colorMode);
+2 −0
Original line number Diff line number Diff line
@@ -29,6 +29,8 @@ enum class ColorMode {
    Hdr = 2,
    // HDR Rec2020 + 1010102
    Hdr10 = 3,
    // Alpha 8
    A8 = 4,
};

} // namespace android::uirenderer
+2 −0
Original line number Diff line number Diff line
@@ -91,6 +91,8 @@ bool SkiaOpenGLPipeline::draw(const Frame& frame, const SkRect& screenDirty, con
        fboInfo.fFormat = GL_RGBA8;
    } else if (colorType == kRGBA_1010102_SkColorType) {
        fboInfo.fFormat = GL_RGB10_A2;
    } else if (colorType == kAlpha_8_SkColorType) {
        fboInfo.fFormat = GL_R8;
    } else {
        LOG_ALWAYS_FATAL("Unsupported color type.");
    }
+4 −0
Original line number Diff line number Diff line
@@ -613,6 +613,10 @@ void SkiaPipeline::setSurfaceColorProperties(ColorMode colorMode) {
            mSurfaceColorType = SkColorType::kRGBA_1010102_SkColorType;
            mSurfaceColorSpace = SkColorSpace::MakeRGB(GetPQSkTransferFunction(), SkNamedGamut::kRec2020);
            break;
        case ColorMode::A8:
            mSurfaceColorType = SkColorType::kAlpha_8_SkColorType;
            mSurfaceColorSpace = nullptr;
            break;
    }
}

Loading