[SDL_Tizen] Add wayland-egl-tizen 82/173982/1
authorhuiyu.eun <huiyu.eun@samsung.com>
Tue, 27 Mar 2018 08:37:24 +0000 (17:37 +0900)
committerhuiyu.eun <huiyu.eun@samsung.com>
Tue, 27 Mar 2018 09:00:17 +0000 (18:00 +0900)
Change-Id: I57a4e810f8892e2ef48203e99393397326986eb9
Signed-off-by: huiyu.eun <huiyu.eun@samsung.com>
configure
configure.in
packaging/SDL2.spec
src/video/tizen/SDL_tizenvideo.h
src/video/tizen/SDL_tizenwindow.c
src/video/tizen/SDL_tizenwindow.h

index 73b2156..dc4d026 100755 (executable)
--- a/configure
+++ b/configure
@@ -18943,9 +18943,9 @@ $as_echo_n "checking for Tizen support... " >&6; }
         if  test x$PKG_CONFIG != xno && \
             test x$video_opengl_egl = xyes && \
             test x$video_opengles_v2 = xyes; then
-            if $PKG_CONFIG --exists wayland-client wayland-egl ecore ecore-wl2 xdg-shell-client text-client tizen-extension-client eina elementary capi-appfw-application capi-system-system-settings ecore-input dlog ecore-imf libdrm ecore-ipc; then
-                TIZEN_CFLAGS=`$PKG_CONFIG --cflags wayland-client wayland-egl ecore ecore-wl2 xdg-shell-client text-client tizen-extension-client eina elementary capi-appfw-application capi-system-system-settings ecore-input dlog ecore-imf libdrm aul ecore-ipc`
-                TIZEN_LIBS=`$PKG_CONFIG --libs wayland-client wayland-egl ecore ecore-wl2 xdg-shell-client text-client tizen-extension-client eina elementary capi-appfw-application capi-system-system-settings ecore-input dlog ecore-imf libdrm aul ecore-ipc`
+            if $PKG_CONFIG --exists wayland-client wayland-egl wayland-egl-tizen ecore ecore-wl2 xdg-shell-client text-client tizen-extension-client eina elementary capi-appfw-application capi-system-system-settings ecore-input dlog ecore-imf libdrm ecore-ipc; then
+                TIZEN_CFLAGS=`$PKG_CONFIG --cflags wayland-client wayland-egl wayland-egl-tizen ecore ecore-wl2 xdg-shell-client text-client tizen-extension-client eina elementary capi-appfw-application capi-system-system-settings ecore-input dlog ecore-imf libdrm aul ecore-ipc`
+                TIZEN_LIBS=`$PKG_CONFIG --libs wayland-client wayland-egl wayland-egl-tizen ecore ecore-wl2 xdg-shell-client text-client tizen-extension-client eina elementary capi-appfw-application capi-system-system-settings ecore-input dlog ecore-imf libdrm aul ecore-ipc`
                 video_tizen=yes
             fi
         fi
index a5b9fc9..0d30343 100755 (executable)
@@ -1269,9 +1269,9 @@ CheckTizen()
         if  test x$PKG_CONFIG != xno && \
             test x$video_opengl_egl = xyes && \
             test x$video_opengles_v2 = xyes; then
-            if $PKG_CONFIG --exists wayland-client wayland-egl ecore ecore-wl2 xdg-shell-client text-client tizen-extension-client eina elementary capi-appfw-application capi-system-system-settings ecore-input dlog ecore-imf libdrm ecore-ipc; then
-                TIZEN_CFLAGS=`$PKG_CONFIG --cflags wayland-client wayland-egl ecore ecore-wl2 xdg-shell-client text-client tizen-extension-client eina elementary capi-appfw-application capi-system-system-settings ecore-input dlog ecore-imf libdrm aul ecore-ipc`
-                TIZEN_LIBS=`$PKG_CONFIG --libs wayland-client wayland-egl ecore ecore-wl2 xdg-shell-client text-client tizen-extension-client eina elementary capi-appfw-application capi-system-system-settings ecore-input dlog ecore-imf libdrm aul ecore-ipc`
+            if $PKG_CONFIG --exists wayland-client wayland-egl wayland-egl-tizen ecore ecore-wl2 xdg-shell-client text-client tizen-extension-client eina elementary capi-appfw-application capi-system-system-settings ecore-input dlog ecore-imf libdrm ecore-ipc; then
+                TIZEN_CFLAGS=`$PKG_CONFIG --cflags wayland-client wayland-egl wayland-egl-tizen ecore ecore-wl2 xdg-shell-client text-client tizen-extension-client eina elementary capi-appfw-application capi-system-system-settings ecore-input dlog ecore-imf libdrm aul ecore-ipc`
+                TIZEN_LIBS=`$PKG_CONFIG --libs wayland-client wayland-egl wayland-egl-tizen ecore ecore-wl2 xdg-shell-client text-client tizen-extension-client eina elementary capi-appfw-application capi-system-system-settings ecore-input dlog ecore-imf libdrm aul ecore-ipc`
                 video_tizen=yes
             fi
         fi
index 9f6c57d..3b520a3 100755 (executable)
@@ -23,6 +23,7 @@ BuildRequires:  pkgconfig(glesv2)
 BuildRequires:  pkgconfig(wayland-client)
 BuildRequires:  pkgconfig(wayland-cursor)
 BuildRequires:  pkgconfig(wayland-egl)
+BuildRequires:  pkgconfig(wayland-egl-tizen)
 BuildRequires:  pkgconfig(text-client)
 BuildRequires:  pkgconfig(tizen-extension-client)
 BuildRequires:  pkgconfig(tizen-remote-surface-client)
index f453fc1..56b7272 100755 (executable)
 #define EFL_BETA_API_SUPPORT
 #endif
 #include <Ecore_Wl2.h>
-#include <wayland-egl.h>
-
-typedef struct Tizen_Rotation_Data{
-    void *dll_handle;
-    int (*wl_egl_window_get_capabilities) (struct wl_egl_window *egl_window);
-    void (*wl_egl_window_set_rotation) (struct wl_egl_window *egl_window, int rotation);
-
-    void (*wl_egl_window_set_buffer_transform) (struct wl_egl_window *egl_window, int wl_output_transform);
-    void (*wl_egl_window_set_window_transform) (struct wl_egl_window *egl_window, int window_transform);
-
-} Tizen_Rotation_Data;
 
 typedef struct {
     struct wl_display *display;
     Ecore_Wl2_Display *wl2_display;
     Eina_Hash *windows;
-    Tizen_Rotation_Data tizen_rotation_data;
 
     int indicator_mode;
     int indicator_height;
index 1e1e8e1..1db81f8 100755 (executable)
 #include <Ecore_Ipc.h>
 #include <unistd.h>
 
-#define LOAD_FUNC(NAME) \
-_this->tizen_rotation_data.NAME = SDL_LoadFunction(_this->tizen_rotation_data.dll_handle, #NAME); \
-if (!_this->tizen_rotation_data.NAME) \
-{ \
-    SDL_LogError(SDL_LOG_CATEGORY_ASSERT, "Could not retrieve pre-rotation function " #NAME); \
-    return SDL_FALSE; \
-}
-
 /*SDL indicator*/
 Ecore_Ipc_Server *ipc = NULL;
 
@@ -264,48 +256,6 @@ _tizen_init_ecore_ipc()
     return 0;
 }
 
-int
-_tizen_Rotatotion_LoadLibrary(SDL_VideoData *_this, const char *lib_path)
-{
-    void *lib_dll_handle = NULL;
-    char *path = NULL;
-
-    if (_this->tizen_rotation_data.dll_handle
-        && _this->tizen_rotation_data.wl_egl_window_set_rotation
-        && _this->tizen_rotation_data.wl_egl_window_get_capabilities
-        && _this->tizen_rotation_data.wl_egl_window_set_buffer_transform
-        && _this->tizen_rotation_data.wl_egl_window_set_window_transform)
-        return SDL_TRUE;
-
-    _this->tizen_rotation_data.dll_handle = NULL;
-    _this->tizen_rotation_data.wl_egl_window_set_rotation = NULL;
-    _this->tizen_rotation_data.wl_egl_window_get_capabilities = NULL;
-
-    _this->tizen_rotation_data.wl_egl_window_set_buffer_transform = NULL;
-    _this->tizen_rotation_data.wl_egl_window_set_window_transform = NULL;
-
-    if (!lib_path)
-        lib_dll_handle = SDL_LoadObject(lib_path);
-
-    if (!lib_dll_handle) {
-        path = "libwayland-egl.so.1";
-        lib_dll_handle = SDL_LoadObject(path);
-    }
-
-    _this->tizen_rotation_data.dll_handle = lib_dll_handle;
-
-    if (lib_dll_handle == NULL)
-        return SDL_FALSE;
-
-    LOAD_FUNC(wl_egl_window_set_rotation);
-    LOAD_FUNC(wl_egl_window_get_capabilities);
-
-    LOAD_FUNC(wl_egl_window_set_buffer_transform);
-    LOAD_FUNC(wl_egl_window_set_window_transform);
-
-    return SDL_TRUE;
-}
-
 SDL_bool
 Tizen_GetWindowWMInfo(_THIS, SDL_Window *window, SDL_SysWMinfo *info)
 {
@@ -485,20 +435,15 @@ _tizen_rotation_do(SDL_Window *window, SDL_WindowData* wind, int rotation)
     {
         if(wind->support_pre_rotation)
         {
-            if(_this->tizen_rotation_data.wl_egl_window_set_rotation)
-                _this->tizen_rotation_data.wl_egl_window_set_rotation(wind->egl_window, 360 - rotation);
-            if(_this->tizen_rotation_data.wl_egl_window_set_buffer_transform)
-                _this->tizen_rotation_data.wl_egl_window_set_buffer_transform(wind->egl_window, _tizen_get_rotation_idx(rotation));
-             if(_this->tizen_rotation_data.wl_egl_window_set_window_transform)
-                _this->tizen_rotation_data.wl_egl_window_set_window_transform(wind->egl_window, _tizen_get_rotation_idx(wind->rotation));
+            wl_egl_window_tizen_set_rotation(wind->egl_window, 360 - rotation);
+            wl_egl_window_tizen_set_buffer_transform(wind->egl_window, _tizen_get_rotation_idx(rotation));
+            wl_egl_window_tizen_set_window_transform(wind->egl_window, _tizen_get_rotation_idx(wind->rotation));
         }
         else
         {
-                wl_egl_window_resize(wind->egl_window, window_w, window_h, 0, 0);
-                if(_this->tizen_rotation_data.wl_egl_window_set_buffer_transform)
-                    _this->tizen_rotation_data.wl_egl_window_set_buffer_transform(wind->egl_window, _tizen_get_rotation_idx((360 - wind->rotation)));
-                if(_this->tizen_rotation_data.wl_egl_window_set_window_transform)
-                    _this->tizen_rotation_data.wl_egl_window_set_window_transform(wind->egl_window, _tizen_get_rotation_idx(0));
+            wl_egl_window_resize(wind->egl_window, window_w, window_h, 0, 0);
+            wl_egl_window_tizen_set_buffer_transform(wind->egl_window, _tizen_get_rotation_idx((360 - wind->rotation)));
+            wl_egl_window_tizen_set_window_transform(wind->egl_window, _tizen_get_rotation_idx(0));
         }
     }
 #endif
@@ -777,16 +722,15 @@ Tizen_CreateWindow(_THIS, SDL_Window *window)
 
         //Support PreRotation
         wind->support_pre_rotation = 0;
-        if (_tizen_Rotatotion_LoadLibrary(data, "libwayland-egl.so.1")) {
-            if (data->tizen_rotation_data.wl_egl_window_get_capabilities(wind->egl_window) == TIZEN_WL_EGL_WINDOW_CAPABILITY_ROTATION_SUPPORTED ) {
-                wind->support_pre_rotation = 1;
-            }
+        if (wl_egl_window_tizen_get_capabilities(wind->egl_window) == WL_EGL_WINDOW_TIZEN_CAPABILITY_ROTATION_SUPPORTED ) {
+            wind->support_pre_rotation = 1;
         }
         else
         {
             wl_egl_window_resize(wind->egl_window, window->w, window->h, 0, 0);
         }
 
+
     }
 #endif
 
index 29dcadf..29d9cbb 100755 (executable)
@@ -31,6 +31,7 @@
 #include "SDL_tizenvideo.h"
 #include <Ecore_Input.h>
 #include <wayland-egl.h>
+#include <wayland-egl-tizen.h>
 
 typedef struct {
     uint32_t g_res_id;         /* Wayland window resource id */
@@ -52,20 +53,6 @@ typedef struct {
 
 } SDL_WindowData;
 
-enum tizen_wl_egl_window_capability {
-    TIZEN_WL_EGL_WINDOW_CAPABILITY_NONE = 0,
-    TIZEN_WL_EGL_WINDOW_CAPABILITY_ROTATION_SUPPORTED = (1 << 0),
-    TIZEN_WL_EGL_WINDOW_CAPABILITY_ROTATION_UNSUPPORTED = (1 << 1),
-    TIZEN_WL_EGL_WINDOW_CAPABILITY_ROTATION_UNKNOWN = (1 << 2),
-};
-
-typedef enum {
-    TIZEN_ROTATION_0 = 0,
-    TIZEN_ROTATION_90 = 90,
-    TIZEN_ROTATION_180 = 180,
-    TIZEN_ROTATION_270 = 270
-} tizen_wl_egl_window_rotation;
-
 enum tizen_rotation_received_type {
     TIZEN_ROTATION_RECEIVED_NONE = 0,
     TIZEN_ROTATION_RECEIVED_SCREEN_ROTATION = 1,