From: huiyu.eun Date: Mon, 2 Jan 2017 10:12:02 +0000 (+0900) Subject: [SDL_Tizen] Add pre-rotation environment variable X-Git-Tag: accepted/tizen/unified/20170407.190801~13 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F16%2F108016%2F2;p=platform%2Fupstream%2FSDL.git [SDL_Tizen] Add pre-rotation environment variable Add pre-rotation environment variable. If you want to change pre-rotation option, add environment variable below. path : in /etc/profile.d/*.sh file export SDL_ROTATION=normal or pre_rotation Change-Id: Icf4abaae95bd083fd6ddf4fe722a0df8ed8ce488 Signed-off-by: huiyu.eun --- diff --git a/src/video/tizen/SDL_tizenwindow.c b/src/video/tizen/SDL_tizenwindow.c index 608bb74..a831a90 100755 --- a/src/video/tizen/SDL_tizenwindow.c +++ b/src/video/tizen/SDL_tizenwindow.c @@ -46,6 +46,11 @@ #include "../SDL_sysvideo.h" #include "../../events/SDL_windowevents_c.h" +enum { + ROTATION_TYPE_NORMAL_ROTATION = 0, + ROTATION_TYPE_PRE_ROTATION, /* use pre-rotation */ +}; + #define LOAD_FUNC(NAME) \ _this->tizen_pre_rotation_data->NAME = SDL_LoadFunction(_this->tizen_pre_rotation_data->prerotation_dll_handle, #NAME); \ if (!_this->tizen_pre_rotation_data->NAME) \ @@ -54,6 +59,30 @@ if (!_this->tizen_pre_rotation_data->NAME) \ return SDL_FALSE; \ } +static int +_tizen_rotation_type_get() +{ + static int type = ROTATION_TYPE_PRE_ROTATION; + static int checked = 0; + char *engine = NULL; + + if (checked) return type; + + engine = getenv("SDL_ROTATION"); + + if (engine) + { + if ((!strcasecmp(engine, "normal"))) + type = ROTATION_TYPE_NORMAL_ROTATION; + else if ((!strcasecmp(engine, "pre_rotation"))) + type = ROTATION_TYPE_PRE_ROTATION; + else + type = ROTATION_TYPE_PRE_ROTATION; + } + checked = 1; + return type; +} + int _tizen_PreRotatotion_LoadLibrary(SDL_WindowData *_this, const char *lib_path) { @@ -293,7 +322,7 @@ Tizen_CreateWindow(_THIS, SDL_Window *window) //Support PreRotation wind->support_pre_rotation = 0; - if (_tizen_PreRotatotion_LoadLibrary(wind, "libwayland-egl.so")) { + if (_tizen_rotation_type_get() && _tizen_PreRotatotion_LoadLibrary(wind, "libwayland-egl.so")) { if (wind->tizen_pre_rotation_data->wl_egl_window_get_capabilities(wind->egl_window) == TIZEN_WL_EGL_WINDOW_CAPABILITY_ROTATION_SUPPORTED ) { wind->support_pre_rotation = 1; }