hwc: initailize target_window in get_hwc 34/210534/2
authorChangyeon Lee <cyeon.lee@samsung.com>
Fri, 19 Jul 2019 08:53:42 +0000 (17:53 +0900)
committerChangyeon Lee <cyeon.lee@samsung.com>
Mon, 22 Jul 2019 12:13:12 +0000 (21:13 +0900)
info of target_window is set in output_set_mode

Change-Id: I5abb4cfb2119c6968f9b4be2d033bbf7643ce8c8

src/tdm_vc4_display.c
src/tdm_vc4_hwc.c
src/tdm_vc4_hwc.h

index d21119d..ce2cee1 100644 (file)
@@ -1976,9 +1976,9 @@ vc4_output_set_mode(tdm_output *output, const tdm_output_mode *mode)
 
        /* create or replace the target_window when the output mode is set */
        if (output_data->hwc_enable) {
-               ret = vc4_hwc_initailize_target_window(output_data->hwc_data, mode->hdisplay, mode->vdisplay);
+               ret = vc4_hwc_target_window_set_info(output_data->hwc_data, mode->hdisplay, mode->vdisplay);
                if (ret != TDM_ERROR_NONE) {
-                       TDM_ERR("create target hwc window failed (%d)", ret);
+                       TDM_ERR("set info target hwc window failed (%d)", ret);
                        return ret;
                }
        }
@@ -2006,6 +2006,7 @@ vc4_output_get_hwc(tdm_output *output, tdm_error *error)
 {
        tdm_vc4_hwc_data *hwc_data = NULL;
        tdm_vc4_output_data *output_data = output;
+       tdm_error ret = TDM_ERROR_NONE;
 
        if (!output_data) {
                TDM_ERR("invalid params");
@@ -2034,6 +2035,15 @@ vc4_output_get_hwc(tdm_output *output, tdm_error *error)
 
        output_data->hwc_data = hwc_data;
 
+       ret = vc4_hwc_initailize_target_window(output_data->hwc_data);
+       if (ret != TDM_ERROR_NONE) {
+               TDM_ERR("create target hwc window failed (%d)", ret);
+               free(hwc_data);
+               if (error)
+                       *error = ret;
+               return NULL;
+       }
+
        if (error)
                *error = TDM_ERROR_NONE;
 
index 22899f2..ab7f8ce 100644 (file)
@@ -685,28 +685,63 @@ vc4_hwc_set_commit_handler(tdm_hwc *hwc, tdm_hwc_commit_handler func)
 }
 
 tdm_error
-vc4_hwc_initailize_target_window(tdm_vc4_hwc_data *hwc_data, int width, int height)
+vc4_hwc_target_window_set_info(tdm_vc4_hwc_data *hwc_data, int width, int height)
 {
        tdm_hwc_window_info info = {0};
-       tdm_error ret = TDM_ERROR_NONE;
        tdm_vc4_hwc_window_data *target_hwc_window;
+       tdm_error ret = TDM_ERROR_NONE;
 
        RETURN_VAL_IF_FAIL(hwc_data, TDM_ERROR_INVALID_PARAMETER);
+       RETURN_VAL_IF_FAIL(hwc_data->target_hwc_window, 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.h = height;
-       info.dst_pos.w = width;
+       info.dst_pos.h = width;
+       info.dst_pos.w = height;
 
        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.pos.h = width;
+       info.src_config.pos.w = 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 != TDM_ERROR_NONE) {
+               TDM_ERR("set info target hwc window failed (%d)", ret);
+               return TDM_ERROR_OPERATION_FAILED;
+       }
+
+       return TDM_ERROR_NONE;
+}
+
+tdm_error
+vc4_hwc_initailize_target_window(tdm_vc4_hwc_data *hwc_data)
+{
+       tdm_hwc_window_info info = {0};
+       tdm_error ret = TDM_ERROR_NONE;
+       tdm_vc4_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 = 2;
+       info.dst_pos.w = 1;
+
+       info.src_config.pos.x = 0;
+       info.src_config.pos.y = 0;
+       info.src_config.pos.h = 2;
+       info.src_config.pos.w = 1;
+
+       info.src_config.size.h = 2;
+       info.src_config.size.v = 1;
+       info.src_config.format = TBM_FORMAT_ARGB8888;
+
        target_hwc_window = _vc4_hwc_create_window(hwc_data, &info, &ret);
        if (ret != TDM_ERROR_NONE) {
                TDM_ERR("create target hwc window failed (%d)", ret);
index ad2cb64..96bf2bf 100644 (file)
@@ -3,6 +3,7 @@
 
 #include "tdm_vc4.h"
 
-tdm_error vc4_hwc_initailize_target_window(tdm_vc4_hwc_data *hwc_data, int width, int height);
+tdm_error vc4_hwc_initailize_target_window(tdm_vc4_hwc_data *hwc_data);
+tdm_error vc4_hwc_target_window_set_info(tdm_vc4_hwc_data *hwc_data, int width, int height);
 
 #endif /* _TDM_VC4_HWC_H_ */