vc4_output_set_mode(hal_tdm_output *output, const hal_tdm_output_mode *mode)
{
tdm_vc4_output *output_data = output;
- hal_tdm_error ret = HAL_TDM_ERROR_NONE;
TDM_BACKEND_RETURN_VAL_IF_FAIL(output_data, HAL_TDM_ERROR_INVALID_PARAMETER);
TDM_BACKEND_RETURN_VAL_IF_FAIL(mode, HAL_TDM_ERROR_INVALID_PARAMETER);
- /* create or replace the target_window when the output mode is set */
- ret = tdm_vc4_hwc_target_window_set_info(output_data->hwc_data, mode->hdisplay, mode->vdisplay);
- if (ret != HAL_TDM_ERROR_NONE) {
- TDM_BACKEND_ERR("set info target hwc window failed (%d)", ret);
- return ret;
- }
-
output_data->current_mode = mode;
output_data->mode_changed = 1;
static tbm_surface_queue_h
_vc4_hwc_window_get_tbm_buffer_queue(hal_tdm_hwc_window *hwc_window, hal_tdm_error *error)
{
+ tdm_vc4_hwc *hwc_data = NULL;
tdm_vc4_hwc_window *hwc_window_data = NULL;
tbm_surface_queue_h tqueue = NULL;
int width, height;
if (error)
*error = HAL_TDM_ERROR_INVALID_PARAMETER;
- TDM_BACKEND_RETURN_VAL_IF_FAIL(hwc_window != NULL, NULL);
-
hwc_window_data = hwc_window;
+ TDM_BACKEND_RETURN_VAL_IF_FAIL(hwc_window_data != NULL, NULL);
+
+ hwc_data = hwc_window_data->hwc_data;
+ TDM_BACKEND_RETURN_VAL_IF_FAIL(hwc_data != NULL, NULL);
+ TDM_BACKEND_RETURN_VAL_IF_FAIL(hwc_data->output_data != NULL, NULL);
- 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;
+ if (hwc_data->target_hwc_window == hwc_window_data) {
+ if (hwc_data->output_data->current_mode) {
+ width = hwc_data->output_data->current_mode->hdisplay;
+ height = hwc_data->output_data->current_mode->vdisplay;
+ format = TBM_FORMAT_ARGB8888;
+ } else {
+ width = 2;
+ height = 2;
+ format = TBM_FORMAT_ARGB8888;
+ }
+ } else {
+ 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(NUM_BUFFERS, width, height, format, TBM_BO_SCANOUT);
if (error)
}
hal_tdm_error
-tdm_vc4_hwc_target_window_set_info(tdm_vc4_hwc *hwc_data, int width, int height)
-{
- hal_tdm_hwc_window_info info = {0};
- tdm_vc4_hwc_window *target_hwc_window;
- hal_tdm_error ret = HAL_TDM_ERROR_NONE;
-
- TDM_BACKEND_RETURN_VAL_IF_FAIL(hwc_data, HAL_TDM_ERROR_INVALID_PARAMETER);
- TDM_BACKEND_RETURN_VAL_IF_FAIL(hwc_data->target_hwc_window, HAL_TDM_ERROR_INVALID_PARAMETER);
-
- target_hwc_window = hwc_data->target_hwc_window;
-
- info.dst_pos.x = 0;
- info.dst_pos.y = 0;
- info.dst_pos.w = width;
- info.dst_pos.h = height;
-
- info.src_config.pos.x = 0;
- info.src_config.pos.y = 0;
- info.src_config.pos.w = width;
- info.src_config.pos.h = height;
-
- info.src_config.size.h = width;
- info.src_config.size.v = height;
- info.src_config.format = TBM_FORMAT_ARGB8888;
-
- ret = vc4_hwc_window_set_info(target_hwc_window, &info);
- if (ret != HAL_TDM_ERROR_NONE) {
- TDM_BACKEND_ERR("set info target hwc window failed (%d)", ret);
- return HAL_TDM_ERROR_OPERATION_FAILED;
- }
-
- return HAL_TDM_ERROR_NONE;
-}
-
-hal_tdm_error
tdm_vc4_hwc_initailize_target_window(tdm_vc4_hwc *hwc_data)
{
hal_tdm_hwc_window_info info = {0};