diff options
Diffstat (limited to 'src/libtdm-exynos/tdm_exynos_hwc.c')
-rw-r--r-- | src/libtdm-exynos/tdm_exynos_hwc.c | 714 |
1 files changed, 0 insertions, 714 deletions
diff --git a/src/libtdm-exynos/tdm_exynos_hwc.c b/src/libtdm-exynos/tdm_exynos_hwc.c deleted file mode 100644 index b8a5bc6..0000000 --- a/src/libtdm-exynos/tdm_exynos_hwc.c +++ /dev/null @@ -1,714 +0,0 @@ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <tdm_helper.h> -#include "tdm_exynos.h" - -#define MIN_WIDTH 32 - -tdm_hwc_window * -_exynos_hwc_create_window(tdm_hwc *hwc, tdm_hwc_window_info *info, - tdm_error *error); - -const char * -_comp_to_str(tdm_hwc_window_composition composition_type) -{ - if (composition_type == TDM_HWC_WIN_COMPOSITION_CLIENT) - return "CLIENT"; - else if (composition_type == TDM_HWC_WIN_COMPOSITION_DEVICE) - return "DEVICE"; - else if (composition_type == TDM_HWC_WIN_COMPOSITION_CURSOR) - return "CURSOR"; - else if (composition_type == TDM_HWC_WIN_COMPOSITION_VIDEO) - return "VIDEO"; - else if (composition_type == TDM_HWC_WIN_COMPOSITION_NONE) - return "SKIP"; - - return "unknown"; -} - -static int -_can_set_hwc_window_on_hw_layer(tdm_exynos_hwc_window_data *hwc_window_data) -{ - if (!hwc_window_data->surface) - return 0; - - if (hwc_window_data->info.transform != TDM_TRANSFORM_NORMAL) - return 0; - - if (hwc_window_data->info.src_config.pos.w != hwc_window_data->info.dst_pos.w) - return 0; - - if (hwc_window_data->info.src_config.pos.h != hwc_window_data->info.dst_pos.h) - return 0; - - if (!IS_RGB(hwc_window_data->info.src_config.format)) - return 0; - - if (hwc_window_data->info.dst_pos.x > hwc_window_data->hwc_data->output_data->current_mode->hdisplay || - hwc_window_data->info.dst_pos.y > hwc_window_data->hwc_data->output_data->current_mode->vdisplay) - return 0; - - if (hwc_window_data->info.src_config.size.h < MIN_WIDTH || hwc_window_data->info.src_config.size.h % 2) - return 0; - - return 1; -} - -tdm_exynos_layer_data * -_exynos_hwc_get_layer(tdm_exynos_hwc_data *hwc_data, int zpos) -{ - tdm_exynos_output_data *output_data = hwc_data->output_data; - tdm_exynos_layer_data *l = NULL; - - LIST_FOR_EACH_ENTRY(l, &output_data->layer_list, link) - if (l->zpos == zpos) - return l; - - return NULL; -} - -static tdm_error -_set_hwc_window_buffer_to_layer(tdm_exynos_layer_data *layer_data, - tdm_exynos_hwc_window_data *hwc_window_data) -{ - tdm_error ret; - - if (hwc_window_data == NULL || !hwc_window_data->surface) { - ret = exynos_layer_unset_buffer(layer_data); - } else { - ret = exynos_layer_set_buffer(layer_data, hwc_window_data->surface); - } - - RETURN_VAL_IF_FAIL(ret == TDM_ERROR_NONE, ret); - - return ret; -} - -static tdm_exynos_hwc_window_data * -_find_maped_hwc_window_to_layer(struct list_head *hwc_wnds, int layer_zpos) -{ - tdm_exynos_hwc_window_data *hwc_window_data = NULL; - - LIST_FOR_EACH_ENTRY(hwc_window_data, hwc_wnds, link) { - if (hwc_window_data->client_type == TDM_HWC_WIN_COMPOSITION_NONE) - continue; - - if (hwc_window_data->assigned_layer_zpos == layer_zpos && - (hwc_window_data->validated_type == TDM_HWC_WIN_COMPOSITION_DEVICE || - hwc_window_data->validated_type == TDM_HWC_WIN_COMPOSITION_CURSOR || - hwc_window_data->validated_type == TDM_HWC_WIN_COMPOSITION_VIDEO)) { - TDM_DBG(" window(%p) type: %s -> %s : candidate_zpos:%d assigned_zpos:%d", hwc_window_data, - _comp_to_str(hwc_window_data->client_type), _comp_to_str(hwc_window_data->validated_type), - hwc_window_data->candidate_layer_zpos, hwc_window_data->assigned_layer_zpos); - return hwc_window_data; - } - } - - return NULL; -} - -static void -_update_layers_info(tdm_exynos_hwc_data *hwc_data) -{ - tdm_exynos_layer_data *layer = NULL; - tdm_exynos_output_data *output_data = hwc_data->output_data; - tdm_exynos_hwc_window_data *hwc_window_data; - tdm_error ret; - - LIST_FOR_EACH_ENTRY(layer, &output_data->layer_list, link) { - if (hwc_data->need_target_window && layer->zpos == hwc_data->target_window_zpos) - hwc_window_data = hwc_data->target_hwc_window; - else - hwc_window_data = _find_maped_hwc_window_to_layer(&hwc_data->hwc_window_list, layer->zpos); - - if (hwc_window_data) { - ret = exynos_layer_set_info((tdm_layer *)layer, (tdm_info_layer *)&(hwc_window_data->info)); - if (ret != TDM_ERROR_NONE) - TDM_ERR("cannot set info to layer with %d zpos", layer->zpos); - } - } -} - -static tdm_exynos_hwc_window_data * -_exynos_hwc_find_assigned_hwc_window(struct list_head *hwc_wnds, int layer_zpos) -{ - tdm_exynos_hwc_window_data *hwc_window_data = NULL; - - LIST_FOR_EACH_ENTRY(hwc_window_data, hwc_wnds, link) { - if (hwc_window_data->client_type == TDM_HWC_WIN_COMPOSITION_NONE) - continue; - - if (hwc_window_data->assigned_layer_zpos == layer_zpos) { - return hwc_window_data; - } - } - - return NULL; -} - -static tdm_error -_exynos_hwc_prepare_commit(tdm_exynos_hwc_data *hwc_data) { - tdm_exynos_layer_data *layer = NULL; - tdm_exynos_hwc_window_data *hwc_window_data = NULL; - tdm_exynos_output_data *output_data = hwc_data->output_data; - - _update_layers_info(hwc_data); - - /* set target hwc window */ - if (hwc_data->need_target_window) { - layer = _exynos_hwc_get_layer(hwc_data, hwc_data->target_window_zpos); - _set_hwc_window_buffer_to_layer(layer, hwc_data->target_hwc_window); - } - - LIST_FOR_EACH_ENTRY(layer, &output_data->layer_list, link) { - if (hwc_data->need_target_window && layer == output_data->primary_layer) - continue; - - hwc_window_data = _exynos_hwc_find_assigned_hwc_window(&hwc_data->hwc_window_list, layer->zpos); - if (hwc_window_data) { - _set_hwc_window_buffer_to_layer(layer, hwc_window_data); - } else { - /* do not set the null on the primary layer */ - if (layer != output_data->primary_layer) - _set_hwc_window_buffer_to_layer(layer, NULL); - } - } - - return TDM_ERROR_NONE; -} - -static int -_exynos_hwc_get_primary_layer_zpos(tdm_exynos_hwc_data *hwc_data) -{ - tdm_exynos_output_data *output_data = hwc_data->output_data; - tdm_exynos_layer_data *layer = NULL; - - LIST_FOR_EACH_ENTRY(layer, &output_data->layer_list, link) { - if (layer->capabilities & TDM_LAYER_CAPABILITY_PRIMARY) - return layer->zpos; - } - - return 0; -} - -/* decide the validated_types and the assigned_layer_zpos of the hwc_windows */ -static void -_exynos_hwc_adapt_policy(tdm_exynos_hwc_data *hwc_data , tdm_hwc_window **composited_wnds, uint32_t num_wnds) -{ - tdm_exynos_output_data *output_data = hwc_data->output_data; - tdm_exynos_hwc_window_data **composited_list = NULL; - int num_visible_windows = num_wnds; - int available_layers = LIST_LENGTH(&output_data->layer_list); - int num_videos = 0, num_clients = 0; - int min_zpos = 0, max_zpos = 0; - int i; - - composited_list = (tdm_exynos_hwc_window_data**)composited_wnds; - - TDM_DBG("1. available_layers=%d, primary_layer_zpos=%d, num_visible_windows=%d", - available_layers, _exynos_hwc_get_primary_layer_zpos(hwc_data), num_visible_windows); - - if (output_data->status != TDM_OUTPUT_CONN_STATUS_MODE_SETTED) { - hwc_data->target_window_zpos = _exynos_hwc_get_primary_layer_zpos(hwc_data); - hwc_data->need_target_window = 1; - goto set_all_client_types; - } else { - /* initialize the zpos of the target_window */ - hwc_data->target_window_zpos = _exynos_hwc_get_primary_layer_zpos(hwc_data); - hwc_data->need_target_window = 0; - } - - /* need_target_window is true and return when there are no visible windows */ - if (!num_visible_windows) { - hwc_data->need_target_window = 1; - return; - } - - /* reset the validated_type and hw layer policy */ - for (i = 0; i < num_wnds; i++) { - if (composited_list[i]->client_type == TDM_HWC_WIN_COMPOSITION_VIDEO) { - composited_list[i]->validated_type = composited_list[i]->client_type; - composited_list[i]->candidate_layer_zpos = 0; - ++num_videos; - /* The video window occupies the bottom layer */ - ++min_zpos; - --available_layers; - continue; - } - - composited_list[i]->validated_type = TDM_HWC_WIN_COMPOSITION_CLIENT; - composited_list[i]->candidate_layer_zpos = -1; - - /* The validate type of all windows below this window are TDM_HWC_WIN_COMPOSITION_CLIENT - * if the upper window is TDM_COMPSITION_CLIENT type. - */ - if (num_clients > 0) { - ++num_clients; - continue; - } - - /* increase the num_clients when the type of the window is TDM_COMPOSITE_CLIENT. */ - if (composited_list[i]->client_type == TDM_HWC_WIN_COMPOSITION_CLIENT) { - ++num_clients; - /* need target_window to composite */ - ++min_zpos; - --available_layers; - hwc_data->need_target_window = 1; - } - } - - /* calculate the num windows which can be the candidates */ - num_visible_windows = num_visible_windows - num_clients - num_videos; - if (num_visible_windows > available_layers) { - /* need target_window to composite if need_target_window is not set above */ - if (hwc_data->need_target_window == 0) { - if (num_videos > 0) { - ++min_zpos; - --available_layers; - } else { - min_zpos = min_zpos + 2; - available_layers = available_layers - 2; - } - hwc_data->need_target_window = 1; - } - max_zpos = LIST_LENGTH(&output_data->layer_list) - 1; - } else { - if (num_visible_windows == 1) - max_zpos = 1; - else - max_zpos = min_zpos + num_visible_windows - 1; - } - - TDM_DBG("2. available_layers=%d, max_zpos=%d, num_visible_windows=%d", available_layers, max_zpos, num_visible_windows); - - /* assgin the hw layers to the ui windows from the top to the bottom */ - for (i = 0; i < num_wnds; i++) { - if (composited_list[i]->client_type == TDM_HWC_WIN_COMPOSITION_VIDEO) - continue; - if (available_layers == 0) - break; - - if (composited_list[i]->client_type == TDM_HWC_WIN_COMPOSITION_DEVICE || - composited_list[i]->client_type == TDM_HWC_WIN_COMPOSITION_CURSOR) { - if (_can_set_hwc_window_on_hw_layer(composited_list[i])) { - composited_list[i]->validated_type = composited_list[i]->client_type; - composited_list[i]->candidate_layer_zpos = max_zpos; - max_zpos--; - available_layers--; - } else - goto set_all_client_types; - } - } - - return; - -set_all_client_types: - TDM_DBG("Set all windows to be CLIENT type due to hw restriction.!!"); - - for (i = 0; i < num_wnds; i++) { - if (composited_list[i]->client_type == TDM_HWC_WIN_COMPOSITION_VIDEO) - continue; - - composited_list[i]->validated_type = TDM_HWC_WIN_COMPOSITION_CLIENT; - composited_list[i]->candidate_layer_zpos = -1; - } - - hwc_data->need_target_window = 1; - hwc_data->target_window_zpos = _exynos_hwc_get_primary_layer_zpos(hwc_data);; -} - -static void -_print_validate_result(tdm_exynos_hwc_data *hwc_data) -{ - tdm_exynos_hwc_window_data *hwc_window_data = NULL; - int primary_layer_zpos = _exynos_hwc_get_primary_layer_zpos(hwc_data); - - LIST_FOR_EACH_ENTRY(hwc_window_data, &hwc_data->hwc_window_list, link) { - if (hwc_window_data->client_type == TDM_HWC_WIN_COMPOSITION_NONE) - continue; - - if (hwc_window_data->validated_type == TDM_HWC_WIN_COMPOSITION_DEVICE || - hwc_window_data->validated_type == TDM_HWC_WIN_COMPOSITION_CURSOR || - hwc_window_data->validated_type == TDM_HWC_WIN_COMPOSITION_VIDEO) - TDM_DBG(" window(%p) type: %s -> %s : is mapped to layer with %d zpos", hwc_window_data, - _comp_to_str(hwc_window_data->client_type), _comp_to_str(hwc_window_data->validated_type), - hwc_window_data->candidate_layer_zpos); - else - TDM_DBG(" window(%p) type: %s -> %s : is composited to layer with %d zpos. need_target_window: %d", hwc_window_data, - _comp_to_str(hwc_window_data->client_type), _comp_to_str(hwc_window_data->validated_type), - primary_layer_zpos, hwc_data->need_target_window); - } -} - -static void -_exynos_hwc_assigned_layer_zpos_update(tdm_exynos_hwc_data *hwc_data) -{ - tdm_exynos_hwc_window_data *hwc_window_data = NULL; - - LIST_FOR_EACH_ENTRY(hwc_window_data, &hwc_data->hwc_window_list, link) { - if (hwc_window_data->client_type == TDM_HWC_WIN_COMPOSITION_NONE) - continue; - - if (hwc_window_data->candidate_layer_zpos == -1) { - hwc_window_data->assigned_layer_zpos = -1; - continue; - } - - hwc_window_data->assigned_layer_zpos = hwc_window_data->candidate_layer_zpos; - - TDM_DBG(" window(%p) type: %s -> %s : candidate_zpos:%d assigned_zpos:%d", hwc_window_data, - _comp_to_str(hwc_window_data->client_type), _comp_to_str(hwc_window_data->validated_type), - hwc_window_data->candidate_layer_zpos, hwc_window_data->assigned_layer_zpos); - } -} - -static int -_exynos_hwc_get_changed_number(tdm_exynos_hwc_data *hwc_data) -{ - int num = 0; - tdm_exynos_hwc_window_data *hwc_window_data = NULL; - - LIST_FOR_EACH_ENTRY(hwc_window_data, &hwc_data->hwc_window_list, link) { - if (hwc_window_data->client_type == TDM_HWC_WIN_COMPOSITION_NONE) - continue; - if (hwc_window_data->client_type != hwc_window_data->validated_type) - num++; - } - - return num; -} - -#if 0 -static int -_exynos_hwc_exynos_hwc_get_primary_layer_zpos(tdm_exynos_hwc_data *hwc_data) -{ - tdm_exynos_output_data *output_data = hwc_data->output_data; - tdm_exynos_layer_data *layer = NULL; - - LIST_FOR_EACH_ENTRY(layer, &output_data->layer_list, link) { - if (layer->capabilities & TDM_LAYER_CAPABILITY_PRIMARY) - return layer->zpos; - } - - return 0; -} -#endif - -static tbm_surface_queue_h -_exynos_hwc_window_get_tbm_buffer_queue(tdm_hwc_window *hwc_window, tdm_error *error) -{ - tdm_exynos_hwc_window_data *hwc_window_data = NULL; - tbm_surface_queue_h tqueue = NULL; - int width, height; - tbm_format format; - - if (error) - *error = TDM_ERROR_INVALID_PARAMETER; - - RETURN_VAL_IF_FAIL(hwc_window != NULL, NULL); - - hwc_window_data = hwc_window; - - width = hwc_window_data->info.src_config.size.h; - height = hwc_window_data->info.src_config.size.v; - format = hwc_window_data->info.src_config.format; - - tqueue = tbm_surface_queue_create(3, width, height, format, TBM_BO_SCANOUT); - if (error) - *error = TDM_ERROR_OPERATION_FAILED; - RETURN_VAL_IF_FAIL(tqueue != NULL, NULL); - - if (error) - *error = TDM_ERROR_NONE; - - return tqueue; - -} - -tdm_hwc_window * -_exynos_hwc_create_window(tdm_hwc *hwc, tdm_hwc_window_info *info, tdm_error *error) -{ - tdm_exynos_hwc_window_data *hwc_window_data = NULL; - tdm_exynos_hwc_data *hwc_data = hwc; - - if (error) - *error = TDM_ERROR_NONE; - - if (!hwc_data) { - TDM_ERR("invalid params"); - if (error) - *error = TDM_ERROR_INVALID_PARAMETER; - return NULL; - } - - hwc_window_data = calloc(1, sizeof(tdm_exynos_hwc_window_data)); - if (!hwc_window_data) { - TDM_ERR("alloc failed"); - if (error) - *error = TDM_ERROR_OUT_OF_MEMORY; - return NULL; - } - - hwc_window_data->client_type = TDM_HWC_WIN_COMPOSITION_NONE; - hwc_window_data->validated_type = -1; - hwc_window_data->assigned_layer_zpos = -1; - - hwc_window_data->hwc_data = hwc_data; - - if (info) - memcpy(&hwc_window_data->info, info, sizeof(tdm_hwc_window_info)); - - LIST_INITHEAD(&hwc_window_data->link); - - return hwc_window_data; -} - -tdm_error -exynos_hwc_initailize_target_window(tdm_exynos_hwc_data *hwc_data, int width, int height) -{ - tdm_hwc_window_info info = {0}; - tdm_error ret = TDM_ERROR_NONE; - tdm_exynos_hwc_window_data *target_hwc_window; - - RETURN_VAL_IF_FAIL(hwc_data, TDM_ERROR_INVALID_PARAMETER); - - info.dst_pos.x = 0; - info.dst_pos.y = 0; - info.dst_pos.h = height; - info.dst_pos.w = width; - - info.src_config.pos.x = 0; - info.src_config.pos.y = 0; - info.src_config.pos.h = height; - info.src_config.pos.w = width; - - info.src_config.size.h = width; - info.src_config.size.v = height; - info.src_config.format = TBM_FORMAT_ARGB8888; - - target_hwc_window = _exynos_hwc_create_window(hwc_data, &info, &ret); - if (target_hwc_window == NULL) { - TDM_ERR("create target hwc window failed (%d)", ret); - return TDM_ERROR_OPERATION_FAILED; - } - - if (hwc_data->target_hwc_window) - exynos_hwc_window_destroy(hwc_data->target_hwc_window); - - hwc_data->target_hwc_window = target_hwc_window; - - return TDM_ERROR_NONE; -} - -tdm_hwc_window * -exynos_hwc_create_window(tdm_hwc *hwc, tdm_error *error) -{ - tdm_exynos_hwc_data *hwc_data = hwc; - tdm_exynos_hwc_window_data *hwc_window_data = NULL; - - hwc_window_data = _exynos_hwc_create_window(hwc_data, NULL, error); - if (hwc_window_data == NULL) - return NULL; - - LIST_ADDTAIL(&hwc_window_data->link, &hwc_data->hwc_window_list); - - TDM_DBG("hwc_window_data(%p) create", hwc_window_data); - if (error) - *error = TDM_ERROR_NONE; - - return hwc_window_data; -} - -tdm_error -exynos_hwc_get_video_supported_formats(tdm_hwc *hwc, const tbm_format **formats, int *count) -{ - tdm_exynos_hwc_data *hwc_data = hwc; - - RETURN_VAL_IF_FAIL(hwc_data != NULL, TDM_ERROR_INVALID_PARAMETER); - RETURN_VAL_IF_FAIL(formats != NULL, TDM_ERROR_INVALID_PARAMETER); - RETURN_VAL_IF_FAIL(count != NULL, TDM_ERROR_INVALID_PARAMETER); - - // TODO: - - return TDM_ERROR_NONE; -} - -tdm_error -exynos_hwc_get_capabilities(tdm_hwc *hwc, tdm_hwc_capability *capabilities) -{ - tdm_exynos_hwc_data *hwc_data = hwc; - - RETURN_VAL_IF_FAIL(hwc_data != NULL, TDM_ERROR_INVALID_PARAMETER); - RETURN_VAL_IF_FAIL(capabilities != NULL, TDM_ERROR_INVALID_PARAMETER); - - *capabilities = 0; - - return TDM_ERROR_NONE; -} - -tdm_error -exynos_hwc_get_available_properties(tdm_hwc *hwc, const tdm_prop **props, int *count) -{ - tdm_exynos_hwc_data *hwc_data = hwc; - - RETURN_VAL_IF_FAIL(hwc_data != NULL, TDM_ERROR_INVALID_PARAMETER); - - // TODO: - - return TDM_ERROR_NONE; -} - -tbm_surface_queue_h -exynos_hwc_get_client_target_buffer_queue(tdm_hwc *hwc, tdm_error *error) -{ - tdm_exynos_hwc_data *hwc_data = hwc; - tbm_surface_queue_h tqueue = NULL; - - if (error) - *error = TDM_ERROR_INVALID_PARAMETER; - - RETURN_VAL_IF_FAIL(hwc_data != NULL, NULL); - - if (hwc_data->target_hwc_window == NULL) { - if (error) - *error = TDM_ERROR_OPERATION_FAILED; - return NULL; - } - - tqueue = _exynos_hwc_window_get_tbm_buffer_queue(hwc_data->target_hwc_window, error); - RETURN_VAL_IF_FAIL(tqueue, NULL); - - if (error) - *error = TDM_ERROR_NONE; - - return tqueue; -} - -tdm_error -exynos_hwc_set_client_target_buffer(tdm_hwc *hwc, tbm_surface_h buffer, - tdm_region damage) -{ - tdm_exynos_hwc_data *hwc_data = hwc; - tdm_error err; - - RETURN_VAL_IF_FAIL(hwc_data != NULL, TDM_ERROR_INVALID_PARAMETER); - RETURN_VAL_IF_FAIL(hwc_data->target_hwc_window != NULL, TDM_ERROR_OPERATION_FAILED); - - err = exynos_hwc_window_set_buffer(hwc_data->target_hwc_window, buffer); - RETURN_VAL_IF_FAIL(err == TDM_ERROR_NONE, err); - - err = exynos_hwc_window_set_buffer_damage(hwc_data->target_hwc_window, damage); - RETURN_VAL_IF_FAIL(err == TDM_ERROR_NONE, err); - - return TDM_ERROR_NONE; -} - -tdm_error -exynos_hwc_validate(tdm_hwc *hwc, tdm_hwc_window **composited_wnds, uint32_t num_wnds, uint32_t *num_types) -{ - tdm_exynos_hwc_data *hwc_data = hwc; - - RETURN_VAL_IF_FAIL(hwc_data != NULL, TDM_ERROR_INVALID_PARAMETER); - RETURN_VAL_IF_FAIL(num_types != NULL, TDM_ERROR_INVALID_PARAMETER); - - _exynos_hwc_adapt_policy(hwc_data, composited_wnds, num_wnds); - - TDM_DBG(" ==============Validate================================="); - *num_types = _exynos_hwc_get_changed_number(hwc_data); - if (*num_types == 0) { - hwc_data->need_validate = 0; - _exynos_hwc_assigned_layer_zpos_update(hwc_data); - _print_validate_result(hwc_data); - } else { - _print_validate_result(hwc_data); - TDM_DBG(" !!!!!!! BUT NEED TO ACCEPT CHANES.!!!!!!!!"); - } - - return TDM_ERROR_NONE; -} - -tdm_error -exynos_hwc_get_changed_composition_types(tdm_hwc *hwc, uint32_t *num_elements, tdm_hwc_window **hwc_wnds, - tdm_hwc_window_composition *composition_types) -{ - tdm_exynos_hwc_data *hwc_data = hwc; - tdm_exynos_hwc_window_data *hwc_window_data = NULL; - int num = 0; - - RETURN_VAL_IF_FAIL(hwc_data != NULL, TDM_ERROR_INVALID_PARAMETER); - RETURN_VAL_IF_FAIL(num_elements != NULL, TDM_ERROR_INVALID_PARAMETER); - - if ((hwc_wnds == NULL) || (composition_types == NULL)) { - *num_elements = _exynos_hwc_get_changed_number(hwc_data); - return TDM_ERROR_NONE; - } - - LIST_FOR_EACH_ENTRY_REV(hwc_window_data, &hwc_data->hwc_window_list, link) { - if (hwc_window_data->client_type == TDM_HWC_WIN_COMPOSITION_NONE) - continue; - - if (num >= *num_elements) - break; - - if (hwc_window_data->client_type != hwc_window_data->validated_type) { - composition_types[num] = hwc_window_data->validated_type; - hwc_wnds[num] = hwc_window_data; - num++; - } - } - - /* set real num of changed composition types */ - *num_elements = num; - - return TDM_ERROR_NONE; -} - -tdm_error -exynos_hwc_accept_validation(tdm_hwc *hwc) -{ - tdm_exynos_hwc_data *hwc_data = hwc; - - RETURN_VAL_IF_FAIL(hwc_data != NULL, TDM_ERROR_INVALID_PARAMETER); - - TDM_DBG(" ==============Accept Changes Done================================="); - - _exynos_hwc_assigned_layer_zpos_update(hwc_data); - hwc_data->need_validate = 0; - - return TDM_ERROR_NONE; -} - -tdm_error -exynos_hwc_commit(tdm_hwc *hwc, int sync, void *user_data) -{ - tdm_exynos_hwc_data *hwc_data = hwc; - tdm_exynos_output_data *output_data = NULL; - tdm_error ret; - - RETURN_VAL_IF_FAIL(hwc_data, TDM_ERROR_INVALID_PARAMETER); - - output_data = hwc_data->output_data; - - ret = _exynos_hwc_prepare_commit(hwc_data); - RETURN_VAL_IF_FAIL(ret == TDM_ERROR_NONE, ret); - - ret = exynos_output_commit(output_data, sync, user_data); - RETURN_VAL_IF_FAIL(ret == TDM_ERROR_NONE, ret); - - return TDM_ERROR_NONE; -} - -tdm_error -exynos_hwc_set_commit_handler(tdm_hwc *hwc, tdm_hwc_commit_handler func) -{ - tdm_exynos_hwc_data *hwc_data = hwc; - - RETURN_VAL_IF_FAIL(hwc_data, TDM_ERROR_INVALID_PARAMETER); - RETURN_VAL_IF_FAIL(func, TDM_ERROR_INVALID_PARAMETER); - - hwc_data->commit_func = func; - - return TDM_ERROR_NONE; -}
\ No newline at end of file |