fix source pos when buffer of mirror output is set 19/271219/2
authorChangyeon Lee <cyeon.lee@samsung.com>
Fri, 11 Feb 2022 09:40:16 +0000 (18:40 +0900)
committerChangyeon Lee <cyeon.lee@samsung.com>
Thu, 17 Feb 2022 06:36:54 +0000 (15:36 +0900)
we use source pos of mirror output mode because
buffer size can larger than output mode

Change-Id: I22233c2fb54cb18e3900cd88be94f881cb4c3be9

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 4961001..7ee3a84 100644 (file)
@@ -122,7 +122,7 @@ void           tdm_vc4_display_destroy_buffer_list(tdm_vc4_display *display_data
 
 /* vc4 output */
 tdm_vc4_layer *tdm_vc4_output_get_layer_data(tdm_vc4_output *output_data, int layer_zops);
-hal_tdm_error   tdm_vc4_output_prepare_mirror_commit(tdm_vc4_output *output_data, tbm_surface_h surface);
+hal_tdm_error   tdm_vc4_output_prepare_mirror_commit(tdm_vc4_output *output_data, tdm_vc4_output *src_output_data);
 
 /* vc4 hwc */
 hal_tdm_error  tdm_vc4_hwc_initailize_target_window(tdm_vc4_hwc *hwc_data);
index 5b6ff68..1c10338 100644 (file)
@@ -2337,19 +2337,21 @@ _vc4_output_data_center_rect_get(int src_w, int src_h, int dst_w, int dst_h, hal
 }
 
 hal_tdm_error
-tdm_vc4_output_prepare_mirror_commit(tdm_vc4_output *output_data, tbm_surface_h surface)
+tdm_vc4_output_prepare_mirror_commit(tdm_vc4_output *output_data, tdm_vc4_output *src_output_data)
 {
        tdm_vc4_layer *layer_data = NULL;
        tdm_vc4_layer_info info;
        tbm_surface_info_s surf_info;
+       tbm_surface_h surface;
        hal_tdm_error ret;
        hal_tdm_pos dst_pos;
 
        TDM_BACKEND_RETURN_VAL_IF_FAIL(output_data, HAL_TDM_ERROR_INVALID_PARAMETER);
-       TDM_BACKEND_RETURN_VAL_IF_FAIL(surface, HAL_TDM_ERROR_INVALID_PARAMETER);
-
        TDM_BACKEND_RETURN_VAL_IF_FAIL(output_data->current_mode, HAL_TDM_ERROR_OPERATION_FAILED);
 
+       surface = src_output_data->hwc_data->target_hwc_window->surface;
+       TDM_BACKEND_RETURN_VAL_IF_FAIL(surface, HAL_TDM_ERROR_INVALID_PARAMETER);
+
        layer_data = tdm_vc4_output_get_layer_data(output_data, 0);
        TDM_BACKEND_RETURN_VAL_IF_FAIL(layer_data, HAL_TDM_ERROR_OPERATION_FAILED);
 
@@ -2366,8 +2368,8 @@ tdm_vc4_output_prepare_mirror_commit(tdm_vc4_output *output_data, tbm_surface_h
        info.src_config.format = TBM_FORMAT_ARGB8888;
        info.src_config.pos.x = 0;
        info.src_config.pos.y = 0;
-       info.src_config.pos.w = surf_info.width;
-       info.src_config.pos.h = surf_info.height;
+       info.src_config.pos.w = src_output_data->current_mode->hdisplay;
+       info.src_config.pos.h = src_output_data->current_mode->vdisplay;
        info.dst_pos.x = dst_pos.x;
        info.dst_pos.y = dst_pos.y;
        info.dst_pos.w = output_data->current_mode->hdisplay;
index 2e9ee8f..7df2a26 100644 (file)
@@ -881,7 +881,7 @@ vc4_hwc_accept_validation(hal_tdm_hwc *hwc)
        /* prepare_mirror_commit for mirroring */
        if (output_data->mirror_dst_output_data) {
                ret = tdm_vc4_output_prepare_mirror_commit(output_data->mirror_dst_output_data,
-                                                                                                       hwc_data->target_hwc_window->surface);
+                                                                                                       hwc_data->output_data);
                if (ret != HAL_TDM_ERROR_NONE)
                        TDM_BACKEND_ERR("fail to prepare mirror_commit.");
        }