remote_surface: do force offscreen render if remote surface requests 32/114032/2
authorMinJeong Kim <minjjj.kim@samsung.com>
Thu, 9 Feb 2017 13:00:02 +0000 (22:00 +0900)
committerMinJeong Kim <minjjj.kim@samsung.com>
Fri, 10 Feb 2017 04:05:47 +0000 (13:05 +0900)
1. Support tizen_remote_surface@remote_render_set
2. Add ec->exp_iconify.skip_by_remote flag
 We have determined skip iconify by checking ec->exp_iconify.skip_iconify flag,
and our new request wants to skip iconify policy. But we are not able to
maintain original value of ec->exp_iconify.skip_iconify if remote surface
overrides it. so new flag ec->exp_iconify.skip_by_remote flag is added
to NOT interrupt original icoinfy policy.

Change-Id: I99c925b7297e48cf347d681791c75597ad537384
Signed-off-by: MinJeong Kim <minjjj.kim@samsung.com>
src/bin/e_client.c
src/bin/e_client.h
src/bin/e_comp_wl_rsm.c
src/bin/e_policy.c
src/bin/e_policy_visibility.c
src/bin/e_policy_wl.c

index f02cff3d9776f5c2402d692eb6ac30a771b6a7e4..6c291649ac2f4d5d4bc0e1b5661b562cc5ebc6f5 100644 (file)
@@ -3650,6 +3650,7 @@ e_client_new(E_Pixmap *cp, int first_map, int internal)
    ec->exp_iconify.by_client = 0;
    ec->exp_iconify.not_raise = 0;
    ec->exp_iconify.skip_iconify = 0;
+   ec->exp_iconify.skip_by_remote = 0;
 
    if (!_e_client_hook_call(E_CLIENT_HOOK_NEW_CLIENT, ec)) 
      {
@@ -5233,6 +5234,7 @@ e_client_iconify(E_Client *ec)
    if (!ec->zone) return;
    if (ec->shading || ec->iconic) return;
    if (ec->exp_iconify.skip_iconify && !ec->exp_iconify.by_client) return;
+   if (ec->exp_iconify.skip_by_remote) return;
 
    TRACE_DS_BEGIN(CLIENT:ICONIFY);
 
index b4ae68ea04e1a32326be800c8d87d1942b3dd47a..271fe6be7271b385bf1462027d6c286cf4ae4de4 100644 (file)
@@ -853,6 +853,7 @@ struct E_Client
       unsigned char by_client : 1;
       unsigned char not_raise : 1;
       unsigned char skip_iconify : 1;
+      unsigned char skip_by_remote : 1; // skip iconify by remote surface client
    } exp_iconify;
 
    struct
index 54c29b37d9c8f3b8704cfd78a4e378821fb72bb7..3a7860fa659da50372e29e6af9a10c609a71b156 100644 (file)
@@ -1,4 +1,5 @@
 #include "e.h"
+#include "e_policy_wl.h"
 #ifdef HAVE_REMOTE_SURFACE
  #include <tizen-remote-surface-server-protocol.h>
 #endif /* HAVE_REMOTE_SURFACE */
@@ -89,8 +90,10 @@ struct _E_Comp_Wl_Remote_Source {
      E_Comp_Wl_Buffer_Ref buffer_ref;
      const char *image_path;
      Ecore_Thread *th;
-
      Eina_Bool deleted;
+
+     int offscreen_ref;
+     Eina_Bool is_offscreen;
 };
 
 struct _E_Comp_Wl_Remote_Surface {
@@ -108,6 +111,8 @@ struct _E_Comp_Wl_Remote_Surface {
      Eina_Bool redirect;
      Eina_Bool visible;
 
+     Eina_Bool remote_render;
+
      int version;
 };
 
@@ -848,6 +853,43 @@ end:
    E_FREE(td);
 }
 
+static void
+_remote_source_offscreen_set(E_Comp_Wl_Remote_Source *source, Eina_Bool set)
+{
+   EINA_SAFETY_ON_NULL_RETURN(source);
+   if (set)
+     {
+        source->offscreen_ref++;
+        RSMDBG("Set offscreen offscreen_ref:%d",
+               source->ec->pixmap, source->ec,
+               "SOURCE", source, source->offscreen_ref);
+
+        if (source->offscreen_ref == 1)
+          {
+             source->is_offscreen = EINA_TRUE;
+             e_policy_wl_uniconify(source->ec);
+             source->ec->exp_iconify.skip_by_remote = 1;
+          }
+     }
+   else
+     {
+        if (!source->is_offscreen)
+          return;
+
+        source->offscreen_ref--;
+        RSMDBG("Unset offscreen offscreen_ref:%d",
+               source->ec->pixmap, source->ec,
+               "SOURCE", source, source->offscreen_ref);
+
+        if (source->offscreen_ref == 0)
+          {
+             source->is_offscreen = EINA_FALSE;
+             source->ec->exp_iconify.skip_by_remote = 0;
+             EC_CHANGED(source->ec);
+          }
+     }
+}
+
 static void
 _remote_surface_region_clear(E_Comp_Wl_Remote_Surface *remote_surface)
 {
@@ -1611,6 +1653,26 @@ _remote_surface_cb_release(struct wl_client *client, struct wl_resource *resourc
      e_comp_wl_buffer_reference(&remote_buffer->ref, NULL);
 }
 
+static void
+_remote_surface_cb_remote_render_set(struct wl_client *client, struct wl_resource *resource, uint32_t set)
+{
+   E_Comp_Wl_Remote_Surface *remote_surface;
+   E_Comp_Wl_Remote_Provider *provider = NULL;
+   E_Comp_Wl_Remote_Source *source = NULL;
+
+   remote_surface = wl_resource_get_user_data(resource);
+   EINA_SAFETY_ON_NULL_RETURN(remote_surface);
+
+   source = remote_surface->source;
+   if (!source) return;
+
+   if (remote_surface->remote_render == set)
+     return;
+
+   remote_surface->remote_render = set;
+   _remote_source_offscreen_set(source, set);
+}
+
 static const struct tizen_remote_surface_interface _remote_surface_interface =
 {
    _remote_surface_cb_destroy,
@@ -1625,6 +1687,7 @@ static const struct tizen_remote_surface_interface _remote_surface_interface =
    _remote_surface_cb_owner_set,
    _remote_surface_cb_region_create,
    _remote_surface_cb_release,
+   _remote_surface_cb_remote_render_set,
 };
 
 static void
@@ -1956,10 +2019,11 @@ _e_comp_wl_remote_surface_state_buffer_set(E_Comp_Wl_Surface_State *state, E_Com
 }
 
 static void
-_e_comp_wl_remote_surface_state_commit(E_Comp_Wl_Remote_Provider *provider, E_Comp_Wl_Surface_State *state)
+_e_comp_wl_remote_surface_state_commit(E_Client *ec, E_Comp_Wl_Surface_State *state)
 {
+   E_Comp_Wl_Remote_Provider *provider;
+   E_Comp_Wl_Remote_Source *source;
    E_Comp_Wl_Remote_Surface *surface;
-   E_Client *ec;
    struct wl_resource *cb;
    Eina_Rectangle *dmg;
    int x = 0, y = 0, sx = 0, sy = 0;
@@ -1968,7 +2032,6 @@ _e_comp_wl_remote_surface_state_commit(E_Comp_Wl_Remote_Provider *provider, E_Co
    struct wl_resource *remote_buffer_resource;
    Eina_List *l, *ll;
 
-   ec = provider->ec;
    if (e_object_is_del(E_OBJECT(ec))) return;
 
    if (state->new_attach)
@@ -2018,46 +2081,53 @@ _e_comp_wl_remote_surface_state_commit(E_Comp_Wl_Remote_Provider *provider, E_Co
    buffer = e_pixmap_resource_get(ec->pixmap);
    if (buffer)
      {
-        EINA_LIST_FOREACH(provider->surfaces, l, surface)
+        if ((provider = _remote_provider_find(ec)))
           {
-             remote_buffer_resource = e_comp_wl_tbm_remote_buffer_get(surface->wl_tbm, buffer->resource);
-             if (!remote_buffer_resource) continue;
+             EINA_LIST_FOREACH(provider->surfaces, l, surface)
+               {
+                  remote_buffer_resource = e_comp_wl_tbm_remote_buffer_get(surface->wl_tbm, buffer->resource);
+                  if (!remote_buffer_resource) continue;
 
-             remote_buffer = _e_comp_wl_remote_buffer_get(remote_buffer_resource);
-             if (!remote_buffer) continue;
+                  remote_buffer = _e_comp_wl_remote_buffer_get(remote_buffer_resource);
+                  if (!remote_buffer) continue;
 
-             if (!surface->redirect) continue;
-             if (surface->bind_ec)
-               {
-                  E_Comp_Wl_Buffer *buffer;
+                  if (!surface->redirect) continue;
+                  if (surface->bind_ec)
+                    {
+                       E_Comp_Wl_Buffer *buffer;
 
-                  buffer = e_comp_wl_buffer_get(remote_buffer->resource, surface->bind_ec);
-                  _e_comp_wl_remote_surface_state_buffer_set(&surface->bind_ec->comp_data->pending, buffer);
-                  surface->bind_ec->comp_data->pending.sx = sx;
-                  surface->bind_ec->comp_data->pending.sy = sy;
-                  surface->bind_ec->comp_data->pending.new_attach = EINA_TRUE;
+                       buffer = e_comp_wl_buffer_get(remote_buffer->resource, surface->bind_ec);
+                       _e_comp_wl_remote_surface_state_buffer_set(&surface->bind_ec->comp_data->pending, buffer);
+                       surface->bind_ec->comp_data->pending.sx = sx;
+                       surface->bind_ec->comp_data->pending.sy = sy;
+                       surface->bind_ec->comp_data->pending.new_attach = EINA_TRUE;
 
-                  e_comp_wl_surface_commit(surface->bind_ec);
-               }
-             else
-               {
-                  if (surface->version >= 2)
-                    e_comp_wl_buffer_reference(&remote_buffer->ref, buffer);
-
-                  if (surface->version >= TIZEN_REMOTE_SURFACE_CHANGED_BUFFER_SINCE_VERSION)
-                    tizen_remote_surface_send_changed_buffer(surface->resource,
-                                                             TIZEN_REMOTE_SURFACE_BUFFER_TYPE_TBM,
-                                                             remote_buffer->resource,
-                                                             _rsm->dummy_fd,
-                                                             0,
-                                                             ecore_time_get() * 1000,
-                                                             NULL);
+                       e_comp_wl_surface_commit(surface->bind_ec);
+                    }
                   else
-                    tizen_remote_surface_send_update_buffer(surface->resource,
-                                                            remote_buffer->resource,
-                                                            ecore_time_get()  * 1000);
+                    {
+                       if (surface->version >= 2)
+                         e_comp_wl_buffer_reference(&remote_buffer->ref, buffer);
+
+                       if (surface->version >= TIZEN_REMOTE_SURFACE_CHANGED_BUFFER_SINCE_VERSION)
+                         tizen_remote_surface_send_changed_buffer(surface->resource,
+                                                                  TIZEN_REMOTE_SURFACE_BUFFER_TYPE_TBM,
+                                                                  remote_buffer->resource,
+                                                                  _rsm->dummy_fd,
+                                                                  0,
+                                                                  ecore_time_get() * 1000,
+                                                                  NULL);
+                       else
+                         tizen_remote_surface_send_update_buffer(surface->resource,
+                                                                 remote_buffer->resource,
+                                                                 ecore_time_get()  * 1000);
+                    }
                }
           }
+        else if ((source = _remote_source_find(ec)))
+          {
+             _e_comp_wl_remote_surface_source_update(source, buffer);
+          }
 
         /* send frame done */
         e_pixmap_image_clear(ec->pixmap, 1);
@@ -2138,7 +2208,7 @@ _e_comp_wl_remote_surface_subsurface_commit(E_Comp_Wl_Remote_Provider *parent_pr
    return EINA_TRUE;
 }
 
-static void
+void
 _e_comp_wl_remote_surface_source_update(E_Comp_Wl_Remote_Source *source, E_Comp_Wl_Buffer *buffer)
 {
    E_Comp_Wl_Remote_Surface *remote_surface;
@@ -2222,6 +2292,12 @@ e_comp_wl_remote_surface_commit(E_Client *ec)
 
    if ((source = _remote_source_find(ec)))
      {
+        if (source->is_offscreen)
+          {
+             _e_comp_wl_remote_surface_state_commit(ec, &ec->comp_data->pending);
+             return EINA_TRUE;
+          }
+
         //send update to remote_surface of source client
         _e_comp_wl_remote_surface_source_update(source, ec->comp_data->pending.buffer);
 
@@ -2255,7 +2331,7 @@ e_comp_wl_remote_surface_commit(E_Client *ec)
    if (!(provider = _remote_provider_find(ec)))
      return EINA_FALSE;
 
-   _e_comp_wl_remote_surface_state_commit(provider, &ec->comp_data->pending);
+   _e_comp_wl_remote_surface_state_commit(ec, &ec->comp_data->pending);
 
    return EINA_TRUE;
 #else
index 8c949ccddf416f936377406e1619b460c593c4f3..e117ee2a0f1734eb039bc4d0346faea08aeae1b4 100644 (file)
@@ -887,6 +887,7 @@ _e_policy_cb_hook_client_visibility(void *d EINA_UNUSED, E_Client *ec)
 
                        if (above_ec->exp_iconify.by_client) continue;
                        if (above_ec->exp_iconify.skip_iconify) continue;
+                       if (above_ec->exp_iconify.skip_by_remote) continue;
 
                        if (above_ec->argb)
                          {
@@ -918,6 +919,7 @@ _e_policy_cb_hook_client_visibility(void *d EINA_UNUSED, E_Client *ec)
                   if (e_client_util_ignored_get(ec)) return;
                   if (ec->exp_iconify.by_client) return;
                   if (ec->exp_iconify.skip_iconify) return;
+                  if (ec->exp_iconify.skip_by_remote) return;
                   if (!ec->iconic)
                     {
                        e_policy_client_iconify_by_visibility(ec);
@@ -962,6 +964,7 @@ _e_policy_cb_hook_pixmap_unusable(void *data EINA_UNUSED, E_Pixmap *cp)
    if (!ec->iconic) return;
    if (ec->exp_iconify.by_client) return;
    if (ec->exp_iconify.skip_iconify) return;
+   if (ec->exp_iconify.skip_by_remote) return;
 
    e_policy_client_unmap(ec);
 }
index 80d528a432826fd8fa9bdad3ec6d4d6ad3f28c40..80050bc9c67f383d5185d3ab6e1b10c5adf66ed0 100644 (file)
@@ -62,7 +62,8 @@ _e_policy_check_transient_child_visible(E_Client *ancestor_ec, E_Client *ec)
      {
         if (visible == EINA_TRUE) continue;
 
-        if (child_ec->exp_iconify.skip_iconify == EINA_TRUE)
+        if ((child_ec->exp_iconify.skip_iconify == EINA_TRUE) ||
+            (child_ec->exp_iconify.skip_by_remote == EINA_TRUE))
           {
              if (child_ec->visibility.obscured == E_VISIBILITY_UNOBSCURED)
                {
@@ -144,6 +145,7 @@ _e_policy_client_iconify_by_visibility(E_Client *ec)
    if (ec->iconic) return;
    if (ec->exp_iconify.by_client) return;
    if (ec->exp_iconify.skip_iconify) return;
+   if (ec->exp_iconify.skip_by_remote) return;
 
    E_Comp_Wl_Client_Data *cdata = (E_Comp_Wl_Client_Data *)ec->comp_data;
    if (cdata && !cdata->mapped) return;
@@ -198,6 +200,7 @@ _e_policy_client_ancestor_uniconify(E_Client *ec)
    if (!ec->iconic) return;
    if (ec->exp_iconify.by_client) return;
    if (ec->exp_iconify.skip_iconify) return;
+   if (ec->exp_iconify.skip_by_remote) return;
 
    parent = ec->parent;
    while (parent)
@@ -213,6 +216,7 @@ _e_policy_client_ancestor_uniconify(E_Client *ec)
         if (!parent->iconic) break;
         if (parent->exp_iconify.by_client) break;
         if (parent->exp_iconify.skip_iconify) break;
+        if (parent->exp_iconify.skip_by_remote) break;
 
         if (eina_list_data_find(list, parent))
           {
@@ -282,6 +286,7 @@ _e_policy_client_uniconify_by_visibility(E_Client *ec)
    if (!ec->iconic) return;
    if (ec->exp_iconify.by_client) return;
    if (ec->exp_iconify.skip_iconify) return;
+   if (ec->exp_iconify.skip_by_remote) return;
 
    E_Comp_Wl_Client_Data *cdata = (E_Comp_Wl_Client_Data *)ec->comp_data;
    if (cdata && !cdata->mapped) return;
index d71cc4f0ce32d2e6dbca84b2828d5bc3283aadf3..922debdef3d5cd875f62b0458484f5a20bd80743 100644 (file)
@@ -1095,6 +1095,7 @@ e_policy_wl_iconify_state_change_send(E_Client *ec, int iconic)
    Ecore_Window win;
 
    if (ec->exp_iconify.skip_iconify) return;
+   if (ec->exp_iconify.skip_by_remote) return;
 
    if (e_config->transient.iconify)
      {