#include "e.h"
+#include "e_policy_wl.h"
#ifdef HAVE_REMOTE_SURFACE
#include <tizen-remote-surface-server-protocol.h>
#endif /* HAVE_REMOTE_SURFACE */
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 {
Eina_Bool redirect;
Eina_Bool visible;
+ Eina_Bool remote_render;
+
int version;
};
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)
{
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,
_remote_surface_cb_owner_set,
_remote_surface_cb_region_create,
_remote_surface_cb_release,
+ _remote_surface_cb_remote_render_set,
};
static void
}
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;
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)
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);
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;
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);
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