hwc: add tdm_hwc_set_property 04/200404/2
authorSooChan Lim <sc1.lim@samsung.com>
Sun, 24 Feb 2019 05:30:17 +0000 (14:30 +0900)
committerSooChan Lim <sc1.lim@samsung.com>
Sun, 24 Feb 2019 05:37:33 +0000 (14:37 +0900)
The user can set the property on the hwc object.

Change-Id: I3b918f99957e72135190af95722ece8ff38341b7

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

index 0a2bcab..53aa771 100644 (file)
@@ -1030,6 +1030,16 @@ tdm_error
 tdm_hwc_commit(tdm_hwc *hwc, int sync, tdm_hwc_commit_handler func, void *user_data);
 
 /**
+ * @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
+ * @param[in] value The value of the propery id
+ * @return #TDM_ERROR_NONE if success. Otherwise, error value.
+ */
+tdm_error
+tdm_hwc_set_property(tdm_hwc *hwc, uint32_t id, tdm_value value);
+
+/**
  * @brief Destroys the given window.
  * @param[in] window the pointer of the window to destroy
  * @since 2.0.0
index c515934..e89cd91 100644 (file)
@@ -928,6 +928,15 @@ typedef struct _tdm_func_hwc {
         * @return #TDM_ERROR_NONE if success. Otherwise, error value.
         */
        tdm_error (*hwc_set_commit_handler)(tdm_hwc *hwc, tdm_hwc_commit_handler func);
+
+       /**
+        * @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
+        * @param[in] value The value of the propery id
+        * @return #TDM_ERROR_NONE if success. Otherwise, error value.
+        */
+       tdm_error (*hwc_set_property)(tdm_hwc *hwc, uint32_t id, tdm_value value);
 } tdm_func_hwc;
 
 /**
index 2632c5b..b9029be 100644 (file)
@@ -605,4 +605,32 @@ commit_failed:
 
        return ret;
        /* LCOV_EXCL_STOP */
-}
\ No newline at end of file
+}
+
+tdm_error
+tdm_hwc_set_property(tdm_hwc *hwc, uint32_t id, tdm_value value)
+{
+       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 (!func_hwc->hwc_set_property) {
+               /* LCOV_EXCL_START */
+               _pthread_mutex_unlock(&private_display->lock);
+               TDM_WRN("not implemented!!");
+               return TDM_ERROR_NOT_IMPLEMENTED;
+               /* LCOV_EXCL_STOP */
+       }
+
+       ret = func_hwc->hwc_set_property(private_hwc->hwc_backend, id, value);
+
+       _pthread_mutex_unlock(&private_display->lock);
+
+       return ret;
+}