virtual:add virtual output create/destroy
[platform/core/uifw/libtdm.git] / src / tdm_display.c
index 9f6dd72..a355ab7 100644 (file)
@@ -815,6 +815,68 @@ tdm_display_find_output(tdm_display *dpy, const char *name, tdm_error *error)
        return NULL;
 }
 
+INTERN tdm_output *
+tdm_display_create_output(tdm_display *dpy, const char *name, tdm_error *error)
+{
+       tdm_private_module *private_module = NULL;
+       tdm_private_module *current_module = NULL;
+       tdm_func_display *func_display = NULL;
+       tdm_output *output = NULL;
+
+       DISPLAY_FUNC_ENTRY_ERROR();
+
+       TDM_RETURN_VAL_IF_FAIL_WITH_ERROR(dpy != NULL, TDM_ERROR_INVALID_PARAMETER, NULL);
+       private_display = (tdm_private_display*)dpy;
+
+       private_module = private_display->virtual_module;
+       TDM_RETURN_VAL_IF_FAIL_WITH_ERROR(private_module != NULL, TDM_ERROR_BAD_MODULE, NULL);
+
+       _pthread_mutex_lock(&private_display->lock);
+
+       if (error)
+               *error = TDM_ERROR_NONE;
+
+       func_display = &private_module->func_display;
+       current_module = private_display->current_module;
+       private_display->current_module = private_module;
+       output = func_display->display_output_create(private_module->bdata, name, &ret);
+       private_display->current_module = current_module;
+
+       _pthread_mutex_unlock(&private_display->lock);
+
+       TDM_RETURN_VAL_IF_FAIL_WITH_ERROR(output != NULL, ret, NULL);
+
+       return output;
+}
+
+INTERN tdm_error
+tdm_display_destroy_output(tdm_display *dpy, tdm_output *output)
+{
+       tdm_private_module *private_module = NULL;
+       tdm_private_module *current_module = NULL;
+       tdm_func_display *func_display = NULL;
+
+       DISPLAY_FUNC_ENTRY();
+
+       TDM_RETURN_VAL_IF_FAIL(output != NULL, TDM_ERROR_INVALID_PARAMETER);
+       private_display = (tdm_private_display*)dpy;
+
+       private_module = private_display->virtual_module;
+       TDM_RETURN_VAL_IF_FAIL(private_module != NULL, TDM_ERROR_BAD_MODULE);
+
+       _pthread_mutex_lock(&private_display->lock);
+
+       func_display = &private_module->func_display;
+       current_module = private_display->current_module;
+       private_display->current_module = private_module;
+       ret = func_display->display_output_destroy(private_module->bdata, output);
+       private_display->current_module = current_module;
+
+       _pthread_mutex_unlock(&private_display->lock);
+
+       return ret;
+}
+
 EXTERN tdm_error
 tdm_display_get_fd(tdm_display *dpy, int *fd)
 {