replace 'tizen_buffer_pool' interface with 'wayland-tbm' library 07/48307/3 accepted/tizen/mobile/20150921.090159 accepted/tizen/tv/20150921.090213 accepted/tizen/wearable/20150921.090251 submit/tizen/20150921.042429 submit/tizen/20150921.055555 submit/tizen_common/20151015.190624 submit/tizen_common/20151019.135620
authorBoram Park <boram1288.park@samsung.com>
Wed, 16 Sep 2015 12:07:43 +0000 (21:07 +0900)
committerBoram Park <boram1288.park@samsung.com>
Mon, 21 Sep 2015 01:59:56 +0000 (10:59 +0900)
Change-Id: Ib85d3a3ec490eb50fe48f233f66f77d22080dd33

configure.ac
ext/wayland/gstwaylandsink.c
ext/wayland/tizen-wlvideoformat.c
ext/wayland/tizen-wlvideoformat.h
ext/wayland/waylandpool.c
ext/wayland/waylandpool.h
ext/wayland/wldisplay.c
ext/wayland/wldisplay.h
ext/wayland/wlwindow.c
ext/wayland/wlwindow.h
packaging/gst-plugins-bad.spec

index 71a8e4d..fcff1e3 100644 (file)
@@ -730,7 +730,7 @@ case $host in
     LIBS=$old_LIBS
     CFLAGS=$old_CFLAGS
 
-    PKG_CHECK_MODULES(WAYLAND_EGL, wayland-client >= 1.0 wayland-cursor >= 1.0 wayland-egl >= 9.0 tizen-extension-client, HAVE_WAYLAND_EGL=yes, HAVE_WAYLAND_EGL=no)
+    PKG_CHECK_MODULES(WAYLAND_EGL, wayland-client >= 1.0 wayland-cursor >= 1.0 wayland-egl >= 9.0 wayland-tbm-client tizen-extension-client, HAVE_WAYLAND_EGL=yes, HAVE_WAYLAND_EGL=no)
   ;;
 esac
 
@@ -2006,7 +2006,7 @@ AG_GST_CHECK_FEATURE(DIRECTFB, [directfb], dfbvideosink , [
 dnl **** Wayland ****
 translit(dnm, m, l) AM_CONDITIONAL(USE_WAYLAND, true)
 AG_GST_CHECK_FEATURE(WAYLAND, [wayland sink], wayland , [
-  PKG_CHECK_MODULES(WAYLAND, wayland-client >= 1.4.0 wayland-scanner tizen-extension-client, [
+  PKG_CHECK_MODULES(WAYLAND, wayland-client >= 1.4.0 wayland-scanner wayland-tbm-client tizen-extension-client, [
     HAVE_WAYLAND="yes" ], [ HAVE_WAYLAND="no"
   ])
 ])
index 14b9102..b801784 100755 (executable)
@@ -644,7 +644,7 @@ gst_wayland_sink_get_caps (GstBaseSink * bsink, GstCaps * filter)
     GArray *formats;
     gint i;
 #ifdef GST_WLSINK_ENHANCEMENT
-    enum tizen_buffer_pool_format fmt;
+    uint32_t fmt;
 #else
     enum wl_shm_format fmt;
 #endif
@@ -657,6 +657,16 @@ gst_wayland_sink_get_caps (GstBaseSink * bsink, GstCaps * filter)
       fmt = g_array_index (formats, uint32_t, i);
       g_value_set_string (&value, gst_wayland_format_to_string (fmt));
       gst_value_list_append_value (&list, &value);
+#ifdef GST_WLSINK_ENHANCEMENT
+      /* TBM doesn't support SN12. So we add SN12 manually as supported format.
+       * SN12 is exactly same with NV12.
+       */
+      if (fmt == TBM_FORMAT_NV12) {
+        g_value_set_string (&value,
+            gst_video_format_to_string (GST_VIDEO_FORMAT_SN12));
+        gst_value_list_append_value (&list, &value);
+      }
+#endif
     }
 
     caps = gst_caps_make_writable (caps);
@@ -688,7 +698,7 @@ gst_wayland_sink_set_caps (GstBaseSink * bsink, GstCaps * caps)
   GstBufferPool *newpool;
   GstVideoInfo info;
 #ifdef GST_WLSINK_ENHANCEMENT
-  enum tizen_buffer_pool_format format;
+  uint32_t format;
 #else
   enum wl_shm_format format;
 #endif
index 23cde48..dfca58d 100755 (executable)
@@ -32,53 +32,53 @@ GST_DEBUG_CATEGORY_EXTERN (gstwayland_debug);
 
 typedef struct
 {
-  enum tizen_buffer_pool_format wl_format;
+  uint32_t wl_format;
   GstVideoFormat gst_format;
 } wl_VideoFormat;
 
 static const wl_VideoFormat formats[] = {
 #if G_BYTE_ORDER == G_BIG_ENDIAN
-  {TIZEN_BUFFER_POOL_FORMAT_XRGB8888, GST_VIDEO_FORMAT_xRGB},
-  {TIZEN_BUFFER_POOL_FORMAT_XBGR8888, GST_VIDEO_FORMAT_xBGR},
-  {TIZEN_BUFFER_POOL_FORMAT_RGBX8888, GST_VIDEO_FORMAT_RGBx},
-  {TIZEN_BUFFER_POOL_FORMAT_BGRX8888, GST_VIDEO_FORMAT_BGRx},
-  {TIZEN_BUFFER_POOL_FORMAT_ARGB8888, GST_VIDEO_FORMAT_ARGB},
-  {TIZEN_BUFFER_POOL_FORMAT_ABGR8888, GST_VIDEO_FORMAT_RGBA},
-  {TIZEN_BUFFER_POOL_FORMAT_RGBA8888, GST_VIDEO_FORMAT_RGBA},
-  {TIZEN_BUFFER_POOL_FORMAT_BGRA8888, GST_VIDEO_FORMAT_BGRA},
+  {TBM_FORMAT_XRGB8888, GST_VIDEO_FORMAT_xRGB},
+  {TBM_FORMAT_XBGR8888, GST_VIDEO_FORMAT_xBGR},
+  {TBM_FORMAT_RGBX8888, GST_VIDEO_FORMAT_RGBx},
+  {TBM_FORMAT_BGRX8888, GST_VIDEO_FORMAT_BGRx},
+  {TBM_FORMAT_ARGB8888, GST_VIDEO_FORMAT_ARGB},
+  {TBM_FORMAT_ABGR8888, GST_VIDEO_FORMAT_RGBA},
+  {TBM_FORMAT_RGBA8888, GST_VIDEO_FORMAT_RGBA},
+  {TBM_FORMAT_BGRA8888, GST_VIDEO_FORMAT_BGRA},
 #else
-  {TIZEN_BUFFER_POOL_FORMAT_XRGB8888, GST_VIDEO_FORMAT_BGRx},
-  {TIZEN_BUFFER_POOL_FORMAT_XBGR8888, GST_VIDEO_FORMAT_RGBx},
-  {TIZEN_BUFFER_POOL_FORMAT_RGBX8888, GST_VIDEO_FORMAT_xBGR},
-  {TIZEN_BUFFER_POOL_FORMAT_BGRX8888, GST_VIDEO_FORMAT_xRGB},
-  {TIZEN_BUFFER_POOL_FORMAT_ARGB8888, GST_VIDEO_FORMAT_BGRA},
-  {TIZEN_BUFFER_POOL_FORMAT_ABGR8888, GST_VIDEO_FORMAT_RGBA},
-  {TIZEN_BUFFER_POOL_FORMAT_RGBA8888, GST_VIDEO_FORMAT_ABGR},
-  {TIZEN_BUFFER_POOL_FORMAT_BGRA8888, GST_VIDEO_FORMAT_ARGB},
+  {TBM_FORMAT_XRGB8888, GST_VIDEO_FORMAT_BGRx},
+  {TBM_FORMAT_XBGR8888, GST_VIDEO_FORMAT_RGBx},
+  {TBM_FORMAT_RGBX8888, GST_VIDEO_FORMAT_xBGR},
+  {TBM_FORMAT_BGRX8888, GST_VIDEO_FORMAT_xRGB},
+  {TBM_FORMAT_ARGB8888, GST_VIDEO_FORMAT_BGRA},
+  {TBM_FORMAT_ABGR8888, GST_VIDEO_FORMAT_RGBA},
+  {TBM_FORMAT_RGBA8888, GST_VIDEO_FORMAT_ABGR},
+  {TBM_FORMAT_BGRA8888, GST_VIDEO_FORMAT_ARGB},
 #endif
-  {TIZEN_BUFFER_POOL_FORMAT_RGB565, GST_VIDEO_FORMAT_RGB16},
-  {TIZEN_BUFFER_POOL_FORMAT_BGR565, GST_VIDEO_FORMAT_BGR16},
-  {TIZEN_BUFFER_POOL_FORMAT_RGB888, GST_VIDEO_FORMAT_RGB},
-  {TIZEN_BUFFER_POOL_FORMAT_BGR888, GST_VIDEO_FORMAT_BGR},
-  {TIZEN_BUFFER_POOL_FORMAT_YUYV, GST_VIDEO_FORMAT_YUY2},
-  {TIZEN_BUFFER_POOL_FORMAT_YVYU, GST_VIDEO_FORMAT_YVYU},
-  {TIZEN_BUFFER_POOL_FORMAT_UYVY, GST_VIDEO_FORMAT_UYVY},
-  {TIZEN_BUFFER_POOL_FORMAT_AYUV, GST_VIDEO_FORMAT_AYUV},
-  {TIZEN_BUFFER_POOL_FORMAT_NV12, GST_VIDEO_FORMAT_NV12},
-  {TIZEN_BUFFER_POOL_FORMAT_NV21, GST_VIDEO_FORMAT_NV21},
-  {TIZEN_BUFFER_POOL_FORMAT_NV16, GST_VIDEO_FORMAT_NV16},
-  {TIZEN_BUFFER_POOL_FORMAT_YUV410, GST_VIDEO_FORMAT_YUV9},
-  {TIZEN_BUFFER_POOL_FORMAT_YVU410, GST_VIDEO_FORMAT_YVU9},
-  {TIZEN_BUFFER_POOL_FORMAT_YUV411, GST_VIDEO_FORMAT_Y41B},
-  {TIZEN_BUFFER_POOL_FORMAT_YUV420, GST_VIDEO_FORMAT_I420},
-  {TIZEN_BUFFER_POOL_FORMAT_YVU420, GST_VIDEO_FORMAT_YV12},
-  {TIZEN_BUFFER_POOL_FORMAT_YUV422, GST_VIDEO_FORMAT_Y42B},
-  {TIZEN_BUFFER_POOL_FORMAT_YUV444, GST_VIDEO_FORMAT_v308},
-  {TIZEN_BUFFER_POOL_FORMAT_ST12, GST_VIDEO_FORMAT_ST12},
-  {TIZEN_BUFFER_POOL_FORMAT_SN12, GST_VIDEO_FORMAT_SN12}
+  {TBM_FORMAT_RGB565, GST_VIDEO_FORMAT_RGB16},
+  {TBM_FORMAT_BGR565, GST_VIDEO_FORMAT_BGR16},
+  {TBM_FORMAT_RGB888, GST_VIDEO_FORMAT_RGB},
+  {TBM_FORMAT_BGR888, GST_VIDEO_FORMAT_BGR},
+  {TBM_FORMAT_YUYV, GST_VIDEO_FORMAT_YUY2},
+  {TBM_FORMAT_YVYU, GST_VIDEO_FORMAT_YVYU},
+  {TBM_FORMAT_UYVY, GST_VIDEO_FORMAT_UYVY},
+  {TBM_FORMAT_AYUV, GST_VIDEO_FORMAT_AYUV},
+  {TBM_FORMAT_NV12, GST_VIDEO_FORMAT_NV12},
+  {TBM_FORMAT_NV21, GST_VIDEO_FORMAT_NV21},
+  {TBM_FORMAT_NV16, GST_VIDEO_FORMAT_NV16},
+  {TBM_FORMAT_YUV410, GST_VIDEO_FORMAT_YUV9},
+  {TBM_FORMAT_YVU410, GST_VIDEO_FORMAT_YVU9},
+  {TBM_FORMAT_YUV411, GST_VIDEO_FORMAT_Y41B},
+  {TBM_FORMAT_YUV420, GST_VIDEO_FORMAT_I420},
+  {TBM_FORMAT_YVU420, GST_VIDEO_FORMAT_YV12},
+  {TBM_FORMAT_YUV422, GST_VIDEO_FORMAT_Y42B},
+  {TBM_FORMAT_YUV444, GST_VIDEO_FORMAT_v308},
+  {TBM_FORMAT_NV12MT, GST_VIDEO_FORMAT_ST12},
+  {TBM_FORMAT_NV12,   GST_VIDEO_FORMAT_SN12},
 };
 
-enum tizen_buffer_pool_format
+uint32_t
 gst_video_format_to_wayland_format (GstVideoFormat format)
 {
   guint i;
@@ -92,7 +92,7 @@ gst_video_format_to_wayland_format (GstVideoFormat format)
 }
 
 GstVideoFormat
-gst_wayland_format_to_video_format (enum tizen_buffer_pool_format wl_format)
+gst_wayland_format_to_video_format (uint32_t wl_format)
 {
   guint i;
 
@@ -105,7 +105,7 @@ gst_wayland_format_to_video_format (enum tizen_buffer_pool_format wl_format)
 }
 
 const gchar *
-gst_wayland_format_to_string (enum tizen_buffer_pool_format wl_format)
+gst_wayland_format_to_string (uint32_t wl_format)
 {
   return gst_video_format_to_string
       (gst_wayland_format_to_video_format (wl_format));
index 0f6f16b..a62e7d8 100755 (executable)
 #include <gst/video/video.h>
 
 #ifdef GST_WLSINK_ENHANCEMENT
-#include <tizen-extension-client-protocol.h>
+#include <tbm_surface.h>
 
 G_BEGIN_DECLS
-    enum tizen_buffer_pool_format
-gst_video_format_to_wayland_format (GstVideoFormat format);
-GstVideoFormat gst_wayland_format_to_video_format (enum tizen_buffer_pool_format
-    wl_format);
+    uint32_t gst_video_format_to_wayland_format (GstVideoFormat format);
+GstVideoFormat gst_wayland_format_to_video_format (uint32_t wl_format);
 
-const gchar *gst_wayland_format_to_string (enum tizen_buffer_pool_format
-    wl_format);
+const gchar *gst_wayland_format_to_string (uint32_t wl_format);
 
 G_END_DECLS
 #endif
index 82d499e..78366a6 100755 (executable)
@@ -66,6 +66,8 @@ gst_wl_meta_free (GstWlMeta * meta, GstBuffer * buffer)
 #ifdef GST_WLSINK_ENHANCEMENT
   if (!meta || !meta->pool)
     return;
+  if (meta->tsurface)
+    tbm_surface_destroy (meta->tsurface);
   g_hash_table_remove (meta->pool->buffers_map, meta->wbuffer);
 #endif
   GST_DEBUG ("destroying wl_buffer %p", meta->wbuffer);
@@ -480,7 +482,8 @@ gst_wayland_tizen_buffer_pool_start (GstBufferPool * pool)
     /*in case of normal video format */
     size = GST_VIDEO_INFO_SIZE (&self->info) * 15;
 
-    self->display->tbm_bufmgr = tbm_bufmgr_init (self->display->drm_fd);
+    self->display->tbm_bufmgr =
+        wayland_tbm_client_get_bufmgr (self->display->tbm_client);
     g_return_if_fail (self->display->tbm_bufmgr != NULL);
 
     self->display->tbm_bo =
@@ -488,8 +491,6 @@ gst_wayland_tizen_buffer_pool_start (GstBufferPool * pool)
     if (!self->display->tbm_bo) {
       GST_ERROR_OBJECT (pool, "alloc tbm bo(size:%d) failed: %s", size,
           strerror (errno));
-      tbm_bufmgr_deinit (self->display->tbm_bufmgr);
-      self->display->tbm_bufmgr = NULL;
       return FALSE;
     }
 
@@ -497,9 +498,7 @@ gst_wayland_tizen_buffer_pool_start (GstBufferPool * pool)
     if (!vitual_addr.ptr) {
       GST_ERROR_OBJECT (pool, "get tbm bo handle failed: %s", strerror (errno));
       tbm_bo_unref (self->display->tbm_bo);
-      tbm_bufmgr_deinit (self->display->tbm_bufmgr);
       self->display->tbm_bo = NULL;
-      self->display->tbm_bufmgr = NULL;
       return FALSE;
     }
   }
@@ -523,8 +522,7 @@ gst_wayland_tizen_buffer_pool_stop (GstBufferPool * pool)
   self->size = 0;
   self->used = 0;
 
-  tizen_buffer_pool_destroy (self->display->tizen_buffer_pool);
-  self->display->tizen_buffer_pool = NULL;
+  self->display->tbm_bufmgr = NULL;
 
   /* all buffers are about to be destroyed;
    * we should no longer do anything with them */
@@ -549,17 +547,16 @@ gst_wayland_tizen_buffer_pool_alloc (GstBufferPool * pool, GstBuffer ** buffer,
 
   gint width, height;
   gsize size;
-  enum tizen_buffer_pool_format format;
+  uint32_t format;
   gint data_offset;
   void *data;
   GstWlMeta *meta;
   tbm_bo_handle vitual_addr;
+  tbm_surface_info_s info;
+  int num_bo;
 
   if (self->display->is_native_format == TRUE) {
     /*in case of SN12 or ST12 video  format */
-    unsigned int name[NV_BUF_PLANE_NUM];
-    unsigned int offset[NV_BUF_PLANE_NUM] = { 0, };
-    unsigned int stride[NV_BUF_PLANE_NUM] = { 0, };
     width = GST_VIDEO_INFO_WIDTH (&self->info);
     height = GST_VIDEO_INFO_HEIGHT (&self->info);
     size = self->display->native_video_size;
@@ -593,23 +590,26 @@ gst_wayland_tizen_buffer_pool_alloc (GstBufferPool * pool, GstBuffer ** buffer,
     meta->pool = self;
     GST_DEBUG ("TBM bo %p %p %p", self->display->bo[0],
         self->display->bo[1], 0);
-    for (int i = 0; i < NV_BUF_PLANE_NUM; i++) {
-      if (self->display->bo[i] != NULL) {
-        name[i] = tbm_bo_export (self->display->bo[i]);
-        offset[i] = 0;
-      } else {
-        name[i] = 0;
-        if (i > 0) {
-          offset[i] = offset[i - 1] + self->display->plane_size[i - 1];
-        }
-      }
-      stride[i] = self->display->stride_width[i];
-    }
 
+    info.width = width;
+    info.height = height;
+    info.format = format;
+    info.bpp = tbm_surface_internal_get_bpp (info.format);
+    info.num_planes = tbm_surface_internal_get_num_planes (info.format);
+    info.planes[0].stride = self->display->stride_width[0];
+    info.planes[1].stride = self->display->stride_width[1];
+    info.planes[0].offset = 0;
+    info.planes[1].offset =
+        (self->display->bo[1]) ? 0 : self->display->plane_size[0];
+    num_bo = (self->display->bo[1]) ? 2 : 1;
+
+    meta->tsurface =
+        tbm_surface_internal_create_with_bos (&info, self->display->bo, num_bo);
     meta->wbuffer =
-        tizen_buffer_pool_create_planar_buffer (self->display->
-        tizen_buffer_pool, width, height, format, name[0], offset[0], stride[0],
-        name[1], offset[1], stride[1], 0, 0, 0);
+        wayland_tbm_client_create_buffer (self->display->tbm_client,
+        meta->tsurface);
+    wl_proxy_set_queue ((struct wl_proxy *) meta->wbuffer,
+        self->display->queue);
     meta->used_by_compositor = FALSE;
 
     GST_DEBUG ("tizen_buffer_pool_create_planar_buffer create wl_buffer %p",
@@ -644,9 +644,25 @@ gst_wayland_tizen_buffer_pool_alloc (GstBufferPool * pool, GstBuffer ** buffer,
     meta = (GstWlMeta *) gst_buffer_add_meta (*buffer, GST_WL_META_INFO, NULL);
     meta->pool = self;
 
+    info.width = width;
+    info.height = height;
+    info.format = format;
+    info.bpp = tbm_surface_internal_get_bpp (info.format);
+    info.num_planes = tbm_surface_internal_get_num_planes (info.format);
+    info.planes[0].stride = GST_VIDEO_INFO_PLANE_STRIDE (&self->info, 0);
+    info.planes[1].stride = GST_VIDEO_INFO_PLANE_STRIDE (&self->info, 1);
+    info.planes[2].stride = GST_VIDEO_INFO_PLANE_STRIDE (&self->info, 2);
+    info.planes[0].offset = GST_VIDEO_INFO_PLANE_OFFSET (&self->info, 0);
+    info.planes[1].offset = GST_VIDEO_INFO_PLANE_OFFSET (&self->info, 1);
+    info.planes[2].offset = GST_VIDEO_INFO_PLANE_OFFSET (&self->info, 2);
+
+    meta->tsurface =
+        tbm_surface_internal_create_with_bos (&info, &self->display->tbm_bo, 1);
     meta->wbuffer =
-        tizen_buffer_pool_create_buffer (self->display->tizen_buffer_pool,
-        tbm_bo_export (self->display->tbm_bo), width, height, stride, format);
+        wayland_tbm_client_create_buffer (self->display->tbm_client,
+        meta->tsurface);
+    wl_proxy_set_queue ((struct wl_proxy *) meta->wbuffer,
+        self->display->queue);
     meta->used_by_compositor = FALSE;
   }
 
@@ -678,7 +694,7 @@ gst_wayland_tizen_buffer_pool_finalize (GObject * object)
 
   GstWaylandBufferPool *pool = GST_WAYLAND_BUFFER_POOL_CAST (object);
 
-  if (pool->display->tizen_buffer_pool) {
+  if (pool->display->tbm_bufmgr) {
     gst_wayland_tizen_buffer_pool_stop (GST_BUFFER_POOL (pool));
   } else {
     /*already stop */
index 0698e6b..28d4f42 100755 (executable)
@@ -28,6 +28,7 @@
 #include "wldisplay.h"
 #ifdef GST_WLSINK_ENHANCEMENT
 #include <tbm_bufmgr.h>
+#include <tbm_surface.h>
 #endif
 
 G_BEGIN_DECLS
@@ -61,6 +62,9 @@ struct _GstWlMeta
   GstWaylandBufferPool *pool;
   struct wl_buffer *wbuffer;
   gboolean used_by_compositor;
+#ifdef GST_WLSINK_ENHANCEMENT
+  tbm_surface_h tsurface;
+#endif
 };
 
 /* buffer pool */
index 6f7d63e..8021e59 100755 (executable)
 #include <stdlib.h>
 
 static void
-handle_tizen_buffer_pool_device (void *data,
-    struct tizen_buffer_pool *tizen_buffer_pool, const char *device_name)
+handle_tizen_video_format (void *data, struct tizen_video *tizen_video,
+    uint32_t format)
 {
   FUNCTION_ENTER ();
   GstWlDisplay *self = data;
 
   g_return_if_fail (self != NULL);
-  g_return_if_fail (device_name != NULL);
-
-  self->device_name = strdup (device_name);
-}
-
-static void
-handle_tizen_buffer_pool_authenticated (void *data,
-    struct tizen_buffer_pool *tizen_buffer_pool)
-{
-  FUNCTION_ENTER ();
-
-  GstWlDisplay *self = data;
-  g_return_if_fail (self != NULL);
-
-  /* authenticated */
-  self->authenticated = 1;
-}
-
-static void
-handle_tizen_buffer_pool_capabilities (void *data,
-    struct tizen_buffer_pool *tizen_buffer_pool, uint32_t value)
-{
-  FUNCTION_ENTER ();
-  GstWlDisplay *self = data;
-  g_return_if_fail (self != NULL);
-
-  drm_magic_t magic;
-
-  /* check if buffer_pool has video capability */
-  if (!(value & TIZEN_BUFFER_POOL_CAPABILITY_VIDEO))
-    return;
-
-  self->has_capability = 1;
-
-  /* do authenticate only if a pool has the video capability */
-#ifdef O_CLOEXEC
-  self->drm_fd = open (self->device_name, O_RDWR | O_CLOEXEC);
-  if (self->drm_fd == -1 && errno == EINVAL)
-#endif
-  {
-    self->drm_fd = open (self->device_name, O_RDWR);
-    if (self->drm_fd != -1)
-      fcntl (self->drm_fd, F_SETFD, fcntl (self->drm_fd, F_GETFD) | FD_CLOEXEC);
-  }
-
-  g_return_if_fail (self->drm_fd >= 0);
-
-  if (drmGetMagic (self->drm_fd, &magic) != 0) {
-    close (self->drm_fd);
-    self->drm_fd = -1;
-    return;
-  }
-
-  tizen_buffer_pool_authenticate (tizen_buffer_pool, magic);
-  wl_display_roundtrip (self->display);
-}
-
-static void
-handle_tizen_buffer_pool_format (void *data,
-    struct tizen_buffer_pool *tizen_buffer_pool, uint32_t format)
-{
-  FUNCTION_ENTER ();
-  GstWlDisplay *self = data;
-  g_return_if_fail (self != NULL);
 
   GST_INFO ("format is %d", format);
   g_array_append_val (self->formats, format);
 }
 
-static const struct tizen_buffer_pool_listener tz_buffer_pool_listener = {
-  handle_tizen_buffer_pool_device,
-  handle_tizen_buffer_pool_authenticated,
-  handle_tizen_buffer_pool_capabilities,
-  handle_tizen_buffer_pool_format
+static const struct tizen_video_listener tz_video_listener = {
+  handle_tizen_video_format
 };
 #endif
 
@@ -157,11 +90,13 @@ gst_wl_display_finalize (GObject * gobject)
     /*in case of normal video format */
     if (self->tbm_bo)
       tbm_bo_unref (self->tbm_bo);
-    if (self->tbm_bufmgr)
-      tbm_bufmgr_deinit (self->tbm_bufmgr);
     self->tbm_bo = NULL;
-    self->tbm_bufmgr = NULL;
   }
+  if (self->tbm_client) {
+    wayland_tbm_client_deinit (self->tbm_client);
+    self->tbm_client = NULL;
+  }
+  self->tbm_bufmgr = NULL;
 #endif
 
   g_array_unref (self->formats);
@@ -194,10 +129,8 @@ gst_wl_display_finalize (GObject * gobject)
 #ifdef GST_WLSINK_ENHANCEMENT
   if (self->tizen_policy)
     tizen_policy_destroy (self->tizen_policy);
-  if (self->device_name)
-    free (self->device_name);
-  if (self->drm_fd >= 0)
-    close (self->drm_fd);
+  if (self->tizen_video)
+    tizen_video_destroy (self->tizen_video);
 #endif
 
   G_OBJECT_CLASS (gst_wl_display_parent_class)->finalize (gobject);
@@ -279,21 +212,14 @@ registry_handle_global (void *data, struct wl_registry *registry,
   } else if (g_strcmp0 (interface, "tizen_policy") == 0) {
     self->tizen_policy =
         wl_registry_bind (registry, id, &tizen_policy_interface, 1);
-  } else if (g_strcmp0 (interface, "tizen_buffer_pool") == 0) {
-
-    self->tizen_buffer_pool =
-        wl_registry_bind (registry, id, &tizen_buffer_pool_interface, 1);
-    g_return_if_fail (self->tizen_buffer_pool != NULL);
+  } else if (g_strcmp0 (interface, "tizen_video") == 0) {
+    self->tizen_video =
+        wl_registry_bind (registry, id, &tizen_video_interface, version);
+    g_return_if_fail (self->tizen_video != NULL);
 
     GST_INFO ("id(%d)", id);
-    self->name = id;
-    self->drm_fd = -1;
 
-    tizen_buffer_pool_add_listener (self->tizen_buffer_pool,
-        &tz_buffer_pool_listener, self);
-
-    /* make sure all tizen_buffer_pool's events are handled */
-    wl_display_roundtrip (self->display);
+    tizen_video_add_listener (self->tizen_video, &tz_video_listener, self);
   }
 #endif
 }
@@ -404,7 +330,14 @@ gst_wl_display_new_existing (struct wl_display * display,
   VERIFY_INTERFACE_EXISTS (subcompositor, "wl_subcompositor");
   VERIFY_INTERFACE_EXISTS (shell, "wl_shell");
 #ifdef GST_WLSINK_ENHANCEMENT
-  VERIFY_INTERFACE_EXISTS (tizen_buffer_pool, "tizen_buffer_pool");
+  VERIFY_INTERFACE_EXISTS (tizen_video, "tizen_video");
+  self->tbm_client = wayland_tbm_client_init (self->display);
+  if (!self->tbm_client) {
+    *error = g_error_new (g_quark_from_static_string ("GstWlDisplay"), 0,
+        "Error initializing wayland-tbm");
+    g_object_unref (self);
+    return NULL;
+  }
 #else
   VERIFY_INTERFACE_EXISTS (shm, "wl_shm");
 #endif
index 587350a..f782534 100755 (executable)
@@ -26,6 +26,7 @@
 #include "scaler-client-protocol.h"
 #ifdef GST_WLSINK_ENHANCEMENT
 #include <tbm_bufmgr.h>
+#include <wayland-tbm-client.h>
 #include <tizen-extension-client-protocol.h>
 #define NV_BUF_PLANE_NUM    2   /*SN12 or ST12 has 2 plane */
 #endif
@@ -69,14 +70,9 @@ struct _GstWlDisplay
 #ifdef GST_WLSINK_ENHANCEMENT
   /*video output layer */
   struct tizen_policy *tizen_policy;
+  struct tizen_video *tizen_video;
 
-  /*tizen buffer pool */
-  struct tizen_buffer_pool *tizen_buffer_pool;
-  uint32_t name;
-  int has_capability;
-  char *device_name;
-  int drm_fd;
-  int authenticated;
+  struct wayland_tbm_client *tbm_client;
   tbm_bufmgr tbm_bufmgr;
   tbm_bo tbm_bo;
 
index 8769335..9c8e80a 100755 (executable)
@@ -445,7 +445,8 @@ gst_wl_window_set_render_rectangle (GstWlWindow * window, gint x, gint y,
 }
 
 #ifdef GST_WLSINK_ENHANCEMENT
-void gst_wl_window_set_rotate_angle (GstWlWindow * window, guint rotate_angle)
+void
+gst_wl_window_set_rotate_angle (GstWlWindow * window, guint rotate_angle)
 {
   FUNCTION_ENTER ();
   g_return_if_fail (window != NULL);
@@ -453,21 +454,27 @@ void gst_wl_window_set_rotate_angle (GstWlWindow * window, guint rotate_angle)
   GST_INFO ("rotate_angle value is (%d)", window->rotate_angle);
 
 }
-void gst_wl_window_set_disp_geo_method (GstWlWindow * window, guint disp_geo_method)
+
+void
+gst_wl_window_set_disp_geo_method (GstWlWindow * window, guint disp_geo_method)
 {
   FUNCTION_ENTER ();
   g_return_if_fail (window != NULL);
   window->disp_geo_method = disp_geo_method;
   GST_INFO ("disp_geo_method value is (%d)", window->disp_geo_method);
 }
-void gst_wl_window_set_orientation (GstWlWindow * window, guint orientation)
+
+void
+gst_wl_window_set_orientation (GstWlWindow * window, guint orientation)
 {
   FUNCTION_ENTER ();
   g_return_if_fail (window != NULL);
   window->orientation = orientation;
   GST_INFO ("orientation value is (%d)", window->orientation);
 }
-void gst_wl_window_set_flip (GstWlWindow * window, guint flip)
+
+void
+gst_wl_window_set_flip (GstWlWindow * window, guint flip)
 {
   FUNCTION_ENTER ();
   g_return_if_fail (window != NULL);
index 38cdc47..3dc3cda 100755 (executable)
@@ -87,7 +87,8 @@ void gst_wl_window_set_render_rectangle (GstWlWindow * window, gint x, gint y,
 
 #ifdef GST_WLSINK_ENHANCEMENT
 void gst_wl_window_set_rotate_angle (GstWlWindow * window, guint rotate_angle);
-void gst_wl_window_set_disp_geo_method (GstWlWindow * window, guint disp_geo_method);
+void gst_wl_window_set_disp_geo_method (GstWlWindow * window,
+    guint disp_geo_method);
 void gst_wl_window_set_orientation (GstWlWindow * window, guint orientation);
 void gst_wl_window_set_flip (GstWlWindow * window, guint flip);
 #endif
index 29d3b3b..a320de9 100644 (file)
@@ -36,6 +36,7 @@ BuildRequires:  pkgconfig(libtbm)
 BuildRequires: pkgconfig(mm-common)
 %if %{with wayland}
 BuildRequires:  pkgconfig(wayland-client) >= 1.0.0
+BuildRequires:  pkgconfig(wayland-tbm-client)
 BuildRequires:  pkgconfig(tizen-extension-client)
 %endif
 %if %{with x}