[M120 Migration][VD] Enable direct rendering for TVPlus 71/309471/2 submit/tizen/20240412.160015
authorwangjing <jing124.wang@samsung.com>
Thu, 11 Apr 2024 06:46:05 +0000 (14:46 +0800)
committerBot Blink <blinkbot@samsung.com>
Fri, 12 Apr 2024 12:26:43 +0000 (12:26 +0000)
This patch enables direct rendering for TVPlus app,
which is using HbbTV runtime.

1. Enable direct rendering by appending EVAS_GL_OPTIONS_DIRECT
2. Do not set evas_object_image_alpha_set
   reason: not needed when direct mode
3. Remove glFinish
   reason: not needed when direct mode
4. Set evas_object_render_op_set
   reason: EFL skips glClear when direct mode and alpha disabled,
   so setting this can force EFL to do glClear
   (if this is not appended, TVPlus won't disappear when exit)

Now most app only need RGB888 mode, HBBTV need to
set RGBA8888 can make the background transparent.

Ref:
https://review.tizen.org/gerrit/#/c/292457/
https://review.tizen.org/gerrit/#/c/291335/

Change-Id: I46802831f41671b569592bc68bd30a6fc80995ab
Signed-off-by: wangjing <jing124.wang@samsung.com>
content/browser/renderer_host/navigation_entry_impl.cc
third_party/blink/public/platform/web_application_type.h
tizen_src/chromium_impl/content/browser/renderer_host/rwhv_aura_offscreen_helper_efl.cc
tizen_src/chromium_impl/third_party/blink/renderer/platform/web_application_type.cc
tizen_src/ewk/efl_integration/common/application_type.cc
tizen_src/ewk/efl_integration/common/application_type.h
tizen_src/ewk/efl_integration/eweb_view.cc

index ab68309..a018fca 100644 (file)
 #include "base/android/content_uri_utils.h"
 #endif
 
+#if BUILDFLAG(IS_TIZEN_TV)
+#include "third_party/blink/public/platform/web_application_type.h"
+#endif
+
 using base::UTF16ToUTF8;
 
 namespace content {
@@ -497,6 +501,9 @@ const Referrer& NavigationEntryImpl::GetReferrer() {
 void NavigationEntryImpl::SetVirtualURL(const GURL& url) {
   virtual_url_ = (url == GetURL()) ? GURL() : url;
   cached_display_title_.clear();
+#if BUILDFLAG(IS_TIZEN_TV)
+  blink::SetURLType(url.spec());
+#endif
 }
 
 const GURL& NavigationEntryImpl::GetVirtualURL() {
index 461c732..ecdc71a 100644 (file)
@@ -5,6 +5,8 @@
 #ifndef WEB_APPLICATION_TYPE_H_
 #define WEB_APPLICATION_TYPE_H_
 
+#include <string>
+
 namespace blink {
 
 enum class ApplicationType : unsigned {
@@ -14,12 +16,16 @@ enum class ApplicationType : unsigned {
   OTHER
 };
 
+enum class URLType : unsigned { TVPLUS = 0, OTHER };
+
 void SetApplicationType(const ApplicationType appType);
 void SetSupportRGBA(bool use_rgba);
+void SetURLType(const std::string& url);
 bool IsSupportRGBA();
 bool IsWebBrowser();
 bool IsHbbTV();
 bool IsTIZENWRT();
+bool IsTVPlus();
 
 }  // namespace blink
 
index c4368ce..ecb434a 100644 (file)
@@ -486,8 +486,24 @@ void RWHVAuraOffscreenHelperEfl::InitEvasGL() {
   evas_gl_config_->stencil_bits = EVAS_GL_STENCIL_BIT_8;
 
 #if BUILDFLAG(IS_TIZEN_TV)
-  if (!blink::IsSupportRGBA())
-    evas_gl_config_->color_format = EVAS_GL_RGB_888;
+  if (blink::IsHbbTV()) {
+    if (blink::IsTVPlus()) {
+      evas_gl_config_->options_bits =
+          (Evas_GL_Options_Bits)(EVAS_GL_OPTIONS_DIRECT |
+                                 EVAS_GL_OPTIONS_DIRECT_MEMORY_OPTIMIZE |
+                                 EVAS_GL_OPTIONS_DIRECT_OVERRIDE);
+    } else {
+      evas_gl_config_->options_bits =
+          (Evas_GL_Options_Bits)(EVAS_GL_OPTIONS_NONE);
+    }
+
+    LOG(INFO) << "Disable depth/stencil bits when HBBTV";
+    evas_gl_config_->depth_bits = EVAS_GL_DEPTH_NONE;
+    evas_gl_config_->stencil_bits = EVAS_GL_STENCIL_NONE;
+  } else {
+    if (!blink::IsSupportRGBA())
+      evas_gl_config_->color_format = EVAS_GL_RGB_888;
+  }
 #endif
 
   evas_gl_ = evas_gl_new(evas_);
@@ -536,6 +552,12 @@ gfx::Size RWHVAuraOffscreenHelperEfl::CreateNativeSurface() {
   evas_object_geometry_set(content_image_, x, y, width, height);
   evas_object_geometry_set(content_image_elm_host_, x, y, width, height);
 
+#if BUILDFLAG(IS_TIZEN_TV)
+  if (blink::IsTVPlus()) {
+    evas_object_render_op_set(content_image_, EVAS_RENDER_COPY);
+  }
+#endif
+
   if (use_hw_backend_) {
     if (evas_gl_surface_) {
       evas_object_image_native_surface_set(content_image_, NULL);
index 297c231..9d98629 100644 (file)
@@ -8,6 +8,7 @@ namespace blink {
 
 namespace {
 ApplicationType s_applicationType = ApplicationType::WEBBROWSER;
+URLType s_urlType = URLType::OTHER;
 bool use_RGBA_mode = false;
 }  // namespace
 
@@ -15,6 +16,15 @@ void SetApplicationType(const ApplicationType appType) {
   s_applicationType = appType;
 }
 
+void SetURLType(const std::string& url) {
+  // TVPlusURL check code should be synchronized with HbbTV
+  std::string tvplus_path("/home/owner/apps_rw/com.samsung.tv.tvplus");
+  if (url.find(tvplus_path) != std::string::npos)
+    s_urlType = URLType::TVPLUS;
+  else
+    s_urlType = URLType::OTHER;
+}
+
 void SetSupportRGBA(bool use_rgba) {
   use_RGBA_mode = use_rgba;
 }
@@ -31,6 +41,13 @@ bool IsHbbTV() {
   return s_applicationType == ApplicationType::HBBTV;
 }
 
+bool IsTVPlus() {
+  if (!IsHbbTV())
+    return false;
+
+  return s_urlType == URLType::TVPLUS;
+}
+
 bool IsTIZENWRT() {
   return s_applicationType == ApplicationType::TIZENWRT;
 }
index 41a87d3..df6ef42 100644 (file)
@@ -24,6 +24,10 @@ void SetApplicationType(const ApplicationType app_type) {
   blink::SetApplicationType(static_cast<blink::ApplicationType>(app_type));
 }
 
+void SetURLType(const std::string& url) {
+  blink::SetURLType(url);
+}
+
 void SetSupportRGBA(bool use_rgba) {
   blink::SetSupportRGBA(use_rgba);
 }
@@ -40,6 +44,10 @@ bool IsHbbTV() {
   return blink::IsHbbTV();
 }
 
+bool IsTVPlus() {
+  return blink::IsTVPlus();
+}
+
 bool IsTIZENWRT() {
   return blink::IsTIZENWRT();
 }
index 3505755..7283e83 100644 (file)
@@ -6,6 +6,8 @@
 #ifndef APPLICATION_TYPE_H_
 #define APPLICATION_TYPE_H_
 
+#include <string>
+
 namespace content {
 
 enum class ApplicationType : unsigned {
@@ -16,10 +18,12 @@ enum class ApplicationType : unsigned {
 };
 
 void SetApplicationType(const ApplicationType app_type);
+void SetURLType(const std::string& url);
 void SetSupportRGBA(bool use_rgba);
 bool IsSupportRGBA();
 bool IsWebBrowser();
 bool IsHbbTV();
 bool IsTIZENWRT();
+bool IsTVPlus();
 }  // namespace content
 #endif  // APPLICATION_TYPE_H_
index a837f40..70d210d 100644 (file)
@@ -2451,8 +2451,14 @@ bool EWebView::SetDrawsTransparentBackground(bool enabled) {
     return false;
   elm_object_style_set(rwhva()->offscreen_helper()->content_image_elm_host(),
                        enabled ? "transparent" : "default");
+#if BUILDFLAG(IS_TIZEN_TV)
+  if (!IsTVPlus())
+    evas_object_image_alpha_set(rwhva()->offscreen_helper()->content_image(),
+                                enabled);
+#else
   evas_object_image_alpha_set(rwhva()->offscreen_helper()->content_image(),
                               enabled);
+#endif
   GetWebContentsViewAura()->SetBackgroundColor(enabled ? SK_ColorTRANSPARENT
                                                        : SK_ColorWHITE);
   static_cast<RenderViewHostImpl*>(render_view_host)
@@ -2487,8 +2493,14 @@ bool EWebView::SetBackgroundColor(int red, int green, int blue, int alpha) {
     return false;
   elm_object_style_set(rwhva()->offscreen_helper()->content_image_elm_host(),
                        alpha < 255 ? "transparent" : "default");
+#if BUILDFLAG(IS_TIZEN_TV)
+  if (!IsTVPlus())
+    evas_object_image_alpha_set(rwhva()->offscreen_helper()->content_image(),
+                                alpha < 255);
+#else
   evas_object_image_alpha_set(rwhva()->offscreen_helper()->content_image(),
                               alpha < 255);
+#endif
   GetWebContentsViewAura()->SetBackgroundColor(
       SkColorSetARGB(alpha, red, green, blue));
   static_cast<RenderViewHostImpl*>(render_view_host)