From 5b11cd1859acaf702bff92e255beab372b7421ee Mon Sep 17 00:00:00 2001 From: SooChan Lim Date: Mon, 12 Feb 2018 10:29:35 +0900 Subject: [PATCH] hwc: add tdm_hwc_unset_buffer Change-Id: Ia00e4ea2e07217fa7c6b42cf9a4ab0aefa4053e7 --- include/tdm.h | 14 ++++++++++++++ include/tdm_backend.h | 13 +++++++++++++ src/tdm_hwc_window.c | 26 ++++++++++++++++++++++++++ 3 files changed, 53 insertions(+) diff --git a/include/tdm.h b/include/tdm.h index d6bc82a..7be0a14 100644 --- a/include/tdm.h +++ b/include/tdm.h @@ -1039,6 +1039,20 @@ tdm_error tdm_hwc_window_set_buffer(tdm_hwc_window *hwc_window, tbm_surface_h buffer); /** + * @brief Unset a TBM buffer to a window object + * @details A TBM buffer will be applied when the output object of a layer + * object is committed. + * @param[in] hwc_window A window object + * @return #TDM_ERROR_NONE if success. Otherwise, error value. + * @return #TDM_ERROR_BUSY if #hwc_window can't be updated right now, this + * can happen if #hwc_window is involved in the smooth transition from + * DEVICE to CLIENT, this shouldn't be interpreted like some critical error. + * @since 2.0.0 + */ +tdm_error +tdm_hwc_window_unset_buffer(tdm_hwc_window *hwc_window); + +/** * @brief Set a flags to a window object * @param[in] hwc_window A window object * @param[in] flags A hwc_window flags diff --git a/include/tdm_backend.h b/include/tdm_backend.h index 297c74a..a3bd3b3 100644 --- a/include/tdm_backend.h +++ b/include/tdm_backend.h @@ -896,6 +896,19 @@ typedef struct _tdm_func_window { tbm_surface_h buffer); /** + * @brief Unset a TDM buffer to a window object + * @details A TDM buffer will be applied when the output object + * of a layer object is committed. + * @param[in] hwc_window A window object + * @return #TDM_ERROR_NONE if success. Otherwise, error value. + * + * Implementation should return #TDM_ERROR_BUSY if #hwc_window can't + * be updated right now, this won't be interpreted like some critical + * error. + */ + tdm_error (*hwc_window_unset_buffer)(tdm_hwc_window *hwc_window); + + /** * @brief Set a flags to a window object * @param[in] hwc_window A window object * @param[in] flags A hwc_window flags diff --git a/src/tdm_hwc_window.c b/src/tdm_hwc_window.c index 73f92c0..96d2698 100644 --- a/src/tdm_hwc_window.c +++ b/src/tdm_hwc_window.c @@ -236,6 +236,32 @@ tdm_hwc_window_set_buffer(tdm_hwc_window *hwc_window, tbm_surface_h buffer) 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) -- 2.7.4