* Taeheon Kim <th908.kim@samsung.com>,
* YoungJun Cho <yj44.cho@samsung.com>,
* SooChan Lim <sc1.lim@samsung.com>,
- * Boram Park <sc1.lim@samsung.com>
+ * Boram Park <boram1288.park@samsung.com>
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
#include "config.h"
#endif
-#include "tdm.h"
-#include "tdm_backend.h"
#include "tdm_private.h"
-#include "tdm_helper.h"
#define COUNT_MAX 10
private_output = private_layer->private_output; \
private_display = private_output->private_display
-static void _tdm_layer_free_buffer(tdm_private_layer *private_layer, tdm_private_layer_buffer *layer_buffer);
static void _tdm_layer_cb_wait_vblank(tdm_vblank *vblank, tdm_error error, unsigned int sequence,
unsigned int tv_sec, unsigned int tv_usec, void *user_data);
static void _tbm_layer_queue_acquirable_cb(tbm_surface_queue_h surface_queue, void *data);
unsigned int tv_sec, unsigned int tv_usec, void *user_data);
static void _tdm_layer_reset_pending_data(tdm_private_layer *private_layer);
+EXTERN tdm_output*
+tdm_layer_get_output(tdm_layer *layer, tdm_error *error)
+{
+ tdm_output *output;
+
+ LAYER_FUNC_ENTRY_ERROR();
+
+ _pthread_mutex_lock(&private_display->lock);
+
+ if (error)
+ *error = TDM_ERROR_NONE;
+
+ output = private_layer->private_output;
+
+ _pthread_mutex_unlock(&private_display->lock);
+
+ return output;
+}
+
+EXTERN tdm_error
+tdm_layer_get_index(tdm_layer *layer, int *index)
+{
+ LAYER_FUNC_ENTRY();
+
+ TDM_RETURN_VAL_IF_FAIL(index != NULL, TDM_ERROR_INVALID_PARAMETER);
+
+ _pthread_mutex_lock(&private_display->lock);
+
+ *index = private_layer->index;
+
+ _pthread_mutex_unlock(&private_display->lock);
+
+ return ret;
+}
+
EXTERN tdm_error
tdm_layer_get_capabilities(tdm_layer *layer, tdm_layer_capability *capabilities)
{
EXTERN tdm_error
tdm_layer_set_property(tdm_layer *layer, unsigned int id, tdm_value value)
{
+ tdm_private_module *private_module;
tdm_func_layer *func_layer;
LAYER_FUNC_ENTRY();
_pthread_mutex_lock(&private_display->lock);
- func_layer = &private_display->func_layer;
+ private_module = private_layer->private_module;
+ func_layer = &private_module->func_layer;
if (private_layer->usable)
- TDM_INFO("layer(%d) not usable", private_layer->index);
+ TDM_INFO("layer(%p,%d) not usable", private_layer, private_layer->index);
private_layer->usable = 0;
if (!func_layer->layer_set_property) {
+ /* LCOV_EXCL_START */
_pthread_mutex_unlock(&private_display->lock);
TDM_ERR("not implemented!!");
return TDM_ERROR_NOT_IMPLEMENTED;
+ /* LCOV_EXCL_STOP */
}
ret = func_layer->layer_set_property(private_layer->layer_backend, id, value);
EXTERN tdm_error
tdm_layer_get_property(tdm_layer *layer, unsigned int id, tdm_value *value)
{
+ tdm_private_module *private_module;
tdm_func_layer *func_layer;
LAYER_FUNC_ENTRY();
_pthread_mutex_lock(&private_display->lock);
- func_layer = &private_display->func_layer;
+ private_module = private_layer->private_module;
+ func_layer = &private_module->func_layer;
if (!func_layer->layer_get_property) {
+ /* LCOV_EXCL_START */
_pthread_mutex_unlock(&private_display->lock);
TDM_ERR("not implemented!!");
return TDM_ERROR_NOT_IMPLEMENTED;
+ /* LCOV_EXCL_SOP */
}
ret = func_layer->layer_get_property(private_layer->layer_backend, id, value);
return ret;
}
-EXTERN tdm_error
-tdm_layer_set_info(tdm_layer *layer, tdm_info_layer *info)
+INTERN tdm_error
+tdm_layer_set_info_internal(tdm_private_layer *private_layer, tdm_info_layer *info)
{
+ tdm_private_module *private_module;
tdm_func_layer *func_layer;
char fmtstr[128];
- LAYER_FUNC_ENTRY();
-
- TDM_RETURN_VAL_IF_FAIL(info != NULL, TDM_ERROR_INVALID_PARAMETER);
-
- _pthread_mutex_lock(&private_display->lock);
-
- func_layer = &private_display->func_layer;
+ private_module = private_layer->private_module;
+ func_layer = &private_module->func_layer;
if (private_layer->usable)
- TDM_INFO("layer(%p) not usable", private_layer);
+ TDM_INFO("layer(%p,%d) not usable", private_layer, private_layer->index);
private_layer->usable = 0;
if (!func_layer->layer_set_info) {
- _pthread_mutex_unlock(&private_display->lock);
+ /* LCOV_EXCL_START */
TDM_ERR("not implemented!!");
return TDM_ERROR_NOT_IMPLEMENTED;
+ /* LCOV_EXCL_STOP */
}
if (info->src_config.format)
else
snprintf(fmtstr, 128, "NONE");
- TDM_INFO("layer(%p) info: src(%dx%d %d,%d %dx%d %s) dst(%d,%d %dx%d) trans(%d)",
- private_layer, info->src_config.size.h, info->src_config.size.v,
+ TDM_INFO("layer(%p,%d) info: src(%ux%u %u,%u %ux%u %s) dst(%u,%u %ux%u) trans(%d)",
+ private_layer, private_layer->index,
+ info->src_config.size.h, info->src_config.size.v,
info->src_config.pos.x, info->src_config.pos.y,
info->src_config.pos.w, info->src_config.pos.h,
fmtstr,
private_layer->pending_info_changed = 1;
private_layer->pending_info = *info;
+ return TDM_ERROR_NONE;
+}
+
+EXTERN tdm_error
+tdm_layer_set_info(tdm_layer *layer, tdm_info_layer *info)
+{
+ LAYER_FUNC_ENTRY();
+
+ TDM_RETURN_VAL_IF_FAIL(info != NULL, TDM_ERROR_INVALID_PARAMETER);
+
+ _pthread_mutex_lock(&private_display->lock);
+
+ ret = tdm_layer_set_info_internal(private_layer, info);
+
_pthread_mutex_unlock(&private_display->lock);
return ret;
EXTERN tdm_error
tdm_layer_get_info(tdm_layer *layer, tdm_info_layer *info)
{
+ tdm_private_module *private_module;
tdm_func_layer *func_layer;
LAYER_FUNC_ENTRY();
_pthread_mutex_lock(&private_display->lock);
- func_layer = &private_display->func_layer;
+ private_module = private_layer->private_module;
+ func_layer = &private_module->func_layer;
if (!func_layer->layer_get_info) {
+ /* LCOV_EXCL_START */
_pthread_mutex_unlock(&private_display->lock);
TDM_ERR("not implemented!!");
return TDM_ERROR_NOT_IMPLEMENTED;
+ /* LCOV_EXCL_STOP */
}
ret = func_layer->layer_get_info(private_layer->layer_backend, info);
return ret;
}
+/* LCOV_EXCL_START */
static void
_tdm_layer_dump_buffer(tdm_layer *layer, tbm_surface_h buffer)
{
tdm_private_layer *private_layer = (tdm_private_layer*)layer;
tdm_private_output *private_output = private_layer->private_output;
unsigned int pipe;
- char fname[PATH_MAX], bufs[PATH_MAX];
- int zpos, len = PATH_MAX;
+ char fname[TDM_PATH_LEN], bufs[TDM_PATH_LEN];
+ int zpos, len = TDM_PATH_LEN;
tdm_private_layer *l = NULL;
char *p = bufs;
int *remain = &len;
return;
}
+/* LCOV_EXCL_STOP */
-static void
-_tdm_layer_free_buffer(tdm_private_layer *private_layer, tdm_private_layer_buffer *layer_buffer)
+void
+tdm_layer_free_buffer(tdm_private_layer *private_layer, tdm_private_layer_buffer *layer_buffer)
{
tdm_private_display *private_display;
_tdm_layer_reset_pending_data(private_layer);
if (private_layer->waiting_buffer) {
- _tdm_layer_free_buffer(private_layer, private_layer->waiting_buffer);
+ tdm_layer_free_buffer(private_layer, private_layer->waiting_buffer);
private_layer->waiting_buffer = NULL;
if (tdm_debug_module & TDM_DEBUG_BUFFER)
- TDM_INFO("layer(%p) waiting_buffer(%p)",
- private_layer, private_layer->waiting_buffer);
+ TDM_INFO("layer(%p,%d) waiting_buffer(%p)",
+ private_layer, private_layer->index, private_layer->waiting_buffer);
}
if (private_layer->committed_buffer) {
- _tdm_layer_free_buffer(private_layer, private_layer->committed_buffer);
+ tdm_layer_free_buffer(private_layer, private_layer->committed_buffer);
private_layer->committed_buffer = NULL;
if (tdm_debug_module & TDM_DEBUG_BUFFER)
- TDM_INFO("layer(%p) committed_buffer(%p)",
- private_layer, private_layer->committed_buffer);
+ TDM_INFO("layer(%p,%d) committed_buffer(%p)",
+ private_layer, private_layer->index, private_layer->committed_buffer);
}
if (private_layer->showing_buffer) {
- _tdm_layer_free_buffer(private_layer, private_layer->showing_buffer);
+ tdm_layer_free_buffer(private_layer, private_layer->showing_buffer);
private_layer->showing_buffer = NULL;
if (tdm_debug_module & TDM_DEBUG_BUFFER)
- TDM_INFO("layer(%p) showing_buffer(%p)",
- private_layer, private_layer->showing_buffer);
+ TDM_INFO("layer(%p,%d) showing_buffer(%p)",
+ private_layer, private_layer->index, private_layer->showing_buffer);
}
LIST_FOR_EACH_ENTRY_SAFE(lm, lmm, &private_output->layer_commit_handler_list, link) {
LIST_FOR_EACH_ENTRY_SAFE(lm, lmm, &clone_list, link) {
LIST_DEL(&lm->link);
tdm_output_remove_commit_handler_internal(private_output, _tdm_layer_cb_output_commit, lm);
- _tdm_layer_free_buffer(private_layer, lm->committed_buffer);
+ tdm_layer_free_buffer(private_layer, lm->committed_buffer);
free(lm);
}
LIST_FOR_EACH_ENTRY_SAFE(lm, lmm, &clone_list, link) {
LIST_DEL(&lm->link);
- _tdm_layer_free_buffer(private_layer, lm->committed_buffer);
+ tdm_layer_free_buffer(private_layer, lm->committed_buffer);
free(lm);
}
}
}
-EXTERN tdm_error
-tdm_layer_set_buffer(tdm_layer *layer, tbm_surface_h buffer)
+INTERN tdm_error
+tdm_layer_set_buffer_internal(tdm_private_layer *private_layer, tbm_surface_h buffer)
{
+ tdm_private_module *private_module;
+ tdm_private_output *private_output = private_layer->private_output;
tdm_func_layer *func_layer;
- LAYER_FUNC_ENTRY();
-
- TDM_RETURN_VAL_IF_FAIL(buffer != NULL, TDM_ERROR_INVALID_PARAMETER);
-
- _pthread_mutex_lock(&private_display->lock);
+ /* LCOV_EXCL_START */
+ /* dump buffer */
+ if (tdm_dump_enable && !(private_layer->caps.capabilities & TDM_LAYER_CAPABILITY_VIDEO))
+ _tdm_layer_dump_buffer(private_layer, buffer);
if (tdm_debug_dump & TDM_DUMP_FLAG_LAYER &&
!(private_layer->caps.capabilities & TDM_LAYER_CAPABILITY_VIDEO)) {
private_output->index, private_layer->index, i++);
tdm_helper_dump_buffer_str(buffer, tdm_debug_dump_dir, str);
}
+ /* LCOV_EXCL_STOP */
- func_layer = &private_display->func_layer;
+ private_module = private_layer->private_module;
+ func_layer = &private_module->func_layer;
if (private_layer->usable)
- TDM_INFO("layer(%p) not usable", private_layer);
+ TDM_INFO("layer(%p,%d) not usable", private_layer, private_layer->index);
private_layer->usable = 0;
if (!func_layer->layer_set_buffer) {
- _pthread_mutex_unlock(&private_display->lock);
+ /* LCOV_EXCL_START */
TDM_ERR("not implemented!!");
return TDM_ERROR_NOT_IMPLEMENTED;
+ /* LCOV_EXCL_START */
}
private_layer->pending_buffer_changed = 1;
if (private_layer->pending_buffer) {
- tbm_surface_internal_unref(private_layer->pending_buffer);
if (tdm_debug_module & TDM_DEBUG_BUFFER)
- TDM_INFO("layer(%p) pending_buffer(%p) skipped",
- private_layer, private_layer->pending_buffer);
+ TDM_INFO("layer(%p,%d) pending_buffer(%p) skipped",
+ private_layer, private_layer->index, private_layer->pending_buffer);
+
+ if (tdm_ttrace_module & TDM_TTRACE_LAYER) {
+ tbm_bo bo = tbm_surface_internal_get_bo(private_layer->pending_buffer, 0);
+ TDM_TRACE_ASYNC_END((intptr_t)private_layer, "[LAYER] %d", tbm_bo_export(bo));
+ }
+
+ tbm_surface_internal_unref(private_layer->pending_buffer);
}
tbm_surface_internal_ref(buffer);
private_layer->pending_buffer = buffer;
- if (tdm_debug_module & TDM_DEBUG_BUFFER)
- TDM_INFO("layer(%p) pending_buffer(%p)",
- private_layer, private_layer->pending_buffer);
+ if (tdm_debug_module & TDM_DEBUG_BUFFER) {
+ tbm_bo bo = tbm_surface_internal_get_bo(private_layer->pending_buffer, 0);
+ int flags = tbm_bo_get_flags(bo);
+ TDM_INFO("layer(%p,%d) pending_buffer(%p) bo_flags(%x)",
+ private_layer, private_layer->index, private_layer->pending_buffer, flags);
+ }
- _pthread_mutex_unlock(&private_display->lock);
+ if (tdm_ttrace_module & TDM_TTRACE_LAYER) {
+ tbm_bo bo = tbm_surface_internal_get_bo(private_layer->pending_buffer, 0);
+ TDM_TRACE_ASYNC_BEGIN((intptr_t)private_layer, "[LAYER] %d", tbm_bo_export(bo));
+ }
- return ret;
+ return TDM_ERROR_NONE;
}
EXTERN tdm_error
-tdm_layer_unset_buffer(tdm_layer *layer)
+tdm_layer_set_buffer(tdm_layer *layer, tbm_surface_h buffer)
{
- tdm_func_layer *func_layer;
LAYER_FUNC_ENTRY();
+ TDM_RETURN_VAL_IF_FAIL(buffer != NULL, TDM_ERROR_INVALID_PARAMETER);
+
_pthread_mutex_lock(&private_display->lock);
- func_layer = &private_display->func_layer;
+ ret = tdm_layer_set_buffer_internal(private_layer, buffer);
+
+ _pthread_mutex_unlock(&private_display->lock);
+
+ return ret;
+}
+
+INTERN tdm_error
+tdm_layer_unset_buffer_internal(tdm_private_layer *private_layer)
+{
+ tdm_private_module *private_module;
+ tdm_func_layer *func_layer;
+ tdm_error ret = TDM_ERROR_NONE;
+
+ private_module = private_layer->private_module;
+ func_layer = &private_module->func_layer;
_tdm_layer_free_all_buffers(private_layer);
private_layer->usable = 1;
if (private_layer->usable)
- TDM_INFO("layer(%p) now usable", private_layer);
+ TDM_INFO("layer(%p,%d) now usable", private_layer, private_layer->index);
if (!func_layer->layer_unset_buffer) {
- _pthread_mutex_unlock(&private_display->lock);
+ /* LCOV_EXCL_START */
TDM_ERR("not implemented!!");
return TDM_ERROR_NOT_IMPLEMENTED;
+ /* LCOV_EXCL_START */
}
ret = func_layer->layer_unset_buffer(private_layer->layer_backend);
TDM_WARNING_IF_FAIL(ret == TDM_ERROR_NONE);
+ return ret;
+}
+
+EXTERN tdm_error
+tdm_layer_unset_buffer(tdm_layer *layer)
+{
+ LAYER_FUNC_ENTRY();
+
+ _pthread_mutex_lock(&private_display->lock);
+
+ ret = tdm_layer_unset_buffer_internal(private_layer);
+ TDM_WARNING_IF_FAIL(ret == TDM_ERROR_NONE);
+
_pthread_mutex_unlock(&private_display->lock);
return ret;
tdm_private_output *private_output = private_layer->private_output;
tdm_private_display *private_display = private_output->private_display;
+ /* LCOV_EXCL_START */
if (private_display->print_fps) {
double curr = tdm_helper_get_time();
if (private_layer->fps_stamp == 0) {
private_layer->fps_stamp = curr;
} else if ((curr - private_layer->fps_stamp) > 1.0) {
- TDM_INFO("output(%d) layer(%d) fps: %d", private_output->index, private_layer->index, private_layer->fps_count);
+ TDM_INFO("output(%d) layer(%p,%d) fps: %d",
+ private_output->index, private_layer, private_layer->index, private_layer->fps_count);
private_layer->fps_count = 0;
private_layer->fps_stamp = curr;
} else
private_layer->fps_stamp = 0;
private_layer->fps_count = 0;
}
+ /* LCOV_EXCL_STOP */
+
+ if (private_layer->showing_buffer) {
+ if (tdm_ttrace_module & TDM_TTRACE_LAYER) {
+ tbm_bo bo = tbm_surface_internal_get_bo(private_layer->showing_buffer->buffer, 0);
+ TDM_TRACE_ASYNC_END((intptr_t)private_layer, "[LAYER] %d", tbm_bo_export(bo));
+ }
- if (private_layer->showing_buffer)
- _tdm_layer_free_buffer(private_layer, private_layer->showing_buffer);
+ tdm_layer_free_buffer(private_layer, private_layer->showing_buffer);
+ }
private_layer->showing_buffer = *committed_buffer;
*committed_buffer = NULL;
if (tdm_debug_module & TDM_DEBUG_BUFFER)
- TDM_INFO("layer(%p) committed_buffer(%p) showing_buffer(%p)",
- private_layer, *committed_buffer,
+ TDM_INFO("layer(%p,%d) committed_buffer(%p) showing_buffer(%p)",
+ private_layer, private_layer->index, *committed_buffer,
(private_layer->showing_buffer) ? private_layer->showing_buffer->buffer : NULL);
}
LIST_FOR_EACH_ENTRY_SAFE(lm, lmm, &clone_list, link) {
if (tdm_debug_module & TDM_DEBUG_COMMIT)
- TDM_INFO("layer(%p) committed. handle(%p) commited_buffer(%p)",
- lm->private_layer, lm, (lm->committed_buffer) ? lm->committed_buffer->buffer : NULL);
+ TDM_INFO("layer(%p,%d) committed. handle(%p) commited_buffer(%p)",
+ lm->private_layer, lm->private_layer->index, lm, (lm->committed_buffer) ? lm->committed_buffer->buffer : NULL);
LIST_DEL(&lm->link);
tdm_layer_committed(lm->private_layer, &lm->committed_buffer);
lm->func(lm->private_layer, sequence, tv_sec, tv_usec, lm->user_data);
_pthread_mutex_lock(&private_display->lock);
if (lm->committed_buffer)
- _tdm_layer_free_buffer(lm->private_layer, lm->committed_buffer);
+ tdm_layer_free_buffer(lm->private_layer, lm->committed_buffer);
free(lm);
}
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);
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);
if (lm->func)
lm->func(lm->private_layer, sequence, tv_sec, tv_usec, lm->user_data);
_pthread_mutex_lock(&private_display->lock);
- _tdm_layer_free_buffer(lm->private_layer, lm->committed_buffer);
+ tdm_layer_free_buffer(lm->private_layer, lm->committed_buffer);
free(lm);
}
private_layer = layer_commit_handler->private_layer;
+ private_layer->committing = 0;
+
if (tdm_debug_module & TDM_DEBUG_COMMIT)
- TDM_INFO("layer(%p) commit: output(%d) committed. handle(%p)",
- private_layer, private_output->pipe, layer_commit_handler);
+ TDM_INFO("layer(%p,%d) commit: output(%d) committed. handle(%p)",
+ private_layer, private_layer->index, private_output->pipe, layer_commit_handler);
_pthread_mutex_lock(&private_display->lock);
if (layer_commit_handler->func) {
_pthread_mutex_unlock(&private_display->lock);
- layer_commit_handler->func(private_output, sequence,
+ layer_commit_handler->func(private_layer, sequence,
tv_sec, tv_usec, layer_commit_handler->user_data);
_pthread_mutex_lock(&private_display->lock);
}
}
static unsigned int
-_tdm_lauer_get_output_used_layer_count(tdm_private_output *private_output)
+_tdm_layer_get_output_used_layer_count(tdm_private_output *private_output)
{
tdm_private_layer *private_layer = NULL;
unsigned int count = 0;
_tdm_layer_commit_possible(tdm_private_layer *private_layer)
{
tdm_private_output *private_output = private_layer->private_output;
- tdm_private_display *private_display = private_output->private_display;
- TDM_RETURN_VAL_IF_FAIL(private_display->commit_per_vblank > 0, 1);
+ TDM_RETURN_VAL_IF_FAIL(private_output->commit_per_vblank > 0, 1);
/* There is a previous commit request which is not done and displayed on screen yet.
* We can't commit at this time.
*/
if (!LIST_IS_EMPTY(&private_output->layer_commit_handler_list)) {
if (tdm_debug_module & TDM_DEBUG_COMMIT)
- TDM_INFO("layer(%p) commit: not possible(previous commit)", private_layer);
+ TDM_INFO("layer(%p,%d) commit: not possible(previous commit)",
+ private_layer, private_layer->index);
return 0;
}
- if (private_display->commit_per_vblank == 1 && _tdm_lauer_get_output_used_layer_count(private_output) > 1) {
+ if (private_output->commit_per_vblank == 1 && _tdm_layer_get_output_used_layer_count(private_output) > 1) {
if (tdm_debug_module & TDM_DEBUG_COMMIT)
- TDM_INFO("layer(%p) commit: not possible(more than 2 layers)", private_layer);
+ TDM_INFO("layer(%p,%d) commit: not possible(more than 2 layers)",
+ private_layer, private_layer->index);
return 0;
}
if (tdm_debug_module & TDM_DEBUG_COMMIT)
- TDM_INFO("layer(%p) commit: possible", private_layer);
+ TDM_INFO("layer(%p,%d) commit: possible", private_layer, private_layer->index);
return 1;
}
INTERN tdm_error
tdm_layer_commit_pending_data(tdm_private_layer *private_layer)
{
- tdm_private_output *private_output = private_layer->private_output;
- tdm_private_display *private_display = private_output->private_display;
+ tdm_private_module *private_module;
tdm_func_layer *func_layer;
tdm_error ret = TDM_ERROR_NONE;
- func_layer = &private_display->func_layer;
+ private_module = private_layer->private_module;
+ func_layer = &private_module->func_layer;
if (private_layer->pending_info_changed) {
ret = func_layer->layer_set_info(private_layer->layer_backend, &private_layer->pending_info);
TDM_WARNING_IF_FAIL(ret == TDM_ERROR_NONE);
if (tdm_debug_module & TDM_DEBUG_BUFFER)
- TDM_INFO("layer(%p) pending_buffer(%p) committed",
- private_layer, private_layer->pending_buffer);
-
- /* dump buffer */
- if (tdm_dump_enable && !(private_layer->caps.capabilities & TDM_LAYER_CAPABILITY_VIDEO))
- _tdm_layer_dump_buffer(private_layer, private_layer->pending_buffer);
+ TDM_INFO("layer(%p,%d) pending_buffer(%p) committed",
+ private_layer, private_layer->index, private_layer->pending_buffer);
if (ret == TDM_ERROR_NONE) {
if (private_layer->waiting_buffer)
- _tdm_layer_free_buffer(private_layer, private_layer->waiting_buffer);
+ tdm_layer_free_buffer(private_layer, private_layer->waiting_buffer);
private_layer->waiting_buffer = layer_buffer;
private_layer->waiting_buffer->buffer = tdm_buffer_ref_backend(private_layer->pending_buffer);
if (tdm_debug_module & TDM_DEBUG_BUFFER)
- TDM_INFO("layer(%p) waiting_buffer(%p)",
- private_layer, private_layer->waiting_buffer->buffer);
+ TDM_INFO("layer(%p,%d) waiting_buffer(%p)",
+ private_layer, private_layer->index, private_layer->waiting_buffer->buffer);
} else
- _tdm_layer_free_buffer(private_layer, layer_buffer);
+ tdm_layer_free_buffer(private_layer, layer_buffer);
}
done:
layer_commit_handler = calloc(1, sizeof(tdm_private_layer_commit_handler));
if (!layer_commit_handler) {
+ /* LCOV_EXCL_START */
TDM_ERR("failed: alloc memory");
return TDM_ERROR_OUT_OF_MEMORY;
+ /* LCOV_EXCL_STOP */
}
if (tdm_debug_module & TDM_DEBUG_COMMIT)
- TDM_INFO("layer(%p) commit: handle(%p)", private_layer, layer_commit_handler);
+ TDM_INFO("layer(%p,%d) commit: handle(%p)", private_layer, private_layer->index, layer_commit_handler);
LIST_INITHEAD(&layer_commit_handler->link);
layer_commit_handler->private_layer = private_layer;
layer_commit_handler->committed_buffer = private_layer->waiting_buffer;
private_layer->waiting_buffer = NULL;
+ if (!private_layer->committing && layer_commit_handler->committed_buffer)
+ private_layer->commiting_buffer = layer_commit_handler->committed_buffer->buffer;
+
+ if (private_layer->committing)
+ TDM_WRN("layer(%p,%d) too many commit", private_layer, private_layer->index);
+ else
+ private_layer->committing = 1;
+
if (tdm_debug_module & TDM_DEBUG_BUFFER)
- TDM_INFO("layer(%p) waiting_buffer(%p) committed_buffer(%p)",
- private_layer, private_layer->waiting_buffer,
+ TDM_INFO("layer(%p,%d) waiting_buffer(%p) committed_buffer(%p)",
+ private_layer, private_layer->index, private_layer->waiting_buffer,
(layer_commit_handler->committed_buffer) ? layer_commit_handler->committed_buffer->buffer : NULL);
- if (!private_display->commit_per_vblank) {
- TDM_GOTO_IF_FAIL(private_display->commit_type == TDM_COMMIT_TYPE_OUTPUT, commit_failed);
+ if (!private_output->commit_per_vblank) {
+ TDM_GOTO_IF_FAIL(private_output->commit_type == TDM_COMMIT_TYPE_OUTPUT, commit_failed);
LIST_ADDTAIL(&layer_commit_handler->link, &private_output->layer_commit_handler_list);
ret = tdm_output_commit_internal(private_layer->private_output, 0, _tdm_layer_cb_output_commit, layer_commit_handler);
TDM_GOTO_IF_FAIL(ret == TDM_ERROR_NONE, commit_failed);
if (tdm_debug_module & TDM_DEBUG_COMMIT)
- TDM_INFO("layer(%p) commit: no commit-per-vblank", private_layer);
+ TDM_INFO("layer(%p,%d) commit: no commit-per-vblank", private_layer, private_layer->index);
} else {
- TDM_GOTO_IF_FAIL(private_display->commit_type == TDM_COMMIT_TYPE_LAYER, commit_failed);
-
- if (private_layer->committing)
- TDM_WRN("layer(%d) too many commit", private_layer->index);
- else
- private_layer->committing = 1;
+ TDM_GOTO_IF_FAIL(private_output->commit_type == TDM_COMMIT_TYPE_LAYER, commit_failed);
if (_tdm_layer_commit_possible(private_layer)) {
/* add to layer_commit_handler_list */
LIST_ADDTAIL(&layer_commit_handler->link, &private_output->layer_commit_handler_list);
- ret = tdm_output_commit_internal(private_layer->private_output, 0, NULL, NULL);
+ ret = tdm_output_commit_internal(private_layer->private_output, 0, _tdm_layer_cb_output_commit, layer_commit_handler);
TDM_GOTO_IF_FAIL(ret == TDM_ERROR_NONE, commit_failed);
if (tdm_debug_module & TDM_DEBUG_COMMIT)
- TDM_INFO("layer(%p) commit: output", private_layer);
+ TDM_INFO("layer(%p,%d) commit: output", private_layer, private_layer->index);
} else {
/* add to pending_commit_handler_list. It will be commited when a vblank occurs */
LIST_ADDTAIL(&layer_commit_handler->link, &private_output->pending_commit_handler_list);
if (tdm_debug_module & TDM_DEBUG_COMMIT)
- TDM_INFO("layer(%p) commit: pending", private_layer);
+ TDM_INFO("layer(%p,%d) commit: pending", private_layer, private_layer->index);
}
if (!private_output->vblank) {
private_output->layer_waiting_vblank = 1;
if (tdm_debug_module & TDM_DEBUG_COMMIT)
- TDM_INFO("layer(%p) commit: wait vblank", private_layer);
+ TDM_INFO("layer(%p,%d) commit: wait vblank", private_layer, private_layer->index);
}
}
return ret;
}
-EXTERN tdm_error
-tdm_layer_commit(tdm_layer *layer, tdm_layer_commit_handler func, void *user_data)
+INTERN tdm_error
+tdm_layer_commit_internal(tdm_private_layer *private_layer, tdm_layer_commit_handler func, void *user_data)
{
- LAYER_FUNC_ENTRY();
-
- _pthread_mutex_lock(&private_display->lock);
+ tdm_private_output *private_output = private_layer->private_output;
+ tdm_error ret = TDM_ERROR_NONE; /* default TDM_ERROR_NONE */
- if (private_display->commit_type == TDM_COMMIT_TYPE_NONE) {
- if (!private_display->commit_per_vblank)
- private_display->commit_type = TDM_COMMIT_TYPE_OUTPUT;
+ if (private_output->commit_type == TDM_COMMIT_TYPE_NONE) {
+ if (!private_output->commit_per_vblank)
+ private_output->commit_type = TDM_COMMIT_TYPE_OUTPUT;
else
- private_display->commit_type = TDM_COMMIT_TYPE_LAYER;
+ private_output->commit_type = TDM_COMMIT_TYPE_LAYER;
}
- if (private_output->current_dpms_value > TDM_OUTPUT_DPMS_ON) {
- TDM_ERR("layer(%p)'s output(%d) dpms: %s", layer, private_output->pipe,
+ if (TDM_OUTPUT_DPMS_VSYNC_IS_OFF(private_output->current_dpms_value)) {
+ TDM_ERR("layer(%p,%d)'s output(%d) dpms: %s", private_layer, private_layer->index, private_output->pipe,
tdm_dpms_str(private_output->current_dpms_value));
- _pthread_mutex_unlock(&private_display->lock);
return TDM_ERROR_DPMS_OFF;
}
/* don't call this inside of _tdm_layer_commit */
ret = tdm_layer_commit_pending_data(private_layer);
if (ret != TDM_ERROR_NONE) {
- TDM_ERR("layer(%p) committing pending data failed", layer);
- _pthread_mutex_unlock(&private_display->lock);
+ TDM_ERR("layer(%p,%d) committing pending data failed", private_layer, private_layer->index);
return ret;
}
ret = _tdm_layer_commit(private_layer, func, user_data);
+ return ret;
+}
+
+EXTERN tdm_error
+tdm_layer_commit(tdm_layer *layer, tdm_layer_commit_handler func, void *user_data)
+{
+ LAYER_FUNC_ENTRY();
+
+ _pthread_mutex_lock(&private_display->lock);
+
+ ret = tdm_layer_commit_internal(private_layer, func, user_data);
+
_pthread_mutex_unlock(&private_display->lock);
return ret;
tdm_private_output *private_output = private_layer->private_output;
tdm_private_layer_commit_handler *lm = NULL, *lmm = NULL;
+ if (!func && !user_data)
+ return;
+
TDM_RETURN_IF_FAIL(private_layer != NULL);
TDM_RETURN_IF_FAIL(TDM_MUTEX_IS_LOCKED());
if (lm->func == func && lm->user_data == user_data) {
LIST_DEL(&lm->link);
tdm_output_remove_commit_handler_internal(private_output, _tdm_layer_cb_output_commit, lm);
- _tdm_layer_free_buffer(private_layer, lm->committed_buffer);
+ tdm_layer_free_buffer(private_layer, lm->committed_buffer);
free(lm);
break;
}
if (lm->func == func && lm->user_data == user_data) {
LIST_DEL(&lm->link);
tdm_output_remove_commit_handler_internal(private_output, _tdm_layer_cb_output_commit, lm);
- _tdm_layer_free_buffer(private_layer, lm->committed_buffer);
+ tdm_layer_free_buffer(private_layer, lm->committed_buffer);
free(lm);
break;
}
if (private_layer->showing_buffer) {
buffer = private_layer->showing_buffer->buffer;
} else {
- if (error)
- *error = TDM_ERROR_OPERATION_FAILED;
_pthread_mutex_unlock(&private_display->lock);
- TDM_DBG("layer(%p) showing_buffer is null", private_layer);
+ TDM_DBG("layer(%p,%d) showing_buffer is null", private_layer, private_layer->index);
return NULL;
}
_pthread_mutex_unlock(&private_display->lock);
{
TDM_RETURN_IF_FAIL(data != NULL);
tdm_layer *layer = data;
+ tdm_private_module *private_module;
tdm_func_layer *func_layer;
- tbm_surface_h surface = NULL;
- tdm_private_layer_buffer *layer_buffer;
+ tbm_surface_h buffer = NULL;
LAYER_FUNC_ENTRY_VOID_RETURN();
_pthread_mutex_lock(&private_display->lock);
- func_layer = &private_display->func_layer;
+ private_module = private_layer->private_module;
+ func_layer = &private_module->func_layer;
+
if (!func_layer->layer_set_buffer) {
+ /* LCOV_EXCL_START */
_pthread_mutex_unlock(&private_display->lock);
return;
+ /* LCOV_EXCL_STOP */
}
- layer_buffer = calloc(1, sizeof(tdm_private_layer_buffer));
- if (!layer_buffer) {
+ if (TBM_SURFACE_QUEUE_ERROR_NONE != tbm_surface_queue_acquire(private_layer->buffer_queue, &buffer) ||
+ buffer == NULL) {
+ /* LCOV_EXCL_START */
+ TDM_ERR("layer(%p,%d) tbm_surface_queue_acquire() failed surface:%p",
+ private_layer, private_layer->index, buffer);
_pthread_mutex_unlock(&private_display->lock);
- TDM_ERR("alloc failed");
return;
+ /* LCOV_EXCL_STOP */
}
- LIST_INITHEAD(&layer_buffer->link);
- if (TBM_SURFACE_QUEUE_ERROR_NONE != tbm_surface_queue_acquire(private_layer->buffer_queue, &surface) ||
- surface == NULL) {
- TDM_ERR("layer(%p) tbm_surface_queue_acquire() failed surface:%p",
- private_layer, surface);
+ ret = tdm_layer_set_buffer_internal(private_layer, buffer);
+ if (ret != TDM_ERROR_NONE) {
+ TDM_ERR("tdm_layer_set_buffer_internal failed");
_pthread_mutex_unlock(&private_display->lock);
- free(layer_buffer);
return;
}
- /* we don't need to handle pending data here because the changes in this function
- * should be applied immediately. we can't expect calling tdm_layer_commit.
- */
- ret = func_layer->layer_set_buffer(private_layer->layer_backend, surface);
- TDM_WARNING_IF_FAIL(ret == TDM_ERROR_NONE);
-
- if (ret == TDM_ERROR_NONE) {
- if (private_layer->waiting_buffer) {
- TDM_DBG("layer(%p) drop waiting_buffer(%p)", private_layer, private_layer->waiting_buffer->buffer);
- _tdm_layer_free_buffer(private_layer, private_layer->waiting_buffer);
- }
-
- private_layer->waiting_buffer = layer_buffer;
- private_layer->waiting_buffer->buffer = tdm_buffer_ref_backend(surface);
-
- if (tdm_debug_module & TDM_DEBUG_BUFFER)
- TDM_INFO("layer(%p) waiting_buffer(%p)",
- private_layer, private_layer->waiting_buffer->buffer);
-
- if (private_display->commit_type == TDM_COMMIT_TYPE_OUTPUT) {
- ret = tdm_output_commit_internal(private_layer->private_output, 0, NULL, NULL);
- if (ret != TDM_ERROR_NONE)
- TDM_ERR("tdm_output_commit_internal() is fail");
- } else if (private_display->commit_type == TDM_COMMIT_TYPE_LAYER) {
- ret = _tdm_layer_commit(private_layer, NULL, NULL);
- if (ret != TDM_ERROR_NONE)
- TDM_ERR("layer(%p) _tdm_layer_commit() is fail", private_layer);
- } else {
- TDM_NEVER_GET_HERE();
- }
- } else
- _tdm_layer_free_buffer(private_layer, layer_buffer);
+ ret = tdm_layer_commit_internal(private_layer, NULL, NULL);
+ if (ret != TDM_ERROR_NONE) {
+ TDM_ERR("tdm_layer_commit_internal failed");
+ _pthread_mutex_unlock(&private_display->lock);
+ return;
+ }
_pthread_mutex_unlock(&private_display->lock);
}
EXTERN tdm_error
tdm_layer_set_buffer_queue(tdm_layer *layer, tbm_surface_queue_h buffer_queue)
{
+ tdm_private_module *private_module;
tdm_func_layer *func_layer;
LAYER_FUNC_ENTRY();
_pthread_mutex_lock(&private_display->lock);
- func_layer = &private_display->func_layer;
+ private_module = private_layer->private_module;
+ func_layer = &private_module->func_layer;
if (private_layer->usable)
- TDM_INFO("layer(%p) not usable", private_layer);
+ TDM_INFO("layer(%p,%d) not usable", private_layer, private_layer->index);
private_layer->usable = 0;
if (!func_layer->layer_set_buffer) {
+ /* LCOV_EXCL_START */
_pthread_mutex_unlock(&private_display->lock);
TDM_ERR("not implemented!!");
return TDM_ERROR_NOT_IMPLEMENTED;
+ /* LCOV_EXCL_STOP */
}
if (buffer_queue == private_layer->buffer_queue) {
}
if (private_layer->waiting_buffer) {
- _tdm_layer_free_buffer(private_layer, private_layer->waiting_buffer);
+ tdm_layer_free_buffer(private_layer, private_layer->waiting_buffer);
private_layer->waiting_buffer = NULL;
if (tdm_debug_module & TDM_DEBUG_BUFFER)
- TDM_INFO("layer(%p) waiting_buffer(%p)",
- private_layer, private_layer->waiting_buffer);
+ TDM_INFO("layer(%p,%d) waiting_buffer(%p)",
+ private_layer, private_layer->index, private_layer->waiting_buffer);
}
private_layer->buffer_queue = buffer_queue;
EXTERN tdm_error
tdm_layer_set_video_pos(tdm_layer *layer, int zpos)
{
+ tdm_private_module *private_module;
tdm_func_layer *func_layer;
LAYER_FUNC_ENTRY();
_pthread_mutex_lock(&private_display->lock);
- func_layer = &private_display->func_layer;
+ private_module = private_layer->private_module;
+ func_layer = &private_module->func_layer;
if (!(private_layer->caps.capabilities & TDM_LAYER_CAPABILITY_VIDEO)) {
- TDM_ERR("layer(%p) is not video layer", private_layer);
+ TDM_ERR("layer(%p,%d) is not video layer", private_layer, private_layer->index);
_pthread_mutex_unlock(&private_display->lock);
- return TDM_ERROR_INVALID_PARAMETER;
+ return TDM_ERROR_BAD_REQUEST;
}
if (!func_layer->layer_set_video_pos) {
+ /* LCOV_EXCL_START */
_pthread_mutex_unlock(&private_display->lock);
- TDM_ERR("not implemented!!");
+ TDM_ERR("layer(%p,%d) not implemented!!", private_layer, private_layer->index);
return TDM_ERROR_NOT_IMPLEMENTED;
+ /* LCOV_EXCL_STOP */
}
ret = func_layer->layer_set_video_pos(private_layer->layer_backend, zpos);
EXTERN tdm_error
tdm_layer_get_buffer_flags(tdm_layer *layer, unsigned int *flags)
{
+ tdm_private_module *private_module;
tdm_func_layer *func_layer;
LAYER_FUNC_ENTRY();
+ TDM_RETURN_VAL_IF_FAIL(flags != NULL, TDM_ERROR_INVALID_PARAMETER);
_pthread_mutex_lock(&private_display->lock);
- func_layer = &private_display->func_layer;
+ private_module = private_layer->private_module;
+ func_layer = &private_module->func_layer;
if (!func_layer->layer_get_buffer_flags) {
+ /* LCOV_EXCL_START */
+ *flags = 0;
_pthread_mutex_unlock(&private_display->lock);
- TDM_ERR("not implemented!!");
- return TDM_ERROR_NOT_IMPLEMENTED;
+ TDM_INFO("not implemented!!");
+ return TDM_ERROR_NONE;
+ /* LCOV_EXCL_STOP */
}
ret = func_layer->layer_get_buffer_flags(private_layer->layer_backend, flags);