From 468fc9e6c79e0dc007834a875dbc572062f4d7e6 Mon Sep 17 00:00:00 2001 From: Roman Peresipkyn Date: Thu, 21 Jul 2016 11:17:37 +0300 Subject: [PATCH 01/16] using queue for client's buffers syncronization changes: 1. added queue of buffers syncronization. 2. added possibility of substitution client buffers with dummy one by defining DRAW_DUMMY. 3. added possibility of dumping client buffers by defining DUMP_PRESENTATION. Change-Id: I4f221ba4cc8e876f4f4a8e4f51ccbdc9067a29fd Signed-off-by: Roman Peresipkyn --- src/e_mod_main.c | 269 ++++++++++++++++++++++++++++++++++++++++++------------- src/e_mod_main.h | 43 ++++++++- 2 files changed, 245 insertions(+), 67 deletions(-) diff --git a/src/e_mod_main.c b/src/e_mod_main.c index 4d7a1dd..6cbea65 100644 --- a/src/e_mod_main.c +++ b/src/e_mod_main.c @@ -15,6 +15,10 @@ E_API E_Module_Api e_modapi = { E_MODULE_API_VERSION, "EOM Module" }; static E_EomPtr g_eom = NULL; Eina_Bool eom_server_debug_on = EINA_FALSE; +#ifdef DUMP_PRESENTATION +static int dump = 0; +#endif + static const struct wl_eom_interface _e_eom_wl_implementation = { _e_eom_cb_wl_request_set_attribute, @@ -198,7 +202,9 @@ _e_eom_cb_wl_bind(struct wl_client *client, void *data, uint32_t version, uint32 new_client->current = EINA_FALSE; new_client->output_id = -1; new_client->ec = NULL; - new_client->buffers = NULL; + new_client->buffers_show = NULL; + new_client->buffers_del = NULL; + new_client->first_buffer = EINA_TRUE; g_eom->clients = eina_list_append(g_eom->clients, new_client); } @@ -225,12 +231,12 @@ _e_eom_cb_wl_resource_destory(struct wl_resource *resource) output = _e_eom_output_get_by_id(client->output_id); GOTOIFTRUE(output == NULL, end2, "output is NULL"); - _e_eom_client_free_buffers(client); - _e_eom_output_state_set_mode(output, EOM_OUTPUT_MODE_MIRROR); ret = _e_eom_output_state_set_attribute(output, EOM_OUTPUT_ATTRIBUTE_NONE); (void)ret; + _e_eom_client_free_buffers(client); + /* TODO: process case when output is not connected */ if (output->state == NONE) goto end; @@ -276,7 +282,7 @@ _e_eom_cb_ecore_drm_output(void *data EINA_UNUSED, int type EINA_UNUSED, void *e Ecore_Drm_Event_Output *e = NULL; char buff[PATH_MAX]; - if (!(e = event)) return ECORE_CALLBACK_PASS_ON;; + if (!(e = event)) return ECORE_CALLBACK_PASS_ON; EOM_DBG("id:%d (x,y,w,h):(%d,%d,%d,%d) (w_mm,h_mm):(%d,%d) refresh:%d subpixel_order:%d transform:%d make:%s model:%s name:%s plug:%d", e->id, e->x, e->y, e->w, e->h, e->phys_width, e->phys_height, e->refresh, e->subpixel_order, e->transform, e->make, e->model, e->name, e->plug); @@ -428,34 +434,20 @@ _e_eom_cb_client_buffer_change(void *data, int type, void *event) ECORE_CALLBACK_PASS_ON, "Client tbm buffer is NULL"); - EOM_DBG("tbm_buffer %p", external_tbm_buffer); + /* EOM_DBG("tbm_buffer %p", external_tbm_buffer); */ #if 0 _e_eom_util_draw(external_tbm_buffer); #endif - /* mmap that buffer to get width and height for test's sake */ - /* - memset(&surface_info, 0, sizeof(tbm_surface_info_s)); - ret = tbm_surface_map(external_tbm_buffer, TBM_SURF_OPTION_READ | - TBM_SURF_OPTION_WRITE, &surface_info); - if (ret != TBM_SURFACE_ERROR_NONE) - { - EOM_ERR("mmap buffer: %d", ret); - return ECORE_CALLBACK_PASS_ON; - } - - EOM_DBG("tbm_buffer: %dx%d", surface_info.width, surface_info.height); - - tbm_surface_unmap(external_tbm_buffer); - */ - - client_buffer = _e_eom_util_create_client_buffer(external_wl_buffer, external_tbm_buffer); + EOM_DBG("BUFF_CHANGE >>>>>>>>>>"); + client_buffer = _e_eom_util_create_client_buffer(eom_client, external_wl_buffer, external_tbm_buffer); RETURNVALIFTRUE(client_buffer == NULL, ECORE_CALLBACK_PASS_ON, "Alloc client buffer"); _e_eom_client_add_buffer(eom_client, client_buffer); + EOM_DBG("BUFF_CHANGE <<<<<<<<<<"); eom_output->state = PRESENTATION; @@ -528,26 +520,50 @@ _e_eom_cb_commit(tdm_output *output EINA_UNUSED, unsigned int sequence EINA_UNUS RETURNIFTRUE(err != TDM_ERROR_NONE, "commit event: mirror: set buffer 0 err:%d", err); err = tdm_output_commit(eom_output->output, 0, _e_eom_cb_commit, eom_output); - RETURNIFTRUE(err != TDM_ERROR_NONE, "commit event: mirror: commit"); + RETURNIFTRUE(err != TDM_ERROR_NONE, "commit event: mirror: commit err:%d", err); } else if (eom_output->state == PRESENTATION) { eom_client = _e_eom_client_get_current_by_id(eom_output->id); + EOM_DBG("COMMIT +++++++++++++++>"); + client_buffer = _e_eom_client_get_buffer(eom_client); if (client_buffer == NULL) { external_buffer = eom_output->dummy_buffer; - EOM_DBG("dummy buffer was substitute"); + EOM_DBG("substitute dummy buffer"); } else external_buffer = client_buffer->tbm_buffer; +#ifdef DRAW_DUMMY + EOM_DBG("COMMIT draw and set dummy"); + + _e_eom_util_draw(eom_output->dummy_buffer); + external_buffer = eom_output->dummy_buffer; +#endif + +#ifdef DUMP_PRESENTATION + if (dump < 29) + { + tbm_surface_internal_dump_buffer(external_buffer, "kyky"); + dump++; + } + else + { + tbm_surface_internal_dump_end(); + EOM_DBG("dump end"); + } +#endif + err = tdm_layer_set_buffer(eom_output->layer, external_buffer); - RETURNIFTRUE(err != TDM_ERROR_NONE, "commit event: presentation: set client buffer"); + RETURNIFTRUE(err != TDM_ERROR_NONE, "commit event: presentation: set buffer"); err = tdm_output_commit(eom_output->output, 0, _e_eom_cb_commit, eom_output); - RETURNIFTRUE(err != TDM_ERROR_NONE, "commit event: presentation: commit"); + RETURNIFTRUE(err != TDM_ERROR_NONE, "commit event: presentation: commit err:%d", err); + + EOM_DBG("COMMIT <+++++++++++++++"); } } @@ -926,7 +942,6 @@ _e_eom_cb_comp_object_redirected(void *data, E_Client *ec) E_EomCompObjectInterceptHookData *hook_data; EOM_DBG("_e_eom_cb_comp_object_redirected"); - RETURNVALIFTRUE(data == NULL, EINA_TRUE, "data is NULL"); hook_data = (E_EomCompObjectInterceptHookData* )data; @@ -1535,24 +1550,35 @@ _e_eom_util_create_buffer(int width, int height, int format, int flags) } static E_EomClientBufferPtr -_e_eom_util_create_client_buffer(E_Comp_Wl_Buffer *wl_buffer, tbm_surface_h tbm_buffer) +_e_eom_util_create_client_buffer(E_EomClientPtr client, E_Comp_Wl_Buffer *wl_buffer, tbm_surface_h tbm_buffer) { E_EomClientBufferPtr buffer = NULL; buffer = E_NEW(E_EomClientBuffer, 1); - if(buffer == NULL) - return NULL; + RETURNVALIFTRUE(buffer == NULL, NULL, "Allocate new client buffer") + + /* TODO: Internal and External frame rate are same */ + + /* Forbid E sending 'wl_buffer_send_release' event to external clients */ + wl_buffer->busy++; buffer->wl_buffer = wl_buffer; buffer->tbm_buffer = tbm_buffer; - /* TODO: It is not used right now */ - buffer->stamp = _e_eom_util_get_stamp(); - /* I am not sure if it is necessary */ - tbm_surface_internal_ref(tbm_buffer); + EOM_DBG("new client buffer wl:%p tbm:%p", + buffer->wl_buffer, buffer->tbm_buffer); + +#ifdef DUMP_PRESENTATION + if (dump == 0) + { + EOM_DBG("dump start"); + tbm_surface_internal_dump_start("/A", wl_buffer->w, wl_buffer->h, 30); + } +#endif - /* TODO: Do we need reference that buffer? */ - /* e_comp_wl_buffer_reference(buffer->tbm_buffer, NULL);*/ +#if 0 + buffer->stamp = _e_eom_util_get_stamp(); +#endif return buffer; } @@ -1687,6 +1713,7 @@ err: return EINA_FALSE; } +#if 0 static int _e_eom_util_get_stamp() { @@ -1696,41 +1723,52 @@ _e_eom_util_get_stamp() return ((tp.tv_sec * 1000) + (tp.tv_nsec / 1000)); } +#endif + +#ifdef DRAW_DUMMY + +int square_x = 0; +int square_w = 200; -#if 0 static void _e_eom_util_draw(tbm_surface_h surface) { + unsigned char rw = 0, gw = 0, bw = 0, aw = 0; + unsigned char r = 255, g = 255, b = 255, a = 0; + + unsigned int *mm = NULL; int i = 0, j = 0; + int w = (int)tbm_surface_get_width(surface); + int h = (int)tbm_surface_get_height(surface); + tbm_bo bo = tbm_surface_internal_get_bo(surface, 0); RETURNIFTRUE(bo == NULL, "bo is NULL"); - unsigned int *mm = (unsigned int *)tbm_bo_map(bo, TBM_DEVICE_CPU, TBM_OPTION_READ|TBM_OPTION_WRITE).ptr; + mm = (unsigned int *)tbm_bo_map(bo, TBM_DEVICE_CPU, TBM_OPTION_READ|TBM_OPTION_WRITE).ptr; RETURNIFTRUE(mm == NULL, "mm is NULL"); - unsigned char r = 0; - unsigned char g = 255; - unsigned char b = 0; - unsigned char a = 0; - - int w = (int)tbm_surface_get_width(surface); - int h = (int)tbm_surface_get_height(surface); - - for (i = 0; i < w; i++) - for (j = 0; j < h/2; j++) + for (i = 0; i < h; i++) + for (j = 0; j < w; j++) { - mm[i*w + j] = r << 24 | g << 16 | b << 8 | a; + if (j > square_x && j < square_x + square_w) + mm[i*w + j] = r << 24 | g << 16 | b << 8 | a; + else + mm[i*w + j] = rw << 24 | gw << 16 | bw << 8 | aw; } + + square_x += 1; + if (square_x + square_w> w) + square_x = 0; + + tbm_bo_unmap(bo); } #endif static void _e_eom_client_add_buffer(E_EomClientPtr client, E_EomClientBufferPtr buffer) { - _e_eom_client_free_buffers(client); - - client->buffers = eina_list_append(client->buffers, buffer); + client->buffers_show = eina_list_append(client->buffers_show, buffer); } static void @@ -1739,18 +1777,38 @@ _e_eom_client_free_buffers(E_EomClientPtr client) E_EomClientBufferPtr buffer = NULL; Eina_List *l; - EINA_LIST_FOREACH(client->buffers, l, buffer) + EINA_LIST_FOREACH(client->buffers_show, l, buffer) + { + if (buffer) + { + client->buffers_show = eina_list_remove(client->buffers_show, buffer); + + /* TODO: not sure if it is necessary */ + if (buffer->tbm_buffer && client->first_buffer == EINA_FALSE) + tbm_surface_internal_unref(buffer->tbm_buffer); + + /* TODO: not sure if it is necessary */ + if (buffer->wl_buffer) + buffer->wl_buffer->busy--; + + E_FREE(buffer); + } + } + + EINA_LIST_FOREACH(client->buffers_del, l, buffer) { if (buffer) { - /* I am not sure if it is necessary */ + client->buffers_del= eina_list_remove(client->buffers_del, buffer); + + /* TODO: not sure if it is necessary */ if (buffer->tbm_buffer) tbm_surface_internal_unref(buffer->tbm_buffer); - /* TODO: Do we need reference that buffer? */ - /* e_comp_wl_buffer_reference(buffer->tbm_buffer, NULL); */ + /* TODO: not sure if it is necessary */ + if (buffer->wl_buffer) + buffer->wl_buffer->busy--; - client->buffers = eina_list_remove(client->buffers, buffer); E_FREE(buffer); } } @@ -1759,17 +1817,102 @@ _e_eom_client_free_buffers(E_EomClientPtr client) static E_EomClientBufferPtr _e_eom_client_get_buffer(E_EomClientPtr client) { - E_EomClientBufferPtr buffer = NULL; + E_EomClientBufferPtr show_buffer = NULL; + E_EomClientBufferPtr prev_buffer = NULL; + E_EomClientBufferPtr del_buffer = NULL; Eina_List *l; - /* There must be only one buffer */ - EINA_LIST_FOREACH(client->buffers, l, buffer) + /* TODO: is it possible that a client has only one buffet to draw too? */ + RETURNVALIFTRUE(eina_list_count(client->buffers_show) == 0, NULL, + "eom client (%p) do not have buffers to be shown", client); + + /* If there is only one buffer we have slow client, just return the buffer */ + if (eina_list_count(client->buffers_show) == 1) { - if (buffer) - return buffer; + show_buffer = eina_list_nth(client->buffers_show, 0); + RETURNVALIFTRUE(show_buffer == NULL, NULL, + "eom client (%p) buffer is NULL", client); + + EOM_DBG("one wl:%p tbm:%p", show_buffer->wl_buffer, show_buffer->tbm_buffer); + + return show_buffer; } - return NULL; + if (client->first_buffer == EINA_TRUE) + { + show_buffer= eina_list_nth(client->buffers_show, 0); + RETURNVALIFTRUE(show_buffer == NULL, NULL, "eom client (%p) first buffer is NULL", client); + + EOM_DBG("first wl:%p tbm:%p", show_buffer->wl_buffer, show_buffer->tbm_buffer); + + /* I am not sure if it is necessary */ + EOM_DBG("ref first"); + tbm_surface_internal_ref(show_buffer->tbm_buffer); + + client->first_buffer = EINA_FALSE; + return show_buffer; + } + + EINA_LIST_FOREACH(client->buffers_del, l, del_buffer) + { + if (del_buffer) + { + client->buffers_del = eina_list_remove(client->buffers_del, del_buffer); + + if (del_buffer->wl_buffer) + { + del_buffer->wl_buffer->busy--; + EOM_DBG("wl_buffer:%p busy:%d", del_buffer->wl_buffer, del_buffer->wl_buffer->busy); + if (del_buffer->wl_buffer->busy == 0) + { + if (del_buffer->wl_buffer->type != E_COMP_WL_BUFFER_TYPE_TBM) + { + if (!wl_resource_get_client(del_buffer->wl_buffer->resource)) + { + EOM_DBG("wl_buffer->resource is NULL"); + return NULL; + } + + wl_buffer_send_release(del_buffer->wl_buffer->resource); + } + } + } + + EOM_DBG("del wl:%p tbm:%p", del_buffer->wl_buffer, del_buffer->tbm_buffer); + + if (del_buffer->tbm_buffer) + { + EOM_DBG("before old unref"); + tbm_surface_internal_unref(del_buffer->tbm_buffer); + } + + /* TODO: should wl_buffer and tbm_surface be deleted here? */ + E_FREE(del_buffer); + } + } + + /* TODO: case of 2 or n buffers */ + prev_buffer = eina_list_nth(client->buffers_show, 0); + RETURNVALIFTRUE(prev_buffer == NULL, NULL, "eom client (%p) old_buffer is NULL", client); + + EOM_DBG("old wl:%p tbm:%p", prev_buffer->wl_buffer, prev_buffer->tbm_buffer); + + client->buffers_show = eina_list_remove(client->buffers_show, prev_buffer); + client->buffers_del = eina_list_append(client->buffers_del, prev_buffer); + + /* Take next buffer to be shown on external output */ + show_buffer = eina_list_nth(client->buffers_show, 0); + RETURNVALIFTRUE(show_buffer == NULL, NULL, "eom client (%p) next buffer is NULL", client); + + EOM_DBG("show wl:%p tbm:%p", show_buffer->wl_buffer, show_buffer->tbm_buffer); + + if (show_buffer->tbm_buffer) + { + EOM_DBG("show ref"); + tbm_surface_internal_ref(show_buffer->tbm_buffer); + } + + return show_buffer; } static E_EomClientPtr diff --git a/src/e_mod_main.h b/src/e_mod_main.h index 7ebb457..d718aea 100644 --- a/src/e_mod_main.h +++ b/src/e_mod_main.h @@ -3,6 +3,14 @@ #include "eom-server-protocol.h" +#if 0 + #define DRAW_DUMMY +#endif + +#if 0 + #define DUMP_PRESENTATION +#endif + extern Eina_Bool eom_server_debug_on; #define ALEN(array) (sizeof(array) / sizeof(array)[0]) @@ -50,8 +58,29 @@ if (statement) \ /* E Module */ E_API extern E_Module_Api e_modapi; + +/** + * @brief Called when Enlightenment is going to load the module + * @param[in] m structure which defines Enlightenment module + * @see e_modapi_shutdown() + * @see e_modapi_save() + */ E_API void *e_modapi_init(E_Module *m); + +/** + * @brief Called when Enlightenment is going to unload the module + * @param[in] m structure which defines Enlightenment module + * @see e_modapi_init() + * @see e_modapi_save() + */ E_API int e_modapi_shutdown(E_Module *m); + +/** + * @brief Called when Enlightenment is going to save some info in the module + * @param[in] m structure which defines Enlightenment module + * @see e_modapi_init() + * @see e_modapi_shutdown() + */ E_API int e_modapi_save(E_Module *m); #define NUM_MAIN_BUF 2 @@ -109,6 +138,7 @@ struct _E_Eom_Output /* mirror mode data */ tbm_surface_h dst_buffers[NUM_MAIN_BUF]; + tbm_surface_h src_buffer; int current_buffer; int pp_buffer; @@ -149,7 +179,9 @@ struct _E_Eom_Client /*TODO: As I understand there are cannot be more than one client buffer on *server side, but for future extendabilty store it in the list */ /*Client's buffers */ - Eina_List *buffers; + Eina_List *buffers_show; + Eina_List *buffers_del; + Eina_Bool first_buffer; }; struct _E_Eom_Client_Buffer @@ -216,14 +248,17 @@ static Eina_Bool _e_eom_pp_is_needed(int src_w, int src_h, int dst_w, int dst_h) static void _e_eom_util_get_debug_env(); static tbm_surface_h _e_eom_util_create_buffer(int width, int height, int format, int flags); -static E_EomClientBufferPtr _e_eom_util_create_client_buffer(E_Comp_Wl_Buffer *wl_buffer, - tbm_surface_h tbm_buffer); +static E_EomClientBufferPtr _e_eom_util_create_client_buffer(E_EomClientPtr client, + E_Comp_Wl_Buffer *wl_buffer, + tbm_surface_h tbm_buffer); static void _e_eom_util_calculate_fullsize(int src_h, int src_v, int dst_size_h, int dst_size_v, int *dst_x, int *dst_y, int *dst_w, int *dst_h); static tbm_surface_h _e_eom_util_get_output_surface(const char *name); static Eina_Bool _e_eom_util_add_comp_object_redirected_hook(E_Client *ec); -static int _e_eom_util_get_stamp(); #if 0 +static int _e_eom_util_get_stamp(); +#endif +#ifdef DRAW_DUMMY static void _e_eom_util_draw(tbm_surface_h surface); #endif -- 2.7.4 From 8f3774e99bad1a7e7ca9ac4ebbc3b6ae175acbd8 Mon Sep 17 00:00:00 2001 From: Roman Peresipkyn Date: Wed, 27 Jul 2016 20:48:07 +0300 Subject: [PATCH 02/16] rework set_attribute fucntion changes: 1. If new client set attribute successfully send lost notification only to curren client 2. If current client has set NONE attribute start mirror mode and notify all clients about that changes 3. clean code Change-Id: I331690a97ae1c121eca6e33678e75d186fb8b366 Signed-off-by: Roman Peresipkyn --- src/e_mod_main.c | 119 ++++++++++++++++++++++++++++++------------------------- 1 file changed, 66 insertions(+), 53 deletions(-) diff --git a/src/e_mod_main.c b/src/e_mod_main.c index 6cbea65..5d193ad 100644 --- a/src/e_mod_main.c +++ b/src/e_mod_main.c @@ -57,8 +57,6 @@ static const char *eom_conn_types[] = "DSI", }; -////////////////////////////////////////////////////////////////////////////////////////////////////// - static inline eom_output_mode_e _e_eom_output_state_get_mode(E_EomOutputPtr output) { @@ -729,10 +727,9 @@ static void _e_eom_cb_wl_request_set_attribute(struct wl_client *client, struct wl_resource *resource, uint32_t output_id, uint32_t attribute) { eom_error_e eom_error = EOM_ERROR_NONE; - E_EomClientPtr eom_client = NULL, iterator = NULL; + E_EomClientPtr eom_client = NULL, current_eom_client = NULL, iterator = NULL; E_EomOutputPtr eom_output = NULL; Eina_Bool changes = EINA_FALSE; - Eina_Bool mode_change = EINA_FALSE; Eina_Bool ret = EINA_FALSE; Eina_List *l; @@ -740,12 +737,13 @@ _e_eom_cb_wl_request_set_attribute(struct wl_client *client, struct wl_resource RETURNIFTRUE(eom_client == NULL, "eom_client is NULL"); /* Bind the client with a concrete output */ - if (eom_client->output_id == -1) - eom_client->output_id = output_id; + eom_client->output_id = output_id; eom_output = _e_eom_output_get_by_id(output_id); GOTOIFTRUE(eom_output == NULL, no_output, "eom_output is NULL"); + EOM_DBG("Set attribute:%d", attribute); + if (eom_client->current == EINA_TRUE && eom_output->id == eom_client->output_id) { /* Current client can set any flag it wants */ @@ -754,6 +752,7 @@ _e_eom_cb_wl_request_set_attribute(struct wl_client *client, struct wl_resource } else { + /* A client is trying to set new attribute */ ret = _e_eom_output_state_set_attribute(eom_output, attribute); if (ret == EINA_FALSE) { @@ -763,23 +762,25 @@ _e_eom_cb_wl_request_set_attribute(struct wl_client *client, struct wl_resource goto end; } - eom_client->output_id = output_id; changes = EINA_TRUE; } + /* If there was no new changes applied do nothing */ + if (changes == EINA_FALSE) + { + EOM_DBG("no new changes"); + return; + } + EOM_DBG("set attribute OK"); - /* If client has set EOM_OUTPUT_ATTRIBUTE_NONE, eom will be - * switched to mirror mode - */ + /* If client has set EOM_OUTPUT_ATTRIBUTE_NONE switching to mirror mode */ if (attribute == EOM_OUTPUT_ATTRIBUTE_NONE && eom_output->state != MIRROR) { eom_output->state = MIRROR; eom_client->current = EINA_FALSE; _e_eom_output_state_set_mode(eom_output, EOM_OUTPUT_ATTRIBUTE_NONE); - mode_change = EINA_TRUE; - ret = _e_eom_output_state_set_attribute(eom_output, EOM_OUTPUT_ATTRIBUTE_NONE); (void)ret; @@ -793,63 +794,75 @@ _e_eom_cb_wl_request_set_attribute(struct wl_client *client, struct wl_resource ret = _e_eom_output_start_pp(eom_output); GOTOIFTRUE(ret == EINA_FALSE, end, - "Restore mirror mode after a client disconnection"); - goto end; + "Restore mirror mode after disconnection of the client"); + + /* If mirror mode has been ran notify all clients about that */ + EOM_DBG("client set NONE attribute send new info to previous current client"); + EINA_LIST_FOREACH(g_eom->clients, l, iterator) + { + if (iterator->output_id == output_id) + { + wl_eom_send_output_attribute(iterator->resource, + eom_output->id, + _e_eom_output_state_get_attribute(eom_output), + _e_eom_output_state_get_attribute_state(eom_output), + EOM_ERROR_NONE); + + wl_eom_send_output_mode(iterator->resource, + eom_output->id, + _e_eom_output_state_get_mode(eom_output)); + } + } + + return; } end: + /* If client was not able to set attribute then send LOST event + * to it and return */ + /* TODO: I think it is bad to send LOST event in that case + * Client must process eom_errors */ + if (eom_error == EOM_ERROR_INVALID_PARAMETER) + { + EOM_DBG("client failed to set attribute"); + + wl_eom_send_output_attribute(eom_client->resource, + eom_output->id, + _e_eom_output_state_get_attribute(eom_output), + EOM_OUTPUT_ATTRIBUTE_STATE_LOST, + eom_error); + return; + } + + /* Send changes to the caller-client */ wl_eom_send_output_attribute(eom_client->resource, eom_output->id, _e_eom_output_state_get_attribute(eom_output), _e_eom_output_state_get_attribute_state(eom_output), eom_error); - /* Notify eom clients that eom state has been changed */ - if (changes == EINA_TRUE) + /* Send changes to previous current client */ + if (eom_client->current == EINA_FALSE && + (current_eom_client = _e_eom_client_get_current_by_id(eom_output->id))) { - EINA_LIST_FOREACH(g_eom->clients, l, iterator) - { - if (iterator && iterator->resource == resource) - continue; - - if (iterator && iterator->output_id == eom_output->id) - { - iterator->current = 0; - - if (eom_output->state == MIRROR) - { - wl_eom_send_output_attribute(iterator->resource, - eom_output->id, - _e_eom_output_state_get_attribute(eom_output), - _e_eom_output_state_get_attribute_state(eom_output), - EOM_ERROR_NONE); - } - else - { - wl_eom_send_output_attribute(iterator->resource, - eom_output->id, - _e_eom_output_state_get_attribute(eom_output), - EOM_OUTPUT_ATTRIBUTE_STATE_LOST, - EOM_ERROR_NONE); - } + current_eom_client->current = EINA_FALSE; - if (mode_change == EINA_TRUE) - { - wl_eom_send_output_mode(iterator->resource, - eom_output->id, - _e_eom_output_state_get_mode(eom_output)); - } - } - } + EOM_DBG("client failed to set attribute"); - eom_client->current= EINA_TRUE; + wl_eom_send_output_attribute(current_eom_client->resource, + eom_output->id, + _e_eom_output_state_get_attribute(eom_output), + EOM_OUTPUT_ATTRIBUTE_STATE_LOST, + EOM_ERROR_NONE); } + /* Set the client as current client of the eom_output */ + eom_client->current= EINA_TRUE; + return; - /* Get here if EOM does not have output with output_id is */ + /* Get here if EOM does not have output referred by output_id */ no_output: - wl_eom_send_output_attribute(eom_client->resource, output_id, EOM_OUTPUT_ATTRIBUTE_NONE, @@ -1882,7 +1895,7 @@ _e_eom_client_get_buffer(E_EomClientPtr client) if (del_buffer->tbm_buffer) { - EOM_DBG("before old unref"); + EOM_DBG("del unref"); tbm_surface_internal_unref(del_buffer->tbm_buffer); } -- 2.7.4 From ea762c2596025c232ca7e534cab714f4be4ce1b0 Mon Sep 17 00:00:00 2001 From: Roman Peresipkyn Date: Thu, 28 Jul 2016 18:00:55 +0300 Subject: [PATCH 03/16] Send status of setting window to clietnt Change-Id: Ic78d25499c6231e9d68671a3c05a77b24657b1e2 --- protocol/eom-client-protocol.h | 10 ++++++++++ protocol/eom-protocol.c | 3 ++- protocol/eom-server-protocol.h | 8 ++++++++ protocol/eom.xml | 5 +++++ src/e_mod_main.c | 7 +++++-- 5 files changed, 30 insertions(+), 3 deletions(-) diff --git a/protocol/eom-client-protocol.h b/protocol/eom-client-protocol.h index 7172c5f..1fcd29d 100644 --- a/protocol/eom-client-protocol.h +++ b/protocol/eom-client-protocol.h @@ -152,6 +152,7 @@ enum wl_eom_attribute_state { * @output_type: (none) * @output_mode: (none) * @output_attribute: (none) + * @output_set_window: (none) * * ***** TODO ****** */ @@ -217,6 +218,15 @@ struct wl_eom_listener { uint32_t attribute, uint32_t attribute_state, uint32_t error); + /** + * output_set_window - (none) + * @output_id: (none) + * @error: (none) + */ + void (*output_set_window)(void *data, + struct wl_eom *wl_eom, + uint32_t output_id, + uint32_t error); }; static inline int diff --git a/protocol/eom-protocol.c b/protocol/eom-protocol.c index 3db1593..c032027 100644 --- a/protocol/eom-protocol.c +++ b/protocol/eom-protocol.c @@ -33,11 +33,12 @@ static const struct wl_message wl_eom_events[] = { { "output_type", "uuu", types + 0 }, { "output_mode", "uu", types + 0 }, { "output_attribute", "uuuu", types + 0 }, + { "output_set_window", "uu", types + 0 }, }; WL_EXPORT const struct wl_interface wl_eom_interface = { "wl_eom", 1, 4, wl_eom_requests, - 5, wl_eom_events, + 6, wl_eom_events, }; diff --git a/protocol/eom-server-protocol.h b/protocol/eom-server-protocol.h index 58400a7..333d0cd 100644 --- a/protocol/eom-server-protocol.h +++ b/protocol/eom-server-protocol.h @@ -196,12 +196,14 @@ struct wl_eom_interface { #define WL_EOM_OUTPUT_TYPE 2 #define WL_EOM_OUTPUT_MODE 3 #define WL_EOM_OUTPUT_ATTRIBUTE 4 +#define WL_EOM_OUTPUT_SET_WINDOW 5 #define WL_EOM_OUTPUT_COUNT_SINCE_VERSION 1 #define WL_EOM_OUTPUT_INFO_SINCE_VERSION 1 #define WL_EOM_OUTPUT_TYPE_SINCE_VERSION 1 #define WL_EOM_OUTPUT_MODE_SINCE_VERSION 1 #define WL_EOM_OUTPUT_ATTRIBUTE_SINCE_VERSION 1 +#define WL_EOM_OUTPUT_SET_WINDOW_SINCE_VERSION 1 static inline void wl_eom_send_output_count(struct wl_resource *resource_, uint32_t count) @@ -233,6 +235,12 @@ wl_eom_send_output_attribute(struct wl_resource *resource_, uint32_t output_id, wl_resource_post_event(resource_, WL_EOM_OUTPUT_ATTRIBUTE, output_id, attribute, attribute_state, error); } +static inline void +wl_eom_send_output_set_window(struct wl_resource *resource_, uint32_t output_id, uint32_t error) +{ + wl_resource_post_event(resource_, WL_EOM_OUTPUT_SET_WINDOW, output_id, error); +} + #ifdef __cplusplus } #endif diff --git a/protocol/eom.xml b/protocol/eom.xml index 699d499..ff50650 100644 --- a/protocol/eom.xml +++ b/protocol/eom.xml @@ -124,6 +124,11 @@ + + + + + diff --git a/src/e_mod_main.c b/src/e_mod_main.c index 5d193ad..37aa0e2 100644 --- a/src/e_mod_main.c +++ b/src/e_mod_main.c @@ -1434,8 +1434,6 @@ _e_eom_window_set_internal(struct wl_resource *resource, int output_id, E_Client eom_client = _e_eom_client_get_by_resource(resource); RETURNIFTRUE(eom_client == NULL, "eom_client is NULL"); - RETURNIFTRUE(eom_client->current == EINA_FALSE, "not current client is going to set its window"); - eom_output = _e_eom_output_get_by_id(output_id); RETURNIFTRUE(eom_output == NULL, "eom_output is NULL"); @@ -1450,6 +1448,11 @@ _e_eom_window_set_internal(struct wl_resource *resource, int output_id, E_Client /* ec is used in buffer_change callback for distinguishing external ec and its buffers */ eom_client->ec = ec; + + if (eom_client->current == EINA_TRUE) + wl_eom_send_output_set_window(resource, eom_output->id, WL_EOM_ERROR_NONE); + else + wl_eom_send_output_set_window(resource, eom_output->id, WL_EOM_ERROR_OUTPUT_OCCUPIED); } static Eina_Bool -- 2.7.4 From b4ab8bfcdc2aa65c6b9ba0d1e1efcc1052906274 Mon Sep 17 00:00:00 2001 From: Roman Peresipkyn Date: Wed, 3 Aug 2016 13:44:10 +0300 Subject: [PATCH 04/16] fixing. Add measuring of fps. Add doxygen documentation Change-Id: I235e8421c067b9a79066c37a8c7a5c9dfe834959 Signed-off-by: Roman Peresipkyn --- src/e_mod_main.c | 88 +++++++++++++++++++++++++++++++++++--------------------- src/e_mod_main.h | 43 ++++++++++++++------------- 2 files changed, 76 insertions(+), 55 deletions(-) diff --git a/src/e_mod_main.c b/src/e_mod_main.c index 37aa0e2..5565a80 100644 --- a/src/e_mod_main.c +++ b/src/e_mod_main.c @@ -11,14 +11,14 @@ #include "Ecore_Drm.h" #include +#ifdef FRAMES + #include +#endif + E_API E_Module_Api e_modapi = { E_MODULE_API_VERSION, "EOM Module" }; static E_EomPtr g_eom = NULL; Eina_Bool eom_server_debug_on = EINA_FALSE; -#ifdef DUMP_PRESENTATION -static int dump = 0; -#endif - static const struct wl_eom_interface _e_eom_wl_implementation = { _e_eom_cb_wl_request_set_attribute, @@ -543,16 +543,17 @@ _e_eom_cb_commit(tdm_output *output EINA_UNUSED, unsigned int sequence EINA_UNUS #endif #ifdef DUMP_PRESENTATION - if (dump < 29) - { - tbm_surface_internal_dump_buffer(external_buffer, "kyky"); - dump++; - } - else - { - tbm_surface_internal_dump_end(); - EOM_DBG("dump end"); - } + if (eom_output->dump_do) + { + tbm_surface_internal_dump_buffer(external_buffer, "eom_buffer"); + eom_output->dump_count++; + + if (eom_output->dump_count > DUMP_NUM) + { + tbm_surface_internal_dump_end(); + eom_output->dump_do = EINA_FALSE; + } + } #endif err = tdm_layer_set_buffer(eom_output->layer, external_buffer); @@ -563,6 +564,10 @@ _e_eom_cb_commit(tdm_output *output EINA_UNUSED, unsigned int sequence EINA_UNUS EOM_DBG("COMMIT <+++++++++++++++"); } + +#ifdef FRAMES + _e_eom_util_check_frames(eom_output); +#endif } static void @@ -659,7 +664,13 @@ _e_eom_cb_tdm_output_status_change(tdm_output *output, tdm_output_change_type ty eom_output->status = plug; eom_output->name = eina_stringshare_add(new_name); eom_output->type = (eom_output_type_e)tdm_type; +#ifdef DUMP_PRESENTATION + eom_output->dump_do = EINA_TRUE; + eom_output->dump_count = 1; + EOM_DBG("dump init"); + tbm_surface_internal_dump_start("/eom_buffers", eom_output->width, eom_output->height, DUMP_NUM); +#endif /* TODO: check output mode(presentation set) and HDMI type */ _e_eom_output_start_mirror(eom_output); @@ -729,7 +740,6 @@ _e_eom_cb_wl_request_set_attribute(struct wl_client *client, struct wl_resource eom_error_e eom_error = EOM_ERROR_NONE; E_EomClientPtr eom_client = NULL, current_eom_client = NULL, iterator = NULL; E_EomOutputPtr eom_output = NULL; - Eina_Bool changes = EINA_FALSE; Eina_Bool ret = EINA_FALSE; Eina_List *l; @@ -748,7 +758,6 @@ _e_eom_cb_wl_request_set_attribute(struct wl_client *client, struct wl_resource { /* Current client can set any flag it wants */ _e_eom_output_state_set_force_attribute(eom_output, attribute); - changes = EINA_TRUE; } else { @@ -761,15 +770,6 @@ _e_eom_cb_wl_request_set_attribute(struct wl_client *client, struct wl_resource eom_error = EOM_ERROR_INVALID_PARAMETER; goto end; } - - changes = EINA_TRUE; - } - - /* If there was no new changes applied do nothing */ - if (changes == EINA_FALSE) - { - EOM_DBG("no new changes"); - return; } EOM_DBG("set attribute OK"); @@ -1584,14 +1584,6 @@ _e_eom_util_create_client_buffer(E_EomClientPtr client, E_Comp_Wl_Buffer *wl_buf EOM_DBG("new client buffer wl:%p tbm:%p", buffer->wl_buffer, buffer->tbm_buffer); -#ifdef DUMP_PRESENTATION - if (dump == 0) - { - EOM_DBG("dump start"); - tbm_surface_internal_dump_start("/A", wl_buffer->w, wl_buffer->h, 30); - } -#endif - #if 0 buffer->stamp = _e_eom_util_get_stamp(); #endif @@ -1780,6 +1772,36 @@ _e_eom_util_draw(tbm_surface_h surface) tbm_bo_unmap(bo); } #endif +#ifdef FRAMES +static void _e_eom_util_check_frames(E_EomOutputPtr eom_output) +{ + int res = 0; + static int first = 1; + + eom_output->num_frames += 1; + res = gettimeofday(&eom_output->curr, NULL); + if (res) + { + EOM_ERR("gettimeofday"); + return; + } + + if (eom_output->curr.tv_sec > eom_output->prev.tv_sec && !first) + { + EOM_DBG("FPS:%d", eom_output->num_frames); + + eom_output->num_frames = 0; + eom_output->prev.tv_sec = eom_output->curr.tv_sec; + eom_output->prev.tv_usec = eom_output->curr.tv_usec; + } + else + { + eom_output->prev.tv_sec = eom_output->curr.tv_sec; + eom_output->prev.tv_usec = eom_output->curr.tv_usec; + first = 0; + } +} +#endif static void _e_eom_client_add_buffer(E_EomClientPtr client, E_EomClientBufferPtr buffer) diff --git a/src/e_mod_main.h b/src/e_mod_main.h index d718aea..365b914 100644 --- a/src/e_mod_main.h +++ b/src/e_mod_main.h @@ -9,6 +9,12 @@ #if 0 #define DUMP_PRESENTATION + #define DUMP_NUM 30 +#endif + +#if 0 + #define FRAMES + #include #endif extern Eina_Bool eom_server_debug_on; @@ -58,29 +64,8 @@ if (statement) \ /* E Module */ E_API extern E_Module_Api e_modapi; - -/** - * @brief Called when Enlightenment is going to load the module - * @param[in] m structure which defines Enlightenment module - * @see e_modapi_shutdown() - * @see e_modapi_save() - */ E_API void *e_modapi_init(E_Module *m); - -/** - * @brief Called when Enlightenment is going to unload the module - * @param[in] m structure which defines Enlightenment module - * @see e_modapi_init() - * @see e_modapi_save() - */ E_API int e_modapi_shutdown(E_Module *m); - -/** - * @brief Called when Enlightenment is going to save some info in the module - * @param[in] m structure which defines Enlightenment module - * @see e_modapi_init() - * @see e_modapi_shutdown() - */ E_API int e_modapi_save(E_Module *m); #define NUM_MAIN_BUF 2 @@ -143,6 +128,18 @@ struct _E_Eom_Output int pp_buffer; tbm_surface_h dummy_buffer; + +#ifdef DUMP_PRESENTATION + Eina_Bool dump_do; + int dump_count; +#endif +#ifdef FRAMES + /* for testing purposes */ + struct timeval prev; + struct timeval curr; + + int num_frames; +#endif }; struct _E_Eom @@ -261,7 +258,9 @@ static int _e_eom_util_get_stamp(); #ifdef DRAW_DUMMY static void _e_eom_util_draw(tbm_surface_h surface); #endif - +#ifdef FRAMES +static void _e_eom_util_check_frames(E_EomOutputPtr eom_output); +#endif static void _e_eom_client_add_buffer(E_EomClientPtr client, E_EomClientBufferPtr buffer); static void _e_eom_client_free_buffers(E_EomClientPtr client); static E_EomClientBufferPtr _e_eom_client_get_buffer(E_EomClientPtr client); -- 2.7.4 From 0b305c9f3c49692af09018785504823039944d97 Mon Sep 17 00:00:00 2001 From: Junkyeong Kim Date: Fri, 5 Aug 2016 15:33:04 +0900 Subject: [PATCH 05/16] enable mirror showing when booting with hdmi connection Change-Id: Icbc52fcb794636eb787efe36f277a2317053e1d4 Signed-off-by: Junkyeong Kim --- src/e_mod_main.c | 250 +++++++++++++++++++++++++++++++++++++------------------ src/e_mod_main.h | 4 + 2 files changed, 174 insertions(+), 80 deletions(-) diff --git a/src/e_mod_main.c b/src/e_mod_main.c index 5565a80..e7fac6c 100644 --- a/src/e_mod_main.c +++ b/src/e_mod_main.c @@ -275,6 +275,77 @@ end2: } static Eina_Bool +_e_eom_check_boot_connection(void *data) +{ + if (g_eom->check_first_boot != 0) + { + g_eom->timer = NULL; + return ECORE_CALLBACK_CANCEL; + } + + g_eom->check_first_boot = 1; + + if (g_eom->outputs) + { + Eina_List *l; + E_EomOutputPtr eom_output; + + EINA_LIST_FOREACH(g_eom->outputs, l, eom_output) + { + tdm_output *output; + const char *tmp_name; + char new_name[DRM_CONNECTOR_NAME_LEN]; + tdm_output_type tdm_type; + tdm_error ret = TDM_ERROR_NONE; + tdm_output_conn_status status; + + if (eom_output->id == 0) + continue; + + output = eom_output->output; + if (output == NULL) + { + EOM_ERR("output is null fail"); + continue; + } + + ret = tdm_output_get_conn_status(output, &status); + if (ret != TDM_ERROR_NONE) + { + EOM_ERR("tdm_output_get_conn_status fail(%d)", ret); + continue; + } + + if (status == TDM_OUTPUT_CONN_STATUS_DISCONNECTED) + continue; + + ret = tdm_output_get_output_type(output, &tdm_type); + if (ret != TDM_ERROR_NONE) + { + EOM_ERR("tdm_output_get_output_type fail(%d)", ret); + continue; + } + + if (tdm_type < ALEN(eom_conn_types)) + tmp_name = eom_conn_types[tdm_type]; + else + tmp_name = "unknown"; + /*TODO: What if there will more then one output of same type. + *e.g. "HDMI and HDMI" "LVDS and LVDS"*/ + snprintf(new_name, sizeof(new_name), "%s-%d", tmp_name, 0); + + eom_output->type = (eom_output_type_e)tdm_type; + eom_output->name = eina_stringshare_add(new_name); + eom_output->status = status; + + _e_eom_output_connected(eom_output); + } + } + g_eom->timer = NULL; + return ECORE_CALLBACK_CANCEL; +} + +static Eina_Bool _e_eom_cb_ecore_drm_output(void *data EINA_UNUSED, int type EINA_UNUSED, void *event) { Ecore_Drm_Event_Output *e = NULL; @@ -298,6 +369,13 @@ _e_eom_cb_ecore_drm_output(void *data EINA_UNUSED, int type EINA_UNUSED, void *e g_eom->main_output_name = strdup(buff); g_eom->main_output_state = UP; + + if (g_eom->check_first_boot == 0) + { + if (g_eom->timer) + ecore_timer_del(g_eom->timer); + g_eom->timer = ecore_timer_add(EOM_CONNECT_CHECK_TIMEOUT, _e_eom_check_boot_connection, NULL); + } } else { @@ -570,20 +648,99 @@ _e_eom_cb_commit(tdm_output *output EINA_UNUSED, unsigned int sequence EINA_UNUS #endif } +static int +_e_eom_output_connected(E_EomOutputPtr eom_output) +{ + tdm_output *output; + tdm_error ret = TDM_ERROR_NONE; + const char *maker = NULL, *model = NULL, *name = NULL; + unsigned int mmWidth, mmHeight, subpixel; + const tdm_output_mode *mode; + int x = 0; + E_EomClientPtr iterator = NULL; + Eina_List *l; + + output = eom_output->output; + + ret = tdm_output_get_model_info(output, &maker, &model, &name); + RETURNVALIFTRUE(ret != TDM_ERROR_NONE, -1, "tdm_output_get_model_info fail(%d)", ret); + + ret = tdm_output_get_physical_size(output, &mmWidth, &mmHeight); + RETURNVALIFTRUE(ret != TDM_ERROR_NONE, -1, "tdm_output_get_physical_size fail(%d)", ret); + + ret = tdm_output_get_subpixel(output, &subpixel); + RETURNVALIFTRUE(ret != TDM_ERROR_NONE, -1, "tdm_output_get_subpixel fail(%d)", ret); + + mode = _e_eom_output_get_best_mode(output); + RETURNVALIFTRUE(mode == NULL, -1, "_e_eom_get_best_resolution fail"); + + ret = tdm_output_set_mode(output, mode); + RETURNVALIFTRUE(ret != TDM_ERROR_NONE, -1, "tdm_output_set_mode fail(%d)", ret); + + x = _e_eom_output_get_position(); + EOM_DBG("mode: %dx%d, phy(%dx%d), pos(%d,0), refresh:%d, subpixel:%d", + mode->hdisplay, mode->vdisplay, mmWidth, mmHeight, x, mode->vrefresh, subpixel); + + if (!e_comp_wl_output_init(eom_output->name, maker, eom_output->name, x, 0, + mode->hdisplay, mode->vdisplay, + mmWidth, mmHeight, mode->vrefresh, subpixel, 0)) + { + EOM_ERR("Could not setup new output: %s", eom_output->name); + return -1; + } + EOM_DBG("Setup new output: %s", eom_output->name); + + /* update eom_output connect */ + eom_output->width = mode->hdisplay; + eom_output->height = mode->vdisplay; + eom_output->phys_width = mmWidth; + eom_output->phys_height = mmHeight; +#ifdef DUMP_PRESENTATION + eom_output->dump_do = EINA_TRUE; + eom_output->dump_count = 1; + + EOM_DBG("dump init"); + tbm_surface_internal_dump_start("/eom_buffers", eom_output->width, eom_output->height, DUMP_NUM); +#endif + /* TODO: check output mode(presentation set) and HDMI type */ + _e_eom_output_start_mirror(eom_output); + + /* If there were previously connected clients to the output - notify them */ + EINA_LIST_FOREACH(g_eom->clients, l, iterator) + { + if (iterator) + { + EOM_DBG("Send MIRROR ON notification to clients"); + + wl_eom_send_output_info(iterator->resource, eom_output->id, + eom_output->type, eom_output->mode, + eom_output->width, eom_output->height, + eom_output->phys_width, eom_output->phys_height, + eom_output->status); + + wl_eom_send_output_attribute(iterator->resource, + eom_output->id, + _e_eom_output_state_get_attribute(eom_output), + _e_eom_output_state_get_attribute_state(eom_output), + EOM_ERROR_NONE); + } + } + + return 0; +} + static void _e_eom_cb_tdm_output_status_change(tdm_output *output, tdm_output_change_type type, tdm_value value, void *user_data) { tdm_output_type tdm_type; tdm_error ret = TDM_ERROR_NONE; tdm_output_conn_status status; - tdm_output_conn_status status2; - const char *maker = NULL, *model = NULL, *name = NULL; const char *tmp_name; char new_name[DRM_CONNECTOR_NAME_LEN]; E_EomOutputPtr eom_output = NULL; tdm_output_conn_status plug; - E_EomClientPtr iterator = NULL; - Eina_List *l; + + g_eom->check_first_boot = 1; if (type == TDM_OUTPUT_CHANGE_DPMS || g_eom->main_output_state == DOWN) return; @@ -603,15 +760,12 @@ _e_eom_cb_tdm_output_status_change(tdm_output *output, tdm_output_change_type ty ret = tdm_output_get_output_type(output, &tdm_type); RETURNIFTRUE(ret != TDM_ERROR_NONE, "tdm_output_get_output_type fail(%d)", ret); - ret = tdm_output_get_model_info(output, &maker, &model, &name); - RETURNIFTRUE(ret != TDM_ERROR_NONE, "tdm_output_get_model_info fail(%d)", ret); - ret = tdm_output_get_conn_status(output, &status); RETURNIFTRUE(ret != TDM_ERROR_NONE, "tdm_output_get_conn_status fail(%d)", ret); - status2 = value.u32; + plug = value.u32; - EOM_DBG("id (%d), type(%d, %d), status(%d, %d) (%s,%s,%s)", eom_output->id, type, tdm_type, status, status2, maker, model, name); + EOM_DBG("id (%d), type(%d, %d), status(%d, %d)", eom_output->id, type, tdm_type, status, plug); if (tdm_type < ALEN(eom_conn_types)) tmp_name = eom_conn_types[tdm_type]; @@ -621,82 +775,19 @@ _e_eom_cb_tdm_output_status_change(tdm_output *output, tdm_output_change_type ty *e.g. "HDMI and HDMI" "LVDS and LVDS"*/ snprintf(new_name, sizeof(new_name), "%s-%d", tmp_name, 0); - plug = value.u32; + eom_output->type = (eom_output_type_e)tdm_type; + eom_output->name = eina_stringshare_add(new_name); + eom_output->status = plug; if (plug == TDM_OUTPUT_CONN_STATUS_CONNECTED) { - unsigned int mmWidth, mmHeight, subpixel; - const tdm_output_mode *mode; - int x = 0; - - ret = tdm_output_get_physical_size(output, &mmWidth, &mmHeight); - RETURNIFTRUE(ret != TDM_ERROR_NONE, "tdm_output_get_physical_size fail(%d)", ret); - - ret = tdm_output_get_subpixel(output, &subpixel); - RETURNIFTRUE(ret != TDM_ERROR_NONE, "tdm_output_get_subpixel fail(%d)", ret); - - mode = _e_eom_output_get_best_mode(output); - RETURNIFTRUE(mode == NULL, "_e_eom_get_best_resolution fail"); - - ret = tdm_output_set_mode(output, mode); - RETURNIFTRUE(ret != TDM_ERROR_NONE, "tdm_output_set_mode fail(%d)", ret); - - x = _e_eom_output_get_position(); - EOM_DBG("mode: %dx%d, phy(%dx%d), pos(%d,0), refresh:%d, subpixel:%d", - mode->hdisplay, mode->vdisplay, mmWidth, mmHeight, x, mode->vrefresh, subpixel); - - /* model is substituted with new_name. - * It used to bind wl_output with eom_output in libeom. */ - if (!e_comp_wl_output_init(new_name, maker, new_name, x, 0, - mode->hdisplay, mode->vdisplay, - mmWidth, mmHeight, mode->vrefresh, subpixel, 0)) - { - EOM_ERR("Could not setup new output: %s", new_name); - return; - } - EOM_DBG("Setup new output: %s", new_name); - - /* update eom_output connect */ - eom_output->width = mode->hdisplay; - eom_output->height = mode->vdisplay; - eom_output->phys_width = mmWidth; - eom_output->phys_height = mmHeight; - eom_output->status = plug; - eom_output->name = eina_stringshare_add(new_name); - eom_output->type = (eom_output_type_e)tdm_type; -#ifdef DUMP_PRESENTATION - eom_output->dump_do = EINA_TRUE; - eom_output->dump_count = 1; - - EOM_DBG("dump init"); - tbm_surface_internal_dump_start("/eom_buffers", eom_output->width, eom_output->height, DUMP_NUM); -#endif - /* TODO: check output mode(presentation set) and HDMI type */ - _e_eom_output_start_mirror(eom_output); - - /* If there were previously connected clients to the output - notify them */ - EINA_LIST_FOREACH(g_eom->clients, l, iterator) - { - if (iterator) - { - EOM_DBG("Send MIRROR ON notification to clients"); - - wl_eom_send_output_info(iterator->resource, eom_output->id, - eom_output->type, eom_output->mode, - eom_output->width, eom_output->height, - eom_output->phys_width, eom_output->phys_height, - eom_output->status); - - wl_eom_send_output_attribute(iterator->resource, - eom_output->id, - _e_eom_output_state_get_attribute(eom_output), - _e_eom_output_state_get_attribute_state(eom_output), - EOM_ERROR_NONE); - } - } + _e_eom_output_connected(eom_output); } else if (plug == TDM_OUTPUT_CONN_STATUS_DISCONNECTED) { + E_EomClientPtr iterator = NULL; + Eina_List *l; + if (eom_output->state == MIRROR) _e_eom_output_stop_mirror(eom_output); @@ -705,7 +796,6 @@ _e_eom_cb_tdm_output_status_change(tdm_output *output, tdm_output_change_type ty eom_output->height = 0; eom_output->phys_width = 0; eom_output->phys_height = 0; - eom_output->status = plug; /* If there were previously connected clients to the output - notify them */ EINA_LIST_FOREACH(g_eom->clients, l, iterator) diff --git a/src/e_mod_main.h b/src/e_mod_main.h index 365b914..b24a5b8 100644 --- a/src/e_mod_main.h +++ b/src/e_mod_main.h @@ -70,6 +70,7 @@ E_API int e_modapi_save(E_Module *m); #define NUM_MAIN_BUF 2 #define NUM_ATTR 3 +#define EOM_CONNECT_CHECK_TIMEOUT 7.0 typedef struct _E_Eom E_Eom, *E_EomPtr; typedef struct _E_Eom_Out_Mode E_EomOutMode, *E_EomOutModePtr; @@ -155,6 +156,8 @@ struct _E_Eom char *main_output_name; int width; int height; + char check_first_boot; + Ecore_Timer *timer; unsigned int output_count; Eina_List *outputs; @@ -252,6 +255,7 @@ static void _e_eom_util_calculate_fullsize(int src_h, int src_v, int dst_size_h, int *dst_x, int *dst_y, int *dst_w, int *dst_h); static tbm_surface_h _e_eom_util_get_output_surface(const char *name); static Eina_Bool _e_eom_util_add_comp_object_redirected_hook(E_Client *ec); +static int _e_eom_output_connected(E_EomOutputPtr eom_output); #if 0 static int _e_eom_util_get_stamp(); #endif -- 2.7.4 From 7095d6a47acfcbab51db4c417f65c882b82161fb Mon Sep 17 00:00:00 2001 From: Roman Peresipkyn Date: Fri, 5 Aug 2016 15:15:03 +0300 Subject: [PATCH 06/16] Start showing recently binded current client's external window if there has been connectetd external outpout changes: 1. send EOM's attribute and attribute_status states in 'info' event on connection and disconnection of an external output. It was necessary because events on clients side are handled in wron way. 2. Send ACTIVE and INACTIVE events to 'current' client if external output has been connected or disconnected. Change-Id: Iae4e6396fd71ac911c8b9938756967362c44fd2e Signed-off-by: Roman Peresipkyn --- protocol/eom-client-protocol.h | 10 +++++- protocol/eom-protocol.c | 10 ++++-- protocol/eom-server-protocol.h | 4 +-- protocol/eom.xml | 12 +++++--- src/e_mod_main.c | 70 +++++++++++++++++++++++------------------- 5 files changed, 64 insertions(+), 42 deletions(-) diff --git a/protocol/eom-client-protocol.h b/protocol/eom-client-protocol.h index 1fcd29d..4aacb71 100644 --- a/protocol/eom-client-protocol.h +++ b/protocol/eom-client-protocol.h @@ -174,6 +174,10 @@ struct wl_eom_listener { * @w_mm: (none) * @h_mm: (none) * @connection: (none) + * @skip: (none) + * @attribute: (none) + * @attribute_state: (none) + * @error: (none) */ void (*output_info)(void *data, struct wl_eom *wl_eom, @@ -184,7 +188,11 @@ struct wl_eom_listener { uint32_t h, uint32_t w_mm, uint32_t h_mm, - uint32_t connection); + uint32_t connection, + uint32_t skip, + uint32_t attribute, + uint32_t attribute_state, + uint32_t error); /** * output_type - (none) * @output_id: (none) diff --git a/protocol/eom-protocol.c b/protocol/eom-protocol.c index c032027..b0b38d5 100644 --- a/protocol/eom-protocol.c +++ b/protocol/eom-protocol.c @@ -15,6 +15,10 @@ static const struct wl_interface *types[] = { NULL, NULL, NULL, + NULL, + NULL, + NULL, + NULL, &xdg_surface_interface, NULL, &wl_shell_surface_interface, @@ -22,14 +26,14 @@ static const struct wl_interface *types[] = { static const struct wl_message wl_eom_requests[] = { { "set_attribute", "uu", types + 0 }, - { "set_xdg_window", "uo", types + 8 }, - { "set_shell_window", "uo", types + 10 }, + { "set_xdg_window", "uo", types + 12 }, + { "set_shell_window", "uo", types + 14 }, { "get_output_info", "u", types + 0 }, }; static const struct wl_message wl_eom_events[] = { { "output_count", "u", types + 0 }, - { "output_info", "uuuuuuuu", types + 0 }, + { "output_info", "uuuuuuuuuuuu", types + 0 }, { "output_type", "uuu", types + 0 }, { "output_mode", "uu", types + 0 }, { "output_attribute", "uuuu", types + 0 }, diff --git a/protocol/eom-server-protocol.h b/protocol/eom-server-protocol.h index 333d0cd..f170f7f 100644 --- a/protocol/eom-server-protocol.h +++ b/protocol/eom-server-protocol.h @@ -212,9 +212,9 @@ wl_eom_send_output_count(struct wl_resource *resource_, uint32_t count) } static inline void -wl_eom_send_output_info(struct wl_resource *resource_, uint32_t output_id, uint32_t type, uint32_t mode, uint32_t w, uint32_t h, uint32_t w_mm, uint32_t h_mm, uint32_t connection) +wl_eom_send_output_info(struct wl_resource *resource_, uint32_t output_id, uint32_t type, uint32_t mode, uint32_t w, uint32_t h, uint32_t w_mm, uint32_t h_mm, uint32_t connection, uint32_t skip, uint32_t attribute, uint32_t attribute_state, uint32_t error) { - wl_resource_post_event(resource_, WL_EOM_OUTPUT_INFO, output_id, type, mode, w, h, w_mm, h_mm, connection); + wl_resource_post_event(resource_, WL_EOM_OUTPUT_INFO, output_id, type, mode, w, h, w_mm, h_mm, connection, skip, attribute, attribute_state, error); } static inline void diff --git a/protocol/eom.xml b/protocol/eom.xml index ff50650..2ea8e15 100644 --- a/protocol/eom.xml +++ b/protocol/eom.xml @@ -34,7 +34,7 @@ - + ***** TODO ****** @@ -43,7 +43,7 @@ - + ***** TODO ****** @@ -52,7 +52,7 @@ - + ***** TODO ****** @@ -62,7 +62,7 @@ - + ***** TODO ****** @@ -104,6 +104,10 @@ + + + + diff --git a/src/e_mod_main.c b/src/e_mod_main.c index e7fac6c..0a7a94d 100644 --- a/src/e_mod_main.c +++ b/src/e_mod_main.c @@ -183,13 +183,8 @@ _e_eom_cb_wl_bind(struct wl_client *client, void *data, uint32_t version, uint32 output->id, output->type, output->mode, output->width, output->height, output->phys_width, output->phys_height, output->status); wl_eom_send_output_info(resource, output->id, output->type, output->mode, output->width, output->height, - output->phys_width, output->phys_height, output->status); - - wl_eom_send_output_attribute(resource, - output->id, - _e_eom_output_state_get_attribute(output), - _e_eom_output_state_get_attribute_state(output), - EOM_ERROR_NONE); + output->phys_width, output->phys_height, output->status, + 1, 0, 0, 0); } } @@ -712,17 +707,23 @@ _e_eom_output_connected(E_EomOutputPtr eom_output) { EOM_DBG("Send MIRROR ON notification to clients"); - wl_eom_send_output_info(iterator->resource, eom_output->id, - eom_output->type, eom_output->mode, - eom_output->width, eom_output->height, - eom_output->phys_width, eom_output->phys_height, - eom_output->status); - - wl_eom_send_output_attribute(iterator->resource, - eom_output->id, - _e_eom_output_state_get_attribute(eom_output), - _e_eom_output_state_get_attribute_state(eom_output), - EOM_ERROR_NONE); + if (iterator->current) + wl_eom_send_output_info(iterator->resource, eom_output->id, + eom_output->type, eom_output->mode, + eom_output->width, eom_output->height, + eom_output->phys_width, eom_output->phys_height, + eom_output->status, + 0, + _e_eom_output_state_get_attribute(eom_output), + EOM_OUTPUT_ATTRIBUTE_STATE_ACTIVE, + EOM_ERROR_NONE); + else + wl_eom_send_output_info(iterator->resource, eom_output->id, + eom_output->type, eom_output->mode, + eom_output->width, eom_output->height, + eom_output->phys_width, eom_output->phys_height, + eom_output->status, + 1, 0, 0, 0); } } @@ -803,18 +804,23 @@ _e_eom_cb_tdm_output_status_change(tdm_output *output, tdm_output_change_type ty if (iterator) { EOM_DBG("Send MIRROR OFF notification to clients"); - - wl_eom_send_output_info(iterator->resource, eom_output->id, - eom_output->type, eom_output->mode, - eom_output->width, eom_output->height, - eom_output->phys_width, eom_output->phys_height, - eom_output->status); - - wl_eom_send_output_attribute(iterator->resource, - eom_output->id, - _e_eom_output_state_get_attribute(eom_output), - EOM_OUTPUT_ATTRIBUTE_STATE_LOST, - EOM_ERROR_NONE); + if (iterator->current) + wl_eom_send_output_info(iterator->resource, eom_output->id, + eom_output->type, eom_output->mode, + eom_output->width, eom_output->height, + eom_output->phys_width, eom_output->phys_height, + eom_output->status, + 0, + _e_eom_output_state_get_attribute(eom_output), + EOM_OUTPUT_ATTRIBUTE_STATE_INACTIVE, + EOM_ERROR_NONE); + else + wl_eom_send_output_info(iterator->resource, eom_output->id, + eom_output->type, eom_output->mode, + eom_output->width, eom_output->height, + eom_output->phys_width, eom_output->phys_height, + eom_output->status, + 1, 0, 0, 0); } } @@ -1033,7 +1039,7 @@ _e_eom_cb_wl_request_get_output_info(struct wl_client *client, struct wl_resourc output->phys_width, output->phys_height, output->status); wl_eom_send_output_info(resource, output->id, output->type, output->mode, output->width, output->height, - output->phys_width, output->phys_height, output->status); + output->phys_width, output->phys_height, output->status, 1, 0, 0, 0); } } } @@ -1314,7 +1320,7 @@ _e_eom_output_start_mirror(E_EomOutputPtr eom_output) GOTOIFTRUE(tdm_err != TDM_ERROR_NONE, err, "Commit crtc:%d", tdm_err); _e_eom_output_state_set_mode(eom_output, EOM_OUTPUT_MODE_MIRROR); - _e_eom_output_state_set_attribute(eom_output, EOM_OUTPUT_ATTRIBUTE_NONE); + /* _e_eom_output_state_set_attribute(eom_output, EOM_OUTPUT_ATTRIBUTE_NONE); */ eom_output->state = MIRROR; return; -- 2.7.4 From adaecb9162917c51e2c500b4737e48f4d7ac1a6f Mon Sep 17 00:00:00 2001 From: Junkyeong Kim Date: Wed, 17 Aug 2016 19:12:12 +0900 Subject: [PATCH 07/16] revert 'disable hwc redering of external outputs' Change-Id: Id724e080d90b5274362f68bf340324d1a474a06f Signed-off-by: Junkyeong Kim --- configure.ac | 19 ------------------- src/e_mod_main.c | 4 ---- 2 files changed, 23 deletions(-) diff --git a/configure.ac b/configure.ac index b1cc3a2..56d3d27 100644 --- a/configure.ac +++ b/configure.ac @@ -51,25 +51,6 @@ if test "x${have_wayland_only}" != "xno"; then AC_DEFINE_UNQUOTED([HAVE_WAYLAND_ONLY],[1],[enable wayland-only version of enlightenment]) fi -have_hwc=no -AC_ARG_ENABLE([hwc], - AS_HELP_STRING([--enable-hwc],[enable hwc @<:@default=enabled@:>@]), - [e_cv_want_hwc=$enableval], - [e_cv_want_hwc=yes]) -AC_MSG_CHECKING([whether HWC support is enabled]) -AC_MSG_RESULT([${e_cv_want_hwc}]) - -if test "x$e_cv_want_hwc" != "xno";then - PKG_CHECK_MODULES([HWC], [gbm], - [ - have_hwc=yes - AC_DEFINE_UNQUOTED([HAVE_HWC],[1],[enable hwc support]) - ]) -else - have_hwc=no -fi -AM_CONDITIONAL([HAVE_HWC], [test "x${have_hwc}" = "xyes"]) - dnl ======================================================================== # checks for wayland only argument dnl ======================================================================== diff --git a/src/e_mod_main.c b/src/e_mod_main.c index 0a7a94d..13f3226 100644 --- a/src/e_mod_main.c +++ b/src/e_mod_main.c @@ -1140,10 +1140,6 @@ _e_eom_output_init(tdm_display *dpy) goto err; } -#ifdef HAVE_HWC - e_comp_hwc_disable_output_hwc_rendering(i, 0); -#endif - if (status == TDM_OUTPUT_CONN_STATUS_DISCONNECTED) { EOM_DBG("create(%d)output, type:%d, status:%d", -- 2.7.4 From 49b223a4341feeea6e56249d8713e75741a4c79d Mon Sep 17 00:00:00 2001 From: Junkyeong Kim Date: Wed, 17 Aug 2016 19:16:10 +0900 Subject: [PATCH 08/16] send correct connection value Change-Id: Ia67750b2ee0690d4bd9151324efb2967a5b3cc7d Signed-off-by: Junkyeong Kim --- src/e_mod_main.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/e_mod_main.c b/src/e_mod_main.c index 13f3226..f9f6b33 100644 --- a/src/e_mod_main.c +++ b/src/e_mod_main.c @@ -346,7 +346,7 @@ _e_eom_cb_ecore_drm_output(void *data EINA_UNUSED, int type EINA_UNUSED, void *e Ecore_Drm_Event_Output *e = NULL; char buff[PATH_MAX]; - if (!(e = event)) return ECORE_CALLBACK_PASS_ON; + if (!(e = event)) return ECORE_CALLBACK_PASS_ON; EOM_DBG("id:%d (x,y,w,h):(%d,%d,%d,%d) (w_mm,h_mm):(%d,%d) refresh:%d subpixel_order:%d transform:%d make:%s model:%s name:%s plug:%d", e->id, e->x, e->y, e->w, e->h, e->phys_width, e->phys_height, e->refresh, e->subpixel_order, e->transform, e->make, e->model, e->name, e->plug); @@ -712,7 +712,7 @@ _e_eom_output_connected(E_EomOutputPtr eom_output) eom_output->type, eom_output->mode, eom_output->width, eom_output->height, eom_output->phys_width, eom_output->phys_height, - eom_output->status, + WL_EOM_STATUS_CONNECTION, 0, _e_eom_output_state_get_attribute(eom_output), EOM_OUTPUT_ATTRIBUTE_STATE_ACTIVE, @@ -722,7 +722,7 @@ _e_eom_output_connected(E_EomOutputPtr eom_output) eom_output->type, eom_output->mode, eom_output->width, eom_output->height, eom_output->phys_width, eom_output->phys_height, - eom_output->status, + WL_EOM_STATUS_CONNECTION, 1, 0, 0, 0); } } @@ -809,7 +809,7 @@ _e_eom_cb_tdm_output_status_change(tdm_output *output, tdm_output_change_type ty eom_output->type, eom_output->mode, eom_output->width, eom_output->height, eom_output->phys_width, eom_output->phys_height, - eom_output->status, + WL_EOM_STATUS_DISCONNECTION, 0, _e_eom_output_state_get_attribute(eom_output), EOM_OUTPUT_ATTRIBUTE_STATE_INACTIVE, @@ -819,7 +819,7 @@ _e_eom_cb_tdm_output_status_change(tdm_output *output, tdm_output_change_type ty eom_output->type, eom_output->mode, eom_output->width, eom_output->height, eom_output->phys_width, eom_output->phys_height, - eom_output->status, + WL_EOM_STATUS_DISCONNECTION, 1, 0, 0, 0); } } -- 2.7.4 From 3b7918b225ab9bf686b4590ae22400d57a53a82c Mon Sep 17 00:00:00 2001 From: Junkyeong Kim Date: Thu, 18 Aug 2016 16:35:01 +0900 Subject: [PATCH 09/16] add _e_eom_output_stop_presentation and execute it for disconnecting when presentation mode Change-Id: I9b37f3488f4dcc0c71d6f24e1a663086b17beb70 Signed-off-by: Junkyeong Kim --- src/e_mod_main.c | 42 ++++++++++++++++++++++++++++++++++-------- src/e_mod_main.h | 3 ++- 2 files changed, 36 insertions(+), 9 deletions(-) diff --git a/src/e_mod_main.c b/src/e_mod_main.c index f9f6b33..24838c5 100644 --- a/src/e_mod_main.c +++ b/src/e_mod_main.c @@ -791,6 +791,8 @@ _e_eom_cb_tdm_output_status_change(tdm_output *output, tdm_output_change_type ty if (eom_output->state == MIRROR) _e_eom_output_stop_mirror(eom_output); + else if (eom_output->state == PRESENTATION) + _e_eom_output_stop_presentation(eom_output); /* update eom_output disconnect */ eom_output->width = 0; @@ -1338,13 +1340,34 @@ _e_eom_output_stop_mirror(E_EomOutputPtr eom_output) _e_eom_output_state_set_mode(eom_output, EOM_OUTPUT_MODE_NONE); _e_eom_output_state_set_attribute(eom_output, EOM_OUTPUT_ATTRIBUTE_NONE); - _e_eom_output_deinit(eom_output); + _e_eom_output_deinit(eom_output, 1); eom_output->state = NONE; } static void -_e_eom_output_deinit(E_EomOutputPtr eom_output) +_e_eom_output_stop_presentation(E_EomOutputPtr eom_output) +{ + E_EomClientPtr iterator = NULL; + Eina_List *l; + + if (eom_output->state == NONE) + return; + + _e_eom_output_state_set_status(eom_output, TDM_OUTPUT_CONN_STATUS_DISCONNECTED); + _e_eom_output_state_set_mode(eom_output, EOM_OUTPUT_MODE_NONE); + + _e_eom_output_deinit(eom_output, 0); + + EINA_LIST_FOREACH(g_eom->clients, l, iterator) + if (iterator && iterator->output_id == eom_output->id) + _e_eom_client_free_buffers(iterator); + + eom_output->state = NONE; +} + +static void +_e_eom_output_deinit(E_EomOutputPtr eom_output, int pp) { tdm_error err = TDM_ERROR_NONE; E_EomClientPtr iterator = NULL; @@ -1368,14 +1391,17 @@ _e_eom_output_deinit(E_EomOutputPtr eom_output) if (err != TDM_ERROR_NONE) EOM_ERR("set DPMS off:%d", err); - for (i = 0; i < NUM_MAIN_BUF; i++) + if (pp == 1) { - tdm_buffer_remove_release_handler(eom_output->dst_buffers[i], - _e_eom_cb_pp, eom_output); + for (i = 0; i < NUM_MAIN_BUF; i++) + { + tdm_buffer_remove_release_handler(eom_output->dst_buffers[i], + _e_eom_cb_pp, eom_output); - if (eom_output->dst_buffers[i]) - tbm_surface_destroy(eom_output->dst_buffers[i]); - } + if (eom_output->dst_buffers[i]) + tbm_surface_destroy(eom_output->dst_buffers[i]); + } + } if (g_eom->main_output_state == DOWN) EINA_LIST_FOREACH(g_eom->clients, l, iterator) diff --git a/src/e_mod_main.h b/src/e_mod_main.h index b24a5b8..da6653c 100644 --- a/src/e_mod_main.h +++ b/src/e_mod_main.h @@ -235,7 +235,8 @@ static const tdm_output_mode *_e_eom_output_get_best_mode(tdm_output *output); static int _e_eom_output_get_position(void); static void _e_eom_output_start_mirror(E_EomOutputPtr eom_output); static void _e_eom_output_stop_mirror(E_EomOutputPtr eom_output); -static void _e_eom_output_deinit(E_EomOutputPtr eom_output); +static void _e_eom_output_stop_presentation(E_EomOutputPtr eom_output); +static void _e_eom_output_deinit(E_EomOutputPtr eom_output, int pp); static tdm_layer *_e_eom_output_get_layer(E_EomOutputPtr eom_output); static E_EomOutputPtr _e_eom_output_get_by_id(int id); static Eina_Bool _e_eom_output_start_pp(E_EomOutputPtr eom_output); -- 2.7.4 From e89e65a76edbe8c1cc1d0d68cb3dd51bb503a30c Mon Sep 17 00:00:00 2001 From: Junkyeong Kim Date: Tue, 30 Aug 2016 13:59:31 +0900 Subject: [PATCH 10/16] remove unnecessary build requirement Change-Id: Id2b1c8815574a53afc261a9901213f982390bf14 Signed-off-by: Junkyeong Kim --- packaging/e-mod-tizen-eom.spec | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/packaging/e-mod-tizen-eom.spec b/packaging/e-mod-tizen-eom.spec index d0b941d..aa925d4 100644 --- a/packaging/e-mod-tizen-eom.spec +++ b/packaging/e-mod-tizen-eom.spec @@ -22,10 +22,7 @@ BuildRequires: pkgconfig(libtbm) BuildRequires: pkgconfig(wayland-tbm-server) %endif BuildRequires: pkgconfig(dlog) -%if "%{?profile}" == "common" -%else -BuildRequires: e-tizen-data -%endif + %description This package is a the Enlightenment eom Module for Tizen. -- 2.7.4 From f286e69061b8769d17145756a60c15c75dd6830d Mon Sep 17 00:00:00 2001 From: Junkyeong Kim Date: Tue, 18 Oct 2016 09:59:53 +0900 Subject: [PATCH 11/16] add null checking condition Change-Id: I0caa083f3d96a5e7282c250c2ef5b7ae767ffe1a Signed-off-by: Junkyeong Kim --- src/e_mod_main.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/e_mod_main.c b/src/e_mod_main.c index 24838c5..b136010 100644 --- a/src/e_mod_main.c +++ b/src/e_mod_main.c @@ -596,6 +596,7 @@ _e_eom_cb_commit(tdm_output *output EINA_UNUSED, unsigned int sequence EINA_UNUS else if (eom_output->state == PRESENTATION) { eom_client = _e_eom_client_get_current_by_id(eom_output->id); + RETURNIFTRUE(eom_client == NULL, "commit event: eom_client is NULL"); EOM_DBG("COMMIT +++++++++++++++>"); @@ -757,6 +758,7 @@ _e_eom_cb_tdm_output_status_change(tdm_output *output, tdm_output_change_type ty eom_output = eom_output_tmp; } } + RETURNIFTRUE(eom_output == NULL, "eom_output get fail"); ret = tdm_output_get_output_type(output, &tdm_type); RETURNIFTRUE(ret != TDM_ERROR_NONE, "tdm_output_get_output_type fail(%d)", ret); @@ -1232,9 +1234,9 @@ _e_eom_output_get_best_mode(tdm_output *output) mode = &modes[i]; } } - - EOM_DBG("bestmode : %s, (%dx%d) r(%d), f(%d), t(%d)", - mode->name, mode->hdisplay, mode->vdisplay, mode->vrefresh, mode->flags, mode->type); + if (mode) + EOM_DBG("bestmode : %s, (%dx%d) r(%d), f(%d), t(%d)", + mode->name, mode->hdisplay, mode->vdisplay, mode->vrefresh, mode->flags, mode->type); return mode; } -- 2.7.4 From 767075b9a892b72e641ec60029bf7a6ccadccb32 Mon Sep 17 00:00:00 2001 From: Junkyeong Kim Date: Thu, 5 Jan 2017 16:13:12 +0900 Subject: [PATCH 12/16] use eom-server package instead of eom Change-Id: I4398d6d1017f326813d86ddcc72a878d5ed32a30 Signed-off-by: Junkyeong Kim --- configure.ac | 2 +- packaging/e-mod-tizen-eom.spec | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index 56d3d27..986b42e 100644 --- a/configure.ac +++ b/configure.ac @@ -35,7 +35,7 @@ fi PKG_CHECK_MODULES(WAYLAND_SCANNER, wayland-scanner) PKG_CHECK_MODULES(WAYLAND, [wayland-server]) -PKG_CHECK_MODULES(ENLIGHTENMENT, [enlightenment, elementary, eom, wayland-tbm-server]) +PKG_CHECK_MODULES(ENLIGHTENMENT, [enlightenment, eom-server, wayland-tbm-server]) dnl ======================================================================== # checks for wayland only argument diff --git a/packaging/e-mod-tizen-eom.spec b/packaging/e-mod-tizen-eom.spec index aa925d4..e2b11f3 100644 --- a/packaging/e-mod-tizen-eom.spec +++ b/packaging/e-mod-tizen-eom.spec @@ -10,8 +10,7 @@ Group: Graphics & UI Framework/Other Source0: %{name}-%{version}.tar.gz License: BSD-2-Clause BuildRequires: pkgconfig(enlightenment) -BuildRequires: pkgconfig(elementary) -BuildRequires: pkgconfig(eom) +BuildRequires: pkgconfig(eom-server) BuildRequires: gettext %if %{with x} BuildRequires: pkgconfig(x11) -- 2.7.4 From 49b0b932b91697465f9ba61d8478a6fd172c29d4 Mon Sep 17 00:00:00 2001 From: SooChan Lim Date: Fri, 13 Jan 2017 13:43:47 +0900 Subject: [PATCH 13/16] package version up to 0.1.2 Change-Id: I6e693741c66cbfa836be65ecc5c60d653a3da159 --- packaging/e-mod-tizen-eom.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/e-mod-tizen-eom.spec b/packaging/e-mod-tizen-eom.spec index e2b11f3..6c94512 100644 --- a/packaging/e-mod-tizen-eom.spec +++ b/packaging/e-mod-tizen-eom.spec @@ -2,7 +2,7 @@ %bcond_with wayland Name: e-mod-tizen-eom -Version: 0.1.1 +Version: 0.1.2 Release: 1 Summary: The Enlightenment eom Module for Tizen URL: http://www.enlightenment.org -- 2.7.4 From c381b79766f6fc045b787331ff590f6c90547e20 Mon Sep 17 00:00:00 2001 From: Boram Park Date: Mon, 26 Dec 2016 14:42:44 +0900 Subject: [PATCH 14/16] use tdm_layer_commit instead of tdm_output_commit Change-Id: I493a824e86639d746941cee2fce66c78b5afbd06 --- src/e_mod_main.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/e_mod_main.c b/src/e_mod_main.c index b136010..6b7191c 100644 --- a/src/e_mod_main.c +++ b/src/e_mod_main.c @@ -564,7 +564,7 @@ _e_eom_cb_pp(tbm_surface_h surface, void *user_data) } static void -_e_eom_cb_commit(tdm_output *output EINA_UNUSED, unsigned int sequence EINA_UNUSED, +_e_eom_cb_commit(tdm_layer *layer EINA_UNUSED, unsigned int sequence EINA_UNUSED, unsigned int tv_sec EINA_UNUSED, unsigned int tv_usec EINA_UNUSED, void *user_data) { @@ -590,7 +590,7 @@ _e_eom_cb_commit(tdm_output *output EINA_UNUSED, unsigned int sequence EINA_UNUS RETURNIFTRUE(err != TDM_ERROR_NONE, "commit event: mirror: set buffer 0 err:%d", err); - err = tdm_output_commit(eom_output->output, 0, _e_eom_cb_commit, eom_output); + err = tdm_layer_commit(eom_output->layer, _e_eom_cb_commit, eom_output); RETURNIFTRUE(err != TDM_ERROR_NONE, "commit event: mirror: commit err:%d", err); } else if (eom_output->state == PRESENTATION) @@ -633,7 +633,7 @@ _e_eom_cb_commit(tdm_output *output EINA_UNUSED, unsigned int sequence EINA_UNUS err = tdm_layer_set_buffer(eom_output->layer, external_buffer); RETURNIFTRUE(err != TDM_ERROR_NONE, "commit event: presentation: set buffer"); - err = tdm_output_commit(eom_output->output, 0, _e_eom_cb_commit, eom_output); + err = tdm_layer_commit(eom_output->layer, _e_eom_cb_commit, eom_output); RETURNIFTRUE(err != TDM_ERROR_NONE, "commit event: presentation: commit err:%d", err); EOM_DBG("COMMIT <+++++++++++++++"); @@ -1316,7 +1316,7 @@ _e_eom_output_start_mirror(E_EomOutputPtr eom_output) ret = _e_eom_output_start_pp(eom_output); GOTOIFTRUE(ret == EINA_FALSE, err, "Get root surfcae"); - tdm_err = tdm_output_commit(eom_output->output, 0, _e_eom_cb_commit, eom_output); + tdm_err = tdm_layer_commit(eom_output->layer, _e_eom_cb_commit, eom_output); GOTOIFTRUE(tdm_err != TDM_ERROR_NONE, err, "Commit crtc:%d", tdm_err); _e_eom_output_state_set_mode(eom_output, EOM_OUTPUT_MODE_MIRROR); @@ -1382,7 +1382,7 @@ _e_eom_output_deinit(E_EomOutputPtr eom_output, int pp) if (err != TDM_ERROR_NONE) EOM_DBG("fail unset buffer:%d", err); - err = tdm_output_commit(eom_output->output, 0, NULL, eom_output); + err = tdm_layer_commit(eom_output->layer, NULL, eom_output); if (err != TDM_ERROR_NONE) EOM_DBG ("fail commit:%d", err); } -- 2.7.4 From 8dd1e3ba5518aace6c316152282f73252738b4df Mon Sep 17 00:00:00 2001 From: Boram Park Date: Thu, 2 Feb 2017 20:36:03 +0900 Subject: [PATCH 15/16] package version up to 0.1.3 Change-Id: Iefc6d3755e3f6a24cfd76a74654b852ffbad17f0 --- packaging/e-mod-tizen-eom.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/e-mod-tizen-eom.spec b/packaging/e-mod-tizen-eom.spec index 6c94512..699c23f 100644 --- a/packaging/e-mod-tizen-eom.spec +++ b/packaging/e-mod-tizen-eom.spec @@ -2,7 +2,7 @@ %bcond_with wayland Name: e-mod-tizen-eom -Version: 0.1.2 +Version: 0.1.3 Release: 1 Summary: The Enlightenment eom Module for Tizen URL: http://www.enlightenment.org -- 2.7.4 From 9e592ea7510baaf95d6533f1a17540e043ffa9ba Mon Sep 17 00:00:00 2001 From: SooChan Lim Date: Wed, 22 Mar 2017 15:09:24 +0900 Subject: [PATCH 16/16] use %license macro to copy the COPYING file. Change-Id: I7428a421fb634e9ab8038bc989b7ef62ae7c3c27 --- packaging/e-mod-tizen-eom.spec | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/packaging/e-mod-tizen-eom.spec b/packaging/e-mod-tizen-eom.spec index 699c23f..f2b7a25 100644 --- a/packaging/e-mod-tizen-eom.spec +++ b/packaging/e-mod-tizen-eom.spec @@ -48,10 +48,6 @@ make %install rm -rf %{buildroot} -# for license notification -mkdir -p %{buildroot}%{TZ_SYS_RO_SHARE}/license -cp -a %{_builddir}/%{buildsubdir}/COPYING %{buildroot}%{TZ_SYS_RO_SHARE}/license/%{name} - # install make install DESTDIR=%{buildroot} @@ -62,4 +58,4 @@ find %{buildroot}%{_libdir}/enlightenment/modules/%{name} -name *.a | xargs rm %files %defattr(-,root,root,-) %{_libdir}/enlightenment/modules/e-mod-tizen-eom -%{TZ_SYS_RO_SHARE}/license/%{name} +%license COPYING -- 2.7.4