hwc: add tdm_hwc_unset_buffer 83/169883/3
authorSooChan Lim <sc1.lim@samsung.com>
Mon, 12 Feb 2018 01:29:35 +0000 (10:29 +0900)
committerSooChan Lim <sc1.lim@samsung.com>
Mon, 12 Feb 2018 06:26:50 +0000 (06:26 +0000)
Change-Id: Ia00e4ea2e07217fa7c6b42cf9a4ab0aefa4053e7

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

index d6bc82a..7be0a14 100644 (file)
@@ -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
index 297c74a..a3bd3b3 100644 (file)
@@ -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
index 73f92c0..96d2698 100644 (file)
@@ -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)