rw-update-ani : apply HWC(HardWard Composer) 50/210150/2 accepted/tizen/unified/20190717.115106 submit/tizen/20190717.054136
authorKichan Kwon <k_c.kwon@samsung.com>
Tue, 16 Jul 2019 06:53:48 +0000 (15:53 +0900)
committerKichan Kwon <k_c.kwon@samsung.com>
Tue, 16 Jul 2019 07:24:59 +0000 (16:24 +0900)
- 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 <k_c.kwon@samsung.com>
packaging/system-rw-update.spec
rw-update-ani/rw-update_new_common_display.h
rw-update-ani/rw-update_new_tdm_display.c

index 7145b3f63df66f92927e24fa1406edd8cc77687c..45b9a1a0c5fc0633b2db7160bc90b568930a7b80 100644 (file)
@@ -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
index d3073f30dad74f62e8e4a71769881ce63ce343a2..456e184c59aace171ab9ad0e9c7323e3bf9f688c 100755 (executable)
@@ -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 {
index ecf8ec5a882fb8c858963bfde6cd274d0546dd1a..a8ff0f7f026e8b9841b00c0998909ac54cd9db21 100755 (executable)
@@ -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;
 }