virtual output: Remove definition, 'tdm_client_output_set_buffer_queue'.
[platform/core/uifw/libtdm.git] / src / tdm_backend.c
index 13ea24c..7d469d1 100644 (file)
        TDM_RETURN_VAL_IF_FAIL(dpy != NULL, TDM_ERROR_INVALID_PARAMETER); \
        private_display = (tdm_private_display*)dpy;
 
+#define BACKEND_FUNC_ENTRY_VOID() \
+       tdm_private_display *private_display; \
+       TDM_RETURN_IF_FAIL(dpy != NULL); \
+       private_display = (tdm_private_display*)dpy;
+
 static int
 _check_abi_version(tdm_backend_module *module, int abimaj, int abimin)
 {
@@ -146,10 +151,7 @@ tdm_backend_register_func_hwc(tdm_display *dpy, tdm_func_hwc *func_hwc)
        assert(private_display->current_module);
 
        module = private_display->current_module->module_data;
-       /* FIX ME:
-                  Temporarily, we set the version of hwc window to 1.1 for the development.
-                  Originally the hwc window version is 2.0. */
-       if (_check_abi_version(module, 1, 1) < 0)
+       if (_check_abi_version(module, 2, 0) < 0)
                return TDM_ERROR_BAD_MODULE;
 
        private_display->current_module->func_hwc = *func_hwc;
@@ -171,10 +173,7 @@ tdm_backend_register_func_hwc_window(tdm_display *dpy, tdm_func_hwc_window *func
        assert(private_display->current_module);
 
        module = private_display->current_module->module_data;
-       /* FIX ME:
-                  Temporarily, we set the version of hwc window to 1.1 for the development.
-                  Originally the hwc window version is 2.0. */
-       if (_check_abi_version(module, 1, 1) < 0)
+       if (_check_abi_version(module, 2, 0) < 0)
                return TDM_ERROR_BAD_MODULE;
 
        private_display->current_module->func_hwc_window = *func_hwc_window;
@@ -230,3 +229,45 @@ tdm_backend_register_func_capture(tdm_display *dpy,
 
        return TDM_ERROR_NONE;
 }
+
+EXTERN tdm_error
+tdm_backend_register_output(tdm_display *dpy, tdm_output *output)
+{
+       tdm_error ret;
+
+       BACKEND_FUNC_ENTRY();
+
+       TDM_RETURN_VAL_IF_FAIL(TDM_MUTEX_IS_LOCKED(), TDM_ERROR_OPERATION_FAILED);
+       TDM_RETURN_VAL_IF_FAIL(output != NULL, TDM_ERROR_OPERATION_FAILED);
+
+       /* this function is only for backend. if backend calls this function, it means
+        * that it's triggered by frontend. frontend should set current_module before calling
+        * backend functions.
+        */
+       TDM_RETURN_VAL_IF_FAIL(private_display->current_module != NULL, TDM_ERROR_OPERATION_FAILED);
+
+       ret = tdm_display_update_output(private_display->current_module, output);
+       TDM_RETURN_VAL_IF_FAIL(ret == TDM_ERROR_NONE, ret);
+
+       return TDM_ERROR_NONE;
+}
+
+EXTERN void
+tdm_backend_unregister_output(tdm_display *dpy, tdm_output *output)
+{
+       tdm_private_output *private_output;
+
+       BACKEND_FUNC_ENTRY_VOID();
+
+       TDM_RETURN_IF_FAIL(TDM_MUTEX_IS_LOCKED());
+       TDM_RETURN_IF_FAIL(output != NULL);
+
+       /* this function is only for backend. if backend calls this function, it means
+        * that it's triggered by frontend. frontend should set current_module before calling
+        * backend functions.
+        */
+       TDM_RETURN_IF_FAIL(private_display->current_module != NULL);
+
+       private_output = tdm_display_find_private_output(private_display, output);
+       tdm_display_destroy_private_output(private_output);
+}