tdm_hwc: add tdm_hwc_get_commit_interval interface 44/246244/4
authorChangyeon Lee <cyeon.lee@samsung.com>
Tue, 27 Oct 2020 05:53:53 +0000 (14:53 +0900)
committerSooChan Lim <sc1.lim@samsung.com>
Wed, 28 Oct 2020 07:45:34 +0000 (07:45 +0000)
Change-Id: Iacc89ddf45f5f7bea9b50f1292b7186c035a0a41

include/tdm.h
include/tdm_backend.h
include/tdm_types.h
src/tdm_hwc.c

index 4a9d60d..92718f7 100644 (file)
@@ -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
index f1f8084..5fe3f34 100644 (file)
@@ -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;
 
 /**
index d9ab984..4846002 100644 (file)
@@ -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
  */
index ccf85ce..76865e0 100644 (file)
@@ -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;
+}