haltest: check hwc enabled to set output mode 49/234449/2
authorJunkyeong Kim <jk0430.kim@samsung.com>
Tue, 26 May 2020 10:04:43 +0000 (19:04 +0900)
committerJunkyeong Kim <jk0430.kim@samsung.com>
Tue, 26 May 2020 10:07:38 +0000 (10:07 +0000)
if hwc enabled, must not use tdm_output_commit function.

Change-Id: I3fedc1d35c8ef914e2939c40f72677fd4c86d39b
Signed-off-by: Junkyeong Kim <jk0430.kim@samsung.com>
haltests/src/tc_tdm_client.cpp

index 5d41486..d107b20 100644 (file)
@@ -289,9 +289,13 @@ _tc_tdm_server_set_output_dpms(tdm_display *dpy, int msg)
 static void
 _tc_tdm_test_server_cb_output_mode_change(tdm_output *output, unsigned int index, void *user_data)
 {
+       tdm_hwc *hwc = NULL;
+       tdm_region fb_damage;
        const tdm_output_mode *modes, *mode;
        int count = 0;
+       uint32_t num = 0;
        tdm_error ret;
+       tbm_surface_h buffer = NULL;
 
        ret = tdm_output_get_available_modes(output, &modes, &count);
        TDM_UT_RETURN_IF_FAIL(ret == TDM_ERROR_NONE);
@@ -305,8 +309,35 @@ _tc_tdm_test_server_cb_output_mode_change(tdm_output *output, unsigned int index
        ret = tdm_output_set_dpms(output, TDM_OUTPUT_DPMS_ON);
        TDM_UT_RETURN_IF_FAIL(ret == TDM_ERROR_NONE);
 
-       ret = tdm_output_commit(output, 0, NULL, NULL);
-       TDM_UT_RETURN_IF_FAIL(ret == TDM_ERROR_NONE);
+       if (tc_tdm_output_is_hwc_enable(output)) {
+               hwc = tdm_output_get_hwc(output, &ret);
+               TDM_UT_RETURN_IF_FAIL(ret == TDM_ERROR_NONE);
+
+               TDM_UT_RETURN_IF_FAIL(tc_tdm_buffer_create(mode->hdisplay, mode->vdisplay, TBM_FORMAT_ARGB8888, TBM_BO_SCANOUT, true, 1, &buffer) == true);
+
+               memset(&fb_damage, 0, sizeof(fb_damage));
+               ret = tdm_hwc_set_client_target_buffer(hwc, buffer, fb_damage);
+               TDM_UT_GOTO_IF_FAIL(ret == TDM_ERROR_NONE, failed);
+
+               ret = tdm_hwc_validate(hwc, NULL, 0, &num);
+               TDM_UT_GOTO_IF_FAIL(ret == TDM_ERROR_NONE, failed);
+
+               ret = tdm_hwc_accept_validation(hwc);
+               TDM_UT_GOTO_IF_FAIL(ret == TDM_ERROR_NONE, failed);
+
+               ret = tdm_hwc_commit(hwc, 0, NULL, NULL);
+               TDM_UT_GOTO_IF_FAIL(ret == TDM_ERROR_NONE, failed);
+
+               tbm_surface_internal_unref(buffer);
+       } else {
+               ret = tdm_output_commit(output, 0, NULL, NULL);
+               TDM_UT_RETURN_IF_FAIL(ret == TDM_ERROR_NONE);
+       }
+
+       return;
+
+failed:
+       tbm_surface_internal_unref(buffer);
 }
 
 static void