tdm_func_output *func_output;
tdm_private_output_commit_handler *output_commit_handler = NULL;
tdm_private_layer *private_layer = NULL;
+ tdm_output_dpms dpms_value = TDM_OUTPUT_DPMS_ON;
OUTPUT_FUNC_ENTRY();
return TDM_ERROR_NOT_IMPLEMENTED;
}
- if (func) {
- if (!private_output->regist_commit_cb) {
- private_output->regist_commit_cb = 1;
- ret = func_output->output_set_commit_handler(private_output->output_backend,
- tdm_output_cb_commit);
- TDM_GOTO_IF_FAIL(ret == TDM_ERROR_NONE, commit_failed);
+ if (!func_output->output_get_dpms) {
+ dpms_value = private_output->current_dpms_value;
+ } else {
+ ret = func_output->output_get_dpms(private_output->output_backend, &dpms_value);
+ if (ret != TDM_ERROR_NONE) {
+ TDM_ERR("output_get_dpms failed");
+ dpms_value = TDM_OUTPUT_DPMS_OFF;
}
+ }
- output_commit_handler = calloc(1, sizeof(tdm_private_output_commit_handler));
- if (!output_commit_handler) {
- TDM_ERR("failed: alloc memory");
- return TDM_ERROR_OUT_OF_MEMORY;
- }
+ if (dpms_value == TDM_OUTPUT_DPMS_ON) {
+ if (func) {
+ if (!private_output->regist_commit_cb) {
+ private_output->regist_commit_cb = 1;
+ ret = func_output->output_set_commit_handler(private_output->output_backend,
+ tdm_output_cb_commit);
+ TDM_GOTO_IF_FAIL(ret == TDM_ERROR_NONE, commit_failed);
+ }
- LIST_ADDTAIL(&output_commit_handler->link, &private_output->output_commit_handler_list);
- output_commit_handler->private_output = private_output;
- output_commit_handler->func = func;
- output_commit_handler->user_data = user_data;
- output_commit_handler->owner_tid = syscall(SYS_gettid);
- }
+ output_commit_handler = calloc(1, sizeof(tdm_private_output_commit_handler));
+ if (!output_commit_handler) {
+ TDM_ERR("failed: alloc memory");
+ return TDM_ERROR_OUT_OF_MEMORY;
+ }
+
+ LIST_ADDTAIL(&output_commit_handler->link, &private_output->output_commit_handler_list);
+ output_commit_handler->private_output = private_output;
+ output_commit_handler->func = func;
+ output_commit_handler->user_data = user_data;
+ output_commit_handler->owner_tid = syscall(SYS_gettid);
+ }
- ret = func_output->output_commit(private_output->output_backend, sync,
- output_commit_handler);
- TDM_GOTO_IF_FAIL(ret == TDM_ERROR_NONE, commit_failed);
+ ret = func_output->output_commit(private_output->output_backend, sync,
+ output_commit_handler);
+ TDM_GOTO_IF_FAIL(ret == TDM_ERROR_NONE, commit_failed);
- if (tdm_debug_module & TDM_DEBUG_COMMIT)
- TDM_INFO("output(%d) backend commit: handle(%p)", private_output->pipe, output_commit_handler);
+ if (tdm_debug_module & TDM_DEBUG_COMMIT)
+ TDM_INFO("output(%d) backend commit: handle(%p) func(%p) user_data(%p)",
+ private_output->pipe, output_commit_handler, func, user_data);
+ }
LIST_FOR_EACH_ENTRY(private_layer, &private_output->layer_list, link) {
if (!private_layer->waiting_buffer)
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 (func)
+ func(output, 0, 0, 0, user_data);
+ }
+
return ret;
commit_failed:
ret = func_output->output_get_dpms(private_output->output_backend, dpms_value);
+ if (*dpms_value != private_output->current_dpms_value) {
+ private_output->current_dpms_value = *dpms_value;
+ TDM_WRN("current_dpms_value changed: %s", tdm_dpms_str(*dpms_value));
+ }
+
_pthread_mutex_unlock(&private_display->lock);
return ret;