]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blame - drivers/dma-buf/sync_debug.h
Merge remote-tracking branch 'airlied/drm-next' into topic/drm-misc
[mirror_ubuntu-bionic-kernel.git] / drivers / dma-buf / sync_debug.h
CommitLineData
7ad530bf 1/*
e912c881 2 * Sync File validation framework and debug infomation
7ad530bf
EG
3 *
4 * Copyright (C) 2012 Google, Inc.
5 *
6 * This program is distributed in the hope that it will be useful,
7 * but WITHOUT ANY WARRANTY; without even the implied warranty of
8 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 * GNU General Public License for more details.
10 *
11 */
12
13#ifndef _LINUX_SYNC_H
14#define _LINUX_SYNC_H
15
7ad530bf
EG
16#include <linux/list.h>
17#include <linux/spinlock.h>
0f0d8406 18#include <linux/fence.h>
7ad530bf 19
460bfc41
GP
20#include <linux/sync_file.h>
21#include <uapi/linux/sync_file.h>
64907b94 22
7ad530bf
EG
23/**
24 * struct sync_timeline - sync object
c5b86b74 25 * @kref: reference count on fence.
7ad530bf 26 * @name: name of the sync_timeline. Useful for debugging
7ad530bf 27 * @child_list_head: list of children sync_pts for this sync_timeline
342952d3 28 * @child_list_lock: lock protecting @child_list_head and fence.status
7ad530bf 29 * @active_list_head: list of active (unsignaled/errored) sync_pts
af7582f2 30 * @sync_timeline_list: membership in global sync_timeline_list
7ad530bf
EG
31 */
32struct sync_timeline {
c5b86b74 33 struct kref kref;
7ad530bf
EG
34 char name[32];
35
36 /* protected by child_list_lock */
731c7d3a
LT
37 u64 context;
38 int value;
7ad530bf
EG
39
40 struct list_head child_list_head;
41 spinlock_t child_list_lock;
42
43 struct list_head active_list_head;
af7582f2
EG
44
45 struct list_head sync_timeline_list;
7ad530bf
EG
46};
47
b55b54b5 48static inline struct sync_timeline *fence_parent(struct fence *fence)
0f0d8406 49{
b55b54b5 50 return container_of(fence->lock, struct sync_timeline,
0f0d8406
ML
51 child_list_lock);
52}
97a84843 53
0431b906
GP
54/**
55 * struct sync_pt - sync_pt object
56 * @base: base fence object
57 * @child_list: sync timeline child's list
58 * @active_list: sync timeline active child's list
59 */
60struct sync_pt {
61 struct fence base;
62 struct list_head child_list;
63 struct list_head active_list;
64};
65
b1f65604 66#ifdef CONFIG_SW_SYNC
0f0d8406 67
1867a23b
GP
68extern const struct file_operations sw_sync_debugfs_fops;
69
d30649a8
JP
70void sync_timeline_debug_add(struct sync_timeline *obj);
71void sync_timeline_debug_remove(struct sync_timeline *obj);
d7fdb0ae
GP
72void sync_file_debug_add(struct sync_file *fence);
73void sync_file_debug_remove(struct sync_file *fence);
d30649a8 74void sync_dump(void);
0f0d8406
ML
75
76#else
77# define sync_timeline_debug_add(obj)
78# define sync_timeline_debug_remove(obj)
d7fdb0ae
GP
79# define sync_file_debug_add(fence)
80# define sync_file_debug_remove(fence)
0f0d8406
ML
81# define sync_dump()
82#endif
0f0d8406 83
7ad530bf 84#endif /* _LINUX_SYNC_H */