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 fae93080788062d67972f23a729937ca83a17517..0ec605545eb54be7458acdfb57955a5661e4aff4 100644 (file)
@@ -1003,6 +1003,16 @@ tdm_hwc_window_destroy(tdm_hwc_window *hwc_window);
 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
index 0b5829c64537c03c9702b85cbb9b48c4bddc4359..52d905669c1f77fa7727b8f352fd71e7e429326d 100644 (file)
@@ -871,6 +871,15 @@ typedef struct _tdm_func_hwc_window {
        tbm_surface_queue_h (*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
+        */
+       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
index 31e62ad65c3258fa63daeced398d6c86d246780f..44e87bc0300adf501857e47b9eca522753fb8688 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)