Add mapping_sub_surface member varable to remove user confusion
authorHyunil <hyunil46.park@samsung.com>
Thu, 29 Aug 2019 06:54:41 +0000 (15:54 +0900)
committerHyunil <hyunil46.park@samsung.com>
Thu, 29 Aug 2019 06:54:41 +0000 (15:54 +0900)
Change-Id: I43ca970f2368940a52094284135d2499bc589e77
Signed-off-by: Hyunil <hyunil46.park@samsung.com>
tizenwlsink/src/tizen-wlshmallocator.c
tizenwlsink/src/wldisplay.c
tizenwlsink/src/wldisplay.h
tizenwlsink/src/wlwindow.c

index 4813dd4..9a833e1 100644 (file)
@@ -168,7 +168,7 @@ gst_tizen_wl_shm_allocator_alloc (GstAllocator * allocator, gsize size,
   FUNCTION;
 
 #ifdef TIZEN_FEATURE_WLSINK_ENHANCEMENT
-  if (self->display->use_tbm) {
+  if (self->display->use_tbm && !self->display->mapping_sub_surface) {
     tbm_bo_handle virtual_addr;
 
     idx = self->display->tbm_bo_idx++;
@@ -470,7 +470,7 @@ gst_tizen_wl_shm_memory_construct_wl_buffer (GstMemory * mem,
   struct wl_buffer *wbuffer;
   FUNCTION;
 
-  if (display->use_tbm) {
+  if (display->use_tbm && !display->mapping_sub_surface) {
     tbm_surface_info_s ts_info;
     tbm_surface_h tsurface;
 
index 36e4c16..c4363ac 100644 (file)
@@ -83,6 +83,7 @@ gst_wl_display_init (GstWlDisplay * self)
   self->tbm_bo_idx = 0;
   self->wl_surface_id = -1;
   self->dump_count = 1;
+  self->mapping_sub_surface = FALSE;
 #endif
 }
 
index 568573a..4f66c37 100644 (file)
@@ -84,6 +84,7 @@ struct _GstWlDisplay
   gint tbm_bo_idx;
   tbm_surface_h tsurface;
   tbm_surface_h flush_tsurface;
+  gboolean mapping_sub_surface;
   gboolean use_tbm;
   gboolean flush_request;
   gboolean dump_video;
index 01cc087..b7f5547 100644 (file)
@@ -120,7 +120,7 @@ gst_wl_window_finalize (GObject * gobject)
 
 #ifdef TIZEN_FEATURE_WLSINK_ENHANCEMENT
 static void
-gst_wl_window_map_sub_surface (GstWlDisplay * display, GstWlWindow * window,
+gst_wl_window_mapping_sub_surface (GstWlDisplay * display, GstWlWindow * window,
     GstVideoInfo * info)
 {
   /* A sub-surface becomes mapped, when a non-NULL wl_buffer is applied
@@ -136,6 +136,7 @@ gst_wl_window_map_sub_surface (GstWlDisplay * display, GstWlWindow * window,
   g_return_if_fail (window != NULL);
   g_return_if_fail (info != NULL);
 
+  display->mapping_sub_surface = TRUE;
   self = GST_TIZEN_WL_SHM_ALLOCATOR (gst_tizen_wl_shm_allocator_get ());
   self->display = display;
 
@@ -173,6 +174,7 @@ gst_wl_window_map_sub_surface (GstWlDisplay * display, GstWlWindow * window,
   /* at this point, the GstWlBuffer keeps the buffer
    * alive and will free it on wl_buffer::release */
   gst_buffer_unref (buf);
+  display->mapping_sub_surface = FALSE;
 }
 #endif
 
@@ -326,15 +328,9 @@ gst_wl_window_new_internal (GstWlDisplay * display)
     /* tizen_video(tbm) render on video_surface */
     window->video_object =
         tizen_video_get_object (display->tizen_video, window->video_surface);
-
-    /* to use shm memory for mapping sub-surface, set FALSE to use_tbm */
-    window->display->use_tbm = FALSE;
-    gst_wl_window_map_sub_surface (display, window, &info);
-    /*restore use_tbm */
-    window->display->use_tbm = TRUE;
-  } else {
-    gst_wl_window_map_sub_surface (display, window, &info);
   }
+
+  gst_wl_window_mapping_sub_surface (display, window, &info);
 #else /* open source */
   buf =
       gst_buffer_new_allocate (gst_tizen_wl_shm_allocator_get (), info.size,