staging: sw_sync: Add fill_driver_data support
authorErik Gilling <konkers@android.com>
Fri, 1 Mar 2013 00:43:03 +0000 (16:43 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 4 Mar 2013 09:40:08 +0000 (17:40 +0800)
Add fill_driver_data support to export fence data to ioctl

Cc: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Cc: Erik Gilling <konkers@android.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Rob Clark <robclark@gmail.com>
Cc: Sumit Semwal <sumit.semwal@linaro.org>
Cc: dri-devel@lists.freedesktop.org
Cc: Android Kernel Team <kernel-team@android.com>
Signed-off-by: Erik Gilling <konkers@android.com>
[jstultz: Add commit message]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/android/sw_sync.c

index 64c5ebbbb1a0c8b87df51daaf2dbee34e9145e8e..081e4d188fe9c45bc821b161cd790ad2e25b5e92 100644 (file)
@@ -87,6 +87,19 @@ static void sw_sync_print_pt(struct seq_file *s, struct sync_pt *sync_pt)
        seq_printf(s, "%d / %d", pt->value, obj->value);
 }
 
+static int sw_sync_fill_driver_data(struct sync_pt *sync_pt,
+                                   void *data, int size)
+{
+       struct sw_sync_pt *pt = (struct sw_sync_pt *)sync_pt;
+
+       if (size < sizeof(pt->value))
+               return -ENOMEM;
+
+       memcpy(data, &pt->value, sizeof(pt->value));
+
+       return sizeof(pt->value);
+}
+
 struct sync_timeline_ops sw_sync_timeline_ops = {
        .driver_name = "sw_sync",
        .dup = sw_sync_pt_dup,
@@ -94,6 +107,7 @@ struct sync_timeline_ops sw_sync_timeline_ops = {
        .compare = sw_sync_pt_compare,
        .print_obj = sw_sync_print_obj,
        .print_pt = sw_sync_print_pt,
+       .fill_driver_data = sw_sync_fill_driver_data,
 };