00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032 #ifndef _PSB_BUFPOOL_H_
00033 #define _PSB_BUFPOOL_H_
00034
00035 #include <xf86drm.h>
00036 #include "pipe/p_thread.h"
00037 struct _DriFenceObject;
00038
00039 typedef struct _DriBufferPool
00040 {
00041 int fd;
00042 int (*map) (struct _DriBufferPool * pool, void *private,
00043 unsigned flags, int hint, pipe_mutex *mutex,
00044 void **virtual);
00045 int (*unmap) (struct _DriBufferPool * pool, void *private);
00046 int (*destroy) (struct _DriBufferPool * pool, void *private);
00047 unsigned long (*offset) (struct _DriBufferPool * pool, void *private);
00048 unsigned long (*poolOffset) (struct _DriBufferPool * pool, void *private);
00049 uint64_t (*flags) (struct _DriBufferPool * pool, void *private);
00050 unsigned long (*size) (struct _DriBufferPool * pool, void *private);
00051 void *(*create) (struct _DriBufferPool * pool, unsigned long size,
00052 uint64_t flags, unsigned hint, unsigned alignment);
00053 void *(*reference) (struct _DriBufferPool * pool, unsigned handle);
00054 int (*unreference) (struct _DriBufferPool * pool, void *private);
00055 int (*fence) (struct _DriBufferPool * pool, void *private,
00056 struct _DriFenceObject * fence);
00057 drmBO *(*kernel) (struct _DriBufferPool * pool, void *private);
00058 int (*validate) (struct _DriBufferPool * pool, void *private, pipe_mutex *mutex);
00059 int (*waitIdle) (struct _DriBufferPool *pool, void *private, pipe_mutex *mutex,
00060 int lazy);
00061 int (*setStatus) (struct _DriBufferPool *pool, void *private,
00062 uint64_t flag_diff, uint64_t old_flags);
00063 void (*takeDown) (struct _DriBufferPool * pool);
00064 void *data;
00065 } DriBufferPool;
00066
00067 extern void bmError(int val, const char *file, const char *function,
00068 int line);
00069 #define BM_CKFATAL(val) \
00070 do{ \
00071 int tstVal = (val); \
00072 if (tstVal) \
00073 bmError(tstVal, __FILE__, __FUNCTION__, __LINE__); \
00074 } while(0);
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085 extern struct _DriBufferPool *driDRMPoolInit(int fd);
00086 extern struct _DriBufferPool *driMallocPoolInit(void);
00087
00088 struct _DriFreeSlabManager;
00089 extern struct _DriBufferPool * driSlabPoolInit(int fd, uint64_t flags,
00090 uint64_t validMask,
00091 uint32_t smallestSize,
00092 uint32_t numSizes,
00093 uint32_t desiredNumBuffers,
00094 uint32_t maxSlabSize,
00095 uint32_t pageAlignment,
00096 struct _DriFreeSlabManager *fMan);
00097 extern void driFinishFreeSlabManager(struct _DriFreeSlabManager *fMan);
00098 extern struct _DriFreeSlabManager *
00099 driInitFreeSlabManager(uint32_t checkIntervalMsec, uint32_t slabTimeoutMsec);
00100
00101
00102 #endif