#include "config.h"
#endif
-#include "tdm.h"
-#include "tdm_backend.h"
#include "tdm_private.h"
-#include "tdm_helper.h"
#define COUNT_MAX 10
}
EXTERN tdm_error
-tdm_hwc_window_set_zpos(tdm_hwc_window *hwc_window, int32_t zpos)
-{
- tdm_func_hwc_window *func_hwc_window = NULL;
-
- HWC_WINDOW_FUNC_ENTRY();
-
- _pthread_mutex_lock(&private_display->lock);
-
- func_hwc_window = &private_display->func_hwc_window;
-
- if (!func_hwc_window->hwc_window_set_zpos) {
- /* LCOV_EXCL_START */
- _pthread_mutex_unlock(&private_display->lock);
- TDM_ERR("not implemented!!");
- return TDM_ERROR_NOT_IMPLEMENTED;
- /* LCOV_EXCL_STOP */
- }
-
- ret = func_hwc_window->hwc_window_set_zpos(private_hwc_window->hwc_window_backend, zpos);
- if (ret == TDM_ERROR_NONE)
- private_hwc_window->zpos = zpos;
-
- _pthread_mutex_unlock(&private_display->lock);
-
- return ret;
-}
-
-EXTERN tdm_error
tdm_hwc_window_set_composition_type(tdm_hwc_window *hwc_window,
tdm_hwc_window_composition composition_type)
{
return ret;
}
-/* LCOV_EXCL_START */
-static void
-_tdm_window_dump_buffer(tdm_hwc_window *hwc_window, tbm_surface_h buffer)
-{
- tdm_private_hwc_window *private_window = (tdm_private_hwc_window *)hwc_window;
- tdm_private_output *private_output = private_window->private_output;
- unsigned int pipe;
- uint32_t zpos;
- char fname[PATH_MAX];
-
- pipe = private_output->pipe;
- zpos = private_window->zpos;
-
- snprintf(fname, sizeof(fname), "tdm_%d_win_%d", pipe, zpos);
-
- tbm_surface_internal_dump_buffer(buffer, fname);
- TDM_DBG("%s dump excute", fname);
-
- return;
-}
-/* LCOV_EXCL_STOP */
-
EXTERN tdm_error
tdm_hwc_window_set_buffer(tdm_hwc_window *hwc_window, tbm_surface_h buffer)
{
/* LCOV_EXCL_START */
char str[TDM_PATH_LEN];
static int i;
- snprintf(str, TDM_PATH_LEN, "window_%d_%d_%03d",
- private_output->index, private_hwc_window->zpos, i++);
+ snprintf(str, TDM_PATH_LEN, "window_%d_%03d", private_output->index, i++);
tdm_helper_dump_buffer_str(buffer, tdm_debug_dump_dir, str);
/* LCOV_EXCL_STOP */
}
/* LCOV_EXCL_STOP */
}
- /* dump buffer */
- /* LCOV_EXCL_START */
- if (tdm_dump_enable && buffer)
- _tdm_window_dump_buffer(hwc_window, buffer);
- /* LCOV_EXCL_STOP */
-
ret = func_hwc_window->hwc_window_set_buffer(private_hwc_window->hwc_window_backend, buffer);
_pthread_mutex_unlock(&private_display->lock);
return ret;
}
+EXTERN tdm_error
+tdm_hwc_window_unset_buffer(tdm_hwc_window *hwc_window)
+{
+ tdm_func_hwc_window *func_hwc_window;
+
+ HWC_WINDOW_FUNC_ENTRY();
+
+ _pthread_mutex_lock(&private_display->lock);
+
+ func_hwc_window = &private_display->func_hwc_window;
+
+ if (!func_hwc_window->hwc_window_unset_buffer) {
+ /* LCOV_EXCL_START */
+ _pthread_mutex_unlock(&private_display->lock);
+ TDM_ERR("not implemented!!");
+ return TDM_ERROR_NOT_IMPLEMENTED;
+ /* LCOV_EXCL_STOP */
+ }
+
+ ret = func_hwc_window->hwc_window_unset_buffer(private_hwc_window->hwc_window_backend);
+
+ _pthread_mutex_unlock(&private_display->lock);
+
+ return ret;
+}
+
INTERN tdm_hwc_window *
tdm_hwc_window_create_internal(tdm_private_output *private_output, int is_video,
tdm_error *error)
return ret;
}
+static void
+_tdm_hwc_window_layer_commit_handler(tdm_layer *layer, unsigned int sequence,
+ unsigned int tv_sec, unsigned int tv_usec,
+ void *user_data)
+{
+ tdm_private_hwc_window_commit_handler *hwc_window_commit_handler = (tdm_private_hwc_window_commit_handler *)user_data;
+ tdm_hwc_window_commit_handler func = hwc_window_commit_handler->func;
+ tdm_hwc_window *hwc_window = (tdm_hwc_window *)hwc_window_commit_handler->private_hwc_window;
+ void *data = hwc_window_commit_handler->user_data;
+
+ func(hwc_window, sequence, tv_sec, tv_usec, data);
+
+ free(hwc_window_commit_handler);
+}
+
+tdm_error
+tdm_hwc_window_commit(tdm_hwc_window *hwc_window, tdm_hwc_window_commit_handler func, void *user_data)
+{
+ tdm_func_hwc_window *func_hwc_window = NULL;
+ tdm_private_hwc_window_commit_handler *hwc_window_commit_handler;
+ tdm_layer *layer = NULL;
+ tdm_private_layer *private_layer;
+ tdm_info_layer *info_layer;
+ tdm_hwc_window_info window_info;
+ tbm_surface_h buffer;
+
+ HWC_WINDOW_FUNC_ENTRY();
+
+ _pthread_mutex_lock(&private_display->lock);
+
+ func_hwc_window = &private_display->func_hwc_window;
+
+ if (!func_hwc_window->hwc_window_get_layer) {
+ /* LCOV_EXCL_START */
+ _pthread_mutex_unlock(&private_display->lock);
+ TDM_ERR("not implemented!!");
+ return TDM_ERROR_NOT_IMPLEMENTED;
+ /* LCOV_EXCL_STOP */
+ }
+
+ layer = func_hwc_window->hwc_window_get_layer(private_hwc_window->hwc_window_backend,
+ &ret);
+ if (!layer) {
+ /* LCOV_EXCL_START */
+ _pthread_mutex_unlock(&private_display->lock);
+ TDM_ERR("no assigned layer!!");
+ return TDM_ERROR_INVALID_PARAMETER;
+ /* LCOV_EXCL_STOP */
+ }
+
+ private_layer = (tdm_private_layer*)layer;
+
+ buffer = func_hwc_window->hwc_window_get_buffer(private_hwc_window->hwc_window_backend,
+ &ret);
+ if (!buffer) {
+ /* LCOV_EXCL_START */
+ _pthread_mutex_unlock(&private_display->lock);
+ TDM_ERR("no assigned buffer!!");
+ return TDM_ERROR_INVALID_PARAMETER;
+ /* LCOV_EXCL_STOP */
+ }
+
+ if (buffer)
+ ret = tdm_layer_set_buffer_internal(private_layer, buffer);
+ else
+ ret = tdm_layer_unset_buffer_internal(private_layer);
+ if (ret != TDM_ERROR_NONE) {
+ /* LCOV_EXCL_START */
+ TDM_ERR("failed: layer set buffer(window)");
+ /* LCOV_EXCL_STOP */
+ return ret;
+ }
+
+ ret = func_hwc_window->hwc_window_get_info(private_hwc_window->hwc_window_backend,
+ &window_info);
+ if (ret != TDM_ERROR_NONE) {
+ /* LCOV_EXCL_START */
+ TDM_ERR("failed: commit layer(window)");
+ /* LCOV_EXCL_STOP */
+ return ret;
+ }
+
+ info_layer = (tdm_info_layer *)&window_info;
+ ret = tdm_layer_set_info_internal(private_layer, info_layer);
+ if (ret != TDM_ERROR_NONE) {
+ /* LCOV_EXCL_START */
+ TDM_ERR("failed: layer set info(window)");
+ /* LCOV_EXCL_STOP */
+ return ret;
+ }
+
+ hwc_window_commit_handler = calloc(1, sizeof(tdm_private_hwc_window_commit_handler));
+ if (!hwc_window_commit_handler) {
+ /* LCOV_EXCL_START */
+ TDM_ERR("failed: alloc memory");
+ return TDM_ERROR_OUT_OF_MEMORY;
+ /* LCOV_EXCL_STOP */
+ }
+
+ hwc_window_commit_handler->private_hwc_window = private_hwc_window;
+ hwc_window_commit_handler->func = func;
+ hwc_window_commit_handler->user_data = user_data;
+
+ ret = tdm_layer_commit_internal(private_layer, _tdm_hwc_window_layer_commit_handler, user_data);
+ if (ret != TDM_ERROR_NONE) {
+ /* LCOV_EXCL_START */
+ TDM_ERR("failed: commit layer(window)");
+ free(hwc_window_commit_handler);
+ /* LCOV_EXCL_STOP */
+ return ret;
+ }
+
+ _pthread_mutex_unlock(&private_display->lock);
+
+ return ret;
+}
+
EXTERN tdm_error
tdm_hwc_window_video_get_capability(tdm_hwc_window *hwc_window,
tdm_hwc_window_video_capability *video_capability)