ws_dri_fencemgr.h

Go to the documentation of this file.
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  * Do a quick check to see if the fence manager has registered the fence
00012  * object as signaled. Note that this function may return a false negative
00013  * answer.
00014  */
00015 extern uint32_t driFenceSignaledTypeCached(struct _DriFenceObject *fence);
00016 
00017 /*
00018  * Check if the fence object is signaled. This function can be substantially
00019  * more expensive to call than the above function, but will not return a false
00020  * negative answer. The argument "flush_type" sets the types that the
00021  * underlying mechanism must make sure will eventually signal.
00022  */
00023 extern int driFenceSignaledType(struct _DriFenceObject *fence,
00024                                 uint32_t flush_type, uint32_t *signaled);
00025 
00026 /*
00027  * Convenience functions.
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  * Reference a fence object.
00051  */
00052 extern struct _DriFenceObject *driFenceReference(struct _DriFenceObject *fence);
00053 
00054 /*
00055  * Unreference a fence object. The fence object pointer will be reset to NULL.
00056  */
00057 
00058 extern void driFenceUnReference(struct _DriFenceObject **pFence);
00059 
00060 
00061 /*
00062  * Wait for a fence to signal the indicated fence_type.
00063  * If "lazy_hint" is true, it indicates that the wait may sleep to avoid
00064  * busy-wait polling.
00065  */
00066 extern int driFenceFinish(struct _DriFenceObject *fence, uint32_t fence_type,
00067                           int lazy_hint);
00068 
00069 /*
00070  * Create a DriFenceObject for manager "mgr".
00071  *
00072  * "private" is a pointer that should be used for the callbacks in
00073  * struct _DriFenceMgrCreateInfo.
00074  *
00075  * if private_size is nonzero, then the info stored at *private, with size
00076  * private size will be copied and the fence manager will instead use a
00077  * pointer to the copied data for the callbacks in
00078  * struct _DriFenceMgrCreateInfo. In that case, the object pointed to by
00079  * "private" may be destroyed after the call to driFenceCreate.
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  * Fence creations are ordered. If a fence signals a fence_type,
00091  * it is safe to assume that all fences of the same class that was
00092  * created before that fence has signaled the same type.
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

Generated on Tue Sep 29 06:25:17 2009 for Gallium3D by  doxygen 1.5.4