All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/10] android sync framework: clean up IOCTLs and ABI.
@ 2016-01-29 21:20 ` Gustavo Padovan
  0 siblings, 0 replies; 35+ messages in thread
From: Gustavo Padovan @ 2016-01-29 21:20 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: linux-kernel, devel, dri-devel, Daniel Stone,
	Arve Hjønnevåg, Riley Andrews, Daniel Vetter,
	Rob Clark, Greg Hackmann, John Harrison, Maarten Lankhorst,
	Gustavo Padovan

From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>

Hi,

This patch series clean up IOCTLs and abi of sync framework and it is a follow
up on the clean up series I've sent on Jan 21:

http://thread.gmane.org/gmane.comp.video.dri.devel/145509

The main changes here are:

 * remove of SYNC_WAIT ioctl, poll() should be used instead.
 * rename some structs and macros to better reflect the new internal names.
 * clean up and improve ABI on SYNC_IOC_FILE_INFO
 * add flags filed to all ABI structs

Please review, thanks!

Gustavo Padovan (10):
  staging/android: remove SYNC_WAIT ioctl
  staging/android: rename sync_pt_info to fence_info
  staging/android: rename sync_file_info_data to sync_file_info
  staging/android: remove driver_data from struct fence_info
  staging/android: remove len field from struct fence_info
  staging/android: turn fence_info into a __64 pointer
  staging/android: add num_fences field to struct sync_file_info
  staging/android: rename SYNC_IOC_FENCE_INFO
  staging/android: add flags member to sync ioctl structs
  staging/android: remove redundant comments on sync_merge_data

 drivers/staging/android/sw_sync.c    |  14 -----
 drivers/staging/android/sync.c       | 113 +++++++----------------------------
 drivers/staging/android/sync.h       |  20 -------
 drivers/staging/android/trace/sync.h |  44 --------------
 drivers/staging/android/uapi/sync.h  |  45 +++++++-------
 5 files changed, 40 insertions(+), 196 deletions(-)

-- 
2.5.0

^ permalink raw reply	[flat|nested] 35+ messages in thread

* [PATCH 00/10] android sync framework: clean up IOCTLs and ABI.
@ 2016-01-29 21:20 ` Gustavo Padovan
  0 siblings, 0 replies; 35+ messages in thread
From: Gustavo Padovan @ 2016-01-29 21:20 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: devel, Daniel Stone, Daniel Vetter, Riley Andrews, dri-devel,
	linux-kernel, Arve Hjønnevåg, Gustavo Padovan,
	John Harrison

From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>

Hi,

This patch series clean up IOCTLs and abi of sync framework and it is a follow
up on the clean up series I've sent on Jan 21:

http://thread.gmane.org/gmane.comp.video.dri.devel/145509

The main changes here are:

 * remove of SYNC_WAIT ioctl, poll() should be used instead.
 * rename some structs and macros to better reflect the new internal names.
 * clean up and improve ABI on SYNC_IOC_FILE_INFO
 * add flags filed to all ABI structs

Please review, thanks!

Gustavo Padovan (10):
  staging/android: remove SYNC_WAIT ioctl
  staging/android: rename sync_pt_info to fence_info
  staging/android: rename sync_file_info_data to sync_file_info
  staging/android: remove driver_data from struct fence_info
  staging/android: remove len field from struct fence_info
  staging/android: turn fence_info into a __64 pointer
  staging/android: add num_fences field to struct sync_file_info
  staging/android: rename SYNC_IOC_FENCE_INFO
  staging/android: add flags member to sync ioctl structs
  staging/android: remove redundant comments on sync_merge_data

 drivers/staging/android/sw_sync.c    |  14 -----
 drivers/staging/android/sync.c       | 113 +++++++----------------------------
 drivers/staging/android/sync.h       |  20 -------
 drivers/staging/android/trace/sync.h |  44 --------------
 drivers/staging/android/uapi/sync.h  |  45 +++++++-------
 5 files changed, 40 insertions(+), 196 deletions(-)

-- 
2.5.0

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 35+ messages in thread

* [PATCH 01/10] staging/android: remove SYNC_WAIT ioctl
  2016-01-29 21:20 ` Gustavo Padovan
@ 2016-01-29 21:20   ` Gustavo Padovan
  -1 siblings, 0 replies; 35+ messages in thread
From: Gustavo Padovan @ 2016-01-29 21:20 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: linux-kernel, devel, dri-devel, Daniel Stone,
	Arve Hjønnevåg, Riley Andrews, Daniel Vetter,
	Rob Clark, Greg Hackmann, John Harrison, Maarten Lankhorst,
	Gustavo Padovan

From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>

This ioctl is replicating the work of poll() syscall so let's take the
opportunity that this is still on staging tree and remove the duplication
and force new users to use the poll() standard interface.

Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
---
 drivers/staging/android/sync.c       | 52 ------------------------------------
 drivers/staging/android/sync.h       | 13 ---------
 drivers/staging/android/trace/sync.h | 44 ------------------------------
 drivers/staging/android/uapi/sync.h  |  7 -----
 4 files changed, 116 deletions(-)

diff --git a/drivers/staging/android/sync.c b/drivers/staging/android/sync.c
index 5fa4779..381209a 100644
--- a/drivers/staging/android/sync.c
+++ b/drivers/staging/android/sync.c
@@ -300,44 +300,6 @@ struct sync_file *sync_file_merge(const char *name,
 }
 EXPORT_SYMBOL(sync_file_merge);
 
-int sync_file_wait(struct sync_file *sync_file, long timeout)
-{
-	long ret;
-	int i;
-
-	if (timeout < 0)
-		timeout = MAX_SCHEDULE_TIMEOUT;
-	else
-		timeout = msecs_to_jiffies(timeout);
-
-	trace_sync_wait(sync_file, 1);
-	for (i = 0; i < sync_file->num_fences; ++i)
-		trace_fence(sync_file->cbs[i].fence);
-	ret = wait_event_interruptible_timeout(sync_file->wq,
-					       atomic_read(&sync_file->status) <= 0,
-					       timeout);
-	trace_sync_wait(sync_file, 0);
-
-	if (ret < 0) {
-		return ret;
-	} else if (ret == 0) {
-		if (timeout) {
-			pr_info("sync_file timeout on [%p] after %dms\n",
-				sync_file, jiffies_to_msecs(timeout));
-			sync_dump();
-		}
-		return -ETIME;
-	}
-
-	ret = atomic_read(&sync_file->status);
-	if (ret) {
-		pr_info("sync_file error %ld on [%p]\n", ret, sync_file);
-		sync_dump();
-	}
-	return ret;
-}
-EXPORT_SYMBOL(sync_file_wait);
-
 static const char *android_fence_get_driver_name(struct fence *fence)
 {
 	struct sync_timeline *parent = fence_parent(fence);
@@ -478,17 +440,6 @@ static unsigned int sync_file_poll(struct file *file, poll_table *wait)
 	return 0;
 }
 
-static long sync_file_ioctl_wait(struct sync_file *sync_file,
-				  unsigned long arg)
-{
-	__s32 value;
-
-	if (copy_from_user(&value, (void __user *)arg, sizeof(value)))
-		return -EFAULT;
-
-	return sync_file_wait(sync_file, value);
-}
-
 static long sync_file_ioctl_merge(struct sync_file *sync_file,
 				   unsigned long arg)
 {
@@ -629,9 +580,6 @@ static long sync_file_ioctl(struct file *file, unsigned int cmd,
 	struct sync_file *sync_file = file->private_data;
 
 	switch (cmd) {
-	case SYNC_IOC_WAIT:
-		return sync_file_ioctl_wait(sync_file, arg);
-
 	case SYNC_IOC_MERGE:
 		return sync_file_ioctl_merge(sync_file, arg);
 
diff --git a/drivers/staging/android/sync.h b/drivers/staging/android/sync.h
index 8980b55..af1af99 100644
--- a/drivers/staging/android/sync.h
+++ b/drivers/staging/android/sync.h
@@ -18,7 +18,6 @@
 #include <linux/ktime.h>
 #include <linux/list.h>
 #include <linux/spinlock.h>
-#include <linux/wait.h>
 #include <linux/fence.h>
 
 #include "uapi/sync.h"
@@ -230,18 +229,6 @@ void sync_file_put(struct sync_file *sync_file);
  */
 void sync_file_install(struct sync_file *sync_file, int fd);
 
-/**
- * sync_file_wait() - wait on sync file
- * @sync_file:	file to wait on
- * @tiemout:	timeout in ms
- *
- * Wait for @sync_file to be signaled or have an error. Waits indefinitely
- * if @timeout < 0.
- *
- * Returns 0 if fence signaled, > 0 if it is still active and <0 on error
- */
-int sync_file_wait(struct sync_file *sync_file, long timeout);
-
 #ifdef CONFIG_DEBUG_FS
 
 void sync_timeline_debug_add(struct sync_timeline *obj);
diff --git a/drivers/staging/android/trace/sync.h b/drivers/staging/android/trace/sync.h
index 87c60e9..a0f80f4 100644
--- a/drivers/staging/android/trace/sync.h
+++ b/drivers/staging/android/trace/sync.h
@@ -32,50 +32,6 @@ TRACE_EVENT(sync_timeline,
 	TP_printk("name=%s value=%s", __get_str(name), __entry->value)
 );
 
-TRACE_EVENT(sync_wait,
-	TP_PROTO(struct sync_file *sync_file, int begin),
-
-	TP_ARGS(sync_file, begin),
-
-	TP_STRUCT__entry(
-			__string(name, sync_file->name)
-			__field(s32, status)
-			__field(u32, begin)
-	),
-
-	TP_fast_assign(
-			__assign_str(name, sync_file->name);
-			__entry->status = atomic_read(&sync_file->status);
-			__entry->begin = begin;
-	),
-
-	TP_printk("%s name=%s state=%d", __entry->begin ? "begin" : "end",
-			__get_str(name), __entry->status)
-);
-
-TRACE_EVENT(fence,
-	TP_PROTO(struct fence *fence),
-
-	TP_ARGS(fence),
-
-	TP_STRUCT__entry(
-		__string(timeline, fence->ops->get_timeline_name(fence))
-		__array(char, value, 32)
-	),
-
-	TP_fast_assign(
-		__assign_str(timeline, fence->ops->get_timeline_name(fence));
-		if (fence->ops->fence_value_str) {
-			fence->ops->fence_value_str(fence, __entry->value,
-							sizeof(__entry->value));
-		} else {
-			__entry->value[0] = '\0';
-		}
-	),
-
-	TP_printk("name=%s value=%s", __get_str(timeline), __entry->value)
-);
-
 #endif /* if !defined(_TRACE_SYNC_H) || defined(TRACE_HEADER_MULTI_READ) */
 
 /* This part must be outside protection */
diff --git a/drivers/staging/android/uapi/sync.h b/drivers/staging/android/uapi/sync.h
index 73deb69..6c88c80 100644
--- a/drivers/staging/android/uapi/sync.h
+++ b/drivers/staging/android/uapi/sync.h
@@ -65,13 +65,6 @@ struct sync_file_info_data {
 #define SYNC_IOC_MAGIC		'>'
 
 /**
- * DOC: SYNC_IOC_WAIT - wait for a fence to signal
- *
- * pass timeout in milliseconds.  Waits indefinitely timeout < 0.
- */
-#define SYNC_IOC_WAIT		_IOW(SYNC_IOC_MAGIC, 0, __s32)
-
-/**
  * DOC: SYNC_IOC_MERGE - merge two fences
  *
  * Takes a struct sync_merge_data.  Creates a new fence containing copies of
-- 
2.5.0

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH 01/10] staging/android: remove SYNC_WAIT ioctl
@ 2016-01-29 21:20   ` Gustavo Padovan
  0 siblings, 0 replies; 35+ messages in thread
From: Gustavo Padovan @ 2016-01-29 21:20 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: devel, Daniel Stone, Daniel Vetter, Riley Andrews, dri-devel,
	linux-kernel, Arve Hjønnevåg, Gustavo Padovan,
	John Harrison

From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>

This ioctl is replicating the work of poll() syscall so let's take the
opportunity that this is still on staging tree and remove the duplication
and force new users to use the poll() standard interface.

Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
---
 drivers/staging/android/sync.c       | 52 ------------------------------------
 drivers/staging/android/sync.h       | 13 ---------
 drivers/staging/android/trace/sync.h | 44 ------------------------------
 drivers/staging/android/uapi/sync.h  |  7 -----
 4 files changed, 116 deletions(-)

diff --git a/drivers/staging/android/sync.c b/drivers/staging/android/sync.c
index 5fa4779..381209a 100644
--- a/drivers/staging/android/sync.c
+++ b/drivers/staging/android/sync.c
@@ -300,44 +300,6 @@ struct sync_file *sync_file_merge(const char *name,
 }
 EXPORT_SYMBOL(sync_file_merge);
 
-int sync_file_wait(struct sync_file *sync_file, long timeout)
-{
-	long ret;
-	int i;
-
-	if (timeout < 0)
-		timeout = MAX_SCHEDULE_TIMEOUT;
-	else
-		timeout = msecs_to_jiffies(timeout);
-
-	trace_sync_wait(sync_file, 1);
-	for (i = 0; i < sync_file->num_fences; ++i)
-		trace_fence(sync_file->cbs[i].fence);
-	ret = wait_event_interruptible_timeout(sync_file->wq,
-					       atomic_read(&sync_file->status) <= 0,
-					       timeout);
-	trace_sync_wait(sync_file, 0);
-
-	if (ret < 0) {
-		return ret;
-	} else if (ret == 0) {
-		if (timeout) {
-			pr_info("sync_file timeout on [%p] after %dms\n",
-				sync_file, jiffies_to_msecs(timeout));
-			sync_dump();
-		}
-		return -ETIME;
-	}
-
-	ret = atomic_read(&sync_file->status);
-	if (ret) {
-		pr_info("sync_file error %ld on [%p]\n", ret, sync_file);
-		sync_dump();
-	}
-	return ret;
-}
-EXPORT_SYMBOL(sync_file_wait);
-
 static const char *android_fence_get_driver_name(struct fence *fence)
 {
 	struct sync_timeline *parent = fence_parent(fence);
@@ -478,17 +440,6 @@ static unsigned int sync_file_poll(struct file *file, poll_table *wait)
 	return 0;
 }
 
-static long sync_file_ioctl_wait(struct sync_file *sync_file,
-				  unsigned long arg)
-{
-	__s32 value;
-
-	if (copy_from_user(&value, (void __user *)arg, sizeof(value)))
-		return -EFAULT;
-
-	return sync_file_wait(sync_file, value);
-}
-
 static long sync_file_ioctl_merge(struct sync_file *sync_file,
 				   unsigned long arg)
 {
@@ -629,9 +580,6 @@ static long sync_file_ioctl(struct file *file, unsigned int cmd,
 	struct sync_file *sync_file = file->private_data;
 
 	switch (cmd) {
-	case SYNC_IOC_WAIT:
-		return sync_file_ioctl_wait(sync_file, arg);
-
 	case SYNC_IOC_MERGE:
 		return sync_file_ioctl_merge(sync_file, arg);
 
diff --git a/drivers/staging/android/sync.h b/drivers/staging/android/sync.h
index 8980b55..af1af99 100644
--- a/drivers/staging/android/sync.h
+++ b/drivers/staging/android/sync.h
@@ -18,7 +18,6 @@
 #include <linux/ktime.h>
 #include <linux/list.h>
 #include <linux/spinlock.h>
-#include <linux/wait.h>
 #include <linux/fence.h>
 
 #include "uapi/sync.h"
@@ -230,18 +229,6 @@ void sync_file_put(struct sync_file *sync_file);
  */
 void sync_file_install(struct sync_file *sync_file, int fd);
 
-/**
- * sync_file_wait() - wait on sync file
- * @sync_file:	file to wait on
- * @tiemout:	timeout in ms
- *
- * Wait for @sync_file to be signaled or have an error. Waits indefinitely
- * if @timeout < 0.
- *
- * Returns 0 if fence signaled, > 0 if it is still active and <0 on error
- */
-int sync_file_wait(struct sync_file *sync_file, long timeout);
-
 #ifdef CONFIG_DEBUG_FS
 
 void sync_timeline_debug_add(struct sync_timeline *obj);
diff --git a/drivers/staging/android/trace/sync.h b/drivers/staging/android/trace/sync.h
index 87c60e9..a0f80f4 100644
--- a/drivers/staging/android/trace/sync.h
+++ b/drivers/staging/android/trace/sync.h
@@ -32,50 +32,6 @@ TRACE_EVENT(sync_timeline,
 	TP_printk("name=%s value=%s", __get_str(name), __entry->value)
 );
 
-TRACE_EVENT(sync_wait,
-	TP_PROTO(struct sync_file *sync_file, int begin),
-
-	TP_ARGS(sync_file, begin),
-
-	TP_STRUCT__entry(
-			__string(name, sync_file->name)
-			__field(s32, status)
-			__field(u32, begin)
-	),
-
-	TP_fast_assign(
-			__assign_str(name, sync_file->name);
-			__entry->status = atomic_read(&sync_file->status);
-			__entry->begin = begin;
-	),
-
-	TP_printk("%s name=%s state=%d", __entry->begin ? "begin" : "end",
-			__get_str(name), __entry->status)
-);
-
-TRACE_EVENT(fence,
-	TP_PROTO(struct fence *fence),
-
-	TP_ARGS(fence),
-
-	TP_STRUCT__entry(
-		__string(timeline, fence->ops->get_timeline_name(fence))
-		__array(char, value, 32)
-	),
-
-	TP_fast_assign(
-		__assign_str(timeline, fence->ops->get_timeline_name(fence));
-		if (fence->ops->fence_value_str) {
-			fence->ops->fence_value_str(fence, __entry->value,
-							sizeof(__entry->value));
-		} else {
-			__entry->value[0] = '\0';
-		}
-	),
-
-	TP_printk("name=%s value=%s", __get_str(timeline), __entry->value)
-);
-
 #endif /* if !defined(_TRACE_SYNC_H) || defined(TRACE_HEADER_MULTI_READ) */
 
 /* This part must be outside protection */
diff --git a/drivers/staging/android/uapi/sync.h b/drivers/staging/android/uapi/sync.h
index 73deb69..6c88c80 100644
--- a/drivers/staging/android/uapi/sync.h
+++ b/drivers/staging/android/uapi/sync.h
@@ -65,13 +65,6 @@ struct sync_file_info_data {
 #define SYNC_IOC_MAGIC		'>'
 
 /**
- * DOC: SYNC_IOC_WAIT - wait for a fence to signal
- *
- * pass timeout in milliseconds.  Waits indefinitely timeout < 0.
- */
-#define SYNC_IOC_WAIT		_IOW(SYNC_IOC_MAGIC, 0, __s32)
-
-/**
  * DOC: SYNC_IOC_MERGE - merge two fences
  *
  * Takes a struct sync_merge_data.  Creates a new fence containing copies of
-- 
2.5.0

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH 02/10] staging/android: rename sync_pt_info to fence_info
  2016-01-29 21:20 ` Gustavo Padovan
@ 2016-01-29 21:20   ` Gustavo Padovan
  -1 siblings, 0 replies; 35+ messages in thread
From: Gustavo Padovan @ 2016-01-29 21:20 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: linux-kernel, devel, dri-devel, Daniel Stone,
	Arve Hjønnevåg, Riley Andrews, Daniel Vetter,
	Rob Clark, Greg Hackmann, John Harrison, Maarten Lankhorst,
	Gustavo Padovan

From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>

As struct sync_pt doesn't exist anymore it is a good idea remove any
reference to it in the sync_framework. sync_pts were replaced directly by
fences.

Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
---
 drivers/staging/android/sync.c      |  8 ++++----
 drivers/staging/android/uapi/sync.h | 12 ++++++------
 2 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/android/sync.c b/drivers/staging/android/sync.c
index 381209a..ed63001 100644
--- a/drivers/staging/android/sync.c
+++ b/drivers/staging/android/sync.c
@@ -490,12 +490,12 @@ err_put_fd:
 	return err;
 }
 
-static int sync_fill_pt_info(struct fence *fence, void *data, int size)
+static int sync_fill_fence_info(struct fence *fence, void *data, int size)
 {
-	struct sync_pt_info *info = data;
+	struct fence_info *info = data;
 	int ret;
 
-	if (size < sizeof(struct sync_pt_info))
+	if (size < sizeof(*info))
 		return -ENOMEM;
 
 	info->len = sizeof(struct sync_pt_info);
@@ -553,7 +553,7 @@ static long sync_file_ioctl_fence_info(struct sync_file *sync_file,
 	for (i = 0; i < sync_file->num_fences; ++i) {
 		struct fence *fence = sync_file->cbs[i].fence;
 
-		ret = sync_fill_pt_info(fence, (u8 *)data + len, size - len);
+		ret = sync_fill_fence_info(fence, (u8 *)data + len, size - len);
 
 		if (ret < 0)
 			goto out;
diff --git a/drivers/staging/android/uapi/sync.h b/drivers/staging/android/uapi/sync.h
index 6c88c80..c4703ec 100644
--- a/drivers/staging/android/uapi/sync.h
+++ b/drivers/staging/android/uapi/sync.h
@@ -27,15 +27,15 @@ struct sync_merge_data {
 };
 
 /**
- * struct sync_pt_info - detailed sync_pt information
- * @len:		length of sync_pt_info including any driver_data
+ * struct fence_info - detailed fence information
+ * @len:		length of fence_info including any driver_data
  * @obj_name:		name of parent sync_timeline
  * @driver_name:	name of driver implementing the parent
- * @status:		status of the sync_pt 0:active 1:signaled <0:error
+ * @status:		status of the fence 0:active 1:signaled <0:error
  * @timestamp_ns:	timestamp of status change in nanoseconds
  * @driver_data:	any driver dependent data
  */
-struct sync_pt_info {
+struct fence_info {
 	__u32	len;
 	char	obj_name[32];
 	char	driver_name[32];
@@ -52,14 +52,14 @@ struct sync_pt_info {
  *		userspace including pt_info.
  * @name:	name of fence
  * @status:	status of fence. 1: signaled 0:active <0:error
- * @pt_info:	a sync_pt_info struct for every sync_pt in the fence
+ * @fence_info:	a fence_info struct for every fence in the sync_file
  */
 struct sync_file_info_data {
 	__u32	len;
 	char	name[32];
 	__s32	status;
 
-	__u8	pt_info[0];
+	__u8	fence_info[0];
 };
 
 #define SYNC_IOC_MAGIC		'>'
-- 
2.5.0

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH 02/10] staging/android: rename sync_pt_info to fence_info
@ 2016-01-29 21:20   ` Gustavo Padovan
  0 siblings, 0 replies; 35+ messages in thread
From: Gustavo Padovan @ 2016-01-29 21:20 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: devel, Daniel Stone, Daniel Vetter, Riley Andrews, dri-devel,
	linux-kernel, Arve Hjønnevåg, Gustavo Padovan,
	John Harrison

From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>

As struct sync_pt doesn't exist anymore it is a good idea remove any
reference to it in the sync_framework. sync_pts were replaced directly by
fences.

Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
---
 drivers/staging/android/sync.c      |  8 ++++----
 drivers/staging/android/uapi/sync.h | 12 ++++++------
 2 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/android/sync.c b/drivers/staging/android/sync.c
index 381209a..ed63001 100644
--- a/drivers/staging/android/sync.c
+++ b/drivers/staging/android/sync.c
@@ -490,12 +490,12 @@ err_put_fd:
 	return err;
 }
 
-static int sync_fill_pt_info(struct fence *fence, void *data, int size)
+static int sync_fill_fence_info(struct fence *fence, void *data, int size)
 {
-	struct sync_pt_info *info = data;
+	struct fence_info *info = data;
 	int ret;
 
-	if (size < sizeof(struct sync_pt_info))
+	if (size < sizeof(*info))
 		return -ENOMEM;
 
 	info->len = sizeof(struct sync_pt_info);
@@ -553,7 +553,7 @@ static long sync_file_ioctl_fence_info(struct sync_file *sync_file,
 	for (i = 0; i < sync_file->num_fences; ++i) {
 		struct fence *fence = sync_file->cbs[i].fence;
 
-		ret = sync_fill_pt_info(fence, (u8 *)data + len, size - len);
+		ret = sync_fill_fence_info(fence, (u8 *)data + len, size - len);
 
 		if (ret < 0)
 			goto out;
diff --git a/drivers/staging/android/uapi/sync.h b/drivers/staging/android/uapi/sync.h
index 6c88c80..c4703ec 100644
--- a/drivers/staging/android/uapi/sync.h
+++ b/drivers/staging/android/uapi/sync.h
@@ -27,15 +27,15 @@ struct sync_merge_data {
 };
 
 /**
- * struct sync_pt_info - detailed sync_pt information
- * @len:		length of sync_pt_info including any driver_data
+ * struct fence_info - detailed fence information
+ * @len:		length of fence_info including any driver_data
  * @obj_name:		name of parent sync_timeline
  * @driver_name:	name of driver implementing the parent
- * @status:		status of the sync_pt 0:active 1:signaled <0:error
+ * @status:		status of the fence 0:active 1:signaled <0:error
  * @timestamp_ns:	timestamp of status change in nanoseconds
  * @driver_data:	any driver dependent data
  */
-struct sync_pt_info {
+struct fence_info {
 	__u32	len;
 	char	obj_name[32];
 	char	driver_name[32];
@@ -52,14 +52,14 @@ struct sync_pt_info {
  *		userspace including pt_info.
  * @name:	name of fence
  * @status:	status of fence. 1: signaled 0:active <0:error
- * @pt_info:	a sync_pt_info struct for every sync_pt in the fence
+ * @fence_info:	a fence_info struct for every fence in the sync_file
  */
 struct sync_file_info_data {
 	__u32	len;
 	char	name[32];
 	__s32	status;
 
-	__u8	pt_info[0];
+	__u8	fence_info[0];
 };
 
 #define SYNC_IOC_MAGIC		'>'
-- 
2.5.0

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH 03/10] staging/android: rename sync_file_info_data to sync_file_info
  2016-01-29 21:20 ` Gustavo Padovan
@ 2016-01-29 21:20   ` Gustavo Padovan
  -1 siblings, 0 replies; 35+ messages in thread
From: Gustavo Padovan @ 2016-01-29 21:20 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: linux-kernel, devel, dri-devel, Daniel Stone,
	Arve Hjønnevåg, Riley Andrews, Daniel Vetter,
	Rob Clark, Greg Hackmann, John Harrison, Maarten Lankhorst,
	Gustavo Padovan

From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>

info_data is a bit redundant, let's keep it as only sync_file_info. It is
also smaller.

Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
---
 drivers/staging/android/sync.c      | 26 +++++++++++++-------------
 drivers/staging/android/uapi/sync.h |  9 ++++-----
 2 files changed, 17 insertions(+), 18 deletions(-)

diff --git a/drivers/staging/android/sync.c b/drivers/staging/android/sync.c
index ed63001..a1cf9fd 100644
--- a/drivers/staging/android/sync.c
+++ b/drivers/staging/android/sync.c
@@ -525,7 +525,7 @@ static int sync_fill_fence_info(struct fence *fence, void *data, int size)
 static long sync_file_ioctl_fence_info(struct sync_file *sync_file,
 					unsigned long arg)
 {
-	struct sync_file_info_data *data;
+	struct sync_file_info *info;
 	__u32 size;
 	__u32 len = 0;
 	int ret, i;
@@ -533,27 +533,27 @@ static long sync_file_ioctl_fence_info(struct sync_file *sync_file,
 	if (copy_from_user(&size, (void __user *)arg, sizeof(size)))
 		return -EFAULT;
 
-	if (size < sizeof(struct sync_file_info_data))
+	if (size < sizeof(struct sync_file_info))
 		return -EINVAL;
 
 	if (size > 4096)
 		size = 4096;
 
-	data = kzalloc(size, GFP_KERNEL);
-	if (!data)
+	info = kzalloc(size, GFP_KERNEL);
+	if (!info)
 		return -ENOMEM;
 
-	strlcpy(data->name, sync_file->name, sizeof(data->name));
-	data->status = atomic_read(&sync_file->status);
-	if (data->status >= 0)
-		data->status = !data->status;
+	strlcpy(info->name, sync_file->name, sizeof(info->name));
+	info->status = atomic_read(&sync_file->status);
+	if (info->status >= 0)
+		info->status = !info->status;
 
-	len = sizeof(struct sync_file_info_data);
+	len = sizeof(struct sync_file_info);
 
 	for (i = 0; i < sync_file->num_fences; ++i) {
 		struct fence *fence = sync_file->cbs[i].fence;
 
-		ret = sync_fill_fence_info(fence, (u8 *)data + len, size - len);
+		ret = sync_fill_fence_info(fence, (u8 *)info + len, size - len);
 
 		if (ret < 0)
 			goto out;
@@ -561,15 +561,15 @@ static long sync_file_ioctl_fence_info(struct sync_file *sync_file,
 		len += ret;
 	}
 
-	data->len = len;
+	info->len = len;
 
-	if (copy_to_user((void __user *)arg, data, len))
+	if (copy_to_user((void __user *)arg, info, len))
 		ret = -EFAULT;
 	else
 		ret = 0;
 
 out:
-	kfree(data);
+	kfree(info);
 
 	return ret;
 }
diff --git a/drivers/staging/android/uapi/sync.h b/drivers/staging/android/uapi/sync.h
index c4703ec..70d05ad 100644
--- a/drivers/staging/android/uapi/sync.h
+++ b/drivers/staging/android/uapi/sync.h
@@ -46,15 +46,15 @@ struct fence_info {
 };
 
 /**
- * struct sync_file_info_data - data returned from fence info ioctl
+ * struct sync_file_info - data returned from fence info ioctl
  * @len:	ioctl caller writes the size of the buffer its passing in.
- *		ioctl returns length of sync_file_info_data returned to
+ *		ioctl returns length of sync_file_info returned to
  *		userspace including pt_info.
  * @name:	name of fence
  * @status:	status of fence. 1: signaled 0:active <0:error
  * @fence_info:	a fence_info struct for every fence in the sync_file
  */
-struct sync_file_info_data {
+struct sync_file_info {
 	__u32	len;
 	char	name[32];
 	__s32	status;
@@ -84,7 +84,6 @@ struct sync_file_info_data {
  * pt_info is a buffer containing sync_pt_infos for every sync_pt in the fence.
  * To iterate over the sync_pt_infos, use the sync_pt_info.len field.
  */
-#define SYNC_IOC_FENCE_INFO	_IOWR(SYNC_IOC_MAGIC, 2,\
-	struct sync_file_info_data)
+#define SYNC_IOC_FENCE_INFO	_IOWR(SYNC_IOC_MAGIC, 2, struct sync_file_info)
 
 #endif /* _UAPI_LINUX_SYNC_H */
-- 
2.5.0

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH 03/10] staging/android: rename sync_file_info_data to sync_file_info
@ 2016-01-29 21:20   ` Gustavo Padovan
  0 siblings, 0 replies; 35+ messages in thread
From: Gustavo Padovan @ 2016-01-29 21:20 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: devel, Daniel Stone, Daniel Vetter, Riley Andrews, dri-devel,
	linux-kernel, Arve Hjønnevåg, Gustavo Padovan,
	John Harrison

From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>

info_data is a bit redundant, let's keep it as only sync_file_info. It is
also smaller.

Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
---
 drivers/staging/android/sync.c      | 26 +++++++++++++-------------
 drivers/staging/android/uapi/sync.h |  9 ++++-----
 2 files changed, 17 insertions(+), 18 deletions(-)

diff --git a/drivers/staging/android/sync.c b/drivers/staging/android/sync.c
index ed63001..a1cf9fd 100644
--- a/drivers/staging/android/sync.c
+++ b/drivers/staging/android/sync.c
@@ -525,7 +525,7 @@ static int sync_fill_fence_info(struct fence *fence, void *data, int size)
 static long sync_file_ioctl_fence_info(struct sync_file *sync_file,
 					unsigned long arg)
 {
-	struct sync_file_info_data *data;
+	struct sync_file_info *info;
 	__u32 size;
 	__u32 len = 0;
 	int ret, i;
@@ -533,27 +533,27 @@ static long sync_file_ioctl_fence_info(struct sync_file *sync_file,
 	if (copy_from_user(&size, (void __user *)arg, sizeof(size)))
 		return -EFAULT;
 
-	if (size < sizeof(struct sync_file_info_data))
+	if (size < sizeof(struct sync_file_info))
 		return -EINVAL;
 
 	if (size > 4096)
 		size = 4096;
 
-	data = kzalloc(size, GFP_KERNEL);
-	if (!data)
+	info = kzalloc(size, GFP_KERNEL);
+	if (!info)
 		return -ENOMEM;
 
-	strlcpy(data->name, sync_file->name, sizeof(data->name));
-	data->status = atomic_read(&sync_file->status);
-	if (data->status >= 0)
-		data->status = !data->status;
+	strlcpy(info->name, sync_file->name, sizeof(info->name));
+	info->status = atomic_read(&sync_file->status);
+	if (info->status >= 0)
+		info->status = !info->status;
 
-	len = sizeof(struct sync_file_info_data);
+	len = sizeof(struct sync_file_info);
 
 	for (i = 0; i < sync_file->num_fences; ++i) {
 		struct fence *fence = sync_file->cbs[i].fence;
 
-		ret = sync_fill_fence_info(fence, (u8 *)data + len, size - len);
+		ret = sync_fill_fence_info(fence, (u8 *)info + len, size - len);
 
 		if (ret < 0)
 			goto out;
@@ -561,15 +561,15 @@ static long sync_file_ioctl_fence_info(struct sync_file *sync_file,
 		len += ret;
 	}
 
-	data->len = len;
+	info->len = len;
 
-	if (copy_to_user((void __user *)arg, data, len))
+	if (copy_to_user((void __user *)arg, info, len))
 		ret = -EFAULT;
 	else
 		ret = 0;
 
 out:
-	kfree(data);
+	kfree(info);
 
 	return ret;
 }
diff --git a/drivers/staging/android/uapi/sync.h b/drivers/staging/android/uapi/sync.h
index c4703ec..70d05ad 100644
--- a/drivers/staging/android/uapi/sync.h
+++ b/drivers/staging/android/uapi/sync.h
@@ -46,15 +46,15 @@ struct fence_info {
 };
 
 /**
- * struct sync_file_info_data - data returned from fence info ioctl
+ * struct sync_file_info - data returned from fence info ioctl
  * @len:	ioctl caller writes the size of the buffer its passing in.
- *		ioctl returns length of sync_file_info_data returned to
+ *		ioctl returns length of sync_file_info returned to
  *		userspace including pt_info.
  * @name:	name of fence
  * @status:	status of fence. 1: signaled 0:active <0:error
  * @fence_info:	a fence_info struct for every fence in the sync_file
  */
-struct sync_file_info_data {
+struct sync_file_info {
 	__u32	len;
 	char	name[32];
 	__s32	status;
@@ -84,7 +84,6 @@ struct sync_file_info_data {
  * pt_info is a buffer containing sync_pt_infos for every sync_pt in the fence.
  * To iterate over the sync_pt_infos, use the sync_pt_info.len field.
  */
-#define SYNC_IOC_FENCE_INFO	_IOWR(SYNC_IOC_MAGIC, 2,\
-	struct sync_file_info_data)
+#define SYNC_IOC_FENCE_INFO	_IOWR(SYNC_IOC_MAGIC, 2, struct sync_file_info)
 
 #endif /* _UAPI_LINUX_SYNC_H */
-- 
2.5.0

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH 04/10] staging/android: remove driver_data from struct fence_info
  2016-01-29 21:20 ` Gustavo Padovan
@ 2016-01-29 21:20   ` Gustavo Padovan
  -1 siblings, 0 replies; 35+ messages in thread
From: Gustavo Padovan @ 2016-01-29 21:20 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: linux-kernel, devel, dri-devel, Daniel Stone,
	Arve Hjønnevåg, Riley Andrews, Daniel Vetter,
	Rob Clark, Greg Hackmann, John Harrison, Maarten Lankhorst,
	Gustavo Padovan

From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>

It is unclear in what situations driver_data should be used thus better do
not upstream it for now. If a need arises in the future a discussion can
be started to re-add it.

Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
---
 drivers/staging/android/sw_sync.c   | 14 --------------
 drivers/staging/android/sync.c      | 21 ---------------------
 drivers/staging/android/sync.h      |  7 -------
 drivers/staging/android/uapi/sync.h |  5 +----
 4 files changed, 1 insertion(+), 46 deletions(-)

diff --git a/drivers/staging/android/sw_sync.c b/drivers/staging/android/sw_sync.c
index 3bee959..af39ff5 100644
--- a/drivers/staging/android/sw_sync.c
+++ b/drivers/staging/android/sw_sync.c
@@ -47,19 +47,6 @@ static int sw_sync_fence_has_signaled(struct fence *fence)
 	return (pt->value > obj->value) ? 0 : 1;
 }
 
-static int sw_sync_fill_driver_data(struct fence *fence,
-				    void *data, int size)
-{
-	struct sw_sync_pt *pt = (struct sw_sync_pt *)fence;
-
-	if (size < sizeof(pt->value))
-		return -ENOMEM;
-
-	memcpy(data, &pt->value, sizeof(pt->value));
-
-	return sizeof(pt->value);
-}
-
 static void sw_sync_timeline_value_str(struct sync_timeline *sync_timeline,
 				       char *str, int size)
 {
@@ -78,7 +65,6 @@ static void sw_sync_fence_value_str(struct fence *fence, char *str, int size)
 static struct sync_timeline_ops sw_sync_timeline_ops = {
 	.driver_name = "sw_sync",
 	.has_signaled = sw_sync_fence_has_signaled,
-	.fill_driver_data = sw_sync_fill_driver_data,
 	.timeline_value_str = sw_sync_timeline_value_str,
 	.fence_value_str = sw_sync_fence_value_str,
 };
diff --git a/drivers/staging/android/sync.c b/drivers/staging/android/sync.c
index a1cf9fd..ced6e61 100644
--- a/drivers/staging/android/sync.c
+++ b/drivers/staging/android/sync.c
@@ -351,16 +351,6 @@ static bool android_fence_enable_signaling(struct fence *fence)
 	return true;
 }
 
-static int android_fence_fill_driver_data(struct fence *fence,
-					  void *data, int size)
-{
-	struct sync_timeline *parent = fence_parent(fence);
-
-	if (!parent->ops->fill_driver_data)
-		return 0;
-	return parent->ops->fill_driver_data(fence, data, size);
-}
-
 static void android_fence_value_str(struct fence *fence,
 				    char *str, int size)
 {
@@ -394,7 +384,6 @@ static const struct fence_ops android_fence_ops = {
 	.signaled = android_fence_signaled,
 	.wait = fence_default_wait,
 	.release = android_fence_release,
-	.fill_driver_data = android_fence_fill_driver_data,
 	.fence_value_str = android_fence_value_str,
 	.timeline_value_str = android_fence_timeline_value_str,
 };
@@ -493,22 +482,12 @@ err_put_fd:
 static int sync_fill_fence_info(struct fence *fence, void *data, int size)
 {
 	struct fence_info *info = data;
-	int ret;
 
 	if (size < sizeof(*info))
 		return -ENOMEM;
 
 	info->len = sizeof(struct sync_pt_info);
 
-	if (fence->ops->fill_driver_data) {
-		ret = fence->ops->fill_driver_data(fence, info->driver_data,
-						   size - sizeof(*info));
-		if (ret < 0)
-			return ret;
-
-		info->len += ret;
-	}
-
 	strlcpy(info->obj_name, fence->ops->get_timeline_name(fence),
 		sizeof(info->obj_name));
 	strlcpy(info->driver_name, fence->ops->get_driver_name(fence),
diff --git a/drivers/staging/android/sync.h b/drivers/staging/android/sync.h
index af1af99..d2a1734 100644
--- a/drivers/staging/android/sync.h
+++ b/drivers/staging/android/sync.h
@@ -32,10 +32,6 @@ struct sync_file;
  *			  1 if pt has signaled
  *			  0 if pt has not signaled
  *			 <0 on error
- * @fill_driver_data:	write implementation specific driver data to data.
- *			  should return an error if there is not enough room
- *			  as specified by size.  This information is returned
- *			  to userspace by SYNC_IOC_FENCE_INFO.
  * @timeline_value_str: fill str with the value of the sync_timeline's counter
  * @fence_value_str:	fill str with the value of the fence
  */
@@ -46,9 +42,6 @@ struct sync_timeline_ops {
 	int (*has_signaled)(struct fence *fence);
 
 	/* optional */
-	int (*fill_driver_data)(struct fence *fence, void *data, int size);
-
-	/* optional */
 	void (*timeline_value_str)(struct sync_timeline *timeline, char *str,
 				   int size);
 
diff --git a/drivers/staging/android/uapi/sync.h b/drivers/staging/android/uapi/sync.h
index 70d05ad..cdc0f04 100644
--- a/drivers/staging/android/uapi/sync.h
+++ b/drivers/staging/android/uapi/sync.h
@@ -28,12 +28,11 @@ struct sync_merge_data {
 
 /**
  * struct fence_info - detailed fence information
- * @len:		length of fence_info including any driver_data
+ * @len:		length of fence_info
  * @obj_name:		name of parent sync_timeline
  * @driver_name:	name of driver implementing the parent
  * @status:		status of the fence 0:active 1:signaled <0:error
  * @timestamp_ns:	timestamp of status change in nanoseconds
- * @driver_data:	any driver dependent data
  */
 struct fence_info {
 	__u32	len;
@@ -41,8 +40,6 @@ struct fence_info {
 	char	driver_name[32];
 	__s32	status;
 	__u64	timestamp_ns;
-
-	__u8	driver_data[0];
 };
 
 /**
-- 
2.5.0

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH 04/10] staging/android: remove driver_data from struct fence_info
@ 2016-01-29 21:20   ` Gustavo Padovan
  0 siblings, 0 replies; 35+ messages in thread
From: Gustavo Padovan @ 2016-01-29 21:20 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: devel, Daniel Stone, Daniel Vetter, Riley Andrews, dri-devel,
	linux-kernel, Arve Hjønnevåg, Gustavo Padovan,
	John Harrison

From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>

It is unclear in what situations driver_data should be used thus better do
not upstream it for now. If a need arises in the future a discussion can
be started to re-add it.

Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
---
 drivers/staging/android/sw_sync.c   | 14 --------------
 drivers/staging/android/sync.c      | 21 ---------------------
 drivers/staging/android/sync.h      |  7 -------
 drivers/staging/android/uapi/sync.h |  5 +----
 4 files changed, 1 insertion(+), 46 deletions(-)

diff --git a/drivers/staging/android/sw_sync.c b/drivers/staging/android/sw_sync.c
index 3bee959..af39ff5 100644
--- a/drivers/staging/android/sw_sync.c
+++ b/drivers/staging/android/sw_sync.c
@@ -47,19 +47,6 @@ static int sw_sync_fence_has_signaled(struct fence *fence)
 	return (pt->value > obj->value) ? 0 : 1;
 }
 
-static int sw_sync_fill_driver_data(struct fence *fence,
-				    void *data, int size)
-{
-	struct sw_sync_pt *pt = (struct sw_sync_pt *)fence;
-
-	if (size < sizeof(pt->value))
-		return -ENOMEM;
-
-	memcpy(data, &pt->value, sizeof(pt->value));
-
-	return sizeof(pt->value);
-}
-
 static void sw_sync_timeline_value_str(struct sync_timeline *sync_timeline,
 				       char *str, int size)
 {
@@ -78,7 +65,6 @@ static void sw_sync_fence_value_str(struct fence *fence, char *str, int size)
 static struct sync_timeline_ops sw_sync_timeline_ops = {
 	.driver_name = "sw_sync",
 	.has_signaled = sw_sync_fence_has_signaled,
-	.fill_driver_data = sw_sync_fill_driver_data,
 	.timeline_value_str = sw_sync_timeline_value_str,
 	.fence_value_str = sw_sync_fence_value_str,
 };
diff --git a/drivers/staging/android/sync.c b/drivers/staging/android/sync.c
index a1cf9fd..ced6e61 100644
--- a/drivers/staging/android/sync.c
+++ b/drivers/staging/android/sync.c
@@ -351,16 +351,6 @@ static bool android_fence_enable_signaling(struct fence *fence)
 	return true;
 }
 
-static int android_fence_fill_driver_data(struct fence *fence,
-					  void *data, int size)
-{
-	struct sync_timeline *parent = fence_parent(fence);
-
-	if (!parent->ops->fill_driver_data)
-		return 0;
-	return parent->ops->fill_driver_data(fence, data, size);
-}
-
 static void android_fence_value_str(struct fence *fence,
 				    char *str, int size)
 {
@@ -394,7 +384,6 @@ static const struct fence_ops android_fence_ops = {
 	.signaled = android_fence_signaled,
 	.wait = fence_default_wait,
 	.release = android_fence_release,
-	.fill_driver_data = android_fence_fill_driver_data,
 	.fence_value_str = android_fence_value_str,
 	.timeline_value_str = android_fence_timeline_value_str,
 };
@@ -493,22 +482,12 @@ err_put_fd:
 static int sync_fill_fence_info(struct fence *fence, void *data, int size)
 {
 	struct fence_info *info = data;
-	int ret;
 
 	if (size < sizeof(*info))
 		return -ENOMEM;
 
 	info->len = sizeof(struct sync_pt_info);
 
-	if (fence->ops->fill_driver_data) {
-		ret = fence->ops->fill_driver_data(fence, info->driver_data,
-						   size - sizeof(*info));
-		if (ret < 0)
-			return ret;
-
-		info->len += ret;
-	}
-
 	strlcpy(info->obj_name, fence->ops->get_timeline_name(fence),
 		sizeof(info->obj_name));
 	strlcpy(info->driver_name, fence->ops->get_driver_name(fence),
diff --git a/drivers/staging/android/sync.h b/drivers/staging/android/sync.h
index af1af99..d2a1734 100644
--- a/drivers/staging/android/sync.h
+++ b/drivers/staging/android/sync.h
@@ -32,10 +32,6 @@ struct sync_file;
  *			  1 if pt has signaled
  *			  0 if pt has not signaled
  *			 <0 on error
- * @fill_driver_data:	write implementation specific driver data to data.
- *			  should return an error if there is not enough room
- *			  as specified by size.  This information is returned
- *			  to userspace by SYNC_IOC_FENCE_INFO.
  * @timeline_value_str: fill str with the value of the sync_timeline's counter
  * @fence_value_str:	fill str with the value of the fence
  */
@@ -46,9 +42,6 @@ struct sync_timeline_ops {
 	int (*has_signaled)(struct fence *fence);
 
 	/* optional */
-	int (*fill_driver_data)(struct fence *fence, void *data, int size);
-
-	/* optional */
 	void (*timeline_value_str)(struct sync_timeline *timeline, char *str,
 				   int size);
 
diff --git a/drivers/staging/android/uapi/sync.h b/drivers/staging/android/uapi/sync.h
index 70d05ad..cdc0f04 100644
--- a/drivers/staging/android/uapi/sync.h
+++ b/drivers/staging/android/uapi/sync.h
@@ -28,12 +28,11 @@ struct sync_merge_data {
 
 /**
  * struct fence_info - detailed fence information
- * @len:		length of fence_info including any driver_data
+ * @len:		length of fence_info
  * @obj_name:		name of parent sync_timeline
  * @driver_name:	name of driver implementing the parent
  * @status:		status of the fence 0:active 1:signaled <0:error
  * @timestamp_ns:	timestamp of status change in nanoseconds
- * @driver_data:	any driver dependent data
  */
 struct fence_info {
 	__u32	len;
@@ -41,8 +40,6 @@ struct fence_info {
 	char	driver_name[32];
 	__s32	status;
 	__u64	timestamp_ns;
-
-	__u8	driver_data[0];
 };
 
 /**
-- 
2.5.0

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH 05/10] staging/android: remove len field from struct fence_info
  2016-01-29 21:20 ` Gustavo Padovan
@ 2016-01-29 21:20   ` Gustavo Padovan
  -1 siblings, 0 replies; 35+ messages in thread
From: Gustavo Padovan @ 2016-01-29 21:20 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: linux-kernel, devel, dri-devel, Daniel Stone,
	Arve Hjønnevåg, Riley Andrews, Daniel Vetter,
	Rob Clark, Greg Hackmann, John Harrison, Maarten Lankhorst,
	Gustavo Padovan

From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>

After removing driver_data struct fence_info has now a fixed size,
thus it doesn't need any field to tell its size, it is already known.

Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
---
 drivers/staging/android/sync.c      | 4 +---
 drivers/staging/android/uapi/sync.h | 2 --
 2 files changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/staging/android/sync.c b/drivers/staging/android/sync.c
index ced6e61..f7530f0 100644
--- a/drivers/staging/android/sync.c
+++ b/drivers/staging/android/sync.c
@@ -486,8 +486,6 @@ static int sync_fill_fence_info(struct fence *fence, void *data, int size)
 	if (size < sizeof(*info))
 		return -ENOMEM;
 
-	info->len = sizeof(struct sync_pt_info);
-
 	strlcpy(info->obj_name, fence->ops->get_timeline_name(fence),
 		sizeof(info->obj_name));
 	strlcpy(info->driver_name, fence->ops->get_driver_name(fence),
@@ -498,7 +496,7 @@ static int sync_fill_fence_info(struct fence *fence, void *data, int size)
 		info->status = 0;
 	info->timestamp_ns = ktime_to_ns(fence->timestamp);
 
-	return info->len;
+	return sizeof(*info);
 }
 
 static long sync_file_ioctl_fence_info(struct sync_file *sync_file,
diff --git a/drivers/staging/android/uapi/sync.h b/drivers/staging/android/uapi/sync.h
index cdc0f04..ed281fc 100644
--- a/drivers/staging/android/uapi/sync.h
+++ b/drivers/staging/android/uapi/sync.h
@@ -28,14 +28,12 @@ struct sync_merge_data {
 
 /**
  * struct fence_info - detailed fence information
- * @len:		length of fence_info
  * @obj_name:		name of parent sync_timeline
  * @driver_name:	name of driver implementing the parent
  * @status:		status of the fence 0:active 1:signaled <0:error
  * @timestamp_ns:	timestamp of status change in nanoseconds
  */
 struct fence_info {
-	__u32	len;
 	char	obj_name[32];
 	char	driver_name[32];
 	__s32	status;
-- 
2.5.0

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH 05/10] staging/android: remove len field from struct fence_info
@ 2016-01-29 21:20   ` Gustavo Padovan
  0 siblings, 0 replies; 35+ messages in thread
From: Gustavo Padovan @ 2016-01-29 21:20 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: devel, Daniel Stone, Daniel Vetter, Riley Andrews, dri-devel,
	linux-kernel, Arve Hjønnevåg, Gustavo Padovan,
	John Harrison

From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>

After removing driver_data struct fence_info has now a fixed size,
thus it doesn't need any field to tell its size, it is already known.

Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
---
 drivers/staging/android/sync.c      | 4 +---
 drivers/staging/android/uapi/sync.h | 2 --
 2 files changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/staging/android/sync.c b/drivers/staging/android/sync.c
index ced6e61..f7530f0 100644
--- a/drivers/staging/android/sync.c
+++ b/drivers/staging/android/sync.c
@@ -486,8 +486,6 @@ static int sync_fill_fence_info(struct fence *fence, void *data, int size)
 	if (size < sizeof(*info))
 		return -ENOMEM;
 
-	info->len = sizeof(struct sync_pt_info);
-
 	strlcpy(info->obj_name, fence->ops->get_timeline_name(fence),
 		sizeof(info->obj_name));
 	strlcpy(info->driver_name, fence->ops->get_driver_name(fence),
@@ -498,7 +496,7 @@ static int sync_fill_fence_info(struct fence *fence, void *data, int size)
 		info->status = 0;
 	info->timestamp_ns = ktime_to_ns(fence->timestamp);
 
-	return info->len;
+	return sizeof(*info);
 }
 
 static long sync_file_ioctl_fence_info(struct sync_file *sync_file,
diff --git a/drivers/staging/android/uapi/sync.h b/drivers/staging/android/uapi/sync.h
index cdc0f04..ed281fc 100644
--- a/drivers/staging/android/uapi/sync.h
+++ b/drivers/staging/android/uapi/sync.h
@@ -28,14 +28,12 @@ struct sync_merge_data {
 
 /**
  * struct fence_info - detailed fence information
- * @len:		length of fence_info
  * @obj_name:		name of parent sync_timeline
  * @driver_name:	name of driver implementing the parent
  * @status:		status of the fence 0:active 1:signaled <0:error
  * @timestamp_ns:	timestamp of status change in nanoseconds
  */
 struct fence_info {
-	__u32	len;
 	char	obj_name[32];
 	char	driver_name[32];
 	__s32	status;
-- 
2.5.0

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH 06/10] staging/android: turn fence_info into a __64 pointer
  2016-01-29 21:20 ` Gustavo Padovan
@ 2016-01-29 21:20   ` Gustavo Padovan
  -1 siblings, 0 replies; 35+ messages in thread
From: Gustavo Padovan @ 2016-01-29 21:20 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: linux-kernel, devel, dri-devel, Daniel Stone,
	Arve Hjønnevåg, Riley Andrews, Daniel Vetter,
	Rob Clark, Greg Hackmann, John Harrison, Maarten Lankhorst,
	Gustavo Padovan

From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>

Making fence_info a pointer enables us to extend the struct in the future
without breaking the ABI.

Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
---
 drivers/staging/android/sync.c      | 2 +-
 drivers/staging/android/uapi/sync.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/android/sync.c b/drivers/staging/android/sync.c
index f7530f0..51d4f47 100644
--- a/drivers/staging/android/sync.c
+++ b/drivers/staging/android/sync.c
@@ -525,7 +525,7 @@ static long sync_file_ioctl_fence_info(struct sync_file *sync_file,
 	if (info->status >= 0)
 		info->status = !info->status;
 
-	len = sizeof(struct sync_file_info);
+	len = sizeof(struct sync_file_info) - sizeof(__u64 *);
 
 	for (i = 0; i < sync_file->num_fences; ++i) {
 		struct fence *fence = sync_file->cbs[i].fence;
diff --git a/drivers/staging/android/uapi/sync.h b/drivers/staging/android/uapi/sync.h
index ed281fc..9f07aa7 100644
--- a/drivers/staging/android/uapi/sync.h
+++ b/drivers/staging/android/uapi/sync.h
@@ -54,7 +54,7 @@ struct sync_file_info {
 	char	name[32];
 	__s32	status;
 
-	__u8	fence_info[0];
+	__u64	*fence_info;
 };
 
 #define SYNC_IOC_MAGIC		'>'
-- 
2.5.0

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH 06/10] staging/android: turn fence_info into a __64 pointer
@ 2016-01-29 21:20   ` Gustavo Padovan
  0 siblings, 0 replies; 35+ messages in thread
From: Gustavo Padovan @ 2016-01-29 21:20 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: devel, Daniel Stone, Daniel Vetter, Riley Andrews, dri-devel,
	linux-kernel, Arve Hjønnevåg, Gustavo Padovan,
	John Harrison

From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>

Making fence_info a pointer enables us to extend the struct in the future
without breaking the ABI.

Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
---
 drivers/staging/android/sync.c      | 2 +-
 drivers/staging/android/uapi/sync.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/android/sync.c b/drivers/staging/android/sync.c
index f7530f0..51d4f47 100644
--- a/drivers/staging/android/sync.c
+++ b/drivers/staging/android/sync.c
@@ -525,7 +525,7 @@ static long sync_file_ioctl_fence_info(struct sync_file *sync_file,
 	if (info->status >= 0)
 		info->status = !info->status;
 
-	len = sizeof(struct sync_file_info);
+	len = sizeof(struct sync_file_info) - sizeof(__u64 *);
 
 	for (i = 0; i < sync_file->num_fences; ++i) {
 		struct fence *fence = sync_file->cbs[i].fence;
diff --git a/drivers/staging/android/uapi/sync.h b/drivers/staging/android/uapi/sync.h
index ed281fc..9f07aa7 100644
--- a/drivers/staging/android/uapi/sync.h
+++ b/drivers/staging/android/uapi/sync.h
@@ -54,7 +54,7 @@ struct sync_file_info {
 	char	name[32];
 	__s32	status;
 
-	__u8	fence_info[0];
+	__u64	*fence_info;
 };
 
 #define SYNC_IOC_MAGIC		'>'
-- 
2.5.0

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH 07/10] staging/android: add num_fences field to struct sync_file_info
  2016-01-29 21:20 ` Gustavo Padovan
@ 2016-01-29 21:20   ` Gustavo Padovan
  -1 siblings, 0 replies; 35+ messages in thread
From: Gustavo Padovan @ 2016-01-29 21:20 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: linux-kernel, devel, dri-devel, Daniel Stone,
	Arve Hjønnevåg, Riley Andrews, Daniel Vetter,
	Rob Clark, Greg Hackmann, John Harrison, Maarten Lankhorst,
	Gustavo Padovan

From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>

Inform the users how many fences are in the fence_info field.

Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
---
 drivers/staging/android/sync.c      | 2 ++
 drivers/staging/android/uapi/sync.h | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/drivers/staging/android/sync.c b/drivers/staging/android/sync.c
index 51d4f47..ae42810 100644
--- a/drivers/staging/android/sync.c
+++ b/drivers/staging/android/sync.c
@@ -525,6 +525,8 @@ static long sync_file_ioctl_fence_info(struct sync_file *sync_file,
 	if (info->status >= 0)
 		info->status = !info->status;
 
+	info->num_fences = sync_file->num_fences;
+
 	len = sizeof(struct sync_file_info) - sizeof(__u64 *);
 
 	for (i = 0; i < sync_file->num_fences; ++i) {
diff --git a/drivers/staging/android/uapi/sync.h b/drivers/staging/android/uapi/sync.h
index 9f07aa7..9a607ea 100644
--- a/drivers/staging/android/uapi/sync.h
+++ b/drivers/staging/android/uapi/sync.h
@@ -47,12 +47,14 @@ struct fence_info {
  *		userspace including pt_info.
  * @name:	name of fence
  * @status:	status of fence. 1: signaled 0:active <0:error
+ * @num_fences	number of fences in the sync_file
  * @fence_info:	a fence_info struct for every fence in the sync_file
  */
 struct sync_file_info {
 	__u32	len;
 	char	name[32];
 	__s32	status;
+	__u32	num_fences;
 
 	__u64	*fence_info;
 };
-- 
2.5.0

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH 07/10] staging/android: add num_fences field to struct sync_file_info
@ 2016-01-29 21:20   ` Gustavo Padovan
  0 siblings, 0 replies; 35+ messages in thread
From: Gustavo Padovan @ 2016-01-29 21:20 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: devel, Daniel Stone, Daniel Vetter, Riley Andrews, dri-devel,
	linux-kernel, Arve Hjønnevåg, Gustavo Padovan,
	John Harrison

From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>

Inform the users how many fences are in the fence_info field.

Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
---
 drivers/staging/android/sync.c      | 2 ++
 drivers/staging/android/uapi/sync.h | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/drivers/staging/android/sync.c b/drivers/staging/android/sync.c
index 51d4f47..ae42810 100644
--- a/drivers/staging/android/sync.c
+++ b/drivers/staging/android/sync.c
@@ -525,6 +525,8 @@ static long sync_file_ioctl_fence_info(struct sync_file *sync_file,
 	if (info->status >= 0)
 		info->status = !info->status;
 
+	info->num_fences = sync_file->num_fences;
+
 	len = sizeof(struct sync_file_info) - sizeof(__u64 *);
 
 	for (i = 0; i < sync_file->num_fences; ++i) {
diff --git a/drivers/staging/android/uapi/sync.h b/drivers/staging/android/uapi/sync.h
index 9f07aa7..9a607ea 100644
--- a/drivers/staging/android/uapi/sync.h
+++ b/drivers/staging/android/uapi/sync.h
@@ -47,12 +47,14 @@ struct fence_info {
  *		userspace including pt_info.
  * @name:	name of fence
  * @status:	status of fence. 1: signaled 0:active <0:error
+ * @num_fences	number of fences in the sync_file
  * @fence_info:	a fence_info struct for every fence in the sync_file
  */
 struct sync_file_info {
 	__u32	len;
 	char	name[32];
 	__s32	status;
+	__u32	num_fences;
 
 	__u64	*fence_info;
 };
-- 
2.5.0

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH 08/10] staging/android: rename SYNC_IOC_FENCE_INFO
  2016-01-29 21:20 ` Gustavo Padovan
@ 2016-01-29 21:20   ` Gustavo Padovan
  -1 siblings, 0 replies; 35+ messages in thread
From: Gustavo Padovan @ 2016-01-29 21:20 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: linux-kernel, devel, dri-devel, Daniel Stone,
	Arve Hjønnevåg, Riley Andrews, Daniel Vetter,
	Rob Clark, Greg Hackmann, John Harrison, Maarten Lankhorst,
	Gustavo Padovan

From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>

We don't use the 'fence' name to refer to sync_file anymore. So rename it
to SYNC_IOC_FILE_INFO.

Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
---
 drivers/staging/android/sync.c      | 2 +-
 drivers/staging/android/uapi/sync.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/android/sync.c b/drivers/staging/android/sync.c
index ae42810..e1d4fcb 100644
--- a/drivers/staging/android/sync.c
+++ b/drivers/staging/android/sync.c
@@ -562,7 +562,7 @@ static long sync_file_ioctl(struct file *file, unsigned int cmd,
 	case SYNC_IOC_MERGE:
 		return sync_file_ioctl_merge(sync_file, arg);
 
-	case SYNC_IOC_FENCE_INFO:
+	case SYNC_IOC_FILE_INFO:
 		return sync_file_ioctl_fence_info(sync_file, arg);
 
 	default:
diff --git a/drivers/staging/android/uapi/sync.h b/drivers/staging/android/uapi/sync.h
index 9a607ea..b00f0eb 100644
--- a/drivers/staging/android/uapi/sync.h
+++ b/drivers/staging/android/uapi/sync.h
@@ -81,6 +81,6 @@ struct sync_file_info {
  * pt_info is a buffer containing sync_pt_infos for every sync_pt in the fence.
  * To iterate over the sync_pt_infos, use the sync_pt_info.len field.
  */
-#define SYNC_IOC_FENCE_INFO	_IOWR(SYNC_IOC_MAGIC, 2, struct sync_file_info)
+#define SYNC_IOC_FILE_INFO	_IOWR(SYNC_IOC_MAGIC, 2, struct sync_file_info)
 
 #endif /* _UAPI_LINUX_SYNC_H */
-- 
2.5.0

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH 08/10] staging/android: rename SYNC_IOC_FENCE_INFO
@ 2016-01-29 21:20   ` Gustavo Padovan
  0 siblings, 0 replies; 35+ messages in thread
From: Gustavo Padovan @ 2016-01-29 21:20 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: devel, Daniel Stone, Daniel Vetter, Riley Andrews, dri-devel,
	linux-kernel, Arve Hjønnevåg, Gustavo Padovan,
	John Harrison

From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>

We don't use the 'fence' name to refer to sync_file anymore. So rename it
to SYNC_IOC_FILE_INFO.

Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
---
 drivers/staging/android/sync.c      | 2 +-
 drivers/staging/android/uapi/sync.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/android/sync.c b/drivers/staging/android/sync.c
index ae42810..e1d4fcb 100644
--- a/drivers/staging/android/sync.c
+++ b/drivers/staging/android/sync.c
@@ -562,7 +562,7 @@ static long sync_file_ioctl(struct file *file, unsigned int cmd,
 	case SYNC_IOC_MERGE:
 		return sync_file_ioctl_merge(sync_file, arg);
 
-	case SYNC_IOC_FENCE_INFO:
+	case SYNC_IOC_FILE_INFO:
 		return sync_file_ioctl_fence_info(sync_file, arg);
 
 	default:
diff --git a/drivers/staging/android/uapi/sync.h b/drivers/staging/android/uapi/sync.h
index 9a607ea..b00f0eb 100644
--- a/drivers/staging/android/uapi/sync.h
+++ b/drivers/staging/android/uapi/sync.h
@@ -81,6 +81,6 @@ struct sync_file_info {
  * pt_info is a buffer containing sync_pt_infos for every sync_pt in the fence.
  * To iterate over the sync_pt_infos, use the sync_pt_info.len field.
  */
-#define SYNC_IOC_FENCE_INFO	_IOWR(SYNC_IOC_MAGIC, 2, struct sync_file_info)
+#define SYNC_IOC_FILE_INFO	_IOWR(SYNC_IOC_MAGIC, 2, struct sync_file_info)
 
 #endif /* _UAPI_LINUX_SYNC_H */
-- 
2.5.0

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH 09/10] staging/android: add flags member to sync ioctl structs
  2016-01-29 21:20 ` Gustavo Padovan
                   ` (8 preceding siblings ...)
  (?)
@ 2016-01-29 21:20 ` Gustavo Padovan
  2016-01-30 18:12     ` Emil Velikov
  2016-02-01  8:39     ` Maarten Lankhorst
  -1 siblings, 2 replies; 35+ messages in thread
From: Gustavo Padovan @ 2016-01-29 21:20 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: linux-kernel, devel, dri-devel, Daniel Stone,
	Arve Hjønnevåg, Riley Andrews, Daniel Vetter,
	Rob Clark, Greg Hackmann, John Harrison, Maarten Lankhorst,
	Gustavo Padovan

From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>

Play safe and add flags member to all structs. So we don't need to
break API or create new IOCTL in the future if new features that requires
flags arises.

Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
---
 drivers/staging/android/uapi/sync.h | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/staging/android/uapi/sync.h b/drivers/staging/android/uapi/sync.h
index b00f0eb..45921f6 100644
--- a/drivers/staging/android/uapi/sync.h
+++ b/drivers/staging/android/uapi/sync.h
@@ -19,11 +19,13 @@
  * @fd2:	file descriptor of second fence
  * @name:	name of new fence
  * @fence:	returns the fd of the new fence to userspace
+ * @flags:	merge_data flags
  */
 struct sync_merge_data {
 	__s32	fd2; /* fd of second fence */
 	char	name[32]; /* name of new fence */
 	__s32	fence; /* fd on newly created fence */
+	__u32	flags;
 };
 
 /**
@@ -31,12 +33,14 @@ struct sync_merge_data {
  * @obj_name:		name of parent sync_timeline
  * @driver_name:	name of driver implementing the parent
  * @status:		status of the fence 0:active 1:signaled <0:error
+ * @flags:		fence_info flags
  * @timestamp_ns:	timestamp of status change in nanoseconds
  */
 struct fence_info {
 	char	obj_name[32];
 	char	driver_name[32];
 	__s32	status;
+	__u32	flags;
 	__u64	timestamp_ns;
 };
 
@@ -47,6 +51,7 @@ struct fence_info {
  *		userspace including pt_info.
  * @name:	name of fence
  * @status:	status of fence. 1: signaled 0:active <0:error
+ * @flags:	sync_file_info flags
  * @num_fences	number of fences in the sync_file
  * @fence_info:	a fence_info struct for every fence in the sync_file
  */
@@ -54,6 +59,7 @@ struct sync_file_info {
 	__u32	len;
 	char	name[32];
 	__s32	status;
+	__u32	flags;
 	__u32	num_fences;
 
 	__u64	*fence_info;
-- 
2.5.0

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH 10/10] staging/android: remove redundant comments on sync_merge_data
  2016-01-29 21:20 ` Gustavo Padovan
@ 2016-01-29 21:20   ` Gustavo Padovan
  -1 siblings, 0 replies; 35+ messages in thread
From: Gustavo Padovan @ 2016-01-29 21:20 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: linux-kernel, devel, dri-devel, Daniel Stone,
	Arve Hjønnevåg, Riley Andrews, Daniel Vetter,
	Rob Clark, Greg Hackmann, John Harrison, Maarten Lankhorst,
	Gustavo Padovan

From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>

struct sync_merge_data already have documentation on top of the
struct definition. No need to duplicate it.

Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
---
 drivers/staging/android/uapi/sync.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/android/uapi/sync.h b/drivers/staging/android/uapi/sync.h
index 45921f6..0e940cb 100644
--- a/drivers/staging/android/uapi/sync.h
+++ b/drivers/staging/android/uapi/sync.h
@@ -22,9 +22,9 @@
  * @flags:	merge_data flags
  */
 struct sync_merge_data {
-	__s32	fd2; /* fd of second fence */
-	char	name[32]; /* name of new fence */
-	__s32	fence; /* fd on newly created fence */
+	__s32	fd2;
+	char	name[32];
+	__s32	fence;
 	__u32	flags;
 };
 
-- 
2.5.0

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH 10/10] staging/android: remove redundant comments on sync_merge_data
@ 2016-01-29 21:20   ` Gustavo Padovan
  0 siblings, 0 replies; 35+ messages in thread
From: Gustavo Padovan @ 2016-01-29 21:20 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: devel, Daniel Stone, Daniel Vetter, Riley Andrews, dri-devel,
	linux-kernel, Arve Hjønnevåg, Gustavo Padovan,
	John Harrison

From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>

struct sync_merge_data already have documentation on top of the
struct definition. No need to duplicate it.

Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
---
 drivers/staging/android/uapi/sync.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/android/uapi/sync.h b/drivers/staging/android/uapi/sync.h
index 45921f6..0e940cb 100644
--- a/drivers/staging/android/uapi/sync.h
+++ b/drivers/staging/android/uapi/sync.h
@@ -22,9 +22,9 @@
  * @flags:	merge_data flags
  */
 struct sync_merge_data {
-	__s32	fd2; /* fd of second fence */
-	char	name[32]; /* name of new fence */
-	__s32	fence; /* fd on newly created fence */
+	__s32	fd2;
+	char	name[32];
+	__s32	fence;
 	__u32	flags;
 };
 
-- 
2.5.0

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* Re: [PATCH 06/10] staging/android: turn fence_info into a __64 pointer
  2016-01-29 21:20   ` Gustavo Padovan
@ 2016-01-30 18:04     ` Emil Velikov
  -1 siblings, 0 replies; 35+ messages in thread
From: Emil Velikov @ 2016-01-30 18:04 UTC (permalink / raw)
  To: Gustavo Padovan
  Cc: Greg Kroah-Hartman, devel, Daniel Stone, Daniel Vetter,
	Riley Andrews, ML dri-devel, Linux-Kernel@Vger. Kernel. Org,
	Arve Hjønnevåg, Gustavo Padovan, John Harrison

Hi Gustavo,

s/__64/__u64/ in the commit message.

On 29 January 2016 at 23:20, Gustavo Padovan <gustavo@padovan.org> wrote:
> From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
>
> Making fence_info a pointer enables us to extend the struct in the future
> without breaking the ABI.
>
> Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>

> diff --git a/drivers/staging/android/uapi/sync.h b/drivers/staging/android/uapi/sync.h
> index ed281fc..9f07aa7 100644
> --- a/drivers/staging/android/uapi/sync.h
> +++ b/drivers/staging/android/uapi/sync.h
> @@ -54,7 +54,7 @@ struct sync_file_info {
>         char    name[32];
>         __s32   status;
>
> -       __u8    fence_info[0];
> +       __u64   *fence_info;
I believe you misinterpreted what was meant with "_u64 pointer". As
the storage use for of a pointer varies across 32/64 bit arch, we
explicitly use a variable type that is large enough (and consistent)
for both cases. Thus the above should be

+       __u64   fence_info;

Hope this clarifies things.

-Emil

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [PATCH 06/10] staging/android: turn fence_info into a __64 pointer
@ 2016-01-30 18:04     ` Emil Velikov
  0 siblings, 0 replies; 35+ messages in thread
From: Emil Velikov @ 2016-01-30 18:04 UTC (permalink / raw)
  To: Gustavo Padovan
  Cc: devel, Daniel Stone, Greg Kroah-Hartman,
	Linux-Kernel@Vger. Kernel. Org, ML dri-devel, Riley Andrews,
	Arve Hjønnevåg, Daniel Vetter, Gustavo Padovan,
	John Harrison

Hi Gustavo,

s/__64/__u64/ in the commit message.

On 29 January 2016 at 23:20, Gustavo Padovan <gustavo@padovan.org> wrote:
> From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
>
> Making fence_info a pointer enables us to extend the struct in the future
> without breaking the ABI.
>
> Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>

> diff --git a/drivers/staging/android/uapi/sync.h b/drivers/staging/android/uapi/sync.h
> index ed281fc..9f07aa7 100644
> --- a/drivers/staging/android/uapi/sync.h
> +++ b/drivers/staging/android/uapi/sync.h
> @@ -54,7 +54,7 @@ struct sync_file_info {
>         char    name[32];
>         __s32   status;
>
> -       __u8    fence_info[0];
> +       __u64   *fence_info;
I believe you misinterpreted what was meant with "_u64 pointer". As
the storage use for of a pointer varies across 32/64 bit arch, we
explicitly use a variable type that is large enough (and consistent)
for both cases. Thus the above should be

+       __u64   fence_info;

Hope this clarifies things.

-Emil
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [PATCH 09/10] staging/android: add flags member to sync ioctl structs
  2016-01-29 21:20 ` [PATCH 09/10] staging/android: add flags member to sync ioctl structs Gustavo Padovan
@ 2016-01-30 18:12     ` Emil Velikov
  2016-02-01  8:39     ` Maarten Lankhorst
  1 sibling, 0 replies; 35+ messages in thread
From: Emil Velikov @ 2016-01-30 18:12 UTC (permalink / raw)
  To: Gustavo Padovan
  Cc: Greg Kroah-Hartman, devel, Daniel Stone, Daniel Vetter,
	Riley Andrews, ML dri-devel, Linux-Kernel@Vger. Kernel. Org,
	Arve Hjønnevåg, Gustavo Padovan, John Harrison

Hi Gustavo,

> @@ -54,6 +59,7 @@ struct sync_file_info {
>         __u32   len;
As mentioned previously - can we rework this variable to indicate the
total length (or the number) of fence_info struct instances. It seems
to be the more common approach afaict. Might also want to move it just
above the fence_into?

-Emil

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [PATCH 09/10] staging/android: add flags member to sync ioctl structs
@ 2016-01-30 18:12     ` Emil Velikov
  0 siblings, 0 replies; 35+ messages in thread
From: Emil Velikov @ 2016-01-30 18:12 UTC (permalink / raw)
  To: Gustavo Padovan
  Cc: devel, Daniel Stone, Greg Kroah-Hartman,
	Linux-Kernel@Vger. Kernel. Org, ML dri-devel, Riley Andrews,
	Arve Hjønnevåg, Daniel Vetter, Gustavo Padovan,
	John Harrison

Hi Gustavo,

> @@ -54,6 +59,7 @@ struct sync_file_info {
>         __u32   len;
As mentioned previously - can we rework this variable to indicate the
total length (or the number) of fence_info struct instances. It seems
to be the more common approach afaict. Might also want to move it just
above the fence_into?

-Emil
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [PATCH 09/10] staging/android: add flags member to sync ioctl structs
  2016-01-29 21:20 ` [PATCH 09/10] staging/android: add flags member to sync ioctl structs Gustavo Padovan
@ 2016-02-01  8:39     ` Maarten Lankhorst
  2016-02-01  8:39     ` Maarten Lankhorst
  1 sibling, 0 replies; 35+ messages in thread
From: Maarten Lankhorst @ 2016-02-01  8:39 UTC (permalink / raw)
  To: Gustavo Padovan, Greg Kroah-Hartman
  Cc: linux-kernel, devel, dri-devel, Daniel Stone,
	Arve Hjønnevåg, Riley Andrews, Daniel Vetter,
	Rob Clark, Greg Hackmann, John Harrison, Gustavo Padovan

Op 29-01-16 om 22:20 schreef Gustavo Padovan:
> From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
>
> Play safe and add flags member to all structs. So we don't need to
> break API or create new IOCTL in the future if new features that requires
> flags arises.
>
This only helps if you reject flags != 0 in the ioctl, else when you extend the abi userspace might initialize it with garbage.

~Maarten

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [PATCH 09/10] staging/android: add flags member to sync ioctl structs
@ 2016-02-01  8:39     ` Maarten Lankhorst
  0 siblings, 0 replies; 35+ messages in thread
From: Maarten Lankhorst @ 2016-02-01  8:39 UTC (permalink / raw)
  To: Gustavo Padovan, Greg Kroah-Hartman
  Cc: devel, Daniel Stone, Daniel Vetter, Riley Andrews, dri-devel,
	linux-kernel, Arve Hjønnevåg, Gustavo Padovan,
	John Harrison

Op 29-01-16 om 22:20 schreef Gustavo Padovan:
> From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
>
> Play safe and add flags member to all structs. So we don't need to
> break API or create new IOCTL in the future if new features that requires
> flags arises.
>
This only helps if you reject flags != 0 in the ioctl, else when you extend the abi userspace might initialize it with garbage.

~Maarten
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [PATCH 06/10] staging/android: turn fence_info into a __64 pointer
  2016-01-29 21:20   ` Gustavo Padovan
@ 2016-02-01  8:41     ` Maarten Lankhorst
  -1 siblings, 0 replies; 35+ messages in thread
From: Maarten Lankhorst @ 2016-02-01  8:41 UTC (permalink / raw)
  To: Gustavo Padovan, Greg Kroah-Hartman
  Cc: linux-kernel, devel, dri-devel, Daniel Stone,
	Arve Hjønnevåg, Riley Andrews, Daniel Vetter,
	Rob Clark, Greg Hackmann, John Harrison, Gustavo Padovan

Op 29-01-16 om 22:20 schreef Gustavo Padovan:
> From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
>
> Making fence_info a pointer enables us to extend the struct in the future
> without breaking the ABI.
>
> Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
> ---
>  drivers/staging/android/sync.c      | 2 +-
>  drivers/staging/android/uapi/sync.h | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/staging/android/sync.c b/drivers/staging/android/sync.c
> index f7530f0..51d4f47 100644
> --- a/drivers/staging/android/sync.c
> +++ b/drivers/staging/android/sync.c
> @@ -525,7 +525,7 @@ static long sync_file_ioctl_fence_info(struct sync_file *sync_file,
>  	if (info->status >= 0)
>  		info->status = !info->status;
>  
> -	len = sizeof(struct sync_file_info);
> +	len = sizeof(struct sync_file_info) - sizeof(__u64 *);
>  
>  	for (i = 0; i < sync_file->num_fences; ++i) {
>  		struct fence *fence = sync_file->cbs[i].fence;
> diff --git a/drivers/staging/android/uapi/sync.h b/drivers/staging/android/uapi/sync.h
> index ed281fc..9f07aa7 100644
> --- a/drivers/staging/android/uapi/sync.h
> +++ b/drivers/staging/android/uapi/sync.h
> @@ -54,7 +54,7 @@ struct sync_file_info {
>  	char	name[32];
>  	__s32	status;
>  
> -	__u8	fence_info[0];
> +	__u64	*fence_info;
>  };
>
Pointers are awful, it should be a __u64 since it's a pointer type. Userspace should cast it to a uintptr_t in userspace.
This structure also won't work on 64-bits systems, there may be a hole between fence_info and status (or num_fences in next patch).

It's probably best to move it to the top and ensure the struct is 64-bits aligned.

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [PATCH 06/10] staging/android: turn fence_info into a __64 pointer
@ 2016-02-01  8:41     ` Maarten Lankhorst
  0 siblings, 0 replies; 35+ messages in thread
From: Maarten Lankhorst @ 2016-02-01  8:41 UTC (permalink / raw)
  To: Gustavo Padovan, Greg Kroah-Hartman
  Cc: devel, Daniel Stone, Daniel Vetter, Riley Andrews, dri-devel,
	linux-kernel, Arve Hjønnevåg, Gustavo Padovan,
	John Harrison

Op 29-01-16 om 22:20 schreef Gustavo Padovan:
> From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
>
> Making fence_info a pointer enables us to extend the struct in the future
> without breaking the ABI.
>
> Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
> ---
>  drivers/staging/android/sync.c      | 2 +-
>  drivers/staging/android/uapi/sync.h | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/staging/android/sync.c b/drivers/staging/android/sync.c
> index f7530f0..51d4f47 100644
> --- a/drivers/staging/android/sync.c
> +++ b/drivers/staging/android/sync.c
> @@ -525,7 +525,7 @@ static long sync_file_ioctl_fence_info(struct sync_file *sync_file,
>  	if (info->status >= 0)
>  		info->status = !info->status;
>  
> -	len = sizeof(struct sync_file_info);
> +	len = sizeof(struct sync_file_info) - sizeof(__u64 *);
>  
>  	for (i = 0; i < sync_file->num_fences; ++i) {
>  		struct fence *fence = sync_file->cbs[i].fence;
> diff --git a/drivers/staging/android/uapi/sync.h b/drivers/staging/android/uapi/sync.h
> index ed281fc..9f07aa7 100644
> --- a/drivers/staging/android/uapi/sync.h
> +++ b/drivers/staging/android/uapi/sync.h
> @@ -54,7 +54,7 @@ struct sync_file_info {
>  	char	name[32];
>  	__s32	status;
>  
> -	__u8	fence_info[0];
> +	__u64	*fence_info;
>  };
>
Pointers are awful, it should be a __u64 since it's a pointer type. Userspace should cast it to a uintptr_t in userspace.
This structure also won't work on 64-bits systems, there may be a hole between fence_info and status (or num_fences in next patch).

It's probably best to move it to the top and ensure the struct is 64-bits aligned.
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [PATCH 09/10] staging/android: add flags member to sync ioctl structs
  2016-01-30 18:12     ` Emil Velikov
@ 2016-02-01 13:24       ` Gustavo Padovan
  -1 siblings, 0 replies; 35+ messages in thread
From: Gustavo Padovan @ 2016-02-01 13:24 UTC (permalink / raw)
  To: Emil Velikov
  Cc: Greg Kroah-Hartman, devel, Daniel Stone, Daniel Vetter,
	Riley Andrews, ML dri-devel, Linux-Kernel@Vger. Kernel. Org,
	Arve Hjønnevåg, Gustavo Padovan, John Harrison

2016-01-30 Emil Velikov <emil.l.velikov@gmail.com>:

> Hi Gustavo,
> 
> > @@ -54,6 +59,7 @@ struct sync_file_info {
> >         __u32   len;
> As mentioned previously - can we rework this variable to indicate the
> total length (or the number) of fence_info struct instances. It seems
> to be the more common approach afaict. Might also want to move it just
> above the fence_into?

Sure, I think this is a good idea.

	Gustavo

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [PATCH 09/10] staging/android: add flags member to sync ioctl structs
@ 2016-02-01 13:24       ` Gustavo Padovan
  0 siblings, 0 replies; 35+ messages in thread
From: Gustavo Padovan @ 2016-02-01 13:24 UTC (permalink / raw)
  To: Emil Velikov
  Cc: devel, Daniel Stone, Greg Kroah-Hartman,
	Linux-Kernel@Vger. Kernel. Org, ML dri-devel, Riley Andrews,
	Arve Hjønnevåg, Daniel Vetter, Gustavo Padovan,
	John Harrison

2016-01-30 Emil Velikov <emil.l.velikov@gmail.com>:

> Hi Gustavo,
> 
> > @@ -54,6 +59,7 @@ struct sync_file_info {
> >         __u32   len;
> As mentioned previously - can we rework this variable to indicate the
> total length (or the number) of fence_info struct instances. It seems
> to be the more common approach afaict. Might also want to move it just
> above the fence_into?

Sure, I think this is a good idea.

	Gustavo
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [PATCH 06/10] staging/android: turn fence_info into a __64 pointer
  2016-02-01  8:41     ` Maarten Lankhorst
@ 2016-02-01 18:00       ` Gustavo Padovan
  -1 siblings, 0 replies; 35+ messages in thread
From: Gustavo Padovan @ 2016-02-01 18:00 UTC (permalink / raw)
  To: Maarten Lankhorst
  Cc: Greg Kroah-Hartman, linux-kernel, devel, dri-devel, Daniel Stone,
	Arve Hjønnevåg, Riley Andrews, Daniel Vetter,
	Rob Clark, Greg Hackmann, John Harrison, Gustavo Padovan

Hi Maarten,

2016-02-01 Maarten Lankhorst <maarten.lankhorst@linux.intel.com>:

> Op 29-01-16 om 22:20 schreef Gustavo Padovan:
> > From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
> >
> > Making fence_info a pointer enables us to extend the struct in the future
> > without breaking the ABI.
> >
> > Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
> > ---
> >  drivers/staging/android/sync.c      | 2 +-
> >  drivers/staging/android/uapi/sync.h | 2 +-
> >  2 files changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/staging/android/sync.c b/drivers/staging/android/sync.c
> > index f7530f0..51d4f47 100644
> > --- a/drivers/staging/android/sync.c
> > +++ b/drivers/staging/android/sync.c
> > @@ -525,7 +525,7 @@ static long sync_file_ioctl_fence_info(struct sync_file *sync_file,
> >  	if (info->status >= 0)
> >  		info->status = !info->status;
> >  
> > -	len = sizeof(struct sync_file_info);
> > +	len = sizeof(struct sync_file_info) - sizeof(__u64 *);
> >  
> >  	for (i = 0; i < sync_file->num_fences; ++i) {
> >  		struct fence *fence = sync_file->cbs[i].fence;
> > diff --git a/drivers/staging/android/uapi/sync.h b/drivers/staging/android/uapi/sync.h
> > index ed281fc..9f07aa7 100644
> > --- a/drivers/staging/android/uapi/sync.h
> > +++ b/drivers/staging/android/uapi/sync.h
> > @@ -54,7 +54,7 @@ struct sync_file_info {
> >  	char	name[32];
> >  	__s32	status;
> >  
> > -	__u8	fence_info[0];
> > +	__u64	*fence_info;
> >  };
> >
> Pointers are awful, it should be a __u64 since it's a pointer type. Userspace should cast it to a uintptr_t in userspace.

Oh, I made a mistake. I'll fix this.


> This structure also won't work on 64-bits systems, there may be a hole between fence_info and status (or num_fences in next patch).
> 
> It's probably best to move it to the top and ensure the struct is 64-bits aligned.

That is not possible because we are not allocating only 64bits there but
a array of struct fence_info, so it needs to be the last one. Maybe we
can add some sort of padding?


	Gustavo

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [PATCH 06/10] staging/android: turn fence_info into a __64 pointer
@ 2016-02-01 18:00       ` Gustavo Padovan
  0 siblings, 0 replies; 35+ messages in thread
From: Gustavo Padovan @ 2016-02-01 18:00 UTC (permalink / raw)
  To: Maarten Lankhorst
  Cc: devel, Daniel Stone, Greg Kroah-Hartman, linux-kernel, dri-devel,
	Arve Hjønnevåg, Daniel Vetter, Riley Andrews,
	Gustavo Padovan, John Harrison

Hi Maarten,

2016-02-01 Maarten Lankhorst <maarten.lankhorst@linux.intel.com>:

> Op 29-01-16 om 22:20 schreef Gustavo Padovan:
> > From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
> >
> > Making fence_info a pointer enables us to extend the struct in the future
> > without breaking the ABI.
> >
> > Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
> > ---
> >  drivers/staging/android/sync.c      | 2 +-
> >  drivers/staging/android/uapi/sync.h | 2 +-
> >  2 files changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/staging/android/sync.c b/drivers/staging/android/sync.c
> > index f7530f0..51d4f47 100644
> > --- a/drivers/staging/android/sync.c
> > +++ b/drivers/staging/android/sync.c
> > @@ -525,7 +525,7 @@ static long sync_file_ioctl_fence_info(struct sync_file *sync_file,
> >  	if (info->status >= 0)
> >  		info->status = !info->status;
> >  
> > -	len = sizeof(struct sync_file_info);
> > +	len = sizeof(struct sync_file_info) - sizeof(__u64 *);
> >  
> >  	for (i = 0; i < sync_file->num_fences; ++i) {
> >  		struct fence *fence = sync_file->cbs[i].fence;
> > diff --git a/drivers/staging/android/uapi/sync.h b/drivers/staging/android/uapi/sync.h
> > index ed281fc..9f07aa7 100644
> > --- a/drivers/staging/android/uapi/sync.h
> > +++ b/drivers/staging/android/uapi/sync.h
> > @@ -54,7 +54,7 @@ struct sync_file_info {
> >  	char	name[32];
> >  	__s32	status;
> >  
> > -	__u8	fence_info[0];
> > +	__u64	*fence_info;
> >  };
> >
> Pointers are awful, it should be a __u64 since it's a pointer type. Userspace should cast it to a uintptr_t in userspace.

Oh, I made a mistake. I'll fix this.


> This structure also won't work on 64-bits systems, there may be a hole between fence_info and status (or num_fences in next patch).
> 
> It's probably best to move it to the top and ensure the struct is 64-bits aligned.

That is not possible because we are not allocating only 64bits there but
a array of struct fence_info, so it needs to be the last one. Maybe we
can add some sort of padding?


	Gustavo
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [PATCH 06/10] staging/android: turn fence_info into a __64 pointer
  2016-02-01 18:00       ` Gustavo Padovan
@ 2016-02-02 13:04         ` Gustavo Padovan
  -1 siblings, 0 replies; 35+ messages in thread
From: Gustavo Padovan @ 2016-02-02 13:04 UTC (permalink / raw)
  To: Maarten Lankhorst, Greg Kroah-Hartman, linux-kernel, devel,
	dri-devel, Daniel Stone, Arve Hjønnevåg, Riley Andrews,
	Daniel Vetter, Rob Clark, Greg Hackmann, John Harrison,
	Gustavo Padovan

2016-02-01 Gustavo Padovan <gustavo@padovan.org>:

> Hi Maarten,
> 
> 2016-02-01 Maarten Lankhorst <maarten.lankhorst@linux.intel.com>:
> 
> > Op 29-01-16 om 22:20 schreef Gustavo Padovan:
> > > From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
> > >
> > > Making fence_info a pointer enables us to extend the struct in the future
> > > without breaking the ABI.
> > >
> > > Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
> > > ---
> > >  drivers/staging/android/sync.c      | 2 +-
> > >  drivers/staging/android/uapi/sync.h | 2 +-
> > >  2 files changed, 2 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/drivers/staging/android/sync.c b/drivers/staging/android/sync.c
> > > index f7530f0..51d4f47 100644
> > > --- a/drivers/staging/android/sync.c
> > > +++ b/drivers/staging/android/sync.c
> > > @@ -525,7 +525,7 @@ static long sync_file_ioctl_fence_info(struct sync_file *sync_file,
> > >  	if (info->status >= 0)
> > >  		info->status = !info->status;
> > >  
> > > -	len = sizeof(struct sync_file_info);
> > > +	len = sizeof(struct sync_file_info) - sizeof(__u64 *);
> > >  
> > >  	for (i = 0; i < sync_file->num_fences; ++i) {
> > >  		struct fence *fence = sync_file->cbs[i].fence;
> > > diff --git a/drivers/staging/android/uapi/sync.h b/drivers/staging/android/uapi/sync.h
> > > index ed281fc..9f07aa7 100644
> > > --- a/drivers/staging/android/uapi/sync.h
> > > +++ b/drivers/staging/android/uapi/sync.h
> > > @@ -54,7 +54,7 @@ struct sync_file_info {
> > >  	char	name[32];
> > >  	__s32	status;
> > >  
> > > -	__u8	fence_info[0];
> > > +	__u64	*fence_info;
> > >  };
> > >
> > Pointers are awful, it should be a __u64 since it's a pointer type. Userspace should cast it to a uintptr_t in userspace.
> 
> Oh, I made a mistake. I'll fix this.
> 
> 
> > This structure also won't work on 64-bits systems, there may be a hole between fence_info and status (or num_fences in next patch).
> > 
> > It's probably best to move it to the top and ensure the struct is 64-bits aligned.
> 
> That is not possible because we are not allocating only 64bits there but
> a array of struct fence_info, so it needs to be the last one. Maybe we
> can add some sort of padding?

Actually it is 64bits aligned:

struct sync_file_info {                                                         
        char    name[32];                                                       
        __s32   status;                                                         
        __u32   flags;                                                          
        __u32   num_fences;                                                     
        __u32   len;                                                            
                                                                                
        __u64   fence_info;                                                     
};

So nothing to worry here.

	Gustavo

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [PATCH 06/10] staging/android: turn fence_info into a __64 pointer
@ 2016-02-02 13:04         ` Gustavo Padovan
  0 siblings, 0 replies; 35+ messages in thread
From: Gustavo Padovan @ 2016-02-02 13:04 UTC (permalink / raw)
  To: Maarten Lankhorst, Greg Kroah-Hartman, linux-kernel, devel,
	dri-devel, Daniel Stone, Arve Hjønnevåg, Riley Andrews,
	Daniel Vetter, Rob Clark, Greg Hackmann, John Harrison,
	Gustavo Padovan

2016-02-01 Gustavo Padovan <gustavo@padovan.org>:

> Hi Maarten,
> 
> 2016-02-01 Maarten Lankhorst <maarten.lankhorst@linux.intel.com>:
> 
> > Op 29-01-16 om 22:20 schreef Gustavo Padovan:
> > > From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
> > >
> > > Making fence_info a pointer enables us to extend the struct in the future
> > > without breaking the ABI.
> > >
> > > Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
> > > ---
> > >  drivers/staging/android/sync.c      | 2 +-
> > >  drivers/staging/android/uapi/sync.h | 2 +-
> > >  2 files changed, 2 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/drivers/staging/android/sync.c b/drivers/staging/android/sync.c
> > > index f7530f0..51d4f47 100644
> > > --- a/drivers/staging/android/sync.c
> > > +++ b/drivers/staging/android/sync.c
> > > @@ -525,7 +525,7 @@ static long sync_file_ioctl_fence_info(struct sync_file *sync_file,
> > >  	if (info->status >= 0)
> > >  		info->status = !info->status;
> > >  
> > > -	len = sizeof(struct sync_file_info);
> > > +	len = sizeof(struct sync_file_info) - sizeof(__u64 *);
> > >  
> > >  	for (i = 0; i < sync_file->num_fences; ++i) {
> > >  		struct fence *fence = sync_file->cbs[i].fence;
> > > diff --git a/drivers/staging/android/uapi/sync.h b/drivers/staging/android/uapi/sync.h
> > > index ed281fc..9f07aa7 100644
> > > --- a/drivers/staging/android/uapi/sync.h
> > > +++ b/drivers/staging/android/uapi/sync.h
> > > @@ -54,7 +54,7 @@ struct sync_file_info {
> > >  	char	name[32];
> > >  	__s32	status;
> > >  
> > > -	__u8	fence_info[0];
> > > +	__u64	*fence_info;
> > >  };
> > >
> > Pointers are awful, it should be a __u64 since it's a pointer type. Userspace should cast it to a uintptr_t in userspace.
> 
> Oh, I made a mistake. I'll fix this.
> 
> 
> > This structure also won't work on 64-bits systems, there may be a hole between fence_info and status (or num_fences in next patch).
> > 
> > It's probably best to move it to the top and ensure the struct is 64-bits aligned.
> 
> That is not possible because we are not allocating only 64bits there but
> a array of struct fence_info, so it needs to be the last one. Maybe we
> can add some sort of padding?

Actually it is 64bits aligned:

struct sync_file_info {                                                         
        char    name[32];                                                       
        __s32   status;                                                         
        __u32   flags;                                                          
        __u32   num_fences;                                                     
        __u32   len;                                                            
                                                                                
        __u64   fence_info;                                                     
};

So nothing to worry here.

	Gustavo
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 35+ messages in thread

end of thread, other threads:[~2016-02-02 13:05 UTC | newest]

Thread overview: 35+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-29 21:20 [PATCH 00/10] android sync framework: clean up IOCTLs and ABI Gustavo Padovan
2016-01-29 21:20 ` Gustavo Padovan
2016-01-29 21:20 ` [PATCH 01/10] staging/android: remove SYNC_WAIT ioctl Gustavo Padovan
2016-01-29 21:20   ` Gustavo Padovan
2016-01-29 21:20 ` [PATCH 02/10] staging/android: rename sync_pt_info to fence_info Gustavo Padovan
2016-01-29 21:20   ` Gustavo Padovan
2016-01-29 21:20 ` [PATCH 03/10] staging/android: rename sync_file_info_data to sync_file_info Gustavo Padovan
2016-01-29 21:20   ` Gustavo Padovan
2016-01-29 21:20 ` [PATCH 04/10] staging/android: remove driver_data from struct fence_info Gustavo Padovan
2016-01-29 21:20   ` Gustavo Padovan
2016-01-29 21:20 ` [PATCH 05/10] staging/android: remove len field " Gustavo Padovan
2016-01-29 21:20   ` Gustavo Padovan
2016-01-29 21:20 ` [PATCH 06/10] staging/android: turn fence_info into a __64 pointer Gustavo Padovan
2016-01-29 21:20   ` Gustavo Padovan
2016-01-30 18:04   ` Emil Velikov
2016-01-30 18:04     ` Emil Velikov
2016-02-01  8:41   ` Maarten Lankhorst
2016-02-01  8:41     ` Maarten Lankhorst
2016-02-01 18:00     ` Gustavo Padovan
2016-02-01 18:00       ` Gustavo Padovan
2016-02-02 13:04       ` Gustavo Padovan
2016-02-02 13:04         ` Gustavo Padovan
2016-01-29 21:20 ` [PATCH 07/10] staging/android: add num_fences field to struct sync_file_info Gustavo Padovan
2016-01-29 21:20   ` Gustavo Padovan
2016-01-29 21:20 ` [PATCH 08/10] staging/android: rename SYNC_IOC_FENCE_INFO Gustavo Padovan
2016-01-29 21:20   ` Gustavo Padovan
2016-01-29 21:20 ` [PATCH 09/10] staging/android: add flags member to sync ioctl structs Gustavo Padovan
2016-01-30 18:12   ` Emil Velikov
2016-01-30 18:12     ` Emil Velikov
2016-02-01 13:24     ` Gustavo Padovan
2016-02-01 13:24       ` Gustavo Padovan
2016-02-01  8:39   ` Maarten Lankhorst
2016-02-01  8:39     ` Maarten Lankhorst
2016-01-29 21:20 ` [PATCH 10/10] staging/android: remove redundant comments on sync_merge_data Gustavo Padovan
2016-01-29 21:20   ` Gustavo Padovan

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.