From ce564395abbd80a1a06de2d01477740b31533d5c Mon Sep 17 00:00:00 2001 From: Kichan Kwon Date: Tue, 16 Jul 2019 15:53:48 +0900 Subject: [PATCH] rw-update-ani : apply HWC(HardWard Composer) - Wearable targets use HWC windows since Tizen 5.5 - Commit via HWC if backend has HWC capability Change-Id: Ie2ffd2746b8fc92aef7c4306d47b3f6af9e8c63a Signed-off-by: Kichan Kwon --- packaging/system-rw-update.spec | 2 +- rw-update-ani/rw-update_new_common_display.h | 3 + rw-update-ani/rw-update_new_tdm_display.c | 120 ++++++++++++++++++--------- 3 files changed, 86 insertions(+), 39 deletions(-) diff --git a/packaging/system-rw-update.spec b/packaging/system-rw-update.spec index 7145b3f..45b9a1a 100644 --- a/packaging/system-rw-update.spec +++ b/packaging/system-rw-update.spec @@ -1,6 +1,6 @@ Name: system-rw-update Summary: System RW update management -Version: 1.2.2 +Version: 1.2.3 Release: 0 Group: Base/Startup License: Apache-2.0 diff --git a/rw-update-ani/rw-update_new_common_display.h b/rw-update-ani/rw-update_new_common_display.h index d3073f3..456e184 100755 --- a/rw-update-ani/rw-update_new_common_display.h +++ b/rw-update-ani/rw-update_new_common_display.h @@ -55,6 +55,9 @@ typedef struct chg_common_disp { int stride; int current_buf_id; int degree; + + bool use_tdm_hwc; + tdm_hwc *hwc; } common_disp; typedef enum { diff --git a/rw-update-ani/rw-update_new_tdm_display.c b/rw-update-ani/rw-update_new_tdm_display.c index ecf8ec5..a8ff0f7 100755 --- a/rw-update-ani/rw-update_new_tdm_display.c +++ b/rw-update-ani/rw-update_new_tdm_display.c @@ -114,6 +114,12 @@ int chg_common_display_init(common_disp *st_disp) goto exit; } + err = tdm_output_set_mode(output, &output_mode[0]); + if (err != TDM_ERROR_NONE) { + _DEBUG_EXCEPTION("failed to set mode. error num = %d\n", err); + goto exit; + } + /* GET MODE INFO */ st_disp->output = output; st_disp->width = output_mode->hdisplay; @@ -197,41 +203,57 @@ int chg_common_display_init(common_disp *st_disp) } #endif - /* SET LAYER */ - tdm_layer_capability layer_caps; - tdm_layer *tmp_layer = NULL; + /* CHECK HWC USAGE */ + tdm_output_capability output_caps; + tdm_output_get_capabilities(st_disp->output, &output_caps); + if (output_caps & TDM_OUTPUT_CAPABILITY_HWC) + st_disp->use_tdm_hwc = true; + else + st_disp->use_tdm_hwc = false; - for (i = 0; i < output_count; i++) { - tmp_layer = tdm_output_get_layer(st_disp->output, output_count, &err); - tdm_layer_get_capabilities(tmp_layer, &layer_caps); - if (layer_caps & TDM_LAYER_CAPABILITY_PRIMARY) - break; - } + /* SET LAYER */ + if (st_disp->use_tdm_hwc) { + st_disp->hwc = tdm_output_get_hwc(st_disp->output, &err); + if (!st_disp->hwc) { + _DEBUG_EXCEPTION("failed to get hwc. error num = %d\n", err); + goto exit; + } + } else { + tdm_layer_capability layer_caps; + tdm_layer *tmp_layer = NULL; + + for (i = 0; i < output_count; i++) { + tmp_layer = tdm_output_get_layer(st_disp->output, output_count, &err); + tdm_layer_get_capabilities(tmp_layer, &layer_caps); + if (layer_caps & TDM_LAYER_CAPABILITY_PRIMARY) + break; + } - if (!tmp_layer) { - _DEBUG_EXCEPTION("failed to get output layer. error num = %d\n", err); - goto exit; - } + if (!tmp_layer) { + _DEBUG_EXCEPTION("failed to get output layer. error num = %d\n", err); + goto exit; + } - st_disp->layer = tmp_layer; - - layer_info.src_config.size.h = st_disp->width; - layer_info.src_config.size.v = st_disp->height; - layer_info.src_config.pos.x = 0; - layer_info.src_config.pos.y = 0; - layer_info.src_config.pos.w = st_disp->width; - layer_info.src_config.pos.h = st_disp->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 = st_disp->width; - layer_info.dst_pos.h = st_disp->height; - layer_info.transform = TDM_TRANSFORM_NORMAL; - - err = tdm_layer_set_info(st_disp->layer, &layer_info); - if (err != TDM_ERROR_NONE) { - _DEBUG_EXCEPTION("failed to get output layer. error num = %d\n", err); - goto exit; + st_disp->layer = tmp_layer; + + layer_info.src_config.size.h = st_disp->width; + layer_info.src_config.size.v = st_disp->height; + layer_info.src_config.pos.x = 0; + layer_info.src_config.pos.y = 0; + layer_info.src_config.pos.w = st_disp->width; + layer_info.src_config.pos.h = st_disp->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 = st_disp->width; + layer_info.dst_pos.h = st_disp->height; + layer_info.transform = TDM_TRANSFORM_NORMAL; + + err = tdm_layer_set_info(st_disp->layer, &layer_info); + if (err != TDM_ERROR_NONE) { + _DEBUG_EXCEPTION("failed to get output layer. error num = %d\n", err); + goto exit; + } } /* SETUP PP */ @@ -366,10 +388,21 @@ void chg_common_display_rotate(common_disp *st_disp) return; } - tdm_layer_set_buffer(st_disp->layer, st_disp->pp_surf[buf_cnt]); + if (st_disp->use_tdm_hwc) { + uint32_t num_types; + tdm_region damage; + memset(&damage, 0, sizeof(damage)); + + tdm_hwc_set_client_target_buffer(st_disp->hwc, st_disp->surf[buf_cnt], damage); + tdm_hwc_validate(st_disp->hwc, NULL, 0, &num_types); + tdm_hwc_accept_validation(st_disp->hwc); + tdm_hwc_commit(st_disp->hwc, 1, chg_common_display_commit_handler_cb, st_disp); + } else { + tdm_layer_set_buffer(st_disp->layer, st_disp->pp_surf[buf_cnt]); - // TODO: sync or async?? - tdm_output_commit(st_disp->output, 1, chg_common_display_commit_handler_cb, st_disp); + // TODO: sync or async?? + tdm_output_commit(st_disp->output, 1, chg_common_display_commit_handler_cb, st_disp); + } } #endif @@ -382,10 +415,21 @@ void chg_common_display_update(common_disp *st_disp) buf_cnt = st_disp->current_buf_id; //st_disp->current_buf_id = (++st_disp->current_buf_id)%MAX_BUF; - tdm_layer_set_buffer(st_disp->layer, st_disp->surf[buf_cnt]); + if (st_disp->use_tdm_hwc) { + uint32_t num_types; + tdm_region damage; + memset(&damage, 0, sizeof(damage)); + + tdm_hwc_set_client_target_buffer(st_disp->hwc, st_disp->surf[buf_cnt], damage); + tdm_hwc_validate(st_disp->hwc, NULL, 0, &num_types); + tdm_hwc_accept_validation(st_disp->hwc); + tdm_hwc_commit(st_disp->hwc, 1, chg_common_display_commit_handler_cb, st_disp); + } else { + tdm_layer_set_buffer(st_disp->layer, st_disp->surf[buf_cnt]); - // TODO: sync or async?? - tdm_output_commit(st_disp->output, 1, chg_common_display_commit_handler_cb, st_disp); + // TODO: sync or async?? + tdm_output_commit(st_disp->output, 1, chg_common_display_commit_handler_cb, st_disp); + } return; } -- 2.7.4