implementation
[platform/core/uifw/libtdm.git] / src / tdm_backend.c
index c979129..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)
 {
@@ -224,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);
+}