Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1318952 > unrolled thread
| Started by | Gustavo Padovan <gustavo@padovan.org> |
|---|---|
| First post | 2016-01-27 14:40 +0100 |
| Last post | 2016-01-27 14:40 +0100 |
| Articles | 10 — 1 participant |
Back to article view | Back to linux.kernel
[PATCH v2 00/11] sync framework de-staging: part 2 - de-stage Gustavo Padovan <gustavo@padovan.org> - 2016-01-27 14:40 +0100
[PATCH v2 08/11] staging/android: rename android_fence to timeline_fence Gustavo Padovan <gustavo@padovan.org> - 2016-01-27 14:40 +0100
[PATCH v2 09/11] dma-buf/sync_timeline: de-stage sync_timeline Gustavo Padovan <gustavo@padovan.org> - 2016-01-27 14:40 +0100
[PATCH v2 10/11] dma-buf/sync_file: bring debug back to sync file Gustavo Padovan <gustavo@padovan.org> - 2016-01-27 14:40 +0100
[PATCH v2 02/11] staging/android: store last signaled value on sync timeline Gustavo Padovan <gustavo@padovan.org> - 2016-01-27 14:40 +0100
[PATCH v2 06/11] staging/android: remove sw_sync_timeline and sw_sync_pt Gustavo Padovan <gustavo@padovan.org> - 2016-01-27 14:40 +0100
[PATCH v2 05/11] staging/android: remove struct sync_timeline_ops Gustavo Padovan <gustavo@padovan.org> - 2016-01-27 14:40 +0100
[PATCH v2 11/11] dma-buf/sync_file: bring sync_dump() back Gustavo Padovan <gustavo@padovan.org> - 2016-01-27 14:40 +0100
[PATCH v2 07/11] staging/android: remove sw_sync.[ch] files Gustavo Padovan <gustavo@padovan.org> - 2016-01-27 14:40 +0100
[PATCH v2 03/11] staging/android: remove .fill_driver_data() timeline ops Gustavo Padovan <gustavo@padovan.org> - 2016-01-27 14:40 +0100
| From | Gustavo Padovan <gustavo@padovan.org> |
|---|---|
| Date | 2016-01-27 14:40 +0100 |
| Subject | [PATCH v2 00/11] sync framework de-staging: part 2 - de-stage |
| Message-ID | <qVyue-49M-7@gated-at.bofh.it> |
From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
This patch series de-stage the sync framework and it a follow up on the
clean up series I've sent last week:
http://thread.gmane.org/gmane.comp.video.dri.devel/145509
Now in part 2 we finish the de-stage of the sync framework. It start with the
move of sync_file from staging to drivers/dma-buf, followed by a bunch of clean
ups on sync_timeline and sw_sync. Finally we de-stage the later two plus the
debug routines.
v2: use git format-patch -M
Gustavo Padovan (11):
dma-buf/sync_file: de-stage sync_file
staging/android: store last signaled value on sync timeline
staging/android: remove .fill_driver_data() timeline ops
staging/android: remove .{fence,timeline}_value_str() from
timeline_ops
staging/android: remove struct sync_timeline_ops
staging/android: remove sw_sync_timeline and sw_sync_pt
staging/android: remove sw_sync.[ch] files
staging/android: rename android_fence to timeline_fence
dma-buf/sync_timeline: de-stage sync_timeline
dma-buf/sync_file: bring debug back to sync file
dma-buf/sync_file: bring sync_dump() back
drivers/Kconfig | 2 +
drivers/dma-buf/Kconfig | 21 ++
drivers/dma-buf/Makefile | 2 +
.../{staging/android/uapi => dma-buf}/sw_sync.h | 0
drivers/{staging/android => dma-buf}/sync_debug.c | 40 ++--
drivers/dma-buf/sync_debug.h | 35 +++
.../android/sync.c => dma-buf/sync_file.c} | 245 ++-----------------
drivers/dma-buf/sync_timeline.c | 222 ++++++++++++++++++
drivers/staging/android/Kconfig | 19 --
drivers/staging/android/Makefile | 1 -
drivers/staging/android/sw_sync.c | 103 --------
drivers/staging/android/sw_sync.h | 59 -----
drivers/staging/android/sync.h | 261 ---------------------
include/linux/sync_file.h | 123 ++++++++++
include/linux/sync_timeline.h | 114 +++++++++
.../sync.h => include/trace/events/sync_file.h | 35 +--
include/trace/events/sync_timeline.h | 31 +++
.../android/uapi => include/uapi/linux}/sync.h | 12 +-
18 files changed, 604 insertions(+), 721 deletions(-)
create mode 100644 drivers/dma-buf/Kconfig
rename drivers/{staging/android/uapi => dma-buf}/sw_sync.h (100%)
rename drivers/{staging/android => dma-buf}/sync_debug.c (91%)
create mode 100644 drivers/dma-buf/sync_debug.h
rename drivers/{staging/android/sync.c => dma-buf/sync_file.c} (62%)
create mode 100644 drivers/dma-buf/sync_timeline.c
delete mode 100644 drivers/staging/android/sw_sync.c
delete mode 100644 drivers/staging/android/sw_sync.h
delete mode 100644 drivers/staging/android/sync.h
create mode 100644 include/linux/sync_file.h
create mode 100644 include/linux/sync_timeline.h
rename drivers/staging/android/trace/sync.h => include/trace/events/sync_file.h (58%)
create mode 100644 include/trace/events/sync_timeline.h
rename {drivers/staging/android/uapi => include/uapi/linux}/sync.h (90%)
--
2.5.0
[toc] | [next] | [standalone]
| From | Gustavo Padovan <gustavo@padovan.org> |
|---|---|
| Date | 2016-01-27 14:40 +0100 |
| Subject | [PATCH v2 08/11] staging/android: rename android_fence to timeline_fence |
| Message-ID | <qVyug-49M-39@gated-at.bofh.it> |
| In reply to | #1318952 |
From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
We are moving out of staging/adroid so rename it to a name that is not
related to android anymore.
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
---
drivers/staging/android/sync.c | 40 ++++++++++++++++++++--------------------
1 file changed, 20 insertions(+), 20 deletions(-)
diff --git a/drivers/staging/android/sync.c b/drivers/staging/android/sync.c
index 07fe995..ea816dd 100644
--- a/drivers/staging/android/sync.c
+++ b/drivers/staging/android/sync.c
@@ -28,7 +28,7 @@
#define CREATE_TRACE_POINTS
#include "trace/sync.h"
-static const struct fence_ops android_fence_ops;
+static const struct fence_ops timeline_fence_ops;
struct sync_timeline *sync_timeline_create(int size, const char *drv_name,
const char *name)
@@ -126,7 +126,7 @@ struct fence *sync_pt_create(struct sync_timeline *obj, int size,
spin_lock_irqsave(&obj->child_list_lock, flags);
sync_timeline_get(obj);
- fence_init(fence, &android_fence_ops, &obj->child_list_lock,
+ fence_init(fence, &timeline_fence_ops, &obj->child_list_lock,
obj->context, value);
list_add_tail(&fence->child_list, &obj->child_list_head);
INIT_LIST_HEAD(&fence->active_list);
@@ -135,21 +135,21 @@ struct fence *sync_pt_create(struct sync_timeline *obj, int size,
}
EXPORT_SYMBOL(sync_pt_create);
-static const char *android_fence_get_driver_name(struct fence *fence)
+static const char *timeline_fence_get_driver_name(struct fence *fence)
{
struct sync_timeline *parent = fence_parent(fence);
return parent->drv_name;
}
-static const char *android_fence_get_timeline_name(struct fence *fence)
+static const char *timeline_fence_get_timeline_name(struct fence *fence)
{
struct sync_timeline *parent = fence_parent(fence);
return parent->name;
}
-static void android_fence_release(struct fence *fence)
+static void timeline_fence_release(struct fence *fence)
{
struct sync_timeline *parent = fence_parent(fence);
unsigned long flags;
@@ -164,25 +164,25 @@ static void android_fence_release(struct fence *fence)
fence_free(fence);
}
-static bool android_fence_signaled(struct fence *fence)
+static bool timeline_fence_signaled(struct fence *fence)
{
struct sync_timeline *parent = fence_parent(fence);
return (fence->seqno > parent->value) ? false : true;
}
-static bool android_fence_enable_signaling(struct fence *fence)
+static bool timeline_fence_enable_signaling(struct fence *fence)
{
struct sync_timeline *parent = fence_parent(fence);
- if (android_fence_signaled(fence))
+ if (timeline_fence_signaled(fence))
return false;
list_add_tail(&fence->active_list, &parent->active_list_head);
return true;
}
-static int android_fence_fill_driver_data(struct fence *fence,
+static int timeline_fence_fill_driver_data(struct fence *fence,
void *data, int size)
{
if (size < sizeof(fence->seqno))
@@ -193,13 +193,13 @@ static int android_fence_fill_driver_data(struct fence *fence,
return sizeof(fence->seqno);
}
-static void android_fence_value_str(struct fence *fence,
+static void timeline_fence_value_str(struct fence *fence,
char *str, int size)
{
snprintf(str, size, "%d", fence->seqno);
}
-static void android_fence_timeline_value_str(struct fence *fence,
+static void timeline_fence_timeline_value_str(struct fence *fence,
char *str, int size)
{
struct sync_timeline *parent = fence_parent(fence);
@@ -207,15 +207,15 @@ static void android_fence_timeline_value_str(struct fence *fence,
snprintf(str, size, "%d", parent->value);
}
-static const struct fence_ops android_fence_ops = {
- .get_driver_name = android_fence_get_driver_name,
- .get_timeline_name = android_fence_get_timeline_name,
- .enable_signaling = android_fence_enable_signaling,
- .signaled = android_fence_signaled,
+static const struct fence_ops timeline_fence_ops = {
+ .get_driver_name = timeline_fence_get_driver_name,
+ .get_timeline_name = timeline_fence_get_timeline_name,
+ .enable_signaling = timeline_fence_enable_signaling,
+ .signaled = timeline_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,
+ .release = timeline_fence_release,
+ .fill_driver_data = timeline_fence_fill_driver_data,
+ .fence_value_str = timeline_fence_value_str,
+ .timeline_value_str = timeline_fence_timeline_value_str,
};
--
2.5.0
[toc] | [prev] | [next] | [standalone]
| From | Gustavo Padovan <gustavo@padovan.org> |
|---|---|
| Date | 2016-01-27 14:40 +0100 |
| Subject | [PATCH v2 09/11] dma-buf/sync_timeline: de-stage sync_timeline |
| Message-ID | <qVyug-49M-41@gated-at.bofh.it> |
| In reply to | #1318952 |
From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
De-stage the remaining bit of sync framework: sync_timeline and sw_sync
plus some debugging routines.
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
---
drivers/dma-buf/Kconfig | 10 +++++++
drivers/dma-buf/Makefile | 3 +-
.../{staging/android/uapi => dma-buf}/sw_sync.h | 0
drivers/{staging/android => dma-buf}/sync_debug.c | 5 ++--
drivers/dma-buf/sync_debug.h | 35 ++++++++++++++++++++++
.../android/sync.c => dma-buf/sync_timeline.c} | 7 +++--
drivers/staging/android/Kconfig | 20 -------------
.../sync.h => include/linux/sync_timeline.h | 24 +++------------
.../sync.h => include/trace/events/sync_timeline.h | 9 +++---
9 files changed, 62 insertions(+), 51 deletions(-)
rename drivers/{staging/android/uapi => dma-buf}/sw_sync.h (100%)
rename drivers/{staging/android => dma-buf}/sync_debug.c (99%)
create mode 100644 drivers/dma-buf/sync_debug.h
rename drivers/{staging/android/sync.c => dma-buf/sync_timeline.c} (98%)
rename drivers/staging/android/sync.h => include/linux/sync_timeline.h (85%)
rename drivers/staging/android/trace/sync.h => include/trace/events/sync_timeline.h (73%)
diff --git a/drivers/dma-buf/Kconfig b/drivers/dma-buf/Kconfig
index 9824bc4..73df024 100644
--- a/drivers/dma-buf/Kconfig
+++ b/drivers/dma-buf/Kconfig
@@ -8,4 +8,14 @@ config SYNC_FILE
---help---
This option enables the fence framework synchronization to export
sync_files to userspace that can represent one or more fences.
+
+config SW_SYNC
+ bool "Software synchronization objects"
+ default n
+ depends on SYNC_FILE
+ ---help---
+ A sync object driver that uses a 32bit counter to coordinate
+ synchronization. Useful when there is no hardware primitive backing
+ the synchronization.
+
endmenu
diff --git a/drivers/dma-buf/Makefile b/drivers/dma-buf/Makefile
index 4a424ec..78d8ec4 100644
--- a/drivers/dma-buf/Makefile
+++ b/drivers/dma-buf/Makefile
@@ -1,2 +1,3 @@
obj-y := dma-buf.o fence.o reservation.o seqno-fence.o
-obj-$(CONFIG_SYNC_FILE) += sync_file.o
+obj-$(CONFIG_SYNC_FILE) += sync_file.o sync_debug.o
+obj-$(CONFIG_SW_SYNC) += sync_timeline.o
diff --git a/drivers/staging/android/uapi/sw_sync.h b/drivers/dma-buf/sw_sync.h
similarity index 100%
rename from drivers/staging/android/uapi/sw_sync.h
rename to drivers/dma-buf/sw_sync.h
diff --git a/drivers/staging/android/sync_debug.c b/drivers/dma-buf/sync_debug.c
similarity index 99%
rename from drivers/staging/android/sync_debug.c
rename to drivers/dma-buf/sync_debug.c
index 9312e6f..7da9ff5 100644
--- a/drivers/staging/android/sync_debug.c
+++ b/drivers/dma-buf/sync_debug.c
@@ -30,9 +30,10 @@
#include <linux/sync_file.h>
#include <linux/types.h>
#include <linux/kconfig.h>
+#include <linux/sync_timeline.h>
-#include "uapi/sw_sync.h"
-#include "sync.h"
+#include "sync_debug.h"
+#include "sw_sync.h"
#ifdef CONFIG_DEBUG_FS
diff --git a/drivers/dma-buf/sync_debug.h b/drivers/dma-buf/sync_debug.h
new file mode 100644
index 0000000..5b71685
--- /dev/null
+++ b/drivers/dma-buf/sync_debug.h
@@ -0,0 +1,35 @@
+/*
+ * drivers/dma-buf/sync_debug.h
+ *
+ * Copyright (C) 2012 Google, Inc.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#ifndef _LINUX_SYNC_DEBUG_H
+#define _LINUX_SYNC_DEBUG_H
+
+#include <linux/types.h>
+#include <linux/sync_timeline.h>
+#include <linux/sync_file.h>
+
+#ifdef CONFIG_DEBUG_FS
+void sync_timeline_debug_add(struct sync_timeline *obj);
+void sync_timeline_debug_remove(struct sync_timeline *obj);
+void sync_file_debug_add(struct sync_file *sync_file);
+void sync_file_debug_remove(struct sync_file *sync_file);
+void sync_dump(void);
+
+#else
+#define sync_timeline_debug_add(obj)
+#define sync_timeline_debug_remove(obj)
+#define sync_file_debug_add(fence)
+#define sync_file_debug_remove(fence)
+#define sync_dump()
+#endif
+
+#endif /* _LINUX_SYNC_DEBUG_H */
diff --git a/drivers/staging/android/sync.c b/drivers/dma-buf/sync_timeline.c
similarity index 98%
rename from drivers/staging/android/sync.c
rename to drivers/dma-buf/sync_timeline.c
index ea816dd..b354b0c 100644
--- a/drivers/staging/android/sync.c
+++ b/drivers/dma-buf/sync_timeline.c
@@ -22,11 +22,12 @@
#include <linux/slab.h>
#include <linux/uaccess.h>
#include <linux/anon_inodes.h>
-
-#include "sync.h"
+#include <linux/sync_timeline.h>
#define CREATE_TRACE_POINTS
-#include "trace/sync.h"
+#include <trace/events/sync_timeline.h>
+
+#include "sync_debug.h"
static const struct fence_ops timeline_fence_ops;
diff --git a/drivers/staging/android/Kconfig b/drivers/staging/android/Kconfig
index 2756988..4b18fee 100644
--- a/drivers/staging/android/Kconfig
+++ b/drivers/staging/android/Kconfig
@@ -38,26 +38,6 @@ config ANDROID_LOW_MEMORY_KILLER
scripts (/init.rc), and it defines priority values with minimum free memory size
for each priority.
-config SYNC
- bool "Synchronization framework"
- default n
- select ANON_INODES
- select DMA_SHARED_BUFFER
- ---help---
- This option enables the framework for synchronization between multiple
- drivers. Sync implementations can take advantage of hardware
- synchronization built into devices like GPUs.
-
-config SW_SYNC
- bool "Software synchronization objects"
- default n
- depends on SYNC
- depends on SYNC_FILE
- ---help---
- A sync object driver that uses a 32bit counter to coordinate
- synchronization. Useful when there is no hardware primitive backing
- the synchronization.
-
source "drivers/staging/android/ion/Kconfig"
endif # if ANDROID
diff --git a/drivers/staging/android/sync.h b/include/linux/sync_timeline.h
similarity index 85%
rename from drivers/staging/android/sync.h
rename to include/linux/sync_timeline.h
index be94a80..27a2eda 100644
--- a/drivers/staging/android/sync.h
+++ b/include/linux/sync_timeline.h
@@ -1,5 +1,5 @@
/*
- * include/linux/sync.h
+ * include/linux/sync_timeline.h
*
* Copyright (C) 2012 Google, Inc.
*
@@ -10,8 +10,8 @@
*
*/
-#ifndef _LINUX_SYNC_H
-#define _LINUX_SYNC_H
+#ifndef _LINUX_SYNC_TIMELINE_H
+#define _LINUX_SYNC_TIMELINE_H
#include <linux/types.h>
#include <linux/kref.h>
@@ -111,20 +111,4 @@ void sync_timeline_signal(struct sync_timeline *obj, unsigned int inc);
struct fence *sync_pt_create(struct sync_timeline *parent, int size,
unsigned int inc);
-#ifdef CONFIG_DEBUG_FS
-
-void sync_timeline_debug_add(struct sync_timeline *obj);
-void sync_timeline_debug_remove(struct sync_timeline *obj);
-void sync_file_debug_add(struct sync_file *fence);
-void sync_file_debug_remove(struct sync_file *fence);
-void sync_dump(void);
-
-#else
-# define sync_timeline_debug_add(obj)
-# define sync_timeline_debug_remove(obj)
-# define sync_file_debug_add(fence)
-# define sync_file_debug_remove(fence)
-# define sync_dump()
-#endif
-
-#endif /* _LINUX_SYNC_H */
+#endif /* _LINUX_SYNC_TIMELINE_H */
diff --git a/drivers/staging/android/trace/sync.h b/include/trace/events/sync_timeline.h
similarity index 73%
rename from drivers/staging/android/trace/sync.h
rename to include/trace/events/sync_timeline.h
index d7f6457f..c4b769b 100644
--- a/drivers/staging/android/trace/sync.h
+++ b/include/trace/events/sync_timeline.h
@@ -1,11 +1,10 @@
#undef TRACE_SYSTEM
-#define TRACE_INCLUDE_PATH ../../drivers/staging/android/trace
-#define TRACE_SYSTEM sync
+#define TRACE_SYSTEM sync_timeline
-#if !defined(_TRACE_SYNC_H) || defined(TRACE_HEADER_MULTI_READ)
-#define _TRACE_SYNC_H
+#if !defined(_TRACE_SYNC_TIMELINE_H) || defined(TRACE_HEADER_MULTI_READ)
+#define _TRACE_SYNC_TIMELINE_H
-#include "../sync.h"
+#include <linux/sync_timeline.h>
#include <linux/tracepoint.h>
TRACE_EVENT(sync_timeline,
--
2.5.0
[toc] | [prev] | [next] | [standalone]
| From | Gustavo Padovan <gustavo@padovan.org> |
|---|---|
| Date | 2016-01-27 14:40 +0100 |
| Subject | [PATCH v2 10/11] dma-buf/sync_file: bring debug back to sync file |
| Message-ID | <qVyug-49M-45@gated-at.bofh.it> |
| In reply to | #1318952 |
From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Enable reports of sync_files through <debugfs>/sync/info
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
---
drivers/dma-buf/sync_file.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/drivers/dma-buf/sync_file.c b/drivers/dma-buf/sync_file.c
index 92474dd..aa1215d 100644
--- a/drivers/dma-buf/sync_file.c
+++ b/drivers/dma-buf/sync_file.c
@@ -29,6 +29,8 @@
#define CREATE_TRACE_POINTS
#include <trace/events/sync_file.h>
+#include "sync_debug.h"
+
static const struct file_operations sync_file_fops;
static struct sync_file *sync_file_alloc(int size, const char *name)
@@ -87,6 +89,8 @@ struct sync_file *sync_file_create(const char *name, struct fence *fence)
fence_check_cb_func))
atomic_dec(&sync_file->status);
+ sync_file_debug_add(sync_file);
+
return sync_file;
}
EXPORT_SYMBOL(sync_file_create);
@@ -188,6 +192,7 @@ struct sync_file *sync_file_merge(const char *name,
atomic_sub(num_fences - i, &sync_file->status);
sync_file->num_fences = i;
+ sync_file_debug_add(sync_file);
return sync_file;
}
EXPORT_SYMBOL(sync_file_merge);
@@ -246,6 +251,8 @@ static int sync_file_release(struct inode *inode, struct file *file)
{
struct sync_file *sync_file = file->private_data;
+ sync_file_debug_remove(sync_file);
+
kref_put(&sync_file->kref, sync_file_free);
return 0;
}
--
2.5.0
[toc] | [prev] | [next] | [standalone]
| From | Gustavo Padovan <gustavo@padovan.org> |
|---|---|
| Date | 2016-01-27 14:40 +0100 |
| Subject | [PATCH v2 02/11] staging/android: store last signaled value on sync timeline |
| Message-ID | <qVyug-49M-49@gated-at.bofh.it> |
| In reply to | #1318952 |
From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Now fence timeline is aware of the last signaled fence, as it
receives the increment to the current value in sync_timeline_signal().
That allow us to remove .has_signaled() from timeline_ops as we can
directly compare using timeline->value and fence->seqno in sync.c
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
---
drivers/staging/android/sw_sync.c | 16 ++--------------
drivers/staging/android/sync.c | 15 +++++++--------
drivers/staging/android/sync.h | 14 +++++---------
3 files changed, 14 insertions(+), 31 deletions(-)
diff --git a/drivers/staging/android/sw_sync.c b/drivers/staging/android/sw_sync.c
index 3bee959..b9d53d3 100644
--- a/drivers/staging/android/sw_sync.c
+++ b/drivers/staging/android/sw_sync.c
@@ -30,7 +30,7 @@ struct fence *sw_sync_pt_create(struct sw_sync_timeline *obj, u32 value)
struct sw_sync_pt *pt;
pt = (struct sw_sync_pt *)
- sync_pt_create(&obj->obj, sizeof(struct sw_sync_pt));
+ sync_pt_create(&obj->obj, sizeof(struct sw_sync_pt), value);
pt->value = value;
@@ -38,15 +38,6 @@ struct fence *sw_sync_pt_create(struct sw_sync_timeline *obj, u32 value)
}
EXPORT_SYMBOL(sw_sync_pt_create);
-static int sw_sync_fence_has_signaled(struct fence *fence)
-{
- struct sw_sync_pt *pt = (struct sw_sync_pt *)fence;
- struct sw_sync_timeline *obj =
- (struct sw_sync_timeline *)fence_parent(fence);
-
- return (pt->value > obj->value) ? 0 : 1;
-}
-
static int sw_sync_fill_driver_data(struct fence *fence,
void *data, int size)
{
@@ -77,7 +68,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,
@@ -96,8 +86,6 @@ EXPORT_SYMBOL(sw_sync_timeline_create);
void sw_sync_timeline_inc(struct sw_sync_timeline *obj, u32 inc)
{
- obj->value += inc;
-
- sync_timeline_signal(&obj->obj);
+ sync_timeline_signal(&obj->obj, inc);
}
EXPORT_SYMBOL(sw_sync_timeline_inc);
diff --git a/drivers/staging/android/sync.c b/drivers/staging/android/sync.c
index 1e1c009..4eea5c3 100644
--- a/drivers/staging/android/sync.c
+++ b/drivers/staging/android/sync.c
@@ -90,7 +90,7 @@ void sync_timeline_destroy(struct sync_timeline *obj)
}
EXPORT_SYMBOL(sync_timeline_destroy);
-void sync_timeline_signal(struct sync_timeline *obj)
+void sync_timeline_signal(struct sync_timeline *obj, unsigned int inc)
{
unsigned long flags;
struct fence *fence, *next;
@@ -99,6 +99,8 @@ void sync_timeline_signal(struct sync_timeline *obj)
spin_lock_irqsave(&obj->child_list_lock, flags);
+ obj->value += inc;
+
list_for_each_entry_safe(fence, next, &obj->active_list_head,
active_list) {
if (fence_is_signaled_locked(fence))
@@ -109,7 +111,8 @@ void sync_timeline_signal(struct sync_timeline *obj)
}
EXPORT_SYMBOL(sync_timeline_signal);
-struct fence *sync_pt_create(struct sync_timeline *obj, int size)
+struct fence *sync_pt_create(struct sync_timeline *obj, int size,
+ unsigned int value)
{
unsigned long flags;
struct fence *fence;
@@ -124,7 +127,7 @@ struct fence *sync_pt_create(struct sync_timeline *obj, int size)
spin_lock_irqsave(&obj->child_list_lock, flags);
sync_timeline_get(obj);
fence_init(fence, &android_fence_ops, &obj->child_list_lock,
- obj->context, ++obj->value);
+ obj->context, value);
list_add_tail(&fence->child_list, &obj->child_list_head);
INIT_LIST_HEAD(&fence->active_list);
spin_unlock_irqrestore(&obj->child_list_lock, flags);
@@ -164,12 +167,8 @@ static void android_fence_release(struct fence *fence)
static bool android_fence_signaled(struct fence *fence)
{
struct sync_timeline *parent = fence_parent(fence);
- int ret;
- ret = parent->ops->has_signaled(fence);
- if (ret < 0)
- fence->status = ret;
- return ret;
+ return (fence->seqno > parent->value) ? false : true;
}
static bool android_fence_enable_signaling(struct fence *fence)
diff --git a/drivers/staging/android/sync.h b/drivers/staging/android/sync.h
index fb209fc..4d3dfbf 100644
--- a/drivers/staging/android/sync.h
+++ b/drivers/staging/android/sync.h
@@ -27,10 +27,6 @@ struct sync_timeline;
/**
* struct sync_timeline_ops - sync object implementation ops
* @driver_name: name of the implementation
- * @has_signaled: returns:
- * 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
@@ -41,9 +37,6 @@ struct sync_timeline;
struct sync_timeline_ops {
const char *driver_name;
- /* required */
- int (*has_signaled)(struct fence *fence);
-
/* optional */
int (*fill_driver_data)(struct fence *fence, void *data, int size);
@@ -123,23 +116,26 @@ void sync_timeline_destroy(struct sync_timeline *obj);
/**
* sync_timeline_signal() - signal a status change on a sync_timeline
* @obj: sync_timeline to signal
+ * @inc: num to increment on timeline->value
*
* A sync implementation should call this any time one of it's fences
* has signaled or has an error condition.
*/
-void sync_timeline_signal(struct sync_timeline *obj);
+void sync_timeline_signal(struct sync_timeline *obj, unsigned int inc);
/**
* sync_pt_create() - creates a sync pt
* @parent: fence's parent sync_timeline
* @size: size to allocate for this pt
+ * @inc: value of the fence
*
* Creates a new fence as a child of @parent. @size bytes will be
* allocated allowing for implementation specific data to be kept after
* the generic sync_timeline struct. Returns the fence object or
* NULL in case of error.
*/
-struct fence *sync_pt_create(struct sync_timeline *parent, int size);
+struct fence *sync_pt_create(struct sync_timeline *parent, int size,
+ unsigned int inc);
#ifdef CONFIG_DEBUG_FS
--
2.5.0
[toc] | [prev] | [next] | [standalone]
| From | Gustavo Padovan <gustavo@padovan.org> |
|---|---|
| Date | 2016-01-27 14:40 +0100 |
| Subject | [PATCH v2 06/11] staging/android: remove sw_sync_timeline and sw_sync_pt |
| Message-ID | <qVyug-49M-61@gated-at.bofh.it> |
| In reply to | #1318952 |
From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
As we moved value storage to sync_timeline and fence those two structs
became useless and can be removed now.
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
---
drivers/staging/android/sw_sync.c | 24 +++++++-----------------
drivers/staging/android/sw_sync.h | 24 ++++++------------------
drivers/staging/android/sync_debug.c | 12 ++++++------
3 files changed, 19 insertions(+), 41 deletions(-)
diff --git a/drivers/staging/android/sw_sync.c b/drivers/staging/android/sw_sync.c
index c5e92c6..461dbd9 100644
--- a/drivers/staging/android/sw_sync.c
+++ b/drivers/staging/android/sw_sync.c
@@ -25,31 +25,21 @@
#include "sw_sync.h"
-struct fence *sw_sync_pt_create(struct sw_sync_timeline *obj, u32 value)
+struct fence *sw_sync_pt_create(struct sync_timeline *obj, u32 value)
{
- struct sw_sync_pt *pt;
-
- pt = (struct sw_sync_pt *)
- sync_pt_create(&obj->obj, sizeof(struct sw_sync_pt), value);
-
- pt->value = value;
-
- return (struct fence *)pt;
+ return sync_pt_create(obj, sizeof(struct fence), value);
}
EXPORT_SYMBOL(sw_sync_pt_create);
-struct sw_sync_timeline *sw_sync_timeline_create(const char *name)
+struct sync_timeline *sw_sync_timeline_create(const char *name)
{
- struct sw_sync_timeline *obj = (struct sw_sync_timeline *)
- sync_timeline_create(sizeof(struct sw_sync_timeline),
- "sw_sync", name);
-
- return obj;
+ return sync_timeline_create(sizeof(struct sync_timeline),
+ "sw_sync", name);
}
EXPORT_SYMBOL(sw_sync_timeline_create);
-void sw_sync_timeline_inc(struct sw_sync_timeline *obj, u32 inc)
+void sw_sync_timeline_inc(struct sync_timeline *obj, u32 inc)
{
- sync_timeline_signal(&obj->obj, inc);
+ sync_timeline_signal(obj, inc);
}
EXPORT_SYMBOL(sw_sync_timeline_inc);
diff --git a/drivers/staging/android/sw_sync.h b/drivers/staging/android/sw_sync.h
index e18667b..9f26c62 100644
--- a/drivers/staging/android/sw_sync.h
+++ b/drivers/staging/android/sw_sync.h
@@ -22,34 +22,22 @@
#include "sync.h"
#include "uapi/sw_sync.h"
-struct sw_sync_timeline {
- struct sync_timeline obj;
-
- u32 value;
-};
-
-struct sw_sync_pt {
- struct fence pt;
-
- u32 value;
-};
-
#if IS_ENABLED(CONFIG_SW_SYNC)
-struct sw_sync_timeline *sw_sync_timeline_create(const char *name);
-void sw_sync_timeline_inc(struct sw_sync_timeline *obj, u32 inc);
+struct sync_timeline *sw_sync_timeline_create(const char *name);
+void sw_sync_timeline_inc(struct sync_timeline *obj, u32 inc);
-struct fence *sw_sync_pt_create(struct sw_sync_timeline *obj, u32 value);
+struct fence *sw_sync_pt_create(struct sync_timeline *obj, u32 value);
#else
-static inline struct sw_sync_timeline *sw_sync_timeline_create(const char *name)
+static inline struct sync_timeline *sw_sync_timeline_create(const char *name)
{
return NULL;
}
-static inline void sw_sync_timeline_inc(struct sw_sync_timeline *obj, u32 inc)
+static inline void sw_sync_timeline_inc(struct sync_timeline *obj, u32 inc)
{
}
-static inline struct fence *sw_sync_pt_create(struct sw_sync_timeline *obj,
+static inline struct fence *sw_sync_pt_create(struct sync_timeline *obj,
u32 value)
{
return NULL;
diff --git a/drivers/staging/android/sync_debug.c b/drivers/staging/android/sync_debug.c
index 26ba9e86..e984955 100644
--- a/drivers/staging/android/sync_debug.c
+++ b/drivers/staging/android/sync_debug.c
@@ -211,7 +211,7 @@ static const struct file_operations sync_info_debugfs_fops = {
/* opening sw_sync create a new sync obj */
static int sw_sync_debugfs_open(struct inode *inode, struct file *file)
{
- struct sw_sync_timeline *obj;
+ struct sync_timeline *obj;
char task_comm[TASK_COMM_LEN];
get_task_comm(task_comm, current);
@@ -227,13 +227,13 @@ static int sw_sync_debugfs_open(struct inode *inode, struct file *file)
static int sw_sync_debugfs_release(struct inode *inode, struct file *file)
{
- struct sw_sync_timeline *obj = file->private_data;
+ struct sync_timeline *obj = file->private_data;
- sync_timeline_destroy(&obj->obj);
+ sync_timeline_destroy(obj);
return 0;
}
-static long sw_sync_ioctl_create_fence(struct sw_sync_timeline *obj,
+static long sw_sync_ioctl_create_fence(struct sync_timeline *obj,
unsigned long arg)
{
int fd = get_unused_fd_flags(O_CLOEXEC);
@@ -280,7 +280,7 @@ err:
return err;
}
-static long sw_sync_ioctl_inc(struct sw_sync_timeline *obj, unsigned long arg)
+static long sw_sync_ioctl_inc(struct sync_timeline *obj, unsigned long arg)
{
u32 value;
@@ -295,7 +295,7 @@ static long sw_sync_ioctl_inc(struct sw_sync_timeline *obj, unsigned long arg)
static long sw_sync_ioctl(struct file *file, unsigned int cmd,
unsigned long arg)
{
- struct sw_sync_timeline *obj = file->private_data;
+ struct sync_timeline *obj = file->private_data;
switch (cmd) {
case SW_SYNC_IOC_CREATE_FENCE:
--
2.5.0
[toc] | [prev] | [next] | [standalone]
| From | Gustavo Padovan <gustavo@padovan.org> |
|---|---|
| Date | 2016-01-27 14:40 +0100 |
| Subject | [PATCH v2 05/11] staging/android: remove struct sync_timeline_ops |
| Message-ID | <qVyug-49M-57@gated-at.bofh.it> |
| In reply to | #1318952 |
From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Move drv_name, the last field of sync_timeline_ops, to sync_timeline
and remove sync_timeline_ops.
struct sync_timeline_ops was just an extra abstraction on top of
fence_ops, and in the last few commits we removed all it ops in favor
of cleaner fence_ops.
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
---
drivers/staging/android/sw_sync.c | 9 ++-------
drivers/staging/android/sync.c | 8 ++++----
drivers/staging/android/sync.h | 28 +++++++++-------------------
drivers/staging/android/sync_debug.c | 3 +--
4 files changed, 16 insertions(+), 32 deletions(-)
diff --git a/drivers/staging/android/sw_sync.c b/drivers/staging/android/sw_sync.c
index 4200b12..c5e92c6 100644
--- a/drivers/staging/android/sw_sync.c
+++ b/drivers/staging/android/sw_sync.c
@@ -38,16 +38,11 @@ struct fence *sw_sync_pt_create(struct sw_sync_timeline *obj, u32 value)
}
EXPORT_SYMBOL(sw_sync_pt_create);
-static struct sync_timeline_ops sw_sync_timeline_ops = {
- .driver_name = "sw_sync",
-};
-
struct sw_sync_timeline *sw_sync_timeline_create(const char *name)
{
struct sw_sync_timeline *obj = (struct sw_sync_timeline *)
- sync_timeline_create(&sw_sync_timeline_ops,
- sizeof(struct sw_sync_timeline),
- name);
+ sync_timeline_create(sizeof(struct sw_sync_timeline),
+ "sw_sync", name);
return obj;
}
diff --git a/drivers/staging/android/sync.c b/drivers/staging/android/sync.c
index f2d298c..07fe995 100644
--- a/drivers/staging/android/sync.c
+++ b/drivers/staging/android/sync.c
@@ -30,8 +30,8 @@
static const struct fence_ops android_fence_ops;
-struct sync_timeline *sync_timeline_create(const struct sync_timeline_ops *ops,
- int size, const char *name)
+struct sync_timeline *sync_timeline_create(int size, const char *drv_name,
+ const char *name)
{
struct sync_timeline *obj;
@@ -43,9 +43,9 @@ struct sync_timeline *sync_timeline_create(const struct sync_timeline_ops *ops,
return NULL;
kref_init(&obj->kref);
- obj->ops = ops;
obj->context = fence_context_alloc(1);
strlcpy(obj->name, name, sizeof(obj->name));
+ strlcpy(obj->drv_name, drv_name, sizeof(obj->drv_name));
INIT_LIST_HEAD(&obj->child_list_head);
INIT_LIST_HEAD(&obj->active_list_head);
@@ -139,7 +139,7 @@ static const char *android_fence_get_driver_name(struct fence *fence)
{
struct sync_timeline *parent = fence_parent(fence);
- return parent->ops->driver_name;
+ return parent->drv_name;
}
static const char *android_fence_get_timeline_name(struct fence *fence)
diff --git a/drivers/staging/android/sync.h b/drivers/staging/android/sync.h
index b1a4b06..be94a80 100644
--- a/drivers/staging/android/sync.h
+++ b/drivers/staging/android/sync.h
@@ -22,20 +22,10 @@
#include <linux/sync_file.h>
#include <uapi/linux/sync.h>
-struct sync_timeline;
-
-/**
- * struct sync_timeline_ops - sync object implementation ops
- * @driver_name: name of the implementation
- */
-struct sync_timeline_ops {
- const char *driver_name;
-};
-
/**
* struct sync_timeline - sync object
* @kref: reference count on fence.
- * @ops: ops that define the implementation of the sync_timeline
+ * @drv_name: drv_name of the driver using the sync_timeline
* @name: name of the sync_timeline. Useful for debugging
* @destroyed: set when sync_timeline is destroyed
* @child_list_head: list of children sync_pts for this sync_timeline
@@ -46,7 +36,7 @@ struct sync_timeline_ops {
*/
struct sync_timeline {
struct kref kref;
- const struct sync_timeline_ops *ops;
+ char drv_name[32];
char name[32];
/* protected by child_list_lock */
@@ -75,17 +65,17 @@ static inline struct sync_timeline *fence_parent(struct fence *fence)
/**
* sync_timeline_create() - creates a sync object
- * @ops: specifies the implementation ops for the object
* @size: size to allocate for this obj
+ * @drv_name: sync_timeline driver name
* @name: sync_timeline name
*
- * Creates a new sync_timeline which will use the implementation specified by
- * @ops. @size bytes will be allocated allowing for implementation specific
- * data to be kept after the generic sync_timeline struct. Returns the
- * sync_timeline object or NULL in case of error.
+ * Creates a new sync_timeline. @size bytes will be allocated allowing
+ * for implementation specific data to be kept after the generic
+ * sync_timeline struct. Returns the sync_timeline object or NULL in
+ * case of error.
*/
-struct sync_timeline *sync_timeline_create(const struct sync_timeline_ops *ops,
- int size, const char *name);
+struct sync_timeline *sync_timeline_create(int size, const char *drv_name,
+ const char *name);
/**
* sync_timeline_destroy() - destroys a sync object
diff --git a/drivers/staging/android/sync_debug.c b/drivers/staging/android/sync_debug.c
index 7517fb3..26ba9e86 100644
--- a/drivers/staging/android/sync_debug.c
+++ b/drivers/staging/android/sync_debug.c
@@ -134,8 +134,7 @@ static void sync_print_obj(struct seq_file *s, struct sync_timeline *obj)
struct list_head *pos;
unsigned long flags;
- seq_printf(s, "%s %s: %d\n", obj->name, obj->ops->driver_name,
- obj->value);
+ seq_printf(s, "%s %s: %d\n", obj->name, obj->drv_name, obj->value);
spin_lock_irqsave(&obj->child_list_lock, flags);
list_for_each(pos, &obj->child_list_head) {
--
2.5.0
[toc] | [prev] | [next] | [standalone]
| From | Gustavo Padovan <gustavo@padovan.org> |
|---|---|
| Date | 2016-01-27 14:40 +0100 |
| Subject | [PATCH v2 11/11] dma-buf/sync_file: bring sync_dump() back |
| Message-ID | <qVyug-49M-63@gated-at.bofh.it> |
| In reply to | #1318952 |
From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
During the de-stage of sync framework it was easy to keep sync_dump() out
to avoid an early de-stage of all debug code, but now that sync_debug.c
was de-staged bring sync_dump() back.
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
---
drivers/dma-buf/sync_file.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/dma-buf/sync_file.c b/drivers/dma-buf/sync_file.c
index aa1215d..fd7e3b9 100644
--- a/drivers/dma-buf/sync_file.c
+++ b/drivers/dma-buf/sync_file.c
@@ -218,15 +218,19 @@ int sync_file_wait(struct sync_file *sync_file, long timeout)
if (ret < 0) {
return ret;
} else if (ret == 0) {
- if (timeout)
+ 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)
+ if (ret) {
pr_info("sync_file error %ld on [%p]\n", ret, sync_file);
+ sync_dump();
+ }
return ret;
}
--
2.5.0
[toc] | [prev] | [next] | [standalone]
| From | Gustavo Padovan <gustavo@padovan.org> |
|---|---|
| Date | 2016-01-27 14:40 +0100 |
| Subject | [PATCH v2 07/11] staging/android: remove sw_sync.[ch] files |
| Message-ID | <qVyuh-49M-65@gated-at.bofh.it> |
| In reply to | #1318952 |
From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
We can glue the sw_sync file operations directly on the sync framework
without the need to pass through sw_sync wrappers.
It only builds sw_sync debugfs file support if CONFIG_SW_SYNC is enabled.
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
---
drivers/staging/android/Makefile | 1 -
drivers/staging/android/sw_sync.c | 45 ----------------------------------
drivers/staging/android/sw_sync.h | 47 ------------------------------------
drivers/staging/android/sync_debug.c | 17 ++++++++++---
4 files changed, 13 insertions(+), 97 deletions(-)
delete mode 100644 drivers/staging/android/sw_sync.c
delete mode 100644 drivers/staging/android/sw_sync.h
diff --git a/drivers/staging/android/Makefile b/drivers/staging/android/Makefile
index c7b6c99..2c1d97f 100644
--- a/drivers/staging/android/Makefile
+++ b/drivers/staging/android/Makefile
@@ -7,4 +7,3 @@ obj-$(CONFIG_ANDROID_TIMED_OUTPUT) += timed_output.o
obj-$(CONFIG_ANDROID_TIMED_GPIO) += timed_gpio.o
obj-$(CONFIG_ANDROID_LOW_MEMORY_KILLER) += lowmemorykiller.o
obj-$(CONFIG_SYNC) += sync.o sync_debug.o
-obj-$(CONFIG_SW_SYNC) += sw_sync.o
diff --git a/drivers/staging/android/sw_sync.c b/drivers/staging/android/sw_sync.c
deleted file mode 100644
index 461dbd9..0000000
--- a/drivers/staging/android/sw_sync.c
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * drivers/base/sw_sync.c
- *
- * Copyright (C) 2012 Google, Inc.
- *
- * This software is licensed under the terms of the GNU General Public
- * License version 2, as published by the Free Software Foundation, and
- * may be copied, distributed, and modified under those terms.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- */
-
-#include <linux/kernel.h>
-#include <linux/init.h>
-#include <linux/export.h>
-#include <linux/file.h>
-#include <linux/fs.h>
-#include <linux/miscdevice.h>
-#include <linux/syscalls.h>
-#include <linux/uaccess.h>
-
-#include "sw_sync.h"
-
-struct fence *sw_sync_pt_create(struct sync_timeline *obj, u32 value)
-{
- return sync_pt_create(obj, sizeof(struct fence), value);
-}
-EXPORT_SYMBOL(sw_sync_pt_create);
-
-struct sync_timeline *sw_sync_timeline_create(const char *name)
-{
- return sync_timeline_create(sizeof(struct sync_timeline),
- "sw_sync", name);
-}
-EXPORT_SYMBOL(sw_sync_timeline_create);
-
-void sw_sync_timeline_inc(struct sync_timeline *obj, u32 inc)
-{
- sync_timeline_signal(obj, inc);
-}
-EXPORT_SYMBOL(sw_sync_timeline_inc);
diff --git a/drivers/staging/android/sw_sync.h b/drivers/staging/android/sw_sync.h
deleted file mode 100644
index 9f26c62..0000000
--- a/drivers/staging/android/sw_sync.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * include/linux/sw_sync.h
- *
- * Copyright (C) 2012 Google, Inc.
- *
- * This software is licensed under the terms of the GNU General Public
- * License version 2, as published by the Free Software Foundation, and
- * may be copied, distributed, and modified under those terms.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- */
-
-#ifndef _LINUX_SW_SYNC_H
-#define _LINUX_SW_SYNC_H
-
-#include <linux/types.h>
-#include <linux/kconfig.h>
-#include "sync.h"
-#include "uapi/sw_sync.h"
-
-#if IS_ENABLED(CONFIG_SW_SYNC)
-struct sync_timeline *sw_sync_timeline_create(const char *name);
-void sw_sync_timeline_inc(struct sync_timeline *obj, u32 inc);
-
-struct fence *sw_sync_pt_create(struct sync_timeline *obj, u32 value);
-#else
-static inline struct sync_timeline *sw_sync_timeline_create(const char *name)
-{
- return NULL;
-}
-
-static inline void sw_sync_timeline_inc(struct sync_timeline *obj, u32 inc)
-{
-}
-
-static inline struct fence *sw_sync_pt_create(struct sync_timeline *obj,
- u32 value)
-{
- return NULL;
-}
-#endif /* IS_ENABLED(CONFIG_SW_SYNC) */
-
-#endif /* _LINUX_SW_SYNC_H */
diff --git a/drivers/staging/android/sync_debug.c b/drivers/staging/android/sync_debug.c
index e984955..9312e6f 100644
--- a/drivers/staging/android/sync_debug.c
+++ b/drivers/staging/android/sync_debug.c
@@ -28,7 +28,11 @@
#include <linux/anon_inodes.h>
#include <linux/time64.h>
#include <linux/sync_file.h>
-#include "sw_sync.h"
+#include <linux/types.h>
+#include <linux/kconfig.h>
+
+#include "uapi/sw_sync.h"
+#include "sync.h"
#ifdef CONFIG_DEBUG_FS
@@ -202,6 +206,7 @@ static const struct file_operations sync_info_debugfs_fops = {
.release = single_release,
};
+#if IS_ENABLED(CONFIG_SW_SYNC)
/*
* *WARNING*
*
@@ -216,7 +221,7 @@ static int sw_sync_debugfs_open(struct inode *inode, struct file *file)
get_task_comm(task_comm, current);
- obj = sw_sync_timeline_create(task_comm);
+ obj = sync_timeline_create(sizeof(*obj), "sw_sync", task_comm);
if (!obj)
return -ENOMEM;
@@ -250,7 +255,7 @@ static long sw_sync_ioctl_create_fence(struct sync_timeline *obj,
goto err;
}
- fence = sw_sync_pt_create(obj, data.value);
+ fence = sync_pt_create(obj, sizeof(*fence), data.value);
if (!fence) {
err = -ENOMEM;
goto err;
@@ -287,7 +292,7 @@ static long sw_sync_ioctl_inc(struct sync_timeline *obj, unsigned long arg)
if (copy_from_user(&value, (void __user *)arg, sizeof(value)))
return -EFAULT;
- sw_sync_timeline_inc(obj, value);
+ sync_timeline_signal(obj, value);
return 0;
}
@@ -315,14 +320,18 @@ static const struct file_operations sw_sync_debugfs_fops = {
.unlocked_ioctl = sw_sync_ioctl,
.compat_ioctl = sw_sync_ioctl,
};
+#endif
static __init int sync_debugfs_init(void)
{
dbgfs = debugfs_create_dir("sync", NULL);
debugfs_create_file("info", 0444, dbgfs, NULL, &sync_info_debugfs_fops);
+
+#if IS_ENABLED(CONFIG_SW_SYNC)
debugfs_create_file("sw_sync", 0644, dbgfs, NULL,
&sw_sync_debugfs_fops);
+#endif
return 0;
}
--
2.5.0
[toc] | [prev] | [next] | [standalone]
| From | Gustavo Padovan <gustavo@padovan.org> |
|---|---|
| Date | 2016-01-27 14:40 +0100 |
| Subject | [PATCH v2 03/11] staging/android: remove .fill_driver_data() timeline ops |
| Message-ID | <qVyuh-49M-67@gated-at.bofh.it> |
| In reply to | #1318952 |
From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
The .fill_driver_data() ops was just a useless abstraction for
fence_ops op of the same name.
Now that we use fence->seqno to store the value it is cleaner to
remove the abstraction and fill the data directly.
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
---
drivers/staging/android/sw_sync.c | 14 --------------
drivers/staging/android/sync.c | 9 +++++----
drivers/staging/android/sync.h | 7 -------
3 files changed, 5 insertions(+), 25 deletions(-)
diff --git a/drivers/staging/android/sw_sync.c b/drivers/staging/android/sw_sync.c
index b9d53d3..428e22c 100644
--- a/drivers/staging/android/sw_sync.c
+++ b/drivers/staging/android/sw_sync.c
@@ -38,19 +38,6 @@ struct fence *sw_sync_pt_create(struct sw_sync_timeline *obj, u32 value)
}
EXPORT_SYMBOL(sw_sync_pt_create);
-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)
{
@@ -68,7 +55,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",
- .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 4eea5c3..39af5fb 100644
--- a/drivers/staging/android/sync.c
+++ b/drivers/staging/android/sync.c
@@ -185,11 +185,12 @@ static bool android_fence_enable_signaling(struct fence *fence)
static int android_fence_fill_driver_data(struct fence *fence,
void *data, int size)
{
- struct sync_timeline *parent = fence_parent(fence);
+ if (size < sizeof(fence->seqno))
+ return -ENOMEM;
+
+ memcpy(data, &fence->seqno, sizeof(fence->seqno));
- if (!parent->ops->fill_driver_data)
- return 0;
- return parent->ops->fill_driver_data(fence, data, size);
+ return sizeof(fence->seqno);
}
static void android_fence_value_str(struct fence *fence,
diff --git a/drivers/staging/android/sync.h b/drivers/staging/android/sync.h
index 4d3dfbf..500838b 100644
--- a/drivers/staging/android/sync.h
+++ b/drivers/staging/android/sync.h
@@ -27,10 +27,6 @@ struct sync_timeline;
/**
* struct sync_timeline_ops - sync object implementation ops
* @driver_name: name of the implementation
- * @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
*/
@@ -38,9 +34,6 @@ struct sync_timeline_ops {
const char *driver_name;
/* 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);
--
2.5.0
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web