From dc0f94dbd2d214c19b3811ed424647906be77f75 Mon Sep 17 00:00:00 2001 From: Changyeon Lee Date: Tue, 24 Jul 2018 19:32:24 +0900 Subject: [PATCH] hwc_window: added tdm_hwc_window_free_buffer_queue Change-Id: I99775be1df445fe64039ba9f5c098b7e50fd005f --- include/tdm.h | 10 ++++++++++ include/tdm_backend.h | 9 +++++++++ src/tdm_hwc_window.c | 38 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 57 insertions(+) diff --git a/include/tdm.h b/include/tdm.h index fae9308..0ec6055 100644 --- a/include/tdm.h +++ b/include/tdm.h @@ -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 diff --git a/include/tdm_backend.h b/include/tdm_backend.h index 0b5829c..52d9056 100644 --- a/include/tdm_backend.h +++ b/include/tdm_backend.h @@ -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 diff --git a/src/tdm_hwc_window.c b/src/tdm_hwc_window.c index 31e62ad..44e87bc 100644 --- a/src/tdm_hwc_window.c +++ b/src/tdm_hwc_window.c @@ -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) -- 2.7.4