0001
0002
0003
0004
0005
0006
0007 #ifndef __MSM_FENCE_H__
0008 #define __MSM_FENCE_H__
0009
0010 #include "msm_drv.h"
0011
0012
0013
0014
0015
0016
0017
0018 struct msm_fence_context {
0019 struct drm_device *dev;
0020
0021 char name[32];
0022
0023 unsigned context;
0024
0025 unsigned index;
0026
0027
0028
0029
0030
0031
0032
0033
0034 uint32_t last_fence;
0035
0036
0037
0038
0039
0040
0041
0042 uint32_t completed_fence;
0043
0044
0045
0046
0047
0048
0049
0050
0051
0052 volatile uint32_t *fenceptr;
0053
0054 spinlock_t spinlock;
0055 };
0056
0057 struct msm_fence_context * msm_fence_context_alloc(struct drm_device *dev,
0058 volatile uint32_t *fenceptr, const char *name);
0059 void msm_fence_context_free(struct msm_fence_context *fctx);
0060
0061 bool msm_fence_completed(struct msm_fence_context *fctx, uint32_t fence);
0062 void msm_update_fence(struct msm_fence_context *fctx, uint32_t fence);
0063
0064 struct dma_fence * msm_fence_alloc(struct msm_fence_context *fctx);
0065
0066 static inline bool
0067 fence_before(uint32_t a, uint32_t b)
0068 {
0069 return (int32_t)(a - b) < 0;
0070 }
0071
0072 static inline bool
0073 fence_after(uint32_t a, uint32_t b)
0074 {
0075 return (int32_t)(a - b) > 0;
0076 }
0077
0078 #endif