Add new interface to get type 72/237572/3 accepted/tizen_6.0_unified_hotfix tizen_6.0_hotfix accepted/tizen/6.0/unified/20201030.114409 accepted/tizen/6.0/unified/hotfix/20201103.004008 accepted/tizen/unified/20200709.212752 submit/tizen/20200708.061411 submit/tizen/20200709.071349 submit/tizen_6.0/20201029.205104 submit/tizen_6.0_hotfix/20201102.192504 submit/tizen_6.0_hotfix/20201103.114804 tizen_6.0.m2_release
authorJeongmo Yang <jm80.yang@samsung.com>
Wed, 1 Jul 2020 10:33:43 +0000 (19:33 +0900)
committerJeongmo Yang <jm80.yang@samsung.com>
Wed, 1 Jul 2020 10:47:40 +0000 (19:47 +0900)
- int mm_display_interface_get_type(mm_display_interface_h handle, mm_display_type_e *type);

[Version] 0.0.8
[Profile] Common
[Issue Type] New feature

Change-Id: Ib06d7afe4e81d86eb29537a69b7203e3e25b5b5f
Signed-off-by: Jeongmo Yang <jm80.yang@samsung.com>
packaging/libmm-display.spec
src/include/mm_display.h
src/include/mm_display_interface.h
src/include/mm_display_interface_private.h
src/mm_display.c
src/mm_display_interface.c

index f5e1d67..40a157d 100644 (file)
@@ -1,6 +1,6 @@
 Name:       libmm-display
 Summary:    Multimedia framework display library
-Version:    0.0.7
+Version:    0.0.8
 Release:    0
 Group:      Multimedia/Libraries
 License:    Apache-2.0
index 7658777..ca1240c 100644 (file)
@@ -44,6 +44,7 @@ typedef void *mm_display_h;
 int mm_display_init(mm_display_h *handle);
 int mm_display_deinit(mm_display_h handle);
 int mm_display_set_display(mm_display_h handle, mm_display_type_e type, void *display, int *parent_id);
+int mm_display_get_type(mm_display_h handle, mm_display_type_e *type);
 #ifdef TIZEN_FEATURE_EVAS_RENDERER
 int mm_display_evas_set_rotation(mm_display_h handle, int rotation);
 int mm_display_evas_get_rotation(mm_display_h handle, int *rotation);
index c305463..23989eb 100644 (file)
@@ -38,6 +38,7 @@ typedef void (*mm_display_evas_rendered_cb)(media_packet_h packet, void *user_da
 int mm_display_interface_init(mm_display_interface_h *handle);
 int mm_display_interface_deinit(mm_display_interface_h handle);
 int mm_display_interface_set_display(mm_display_interface_h handle, mm_display_type_e type, void *display, int *parent_id);
+int mm_display_interface_get_type(mm_display_interface_h handle, mm_display_type_e *type);
 int mm_display_interface_get_window_rect(mm_display_interface_h handle, MMRectType *window_rect);
 int mm_display_interface_evas_set_rotation(mm_display_interface_h handle, int rotation);
 int mm_display_interface_evas_get_rotation(mm_display_interface_h handle, int *rotation);
index e1c0902..5b5d034 100644 (file)
@@ -33,7 +33,8 @@ typedef struct mm_display_interface {
 
        int (*init)(void **);
        int (*deinit)(void *);
-       int (*set_display)(void *, int, void *, int *);
+       int (*set_display)(void *, mm_display_type_e, void *, int *);
+       int (*get_type)(void *, mm_display_type_e *);
        int (*get_window_rect)(void *, MMRectType *);
        int (*evas_set_rotation)(void *, int);
        int (*evas_get_rotation)(void *, int *);
index 7aa68c5..c53477a 100644 (file)
@@ -91,7 +91,7 @@ static const struct wl_registry_listener _mm_display_wl_registry_listener = {
        __global_remove
 };
 
-void __parent_id_getter(void *data, struct tizen_resource *tizen_resource, uint32_t id)
+static void __parent_id_getter(void *data, struct tizen_resource *tizen_resource, uint32_t id)
 {
        if (!data) {
                LOGE("NULL data");
@@ -110,7 +110,7 @@ static const struct tizen_resource_listener _mm_display_tz_resource_listener = {
 };
 
 
-int _mm_display_get_parent_id(mm_display_type_e type, void *handle, int *parent_id)
+static int __mm_display_get_parent_id(mm_display_type_e type, void *handle, int *parent_id)
 {
        int ret = MM_ERROR_NONE;
        Ecore_Wl2_Window *wl2_window = NULL;
@@ -235,7 +235,7 @@ int mm_display_init(mm_display_h *handle)
                return MM_ERROR_OUT_OF_MEMORY;
        }
 
-       new_handle->type = MM_DISPLAY_TYPE_OVERLAY;
+       new_handle->type = MM_DISPLAY_TYPE_NONE;
 
        *handle = (mm_display_h)new_handle;
 
@@ -276,6 +276,9 @@ int mm_display_set_display(mm_display_h handle, mm_display_type_e type, void *di
        int ret = MM_ERROR_NONE;
        const char *object_type = NULL;
        mm_display_t *dp_handle = NULL;
+#ifdef TIZEN_FEATURE_EVAS_RENDERER
+       MMHandleType new_evas_renderer = NULL;
+#endif
 
        if (!handle || !display || !parent_id ||
                type > MM_DISPLAY_TYPE_OVERLAY_EXT) {
@@ -295,55 +298,65 @@ int mm_display_set_display(mm_display_h handle, mm_display_type_e type, void *di
                }
        }
 
-       if ((type == MM_DISPLAY_TYPE_OVERLAY && !strcmp(object_type, "elm_win")) ||
-               type == MM_DISPLAY_TYPE_OVERLAY_EXT) {
+       if (type == MM_DISPLAY_TYPE_OVERLAY_EXT ||
+               (type == MM_DISPLAY_TYPE_OVERLAY && !strcmp(object_type, "elm_win"))) {
                /* get wayland parent id */
-               ret = _mm_display_get_parent_id(type, display, &dp_handle->parent_id);
-               if (ret == MM_ERROR_NONE)
-                       *parent_id = dp_handle->parent_id;
-               else
+               ret = __mm_display_get_parent_id(type, display, &dp_handle->parent_id);
+               if (ret != MM_ERROR_NONE) {
                        LOGE("failed to get wayland info. ret 0x%x", ret);
+                       return ret;
+               }
+
+               *parent_id = dp_handle->parent_id;
        } else if (type == MM_DISPLAY_TYPE_EVAS && !strcmp(object_type, "image")) {
                /* evas object surface */
 #ifdef TIZEN_FEATURE_EVAS_RENDERER
-               MMHandleType new_evas_renderer = NULL;
-
-               /* create evas renderer */
                ret = mm_evas_renderer_create(&new_evas_renderer, (Evas_Object *)display);
                if (ret != MM_ERROR_NONE) {
                        LOGE("failed to create evas renderer 0x%x", ret);
-                       ret = MM_ERROR_UNKNOWN;
+                       return MM_ERROR_UNKNOWN;
+               }
+
+               if (dp_handle->evas_renderer) {
+                       /* release old evas renderer */
+                       mm_evas_renderer_destroy(dp_handle->evas_renderer);
                } else {
-                       /* release previous resources */
-                       if (dp_handle->evas_renderer) {
-                               LOGW("release previous evas renderer %p", dp_handle->evas_renderer);
-                               mm_evas_renderer_destroy(dp_handle->evas_renderer);
-                               dp_handle->evas_renderer = NULL;
-                       } else {
-                               /* init mutex for first time */
-                               g_mutex_init(&dp_handle->evas_mutex);
-                       }
-
-                       dp_handle->evas_renderer = new_evas_renderer;
-
-                       LOGD("new evas renderer %p", new_evas_renderer);
+                       /* init mutex for first time */
+                       g_mutex_init(&dp_handle->evas_mutex);
                }
+
+               dp_handle->evas_renderer = new_evas_renderer;
+
+               LOGD("new evas renderer %p", new_evas_renderer);
 #else /* TIZEN_FEATURE_EVAS_RENDERER */
                LOGE("EVAS surface is not supported");
-               ret = MM_ERROR_NOT_SUPPORT_API;
+               return MM_ERROR_NOT_SUPPORT_API;
 #endif /* TIZEN_FEATURE_EVAS_RENDERER */
        } else {
                LOGE("unknown display handle [%p,%s] or type [%d] mismatch",
                        display, object_type ? object_type : "UNKNOWN", type);
-               ret = MM_ERROR_INVALID_ARGUMENT;
+               return MM_ERROR_INVALID_ARGUMENT;
        }
 
-       if (ret == MM_ERROR_NONE) {
-               dp_handle->type = type;
-               dp_handle->display = display;
+       dp_handle->type = type;
+       dp_handle->display = display;
+
+       return MM_ERROR_NONE;
+}
+
+
+int mm_display_get_type(mm_display_h handle, mm_display_type_e *type)
+{
+       mm_display_t *dp_handle = (mm_display_t *)handle;
+
+       if (!dp_handle || !type) {
+               LOGE("NULL param %p %p", dp_handle, type);
+               return MM_ERROR_INVALID_ARGUMENT;
        }
 
-       return ret;
+       *type = dp_handle->type;
+
+       return MM_ERROR_NONE;
 }
 
 
index 3f4c9f6..5f3bc44 100644 (file)
@@ -77,6 +77,7 @@ int mm_display_interface_init(mm_display_interface_h *handle)
        sym_ret = g_module_symbol(module, "mm_display_init", (gpointer *)&new_interface->init);
        sym_ret &= g_module_symbol(module, "mm_display_deinit", (gpointer *)&new_interface->deinit);
        sym_ret &= g_module_symbol(module, "mm_display_set_display", (gpointer *)&new_interface->set_display);
+       sym_ret &= g_module_symbol(module, "mm_display_get_type", (gpointer *)&new_interface->get_type);
        sym_ret &= g_module_symbol(module, "mm_display_get_window_rect", (gpointer *)&new_interface->get_window_rect);
 #ifdef TIZEN_FEATURE_EVAS_RENDERER
        sym_ret &= g_module_symbol(module, "mm_display_evas_set_rotation", (gpointer *)&new_interface->evas_set_rotation);
@@ -175,6 +176,19 @@ int mm_display_interface_set_display(mm_display_interface_h handle, mm_display_t
 }
 
 
+int mm_display_interface_get_type(mm_display_interface_h handle, mm_display_type_e *type)
+{
+       DECLARE_CHECK_INTERFACE_HANDLE(handle);
+
+       if (!interface->get_type) {
+               LOGE("NULL function pointer");
+               return MM_ERROR_UNKNOWN;
+       }
+
+       return interface->get_type(interface->dp_handle, type);
+}
+
+
 int mm_display_interface_get_window_rect(mm_display_interface_h handle, MMRectType *window_rect)
 {
        DECLARE_CHECK_INTERFACE_HANDLE(handle);