From 4e887eb12fbe4d35dc3f8a62cb4526415ff61364 Mon Sep 17 00:00:00 2001 From: "huiyu.eun" Date: Mon, 16 Jan 2017 12:58:27 +0900 Subject: [PATCH] [SDL_Tizen] Remove remote surface indicator remove remote surface indicator Change-Id: Id5e96f0c0987ce9f34935ddb7b0e1fa97fb1f6e3 Signed-off-by: huiyu.eun --- doc/sdl-tizen_docs.h | 5 +- src/video/tizen/SDL_ecore_ipc.c | 4 - src/video/tizen/SDL_ecore_ipc.h | 8 -- src/video/tizen/SDL_tizenindicator.c | 147 ----------------------------------- src/video/tizen/SDL_tizenindicator.h | 4 - 5 files changed, 2 insertions(+), 166 deletions(-) diff --git a/doc/sdl-tizen_docs.h b/doc/sdl-tizen_docs.h index 0d95136..f8378ee 100644 --- a/doc/sdl-tizen_docs.h +++ b/doc/sdl-tizen_docs.h @@ -1,20 +1,19 @@ /** * @defgroup CAPI_SDL_TIZEN_MODULE SDL Tizen - * @brief SDL is for OpenGL ES, Vulkan applications in Tizen. + * @brief SDL is for Vulkan applications in Tizen. * @ingroup OPENSRC_SDL_FRAMEWORK * * @section CAPI_SDL_TIZEN_MODULE_HEADER Required Header * \#include * * @section CAPI_SDL_TIZEN_MODULE_OVERVIEW Overview - * In Tizen, SDL can use OpenGL ES, Vulkan APIs directly. + * In Tizen, SDL can use Vulkan APIs directly. * * Remarks :\n * - 5 event types are added for Tizen application framework.\n * @remarks #SDL_APP_CONTROL\n * #SDL_APP_LOWBATTERY\n * #SDL_APP_LANGUAGE_CHANGED\n - * #SDL_APP_REGION_CHANGED\n * #SDL_ROTATEEVENT\n * - 2 functions are added for Vulkan.\n * @remarks #SDL_Vulkan_GetInstanceExtensions\n diff --git a/src/video/tizen/SDL_ecore_ipc.c b/src/video/tizen/SDL_ecore_ipc.c index 8a7edfe..328ecd9 100755 --- a/src/video/tizen/SDL_ecore_ipc.c +++ b/src/video/tizen/SDL_ecore_ipc.c @@ -195,10 +195,6 @@ void DataReceived(void* event, SharedIndicatorInfo* shared_info) } case OP_GL_REF: { - if (Tizen_remote_surface_init()) - { - Tizen_remote_indicator(epcEvent->ref); - } break; } case OP_RESIZE: diff --git a/src/video/tizen/SDL_ecore_ipc.h b/src/video/tizen/SDL_ecore_ipc.h index cd00840..3a22e67 100755 --- a/src/video/tizen/SDL_ecore_ipc.h +++ b/src/video/tizen/SDL_ecore_ipc.h @@ -61,14 +61,6 @@ typedef struct typedef struct { SharedFileInfo fileInfo[2]; - - /* for tizen remote manager */ - struct tizen_remote_surface_manager *tizen_rsm; - struct tizen_remote_surface *tizen_rs; - struct wayland_tbm_client *tbm_client; - struct wl_tbm *wl_tbm; - - void* eglImage_Indicator; int cur_idx; }SharedIndicatorInfo; diff --git a/src/video/tizen/SDL_tizenindicator.c b/src/video/tizen/SDL_tizenindicator.c index c2554a2..37e8fe0 100644 --- a/src/video/tizen/SDL_tizenindicator.c +++ b/src/video/tizen/SDL_tizenindicator.c @@ -98,10 +98,6 @@ GLfloat vCoord[12] = { 0.0f, 1.0f }; -PFNEGLCREATEIMAGEKHRPROC eglCreateImageKHR = NULL; -PFNEGLDESTROYIMAGEKHRPROC eglDestroyImageKHR = NULL; -PFNGLEGLIMAGETARGETTEXTURE2DOESPROC glEGLImageTargetTexture2DOES = NULL; - SharedIndicatorInfo shared_info; GLuint textureID; GLuint indicator_vbo, indicator_ibo; @@ -495,15 +491,6 @@ int Tizen_FiniIndicator() for (n=0; n < SHARED_FILE_NUMBER; n++) Tizen_Indicator_SharedFile_Free(&shared_info, n); - if(shared_info.eglImage_Indicator != NULL) - eglDestroyImageKHR(SDL_GetVideoDevice()->egl_data->egl_display, shared_info.eglImage_Indicator); - - if (shared_info.tizen_rs) - tizen_remote_surface_destroy(shared_info.tizen_rs); - if (shared_info.tbm_client) - wayland_tbm_client_deinit(shared_info.tbm_client); - if (shared_info.tizen_rsm) - tizen_remote_surface_manager_destroy(shared_info.tizen_rsm); GLES2_Context Mainctx; LoadContext(&Mainctx); @@ -511,139 +498,5 @@ int Tizen_FiniIndicator() return SDL_TRUE; } -SDL_bool Tizen_remote_surface_init(void) -{ - Eina_Inlist *globals; - Ecore_Wl_Global *global; - struct wl_registry *registry; - if (!shared_info.tizen_rsm) - { - registry = ecore_wl_registry_get(); - globals = ecore_wl_globals_get(); - - if (!registry || !globals) - { - SDL_Log( "Could not get registry(%p) or global list(%p)\n", registry, globals); - return SDL_FALSE; - } - - EINA_INLIST_FOREACH(globals, global) - { - if (!strcmp(global->interface, "tizen_remote_surface_manager")) - { - shared_info.tizen_rsm = wl_registry_bind(registry, global->id, - &tizen_remote_surface_manager_interface, global->version<2? global->version : 2); - SDL_Log("[SDL] Create tizen_rsm : %p",shared_info.tizen_rsm); - } - } - shared_info.tizen_rs = NULL; - } - if (!shared_info.tizen_rsm) - { - SDL_Log("Could not bind tizen_remote_surface_manager"); - return SDL_FALSE; - } - - if(!shared_info.tbm_client) - { - shared_info.tbm_client = (struct wayland_tbm_client *)wayland_tbm_client_init(ecore_wl_display_get()); - shared_info.wl_tbm = (struct wl_tbm *)wayland_tbm_client_get_wl_tbm(shared_info.tbm_client); - if (!shared_info.wl_tbm) - { - SDL_Log("[SDL]wl_tbm is NULL"); - return SDL_FALSE; - } - } - - eglCreateImageKHR = (PFNEGLCREATEIMAGEKHRPROC)SDL_GetVideoDevice()->egl_data->eglGetProcAddress("eglCreateImageKHR"); - eglDestroyImageKHR = (PFNEGLDESTROYIMAGEKHRPROC)SDL_GetVideoDevice()->egl_data->eglGetProcAddress("eglDestroyImageKHR"); - glEGLImageTargetTexture2DOES = (PFNGLEGLIMAGETARGETTEXTURE2DOESPROC)SDL_GetVideoDevice()->egl_data->eglGetProcAddress("glEGLImageTargetTexture2DOES"); - - return SDL_TRUE; -} - -struct wl_buffer *pre_buffer; //pre_buffer for tizen remote surface - -static void -_tizen_rs_cb_buffer_update(void *data, struct tizen_remote_surface *trs, struct wl_buffer *buffer, uint32_t time) -{ - tizen_remote_surface_transfer_visibility(trs, TIZEN_REMOTE_SURFACE_VISIBILITY_TYPE_VISIBLE); - tbm_surface_h tbmSurface= wl_buffer_get_user_data(buffer); - if(eglCreateImageKHR != NULL && glEGLImageTargetTexture2DOES != NULL && eglDestroyImageKHR != NULL) - { - SDL_VideoDevice *_this = SDL_GetVideoDevice(); - - if(shared_info.eglImage_Indicator != NULL) - eglDestroyImageKHR(_this->egl_data->egl_display, shared_info.eglImage_Indicator); - - shared_info.eglImage_Indicator = eglCreateImageKHR(_this->egl_data->egl_display, - EGL_NO_CONTEXT, EGL_NATIVE_SURFACE_TIZEN, tbmSurface, NULL); - - if(shared_info.eglImage_Indicator == NULL) - { - SDL_Log("[SDL] eglImage is NULL"); - return; - } - SDL_Log("[SDL] eglImage : %p", shared_info.eglImage_Indicator); - glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, shared_info.eglImage_Indicator); - } - else - { - tbm_surface_info_s info; - tbm_surface_map(tbmSurface, TBM_SURF_OPTION_WRITE|TBM_SURF_OPTION_READ, &info); - - SDL_Log("[SDL] Buffer Update %p %p (%dx%d), format:%d", buffer, tbmSurface, info.width, info.height, info.format); - SDL_Log("[SDL] Info size:%d, offset:%d, stride:%d", info.planes[0].size, info.planes[0].offset, info.planes[0].stride); - - GLES2_Context Mainctx; - LoadContext(&Mainctx); - - Mainctx.glActiveTexture(GL_TEXTURE0); - - Mainctx.glBindTexture(GL_TEXTURE_2D, textureID); - Mainctx.glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, info.planes[0].stride/4, info.height, 0, GL_RGBA, GL_UNSIGNED_BYTE, (unsigned int*)info.planes[0].ptr); - - if (tbm_surface_unmap (tbmSurface) != TBM_SURFACE_ERROR_NONE) - SDL_Log("Failed to unmap tbm_surface\n"); - } - - if( pre_buffer) - { - if (tizen_remote_surface_get_version(trs) >= TIZEN_REMOTE_SURFACE_RELEASE_SINCE_VERSION) - tizen_remote_surface_release(trs, pre_buffer); - } - pre_buffer = buffer; - - if (tbm_surface_destroy (tbmSurface) != TBM_SURFACE_ERROR_NONE) - SDL_Log("Failed to destroy tbm_surface\n"); - -} - -static void -_tizen_rs_cb_missing(void *data, struct tizen_remote_surface *trs) -{ - SDL_Log("Plug is missing...! "); -} - -static const struct tizen_remote_surface_listener _extn_gl_plug_listener = -{ - _tizen_rs_cb_buffer_update, - _tizen_rs_cb_missing, -}; - -void Tizen_remote_indicator(int res_id) -{ - if(!shared_info.tizen_rs) { - //create tizen_remote_surface - shared_info.tizen_rs = tizen_remote_surface_manager_create_surface(shared_info.tizen_rsm, res_id, shared_info.wl_tbm); - if(!shared_info.tizen_rs) - { - SDL_Log("tizen_rs is NULL"); - return; - } - tizen_remote_surface_add_listener(shared_info.tizen_rs, &_extn_gl_plug_listener, NULL); - tizen_remote_surface_redirect(shared_info.tizen_rs); - } -} #endif /* SDL_VIDEO_DRIVER_TIZEN && SDL_VIDEO_OPENGL_EGL */ diff --git a/src/video/tizen/SDL_tizenindicator.h b/src/video/tizen/SDL_tizenindicator.h index 2c6fb04..4fa15ea 100644 --- a/src/video/tizen/SDL_tizenindicator.h +++ b/src/video/tizen/SDL_tizenindicator.h @@ -42,10 +42,6 @@ extern int Tizen_FiniIndicator(void); extern void Tizen_DrawIndicator(SDL_Window *window); extern void Tizen_IndicatorProcessEvent(SDL_Window* window, int rot); -/* Tizen remote-surface indicator */ -extern SDL_bool Tizen_remote_surface_init(void); -extern void Tizen_remote_indicator(int res_id); - #endif -- 2.7.4