Loading libs/renderengine/skia/Cache.cpp +55 −48 Original line number Diff line number Diff line Loading @@ -238,9 +238,14 @@ void Cache::primeShaderCache(SkiaRenderEngine* renderengine) { if (previousCount) { ALOGD("%d Shaders already compiled before Cache::primeShaderCache ran\n", previousCount); } // The loop is beneficial for debugging and should otherwise be optimized out by the compiler. // Adding additional bounds to the loop is useful for verifying that the size of the dst buffer // does not impact the shader compilation counts by triggering different behaviors in RE/Skia. for (SkSize bounds : {SkSize::Make(128, 128), /*SkSize::Make(1080, 2340)*/}) { const nsecs_t timeBefore = systemTime(); // The dimensions should not matter, so long as we draw inside them. const Rect displayRect(0, 0, 1080, 2340); const Rect displayRect(0, 0, bounds.fWidth, bounds.fHeight); DisplaySettings display{ .physicalDisplay = displayRect, .clip = displayRect, Loading @@ -251,18 +256,19 @@ void Cache::primeShaderCache(SkiaRenderEngine* renderengine) { const int64_t usage = GRALLOC_USAGE_HW_RENDER | GRALLOC_USAGE_HW_TEXTURE; sp<GraphicBuffer> dstBuffer = new GraphicBuffer(displayRect.width(), displayRect.height(), PIXEL_FORMAT_RGBA_8888, 1, usage, "primeShaderCache_dst"); new GraphicBuffer(displayRect.width(), displayRect.height(), PIXEL_FORMAT_RGBA_8888, 1, usage, "primeShaderCache_dst"); const auto dstTexture = std::make_shared<ExternalTexture>(dstBuffer, *renderengine, const auto dstTexture = std::make_shared<ExternalTexture>(dstBuffer, *renderengine, ExternalTexture::Usage::WRITEABLE); // This buffer will be the source for the call to drawImageLayers. Draw // something to it as a placeholder for what an app draws. We should draw // something, but the details are not important. Make use of the shadow layer drawing step // to populate it. sp<GraphicBuffer> srcBuffer = new GraphicBuffer(displayRect.width(), displayRect.height(), PIXEL_FORMAT_RGBA_8888, 1, usage, "drawImageLayer_src"); new GraphicBuffer(displayRect.width(), displayRect.height(), PIXEL_FORMAT_RGBA_8888, 1, usage, "drawImageLayer_src"); const auto srcTexture = std::make_shared<ExternalTexture>(srcBuffer, *renderengine, Loading @@ -279,8 +285,8 @@ void Cache::primeShaderCache(SkiaRenderEngine* renderengine) { const int64_t usageExternal = GRALLOC_USAGE_HW_TEXTURE; sp<GraphicBuffer> externalBuffer = new GraphicBuffer(displayRect.width(), displayRect.height(), PIXEL_FORMAT_RGBA_8888, 1, usageExternal, "primeShaderCache_external"); new GraphicBuffer(displayRect.width(), displayRect.height(), PIXEL_FORMAT_RGBA_8888, 1, usageExternal, "primeShaderCache_external"); const auto externalTexture = std::make_shared<ExternalTexture>(externalBuffer, *renderengine, ExternalTexture::Usage::READABLE); Loading @@ -296,5 +302,6 @@ void Cache::primeShaderCache(SkiaRenderEngine* renderengine) { const int shadersCompiled = renderengine->reportShadersCompiled(); ALOGD("Shader cache generated %d shaders in %f ms\n", shadersCompiled, compileTimeMs); } } } // namespace android::renderengine::skia Loading
libs/renderengine/skia/Cache.cpp +55 −48 Original line number Diff line number Diff line Loading @@ -238,9 +238,14 @@ void Cache::primeShaderCache(SkiaRenderEngine* renderengine) { if (previousCount) { ALOGD("%d Shaders already compiled before Cache::primeShaderCache ran\n", previousCount); } // The loop is beneficial for debugging and should otherwise be optimized out by the compiler. // Adding additional bounds to the loop is useful for verifying that the size of the dst buffer // does not impact the shader compilation counts by triggering different behaviors in RE/Skia. for (SkSize bounds : {SkSize::Make(128, 128), /*SkSize::Make(1080, 2340)*/}) { const nsecs_t timeBefore = systemTime(); // The dimensions should not matter, so long as we draw inside them. const Rect displayRect(0, 0, 1080, 2340); const Rect displayRect(0, 0, bounds.fWidth, bounds.fHeight); DisplaySettings display{ .physicalDisplay = displayRect, .clip = displayRect, Loading @@ -251,18 +256,19 @@ void Cache::primeShaderCache(SkiaRenderEngine* renderengine) { const int64_t usage = GRALLOC_USAGE_HW_RENDER | GRALLOC_USAGE_HW_TEXTURE; sp<GraphicBuffer> dstBuffer = new GraphicBuffer(displayRect.width(), displayRect.height(), PIXEL_FORMAT_RGBA_8888, 1, usage, "primeShaderCache_dst"); new GraphicBuffer(displayRect.width(), displayRect.height(), PIXEL_FORMAT_RGBA_8888, 1, usage, "primeShaderCache_dst"); const auto dstTexture = std::make_shared<ExternalTexture>(dstBuffer, *renderengine, const auto dstTexture = std::make_shared<ExternalTexture>(dstBuffer, *renderengine, ExternalTexture::Usage::WRITEABLE); // This buffer will be the source for the call to drawImageLayers. Draw // something to it as a placeholder for what an app draws. We should draw // something, but the details are not important. Make use of the shadow layer drawing step // to populate it. sp<GraphicBuffer> srcBuffer = new GraphicBuffer(displayRect.width(), displayRect.height(), PIXEL_FORMAT_RGBA_8888, 1, usage, "drawImageLayer_src"); new GraphicBuffer(displayRect.width(), displayRect.height(), PIXEL_FORMAT_RGBA_8888, 1, usage, "drawImageLayer_src"); const auto srcTexture = std::make_shared<ExternalTexture>(srcBuffer, *renderengine, Loading @@ -279,8 +285,8 @@ void Cache::primeShaderCache(SkiaRenderEngine* renderengine) { const int64_t usageExternal = GRALLOC_USAGE_HW_TEXTURE; sp<GraphicBuffer> externalBuffer = new GraphicBuffer(displayRect.width(), displayRect.height(), PIXEL_FORMAT_RGBA_8888, 1, usageExternal, "primeShaderCache_external"); new GraphicBuffer(displayRect.width(), displayRect.height(), PIXEL_FORMAT_RGBA_8888, 1, usageExternal, "primeShaderCache_external"); const auto externalTexture = std::make_shared<ExternalTexture>(externalBuffer, *renderengine, ExternalTexture::Usage::READABLE); Loading @@ -296,5 +302,6 @@ void Cache::primeShaderCache(SkiaRenderEngine* renderengine) { const int shadersCompiled = renderengine->reportShadersCompiled(); ALOGD("Shader cache generated %d shaders in %f ms\n", shadersCompiled, compileTimeMs); } } } // namespace android::renderengine::skia