00001 #ifndef DRI_FENCEMGR_H
00002 #define DRI_FENCEMGR_H
00003
00004 #include <stdint.h>
00005 #include <stdlib.h>
00006
00007 struct _DriFenceObject;
00008 struct _DriFenceMgr;
00009
00010
00011
00012
00013
00014
00015 extern uint32_t driFenceSignaledTypeCached(struct _DriFenceObject *fence);
00016
00017
00018
00019
00020
00021
00022
00023 extern int driFenceSignaledType(struct _DriFenceObject *fence,
00024 uint32_t flush_type, uint32_t *signaled);
00025
00026
00027
00028
00029
00030 static inline int driFenceSignaled(struct _DriFenceObject *fence,
00031 uint32_t flush_type)
00032 {
00033 uint32_t signaled_types;
00034 int ret = driFenceSignaledType(fence, flush_type, &signaled_types);
00035 if (ret)
00036 return 0;
00037 return ((signaled_types & flush_type) == flush_type);
00038 }
00039
00040 static inline int driFenceSignaledCached(struct _DriFenceObject *fence,
00041 uint32_t flush_type)
00042 {
00043 uint32_t signaled_types =
00044 driFenceSignaledTypeCached(fence);
00045
00046 return ((signaled_types & flush_type) == flush_type);
00047 }
00048
00049
00050
00051
00052 extern struct _DriFenceObject *driFenceReference(struct _DriFenceObject *fence);
00053
00054
00055
00056
00057
00058 extern void driFenceUnReference(struct _DriFenceObject **pFence);
00059
00060
00061
00062
00063
00064
00065
00066 extern int driFenceFinish(struct _DriFenceObject *fence, uint32_t fence_type,
00067 int lazy_hint);
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081 extern struct _DriFenceObject *driFenceCreate(struct _DriFenceMgr *mgr,
00082 uint32_t fence_class,
00083 uint32_t fence_type,
00084 void *private,
00085 size_t private_size);
00086
00087 extern uint32_t driFenceType(struct _DriFenceObject *fence);
00088
00089
00090
00091
00092
00093
00094
00095 #define DRI_FENCE_CLASS_ORDERED (1 << 0)
00096
00097 struct _DriFenceMgrCreateInfo {
00098 uint32_t flags;
00099 uint32_t num_classes;
00100 int (*signaled) (struct _DriFenceMgr *mgr, void *private, uint32_t flush_type,
00101 uint32_t *signaled_type);
00102 int (*finish) (struct _DriFenceMgr *mgr, void *private, uint32_t fence_type, int lazy_hint);
00103 int (*unreference) (struct _DriFenceMgr *mgr, void **private);
00104 };
00105
00106 extern struct _DriFenceMgr *
00107 driFenceMgrCreate(const struct _DriFenceMgrCreateInfo *info);
00108
00109 void
00110 driFenceMgrUnReference(struct _DriFenceMgr **pMgr);
00111
00112 extern struct _DriFenceMgr *
00113 driFenceMgrTTMInit(int fd);
00114
00115 #endif