[M120 Migration][Canvas2D] Canvas performance. 74/306874/8
authorManjeet <manjeet.1@partner.samsung.com>
Wed, 28 Feb 2024 14:06:53 +0000 (19:36 +0530)
committerBot Blink <blinkbot@samsung.com>
Fri, 8 Mar 2024 07:41:19 +0000 (07:41 +0000)
This commit combines below commits,
4174fa41750  Enable MSAA sample count for Canvas2D.
a3077ed5b97  Disable periodic flush for canvas.

Performance(TV):
Ubrowser CanvasMark
Before:24.3
After:25.6

Reference:
https://review.tizen.org/gerrit/290940

Change-Id: Iea7060760bad7122dd5d5c8b948c96d5da8e73c5
Signed-off-by: Manjeet <manjeet.1@partner.samsung.com>
third_party/blink/renderer/platform/graphics/canvas_resource_provider.cc
tizen_src/ewk/efl_integration/command_line_efl.cc

index a3a080c..d4f9fb3 100644 (file)
 #include "third_party/skia/include/gpu/ganesh/gl/GrGLBackendSurface.h"
 #include "third_party/skia/include/gpu/gl/GrGLTypes.h"
 
+#if BUILDFLAG(IS_TIZEN)
+#define DISABLE_2D_CANVAS_AUTO_FLUSH
+#endif
+
 namespace blink {
 
 class FlushForImageListener {
@@ -569,9 +573,13 @@ class CanvasResourceProviderSharedImage : public CanvasResourceProvider {
 
     const auto props = GetSkSurfaceProps();
     if (is_accelerated_) {
+      int msaa_sample_count = 0;
+#if BUILDFLAG(IS_TIZEN)
+      msaa_sample_count = 4;
+#endif
       return SkSurfaces::WrapBackendTexture(
           GetGrContext(), CreateGrTextureForResource(), GetGrSurfaceOrigin(),
-          0 /* msaa_sample_count */, GetSkImageInfo().colorType(),
+          msaa_sample_count, GetSkImageInfo().colorType(),
           GetSkImageInfo().refColorSpace(), &props);
     }
 
@@ -1350,6 +1358,8 @@ void CanvasResourceProvider::EnsureSkiaCanvas() {
     return;
 
   cc::SkiaPaintCanvas::ContextFlushes context_flushes;
+
+#if !defined(DISABLE_2D_CANVAS_AUTO_FLUSH)
   if (IsAccelerated() && ContextProviderWrapper() &&
       !ContextProviderWrapper()
            ->ContextProvider()
@@ -1358,6 +1368,7 @@ void CanvasResourceProvider::EnsureSkiaCanvas() {
     context_flushes.enable = true;
     context_flushes.max_draws_before_flush = kMaxDrawsBeforeContextFlush;
   }
+#endif
   skia_canvas_ = std::make_unique<cc::SkiaPaintCanvas>(
       GetSkSurface()->getCanvas(), GetOrCreateCanvasImageProvider(),
       context_flushes);
index 2217514..6942111 100644 (file)
@@ -91,8 +91,6 @@ content::MainFunctionParams CommandLineEfl::GetDefaultPortParams() {
                                       "500");
   }
 #if !defined(EWK_BRINGUP)
-  p_command_line->AppendSwitchASCII(
-      switches::kAcceleratedCanvas2dMSAASampleCount, "4");
   p_command_line->AppendSwitch(switches::kEnableGestureTapHighlight);
   p_command_line->AppendSwitch(switches::kEnableSpatialNavigation);
   p_command_line->AppendSwitch(switches::kMainFrameResizesAreOrientationChanges);