e_comp_wl_tbm: add e_comp_wl_tbm 49/47349/14
authorSooChan Lim <sc1.lim@samsung.com>
Tue, 25 Aug 2015 14:35:47 +0000 (23:35 +0900)
committerBoram Park <boram1288.park@samsung.com>
Mon, 7 Sep 2015 10:34:23 +0000 (03:34 -0700)
first implementation for wayland-tbm server

Change-Id: I06c44fb9211efaba208a1537af3c17360f7797fd

configure.ac [changed mode: 0644->0755]
packaging/enlightenment.spec
src/bin/Makefile.mk
src/bin/e_comp_wl.c [changed mode: 0644->0755]
src/bin/e_comp_wl.h [changed mode: 0644->0755]
src/bin/e_comp_wl_tbm.c [new file with mode: 0755]
src/bin/e_comp_wl_tbm.h [new file with mode: 0644]
src/bin/e_includes.h [changed mode: 0644->0755]

old mode 100644 (file)
new mode 100755 (executable)
index 409a98b..ec97d49
@@ -868,10 +868,31 @@ if test "x${have_wayland}" = "xyes"; then
   fi
 fi
 
+have_wayland_tbm=no
+AC_ARG_ENABLE([wayland-tbm],
+  AS_HELP_STRING([--enable-wayland-tbm],[enable wayland-tbm @<:@default=enabled@:>@]),
+  [e_cv_want_wayland_tbm=$enableval],
+  [e_cv_want_wayland_tbm=yes])
+AC_MSG_CHECKING([whether wayland TBM support is enabled])
+AC_MSG_RESULT([${e_cv_want_wayland_tbm}])
+
+if test "x$e_cv_want_wayland_tbm" != "xno";then
+  PKG_CHECK_MODULES([WAYLAND_TBM], [wayland-tbm-server],
+    [
+      have_wayland_tbm=yes
+      AC_DEFINE_UNQUOTED([HAVE_WAYLAND_TBM],[1],[enable wayland-tbm support])
+    ])
+
+  PKG_CHECK_MODULES([ECORE_DRM], [ecore-drm >= ${efl_version}])
+else
+  have_wayland_tbm=no
+fi
+
 AM_CONDITIONAL([HAVE_WAYLAND], [test "x${have_wayland}" = "xyes"])
 AM_CONDITIONAL([HAVE_WAYLAND_ONLY], [test "x${have_wayland_only}" = "xyes"])
 AM_CONDITIONAL([HAVE_WAYLAND_CLIENTS], [test "x${have_wayland_clients}" = "xyes"])
 AM_CONDITIONAL([HAVE_WAYLAND_EGL], [test "x${have_wayland_egl}" = "xyes"])
+AM_CONDITIONAL([HAVE_WAYLAND_TBM], [test "x${have_wayland_tbm}" = "xyes"])
 
 if test "x${have_wayland_only}" != "xyes"; then
   PKG_CHECK_MODULES([ECORE_X], [ecore-x >= ${efl_version}])
index e64f930a0eb917ddc589549ea913f37c04c404b1..075bdd5975092bb2e11ec8cd6d3f18895d4cbbc5 100644 (file)
@@ -50,6 +50,8 @@ BuildRequires:  pkgconfig(transform-server)
 BuildRequires:  pkgconfig(screenshooter-server)
 BuildRequires:  pkgconfig(screenshooter-client)
 BuildRequires:  pkgconfig(tizen-extension-server)
+BuildRequires:  pkgconfig(wayland-tbm-server)
+BuildRequires:  pkgconfig(ecore-drm)
 Requires:       libwayland-extension-server
 %endif
 
index 9c63ee20dd3df669d2c1842011b8ab50047f16e0..8dc393fa34dd747b1ba847989610ed7a50ef31a7 100644 (file)
@@ -11,6 +11,7 @@ E_CPPFLAGS = \
 @EDJE_DEF@ \
 @WAYLAND_CFLAGS@ \
 @WAYLAND_EGL_CFLAGS@ \
+@WAYLAND_TBM_CFLAGS@ \
 -DE_BINDIR=\"$(bindir)\" \
 -DPACKAGE_BIN_DIR=\"@PACKAGE_BIN_DIR@\" \
 -DPACKAGE_LIB_DIR=\"@PACKAGE_LIB_DIR@\" \
@@ -210,6 +211,12 @@ src/bin/e_uuid_store.h \
 src/bin/e_comp_wl_data.h \
 src/bin/e_comp_wl_input.h \
 src/bin/e_comp_wl.h
+
+if HAVE_WAYLAND_TBM
+ENLIGHTENMENTHEADERS += \
+src/bin/e_comp_wl_tbm.h
+endif
+
 endif
 
 
@@ -384,12 +391,21 @@ src/bin/e_uuid_store.c \
 src/bin/e_comp_wl_data.c \
 src/bin/e_comp_wl_input.c \
 src/bin/e_comp_wl.c
+
+if HAVE_WAYLAND_TBM
+enlightenment_src += \
+src/bin/e_comp_wl_tbm.c
+endif
+
 endif
 
 src_bin_enlightenment_CPPFLAGS = $(E_CPPFLAGS) -DEFL_BETA_API_SUPPORT -DEFL_EO_API_SUPPORT -DE_LOGGING=1 @WAYLAND_CFLAGS@ @WAYLAND_EGL_CFLAGS@ -DNEED_WL
 if ! HAVE_WAYLAND_ONLY
 src_bin_enlightenment_CPPFLAGS += @ECORE_X_CFLAGS@ -DNEED_X=1
 endif
+if HAVE_WAYLAND_TBM
+src_bin_enlightenment_CPPFLAGS += @WAYLAND_TBM_CFLAGS@ @ECORE_DRM_CFLAGS@
+endif
 src_bin_enlightenment_SOURCES = \
 src/bin/e_main.c \
 $(enlightenment_src)
@@ -399,6 +415,9 @@ src_bin_enlightenment_LDADD = @e_libs@ @dlopen_libs@ @cf_libs@ @VALGRIND_LIBS@ @
 if ! HAVE_WAYLAND_ONLY
 src_bin_enlightenment_LDADD += @ECORE_X_LIBS@
 endif
+if HAVE_WAYLAND_TBM
+src_bin_enlightenment_LDADD += @WAYLAND_TBM_LIBS@ @ECORE_DRM_LIBS@
+endif
 
 src_bin_enlightenment_imc_SOURCES = \
 src/bin/e.h \
old mode 100644 (file)
new mode 100755 (executable)
index 132da2c..d23bcb3
@@ -3730,6 +3730,10 @@ e_comp_wl_init(void)
    /* clients_win_hash = eina_hash_int64_new(NULL); */
    clients_buffer_hash = eina_hash_pointer_new(NULL);
 
+#ifdef HAVE_WAYLAND_TBM
+   e_comp_wl_tbm_init();
+#endif
+
    /* add event handlers to catch E events */
 #ifndef HAVE_WAYLAND_ONLY
    E_LIST_HANDLER_APPEND(handlers, E_EVENT_RANDR_CHANGE,
@@ -3808,6 +3812,10 @@ e_comp_wl_shutdown(void)
    /* free handlers */
    E_FREE_LIST(handlers, ecore_event_handler_del);
 
+#ifdef HAVE_WAYLAND_TBM
+   e_comp_wl_tbm_shutdown();
+#endif
+
    /* shutdown ecore_wayland */
    ecore_wl_shutdown();
 }
old mode 100644 (file)
new mode 100755 (executable)
index 0f935f0..a54c9bb
@@ -248,6 +248,11 @@ struct _E_Comp_Wl_Data
         Eina_Bool scaler;
      } available_hw_accel;
 
+   struct
+     {
+        void *server;
+     } tbm;
+
    Eina_List *outputs;
 
    Ecore_Fd_Handler *fd_hdlr;
diff --git a/src/bin/e_comp_wl_tbm.c b/src/bin/e_comp_wl_tbm.c
new file mode 100755 (executable)
index 0000000..5616b5e
--- /dev/null
@@ -0,0 +1,67 @@
+#define E_COMP_WL
+#include "e.h"
+#include <Ecore_Drm.h>
+#include <wayland-tbm-server.h>
+
+EINTERN Eina_Bool
+e_comp_wl_tbm_init(void)
+{
+   struct wayland_tbm_server *tbm_server = NULL;
+   Eina_List *devs;
+   Ecore_Drm_Device *dev;
+   int drm_fd = -1;
+   const char *dev_name;
+
+   if (!e_comp)
+     {
+        e_error_message_show(_("Enlightenment cannot has no e_comp at Wayland TBM!\n"));
+        return EINA_FALSE;
+     }
+
+   EINA_SAFETY_ON_FALSE_RETURN_VAL(e_comp->wl_comp_data->wl.disp, EINA_FALSE);
+
+   if (e_comp->wl_comp_data->tbm.server)
+      return EINA_TRUE;
+
+   devs = ecore_drm_devices_get();
+   EINA_SAFETY_ON_NULL_RETURN_VAL(devs, EINA_FALSE);
+
+   dev = eina_list_nth(devs, 0);
+   EINA_SAFETY_ON_NULL_RETURN_VAL(dev, EINA_FALSE);
+
+   drm_fd = ecore_drm_device_fd_get(dev);
+   EINA_SAFETY_ON_FALSE_RETURN_VAL(drm_fd >= 0, EINA_FALSE);
+
+   dev_name = ecore_drm_device_name_get(dev);
+   EINA_SAFETY_ON_FALSE_RETURN_VAL(dev_name, EINA_FALSE);
+
+   tbm_server = wayland_tbm_server_init(e_comp->wl_comp_data->wl.disp, dev_name, drm_fd, 0);
+   if (!tbm_server)
+     {
+        e_error_message_show(_("Enlightenment cannot initialize a Wayland TBM!\n"));
+        return EINA_FALSE;
+     }
+
+   e_comp->wl_comp_data->tbm.server = (void *)tbm_server;
+
+   return EINA_TRUE;
+}
+
+EINTERN void
+e_comp_wl_tbm_shutdown(void)
+{
+   if (!e_comp)
+      return;
+
+   if (!e_comp->wl_comp_data)
+      return;
+
+   if (!e_comp->wl_comp_data->tbm.server)
+      return;
+
+   wayland_tbm_server_deinit((struct wayland_tbm_server *)e_comp->wl_comp_data->tbm.server);
+
+   e_comp->wl_comp_data->tbm.server = NULL;
+}
+
+
diff --git a/src/bin/e_comp_wl_tbm.h b/src/bin/e_comp_wl_tbm.h
new file mode 100644 (file)
index 0000000..833d323
--- /dev/null
@@ -0,0 +1,11 @@
+#ifdef E_TYPEDEFS
+
+#else
+# ifndef E_COMP_WL_TBM_H
+#  define E_COMP_WL_TBM_H
+
+EINTERN Eina_Bool e_comp_wl_tbm_init(void);
+EINTERN void e_comp_wl_tbm_shutdown(void);
+
+# endif
+#endif
old mode 100644 (file)
new mode 100755 (executable)
index cc0bc03..e9fefd2
 # include "e_comp_wl_input.h"
 # include "e_uuid_store.h"
 # include "e_drm_buffer_pool.h"
+#ifdef HAVE_WAYLAND_TBM
+# include "e_comp_wl_tbm.h"
+#endif
 #endif