e_comp_wl_tbm: add e_comp_wl_tbm_client_queue_get 74/294474/1
authorChangyeon Lee <cyeon.lee@samsung.com>
Fri, 16 Jun 2023 08:35:53 +0000 (17:35 +0900)
committerTizen Window System <tizen.windowsystem@gmail.com>
Tue, 20 Jun 2023 03:19:01 +0000 (12:19 +0900)
Change-Id: Ida1b586dbda4d43d8732d893fd26ec95afc779e3

src/bin/e_comp_wl_tbm.c
src/bin/e_comp_wl_tbm.h
src/bin/e_hwc_window.c
src/bin/e_hwc_window.h
src/bin/e_hwc_window_queue.c
src/bin/e_hwc_windows.c
src/bin/e_pixmap.c
src/bin/services/e_service_launcher.c

index 2933b0d..032f096 100644 (file)
@@ -406,3 +406,22 @@ e_comp_wl_tbm_gbm_bo_user_data_set(tbm_surface_h tsurface, void *gbo)
 
    return EINA_TRUE;
 }
+
+EINTERN struct wayland_tbm_client_queue *
+e_comp_wl_tbm_client_queue_get(E_Client *ec)
+{
+   struct wayland_tbm_client_queue * cqueue;
+   E_Comp_Wl_Data *wl_cdata = (E_Comp_Wl_Data *)e_comp->wl_comp_data;
+   E_Comp_Wl_Client_Data *cdata;
+
+   EINA_SAFETY_ON_NULL_RETURN_VAL(wl_cdata, NULL);
+   EINA_SAFETY_ON_NULL_RETURN_VAL(ec, NULL);
+
+   cdata = e_pixmap_cdata_get(ec->pixmap);
+   if (!cdata) return NULL;
+   if (!cdata->wl_surface) return NULL;
+
+   cqueue = wayland_tbm_server_client_queue_get(wl_cdata->tbm.server, cdata->wl_surface);
+
+   return cqueue;
+}
index d1c5dca..0ba3820 100644 (file)
@@ -7,6 +7,7 @@ typedef struct _E_Comp_Wl_Tbm_Funcs E_Comp_Wl_Tbm_Funcs;
 #  define E_COMP_WL_TBM_H
 
 #include <tbm_surface.h>
+#include <wayland-tbm-server.h>
 
 struct _E_Comp_Wl_Tbm_Funcs
 {
@@ -38,5 +39,7 @@ EINTERN tbm_surface_h e_comp_wl_tbm_egl_image_buffer_get(int width, int height,
 
 EINTERN Eina_Bool e_comp_wl_tbm_gbm_bo_user_data_set(tbm_surface_h tsurface, void *gbo);
 
+EINTERN struct wayland_tbm_client_queue *e_comp_wl_tbm_client_queue_get(E_Client *ec);
+
 # endif
 #endif
index 319a1d5..db13f8d 100644 (file)
@@ -162,32 +162,6 @@ _e_hwc_window_comp_wl_buffer_get(E_Hwc_Window *hwc_window)
    return cdata->buffer_ref.buffer;
 }
 
-struct wayland_tbm_client_queue *
-e_hwc_window_wayland_tbm_client_queue_get(E_Hwc_Window *hwc_window)
-{
-   struct wayland_tbm_client_queue * cqueue;
-   struct wl_resource *wl_surface;
-   E_Comp_Wl_Data *wl_cdata = (E_Comp_Wl_Data *)e_comp->wl_comp_data;
-   E_Comp_Wl_Client_Data *cdata;
-   E_Client *ec;
-
-   EINA_SAFETY_ON_NULL_RETURN_VAL(wl_cdata, NULL);
-   EINA_SAFETY_ON_NULL_RETURN_VAL(hwc_window, NULL);
-
-   ec = hwc_window->ec;
-   if (!ec) return NULL;
-
-   cdata = e_pixmap_cdata_get(ec->pixmap);
-   EINA_SAFETY_ON_NULL_RETURN_VAL(cdata, NULL);
-
-   wl_surface = cdata->wl_surface;
-   EINA_SAFETY_ON_NULL_RETURN_VAL(wl_surface, NULL);
-
-   cqueue = wayland_tbm_server_client_queue_get(wl_cdata->tbm.server, wl_surface);
-
-   return cqueue;
-}
-
 static tdm_hwc_window_composition
 _get_composition_type(E_Hwc_Window_State state)
 {
@@ -1904,7 +1878,7 @@ e_hwc_window_activate(E_Hwc_Window *hwc_window, E_Hwc_Window_Queue *queue)
         queue_height = tbm_surface_queue_get_height(queue->tqueue);
      }
 
-   cqueue = e_hwc_window_wayland_tbm_client_queue_get(hwc_window);
+   cqueue = e_comp_wl_tbm_client_queue_get(hwc_window->ec);
    if (cqueue)
      {
         wayland_tbm_server_client_queue_activate(cqueue, 0, queue_size,
@@ -2345,7 +2319,7 @@ e_hwc_window_constraints_update(E_Hwc_Window *hwc_window)
      {
         if (constraints & TDM_HWC_WIN_CONSTRAINT_BUFFER_QUEUE)
           {
-             cqueue = e_hwc_window_wayland_tbm_client_queue_get(hwc_window);
+             cqueue = e_comp_wl_tbm_client_queue_get(hwc_window->ec);
              if (!cqueue) return EINA_FALSE;
 
              if (!_e_hwc_window_buffer_queue_set(hwc_window))
index eb7bb64..ab056aa 100644 (file)
@@ -269,7 +269,5 @@ EINTERN Eina_Bool                 e_hwc_window_presentation_callback_pending_tak
 EINTERN Eina_Bool                 e_hwc_window_presentation_callback_take(E_Hwc_Window *hwc_window, E_Hwc_Presentation_Callback_List *src_list);
 EINTERN Eina_Bool                 e_hwc_window_presentation_callback_call(E_Hwc_Window *hwc_window);
 
-struct wayland_tbm_client_queue  *e_hwc_window_wayland_tbm_client_queue_get(E_Hwc_Window *hwc_window);
-
 #endif // E_HWC_WINDOW_H
 #endif
index 1aeaa98..d936d49 100644 (file)
@@ -119,29 +119,6 @@ static Eina_List *hwc_window_queue_window_hooks = NULL;
 static Eina_List *hwc_window_queue_comp_wl_hooks = NULL;
 static E_Hwc_Window_Queue_Manager *_hwc_winq_mgr = NULL;
 
-struct wayland_tbm_client_queue *
-_user_cqueue_get(E_Client *ec)
-{
-   struct wayland_tbm_client_queue * cqueue;
-   struct wl_resource *wl_surface;
-   E_Comp_Wl_Data *wl_cdata = (E_Comp_Wl_Data *)e_comp->wl_comp_data;
-   E_Comp_Wl_Client_Data *cdata;
-
-   EINA_SAFETY_ON_NULL_RETURN_VAL(wl_cdata, NULL);
-
-   if (!ec) return NULL;
-
-   cdata = e_pixmap_cdata_get(ec->pixmap);
-   if (!cdata) return NULL;
-
-   wl_surface = cdata->wl_surface;
-   if (!wl_surface) return NULL;
-
-   cqueue = wayland_tbm_server_client_queue_get(wl_cdata->tbm.server, wl_surface);
-
-   return cqueue;
-}
-
 static uint32_t
 _comp_wl_buffer_flags_get(E_Comp_Wl_Buffer *buffer)
 {
@@ -926,7 +903,7 @@ _e_hwc_window_queue_prepare_set(E_Hwc_Window_Queue *queue, E_Hwc_Window *hwc_win
         return EINA_FALSE;
      }
 
-   cqueue = _user_cqueue_get(hwc_window->ec);
+   cqueue = e_comp_wl_tbm_client_queue_get(hwc_window->ec);
    if (!cqueue)
      {
         EHWQERR("fail to get wayland_tbm_client_queue", hwc_window->ec, queue->hwc, queue);
index 9446470..e314a16 100644 (file)
@@ -4155,7 +4155,7 @@ _e_hwc_windows_window_debug_info_get(Eldbus_Message_Iter *iter, E_Hwc_Wins_Debug
                       (hwc_window->current.buffer.transform < 4) ? hwc_window->current.buffer.transform * 90 : (hwc_window->current.buffer.transform - 4) * 90,
                       (uintptr_t)hwc_window->display.buffer.tsurface,
                       (uintptr_t)hwc_window->queue,
-                      (uintptr_t)e_hwc_window_wayland_tbm_client_queue_get(hwc_window),
+                      hwc_window->ec ? (uintptr_t)e_comp_wl_tbm_client_queue_get(hwc_window->ec) : 0,
                       vis_skip ? "TRUE" : "FALSE",
                       e_hwc_window_restriction_string_get(hwc_window));
              eldbus_message_iter_basic_append(line_array, 's', info_str);
index dad30ae..a4a70e1 100644 (file)
@@ -1014,8 +1014,7 @@ _e_pixmap_buffer_clear(E_Pixmap *cp, Eina_Bool only_free)
                {
                   struct wayland_tbm_client_queue * cqueue;
 
-                  cqueue = wayland_tbm_server_client_queue_get(e_comp_wl->tbm.server,
-                                                               cp->client->comp_data->wl_surface);
+                  cqueue = e_comp_wl_tbm_client_queue_get(cp->client);
                   if (!cqueue) return;
 
                   if (only_free)
index 4c64a84..ae263cb 100644 (file)
@@ -1231,18 +1231,14 @@ _launcher_cb_launching(struct wl_client *client EINA_UNUSED,
 static void
 _launcher_target_ec_queue_flush(E_Service_Launcher *lc)
 {
-   E_Comp_Wl_Client_Data *target_cdata = NULL;
    struct wayland_tbm_client_queue *cqueue;
 
    if (!e_comp_wl) return;
    if (!lc) return;
    if (!lc->target.ec) return;
-   target_cdata = e_client_cdata_get(lc->target.ec);
-   if (!target_cdata) return;
-   if (!target_cdata->wl_surface) return;
    if (e_object_is_del(E_OBJECT(lc->target.ec))) return;
 
-   cqueue = wayland_tbm_server_client_queue_get(e_comp_wl->tbm.server, target_cdata->wl_surface);
+   cqueue = e_comp_wl_tbm_client_queue_get(lc->target.ec);
    if (cqueue)
      wayland_tbm_server_client_queue_flush(cqueue);
 }