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

Commit ac3eddae authored by Vishnu Nair's avatar Vishnu Nair Committed by Android (Google) Code Review
Browse files

Merge "Migrate renderengine atrace calls to perfetto" into main

parents ecc1fa52 40d80014
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -14,11 +14,11 @@
 * limitations under the License.
 */

#include <common/trace.h>
#include <log/log.h>
#include <renderengine/RenderEngine.h>
#include <renderengine/impl/ExternalTexture.h>
#include <ui/GraphicBuffer.h>
#include <utils/Trace.h>

namespace android::renderengine::impl {

@@ -35,7 +35,7 @@ ExternalTexture::~ExternalTexture() {
}

void ExternalTexture::remapBuffer() {
    ATRACE_CALL();
    SFTRACE_CALL();
    {
        auto buf = mBuffer;
        mRenderEngine.unmapExternalTextureBuffer(std::move(buf));
+1 −0
Original line number Diff line number Diff line
@@ -57,6 +57,7 @@ cc_benchmark {
        "libui",
        "libutils",
        "server_configurable_flags",
        "libtracing_perfetto",
    ],

    data: ["resources/*"],
+3 −3
Original line number Diff line number Diff line
@@ -25,8 +25,8 @@

#include "compat/SkiaBackendTexture.h"

#include <common/trace.h>
#include <log/log_main.h>
#include <utils/Trace.h>

namespace android {
namespace renderengine {
@@ -63,7 +63,7 @@ void AutoBackendTexture::releaseImageProc(SkImages::ReleaseContext releaseContex
}

sk_sp<SkImage> AutoBackendTexture::makeImage(ui::Dataspace dataspace, SkAlphaType alphaType) {
    ATRACE_CALL();
    SFTRACE_CALL();

    sk_sp<SkImage> image = mBackendTexture->makeImage(alphaType, dataspace, releaseImageProc, this);
    // The following ref will be counteracted by releaseProc, when SkImage is discarded.
@@ -75,7 +75,7 @@ sk_sp<SkImage> AutoBackendTexture::makeImage(ui::Dataspace dataspace, SkAlphaTyp
}

sk_sp<SkSurface> AutoBackendTexture::getOrCreateSurface(ui::Dataspace dataspace) {
    ATRACE_CALL();
    SFTRACE_CALL();
    LOG_ALWAYS_FATAL_IF(!mBackendTexture->isOutputBuffer(),
                        "You can't generate an SkSurface for a read-only texture");
    if (!mSurface.get() || mDataspace != dataspace) {
+2 −2
Original line number Diff line number Diff line
@@ -21,9 +21,9 @@

#include <include/gpu/ganesh/vk/GrVkBackendSemaphore.h>

#include <common/trace.h>
#include <log/log_main.h>
#include <sync/sync.h>
#include <utils/Trace.h>

namespace android::renderengine::skia {

@@ -78,7 +78,7 @@ base::unique_fd GaneshVkRenderEngine::flushAndSubmit(SkiaGpuContext* context,
                                                     sk_sp<SkSurface> dstSurface) {
    sk_sp<GrDirectContext> grContext = context->grDirectContext();
    {
        ATRACE_NAME("flush surface");
        SFTRACE_NAME("flush surface");
        // TODO: Investigate feasibility of combining this "surface flush" into the "context flush"
        // below.
        context->grDirectContext()->flush(dstSurface.get());
+7 −8
Original line number Diff line number Diff line
@@ -28,12 +28,11 @@
#include <GrContextOptions.h>
#include <GrTypes.h>
#include <android-base/stringprintf.h>
#include <common/trace.h>
#include <gl/GrGLInterface.h>
#include <include/gpu/ganesh/gl/GrGLDirectContext.h>
#include <gui/TraceUtils.h>
#include <sync/sync.h>
#include <ui/DebugUtils.h>
#include <utils/Trace.h>

#include <cmath>
#include <cstdint>
@@ -332,7 +331,7 @@ bool SkiaGLRenderEngine::useProtectedContextImpl(GrProtected isProtected) {

void SkiaGLRenderEngine::waitFence(SkiaGpuContext*, base::borrowed_fd fenceFd) {
    if (fenceFd.get() >= 0 && !waitGpuFence(fenceFd)) {
        ATRACE_NAME("SkiaGLRenderEngine::waitFence");
        SFTRACE_NAME("SkiaGLRenderEngine::waitFence");
        sync_wait(fenceFd.get(), -1);
    }
}
@@ -341,19 +340,19 @@ base::unique_fd SkiaGLRenderEngine::flushAndSubmit(SkiaGpuContext* context,
                                                   sk_sp<SkSurface> dstSurface) {
    sk_sp<GrDirectContext> grContext = context->grDirectContext();
    {
        ATRACE_NAME("flush surface");
        SFTRACE_NAME("flush surface");
        grContext->flush(dstSurface.get());
    }
    base::unique_fd drawFence = flushGL();

    bool requireSync = drawFence.get() < 0;
    if (requireSync) {
        ATRACE_BEGIN("Submit(sync=true)");
        SFTRACE_BEGIN("Submit(sync=true)");
    } else {
        ATRACE_BEGIN("Submit(sync=false)");
        SFTRACE_BEGIN("Submit(sync=false)");
    }
    bool success = grContext->submit(requireSync ? GrSyncCpu::kYes : GrSyncCpu::kNo);
    ATRACE_END();
    SFTRACE_END();
    if (!success) {
        ALOGE("Failed to flush RenderEngine commands");
        // Chances are, something illegal happened (Skia's internal GPU object
@@ -400,7 +399,7 @@ bool SkiaGLRenderEngine::waitGpuFence(base::borrowed_fd fenceFd) {
}

base::unique_fd SkiaGLRenderEngine::flushGL() {
    ATRACE_CALL();
    SFTRACE_CALL();
    if (!GLExtensions::getInstance().hasNativeFenceSync()) {
        return base::unique_fd();
    }
Loading