e_hwc_window_queue: fix the problem of releasing tbm_surface used by front buffer 15/310115/2
authorChangyeon Lee <cyeon.lee@samsung.com>
Mon, 22 Apr 2024 07:08:29 +0000 (16:08 +0900)
committerChangyeon Lee <cyeon.lee@samsung.com>
Tue, 23 Apr 2024 02:00:37 +0000 (11:00 +0900)
do not release tbm_surface untill client send request of deatch or destroy of buffer

Change-Id: Idc410856761370eb0b24cad39147687faf4c9e6c

src/bin/e_hwc_window_queue.c

index 2d8a30b..8091b2f 100644 (file)
@@ -1030,7 +1030,18 @@ _e_hwc_window_queue_copy_thread_data_destroy(E_Hwc_Window_Queue_Copy_Thread_Data
         queue_buffer->copying = EINA_FALSE;
 
         if ((!queue_buffer->acquired) && (queue_buffer->dequeued))
-          e_hwc_window_queue_buffer_release(copy_thread_data->queue, queue_buffer);
+          {
+             if ((copy_thread_data->queue->state == E_HWC_WINDOW_QUEUE_STATE_UNSET_WAITING) &&
+                 (queue_buffer->usable) && (queue_buffer->exported))
+               {
+                  EHWQINF("Wait detach ts:%p tq:%p", NULL, NULL, copy_thread_data->queue,
+                          queue_buffer->tsurface, copy_thread_data->queue->tqueue);
+               }
+             else
+               {
+                  e_hwc_window_queue_buffer_release(copy_thread_data->queue, queue_buffer);
+               }
+          }
      }
 
    e_object_unref(E_OBJECT(copy_thread_data->queue));
@@ -2398,7 +2409,21 @@ e_hwc_window_queue_buffer_reference(E_Hwc_Window_Queue_Buffer_Ref *ref, E_Hwc_Wi
         if (ref->buffer->busy == 0)
           {
              if (ref->buffer->queue)
-               e_hwc_window_queue_buffer_release(ref->buffer->queue, ref->buffer);
+               {
+                   if ((ref->buffer->queue->state == E_HWC_WINDOW_QUEUE_STATE_UNSET_WAITING) &&
+                       (ref->buffer->usable) && (ref->buffer->exported))
+                     {
+                        ref->buffer->acquired = EINA_FALSE;
+                        ref->buffer->dequeued = EINA_TRUE;
+
+                        EHWQINF("Wait detach ts:%p tq:%p", NULL, NULL, ref->buffer->queue,
+                                ref->buffer->tsurface, ref->buffer->queue->tqueue);
+                     }
+                   else
+                     {
+                        e_hwc_window_queue_buffer_release(ref->buffer->queue, ref->buffer);
+                     }
+               }
           }
 
         if (ref->destroy_listener.notify)