From 8f1377d4928ad9bdcc0cf10e16bfd24a3ed56de3 Mon Sep 17 00:00:00 2001 From: SooChan Lim Date: Tue, 4 Dec 2018 11:18:59 +0900 Subject: [PATCH] add tdm_hwc_window_set_cursor_image let the tdm backend know the virtual address and information of the cursor image. Change-Id: I31716a8fae97affb5ab801027c081bd0d2bdccbc --- include/tdm.h | 12 ++++++++++++ include/tdm_backend.h | 12 ++++++++++++ src/tdm_hwc_window.c | 26 ++++++++++++++++++++++++++ 3 files changed, 50 insertions(+) diff --git a/include/tdm.h b/include/tdm.h index 63edce4..c18b27e 100644 --- a/include/tdm.h +++ b/include/tdm.h @@ -1159,6 +1159,18 @@ tdm_error tdm_hwc_window_set_name(tdm_hwc_window *hwc_window, const char *name); /** + * @brief Get buffer flags of cursor hwc_window + * @param[in] hwc_window A hwc window object + * @param[in] width of the cursor image + * @param[in] height of the cursor image + * @param[in] stride of the cursor image + * @param[in] virtual address of the cursor image + * @return #TDM_ERROR_NONE if success. Otherwise, error value. + */ +tdm_error +tdm_hwc_window_set_cursor_image(tdm_hwc_window *hwc_window, int width, int height, int stride, void *ptr); + +/** * @brief Destroy a pp object * @param[in] pp A pp object * @see tdm_display_create_pp diff --git a/include/tdm_backend.h b/include/tdm_backend.h index 1b73ba9..b131ced 100644 --- a/include/tdm_backend.h +++ b/include/tdm_backend.h @@ -1056,6 +1056,18 @@ typedef struct _tdm_func_hwc_window { */ tdm_error (*hwc_window_set_name)(tdm_hwc_window *hwc_window, const char *name); + + /** + * @brief Get buffer flags of cursor hwc_window + * @param[in] hwc_window A hwc window object + * @param[in] width of the cursor image + * @param[in] height of the cursor image + * @param[in] stride of the cursor image + * @param[in] virtual address of the cursor image + * @return #TDM_ERROR_NONE if success. Otherwise, error value. + */ + tdm_error (*hwc_window_set_cursor_image)(tdm_hwc_window *hwc_window, + int width, int height, int stride, void *ptr); } tdm_func_hwc_window; /** diff --git a/src/tdm_hwc_window.c b/src/tdm_hwc_window.c index fd86345..8f5fcda 100644 --- a/src/tdm_hwc_window.c +++ b/src/tdm_hwc_window.c @@ -493,4 +493,30 @@ tdm_hwc_window_set_name(tdm_hwc_window *hwc_window, const char *name) return ret; } + +tdm_error +tdm_hwc_window_set_cursor_image(tdm_hwc_window *hwc_window, int width, int height, int stride, void *ptr) +{ + tdm_private_module *private_module; + tdm_func_hwc_window *func_hwc_window = NULL; + + HWC_WINDOW_FUNC_ENTRY(); + + _pthread_mutex_lock(&private_display->lock); + + private_module = private_output->private_module; + func_hwc_window = &private_module->func_hwc_window; + + if (!func_hwc_window->hwc_window_set_cursor_image) { + _pthread_mutex_unlock(&private_display->lock); + TDM_WRN("not implemented!!"); + return TDM_ERROR_NOT_IMPLEMENTED; + } + + ret = func_hwc_window->hwc_window_set_cursor_image(private_hwc_window->hwc_window_backend, width, height, stride, ptr); + + _pthread_mutex_unlock(&private_display->lock); + + return ret; +} /* LCOV_EXCL_STOP */ \ No newline at end of file -- 2.7.4