diff options
author | 2024-07-13 23:25:06 +0000 | |
---|---|---|
committer | 2024-07-15 22:45:32 +0000 | |
commit | 40d8001464b93d679ab715cc642a25fa5925fe2a (patch) | |
tree | 7961260096082c1e21c69071e704d651e4590748 | |
parent | 687f9fea008f01b02284f45c5a582e1b445d3030 (diff) |
Migrate renderengine atrace calls to perfetto
Flag: android.os.perfetto_sdk_tracing
Bug: 349905670
Test: perfetto
Change-Id: Icd84634317471a249976fd59eca28a300fc38266
-rw-r--r-- | libs/renderengine/ExternalTexture.cpp | 4 | ||||
-rw-r--r-- | libs/renderengine/benchmark/Android.bp | 1 | ||||
-rw-r--r-- | libs/renderengine/skia/AutoBackendTexture.cpp | 6 | ||||
-rw-r--r-- | libs/renderengine/skia/GaneshVkRenderEngine.cpp | 4 | ||||
-rw-r--r-- | libs/renderengine/skia/SkiaGLRenderEngine.cpp | 15 | ||||
-rw-r--r-- | libs/renderengine/skia/SkiaRenderEngine.cpp | 29 | ||||
-rw-r--r-- | libs/renderengine/skia/SkiaVkRenderEngine.cpp | 3 | ||||
-rw-r--r-- | libs/renderengine/skia/compat/GaneshBackendTexture.cpp | 4 | ||||
-rw-r--r-- | libs/renderengine/skia/compat/GraphiteBackendTexture.cpp | 4 | ||||
-rw-r--r-- | libs/renderengine/skia/debug/CommonPool.cpp | 4 | ||||
-rw-r--r-- | libs/renderengine/skia/debug/SkiaCapture.cpp | 14 | ||||
-rw-r--r-- | libs/renderengine/skia/filters/BlurFilter.cpp | 4 | ||||
-rw-r--r-- | libs/renderengine/skia/filters/GaussianBlurFilter.cpp | 6 | ||||
-rw-r--r-- | libs/renderengine/skia/filters/KawaseBlurFilter.cpp | 2 | ||||
-rw-r--r-- | libs/renderengine/skia/filters/LinearEffect.cpp | 6 | ||||
-rw-r--r-- | libs/renderengine/tests/Android.bp | 1 | ||||
-rw-r--r-- | libs/renderengine/threaded/RenderEngineThreaded.cpp | 32 |
17 files changed, 69 insertions, 70 deletions
diff --git a/libs/renderengine/ExternalTexture.cpp b/libs/renderengine/ExternalTexture.cpp index 6f2a96a87b..8d0fbba2e0 100644 --- a/libs/renderengine/ExternalTexture.cpp +++ b/libs/renderengine/ExternalTexture.cpp @@ -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)); diff --git a/libs/renderengine/benchmark/Android.bp b/libs/renderengine/benchmark/Android.bp index e1a6f6af0d..f84db0b04c 100644 --- a/libs/renderengine/benchmark/Android.bp +++ b/libs/renderengine/benchmark/Android.bp @@ -57,6 +57,7 @@ cc_benchmark { "libui", "libutils", "server_configurable_flags", + "libtracing_perfetto", ], data: ["resources/*"], diff --git a/libs/renderengine/skia/AutoBackendTexture.cpp b/libs/renderengine/skia/AutoBackendTexture.cpp index 8aeef9f4bc..b7b7a4d086 100644 --- a/libs/renderengine/skia/AutoBackendTexture.cpp +++ b/libs/renderengine/skia/AutoBackendTexture.cpp @@ -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) { diff --git a/libs/renderengine/skia/GaneshVkRenderEngine.cpp b/libs/renderengine/skia/GaneshVkRenderEngine.cpp index 68798bf8b4..a3a43e20be 100644 --- a/libs/renderengine/skia/GaneshVkRenderEngine.cpp +++ b/libs/renderengine/skia/GaneshVkRenderEngine.cpp @@ -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()); diff --git a/libs/renderengine/skia/SkiaGLRenderEngine.cpp b/libs/renderengine/skia/SkiaGLRenderEngine.cpp index 48270e1d2b..af24600ade 100644 --- a/libs/renderengine/skia/SkiaGLRenderEngine.cpp +++ b/libs/renderengine/skia/SkiaGLRenderEngine.cpp @@ -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(); } diff --git a/libs/renderengine/skia/SkiaRenderEngine.cpp b/libs/renderengine/skia/SkiaRenderEngine.cpp index a609f2d2b3..9709cd1d6b 100644 --- a/libs/renderengine/skia/SkiaRenderEngine.cpp +++ b/libs/renderengine/skia/SkiaRenderEngine.cpp @@ -54,8 +54,8 @@ #include <SkTileMode.h> #include <android-base/stringprintf.h> #include <common/FlagManager.h> +#include <common/trace.h> #include <gui/FenceMonitor.h> -#include <gui/TraceUtils.h> #include <include/gpu/ganesh/SkSurfaceGanesh.h> #include <pthread.h> #include <src/core/SkTraceEventCommon.h> @@ -64,7 +64,6 @@ #include <ui/DebugUtils.h> #include <ui/GraphicBuffer.h> #include <ui/HdrRenderTypeUtils.h> -#include <utils/Trace.h> #include <cmath> #include <cstdint> @@ -261,7 +260,7 @@ void SkiaRenderEngine::SkSLCacheMonitor::store(const SkData& key, const SkData& const SkString& description) { mShadersCachedSinceLastCall++; mTotalShadersCompiled++; - ATRACE_FORMAT("SF cache: %i shaders", mTotalShadersCompiled); + SFTRACE_FORMAT("SF cache: %i shaders", mTotalShadersCompiled); } int SkiaRenderEngine::reportShadersCompiled() { @@ -416,7 +415,7 @@ void SkiaRenderEngine::mapExternalTextureBuffer(const sp<GraphicBuffer>& buffer, if (isProtectedBuffer || isProtected() || !isGpuSampleable) { return; } - ATRACE_CALL(); + SFTRACE_CALL(); // If we were to support caching protected buffers then we will need to switch the // currently bound context if we are not already using the protected context (and subsequently @@ -441,7 +440,7 @@ void SkiaRenderEngine::mapExternalTextureBuffer(const sp<GraphicBuffer>& buffer, } void SkiaRenderEngine::unmapExternalTextureBuffer(sp<GraphicBuffer>&& buffer) { - ATRACE_CALL(); + SFTRACE_CALL(); std::lock_guard<std::mutex> lock(mRenderingMutex); if (const auto& iter = mGraphicBufferExternalRefs.find(buffer->getId()); iter != mGraphicBufferExternalRefs.end()) { @@ -498,7 +497,7 @@ bool SkiaRenderEngine::canSkipPostRenderCleanup() const { } void SkiaRenderEngine::cleanupPostRender() { - ATRACE_CALL(); + SFTRACE_CALL(); std::lock_guard<std::mutex> lock(mRenderingMutex); mTextureCleanupMgr.cleanup(); } @@ -696,7 +695,7 @@ void SkiaRenderEngine::drawLayersInternal( const std::shared_ptr<std::promise<FenceResult>>&& resultPromise, const DisplaySettings& display, const std::vector<LayerSettings>& layers, const std::shared_ptr<ExternalTexture>& buffer, base::unique_fd&& bufferFence) { - ATRACE_FORMAT("%s for %s", __func__, display.namePlusId.c_str()); + SFTRACE_FORMAT("%s for %s", __func__, display.namePlusId.c_str()); std::lock_guard<std::mutex> lock(mRenderingMutex); @@ -788,7 +787,7 @@ void SkiaRenderEngine::drawLayersInternal( logSettings(display); } for (const auto& layer : layers) { - ATRACE_FORMAT("DrawLayer: %s", layer.name.c_str()); + SFTRACE_FORMAT("DrawLayer: %s", layer.name.c_str()); if (kPrintLayerSettings) { logSettings(layer); @@ -882,7 +881,7 @@ void SkiaRenderEngine::drawLayersInternal( // TODO(b/182216890): Filter out empty layers earlier if (blurRect.width() > 0 && blurRect.height() > 0) { if (layer.backgroundBlurRadius > 0) { - ATRACE_NAME("BackgroundBlur"); + SFTRACE_NAME("BackgroundBlur"); auto blurredImage = mBlurFilter->generate(context, layer.backgroundBlurRadius, blurInput, blurRect); @@ -895,7 +894,7 @@ void SkiaRenderEngine::drawLayersInternal( canvas->concat(getSkM44(layer.blurRegionTransform).asM33()); for (auto region : layer.blurRegions) { if (cachedBlurs[region.blurRadius] == nullptr) { - ATRACE_NAME("BlurRegion"); + SFTRACE_NAME("BlurRegion"); cachedBlurs[region.blurRadius] = mBlurFilter->generate(context, region.blurRadius, blurInput, blurRect); @@ -978,7 +977,7 @@ void SkiaRenderEngine::drawLayersInternal( SkPaint paint; if (layer.source.buffer.buffer) { - ATRACE_NAME("DrawImage"); + SFTRACE_NAME("DrawImage"); validateInputBufferUsage(layer.source.buffer.buffer->getBuffer()); const auto& item = layer.source.buffer; auto imageTextureRef = getOrCreateBackendTexture(item.buffer->getBuffer(), false); @@ -1111,7 +1110,7 @@ void SkiaRenderEngine::drawLayersInternal( paint.setColorFilter(SkColorFilters::Matrix(colorMatrix)); } } else { - ATRACE_NAME("DrawColor"); + SFTRACE_NAME("DrawColor"); const auto color = layer.source.solidColor; sk_sp<SkShader> shader = SkShaders::Color(SkColor4f{.fR = color.r, .fG = color.g, @@ -1168,7 +1167,7 @@ void SkiaRenderEngine::drawLayersInternal( canvas->drawRect(bounds.rect(), paint); } if (kGaneshFlushAfterEveryLayer) { - ATRACE_NAME("flush surface"); + SFTRACE_NAME("flush surface"); // No-op in Graphite. If "flushing" Skia's drawing commands after each layer is desired // in Graphite, then a graphite::Recording would need to be snapped and tracked for each // layer, which is likely possible but adds non-trivial complexity (in both bookkeeping @@ -1183,7 +1182,7 @@ void SkiaRenderEngine::drawLayersInternal( LOG_ALWAYS_FATAL_IF(activeSurface != dstSurface); auto drawFence = sp<Fence>::make(flushAndSubmit(context, dstSurface)); - if (ATRACE_ENABLED()) { + if (SFTRACE_ENABLED()) { static gui::FenceMonitor sMonitor("RE Completion"); sMonitor.queueFence(drawFence); } @@ -1201,7 +1200,7 @@ size_t SkiaRenderEngine::getMaxViewportDims() const { void SkiaRenderEngine::drawShadow(SkCanvas* canvas, const SkRRect& casterRRect, const ShadowSettings& settings) { - ATRACE_CALL(); + SFTRACE_CALL(); const float casterZ = settings.length / 2.0f; const auto flags = settings.casterIsTranslucent ? kTransparentOccluder_ShadowFlag : kNone_ShadowFlag; diff --git a/libs/renderengine/skia/SkiaVkRenderEngine.cpp b/libs/renderengine/skia/SkiaVkRenderEngine.cpp index a1f917dc03..d89e818cdc 100644 --- a/libs/renderengine/skia/SkiaVkRenderEngine.cpp +++ b/libs/renderengine/skia/SkiaVkRenderEngine.cpp @@ -32,9 +32,8 @@ #include <vk/GrVkTypes.h> #include <android-base/stringprintf.h> -#include <gui/TraceUtils.h> +#include <common/trace.h> #include <sync/sync.h> -#include <utils/Trace.h> #include <memory> #include <string> diff --git a/libs/renderengine/skia/compat/GaneshBackendTexture.cpp b/libs/renderengine/skia/compat/GaneshBackendTexture.cpp index d246466965..3fbc6ca22e 100644 --- a/libs/renderengine/skia/compat/GaneshBackendTexture.cpp +++ b/libs/renderengine/skia/compat/GaneshBackendTexture.cpp @@ -32,15 +32,15 @@ #include "skia/compat/SkiaBackendTexture.h" #include <android/hardware_buffer.h> +#include <common/trace.h> #include <log/log_main.h> -#include <utils/Trace.h> namespace android::renderengine::skia { GaneshBackendTexture::GaneshBackendTexture(sk_sp<GrDirectContext> grContext, AHardwareBuffer* buffer, bool isOutputBuffer) : SkiaBackendTexture(buffer, isOutputBuffer), mGrContext(grContext) { - ATRACE_CALL(); + SFTRACE_CALL(); AHardwareBuffer_Desc desc; AHardwareBuffer_describe(buffer, &desc); const bool createProtectedImage = 0 != (desc.usage & AHARDWAREBUFFER_USAGE_PROTECTED_CONTENT); diff --git a/libs/renderengine/skia/compat/GraphiteBackendTexture.cpp b/libs/renderengine/skia/compat/GraphiteBackendTexture.cpp index 3dd9ed242e..a6e93ba7e0 100644 --- a/libs/renderengine/skia/compat/GraphiteBackendTexture.cpp +++ b/libs/renderengine/skia/compat/GraphiteBackendTexture.cpp @@ -28,16 +28,16 @@ #include "skia/ColorSpaces.h" #include <android/hardware_buffer.h> +#include <common/trace.h> #include <inttypes.h> #include <log/log_main.h> -#include <utils/Trace.h> namespace android::renderengine::skia { GraphiteBackendTexture::GraphiteBackendTexture(std::shared_ptr<skgpu::graphite::Recorder> recorder, AHardwareBuffer* buffer, bool isOutputBuffer) : SkiaBackendTexture(buffer, isOutputBuffer), mRecorder(std::move(recorder)) { - ATRACE_CALL(); + SFTRACE_CALL(); AHardwareBuffer_Desc desc; AHardwareBuffer_describe(buffer, &desc); const bool createProtectedImage = 0 != (desc.usage & AHARDWAREBUFFER_USAGE_PROTECTED_CONTENT); diff --git a/libs/renderengine/skia/debug/CommonPool.cpp b/libs/renderengine/skia/debug/CommonPool.cpp index bf15300227..9d7c69b019 100644 --- a/libs/renderengine/skia/debug/CommonPool.cpp +++ b/libs/renderengine/skia/debug/CommonPool.cpp @@ -20,8 +20,8 @@ #define LOG_TAG "RenderEngine" #define ATRACE_TAG ATRACE_TAG_GRAPHICS +#include <common/trace.h> #include <sys/resource.h> -#include <utils/Trace.h> #include <system/thread_defs.h> #include <array> @@ -31,7 +31,7 @@ namespace renderengine { namespace skia { CommonPool::CommonPool() { - ATRACE_CALL(); + SFTRACE_CALL(); CommonPool* pool = this; // Create 2 workers diff --git a/libs/renderengine/skia/debug/SkiaCapture.cpp b/libs/renderengine/skia/debug/SkiaCapture.cpp index e778884629..e6a0e22dcf 100644 --- a/libs/renderengine/skia/debug/SkiaCapture.cpp +++ b/libs/renderengine/skia/debug/SkiaCapture.cpp @@ -22,9 +22,9 @@ #include <android-base/properties.h> #include <android-base/stringprintf.h> +#include <common/trace.h> #include <log/log.h> #include <renderengine/RenderEngine.h> -#include <utils/Trace.h> #include "CommonPool.h" #include "SkCanvas.h" @@ -48,7 +48,7 @@ SkiaCapture::~SkiaCapture() { } SkCanvas* SkiaCapture::tryCapture(SkSurface* surface) NO_THREAD_SAFETY_ANALYSIS { - ATRACE_CALL(); + SFTRACE_CALL(); // If we are not running yet, set up. if (CC_LIKELY(!mCaptureRunning)) { @@ -86,7 +86,7 @@ SkCanvas* SkiaCapture::tryCapture(SkSurface* surface) NO_THREAD_SAFETY_ANALYSIS } void SkiaCapture::endCapture() NO_THREAD_SAFETY_ANALYSIS { - ATRACE_CALL(); + SFTRACE_CALL(); // Don't end anything if we are not running. if (CC_LIKELY(!mCaptureRunning)) { return; @@ -102,7 +102,7 @@ void SkiaCapture::endCapture() NO_THREAD_SAFETY_ANALYSIS { } SkCanvas* SkiaCapture::tryOffscreenCapture(SkSurface* surface, OffscreenState* state) { - ATRACE_CALL(); + SFTRACE_CALL(); // Don't start anything if we are not running. if (CC_LIKELY(!mCaptureRunning)) { return surface->getCanvas(); @@ -122,7 +122,7 @@ SkCanvas* SkiaCapture::tryOffscreenCapture(SkSurface* surface, OffscreenState* s } uint64_t SkiaCapture::endOffscreenCapture(OffscreenState* state) { - ATRACE_CALL(); + SFTRACE_CALL(); // Don't end anything if we are not running. if (CC_LIKELY(!mCaptureRunning)) { return 0; @@ -151,7 +151,7 @@ uint64_t SkiaCapture::endOffscreenCapture(OffscreenState* state) { } void SkiaCapture::writeToFile() { - ATRACE_CALL(); + SFTRACE_CALL(); // Pass mMultiPic and mOpenMultiPicStream to a background thread, which will // handle the heavyweight serialization work and destroy them. // mOpenMultiPicStream is released to a bare pointer because keeping it in @@ -169,7 +169,7 @@ void SkiaCapture::writeToFile() { } bool SkiaCapture::setupMultiFrameCapture() { - ATRACE_CALL(); + SFTRACE_CALL(); ALOGD("Set up multi-frame capture, ms = %llu", mTimerInterval.count()); base::SetProperty(PROPERTY_DEBUG_RENDERENGINE_CAPTURE_FILENAME, ""); diff --git a/libs/renderengine/skia/filters/BlurFilter.cpp b/libs/renderengine/skia/filters/BlurFilter.cpp index 1e0c4cf9d0..cd1bd71807 100644 --- a/libs/renderengine/skia/filters/BlurFilter.cpp +++ b/libs/renderengine/skia/filters/BlurFilter.cpp @@ -25,8 +25,8 @@ #include <SkString.h> #include <SkSurface.h> #include <SkTileMode.h> +#include <common/trace.h> #include <log/log.h> -#include <utils/Trace.h> namespace android { namespace renderengine { @@ -79,7 +79,7 @@ void BlurFilter::drawBlurRegion(SkCanvas* canvas, const SkRRect& effectRegion, const uint32_t blurRadius, const float blurAlpha, const SkRect& blurRect, sk_sp<SkImage> blurredImage, sk_sp<SkImage> input) { - ATRACE_CALL(); + SFTRACE_CALL(); SkPaint paint; paint.setAlphaf(blurAlpha); diff --git a/libs/renderengine/skia/filters/GaussianBlurFilter.cpp b/libs/renderengine/skia/filters/GaussianBlurFilter.cpp index c9499cbc24..8c52c571a9 100644 --- a/libs/renderengine/skia/filters/GaussianBlurFilter.cpp +++ b/libs/renderengine/skia/filters/GaussianBlurFilter.cpp @@ -19,18 +19,18 @@ #include "GaussianBlurFilter.h" #include <SkBlendMode.h> #include <SkCanvas.h> +#include <SkImageFilters.h> #include <SkPaint.h> #include <SkRRect.h> #include <SkRuntimeEffect.h> -#include <SkImageFilters.h> #include <SkSize.h> #include <SkString.h> #include <SkSurface.h> #include <SkTileMode.h> +#include <common/trace.h> #include <include/gpu/ganesh/SkSurfaceGanesh.h> -#include "include/gpu/GpuTypes.h" // from Skia #include <log/log.h> -#include <utils/Trace.h> +#include "include/gpu/GpuTypes.h" // from Skia namespace android { namespace renderengine { diff --git a/libs/renderengine/skia/filters/KawaseBlurFilter.cpp b/libs/renderengine/skia/filters/KawaseBlurFilter.cpp index 7a070d7024..defaf6e476 100644 --- a/libs/renderengine/skia/filters/KawaseBlurFilter.cpp +++ b/libs/renderengine/skia/filters/KawaseBlurFilter.cpp @@ -29,10 +29,10 @@ #include <SkString.h> #include <SkSurface.h> #include <SkTileMode.h> +#include <common/trace.h> #include <include/gpu/GpuTypes.h> #include <include/gpu/ganesh/SkSurfaceGanesh.h> #include <log/log.h> -#include <utils/Trace.h> namespace android { namespace renderengine { diff --git a/libs/renderengine/skia/filters/LinearEffect.cpp b/libs/renderengine/skia/filters/LinearEffect.cpp index f7dcd3a6e1..3bc3564f4c 100644 --- a/libs/renderengine/skia/filters/LinearEffect.cpp +++ b/libs/renderengine/skia/filters/LinearEffect.cpp @@ -19,9 +19,9 @@ #define ATRACE_TAG ATRACE_TAG_GRAPHICS #include <SkString.h> +#include <common/trace.h> #include <log/log.h> #include <shaders/shaders.h> -#include <utils/Trace.h> #include <math/mat4.h> @@ -30,7 +30,7 @@ namespace renderengine { namespace skia { sk_sp<SkRuntimeEffect> buildRuntimeEffect(const shaders::LinearEffect& linearEffect) { - ATRACE_CALL(); + SFTRACE_CALL(); SkString shaderString = SkString(shaders::buildLinearEffectSkSL(linearEffect)); auto [shader, error] = SkRuntimeEffect::MakeForShader(shaderString); @@ -45,7 +45,7 @@ sk_sp<SkShader> createLinearEffectShader( sk_sp<SkRuntimeEffect> runtimeEffect, const mat4& colorTransform, float maxDisplayLuminance, float currentDisplayLuminanceNits, float maxLuminance, AHardwareBuffer* buffer, aidl::android::hardware::graphics::composer3::RenderIntent renderIntent) { - ATRACE_CALL(); + SFTRACE_CALL(); SkRuntimeShaderBuilder effectBuilder(runtimeEffect); effectBuilder.child("child") = shader; diff --git a/libs/renderengine/tests/Android.bp b/libs/renderengine/tests/Android.bp index 0783714eb9..7fbbf49586 100644 --- a/libs/renderengine/tests/Android.bp +++ b/libs/renderengine/tests/Android.bp @@ -66,5 +66,6 @@ cc_test { "libutils", "server_configurable_flags", "libaconfig_storage_read_api_cc", + "libtracing_perfetto", ], } diff --git a/libs/renderengine/threaded/RenderEngineThreaded.cpp b/libs/renderengine/threaded/RenderEngineThreaded.cpp index d27c151e72..f5a90fdcfd 100644 --- a/libs/renderengine/threaded/RenderEngineThreaded.cpp +++ b/libs/renderengine/threaded/RenderEngineThreaded.cpp @@ -23,9 +23,9 @@ #include <future> #include <android-base/stringprintf.h> +#include <common/trace.h> #include <private/gui/SyncFeatures.h> #include <processgroup/processgroup.h> -#include <utils/Trace.h> using namespace std::chrono_literals; @@ -39,7 +39,7 @@ std::unique_ptr<RenderEngineThreaded> RenderEngineThreaded::create(CreateInstanc RenderEngineThreaded::RenderEngineThreaded(CreateInstanceFactory factory) : RenderEngine(Threaded::YES) { - ATRACE_CALL(); + SFTRACE_CALL(); std::lock_guard lockThread(mThreadMutex); mThread = std::thread(&RenderEngineThreaded::threadMain, this, factory); @@ -76,7 +76,7 @@ status_t RenderEngineThreaded::setSchedFifo(bool enabled) { // NO_THREAD_SAFETY_ANALYSIS is because std::unique_lock presently lacks thread safety annotations. void RenderEngineThreaded::threadMain(CreateInstanceFactory factory) NO_THREAD_SAFETY_ANALYSIS { - ATRACE_CALL(); + SFTRACE_CALL(); if (!SetTaskProfiles(0, {"SFRenderEnginePolicy"})) { ALOGW("Failed to set render-engine task profile!"); @@ -133,13 +133,13 @@ void RenderEngineThreaded::waitUntilInitialized() const { std::future<void> RenderEngineThreaded::primeCache(PrimeCacheConfig config) { const auto resultPromise = std::make_shared<std::promise<void>>(); std::future<void> resultFuture = resultPromise->get_future(); - ATRACE_CALL(); + SFTRACE_CALL(); // This function is designed so it can run asynchronously, so we do not need to wait // for the futures. { std::lock_guard lock(mThreadMutex); mFunctionCalls.push([resultPromise, config](renderengine::RenderEngine& instance) { - ATRACE_NAME("REThreaded::primeCache"); + SFTRACE_NAME("REThreaded::primeCache"); if (setSchedFifo(false) != NO_ERROR) { ALOGW("Couldn't set SCHED_OTHER for primeCache"); } @@ -163,7 +163,7 @@ void RenderEngineThreaded::dump(std::string& result) { { std::lock_guard lock(mThreadMutex); mFunctionCalls.push([&resultPromise, &result](renderengine::RenderEngine& instance) { - ATRACE_NAME("REThreaded::dump"); + SFTRACE_NAME("REThreaded::dump"); std::string localResult = result; instance.dump(localResult); resultPromise.set_value(std::move(localResult)); @@ -176,13 +176,13 @@ void RenderEngineThreaded::dump(std::string& result) { void RenderEngineThreaded::mapExternalTextureBuffer(const sp<GraphicBuffer>& buffer, bool isRenderable) { - ATRACE_CALL(); + SFTRACE_CALL(); // This function is designed so it can run asynchronously, so we do not need to wait // for the futures. { std::lock_guard lock(mThreadMutex); mFunctionCalls.push([=](renderengine::RenderEngine& instance) { - ATRACE_NAME("REThreaded::mapExternalTextureBuffer"); + SFTRACE_NAME("REThreaded::mapExternalTextureBuffer"); instance.mapExternalTextureBuffer(buffer, isRenderable); }); } @@ -190,14 +190,14 @@ void RenderEngineThreaded::mapExternalTextureBuffer(const sp<GraphicBuffer>& buf } void RenderEngineThreaded::unmapExternalTextureBuffer(sp<GraphicBuffer>&& buffer) { - ATRACE_CALL(); + SFTRACE_CALL(); // This function is designed so it can run asynchronously, so we do not need to wait // for the futures. { std::lock_guard lock(mThreadMutex); mFunctionCalls.push( [=, buffer = std::move(buffer)](renderengine::RenderEngine& instance) mutable { - ATRACE_NAME("REThreaded::unmapExternalTextureBuffer"); + SFTRACE_NAME("REThreaded::unmapExternalTextureBuffer"); instance.unmapExternalTextureBuffer(std::move(buffer)); }); } @@ -229,7 +229,7 @@ void RenderEngineThreaded::cleanupPostRender() { { std::lock_guard lock(mThreadMutex); mFunctionCalls.push([=](renderengine::RenderEngine& instance) { - ATRACE_NAME("REThreaded::cleanupPostRender"); + SFTRACE_NAME("REThreaded::cleanupPostRender"); instance.cleanupPostRender(); }); mNeedsPostRenderCleanup = false; @@ -252,7 +252,7 @@ void RenderEngineThreaded::drawLayersInternal( ftl::Future<FenceResult> RenderEngineThreaded::drawLayers( const DisplaySettings& display, const std::vector<LayerSettings>& layers, const std::shared_ptr<ExternalTexture>& buffer, base::unique_fd&& bufferFence) { - ATRACE_CALL(); + SFTRACE_CALL(); const auto resultPromise = std::make_shared<std::promise<FenceResult>>(); std::future<FenceResult> resultFuture = resultPromise->get_future(); int fd = bufferFence.release(); @@ -261,7 +261,7 @@ ftl::Future<FenceResult> RenderEngineThreaded::drawLayers( mNeedsPostRenderCleanup = true; mFunctionCalls.push( [resultPromise, display, layers, buffer, fd](renderengine::RenderEngine& instance) { - ATRACE_NAME("REThreaded::drawLayers"); + SFTRACE_NAME("REThreaded::drawLayers"); instance.updateProtectedContext(layers, buffer); instance.drawLayersInternal(std::move(resultPromise), display, layers, buffer, base::unique_fd(fd)); @@ -277,7 +277,7 @@ int RenderEngineThreaded::getContextPriority() { { std::lock_guard lock(mThreadMutex); mFunctionCalls.push([&resultPromise](renderengine::RenderEngine& instance) { - ATRACE_NAME("REThreaded::getContextPriority"); + SFTRACE_NAME("REThreaded::getContextPriority"); int priority = instance.getContextPriority(); resultPromise.set_value(priority); }); @@ -297,7 +297,7 @@ void RenderEngineThreaded::onActiveDisplaySizeChanged(ui::Size size) { { std::lock_guard lock(mThreadMutex); mFunctionCalls.push([size](renderengine::RenderEngine& instance) { - ATRACE_NAME("REThreaded::onActiveDisplaySizeChanged"); + SFTRACE_NAME("REThreaded::onActiveDisplaySizeChanged"); instance.onActiveDisplaySizeChanged(size); }); } @@ -324,7 +324,7 @@ void RenderEngineThreaded::setEnableTracing(bool tracingEnabled) { { std::lock_guard lock(mThreadMutex); mFunctionCalls.push([tracingEnabled](renderengine::RenderEngine& instance) { - ATRACE_NAME("REThreaded::setEnableTracing"); + SFTRACE_NAME("REThreaded::setEnableTracing"); instance.setEnableTracing(tracingEnabled); }); } |