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;
}
#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 */
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
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;
}