blob: 869ff1ffe7550ab284593545359110dbfbab9542 [file] [log] [blame]
Jeff Boodyfe6c39c2012-08-09 13:54:50 -06001/* Copyright (c) 2012, The Linux Foundation. All rights reserved.
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 and
5 * only version 2 as published by the Free Software Foundation.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
12 */
13#ifndef __KGSL_SYNC_H
14#define __KGSL_SYNC_H
15
16#include <linux/sync.h>
17#include "kgsl_device.h"
18
19struct kgsl_sync_timeline {
20 struct sync_timeline timeline;
21 unsigned int last_timestamp;
22};
23
24struct kgsl_sync_pt {
25 struct sync_pt pt;
26 unsigned int timestamp;
27};
28
29#if defined(CONFIG_SYNC)
30struct sync_pt *kgsl_sync_pt_create(struct sync_timeline *timeline,
31 unsigned int timestamp);
32void kgsl_sync_pt_destroy(struct sync_pt *pt);
33struct sync_pt *kgsl_sync_pt_dup(struct sync_pt *pt);
34int kgsl_sync_pt_has_signaled(struct sync_pt *pt);
35int kgsl_add_fence_event(struct kgsl_device *device,
36 u32 context_id, u32 timestamp, void __user *data, int len,
37 struct kgsl_device_private *owner);
38int kgsl_sync_timeline_create(struct kgsl_context *context);
39void kgsl_sync_timeline_signal(struct sync_timeline *timeline,
40 unsigned int timestamp);
41void kgsl_sync_timeline_destroy(struct kgsl_context *context);
42#else
43static inline struct sync_pt
44*kgsl_sync_pt_create(struct sync_timeline *timeline, unsigned int timestamp)
45{
46 return NULL;
47}
48
49static inline void kgsl_sync_pt_destroy(struct sync_pt *pt)
50{
51}
52
53static inline struct sync_pt *kgsl_sync_pt_dup(struct sync_pt *pt)
54{
55 return NULL;
56}
57
58static inline int kgsl_sync_pt_has_signaled(struct sync_pt *pt)
59{
60 return 0;
61}
62
63static inline int kgsl_add_fence_event(struct kgsl_device *device,
64 u32 context_id, u32 timestamp, void __user *data, int len,
65 struct kgsl_device_private *owner)
66{
67 return -EINVAL;
68}
69
70static int kgsl_sync_timeline_create(struct kgsl_context *context)
71{
72 context->timeline = NULL;
73 return 0;
74}
75
76static inline void
77kgsl_sync_timeline_signal(struct sync_timeline *timeline,
78 unsigned int timestamp)
79{
80}
81
82static inline void kgsl_sync_timeline_destroy(struct kgsl_context *context)
83{
84}
85#endif
86
87#endif /* __KGSL_SYNC_H */