Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 06408711 authored by Ingrid Gallardo's avatar Ingrid Gallardo
Browse files

Revert "android: convert sync to fence api, v6"



This reverts commit 0f0d8406
("android: convert sync to fence api, v6"), these changes
are causing some random stability issues, reverting changes
until root cause is found.

Change-Id: I3d178829277acd8e237e0e8afc5e07b04322e1d9
[ingridg@codeaurora.org: resolve trivial merge conflicts]
Signed-off-by: default avatarIngrid Gallardo <ingridg@codeaurora.org>
parent 9d4b47cc
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -71,7 +71,6 @@ 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
+1 −1
Original line number Diff line number Diff line
@@ -8,6 +8,6 @@ obj-$(CONFIG_ASHMEM) += ashmem.o
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_SYNC)			+= sync.o
obj-$(CONFIG_SW_SYNC)			+= sw_sync.o
obj-$(CONFIG_ONESHOT_SYNC)		+= oneshot_sync.o
+2 −2
Original line number Diff line number Diff line
@@ -50,7 +50,7 @@ static struct sync_pt *sw_sync_pt_dup(struct sync_pt *sync_pt)
{
	struct sw_sync_pt *pt = (struct sw_sync_pt *)sync_pt;
	struct sw_sync_timeline *obj =
		(struct sw_sync_timeline *)sync_pt_parent(sync_pt);
		(struct sw_sync_timeline *)sync_pt->parent;

	return (struct sync_pt *)sw_sync_pt_create(obj, pt->value);
}
@@ -59,7 +59,7 @@ static int sw_sync_pt_has_signaled(struct sync_pt *sync_pt)
{
	struct sw_sync_pt *pt = (struct sw_sync_pt *)sync_pt;
	struct sw_sync_timeline *obj =
		(struct sw_sync_timeline *)sync_pt_parent(sync_pt);
		(struct sw_sync_timeline *)sync_pt->parent;

	return sw_sync_cmp(obj->value, pt->value) >= 0;
}
+606 −307

File changed.

Preview size limit exceeded, changes collapsed.

+34 −45
Original line number Diff line number Diff line
@@ -19,7 +19,6 @@
#include <linux/list.h>
#include <linux/spinlock.h>
#include <linux/wait.h>
#include <linux/fence.h>

#include "uapi/sync.h"

@@ -41,6 +40,8 @@ struct sync_fence;
 *			 -1 if a will signal before b
 * @free_pt:		called before sync_pt is freed
 * @release_obj:	called before sync_timeline is freed
 * @print_obj:		deprecated
 * @print_pt:		deprecated
 * @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
@@ -66,6 +67,13 @@ struct sync_timeline_ops {
	/* optional */
	void (*release_obj)(struct sync_timeline *sync_timeline);

	/* deprecated */
	void (*print_obj)(struct seq_file *s,
			  struct sync_timeline *sync_timeline);

	/* deprecated */
	void (*print_pt)(struct seq_file *s, struct sync_pt *sync_pt);

	/* optional */
	int (*fill_driver_data)(struct sync_pt *syncpt, void *data, int size);

@@ -99,21 +107,19 @@ struct sync_timeline {

	/* protected by child_list_lock */
	bool			destroyed;
	int			context, value;

	struct list_head	child_list_head;
	spinlock_t		child_list_lock;

	struct list_head	active_list_head;
	spinlock_t		active_list_lock;

#ifdef CONFIG_DEBUG_FS
	struct list_head	sync_timeline_list;
#endif
};

/**
 * struct sync_pt - sync point
 * @fence:		base fence class
 * @parent:		sync_timeline to which this sync_pt belongs
 * @child_list:		membership in sync_timeline.child_list_head
 * @active_list:	membership in sync_timeline.active_list_head
 * @signaled_list:	membership in temporary signaled_list on stack
@@ -124,22 +130,19 @@ struct sync_timeline {
 *			  signaled or error.
 */
struct sync_pt {
	struct fence base;

	struct sync_timeline		*parent;
	struct list_head	child_list;
	struct list_head	active_list;
};

static inline struct sync_timeline *sync_pt_parent(struct sync_pt *pt)
{
	return container_of(pt->base.lock, struct sync_timeline,
			    child_list_lock);
}
	struct list_head	active_list;
	struct list_head	signaled_list;

struct sync_fence_cb {
	struct fence_cb cb;
	struct fence *sync_pt;
	struct sync_fence	*fence;
	struct list_head	pt_list;

	/* protected by parent->active_list_lock */
	int			status;

	ktime_t			timestamp;
};

/**
@@ -149,7 +152,9 @@ struct sync_fence_cb {
 * @name:		name of sync_fence.  Useful for debugging
 * @pt_list_head:	list of sync_pts in the fence.  immutable once fence
 *			  is created
 * @status:		0: signaled, >0:active, <0: error
 * @waiter_list_head:	list of asynchronous waiters on this fence
 * @waiter_list_lock:	lock protecting @waiter_list_head and @status
 * @status:		1: signaled, 0:active, <0: error
 *
 * @wq:			wait queue for fence signaling
 * @sync_fence_list:	membership in global fence list
@@ -158,15 +163,17 @@ struct sync_fence {
	struct file		*file;
	struct kref		kref;
	char			name[32];
#ifdef CONFIG_DEBUG_FS
	struct list_head	sync_fence_list;
#endif
	int num_fences;

	/* this list is immutable once the fence is created */
	struct list_head	pt_list_head;

	struct list_head	waiter_list_head;
	spinlock_t		waiter_list_lock; /* also protects status */
	int			status;

	wait_queue_head_t	wq;
	atomic_t		status;

	struct sync_fence_cb	cbs[];
	struct list_head	sync_fence_list;
};

struct sync_fence_waiter;
@@ -180,14 +187,14 @@ typedef void (*sync_callback_t)(struct sync_fence *fence,
 * @callback_data:	pointer to pass to @callback
 */
struct sync_fence_waiter {
	wait_queue_t work;
	struct list_head	waiter_list;

	sync_callback_t		callback;
};

static inline void sync_fence_waiter_init(struct sync_fence_waiter *waiter,
					  sync_callback_t callback)
{
	INIT_LIST_HEAD(&waiter->work.task_list);
	waiter->callback = callback;
}

@@ -338,22 +345,4 @@ int sync_fence_cancel_async(struct sync_fence *fence,
 */
int sync_fence_wait(struct sync_fence *fence, long timeout);

#ifdef CONFIG_DEBUG_FS

extern void sync_timeline_debug_add(struct sync_timeline *obj);
extern void sync_timeline_debug_remove(struct sync_timeline *obj);
extern void sync_fence_debug_add(struct sync_fence *fence);
extern void sync_fence_debug_remove(struct sync_fence *fence);
extern void sync_dump(void);

#else
# define sync_timeline_debug_add(obj)
# define sync_timeline_debug_remove(obj)
# define sync_fence_debug_add(fence)
# define sync_fence_debug_remove(fence)
# define sync_dump()
#endif
int sync_fence_wake_up_wq(wait_queue_t *curr, unsigned mode,
				 int wake_flags, void *key);

#endif /* _LINUX_SYNC_H */
Loading