add stamp to vblank objects 60/161060/1
authorBoram Park <boram1288.park@samsung.com>
Tue, 21 Nov 2017 07:31:35 +0000 (16:31 +0900)
committerBoram Park <boram1288.park@samsung.com>
Tue, 21 Nov 2017 07:50:57 +0000 (16:50 +0900)
To distinguish among vblank objects

Change-Id: Id419092118542442fa719824204e495c48e32d40

client/tdm_client.c
protocol/tdm.xml
src/tdm_private.h
src/tdm_server.c
src/tdm_vblank.c

index d80100d..cd74513 100644 (file)
@@ -94,6 +94,7 @@ struct _tdm_private_client_vblank {
        unsigned int enable_fake;
 
        unsigned int started;
+       unsigned int stamp;
 
        double last_time;
 
@@ -123,6 +124,16 @@ typedef struct _tdm_client_wait_info {
 } tdm_client_wait_info;
 
 static void
+_tdm_client_vblank_cb_stamp(void *data, struct wl_tdm_vblank *wl_tdm_vblank, uint32_t stamp)
+{
+       tdm_private_client_vblank *private_vblank = data;
+
+       TDM_RETURN_IF_FAIL(private_vblank != NULL);
+
+       private_vblank->stamp = stamp;
+}
+
+static void
 _tdm_client_vblank_cb_done(void *data, struct wl_tdm_vblank *wl_tdm_vblank,
                                                   uint32_t req_id, uint32_t sequence, uint32_t tv_sec,
                                                   uint32_t tv_usec, uint32_t error)
@@ -159,6 +170,7 @@ _tdm_client_vblank_cb_done(void *data, struct wl_tdm_vblank *wl_tdm_vblank,
 }
 
 static const struct wl_tdm_vblank_listener tdm_client_vblank_listener = {
+       _tdm_client_vblank_cb_stamp,
        _tdm_client_vblank_cb_done,
 };
 
@@ -649,6 +661,7 @@ tdm_client_output_get_dpms(tdm_client_output *output, tdm_output_dpms *dpms)
 tdm_client_vblank*
 tdm_client_output_create_vblank(tdm_client_output *output, tdm_error *error)
 {
+       tdm_private_client *private_client;
        tdm_private_client_output *private_output;
        tdm_private_client_vblank *private_vblank;
 
@@ -663,6 +676,14 @@ tdm_client_output_create_vblank(tdm_client_output *output, tdm_error *error)
        }
 
        private_output = (tdm_private_client_output*)output;
+       private_client = private_output->private_client;
+
+       if (!private_client) {
+               TDM_ERR("'!private_client' failed");
+               if (error)
+                       *error = TDM_ERROR_INVALID_PARAMETER;
+               return NULL;
+       }
 
        private_vblank = calloc(1, sizeof *private_vblank);
        if (!private_vblank) {
@@ -693,6 +714,7 @@ tdm_client_output_create_vblank(tdm_client_output *output, tdm_error *error)
 
        wl_tdm_vblank_add_listener(private_vblank->vblank,
                                                           &tdm_client_vblank_listener, private_vblank);
+       wl_display_roundtrip(private_client->display);
 
        return (tdm_client_vblank*)private_vblank;
 }
index 22328ac..24d3a7b 100644 (file)
 
     <interface name="wl_tdm_vblank" version="1">
 
+        <event name="stamp">
+            <arg name="stamp" type="uint"/>
+        </event>
+
         <event name="done">
             <arg name="req_id" type="uint" summary="wait_vblank request ID"/>
             <arg name="sequence" type="uint" summary="the sequence number of the vblank"/>
index 2a927db..6853bfb 100644 (file)
@@ -491,6 +491,8 @@ tdm_error
 tdm_vblank_set_add_front(tdm_vblank *vblank, unsigned int add_front);
 tdm_error
 tdm_vblank_set_resource(tdm_vblank *vblank, struct wl_resource *resource);
+double
+tdm_vblank_get_stamp(tdm_vblank *vblank);
 tdm_error
 tdm_vblank_set_client_vblank_fps(unsigned int pid, const char *name, unsigned int fps);
 void
index 3ade1e5..4da079d 100644 (file)
@@ -72,6 +72,7 @@ typedef struct _tdm_server_vblank_info {
        struct wl_resource *resource;
 
        tdm_vblank *vblank;
+       unsigned int stamp;
 } tdm_server_vblank_info;
 
 typedef struct _tdm_server_wait_info {
@@ -433,12 +434,15 @@ _tdm_server_output_cb_create_vblank(struct wl_client *client, struct wl_resource
        vblank_info->output_info = output_info;
        vblank_info->resource = vblank_resource;
        vblank_info->vblank = vblank;
+       vblank_info->stamp = (unsigned int)tdm_vblank_get_stamp(vblank);
 
        tdm_vblank_set_resource(vblank, vblank_resource);
 
        wl_resource_set_implementation(vblank_resource, &tdm_vblank_implementation,
                                                                   vblank_info, destroy_vblank_callback);
 
+       wl_tdm_vblank_send_stamp(vblank_info->resource, vblank_info->stamp);
+
        return;
 }
 
index b2ccb95..6861ec8 100644 (file)
@@ -1230,6 +1230,16 @@ tdm_vblank_set_resource(tdm_vblank *vblank, struct wl_resource *resource)
        return TDM_ERROR_NONE;
 }
 
+INTERN double
+tdm_vblank_get_stamp(tdm_vblank *vblank)
+{
+       tdm_private_vblank *private_vblank = vblank;
+
+       TDM_RETURN_VAL_IF_FAIL(private_vblank != NULL, TDM_ERROR_INVALID_PARAMETER);
+
+       return private_vblank->stamp;
+}
+
 INTERN void
 tdm_vblank_get_vblank_list_information(tdm_display *dpy, char *reply, int *len)
 {