From 2abe7d6fb5819042d36e8f02328ad113eb8b449f Mon Sep 17 00:00:00 2001 From: Jeongmo Yang Date: Wed, 15 Nov 2017 17:43:07 +0900 Subject: [PATCH] Remove dependency of display related packages.(evas, wayland) [Version] 0.4.0 [Profile] Common [Issue Type] Update [Dependency module] mmsvc-camera, libmm-camcorder [Test] [M(T) - Boot=(OK), sdb=(OK), Home=(OK), Touch=(OK), Version=tizen-unified_20171122.1] Change-Id: Ie59b04c3625ca5aaa0152beed60e656578534aa1 Signed-off-by: Jeongmo Yang --- CMakeLists.txt | 12 +- include/camera_private.h | 13 +- packaging/capi-media-camera.spec | 16 +- src/camera.c | 451 +++++---------------------------------- 4 files changed, 67 insertions(+), 425 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1f068d8..186aa94 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,12 +9,8 @@ SET(service "media") SET(submodule "camera") # for package file -IF(TIZEN_FEATURE_EVAS_RENDERER) -SET(dependents "glib-2.0 gio-2.0 libtbm dlog mm-common capi-base-common capi-media-tool ecore elementary mmsvc-camera tizen-extension-client mm-evas-renderer muse-client") -ELSE(TIZEN_FEATURE_EVAS_RENDERER) -SET(dependents "glib-2.0 gio-2.0 libtbm dlog mm-common capi-base-common capi-media-tool ecore elementary mmsvc-camera tizen-extension-client muse-client") -ENDIF(TIZEN_FEATURE_EVAS_RENDERER) -SET(pc_dependents "capi-base-common capi-media-tool libtbm evas ecore elementary") +SET(dependents "glib-2.0 gio-2.0 libtbm dlog mm-common capi-base-common capi-media-tool mmsvc-camera muse-client mm-display-interface") +SET(pc_dependents "capi-base-common capi-media-tool") SET(fw_name "${project_prefix}-${service}-${submodule}") PROJECT(${fw_name}) @@ -38,10 +34,6 @@ IF("${ARCH}" STREQUAL "arm") ADD_DEFINITIONS("-DTARGET") ENDIF("${ARCH}" STREQUAL "arm") -IF(TIZEN_FEATURE_EVAS_RENDERER) - ADD_DEFINITIONS("-DTIZEN_FEATURE_EVAS_RENDERER") -ENDIF(TIZEN_FEATURE_EVAS_RENDERER) - ADD_DEFINITIONS("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"") ADD_DEFINITIONS("-DTIZEN_DEBUG") diff --git a/include/camera_private.h b/include/camera_private.h index 9204df5..e419ec2 100644 --- a/include/camera_private.h +++ b/include/camera_private.h @@ -24,6 +24,7 @@ #include #include #include +#include #ifdef __cplusplus extern "C" { @@ -142,6 +143,9 @@ typedef struct _camera_cb_info_s { /* tbm */ tbm_bufmgr bufmgr; + /* wayland */ + int parent_id; + /* media packet */ media_format_h pkt_fmt; GMutex mp_data_mutex; @@ -149,11 +153,8 @@ typedef struct _camera_cb_info_s { /* preview callback flag */ int preview_cb_flag; - /* evas surface */ -#ifdef TIZEN_FEATURE_EVAS_RENDERER - void *evas_info; - GMutex evas_mutex; -#endif /* TIZEN_FEATURE_EVAS_RENDERER */ + /* display interface handle */ + mm_display_interface_h dp_interface; gboolean run_evas_render; /* get values */ @@ -188,9 +189,7 @@ typedef struct _camera_wl_info_s { typedef struct _camera_cli_s { intptr_t remote_handle; - intptr_t display_handle; camera_cb_info_s *cb_info; - camera_wl_info_s wl_info; } camera_cli_s; typedef struct _camera_media_packet_data { diff --git a/packaging/capi-media-camera.spec b/packaging/capi-media-camera.spec index 8980018..080c3bb 100644 --- a/packaging/capi-media-camera.spec +++ b/packaging/capi-media-camera.spec @@ -1,6 +1,6 @@ Name: capi-media-camera Summary: A Camera API -Version: 0.3.12 +Version: 0.4.0 Release: 0 Group: Multimedia/API License: Apache-2.0 @@ -11,20 +11,16 @@ BuildRequires: pkgconfig(glib-2.0) BuildRequires: pkgconfig(gio-2.0) BuildRequires: pkgconfig(muse-client) BuildRequires: pkgconfig(mm-common) +BuildRequires: pkgconfig(mm-display-interface) BuildRequires: pkgconfig(capi-base-common) BuildRequires: pkgconfig(mmsvc-camera) +BuildRequires: pkgconfig(capi-media-tool) +BuildRequires: pkgconfig(libtbm) +%if "%{TIZEN_PRODUCT_TV}" != "1" BuildRequires: pkgconfig(appcore-efl) BuildRequires: pkgconfig(elementary) BuildRequires: pkgconfig(ecore) BuildRequires: pkgconfig(evas) -BuildRequires: pkgconfig(capi-media-tool) -%if %{with wayland} -BuildRequires: pkgconfig(ecore-wayland) -%endif -BuildRequires: pkgconfig(libtbm) -BuildRequires: pkgconfig(tizen-extension-client) -%if "%{TIZEN_PRODUCT_TV}" != "1" -BuildRequires: pkgconfig(mm-evas-renderer) %endif Requires(post): /sbin/ldconfig @@ -58,10 +54,8 @@ export CFLAGS+=" -DTIZEN_DEBUG_ENABLE" MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'` %cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} -DFULLVER=%{version} -DMAJORVER=${MAJORVER} \ %if "%{TIZEN_PRODUCT_TV}" != "1" - -DTIZEN_FEATURE_EVAS_RENDERER=On \ -DTIZEN_FEATURE_TESTSUITE=On %else - -DTIZEN_FEATURE_EVAS_RENDERER=Off \ -DTIZEN_FEATURE_TESTSUITE=Off %endif diff --git a/src/camera.c b/src/camera.c index 07e90bd..8e20932 100644 --- a/src/camera.c +++ b/src/camera.c @@ -27,15 +27,7 @@ #include #include #include -#include #include -#include -#include -#include -#include -#ifdef TIZEN_FEATURE_EVAS_RENDERER -#include -#endif /* TIZEN_FEATURE_EVAS_RENDERER */ #include #ifdef LOG_TAG @@ -65,217 +57,6 @@ static int _camera_media_packet_data_create(int tbm_key, int num_buffer_key, tbm static void _camera_media_packet_data_release(camera_media_packet_data *mp_data, camera_cb_info_s *cb_info); -static void __global(void *data, struct wl_registry *registry, - uint32_t name, const char *interface, uint32_t version) -{ - struct tizen_surface **tz_surface = NULL; - - if (!data) { - LOGE("NULL data"); - return; - } - - tz_surface = (struct tizen_surface **)data; - - if (!interface) { - LOGW("NULL interface"); - return; - } - - /*LOGI("interface %s", interface);*/ - - if (strcmp(interface, "tizen_surface") == 0) { - LOGD("binding tizen surface for wayland"); - - *tz_surface = wl_registry_bind(registry, name, &tizen_surface_interface, version); - if (*tz_surface == NULL) - LOGE("failed to bind"); - - LOGD("done"); - } - - return; -} - -static void __global_remove(void *data, struct wl_registry *wl_registry, uint32_t name) -{ - LOGD("enter"); - return; -} - -static const struct wl_registry_listener _camera_wl_registry_listener = { - __global, - __global_remove -}; - -void __parent_id_getter(void *data, struct tizen_resource *tizen_resource, uint32_t id) -{ - if (!data) { - LOGE("NULL data"); - return; - } - - *((unsigned int *)data) = id; - - LOGD("[CLIENT] got parent_id [%u] from server", id); - - return; -} - -static const struct tizen_resource_listener _camera_tz_resource_listener = { - __parent_id_getter -}; - -int _camera_get_wl_info(Evas_Object *obj, camera_wl_info_s *wl_info) -{ - int ret = CAMERA_ERROR_NONE; - Ecore_Wl_Window *window = NULL; - struct wl_display *display = NULL; - struct wl_display *display_wrapper = NULL; - struct wl_surface *surface = NULL; - struct wl_registry *registry = NULL; - struct wl_event_queue *queue = NULL; - struct tizen_surface *tz_surface = NULL; - struct tizen_resource *tz_resource = NULL; - - if (!obj || !wl_info) { - LOGE("NULL parameter %p %p", obj, wl_info); - return CAMERA_ERROR_INVALID_OPERATION; - } - - window = elm_win_wl_window_get(obj); - if (!window) { - LOGE("failed to get wayland window"); - ret = CAMERA_ERROR_INVALID_OPERATION; - goto _DONE; - } - - ecore_wl_window_video_has(window, EINA_TRUE); - - surface = (struct wl_surface *)ecore_wl_window_surface_get(window); - if (!surface) { - LOGE("failed to get wayland surface"); - ret = CAMERA_ERROR_INVALID_OPERATION; - goto _DONE; - } - - display = (struct wl_display *)ecore_wl_display_get(); - if (!display) { - LOGE("failed to get wayland display"); - ret = CAMERA_ERROR_INVALID_OPERATION; - goto _DONE; - } - - display_wrapper = wl_proxy_create_wrapper(display); - if (!display_wrapper) { - LOGE("failed to create wl display wrapper"); - ret = CAMERA_ERROR_INVALID_OPERATION; - goto _DONE; - } - - queue = wl_display_create_queue(display); - if (!queue) { - LOGE("failed to create wl display queue"); - ret = CAMERA_ERROR_INVALID_OPERATION; - goto _DONE; - } - - wl_proxy_set_queue((struct wl_proxy *)display_wrapper, queue); - - registry = wl_display_get_registry(display_wrapper); - if (!registry) { - LOGE("failed to get wayland registry"); - ret = CAMERA_ERROR_INVALID_OPERATION; - goto _DONE; - } - - wl_registry_add_listener(registry, &_camera_wl_registry_listener, &tz_surface); - - wl_display_dispatch_queue(display, queue); - wl_display_roundtrip_queue(display, queue); - - if (!tz_surface) { - LOGE("failed to get tizen surface"); - ret = CAMERA_ERROR_INVALID_OPERATION; - goto _DONE; - } - - /* Get parent_id which is unique in a entire systemw. */ - tz_resource = tizen_surface_get_tizen_resource(tz_surface, surface); - if (!tz_resource) { - LOGE("failed to get tizen resurce"); - ret = CAMERA_ERROR_INVALID_OPERATION; - goto _DONE; - } - - wl_info->parent_id = 0; - - tizen_resource_add_listener(tz_resource, &_camera_tz_resource_listener, &wl_info->parent_id); - - wl_display_roundtrip_queue(display, queue); - - if (wl_info->parent_id > 0) { - int rotation = 0; - Ecore_Evas *ecore_evas = NULL; - ret = CAMERA_ERROR_NONE; - - evas_object_geometry_get(obj, &wl_info->window_x, &wl_info->window_y, - &wl_info->window_width, &wl_info->window_height); - - ecore_evas = ecore_evas_ecore_evas_get(evas_object_evas_get(obj)); - if (ecore_evas) { - rotation = ecore_evas_rotation_get(ecore_evas); - if (rotation == 90 || rotation == 270) { - int temp = wl_info->window_width; - - LOGD("swap width and height %d, %d", wl_info->window_width, wl_info->window_height); - - wl_info->window_width = wl_info->window_height; - wl_info->window_height = temp; - } - } else { - LOGW("failed to get ecore_evas.. skip rotation check"); - } - - LOGD("evas object : %p, rotation : %d, parent id : %u, window : %d,%d,%dx%d", - obj, rotation, wl_info->parent_id, - wl_info->window_x, wl_info->window_y, - wl_info->window_width, wl_info->window_height); - } else { - ret = CAMERA_ERROR_INVALID_OPERATION; - LOGE("failed to get parent id"); - } - -_DONE: - if (tz_surface) { - tizen_surface_destroy(tz_surface); - tz_surface = NULL; - } - - if (tz_resource) { - tizen_resource_destroy(tz_resource); - tz_resource = NULL; - } - - if (registry) { - wl_registry_destroy(registry); - registry = NULL; - } - - if (queue) { - wl_event_queue_destroy(queue); - queue = NULL; - } - - if (display_wrapper) { - wl_proxy_wrapper_destroy(display_wrapper); - display_wrapper = NULL; - } - - return ret; -} - - static void __camera_update_api_waiting(camera_cb_info_s *cb_info, int api, int value) { if (!cb_info || @@ -367,9 +148,7 @@ static void __camera_event_handler_preview(camera_cb_info_s *cb_info, char *recv camera_stream_data_s *stream = NULL; camera_media_packet_data *mp_data = NULL; media_packet_h pkt = NULL; -#ifdef TIZEN_FEATURE_EVAS_RENDERER media_packet_h pkt_evas = NULL; -#endif /* TIZEN_FEATURE_EVAS_RENDERER */ if (!cb_info || !recv_msg) { LOGE("invalid param %p %p", cb_info, recv_msg); @@ -431,7 +210,6 @@ static void __camera_event_handler_preview(camera_cb_info_s *cb_info, char *recv } if (CHECK_PREVIEW_CB(cb_info, PREVIEW_CB_TYPE_EVAS)) { -#ifdef TIZEN_FEATURE_EVAS_RENDERER ret = _camera_media_packet_data_create(tbm_key, num_buffer_key, bo, buffer_bo, data_bo, &mp_data); if (ret == CAMERA_ERROR_NONE) { @@ -442,9 +220,6 @@ static void __camera_event_handler_preview(camera_cb_info_s *cb_info, char *recv mp_data = NULL; } } -#else /* TIZEN_FEATURE_EVAS_RENDERER */ - LOGW("evas renderer is not supported"); -#endif /* TIZEN_FEATURE_EVAS_RENDERER */ } /* call media packet callback */ @@ -464,20 +239,16 @@ static void __camera_event_handler_preview(camera_cb_info_s *cb_info, char *recv } } -#ifdef TIZEN_FEATURE_EVAS_RENDERER /* call evas renderer */ if (pkt_evas) { - g_mutex_lock(&cb_info->evas_mutex); if (cb_info->run_evas_render) { - mm_evas_renderer_write(pkt_evas, cb_info->evas_info); + mm_display_interface_evas_render(cb_info->dp_interface, pkt_evas); } else { LOGW("evas renderer is stopped, skip this buffer..."); media_packet_destroy(pkt_evas); } pkt_evas = NULL; - g_mutex_unlock(&cb_info->evas_mutex); } -#endif /* TIZEN_FEATURE_EVAS_RENDERER */ /* send message for preview callback return */ if (!CHECK_PREVIEW_CB(cb_info, PREVIEW_CB_TYPE_EVAS)) @@ -2297,6 +2068,12 @@ static camera_cb_info_s *_camera_client_callback_new(gint sockfd) goto ErrorExit; } + /* display interface handle */ + if (mm_display_interface_init(&cb_info->dp_interface) != MM_ERROR_NONE) { + LOGE("display interface init failed"); + goto ErrorExit; + } + cb_info->api_waiting[MUSE_CAMERA_API_CREATE] = 1; for (i = 0 ; i < MUSE_CAMERA_API_MAX ; i++) { @@ -2308,9 +2085,6 @@ static camera_cb_info_s *_camera_client_callback_new(gint sockfd) g_mutex_init(&cb_info->idle_event_mutex); g_cond_init(&cb_info->idle_event_cond); g_mutex_init(&cb_info->mp_data_mutex); -#ifdef TIZEN_FEATURE_EVAS_RENDERER - g_mutex_init(&cb_info->evas_mutex); -#endif /* TIZEN_FEATURE_EVAS_RENDERER */ for (i = 0 ; i < MUSE_CAMERA_EVENT_TYPE_NUM ; i++) g_mutex_init(&cb_info->user_cb_mutex[i]); @@ -2338,9 +2112,6 @@ static camera_cb_info_s *_camera_client_callback_new(gint sockfd) cb_info->fd = sockfd; cb_info->preview_cb_flag = 0; -#ifdef TIZEN_FEATURE_EVAS_RENDERER - cb_info->evas_info = NULL; -#endif /* TIZEN_FEATURE_EVAS_RENDERER */ /* message receive thread */ g_atomic_int_set(&cb_info->msg_recv_running, 1); @@ -2368,15 +2139,17 @@ ErrorExit: g_mutex_clear(&cb_info->idle_event_mutex); g_cond_clear(&cb_info->idle_event_cond); g_mutex_clear(&cb_info->mp_data_mutex); -#ifdef TIZEN_FEATURE_EVAS_RENDERER - g_mutex_clear(&cb_info->evas_mutex); -#endif /* TIZEN_FEATURE_EVAS_RENDERER */ for (i = 0 ; i < MUSE_CAMERA_API_MAX ; i++) { g_mutex_clear(&cb_info->api_mutex[i]); g_cond_clear(&cb_info->api_cond[i]); } + if (cb_info->dp_interface) { + mm_display_interface_deinit(cb_info->dp_interface); + cb_info->dp_interface = NULL; + } + g_free(cb_info); cb_info = NULL; } @@ -2409,9 +2182,6 @@ static void _camera_client_callback_destroy(camera_cb_info_s *cb_info) g_mutex_clear(&cb_info->idle_event_mutex); g_cond_clear(&cb_info->idle_event_cond); g_mutex_clear(&cb_info->mp_data_mutex); -#ifdef TIZEN_FEATURE_EVAS_RENDERER - g_mutex_clear(&cb_info->evas_mutex); -#endif /* TIZEN_FEATURE_EVAS_RENDERER */ for (i = 0 ; i < MUSE_CAMERA_API_MAX ; i++) { g_mutex_clear(&cb_info->api_mutex[i]); @@ -2432,10 +2202,10 @@ static void _camera_client_callback_destroy(camera_cb_info_s *cb_info) cb_info->pkt_fmt = NULL; } -#ifdef TIZEN_FEATURE_EVAS_RENDERER - if (cb_info->evas_info) - mm_evas_renderer_destroy(&cb_info->evas_info); -#endif /* TIZEN_FEATURE_EVAS_RENDERER */ + if (cb_info->dp_interface) { + mm_display_interface_deinit(cb_info->dp_interface); + cb_info->dp_interface = NULL; + } cb_info->preview_cb_flag = 0; @@ -2448,7 +2218,6 @@ static void _camera_client_callback_destroy(camera_cb_info_s *cb_info) int _camera_start_evas_rendering(camera_h camera) { - int ret = CAMERA_ERROR_NONE; camera_cli_s *pc = (camera_cli_s *)camera; if (!pc || !pc->cb_info) { @@ -2463,20 +2232,10 @@ int _camera_start_evas_rendering(camera_h camera) return CAMERA_ERROR_NONE; } -#ifdef TIZEN_FEATURE_EVAS_RENDERER - g_mutex_lock(&pc->cb_info->evas_mutex); - /* set evas render flag as RUN */ pc->cb_info->run_evas_render = true; - ret = CAMERA_ERROR_NONE; - - g_mutex_unlock(&pc->cb_info->evas_mutex); -#else /* TIZEN_FEATURE_EVAS_RENDERER */ - LOGW("evas renderer is not supported"); - ret = CAMERA_ERROR_NOT_SUPPORTED; -#endif /* TIZEN_FEATURE_EVAS_RENDERER */ - return ret; + return CAMERA_ERROR_NONE; } @@ -2497,24 +2256,17 @@ int _camera_stop_evas_rendering(camera_h camera, bool keep_screen) return CAMERA_ERROR_NONE; } -#ifdef TIZEN_FEATURE_EVAS_RENDERER - g_mutex_lock(&pc->cb_info->evas_mutex); - /* set evas render flag as STOP and release buffers */ pc->cb_info->run_evas_render = false; - ret = mm_evas_renderer_retrieve_all_packets(pc->cb_info->evas_info, keep_screen); - if (ret != MM_ERROR_NONE) { + ret = mm_display_interface_evas_flush(pc->cb_info->dp_interface, keep_screen); + if (ret == MM_ERROR_NONE) { + ret = CAMERA_ERROR_NONE; + } else { LOGE("mm_evas_renderer_retrieve_all_packets failed 0x%x", ret); ret = CAMERA_ERROR_INVALID_OPERATION; } - g_mutex_unlock(&pc->cb_info->evas_mutex); -#else /* TIZEN_FEATURE_EVAS_RENDERER */ - LOGW("evas renderer is not supported"); - ret = CAMERA_ERROR_NOT_SUPPORTED; -#endif /* TIZEN_FEATURE_EVAS_RENDERER */ - return ret; } @@ -3186,9 +2938,6 @@ int camera_cancel_focusing(camera_h camera) int camera_set_display(camera_h camera, camera_display_type_e type, camera_display_h display) { int ret = CAMERA_ERROR_NONE; - void *set_display_handle = NULL; - Evas_Object *obj = NULL; - const char *object_type = NULL; camera_cli_s *pc = (camera_cli_s *)camera; camera_cb_info_s *cb_info = NULL; muse_camera_api_e api = MUSE_CAMERA_API_SET_DISPLAY; @@ -3228,91 +2977,38 @@ int camera_set_display(camera_h camera, camera_display_type_e type, camera_displ LOGD("Enter - display : %p", display); if (type == CAMERA_DISPLAY_TYPE_NONE) { - set_display_handle = 0; LOGD("display type NONE"); } else { - obj = (Evas_Object *)display; - object_type = evas_object_type_get(obj); - if (object_type) { - if (type == CAMERA_DISPLAY_TYPE_OVERLAY && !strcmp(object_type, "elm_win")) { - /* get wayland parent id */ - if (_camera_get_wl_info(obj, &pc->wl_info) != CAMERA_ERROR_NONE) { - LOGE("failed to get wayland info"); - return CAMERA_ERROR_INVALID_OPERATION; - } - - set_display_handle = (void *)&pc->wl_info; - LOGD("display type OVERLAY : handle %p", set_display_handle); - } else if (type == CAMERA_DISPLAY_TYPE_EVAS && !strcmp(object_type, "image")) { - /* evas object surface */ - set_display_handle = (void *)display; - LOGD("display type EVAS : handle %p", set_display_handle); - -#ifdef TIZEN_FEATURE_EVAS_RENDERER - g_mutex_lock(&cb_info->evas_mutex); - - if (cb_info->evas_info) { - LOGW("destroy existed evas renderer %p", cb_info->evas_info); - ret = mm_evas_renderer_destroy(&cb_info->evas_info); - if (ret != MM_ERROR_NONE) { - LOGE("failed to destroy evas renderer %p", cb_info->evas_info); - g_mutex_unlock(&cb_info->evas_mutex); - return CAMERA_ERROR_INVALID_OPERATION; - } - } - - /* create evas renderer */ - ret = mm_evas_renderer_create(&cb_info->evas_info, (Evas_Object *)set_display_handle); - if (ret == MM_ERROR_NONE) { - camera_flip_e flip = CAMERA_FLIP_NONE; - camera_display_mode_e mode = CAMERA_DISPLAY_MODE_LETTER_BOX; - camera_rotation_e rotation = CAMERA_ROTATION_NONE; - bool visible = 0; - int x = 0; - int y = 0; - int width = 0; - int height = 0; - - camera_get_display_flip(camera, &flip); - camera_get_display_mode(camera, &mode); - camera_get_display_rotation(camera, &rotation); - camera_is_display_visible(camera, &visible); - camera_attr_get_display_roi_area(camera, &x, &y, &width, &height); - - LOGD("current setting : flip %d, mode %d, rotation %d, visible %d, roi %d,%d,%dx%d", - flip, mode, rotation, visible, x, y, width, height); - - ret = mm_evas_renderer_set_flip(cb_info->evas_info, flip); - ret |= mm_evas_renderer_set_geometry(cb_info->evas_info, mode); - ret |= mm_evas_renderer_set_rotation(cb_info->evas_info, rotation); - ret |= mm_evas_renderer_set_visible(cb_info->evas_info, visible); - - if (mode == CAMERA_DISPLAY_MODE_CUSTOM_ROI) - ret |= mm_evas_renderer_set_roi_area(cb_info->evas_info, x, y, width, height); - } - - g_mutex_unlock(&cb_info->evas_mutex); - - if (ret != MM_ERROR_NONE) { - LOGE("mm_evas_renderer error 0x%x", ret); - return CAMERA_ERROR_INVALID_OPERATION; - } -#else /* TIZEN_FEATURE_EVAS_RENDERER */ - LOGE("EVAS surface is not supported"); - return CAMERA_ERROR_NOT_SUPPORTED; -#endif /* TIZEN_FEATURE_EVAS_RENDERER */ - } else { - LOGE("unknown evas object [%p,%s] or type [%d] mismatch", obj, object_type, type); - return CAMERA_ERROR_INVALID_PARAMETER; - } - } else { - LOGE("failed to get evas object type from %p", obj); - return CAMERA_ERROR_INVALID_PARAMETER; + ret = mm_display_interface_set_display(cb_info->dp_interface, type, display, &cb_info->parent_id); + if (ret == MM_ERROR_NONE && type == CAMERA_DISPLAY_TYPE_EVAS) { + camera_flip_e flip = CAMERA_FLIP_NONE; + camera_display_mode_e mode = CAMERA_DISPLAY_MODE_LETTER_BOX; + camera_rotation_e rotation = CAMERA_ROTATION_NONE; + bool visible = 0; + int x = 0; + int y = 0; + int width = 0; + int height = 0; + + camera_get_display_flip(camera, &flip); + camera_get_display_mode(camera, &mode); + camera_get_display_rotation(camera, &rotation); + camera_is_display_visible(camera, &visible); + camera_attr_get_display_roi_area(camera, &x, &y, &width, &height); + + LOGD("current setting : flip %d, mode %d, rotation %d, visible %d, roi %d,%d,%dx%d", + flip, mode, rotation, visible, x, y, width, height); + + ret = mm_display_interface_evas_set_flip(cb_info->dp_interface, flip); + ret |= mm_display_interface_evas_set_mode(cb_info->dp_interface, mode); + ret |= mm_display_interface_evas_set_rotation(cb_info->dp_interface, rotation); + ret |= mm_display_interface_evas_set_visible(cb_info->dp_interface, visible); + + if (mode == CAMERA_DISPLAY_MODE_CUSTOM_ROI) + ret |= mm_display_interface_evas_set_roi_area(cb_info->dp_interface, x, y, width, height); } } - pc->display_handle = (intptr_t)set_display_handle; - if (type == CAMERA_DISPLAY_TYPE_OVERLAY) { int send_ret = 0; @@ -3321,7 +3017,7 @@ int camera_set_display(camera_h camera, camera_display_type_e type, camera_displ msg = muse_core_msg_new(api, MUSE_TYPE_INT, "type", type, - MUSE_TYPE_ARRAY, "wl_info", length, (int *)&pc->wl_info, + MUSE_TYPE_INT, "parent_id", cb_info->parent_id, NULL); if (!msg) { LOGE("msg creation failed: api %d", api); @@ -3346,10 +3042,6 @@ int camera_set_display(camera_h camera, camera_display_type_e type, camera_displ __camera_update_api_waiting(pc->cb_info, api, -1); muse_core_msg_free(msg); - - LOGD("wayland parent id : %d, window %d,%d,%dx%d", - pc->wl_info.parent_id, pc->wl_info.window_x, pc->wl_info.window_y, - pc->wl_info.window_width, pc->wl_info.window_height); } else { CAMERA_MSG_PARAM_SET(param, INT, type); @@ -3525,20 +3217,13 @@ int camera_set_display_rotation(camera_h camera, camera_rotation_e rotation) return CAMERA_ERROR_INVALID_PARAMETER; } -#ifdef TIZEN_FEATURE_EVAS_RENDERER if (CHECK_PREVIEW_CB(pc->cb_info, PREVIEW_CB_TYPE_EVAS)) { - g_mutex_lock(&pc->cb_info->evas_mutex); - - ret = mm_evas_renderer_set_rotation(pc->cb_info->evas_info, rotation); - - g_mutex_unlock(&pc->cb_info->evas_mutex); - + ret = mm_display_interface_evas_set_rotation(pc->cb_info->dp_interface, rotation); if (ret != MM_ERROR_NONE) { LOGE("failed to set rotation for evas surface 0x%x", ret); return CAMERA_ERROR_INVALID_OPERATION; } } -#endif /* TIZEN_FEATURE_EVAS_RENDERER */ CAMERA_MSG_PARAM_SET(param, INT, set_rotation); @@ -3579,20 +3264,13 @@ int camera_set_display_flip(camera_h camera, camera_flip_e flip) return CAMERA_ERROR_INVALID_PARAMETER; } -#ifdef TIZEN_FEATURE_EVAS_RENDERER if (CHECK_PREVIEW_CB(pc->cb_info, PREVIEW_CB_TYPE_EVAS)) { - g_mutex_lock(&pc->cb_info->evas_mutex); - - ret = mm_evas_renderer_set_flip(pc->cb_info->evas_info, flip); - - g_mutex_unlock(&pc->cb_info->evas_mutex); - + ret = mm_display_interface_evas_set_flip(pc->cb_info->dp_interface, flip); if (ret != MM_ERROR_NONE) { LOGE("failed to set flip for evas surface 0x%x", ret); return CAMERA_ERROR_INVALID_OPERATION; } } -#endif /* TIZEN_FEATURE_EVAS_RENDERER */ CAMERA_MSG_PARAM_SET(param, INT, set_flip); @@ -3633,20 +3311,13 @@ int camera_set_display_visible(camera_h camera, bool visible) return CAMERA_ERROR_INVALID_PARAMETER; } -#ifdef TIZEN_FEATURE_EVAS_RENDERER if (CHECK_PREVIEW_CB(pc->cb_info, PREVIEW_CB_TYPE_EVAS)) { - g_mutex_lock(&pc->cb_info->evas_mutex); - - ret = mm_evas_renderer_set_visible(pc->cb_info->evas_info, visible); - - g_mutex_unlock(&pc->cb_info->evas_mutex); - + ret = mm_display_interface_evas_set_visible(pc->cb_info->dp_interface, visible); if (ret != MM_ERROR_NONE) { LOGE("failed to set visible for evas surface 0x%x", ret); return CAMERA_ERROR_INVALID_OPERATION; } } -#endif /* TIZEN_FEATURE_EVAS_RENDERER */ CAMERA_MSG_PARAM_SET(param, INT, set_visible); @@ -3687,20 +3358,13 @@ int camera_set_display_mode(camera_h camera, camera_display_mode_e mode) return CAMERA_ERROR_INVALID_PARAMETER; } -#ifdef TIZEN_FEATURE_EVAS_RENDERER if (CHECK_PREVIEW_CB(pc->cb_info, PREVIEW_CB_TYPE_EVAS)) { - g_mutex_lock(&pc->cb_info->evas_mutex); - - ret = mm_evas_renderer_set_geometry(pc->cb_info->evas_info, mode); - - g_mutex_unlock(&pc->cb_info->evas_mutex); - + ret = mm_display_interface_evas_set_mode(pc->cb_info->dp_interface, mode); if (ret != MM_ERROR_NONE) { LOGE("failed to set geometry for evas surface 0x%x", ret); return CAMERA_ERROR_INVALID_OPERATION; } } -#endif /* TIZEN_FEATURE_EVAS_RENDERER */ CAMERA_MSG_PARAM_SET(param, INT, set_mode); @@ -6703,20 +6367,13 @@ int camera_attr_set_display_roi_area(camera_h camera, int x, int y, int width, i LOGD("Enter"); -#ifdef TIZEN_FEATURE_EVAS_RENDERER if (CHECK_PREVIEW_CB(pc->cb_info, PREVIEW_CB_TYPE_EVAS)) { - g_mutex_lock(&pc->cb_info->evas_mutex); - - ret = mm_evas_renderer_set_roi_area(pc->cb_info->evas_info, x, y, width, height); - - g_mutex_unlock(&pc->cb_info->evas_mutex); - + ret = mm_display_interface_evas_set_roi_area(pc->cb_info->dp_interface, x, y, width, height); if (ret != MM_ERROR_NONE) { LOGE("mm_evas_renderer_set_roi_area error 0x%x", ret); return CAMERA_ERROR_INVALID_OPERATION; } } -#endif /* TIZEN_FEATURE_EVAS_RENDERER */ length = sizeof(set_display_roi_area) / sizeof(int) + \ (sizeof(set_display_roi_area) % sizeof(int) ? 1 : 0); -- 2.7.4