e_hwc_windows: add root target hwc window to hwc of primary output 04/271304/1
authorChangyeon Lee <cyeon.lee@samsung.com>
Tue, 8 Feb 2022 07:23:59 +0000 (16:23 +0900)
committerChangyeon Lee <cyeon.lee@samsung.com>
Fri, 18 Feb 2022 02:15:16 +0000 (11:15 +0900)
this patch is for sharing buffer of gl compositing to all output.
root target hwc window fetch buffer of gl compositing and
target hwc window is fetch buffer from the root target hwc window.

Change-Id: Ic5041e55a5a94dc881cd652a6e693d1785eb2a1a

src/bin/e_hwc.c
src/bin/e_hwc.h
src/bin/e_hwc_windows.c

index edbbaa731c6b183765080be4ba2901135648c170..dd3b910ca1168fb3a954cc8d735765a73596d398 100644 (file)
@@ -597,6 +597,16 @@ e_hwc_new(E_Output *output, Eina_Bool primary_output)
              EHERR("e_hwc_windows_target_window_new failed", hwc);
              goto fail;
           }
+
+        if (primary_output)
+          {
+             hwc->root_target_hwc_window = e_hwc_windows_target_window_new(hwc);
+             if (!hwc->root_target_hwc_window)
+               {
+                  EHERR("e_hwc_windows_target_window_new failed", hwc);
+                  goto fail;
+               }
+          }
      }
 
    /* default active hwc */
@@ -620,8 +630,17 @@ e_hwc_del(E_Hwc *hwc)
 
    if (e_hwc_policy_get(hwc) == E_HWC_POLICY_WINDOWS)
      {
-        e_hwc_windows_target_window_del(hwc->target_hwc_window);
-        hwc->target_hwc_window = NULL;
+        if (hwc->target_hwc_window)
+          {
+             e_hwc_windows_target_window_del(hwc->target_hwc_window);
+             hwc->target_hwc_window = NULL;
+          }
+
+        if (hwc->root_target_hwc_window)
+          {
+             e_hwc_windows_target_window_del(hwc->root_target_hwc_window);
+             hwc->root_target_hwc_window = NULL;
+          }
      }
 
    e_comp_wl_buffer_reference(&hwc->pp_buffer_ref, NULL);
index 267f23d6ed39918fc30f4ac07d38a044f770021b..f06e16271a806bf82e5613bd1b874555f3eb4497 100644 (file)
@@ -139,6 +139,7 @@ struct _E_Hwc
    Eina_List           *hwc_windows;
    E_Hwc_Window_Target *target_hwc_window;
    tbm_surface_queue_h  target_buffer_queue;
+   E_Hwc_Window_Target *root_target_hwc_window;
    Eina_Bool            wait_commit;
    Eina_List           *visible_windows;
    int                  num_visible_windows;
index 12726bbe4c730f89bacc3286d1d1bc373f687a5a..e12d24b8e91256bd002f4323df35cbccee4eb890 100644 (file)
@@ -462,6 +462,9 @@ _e_hwc_windows_commit_data_acquire(E_Hwc *hwc)
    /* return TRUE when the number of the commit data is more than one */
    EINA_LIST_FOREACH(hwc->hwc_windows, l, hwc_window)
      {
+        if ((E_Hwc_Window *)hwc->root_target_hwc_window == hwc_window)
+          continue;
+
         commit_data = e_hwc_window_commit_data_acquire(hwc_window);
         if (!commit_data)
           {
@@ -579,13 +582,34 @@ _e_hwc_windows_target_window_rendered_windows_get(tbm_surface_h target_tsurface)
 EINTERN void
 e_hwc_windows_target_window_force_render(E_Hwc_Window_Target *target_hwc_window)
 {
+   E_Hwc_Window_Target *root_target_hwc_window;
+   E_Output *primary_output;
+   E_Hwc *hwc;
    int w, h;
 
-   if (!target_hwc_window->ee) return;
-   if (!target_hwc_window->evas) return;
+   hwc = target_hwc_window->hwc;
+   EINA_SAFETY_ON_NULL_RETURN(hwc);
 
-   ecore_evas_geometry_get(target_hwc_window->ee, 0, 0, &w, &h);
-   evas_damage_rectangle_add(target_hwc_window->evas, 0, 0, w,  h);
+   if (hwc->primary_output)
+     {
+        root_target_hwc_window = hwc->root_target_hwc_window;
+        EINA_SAFETY_ON_NULL_RETURN(root_target_hwc_window);
+     }
+   else
+     {
+        primary_output = e_comp_screen_primary_output_get(e_comp->e_comp_screen);
+        EINA_SAFETY_ON_NULL_RETURN(primary_output);
+        EINA_SAFETY_ON_NULL_RETURN(primary_output->hwc);
+
+        root_target_hwc_window = primary_output->hwc->root_target_hwc_window;
+        EINA_SAFETY_ON_NULL_RETURN(root_target_hwc_window);
+     }
+
+   if (!root_target_hwc_window->ee) return;
+   if (!root_target_hwc_window->evas) return;
+
+   ecore_evas_geometry_get(root_target_hwc_window->ee, 0, 0, &w, &h);
+   evas_damage_rectangle_add(root_target_hwc_window->evas, 0, 0, w,  h);
 }
 
 static Eina_Bool
@@ -610,39 +634,41 @@ _e_hwc_windows_target_window_buffer_skip(E_Hwc *hwc)
    if ((hwc_window->current.buffer.tsurface) &&
        (hwc_window->current.buffer.tsurface != hwc_window->display.buffer.tsurface))
      {
+        e_hwc_window_queue_buffer_reference(&hwc_window->current.queue_buffer_ref, hwc_window->display.queue_buffer_ref.buffer);
+        e_hwc_window_buffer_set(&hwc_window->current.buffer, hwc_window->display.buffer.tsurface,
+                                hwc_window->display.buffer.queue, hwc_window->display.buffer.transform);
+        tdm_hwc_set_client_target_buffer(thwc, hwc_window->display.buffer.tsurface, fb_damage);
+
+        e_hwc_windows_target_window_force_render(target_hwc_window);
+     }
+
+   if (hwc->root_target_hwc_window)
+     {
+        hwc_window = (E_Hwc_Window *)hwc->root_target_hwc_window;
+
         comp_info = _e_hwc_windows_comp_info_get(hwc_window->current.buffer.tsurface);
         if (comp_info)
           {
-             e_hwc_window_presentation_time_feedback_take(hwc_window,
+             e_hwc_window_presentation_time_feedback_take((E_Hwc_Window *)target_hwc_window,
                                                           &comp_info->presentation_container);
-             e_hwc_window_presentation_callback_take(hwc_window,
+             e_hwc_window_presentation_callback_take((E_Hwc_Window *)target_hwc_window,
                                                      &comp_info->presentation_callbacks);
           }
 
         e_hwc_window_queue_buffer_reference(&hwc_window->current.queue_buffer_ref, hwc_window->display.queue_buffer_ref.buffer);
         e_hwc_window_buffer_set(&hwc_window->current.buffer, hwc_window->display.buffer.tsurface,
                                 hwc_window->display.buffer.queue, hwc_window->display.buffer.transform);
-        tdm_hwc_set_client_target_buffer(thwc, hwc_window->display.buffer.tsurface, fb_damage);
-
-        e_hwc_windows_target_window_force_render(target_hwc_window);
      }
 
    return EINA_TRUE;
 }
 
-/* set the tsurface to the target_window->tsurface according to the state.
- *  1. try to set the tsurface to the target_window at E_HWC_WINDOW_STATE_DEVICE.
- *  2. try to set NULL and release(clear) tsurface_queue of the target_window at E_HWC_WINDOW_STATE_NONE.
- *  Returing EINA_FALSE means that there is no update for the target_window->tsurface.
- **/
 static Eina_Bool
-_e_hwc_windows_target_buffer_fetch(E_Hwc *hwc)
+_e_hwc_windows_root_target_buffer_fetch(E_Hwc *hwc)
 {
    E_Hwc_Window_Target *target_hwc_window;
    E_Hwc_Window *hwc_window, *hw;
-   tdm_hwc *thwc;
    tbm_surface_h tsurface;
-   tdm_region fb_damage;
    Eina_List *rendered_windows = NULL;
    E_Hwc_Window_Queue_Buffer *queue_buffer = NULL;
    E_Hwc_Windows_Comp_Info *comp_info;
@@ -651,29 +677,24 @@ _e_hwc_windows_target_buffer_fetch(E_Hwc *hwc)
    const Eina_List *l;
    int i;
 
-   target_hwc_window = hwc->target_hwc_window;
+   EINA_SAFETY_ON_NULL_RETURN_VAL(hwc, EINA_FALSE);
+
+   target_hwc_window = hwc->root_target_hwc_window;
    EINA_SAFETY_ON_NULL_RETURN_VAL(target_hwc_window, EINA_FALSE);
 
    hwc_window = (E_Hwc_Window *)target_hwc_window;
 
-   thwc = hwc->thwc;
-   EINA_SAFETY_ON_NULL_RETURN_VAL(thwc, EINA_FALSE);
-
    if (!hwc_window->queue)
      {
         if (!_e_hwc_windows_target_window_queue_set(target_hwc_window))
           {
-             EHWSERR("fail to _e_hwc_windows_target_window_queue_set", hwc);
+             EHWSERR("fail to _e_hwc_windows_target_window_queue_set", NULL);
              return EINA_FALSE;
           }
      }
 
-   EINA_SAFETY_ON_NULL_RETURN_VAL(hwc_window->queue , EINA_FALSE);
-
-   if ((hwc->pp_set) && (target_hwc_window->pp_queue))
-     queue = target_hwc_window->pp_queue;
-   else
-     queue = hwc_window->queue;
+   queue = hwc_window->queue;
+   EINA_SAFETY_ON_NULL_RETURN_VAL(queue, EINA_FALSE);
 
    if (hwc_window->state == E_HWC_WINDOW_STATE_DEVICE)
      {
@@ -687,9 +708,9 @@ _e_hwc_windows_target_buffer_fetch(E_Hwc *hwc)
         comp_info = _e_hwc_windows_comp_info_get(tsurface);
         if ((comp_info) && (comp_info->skip))
           {
-             e_hwc_window_presentation_time_feedback_take(hwc_window,
+             e_hwc_window_presentation_time_feedback_take((E_Hwc_Window *)hwc->target_hwc_window,
                                                           &comp_info->presentation_container);
-             e_hwc_window_presentation_callback_take(hwc_window,
+             e_hwc_window_presentation_callback_take((E_Hwc_Window *)hwc->target_hwc_window,
                                                      &comp_info->presentation_callbacks);
              e_hwc_window_queue_buffer_release(queue, queue_buffer);
              return EINA_FALSE;
@@ -699,20 +720,6 @@ _e_hwc_windows_target_buffer_fetch(E_Hwc *hwc)
         e_hwc_window_buffer_set(&hwc_window->current.buffer, tsurface, queue, 0);
         e_hwc_window_info_update(hwc_window);
 
-        /* the damage isn't supported by hwc extension yet */
-        CLEAR(fb_damage);
-
-        tdm_hwc_set_client_target_buffer(thwc, hwc_window->current.buffer.tsurface, fb_damage);
-        if ((target_hwc_window->end_render_sync) && (e_hwc_windows_fence_enabled_get(hwc)))
-          {
-             int fence = e_egl_sync_fence_fd_dup(target_hwc_window->end_render_sync);
-             if (fence >= 0)
-               {
-                  tdm_hwc_set_client_target_acquire_fence(thwc, fence);
-                  close(fence);
-               }
-          }
-
         if (ehws_trace)
           {
              rendered_windows = _e_hwc_windows_target_window_rendered_windows_get(hwc_window->current.buffer.tsurface);
@@ -720,7 +727,7 @@ _e_hwc_windows_target_buffer_fetch(E_Hwc *hwc)
              if (n_thw)
                {
                   EHWSTRACE("FET {%s} ts:%p state:%s has hwc_windows to render below.",
-                           NULL, hwc, "@TARGET WINDOW@", hwc_window->current.buffer.tsurface,
+                           NULL, hwc, "@ROOT TARGET WINDOW@", hwc_window->current.buffer.tsurface,
                            e_hwc_window_state_string_get(hwc_window->state));
 
                   i = 0;
@@ -734,7 +741,7 @@ _e_hwc_windows_target_buffer_fetch(E_Hwc *hwc)
                 }
               else
                 EHWSTRACE("FET {%s} ts:%p state:%s has no hwc_windows to render.",
-                         NULL, hwc, "@TARGET WINDOW@", hwc_window->current.buffer.tsurface,
+                         NULL, hwc, "@ROOT TARGET WINDOW@", hwc_window->current.buffer.tsurface,
                          e_hwc_window_state_string_get(hwc_window->state));
           }
      }
@@ -754,9 +761,9 @@ _e_hwc_windows_target_buffer_fetch(E_Hwc *hwc)
                   comp_info = _e_hwc_windows_comp_info_get(hwc_window->current.buffer.tsurface);
                   if (comp_info)
                     {
-                       e_hwc_window_presentation_time_feedback_take(hwc_window,
+                       e_hwc_window_presentation_time_feedback_take((E_Hwc_Window *)hwc->target_hwc_window,
                                                                    &comp_info->presentation_container);
-                       e_hwc_window_presentation_callback_take(hwc_window,
+                       e_hwc_window_presentation_callback_take((E_Hwc_Window *)hwc->target_hwc_window,
                                                                &comp_info->presentation_callbacks);
                     }
                }
@@ -766,12 +773,103 @@ _e_hwc_windows_target_buffer_fetch(E_Hwc *hwc)
         e_hwc_window_buffer_set(&hwc_window->current.buffer, NULL, NULL, 0);
         e_hwc_window_info_update(hwc_window);
 
+        EHWSTRACE("FET {%s} ts:%p state:%s",
+                  NULL, hwc, "@ROOT TARGET WINDOW@", hwc_window->current.buffer.tsurface,
+                  e_hwc_window_state_string_get(hwc_window->state));
+     }
+
+   return EINA_TRUE;
+}
+
+static Eina_Bool
+_e_hwc_windows_target_buffer_fetch(E_Hwc *hwc)
+{
+   E_Hwc_Window_Target *target_hwc_window;
+   E_Hwc_Window *hwc_window, *root_hwc_window;
+   E_Hwc_Window_Queue_Buffer *queue_buffer;
+   E_Output *primary_output;
+   tdm_region fb_damage;
+   tbm_surface_h tsurface;
+   tdm_hwc *thwc;
+
+   thwc = hwc->thwc;
+   EINA_SAFETY_ON_NULL_RETURN_VAL(thwc, EINA_FALSE);
+
+   target_hwc_window = hwc->target_hwc_window;
+   EINA_SAFETY_ON_NULL_RETURN_VAL(target_hwc_window, EINA_FALSE);
+
+   hwc_window = (E_Hwc_Window *)target_hwc_window;
+
+   if (hwc->primary_output)
+     {
+        root_hwc_window = (E_Hwc_Window *)hwc->root_target_hwc_window;
+        EINA_SAFETY_ON_NULL_RETURN_VAL(root_hwc_window, EINA_FALSE);
+     }
+   else
+     {
+        primary_output = e_comp_screen_primary_output_get(e_comp->e_comp_screen);
+        EINA_SAFETY_ON_NULL_RETURN_VAL(primary_output, EINA_FALSE);
+        EINA_SAFETY_ON_NULL_RETURN_VAL(primary_output->hwc, EINA_FALSE);
+
+        root_hwc_window = (E_Hwc_Window *)primary_output->hwc->root_target_hwc_window;
+        EINA_SAFETY_ON_NULL_RETURN_VAL(root_hwc_window, EINA_FALSE);
+     }
+
+   if (hwc_window->state == E_HWC_WINDOW_STATE_DEVICE)
+     {
+        if ((hwc->pp_set) && (target_hwc_window->pp_queue))
+          queue_buffer = e_hwc_window_queue_buffer_acquire(target_hwc_window->pp_queue);
+        else
+          queue_buffer = root_hwc_window->current.queue_buffer_ref.buffer;
+
+        if (!queue_buffer) return EINA_FALSE;
+
+        tsurface = queue_buffer->tsurface;
+        EINA_SAFETY_ON_NULL_RETURN_VAL(tsurface, EINA_FALSE);
+
+        if (tsurface == hwc_window->current.buffer.tsurface) return EINA_FALSE;
+
+        e_hwc_window_queue_buffer_reference(&hwc_window->current.queue_buffer_ref, queue_buffer);
+        e_hwc_window_buffer_set(&hwc_window->current.buffer, tsurface, NULL, 0);
+        e_hwc_window_info_update(hwc_window);
+
+        /* the damage isn't supported by hwc extension yet */
+        CLEAR(fb_damage);
+
+        tdm_hwc_set_client_target_buffer(thwc, hwc_window->current.buffer.tsurface, fb_damage);
+        if ((target_hwc_window->end_render_sync) && (e_hwc_windows_fence_enabled_get(hwc)))
+          {
+             int fence = e_egl_sync_fence_fd_dup(target_hwc_window->end_render_sync);
+             if (fence >= 0)
+               {
+                  tdm_hwc_set_client_target_acquire_fence(thwc, fence);
+                  close(fence);
+               }
+          }
+
+        EHWSTRACE("FET {%s} ts:%p state:%s",
+                  NULL, hwc, "@TARGET WINDOW@",
+                  hwc_window->current.buffer.tsurface, e_hwc_window_state_string_get(hwc_window->state));
+
+     }
+   else
+     {
+        if (!hwc_window->current.buffer.tsurface) return EINA_FALSE;
+
+        e_hwc_window_queue_buffer_reference(&hwc_window->current.queue_buffer_ref, NULL);
+        e_hwc_window_buffer_set(&hwc_window->current.buffer, NULL, NULL, 0);
+        e_hwc_window_info_update(hwc_window);
+
         CLEAR(fb_damage);
 
         tdm_hwc_set_client_target_buffer(thwc, NULL, fb_damage);
 
         if (e_hwc_windows_fence_enabled_get(hwc))
           tdm_hwc_set_client_target_acquire_fence(thwc, -1);
+
+        EHWSTRACE("FET {%s} ts:%p state:%s",
+                  NULL, hwc, "@TARGET WINDOW@",
+                  hwc_window->current.buffer.tsurface, e_hwc_window_state_string_get(hwc_window->state));
      }
 
    return EINA_TRUE;
@@ -1568,19 +1666,18 @@ _e_hwc_windows_target_window_render_flush_post_cb(void *data, Evas *e EINA_UNUSE
 
    fence_enabled = e_hwc_windows_fence_enabled_get(target_hwc_window->hwc);
 
-   EINA_LIST_FOREACH(target_hwc_window->hwc->hwc_windows, l, hwc_window)
+   EINA_LIST_FOREACH(target_hwc_window->rendered_windows, l, hwc_window)
      {
         E_Client *ec = NULL;
         E_Comp_Wl_Client_Data *cdata;
 
-        if (hwc_window->render_target)
-          e_hwc_presentation_callback_list_merge(&comp_info->presentation_callbacks,
-                                                 &hwc_window->pending_presentation_callbacks);
-
         if (!hwc_window->on_rendered_target) continue;
 
         hwc_window->on_rendered_target = EINA_FALSE;
 
+        e_hwc_presentation_callback_list_merge(&comp_info->presentation_callbacks,
+                                               &hwc_window->pending_presentation_callbacks);
+
         ec = hwc_window->ec;
         if (!ec) continue;
 
@@ -1638,20 +1735,26 @@ _e_hwc_windows_target_window_free(E_Hwc_Window_Target *target_hwc_window)
 {
    E_Hwc_Window *target_window = (E_Hwc_Window *)target_hwc_window;
 
-   evas_event_callback_del(target_hwc_window->evas,
-                           EVAS_CALLBACK_RENDER_FLUSH_POST,
-                           _e_hwc_windows_target_window_render_flush_post_cb);
+   if (target_hwc_window->evas)
+     {
+        evas_event_callback_del(target_hwc_window->evas,
+                                EVAS_CALLBACK_RENDER_FLUSH_POST,
+                                _e_hwc_windows_target_window_render_flush_post_cb);
 
-   evas_event_callback_del(target_hwc_window->evas,
-                           EVAS_CALLBACK_RENDER_FLUSH_PRE,
-                           _e_hwc_windows_target_window_render_flush_pre_cb);
+        evas_event_callback_del(target_hwc_window->evas,
+                                EVAS_CALLBACK_RENDER_FLUSH_PRE,
+                                _e_hwc_windows_target_window_render_flush_pre_cb);
 
-   evas_event_callback_del(target_hwc_window->evas,
-                           EVAS_CALLBACK_RENDER_PRE,
-                           _e_hwc_windows_target_window_render_pre_cb);
+        evas_event_callback_del(target_hwc_window->evas,
+                                EVAS_CALLBACK_RENDER_PRE,
+                                _e_hwc_windows_target_window_render_pre_cb);
+     }
+
+   if (target_hwc_window->event_hdlr)
+     ecore_main_fd_handler_del(target_hwc_window->event_hdlr);
 
-   ecore_main_fd_handler_del(target_hwc_window->event_hdlr);
-   close(target_hwc_window->event_fd);
+   if (target_hwc_window->event_fd >= 0)
+     close(target_hwc_window->event_fd);
 
    if (target_window->queue && target_window->queue->tqueue)
      tbm_surface_queue_destroy(target_window->queue->tqueue);
@@ -2059,18 +2162,34 @@ static Eina_Bool
 _e_hwc_windows_transition_check(E_Hwc *hwc)
 {
    E_Hwc_Window *hwc_window = NULL;
-   E_Hwc_Window_Target *target_hwc_window = NULL;
+   E_Hwc_Window_Target *target_hwc_window = NULL, *root_target_hwc_window;
    Eina_Bool transition = EINA_FALSE;
    const Eina_List *l;
    Eina_Bool display_state_changed = EINA_FALSE;
    Eina_Bool target_window_changed = EINA_FALSE;
    Eina_Bool client_to_none_transition = EINA_FALSE;
    E_Hwc_Window_Queue_Type queue_type;
+   E_Output *primary_output;
 
    target_hwc_window = hwc->target_hwc_window;
    EINA_SAFETY_ON_NULL_RETURN_VAL(target_hwc_window, EINA_FALSE);
 
-   queue_type = e_hwc_window_queue_type_get(((E_Hwc_Window *)target_hwc_window)->queue);
+   if (hwc->primary_output)
+     {
+        root_target_hwc_window = hwc->root_target_hwc_window;
+        EINA_SAFETY_ON_NULL_RETURN_VAL(root_target_hwc_window, EINA_FALSE);
+     }
+   else
+     {
+        primary_output = e_comp_screen_primary_output_get(e_comp->e_comp_screen);
+        EINA_SAFETY_ON_NULL_RETURN_VAL(primary_output, EINA_FALSE);
+        EINA_SAFETY_ON_NULL_RETURN_VAL(primary_output->hwc, EINA_FALSE);
+
+        root_target_hwc_window = primary_output->hwc->root_target_hwc_window;
+        EINA_SAFETY_ON_NULL_RETURN_VAL(root_target_hwc_window, EINA_FALSE);
+     }
+
+   queue_type = e_hwc_window_queue_type_get(((E_Hwc_Window *)root_target_hwc_window)->queue);
    if (queue_type == E_HWC_WINDOW_QUEUE_TYPE_GBM_SURFACE) return EINA_FALSE;
 
    EINA_LIST_FOREACH(hwc->hwc_windows, l, hwc_window)
@@ -2665,6 +2784,9 @@ _e_hwc_windows_changes_update(E_Hwc *hwc)
           update_changes = EINA_TRUE;
      }
 
+   if (hwc->primary_output)
+     _e_hwc_windows_root_target_buffer_fetch(hwc);
+
    /* fetch the target buffer (try acquire) */
    if (_e_hwc_windows_target_buffer_fetch(hwc))
      update_changes = EINA_TRUE;
@@ -3274,7 +3396,7 @@ e_hwc_windows_render(E_Hwc *hwc)
 
    EINA_SAFETY_ON_NULL_RETURN_VAL(hwc, EINA_FALSE);
 
-   target_hwc_window = hwc->target_hwc_window;
+   target_hwc_window = hwc->root_target_hwc_window;
    EINA_SAFETY_ON_NULL_RETURN_VAL(target_hwc_window, EINA_FALSE);
 
    target_window = (E_Hwc_Window *)target_hwc_window;
@@ -3328,7 +3450,7 @@ _e_hwc_windows_release_fence_fd_update(E_Hwc *hwc)
    EINA_SAFETY_ON_NULL_RETURN(target_hwc_window);
 
    hwc_window = (E_Hwc_Window *)target_hwc_window;
-   if ((hwc_window->display.buffer.tsurface) && (hwc_window->display.buffer.queue) &&
+   if ((hwc_window->display.buffer.tsurface) &&
        (hwc_window->display.buffer.tsurface != hwc_window->commit.buffer.tsurface))
      {
         comp_info = _e_hwc_windows_comp_info_get(hwc_window->display.buffer.tsurface);
@@ -3877,24 +3999,30 @@ EINTERN void
 e_hwc_windows_rendered_window_add(E_Hwc_Window *hwc_window)
 {
    E_Hwc *hwc;
-   E_Hwc_Window_Target *target_hwc_window;
+   E_Hwc_Window_Target *root_target_hwc_window;
    E_Client *ec;
+   E_Output *primary_output;
 
    EINA_SAFETY_ON_NULL_RETURN(hwc_window);
+   EINA_SAFETY_ON_NULL_RETURN(e_comp);
+   EINA_SAFETY_ON_NULL_RETURN(e_comp->e_comp_screen);
 
    if (hwc_window->on_rendered_target) return;
 
    ec = hwc_window->ec;
    EINA_SAFETY_ON_NULL_RETURN(ec);
 
-   hwc = hwc_window->hwc;
+   primary_output = e_comp_screen_primary_output_get(e_comp->e_comp_screen);
+   EINA_SAFETY_ON_NULL_RETURN(primary_output);
+
+   hwc = primary_output->hwc;
    EINA_SAFETY_ON_NULL_RETURN(hwc);
 
-   target_hwc_window = hwc->target_hwc_window;
-   EINA_SAFETY_ON_NULL_RETURN(target_hwc_window);
+   root_target_hwc_window = hwc->root_target_hwc_window;
+   EINA_SAFETY_ON_NULL_RETURN(root_target_hwc_window);
 
-   target_hwc_window->rendered_windows =
-           eina_list_append(target_hwc_window->rendered_windows, hwc_window);
+   root_target_hwc_window->rendered_windows =
+           eina_list_append(root_target_hwc_window->rendered_windows, hwc_window);
 
    hwc_window->on_rendered_target = EINA_TRUE;