From 8909a95085772f73dd6bbf6bfef6eb277843a6ca Mon Sep 17 00:00:00 2001 From: Changyeon Lee Date: Tue, 27 Oct 2020 14:53:53 +0900 Subject: [PATCH] tdm_hwc: add tdm_hwc_get_commit_interval interface Change-Id: Iacc89ddf45f5f7bea9b50f1292b7186c035a0a41 --- include/tdm.h | 9 +++++++++ include/tdm_backend.h | 8 ++++++++ include/tdm_types.h | 8 ++++++++ src/tdm_hwc.c | 27 +++++++++++++++++++++++++++ 4 files changed, 52 insertions(+) diff --git a/include/tdm.h b/include/tdm.h index 4a9d60d..92718f7 100644 --- a/include/tdm.h +++ b/include/tdm.h @@ -1094,6 +1094,15 @@ tdm_hwc_get_release_fences(tdm_hwc *hwc, uint32_t *num_elements, tdm_hwc_window **hwc_windows, int *fences); /** + * @brief Get the commit interval + * @param[in] hwc A hwc object + * @param[out] interval commit interval of backend + * @return #TDM_ERROR_NONE if success. Otherwise, error value. + */ +tdm_error +tdm_hwc_get_commit_interval(tdm_hwc *hwc, tdm_hwc_commit_interval *interval); + +/** * @brief Set the property which has a given id on the hwc object. * @param[in] hwc A hwc object * @param[in] id The property id diff --git a/include/tdm_backend.h b/include/tdm_backend.h index f1f8084..5fe3f34 100644 --- a/include/tdm_backend.h +++ b/include/tdm_backend.h @@ -1016,6 +1016,14 @@ typedef struct _tdm_func_hwc { * @return #TDM_ERROR_NONE if success. Otherwise, error value. */ tdm_error (*hwc_get_property)(tdm_hwc *hwc, uint32_t id, tdm_value *value); + + /** + * @brief Get the commit interval + * @param[in] hwc A hwc object + * @param[out] interval commit interval of backend + * @return #TDM_ERROR_NONE if success. Otherwise, error value. + */ + tdm_error (*hwc_get_commit_interval)(tdm_hwc *hwc, tdm_hwc_commit_interval *interval); } tdm_func_hwc; /** diff --git a/include/tdm_types.h b/include/tdm_types.h index d9ab984..4846002 100644 --- a/include/tdm_types.h +++ b/include/tdm_types.h @@ -222,6 +222,14 @@ typedef enum { TDM_HWC_WIN_CONSTRAINT_BUFFER_QUEUE = (1 << 0), } tdm_hwc_window_constraint; +typedef enum { + TDM_HWC_COMMIT_INTERVAL_NONE = 0, + /** If this interval is set by tdm backend, the compositor call commit per vblank + * even if the handler of commit isn't called. + */ + TDM_HWC_COMMIT_INTERVAL_VBLANK = 1, +} tdm_hwc_commit_interval; + /** * @brief The tdm display object */ diff --git a/src/tdm_hwc.c b/src/tdm_hwc.c index ccf85ce..76865e0 100644 --- a/src/tdm_hwc.c +++ b/src/tdm_hwc.c @@ -964,3 +964,30 @@ tdm_hwc_get_property(tdm_hwc *hwc, uint32_t id, tdm_value *value) return ret; } + +tdm_error +tdm_hwc_get_commit_interval(tdm_hwc *hwc, tdm_hwc_commit_interval *refresh) +{ + 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; + + /* LCOV_EXCL_START */ + if (!func_hwc->hwc_get_commit_interval) { + _pthread_mutex_unlock(&private_display->lock); + return TDM_ERROR_NOT_IMPLEMENTED; + } + + ret = func_hwc->hwc_get_commit_interval(private_hwc->hwc_backend, refresh); + /* LCOV_EXCL_STOP */ + + _pthread_mutex_unlock(&private_display->lock); + + return ret; +} -- 2.7.4