From 3f66eefbafbdce878a10276e0a5d8299b7267b56 Mon Sep 17 00:00:00 2001 From: Changyeon Lee Date: Fri, 11 Feb 2022 18:10:25 +0900 Subject: [PATCH] add tdm_hwc_set_client_target_buffer_info Change-Id: I2d1e5b302cd15355e4869faf59802a77c5cf0ca5 --- include/tdm.h | 11 +++++++++++ include/tdm_backend.h | 8 ++++++++ src/tdm_hwc.c | 31 +++++++++++++++++++++++++++++++ 3 files changed, 50 insertions(+) diff --git a/include/tdm.h b/include/tdm.h index 92718f7..0772b7f 100644 --- a/include/tdm.h +++ b/include/tdm.h @@ -978,6 +978,17 @@ tbm_surface_queue_h tdm_hwc_get_client_target_buffer_queue(tdm_hwc *hwc, tdm_error *error); /** + * @brief Set the information of the client target buffer + * @details This function lets the backend know information of the target. + * @param[in] hwc A output hwc + * @param[in] info The information + * @return #TDM_ERROR_NONE if success. Otherwise, error value. + * @since 3.1.0 + */ +tdm_error +tdm_hwc_set_client_target_buffer_info(tdm_hwc *hwc, tdm_hwc_window_info *info); + +/** * @brief Set the client(relative to the TDM) target buffer * @details This function lets the backend know the target buffer. * The target buffer contains the result of the gl composition with the diff --git a/include/tdm_backend.h b/include/tdm_backend.h index 078815c..e53eb10 100644 --- a/include/tdm_backend.h +++ b/include/tdm_backend.h @@ -1024,6 +1024,14 @@ typedef struct _tdm_func_hwc { * @return #TDM_ERROR_NONE if success. Otherwise, error value. */ tdm_error (*hwc_get_commit_interval)(tdm_hwc *hwc, tdm_hwc_commit_interval *interval); + + /** + * @brief Set the information of the client target buffer + * @param[in] hwc A output hwc + * @param[in] info The information + * @return #TDM_ERROR_NONE if success. Otherwise, error value. + */ + tdm_error (*hwc_set_client_target_buffer_info)(tdm_hwc *hwc, tdm_hwc_window_info *info); } tdm_func_hwc; /** diff --git a/src/tdm_hwc.c b/src/tdm_hwc.c index 11a7d5d..18fca9c 100644 --- a/src/tdm_hwc.c +++ b/src/tdm_hwc.c @@ -521,6 +521,37 @@ tdm_hwc_get_client_target_buffer_queue(tdm_hwc *hwc, tdm_error *error) } EXTERN tdm_error +tdm_hwc_set_client_target_buffer_info(tdm_hwc *hwc, tdm_hwc_window_info *info) +{ + tdm_private_module *private_module; + tdm_func_hwc *func_hwc = NULL; + + HWC_FUNC_ENTRY(); + + _pthread_mutex_lock(&private_display->lock); + + private_module = private_hwc->private_module; + func_hwc = &private_module->func_hwc; + + if (private_module->use_hal_tdm) { + ret = (tdm_error)hal_tdm_hwc_set_client_target_buffer_info((hal_tdm_hwc *)private_hwc->hwc_backend, (hal_tdm_hwc_window_info *)info); + } else { + if (!func_hwc->hwc_set_client_target_buffer_info) { + /* LCOV_EXCL_START */ + _pthread_mutex_unlock(&private_display->lock); + return TDM_ERROR_NOT_IMPLEMENTED; + /* LCOV_EXCL_STOP */ + } + + ret = func_hwc->hwc_set_client_target_buffer_info(private_hwc->hwc_backend, info); + } + + _pthread_mutex_unlock(&private_display->lock); + + return ret; +} + +EXTERN tdm_error tdm_hwc_set_client_target_buffer(tdm_hwc *hwc, tbm_surface_h target_buffer, tdm_region damage) { tdm_private_module *private_module; -- 2.7.4