From 207297b428e6e8e829b70b99038ff721a8a1e8e6 Mon Sep 17 00:00:00 2001 From: Qiang Ji Date: Mon, 4 Mar 2024 16:40:37 +0800 Subject: [PATCH] [M120 Migration] NUI related patch 1. Fix rotation issue for NUI app Ecore_Evas can't sense that NUI app has rotated, so get the wrong value from ecore_evas_rotation_get API refs: https://review.tizen.org/gerrit/#/c/platform/framework/web/chromium-efl/+/305631/ 2. Fix NUI video can't play issue NUI app use wayland window but video hole set as evas window default. refs: https://review.tizen.org/gerrit/#/c/platform/framework/web/chromium-efl/+/295315/ 3. Fix crash refs: https://review.tizen.org/gerrit/#/c/platform/framework/web/chromium-efl/+/297840/ Change-Id: Id043740ee26661581c754b5b2cbf71f65130f7ee Signed-off-by: Qiang Ji --- cc/trees/draw_property_utils.cc | 7 +++--- .../browser/web_contents/web_contents_view_aura.cc | 25 +++++++++++++++++++++- .../media/base/tizen/video_plane_controller.cc | 1 + .../media/base/tizen/video_plane_controller.h | 6 ++++++ .../media/filters/media_player_esplusplayer.cc | 3 ++- tizen_src/ewk/efl_integration/eweb_view.cc | 15 +++++++++++++ tizen_src/ewk/efl_integration/public/ewk_view.cc | 3 +++ 7 files changed, 55 insertions(+), 5 deletions(-) diff --git a/cc/trees/draw_property_utils.cc b/cc/trees/draw_property_utils.cc index f55ffb1..c17fc58 100644 --- a/cc/trees/draw_property_utils.cc +++ b/cc/trees/draw_property_utils.cc @@ -255,9 +255,10 @@ ConditionalClip ComputeAccumulatedClip(PropertyTrees* property_trees, // contributing layer that escapes clip, this will find the nearest ancestor // that doesn't. while (target_node->clip_id > clip_node->id || - property_trees->effect_tree() - .GetRenderSurface(target_node->id) - ->has_contributing_layer_that_escapes_clip()) { + (property_trees->effect_tree().GetRenderSurface(target_node->id) && + property_trees->effect_tree() + .GetRenderSurface(target_node->id) + ->has_contributing_layer_that_escapes_clip())) { target_node = effect_tree.Node(target_node->target_id); } diff --git a/content/browser/web_contents/web_contents_view_aura.cc b/content/browser/web_contents/web_contents_view_aura.cc index 4831918..ca6e320 100644 --- a/content/browser/web_contents/web_contents_view_aura.cc +++ b/content/browser/web_contents/web_contents_view_aura.cc @@ -96,6 +96,15 @@ #include "wrt/public/browser/wrt.h" #endif +#if BUILDFLAG(IS_TIZEN_TV) +#include "ewk/efl_integration/common/application_type.h" +#include "ui/ozone/platform/efl/efl_screen.h" +#endif + +#if defined(TIZEN_TBM_SUPPORT) +#include "ui/compositor/compositor.h" +#endif + namespace content { std::unique_ptr CreateWebContentsView( @@ -919,7 +928,21 @@ void WebContentsViewAura::Focus() { #if BUILDFLAG(IS_TIZEN) void WebContentsViewAura::SetOrientation(int orientation) { LOG(INFO) << __FUNCTION__ << " " << orientation; - NOTIMPLEMENTED(); + + RenderWidgetHostViewAura* rwhv_aura = static_cast( + web_contents_->GetRenderWidgetHostView()); + if (rwhv_aura) { +#if defined(TIZEN_TBM_SUPPORT) + if (rwhv_aura->GetCompositor() && + rwhv_aura->GetCompositor()->use_tbm_surface_for_offscreen_rendering()) { + display::DeviceDisplayInfoEfl display_info; + display_info.SetRotationDegrees(orientation); + } +#endif + } + + TRACE_EVENT1("viz", "WebContentsViewAura::SetOrientation", "orientation", orientation); + orientation_ = orientation; } #endif diff --git a/tizen_src/chromium_impl/media/base/tizen/video_plane_controller.cc b/tizen_src/chromium_impl/media/base/tizen/video_plane_controller.cc index 01f35de..582fbe1 100644 --- a/tizen_src/chromium_impl/media/base/tizen/video_plane_controller.cc +++ b/tizen_src/chromium_impl/media/base/tizen/video_plane_controller.cc @@ -13,6 +13,7 @@ namespace media { void* VideoPlaneController::main_window_handle_ = nullptr; VideoPlaneController::RenderingMode VideoPlaneController::rendering_mode_ = VideoPlaneController::RenderingMode::OFFSCREEN; +bool VideoPlaneController::use_wayland_window = false; VideoPlaneController::VideoPlaneController() : should_crop_video_(false) {} diff --git a/tizen_src/chromium_impl/media/base/tizen/video_plane_controller.h b/tizen_src/chromium_impl/media/base/tizen/video_plane_controller.h index ccfc550..3520722 100644 --- a/tizen_src/chromium_impl/media/base/tizen/video_plane_controller.h +++ b/tizen_src/chromium_impl/media/base/tizen/video_plane_controller.h @@ -26,6 +26,12 @@ class MEDIA_EXPORT VideoPlaneController { } static RenderingMode rendering_mode() { return rendering_mode_; } + static void set_use_wayland_window(bool use) { use_wayland_window = use; } + + static bool get_use_wayland_window() { return use_wayland_window; } + + static bool use_wayland_window; + VideoPlaneController(); virtual ~VideoPlaneController(); diff --git a/tizen_src/chromium_impl/media/filters/media_player_esplusplayer.cc b/tizen_src/chromium_impl/media/filters/media_player_esplusplayer.cc index 4afa7e3..d7bd803 100644 --- a/tizen_src/chromium_impl/media/filters/media_player_esplusplayer.cc +++ b/tizen_src/chromium_impl/media/filters/media_player_esplusplayer.cc @@ -1407,7 +1407,8 @@ void MediaPlayerESPlusPlayer::PrepareVideoHole() { LOG(INFO) << __func__ << " set ESPLUSPLAYER_DISPLAY_TYPE_OVERLAY"; int player_error = ESPLUSPLAYER_ERROR_TYPE_NONE; if (video_plane_controller_->rendering_mode() == - VideoPlaneController::RenderingMode::OFFSCREEN) { + VideoPlaneController::RenderingMode::OFFSCREEN && + !video_plane_controller_->get_use_wayland_window()) { player_error = esplusplayer_set_display( esplayer_, ESPLUSPLAYER_DISPLAY_TYPE_OVERLAY, video_plane_controller_->GetVideoPlaneHandle()); diff --git a/tizen_src/ewk/efl_integration/eweb_view.cc b/tizen_src/ewk/efl_integration/eweb_view.cc index 7e64d85..23037c1 100644 --- a/tizen_src/ewk/efl_integration/eweb_view.cc +++ b/tizen_src/ewk/efl_integration/eweb_view.cc @@ -166,6 +166,21 @@ void GetEinaRectFromGfxRect(const gfx::Rect& gfx_rect, #if BUILDFLAG(IS_TIZEN) static Eina_Bool RotateWindowCb(void* data, int type, void* event) { auto wv = static_cast(data); +#if defined(TIZEN_TBM_SUPPORT) + if (wv->rwhva() && wv->rwhva()->GetCompositor() && + wv->rwhva()->GetCompositor()->use_tbm_surface_for_offscreen_rendering()) { + Ecore_Wl2_Event_Window_Rotation* rotateEvent = + static_cast(event); + if (rotateEvent != nullptr) { + LOG(INFO) << "For NUI app, new ori " << rotateEvent->angle; + wv->SetOrientation(rotateEvent->angle); + } + return ECORE_CALLBACK_PASS_ON; + } +#endif + LOG(INFO) << "New ori " + << ecore_evas_rotation_get( + ecore_evas_ecore_evas_get(wv->GetEvas())); wv->SetOrientation( ecore_evas_rotation_get(ecore_evas_ecore_evas_get(wv->GetEvas()))); return ECORE_CALLBACK_PASS_ON; diff --git a/tizen_src/ewk/efl_integration/public/ewk_view.cc b/tizen_src/ewk/efl_integration/public/ewk_view.cc index a96a0cb..61f536b 100644 --- a/tizen_src/ewk/efl_integration/public/ewk_view.cc +++ b/tizen_src/ewk/efl_integration/public/ewk_view.cc @@ -1653,6 +1653,9 @@ void ewk_view_offscreen_rendering_enabled_set(Evas_Object* o, Eina_Bool enabled) #if defined(TIZEN_TBM_SUPPORT) EWK_VIEW_IMPL_GET_OR_RETURN(o, impl); impl->SetOffscreenRendering(enabled); +#if defined(TIZEN_VIDEO_HOLE) + media::VideoPlaneController::set_use_wayland_window(true); +#endif #else LOG_EWK_API_MOCKUP(); #endif -- 2.7.4