hwc_window: added tdm_hwc_window_free_buffer_queue 38/186438/1
authorChangyeon Lee <cyeon.lee@samsung.com>
Tue, 24 Jul 2018 10:32:24 +0000 (19:32 +0900)
committerChangyeon Lee <cyeon.lee@samsung.com>
Thu, 9 Aug 2018 12:22:26 +0000 (21:22 +0900)
Change-Id: I99775be1df445fe64039ba9f5c098b7e50fd005f

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

index fae9308..0ec6055 100644 (file)
@@ -1004,6 +1004,16 @@ tbm_surface_queue_h
 tdm_hwc_window_get_buffer_queue(tdm_hwc_window *hwc_window, tdm_error *error);
 
 /**
+ * @brief Free a buffer queue for the window object
+ * @details Free buffer queue when the client no longer uses buferrs of queue.
+ * @param[in] hwc_window A window object
+ * @param[in] A tbm buffer queue
+ * @since 2.0.0
+ */
+void
+tdm_hwc_window_free_buffer_queue(tdm_hwc_window *hwc_window, tbm_surface_queue_h queue);
+
+/**
  * @brief Sets the desired composition type of the given window.
  * @details During tdm_hwc_validate(), the device may request changes to
  * the composition types of any of the layers as described in the definition
index 0b5829c..52d9056 100644 (file)
@@ -872,6 +872,15 @@ typedef struct _tdm_func_hwc_window {
                                                                                                           tdm_error *error);
 
        /**
+        * @brief Free a buffer queue for the window object
+        * @details Free buffer queue when the client no longer uses buferrs of queue.
+        * @param[in] hwc_window A window object
+        * @param[in] A tbm buffer queue
+        */
+       void (*hwc_window_free_buffer_queue)(tdm_hwc_window *hwc_window,
+                                                                                tbm_surface_queue_h queue);
+
+       /**
         * @brief Sets the desired composition type of the given window.
         * @details During hwc_validate(), the device may request changes to
         * the composition types of any of the layers as described in the definition
index 31e62ad..44e87bc 100644 (file)
@@ -214,6 +214,44 @@ tdm_hwc_window_get_buffer_queue(tdm_hwc_window *hwc_window, tdm_error *error)
        return queue;
 }
 
+EXTERN void
+tdm_hwc_window_free_buffer_queue(tdm_hwc_window *hwc_window, tbm_surface_queue_h queue)
+{
+       tdm_private_module *private_module;
+       tdm_func_hwc_window *func_hwc_window = NULL;
+       tdm_private_display *private_display;
+       tdm_private_output *private_output;
+       tdm_private_hwc *private_hwc;
+       tdm_private_hwc_window *private_hwc_window;
+
+       if (!hwc_window)
+               return;
+
+       private_hwc_window = (tdm_private_hwc_window *)hwc_window;
+       private_hwc = private_hwc_window->private_hwc;
+       private_output = private_hwc->private_output;
+       private_display = private_output->private_display;
+
+       TDM_RETURN_IF_FAIL(queue != NULL);
+
+       _pthread_mutex_lock(&private_display->lock);
+
+       private_module = private_output->private_module;
+       func_hwc_window = &private_module->func_hwc_window;
+
+       if (!func_hwc_window->hwc_window_free_buffer_queue) {
+               _pthread_mutex_unlock(&private_display->lock);
+               TDM_WRN("not implemented!!");
+               return;
+       }
+
+       func_hwc_window->hwc_window_free_buffer_queue(private_hwc_window->hwc_window_backend, queue);
+
+       _pthread_mutex_unlock(&private_display->lock);
+
+       return;
+}
+
 EXTERN tdm_error
 tdm_hwc_window_set_composition_type(tdm_hwc_window *hwc_window,
                                                                        tdm_hwc_window_composition composition_type)