From 5333552fcc041b9ea6d686eb81d3e23d257ca7f0 Mon Sep 17 00:00:00 2001 From: Roman Peresipkyn Date: Wed, 6 Jul 2016 18:33:26 +0300 Subject: [PATCH] refactor _e_eom_output_start_mirror and _e_eom_output_get_layer functions Change-Id: Ica30dbf2bb44d08a00c01ed5d356fff4426389e1 Signed-off-by: Roman Peresipkyn --- src/e_mod_main.c | 36 ++++++++++++++++++------------------ src/e_mod_main.h | 4 ++-- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/e_mod_main.c b/src/e_mod_main.c index 23b944d..b96a58e 100644 --- a/src/e_mod_main.c +++ b/src/e_mod_main.c @@ -628,7 +628,7 @@ _e_eom_cb_tdm_output_status_change(tdm_output *output, tdm_output_change_type ty eom_output->type = (eom_output_type_e)tdm_type; /* TODO: check output mode(presentation set) and HDMI type */ - _e_eom_output_start_mirror(eom_output, mode->hdisplay, mode->vdisplay); + _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) @@ -1102,9 +1102,8 @@ _e_eom_output_get_position(void) } static void -_e_eom_output_start_mirror(E_EomOutputPtr eom_output, int width, int height) +_e_eom_output_start_mirror(E_EomOutputPtr eom_output) { - tdm_output *output; tdm_layer *hal_layer; tdm_info_layer layer_info; tdm_error tdm_err = TDM_ERROR_NONE; @@ -1113,11 +1112,10 @@ _e_eom_output_start_mirror(E_EomOutputPtr eom_output, int width, int height) if (eom_output->state == MIRROR) return; - output = eom_output->output; - hal_layer = _e_eom_output_get_layer(output, width, height); + hal_layer = _e_eom_output_get_layer(eom_output); GOTOIFTRUE(hal_layer == NULL, err, "ERROR: get hal layer\n"); - ret = _e_eom_output_create_buffers(eom_output, width, height); + ret = _e_eom_output_create_buffers(eom_output, eom_output->width, eom_output->height); GOTOIFTRUE(ret == EINA_FALSE, err, "ERROR: create buffers \n"); tdm_err = tdm_layer_get_info(hal_layer, &layer_info); @@ -1131,20 +1129,19 @@ _e_eom_output_start_mirror(E_EomOutputPtr eom_output, int width, int height) layer_info.dst_pos.w, layer_info.dst_pos.h); eom_output->layer = hal_layer; - eom_output->output = output; eom_output->current_buffer = 0; tdm_err = tdm_layer_set_buffer(hal_layer, eom_output->dst_buffers[eom_output->current_buffer]); GOTOIFTRUE(tdm_err != TDM_ERROR_NONE, err, "ERROR: set buffer on layer:%d\n", tdm_err); - tdm_err = tdm_output_set_dpms(output, TDM_OUTPUT_DPMS_ON); + tdm_err = tdm_output_set_dpms(eom_output->output, TDM_OUTPUT_DPMS_ON); GOTOIFTRUE(tdm_err != TDM_ERROR_NONE, err, "ERROR: tdm_output_set_dpms on\n"); /* get main surface */ ret = _e_eom_output_start_pp(eom_output); GOTOIFTRUE(ret == EINA_FALSE, err, "ERROR: get root surfcae\n"); - tdm_err = tdm_output_commit(output, 0, _e_eom_cb_commit, eom_output); + tdm_err = tdm_output_commit(eom_output->output, 0, _e_eom_cb_commit, eom_output); GOTOIFTRUE(tdm_err != TDM_ERROR_NONE, err, "ERROR: commit crtc:%d\n", tdm_err); _e_eom_output_state_set_mode(eom_output, EOM_OUTPUT_MODE_MIRROR); @@ -1223,7 +1220,7 @@ _e_eom_output_deinit(E_EomOutputPtr eom_output) } static tdm_layer * -_e_eom_output_get_layer(tdm_output *output, int width, int height) +_e_eom_output_get_layer(E_EomOutputPtr eom_output) { int i = 0; int count = 0; @@ -1232,7 +1229,10 @@ _e_eom_output_get_layer(tdm_output *output, int width, int height) tdm_layer_capability capa; tdm_info_layer layer_info; - err = tdm_output_get_layer_count(output, &count); + RETURNVALIFTRUE(eom_output == NULL, NULL, "ERROR: eom_output is NULL"); + RETURNVALIFTRUE(eom_output->output == NULL, NULL, "ERROR: eom_output->output is NULL"); + + err = tdm_output_get_layer_count(eom_output->output, &count); if (err != TDM_ERROR_NONE) { EOM_DBG ("tdm_output_get_layer_count fail(%d)\n", err); @@ -1241,7 +1241,7 @@ _e_eom_output_get_layer(tdm_output *output, int width, int height) for (i = 0; i < count; i++) { - layer = (tdm_layer *)tdm_output_get_layer(output, i, &err); + layer = (tdm_layer *)tdm_output_get_layer(eom_output->output, i, &err); RETURNVALIFTRUE(err != TDM_ERROR_NONE, NULL, "tdm_output_get_layer fail(%d)\n", err); err = tdm_layer_get_capabilities(layer, &capa); @@ -1255,17 +1255,17 @@ _e_eom_output_get_layer(tdm_output *output, int width, int height) } memset(&layer_info, 0x0, sizeof(tdm_info_layer)); - layer_info.src_config.size.h = width; - layer_info.src_config.size.v = height; + layer_info.src_config.size.h = eom_output->width; + layer_info.src_config.size.v = eom_output->height; layer_info.src_config.pos.x = 0; layer_info.src_config.pos.y = 0; - layer_info.src_config.pos.w = width; - layer_info.src_config.pos.h = height; + layer_info.src_config.pos.w = eom_output->width; + layer_info.src_config.pos.h = eom_output->height; layer_info.src_config.format = TBM_FORMAT_ARGB8888; layer_info.dst_pos.x = 0; layer_info.dst_pos.y = 0; - layer_info.dst_pos.w = width; - layer_info.dst_pos.h = height; + layer_info.dst_pos.w = eom_output->width; + layer_info.dst_pos.h = eom_output->height; layer_info.transform = TDM_TRANSFORM_NORMAL; err = tdm_layer_set_info(layer, &layer_info); diff --git a/src/e_mod_main.h b/src/e_mod_main.h index e2eef74..b041517 100644 --- a/src/e_mod_main.h +++ b/src/e_mod_main.h @@ -179,10 +179,10 @@ static void _e_eom_cb_tdm_output_status_change(tdm_output *output, tdm_output_ch static Eina_Bool _e_eom_output_init(tdm_display *dpy); 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, int width, int height); +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 tdm_layer *_e_eom_output_get_layer(tdm_output *output, int width, int height); +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); static Eina_Bool _e_eom_output_create_buffers(E_EomOutputPtr eom_output, int width, int height); -- 2.34.1