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

Commit a85fe534 authored by android-build-team Robot's avatar android-build-team Robot
Browse files

Snap for 7351654 from d16d3a03 to sc-release

Change-Id: I4eb099a91dc278aab14e98159d36e4cd26b53d07
parents d2536211 d16d3a03
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -1641,6 +1641,10 @@ static Dumpstate::RunStatus dumpstate() {
        MYLOGD("Skipping 'lsmod' because /proc/modules does not exist\n");
    } else {
        RunCommand("LSMOD", {"lsmod"});
        RunCommand("MODULES INFO",
                   {"sh", "-c", "cat /proc/modules | cut -d' ' -f1 | "
                    "    while read MOD ; do echo modinfo:$MOD ; modinfo $MOD ; "
                    "done"}, CommandOptions::AS_ROOT);
    }

    if (android::base::GetBoolProperty("ro.logd.kernel", false)) {
+9 −48
Original line number Diff line number Diff line
@@ -560,7 +560,11 @@ sk_sp<SkShader> SkiaGLRenderEngine::createRuntimeEffectShader(
        const LayerSettings* layer, const DisplaySettings& display, bool undoPremultipliedAlpha,
        bool requiresLinearEffect) {
    const auto stretchEffect = layer->stretchEffect;
    if (stretchEffect.hasEffect()) {
    // The given surface will be stretched by HWUI via matrix transformation
    // which gets similar results for most surfaces
    // Determine later on if we need to leverage the stertch shader within
    // surface flinger
    if (stretchEffect.hasEffect() && /* DISABLES CODE */ (false)) {
        const auto targetBuffer = layer->source.buffer.buffer;
        const auto graphicsBuffer = targetBuffer ? targetBuffer->getBuffer() : nullptr;
        if (graphicsBuffer && shader) {
@@ -653,33 +657,6 @@ private:
    int mSaveCount;
};

void drawStretch(const SkRect& bounds, const StretchEffect& stretchEffect,
                 SkCanvas* canvas, const SkPaint& paint) {
    float top = bounds.top();
    float left = bounds.left();
    float bottom = bounds.bottom();
    float right = bounds.right();
    // Adjust the drawing bounds based on the stretch itself.
    float stretchOffsetX =
        round(bounds.width() * stretchEffect.getStretchWidthMultiplier());
    float stretchOffsetY =
        round(bounds.height() * stretchEffect.getStretchHeightMultiplier());
    if (stretchEffect.vectorY < 0.f) {
        top -= stretchOffsetY;
    } else if (stretchEffect.vectorY > 0.f){
        bottom += stretchOffsetY;
    }

    if (stretchEffect.vectorX < 0.f) {
        left -= stretchOffsetX;
    } else if (stretchEffect.vectorX > 0.f) {
        right += stretchOffsetX;
    }

    auto stretchBounds = SkRect::MakeLTRB(left, top, right, bottom);
    canvas->drawRect(stretchBounds, paint);
}

static SkRRect getBlurRRect(const BlurRegion& region) {
    const auto rect = SkRect::MakeLTRB(region.left, region.top, region.right, region.bottom);
    const SkVector radii[4] = {SkVector::Make(region.cornerRadiusTL, region.cornerRadiusTL),
@@ -919,12 +896,9 @@ status_t SkiaGLRenderEngine::drawLayers(const DisplaySettings& display,
        // TODO(b/175915334): consider relaxing this restriction to enable more flexible
        // composition - using a well-defined invalid color is long-term less error-prone.
        if (layer->shadow.length > 0) {
            const auto rect = layer->geometry.roundedCornersRadius > 0
                    ? getSkRect(layer->geometry.roundedCornersCrop)
                    : bounds.rect();
            // This would require a new parameter/flag to SkShadowUtils::DrawShadow
            LOG_ALWAYS_FATAL_IF(layer->disableBlending, "Cannot disableBlending with a shadow");
            drawShadow(canvas, rect, layer->geometry.roundedCornersRadius, layer->shadow);
            drawShadow(canvas, bounds, layer->shadow);
            continue;
        }

@@ -1055,19 +1029,9 @@ status_t SkiaGLRenderEngine::drawLayers(const DisplaySettings& display,
        if (!bounds.isRect()) {
            paint.setAntiAlias(true);
            canvas->drawRRect(bounds, paint);
        } else {
            auto& stretchEffect = layer->stretchEffect;
            // TODO (njawad) temporarily disable manipulation of geometry
            //  the layer bounds will be updated in HWUI instead of RenderEngine
            //  in a subsequent CL
            // Keep the method call in a dead code path to make -Werror happy
            // with unused methods
            if (stretchEffect.hasEffect() && /* DISABLES CODE */ (false)) {
                drawStretch(bounds.rect(), stretchEffect, canvas, paint);
        } else {
            canvas->drawRect(bounds.rect(), paint);
        }
        }
        if (kFlushAfterEveryLayer) {
            ATRACE_NAME("flush surface");
            activeSurface->flush();
@@ -1213,17 +1177,14 @@ size_t SkiaGLRenderEngine::getMaxViewportDims() const {
    return mGrContext->maxRenderTargetSize();
}

void SkiaGLRenderEngine::drawShadow(SkCanvas* canvas, const SkRect& casterRect, float cornerRadius,
void SkiaGLRenderEngine::drawShadow(SkCanvas* canvas, const SkRRect& casterRRect,
                                    const ShadowSettings& settings) {
    ATRACE_CALL();
    const float casterZ = settings.length / 2.0f;
    const auto shadowShape = cornerRadius > 0
            ? SkPath::RRect(SkRRect::MakeRectXY(casterRect, cornerRadius, cornerRadius))
            : SkPath::Rect(casterRect);
    const auto flags =
            settings.casterIsTranslucent ? kTransparentOccluder_ShadowFlag : kNone_ShadowFlag;

    SkShadowUtils::DrawShadow(canvas, shadowShape, SkPoint3::Make(0, 0, casterZ),
    SkShadowUtils::DrawShadow(canvas, SkPath::RRect(casterRRect), SkPoint3::Make(0, 0, casterZ),
                              getSkPoint3(settings.lightPos), settings.lightRadius,
                              getSkColor(settings.ambientColor), getSkColor(settings.spotColor),
                              flags);
+1 −1
Original line number Diff line number Diff line
@@ -98,7 +98,7 @@ private:
    base::unique_fd flush();
    bool waitFence(base::unique_fd fenceFd);
    void initCanvas(SkCanvas* canvas, const DisplaySettings& display);
    void drawShadow(SkCanvas* canvas, const SkRect& casterRect, float casterCornerRadius,
    void drawShadow(SkCanvas* canvas, const SkRRect& casterRRect,
                    const ShadowSettings& shadowSettings);
    // If requiresLinearEffect is true or the layer has a stretchEffect a new shader is returned.
    // Otherwise it returns the input shader.
+4 −5
Original line number Diff line number Diff line
@@ -69,9 +69,8 @@ static const SkString stretchShader = SkString(R"(
    // and the other way around.
    uniform float uInterpolationStrength;

    float easeInCubic(float t, float d) {
        float tmp = t * d;
        return tmp * tmp * tmp;
    float easeIn(float t, float d) {
        return t * d;
    }

    float computeOverscrollStart(
@@ -84,7 +83,7 @@ static const SkString stretchShader = SkString(R"(
    ) {
        float offsetPos = uStretchAffectedDist - inPos;
        float posBasedVariation = mix(
                1. ,easeInCubic(offsetPos, uInverseStretchAffectedDist), interpolationStrength);
                1. ,easeIn(offsetPos, uInverseStretchAffectedDist), interpolationStrength);
        float stretchIntensity = overscroll * posBasedVariation;
        return distanceStretched - (offsetPos / (1. + stretchIntensity));
    }
@@ -100,7 +99,7 @@ static const SkString stretchShader = SkString(R"(
    ) {
        float offsetPos = inPos - reverseStretchDist;
        float posBasedVariation = mix(
                1. ,easeInCubic(offsetPos, uInverseStretchAffectedDist), interpolationStrength);
                1. ,easeIn(offsetPos, uInverseStretchAffectedDist), interpolationStrength);
        float stretchIntensity = (-overscroll) * posBasedVariation;
        return 1 - (distanceStretched - (offsetPos / (1. + stretchIntensity)));
    }