create client target buffer queue with width and height of output mode 10/271610/1
authorChangyeon Lee <cyeon.lee@samsung.com>
Wed, 23 Feb 2022 09:39:36 +0000 (18:39 +0900)
committerChangyeon Lee <cyeon.lee@samsung.com>
Wed, 23 Feb 2022 09:41:53 +0000 (18:41 +0900)
after suuport set_client_target_buffer_info interface,
width and height of target hwc window info can be set 0
when client target buffer is not used.

Change-Id: I91f9aaa9a9e18b7960dd760ad705f9213b64c6c2

src/libhal-backend-tdm-vc4/tdm_backend_vc4.h
src/libhal-backend-tdm-vc4/tdm_vc4_display.c
src/libhal-backend-tdm-vc4/tdm_vc4_hwc.c

index 904bed9..5c17786 100644 (file)
@@ -128,7 +128,6 @@ hal_tdm_error   tdm_vc4_output_prepare_mirror_commit(tdm_vc4_output *output_data
 
 /* vc4 hwc */
 hal_tdm_error  tdm_vc4_hwc_initailize_target_window(tdm_vc4_hwc *hwc_data);
-hal_tdm_error  tdm_vc4_hwc_target_window_set_info(tdm_vc4_hwc *hwc_data, int width, int height);
 
 /* vc4 layer */
 hal_tdm_error  tdm_vc4_layer_get_capability(tdm_vc4_layer *layer_data, tdm_vc4_caps_layer *caps);
index 5a712b5..eb92ecf 100644 (file)
@@ -1789,18 +1789,10 @@ hal_tdm_error
 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;
 
index 1a25905..5924d82 100644 (file)
@@ -72,6 +72,7 @@ _comp_to_str(hal_tdm_hwc_window_composition composition_type)
 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;
@@ -80,13 +81,28 @@ _vc4_hwc_window_get_tbm_buffer_queue(hal_tdm_hwc_window *hwc_window, hal_tdm_err
        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)
@@ -996,41 +1012,6 @@ vc4_hwc_get_release_fences(hal_tdm_hwc *hwc, uint32_t *num_elements,
 }
 
 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};