Jeff Boody | fe6c39c | 2012-08-09 13:54:50 -0600 | [diff] [blame] | 1 | /* 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 | |
| 19 | struct kgsl_sync_timeline { |
| 20 | struct sync_timeline timeline; |
| 21 | unsigned int last_timestamp; |
| 22 | }; |
| 23 | |
| 24 | struct kgsl_sync_pt { |
| 25 | struct sync_pt pt; |
| 26 | unsigned int timestamp; |
| 27 | }; |
| 28 | |
| 29 | #if defined(CONFIG_SYNC) |
| 30 | struct sync_pt *kgsl_sync_pt_create(struct sync_timeline *timeline, |
| 31 | unsigned int timestamp); |
| 32 | void kgsl_sync_pt_destroy(struct sync_pt *pt); |
Jeff Boody | fe6c39c | 2012-08-09 13:54:50 -0600 | [diff] [blame] | 33 | int kgsl_add_fence_event(struct kgsl_device *device, |
| 34 | u32 context_id, u32 timestamp, void __user *data, int len, |
| 35 | struct kgsl_device_private *owner); |
| 36 | int kgsl_sync_timeline_create(struct kgsl_context *context); |
| 37 | void kgsl_sync_timeline_signal(struct sync_timeline *timeline, |
| 38 | unsigned int timestamp); |
| 39 | void kgsl_sync_timeline_destroy(struct kgsl_context *context); |
| 40 | #else |
| 41 | static inline struct sync_pt |
| 42 | *kgsl_sync_pt_create(struct sync_timeline *timeline, unsigned int timestamp) |
| 43 | { |
| 44 | return NULL; |
| 45 | } |
| 46 | |
| 47 | static inline void kgsl_sync_pt_destroy(struct sync_pt *pt) |
| 48 | { |
| 49 | } |
| 50 | |
Jeff Boody | fe6c39c | 2012-08-09 13:54:50 -0600 | [diff] [blame] | 51 | static inline int kgsl_add_fence_event(struct kgsl_device *device, |
| 52 | u32 context_id, u32 timestamp, void __user *data, int len, |
| 53 | struct kgsl_device_private *owner) |
| 54 | { |
| 55 | return -EINVAL; |
| 56 | } |
| 57 | |
| 58 | static int kgsl_sync_timeline_create(struct kgsl_context *context) |
| 59 | { |
| 60 | context->timeline = NULL; |
| 61 | return 0; |
| 62 | } |
| 63 | |
| 64 | static inline void |
| 65 | kgsl_sync_timeline_signal(struct sync_timeline *timeline, |
| 66 | unsigned int timestamp) |
| 67 | { |
| 68 | } |
| 69 | |
| 70 | static inline void kgsl_sync_timeline_destroy(struct kgsl_context *context) |
| 71 | { |
| 72 | } |
| 73 | #endif |
| 74 | |
| 75 | #endif /* __KGSL_SYNC_H */ |