virtual output: Add implementation for client and test case for virtual output.
[platform/core/uifw/libtdm.git] / src / tdm_server.c
index f5e222a..d77151c 100644 (file)
@@ -9,7 +9,7 @@
  *          Taeheon Kim <th908.kim@samsung.com>,
  *          YoungJun Cho <yj44.cho@samsung.com>,
  *          SooChan Lim <sc1.lim@samsung.com>,
- *          Boram Park <sc1.lim@samsung.com>
+ *          Boram Park <boram1288.park@samsung.com>
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
  * copy of this software and associated documentation files (the
@@ -239,8 +239,10 @@ static void
 _tdm_server_vblank_cb_set_name(struct wl_client *client, struct wl_resource *resource, const char *name)
 {
        tdm_server_vblank_info *vblank_info = wl_resource_get_user_data(resource);
+       tdm_error ret;
 
-       tdm_vblank_set_name(vblank_info->vblank, name);
+       ret = tdm_vblank_set_name(vblank_info->vblank, name);
+       TDM_RETURN_IF_FAIL(ret == TDM_ERROR_NONE);
 }
 /* LCOV_EXCL_STOP */
 
@@ -249,8 +251,10 @@ static void
 _tdm_server_vblank_cb_set_fps(struct wl_client *client, struct wl_resource *resource, uint32_t fps)
 {
        tdm_server_vblank_info *vblank_info = wl_resource_get_user_data(resource);
+       tdm_error ret;
 
-       tdm_vblank_set_fps(vblank_info->vblank, fps);
+       ret = tdm_vblank_set_fps(vblank_info->vblank, fps);
+       TDM_RETURN_IF_FAIL(ret == TDM_ERROR_NONE);
 }
 /* LCOV_EXCL_STOP */
 
@@ -259,8 +263,10 @@ static void
 _tdm_server_vblank_cb_set_offset(struct wl_client *client, struct wl_resource *resource, int32_t offset)
 {
        tdm_server_vblank_info *vblank_info = wl_resource_get_user_data(resource);
+       tdm_error ret;
 
-       tdm_vblank_set_offset(vblank_info->vblank, offset);
+       ret = tdm_vblank_set_offset(vblank_info->vblank, offset);
+       TDM_RETURN_IF_FAIL(ret == TDM_ERROR_NONE);
 }
 /* LCOV_EXCL_STOP */
 
@@ -268,8 +274,10 @@ static void
 _tdm_server_vblank_cb_set_enable_fake(struct wl_client *client, struct wl_resource *resource, uint32_t enable_fake)
 {
        tdm_server_vblank_info *vblank_info = wl_resource_get_user_data(resource);
+       tdm_error ret;
 
-       tdm_vblank_set_enable_fake(vblank_info->vblank, enable_fake);
+       ret = tdm_vblank_set_enable_fake(vblank_info->vblank, enable_fake);
+       TDM_RETURN_IF_FAIL(ret == TDM_ERROR_NONE);
 }
 
 static void
@@ -674,6 +682,27 @@ _tdm_server_cb_create_output(struct wl_client *client, struct wl_resource *resou
        }
 }
 
+static void
+_tdm_server_cb_create_virtual_output(struct wl_client *client, struct wl_resource *resource, const char *name, uint32_t id)
+{
+       struct wl_resource *voutput_resource = NULL;
+
+       voutput_resource =
+               wl_resource_create(client, &wl_tdm_voutput_interface,
+                                                  wl_resource_get_version(resource), id);
+       if (!voutput_resource) {
+               /* LCOV_EXCL_START */
+
+               wl_resource_post_no_memory(resource);
+               TDM_ERR("wl_resource_create failed");
+               return;
+
+               /* LCOV_EXCL_STOP */
+       }
+
+       wl_tdm_voutput_send_ack_message(voutput_resource, WL_TDM_VOUTPUT_MESSAGE_ADDED);
+}
+
 /* LCOV_EXCL_START */
 static void
 _tdm_server_cb_debug(struct wl_client *client, struct wl_resource *resource, const char *options)
@@ -719,6 +748,7 @@ _tdm_server_cb_debug(struct wl_client *client, struct wl_resource *resource, con
 static const struct wl_tdm_interface tdm_implementation = {
        _tdm_server_cb_debug,
        _tdm_server_cb_create_output,
+       _tdm_server_cb_create_virtual_output
 };
 
 static void