Add NoRenderPush feature 13/223713/1
authorhyunho <hhstark.kang@samsung.com>
Mon, 3 Feb 2020 07:10:49 +0000 (16:10 +0900)
committerhyunho <hhstark.kang@samsung.com>
Mon, 3 Feb 2020 07:10:49 +0000 (16:10 +0900)
Change-Id: I6cb86fcbebc6f5ba962d71ad3043c12bbd709d71
Signed-off-by: hyunho <hhstark.kang@samsung.com>
screen_connector_remote_surface_evas/remote_surface_evas.cc
screen_connector_remote_surface_evas/remote_surface_evas.h
screen_connector_remote_surface_evas/remote_surface_evas_implementation.h

index 3636e757eb01e303c8226b933f53f8b5a094810c..c305d3721ac3c65ac6ce43fb0c149578a7a830b2 100644 (file)
@@ -16,6 +16,7 @@
 
 #include <dlog.h>
 #include <Ecore_Wl2.h>
+#include <glib.h>
 
 #include <memory>
 
@@ -51,7 +52,9 @@ RemoteSurfaceEvas::RemoteSurfaceEvas(int rid, const std::string& id,
       win_ctx_(new WindowContext()) {
 }
 
-RemoteSurfaceEvas::~RemoteSurfaceEvas() = default;
+RemoteSurfaceEvas::~RemoteSurfaceEvas() {
+  ClearNoRenderTimer();
+}
 RemoteSurfaceEvas::RemoteSurfaceEvas(RemoteSurfaceEvas&&) noexcept = default;
 RemoteSurfaceEvas& RemoteSurfaceEvas::operator=(
     RemoteSurfaceEvas&&) noexcept = default;
@@ -506,6 +509,7 @@ void RemoteSurfaceEvas::OnBufferChanged(int type, std::shared_ptr<WlBuffer> tbm,
   }
 
   impl_->img_tbm_->Update(tbm);
+  ClearNoRenderTimer();
   if (isAdded)
     OnEvasAdded(GetAppId(), GetInstId(), GetPid(), *(impl_->img_tbm_));
   else
@@ -527,6 +531,28 @@ void RemoteSurfaceEvas::OnEvasChanged(const std::string& appId,
                                       const EvasObject& image) {
 }
 
+void RemoteSurfaceEvas::ClearNoRenderTimer() {
+  if (impl_->no_render_timer_ > 0) {
+    elm_win_norender_pop(impl_->viewer_win_->GetRaw());
+    g_source_remove(impl_->no_render_timer_);
+    impl_->no_render_timer_ = 0;
+    LOGI("Clear no render push");
+  }
+}
+
+void RemoteSurfaceEvas::NoRenderPush(int timeout) {
+  LOGI("No render push start");
+  elm_win_norender_push(impl_->viewer_win_->GetRaw());
+  impl_->no_render_timer_ = g_timeout_add(timeout,
+      [](gpointer user_data)->gboolean {
+    RemoteSurfaceEvas* rs = static_cast<RemoteSurfaceEvas*>(user_data);
+    elm_win_norender_pop(rs->impl_->viewer_win_->GetRaw());
+    rs->impl_->no_render_timer_ = 0;
+    LOGW("No render push timeout!");
+    return G_SOURCE_REMOVE;
+  }, this);
+}
+
 void RemoteSurfaceEvas::Bind(const EvasObject& win) {
   struct wl_surface* surface;
   Ecore_Wl2_Window* wl_win;
index 69c67a998e24c7f5dd76edf6cec447c971c93b41..6e2a9025247c80c1a6e67dfcb27ef6771b779baf 100644 (file)
@@ -71,6 +71,8 @@ class EXPORT_API RemoteSurfaceEvas : public RemoteSurface, public IEvasEvent {
                      int pid, const EvasObject& image) override;
   void OnEvasChanged(const std::string& appId, const std::string& instId,
                      int pid, const EvasObject& image) override;
+  void ClearNoRenderTimer();
+  void NoRenderPush(int timeout);
 
  private:
   Visibility GetVisibility(unsigned int win);
index f0cd7eb8061d0952a4810996e8ef41ed8c408874..50314bd93c299eb6aec77e4d6bc929bdf3088830 100644 (file)
@@ -63,6 +63,7 @@ class RemoteSurfaceEvas::Impl : public Image::IEventListener {
   int prev_y_ = 0;
   RemoteSurfaceEvas* parent_;
   bool auto_visibility_ = true;
+  int no_render_timer_ = 0;
   bool mock_;
 };