From: Boram Park Date: Tue, 28 Nov 2017 02:47:13 +0000 (+0900) Subject: dpms: add macro to check dpms status X-Git-Tag: accepted/tizen/unified/20171205.060640~6 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F59%2F162159%2F1;p=platform%2Fcore%2Fuifw%2Flibtdm.git dpms: add macro to check dpms status Change-Id: I5b3f14d081203395c4fd7e781f216f4871a16bf6 --- diff --git a/client/tdm_client.c b/client/tdm_client.c index 3e9176a..6153187 100644 --- a/client/tdm_client.c +++ b/client/tdm_client.c @@ -906,8 +906,8 @@ tdm_client_vblank_wait(tdm_client_vblank *vblank, unsigned int interval, tdm_cli TDM_ERR("output disconnected"); return TDM_ERROR_OUTPUT_DISCONNECTED; } - if (private_output->dpms != TDM_OUTPUT_DPMS_ON) { - TDM_ERR("dpms off"); + if (TDM_OUTPUT_DPMS_VSYNC_IS_OFF(private_output->dpms)) { + TDM_ERR("dpms %s", tdm_dpms_str(private_output->dpms)); return TDM_ERROR_DPMS_OFF; } } @@ -999,8 +999,8 @@ tdm_client_vblank_wait_seq(tdm_client_vblank *vblank, unsigned int sequence, TDM_ERR("output disconnected"); return TDM_ERROR_OUTPUT_DISCONNECTED; } - if (private_output->dpms != TDM_OUTPUT_DPMS_ON) { - TDM_ERR("dpms off"); + if (TDM_OUTPUT_DPMS_VSYNC_IS_OFF(private_output->dpms)) { + TDM_ERR("dpms %s", tdm_dpms_str(private_output->dpms)); return TDM_ERROR_DPMS_OFF; } } diff --git a/src/tdm_capture.c b/src/tdm_capture.c index 751056b..bfb9e40 100644 --- a/src/tdm_capture.c +++ b/src/tdm_capture.c @@ -561,7 +561,9 @@ tdm_capture_commit(tdm_capture *capture) _pthread_mutex_lock(&private_display->lock); private_output = private_capture->private_output; - if (private_output->current_dpms_value > TDM_OUTPUT_DPMS_ON) { + + /* TODO: possible when standby mode? can't decide it yet. no scenario. */ + if (TDM_OUTPUT_DPMS_VSYNC_IS_OFF(private_output->current_dpms_value)) { TDM_ERR("output(%d) dpms: %s", private_output->pipe, tdm_dpms_str(private_output->current_dpms_value)); _pthread_mutex_unlock(&private_display->lock); diff --git a/src/tdm_layer.c b/src/tdm_layer.c index cca078e..5d3d1c9 100644 --- a/src/tdm_layer.c +++ b/src/tdm_layer.c @@ -595,7 +595,7 @@ _tdm_layer_got_output_vblank(tdm_private_output *private_output, unsigned int se if (tdm_debug_module & TDM_DEBUG_COMMIT) TDM_INFO("layer commit: output(%d) commit", private_output->pipe); - if (private_output->current_dpms_value == TDM_OUTPUT_DPMS_ON) { + if (!TDM_OUTPUT_DPMS_VSYNC_IS_OFF(private_output->current_dpms_value)) { /* tdm_vblank APIs is for server. it should be called in unlock status*/ if (!private_output->layer_waiting_vblank) { _pthread_mutex_unlock(&private_display->lock); @@ -614,8 +614,8 @@ _tdm_layer_got_output_vblank(tdm_private_output *private_output, unsigned int se LIST_ADDTAIL(&lm->link, &private_output->layer_commit_handler_list); } - if (private_output->current_dpms_value != TDM_OUTPUT_DPMS_ON) { - TDM_WRN("TDM_OUTPUT_DPMS_OFF. Directly call vblank callback."); + if (TDM_OUTPUT_DPMS_VSYNC_IS_OFF(private_output->current_dpms_value)) { + TDM_WRN("dpms %s. Directly call vblank callback.", tdm_dpms_str(private_output->current_dpms_value)); _pthread_mutex_unlock(&private_display->lock); _tdm_layer_cb_wait_vblank(private_output->vblank, 0, 0, 0, 0, private_output); _pthread_mutex_lock(&private_display->lock); @@ -934,7 +934,7 @@ tdm_layer_commit(tdm_layer *layer, tdm_layer_commit_handler func, void *user_dat private_output->commit_type = TDM_COMMIT_TYPE_LAYER; } - if (private_output->current_dpms_value > TDM_OUTPUT_DPMS_ON) { + if (TDM_OUTPUT_DPMS_VSYNC_IS_OFF(private_output->current_dpms_value)) { TDM_ERR("layer(%p)'s output(%d) dpms: %s", layer, private_output->pipe, tdm_dpms_str(private_output->current_dpms_value)); _pthread_mutex_unlock(&private_display->lock); diff --git a/src/tdm_macro.h b/src/tdm_macro.h index 504315a..775354e 100644 --- a/src/tdm_macro.h +++ b/src/tdm_macro.h @@ -159,6 +159,12 @@ extern "C" { #define TDM_SWAP(a, b) ({ int t; t = a; a = b; b = t; }) #define TDM_ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0])) +/* can't export VSYNC macro because we can't define the exact meaning of vsync off + * at this time. Does committing in standy mode work? Doesn't committing in suspend mode work? + */ +#define TDM_OUTPUT_DPMS_VSYNC_OFF_MASK 0x2 +#define TDM_OUTPUT_DPMS_VSYNC_IS_OFF(dpms) ((dpms) & TDM_OUTPUT_DPMS_VSYNC_OFF_MASK) + struct tdm_type_name { int type; const char *name; diff --git a/src/tdm_output.c b/src/tdm_output.c index 2e0b705..42dfe87 100644 --- a/src/tdm_output.c +++ b/src/tdm_output.c @@ -814,7 +814,7 @@ tdm_output_wait_vblank(tdm_output *output, int interval, int sync, _pthread_mutex_lock(&private_display->lock); - if (private_output->current_dpms_value > TDM_OUTPUT_DPMS_ON) { + if (TDM_OUTPUT_DPMS_VSYNC_IS_OFF(private_output->current_dpms_value)) { TDM_WRN("output(%d) dpms: %s", private_output->pipe, tdm_dpms_str(private_output->current_dpms_value)); _pthread_mutex_unlock(&private_display->lock); @@ -837,7 +837,7 @@ tdm_output_wait_vblank_add_front(tdm_output *output, int interval, int sync, _pthread_mutex_lock(&private_display->lock); - if (private_output->current_dpms_value > TDM_OUTPUT_DPMS_ON) { + if (TDM_OUTPUT_DPMS_VSYNC_IS_OFF(private_output->current_dpms_value)) { TDM_WRN("output(%d) dpms: %s", private_output->pipe, tdm_dpms_str(private_output->current_dpms_value)); _pthread_mutex_unlock(&private_display->lock); @@ -940,7 +940,7 @@ tdm_output_commit_internal(tdm_output *output, int sync, tdm_output_commit_handl ret = tdm_output_get_dpms_internal(output, &dpms_value); TDM_RETURN_VAL_IF_FAIL(ret == TDM_ERROR_NONE, ret); - if (dpms_value == TDM_OUTPUT_DPMS_ON) { + if (!TDM_OUTPUT_DPMS_VSYNC_IS_OFF(dpms_value)) { if (func) { if (!private_output->regist_commit_cb) { private_output->regist_commit_cb = 1; @@ -988,8 +988,8 @@ tdm_output_commit_internal(tdm_output *output, int sync, tdm_output_commit_handl private_layer->committed_buffer->buffer); } - if (dpms_value != TDM_OUTPUT_DPMS_ON) { - TDM_WRN("TDM_OUTPUT_DPMS_OFF. Directly call commit handler instead of commit."); + if (TDM_OUTPUT_DPMS_VSYNC_IS_OFF(dpms_value)) { + TDM_WRN("dpms %s. Directly call commit handler instead of commit.", tdm_dpms_str(dpms_value)); if (func) func(output, 0, 0, 0, user_data); } @@ -1030,7 +1030,7 @@ tdm_output_commit(tdm_output *output, int sync, tdm_output_commit_handler func, return TDM_ERROR_BAD_REQUEST; } - if (private_output->current_dpms_value > TDM_OUTPUT_DPMS_ON) { + if (TDM_OUTPUT_DPMS_VSYNC_IS_OFF(private_output->current_dpms_value)) { TDM_ERR("output(%d) dpms: %s", private_output->pipe, tdm_dpms_str(private_output->current_dpms_value)); _pthread_mutex_unlock(&private_display->lock); @@ -1209,9 +1209,6 @@ tdm_output_set_dpms(tdm_output *output, tdm_output_dpms dpms_value) tdm_func_output *func_output; OUTPUT_FUNC_ENTRY(); - if (dpms_value > TDM_OUTPUT_DPMS_OFF) - dpms_value = TDM_OUTPUT_DPMS_OFF; - _pthread_mutex_lock(&private_display->lock); if (private_output->waiting_dpms_change) { @@ -1267,9 +1264,6 @@ tdm_output_set_dpms_async(tdm_output *output, tdm_output_dpms dpms_value) return TDM_ERROR_BAD_REQUEST; } - if (dpms_value > TDM_OUTPUT_DPMS_OFF) - dpms_value = TDM_OUTPUT_DPMS_OFF; - _pthread_mutex_lock(&private_display->lock); if (private_output->waiting_dpms_change) { diff --git a/src/tdm_vblank.c b/src/tdm_vblank.c index 2701456..e7b79b5 100644 --- a/src/tdm_vblank.c +++ b/src/tdm_vblank.c @@ -365,7 +365,7 @@ _tdm_vblank_cb_output_change(tdm_output *output, tdm_output_change_type type, case TDM_OUTPUT_CHANGE_DPMS: VIN("dpms %s", tdm_dpms_str(value.u32)); private_vblank->check_HW_or_SW = 1; - if (value.u32 != TDM_OUTPUT_DPMS_ON) { + if (TDM_OUTPUT_DPMS_VSYNC_IS_OFF(value.u32)) { if (private_vblank->enable_fake) _tdm_vblank_change_to_SW(private_vblank); else @@ -1081,8 +1081,8 @@ tdm_vblank_wait(tdm_vblank *vblank, unsigned int req_sec, unsigned int req_usec, VER("can't wait a vblank: output disconnected"); return TDM_ERROR_OUTPUT_DISCONNECTED; } - if (dpms != TDM_OUTPUT_DPMS_ON) { - VER("can't wait a vblank: DPMS off"); + if (TDM_OUTPUT_DPMS_VSYNC_IS_OFF(dpms)) { + VER("can't wait a vblank: DPMS %s", tdm_dpms_str(dpms)); return TDM_ERROR_DPMS_OFF; } } @@ -1134,7 +1134,7 @@ tdm_vblank_wait(tdm_vblank *vblank, unsigned int req_sec, unsigned int req_usec, */ if (private_vblank->vrefresh % fps) wait_info->type = VBLANK_TYPE_SW; - else if (dpms == TDM_OUTPUT_DPMS_OFF || + else if (TDM_OUTPUT_DPMS_VSYNC_IS_OFF(dpms) || private_vblank->connection == TDM_OUTPUT_CONN_STATUS_DISCONNECTED) wait_info->type = VBLANK_TYPE_SW_FAKE; else if (private_vblank->offset == 0)