ws_dri_bufpool.h File Reference

Include dependency graph for ws_dri_bufpool.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  _DriBufferPool

Defines

#define BM_CKFATAL(val)

Typedefs

typedef struct _DriBufferPool DriBufferPool

Functions

void bmError (int val, const char *file, const char *function, int line)
struct _DriBufferPooldriDRMPoolInit (int fd)
struct _DriBufferPooldriMallocPoolInit (void)
struct _DriBufferPooldriSlabPoolInit (int fd, uint64_t flags, uint64_t validMask, uint32_t smallestSize, uint32_t numSizes, uint32_t desiredNumBuffers, uint32_t maxSlabSize, uint32_t pageAlignment, struct _DriFreeSlabManager *fMan)
void driFinishFreeSlabManager (struct _DriFreeSlabManager *fMan)
struct _DriFreeSlabManagerdriInitFreeSlabManager (uint32_t checkIntervalMsec, uint32_t slabTimeoutMsec)


Define Documentation

#define BM_CKFATAL ( val   ) 

Value:

do{                                                            \
    int tstVal = (val);                                        \
    if (tstVal)                                                \
      bmError(tstVal, __FILE__, __FUNCTION__, __LINE__);       \
  } while(0);

Definition at line 69 of file ws_dri_bufpool.h.


Typedef Documentation

typedef struct _DriBufferPool DriBufferPool


Function Documentation

void bmError ( int  val,
const char *  file,
const char *  function,
int  line 
)

Definition at line 301 of file ws_dri_bufmgr.c.

00302 {
00303    printf("Fatal video memory manager error \"%s\".\n"
00304           "Check kernel logs or set the LIBGL_DEBUG\n"
00305           "environment variable to \"verbose\" for more info.\n"
00306           "Detected in file %s, line %d, function %s.\n",
00307           strerror(-val), file, line, function);
00308 #ifndef NDEBUG
00309    abort();
00310 #else
00311    abort();
00312 #endif

struct _DriBufferPool* driDRMPoolInit ( int  fd  )  [read]

Definition at line 241 of file ws_dri_drmpool.c.

References _DriBufferPool::create, _DriBufferPool::data, _DriBufferPool::destroy, _DriBufferPool::fd, _DriBufferPool::fence, _DriBufferPool::flags, _DriBufferPool::kernel, _DriBufferPool::map, _DriBufferPool::offset, pool_create(), pool_destroy(), pool_fence(), pool_flags(), pool_kernel(), pool_map(), pool_offset(), pool_poolOffset(), pool_reference(), pool_size(), pool_takedown(), pool_unmap(), pool_unreference(), pool_waitIdle(), _DriBufferPool::poolOffset, _DriBufferPool::reference, _DriBufferPool::size, _DriBufferPool::takeDown, _DriBufferPool::unmap, _DriBufferPool::unreference, _DriBufferPool::validate, and _DriBufferPool::waitIdle.

00242 {
00243    struct _DriBufferPool *pool;
00244 
00245    pool = (struct _DriBufferPool *) malloc(sizeof(*pool));
00246 
00247    if (!pool)
00248       return NULL;
00249 
00250    pool->fd = fd;
00251    pool->map = &pool_map;
00252    pool->unmap = &pool_unmap;
00253    pool->destroy = &pool_destroy;
00254    pool->offset = &pool_offset;
00255    pool->poolOffset = &pool_poolOffset;
00256    pool->flags = &pool_flags;
00257    pool->size = &pool_size;
00258    pool->create = &pool_create;
00259    pool->fence = &pool_fence;
00260    pool->kernel = &pool_kernel;
00261    pool->validate = NULL;
00262    pool->waitIdle = &pool_waitIdle;
00263    pool->takeDown = &pool_takedown;
00264    pool->reference = &pool_reference;
00265    pool->unreference = &pool_unreference;
00266    pool->data = NULL;
00267    return pool;
00268 }

void driFinishFreeSlabManager ( struct _DriFreeSlabManager fMan  ) 

Definition at line 823 of file ws_dri_slabpool.c.

References assert, _DriFreeSlabManager::cached, _DriFreeSlabManager::checkInterval, driFreeTimeoutKBOsLocked(), driTimeAdd(), _DriFreeSlabManager::mutex, _DriFreeSlabManager::nextCheck, pipe_mutex_lock, pipe_mutex_unlock, _DriFreeSlabManager::timeoutList, and _DriFreeSlabManager::unCached.

00824 {
00825     struct timeval time;
00826 
00827     time = fMan->nextCheck;
00828     driTimeAdd(&time, &fMan->checkInterval);
00829 
00830     pipe_mutex_lock(fMan->mutex);
00831     driFreeTimeoutKBOsLocked(fMan, &time);
00832     pipe_mutex_unlock(fMan->mutex);
00833 
00834     assert(fMan->timeoutList.next == &fMan->timeoutList);
00835     assert(fMan->unCached.next == &fMan->unCached);
00836     assert(fMan->cached.next == &fMan->cached);
00837 
00838     free(fMan);
00839 }

struct _DriFreeSlabManager* driInitFreeSlabManager ( uint32_t  checkIntervalMsec,
uint32_t  slabTimeoutMsec 
) [read]

Definition at line 794 of file ws_dri_slabpool.c.

References _DriFreeSlabManager::cached, _DriFreeSlabManager::checkInterval, driTimeAdd(), _DriFreeSlabManager::mutex, _DriFreeSlabManager::nextCheck, pipe_mutex_init, pipe_mutex_lock, pipe_mutex_unlock, _DriFreeSlabManager::slabTimeout, _DriFreeSlabManager::timeoutList, and _DriFreeSlabManager::unCached.

00795 {
00796     struct _DriFreeSlabManager *tmp;
00797 
00798     tmp = calloc(1, sizeof(*tmp));
00799     if (!tmp)
00800         return NULL;
00801 
00802     pipe_mutex_init(tmp->mutex);
00803     pipe_mutex_lock(tmp->mutex);
00804     tmp->slabTimeout.tv_usec = slabTimeoutMsec*1000;
00805     tmp->slabTimeout.tv_sec = tmp->slabTimeout.tv_usec / 1000000;
00806     tmp->slabTimeout.tv_usec -=  tmp->slabTimeout.tv_sec*1000000;
00807 
00808     tmp->checkInterval.tv_usec = checkIntervalMsec*1000;
00809     tmp->checkInterval.tv_sec = tmp->checkInterval.tv_usec / 1000000;
00810     tmp->checkInterval.tv_usec -=  tmp->checkInterval.tv_sec*1000000;
00811 
00812     gettimeofday(&tmp->nextCheck, NULL);
00813     driTimeAdd(&tmp->nextCheck, &tmp->checkInterval);
00814     DRMINITLISTHEAD(&tmp->timeoutList);
00815     DRMINITLISTHEAD(&tmp->unCached);
00816     DRMINITLISTHEAD(&tmp->cached);
00817     pipe_mutex_unlock(tmp->mutex);
00818 
00819     return tmp;
00820 }

struct _DriBufferPool* driMallocPoolInit ( void   )  [read]

Definition at line 137 of file ws_dri_mallocpool.c.

References _DriBufferPool::create, _DriBufferPool::data, _DriBufferPool::destroy, _DriBufferPool::fd, _DriBufferPool::fence, _DriBufferPool::flags, _DriBufferPool::kernel, _DriBufferPool::map, _DriBufferPool::offset, pool_create(), pool_destroy(), pool_fence(), pool_flags(), pool_kernel(), pool_map(), pool_offset(), pool_poolOffset(), pool_size(), pool_takedown(), pool_unmap(), pool_waitIdle(), _DriBufferPool::poolOffset, _DriBufferPool::size, _DriBufferPool::takeDown, _DriBufferPool::unmap, _DriBufferPool::validate, and _DriBufferPool::waitIdle.

00138 {
00139    struct _DriBufferPool *pool;
00140 
00141    pool = (struct _DriBufferPool *) malloc(sizeof(*pool));
00142    if (!pool)
00143        return NULL;
00144 
00145    pool->data = NULL;
00146    pool->fd = -1;
00147    pool->map = &pool_map;
00148    pool->unmap = &pool_unmap;
00149    pool->destroy = &pool_destroy;
00150    pool->offset = &pool_offset;
00151    pool->poolOffset = &pool_poolOffset;
00152    pool->flags = &pool_flags;
00153    pool->size = &pool_size;
00154    pool->create = &pool_create;
00155    pool->fence = &pool_fence;
00156    pool->kernel = &pool_kernel;
00157    pool->validate = NULL;
00158    pool->waitIdle = &pool_waitIdle;
00159    pool->takeDown = &pool_takedown;
00160    return pool;
00161 }

struct _DriBufferPool* driSlabPoolInit ( int  fd,
uint64_t  flags,
uint64_t  validMask,
uint32_t  smallestSize,
uint32_t  numSizes,
uint32_t  desiredNumBuffers,
uint32_t  maxSlabSize,
uint32_t  pageAlignment,
struct _DriFreeSlabManager fMan 
) [read]

Definition at line 898 of file ws_dri_slabpool.c.

References _DriSlabPool::bucketSizes, _DriBufferPool::create, _DriBufferPool::data, _DriSlabPool::desiredNumBuffers, _DriBufferPool::destroy, driInitSizeHeader(), _DriSlabPool::fd, _DriBufferPool::fence, _DriBufferPool::flags, _DriSlabPool::fMan, _DriSlabPool::headers, _DriBufferPool::kernel, _DriBufferPool::map, _DriSlabPool::maxSlabSize, _DriSlabPool::numBuckets, _DriBufferPool::offset, _DriSlabPool::pageAlignment, _DriSlabPool::pageSize, pool_create(), pool_destroy(), pool_fence(), pool_flags(), pool_kernel(), pool_map(), pool_offset(), pool_poolOffset(), pool_size(), pool_takedown(), pool_unmap(), pool_validate(), pool_waitIdle(), _DriBufferPool::poolOffset, _DriSlabPool::proposedFlags, _DriBufferPool::size, _DriBufferPool::takeDown, _DriBufferPool::unmap, _DriBufferPool::validate, _DriSlabPool::validMask, and _DriBufferPool::waitIdle.

00906 {
00907     struct _DriBufferPool *driPool;
00908     struct _DriSlabPool *pool;
00909     uint32_t i;
00910 
00911     driPool = calloc(1, sizeof(*driPool));
00912     if (!driPool)
00913         return NULL;
00914 
00915     pool = calloc(1, sizeof(*pool));
00916     if (!pool)
00917         goto out_err0;
00918 
00919     pool->bucketSizes = calloc(numSizes, sizeof(*pool->bucketSizes));
00920     if (!pool->bucketSizes)
00921         goto out_err1;
00922 
00923     pool->headers = calloc(numSizes, sizeof(*pool->headers));
00924     if (!pool->headers)
00925         goto out_err2;
00926 
00927     pool->fMan = fMan;
00928     pool->proposedFlags = flags;
00929     pool->validMask = validMask;
00930     pool->numBuckets = numSizes;
00931     pool->pageSize = getpagesize();
00932     pool->fd = fd;
00933     pool->pageAlignment = pageAlignment;
00934     pool->maxSlabSize = maxSlabSize;
00935     pool->desiredNumBuffers = desiredNumBuffers;
00936 
00937     for (i=0; i<pool->numBuckets; ++i) {
00938         pool->bucketSizes[i] = (smallestSize << i);
00939         driInitSizeHeader(pool, pool->bucketSizes[i],
00940                           &pool->headers[i]);
00941     }
00942 
00943     driPool->data = (void *) pool;
00944     driPool->map = &pool_map;
00945     driPool->unmap = &pool_unmap;
00946     driPool->destroy = &pool_destroy;
00947     driPool->offset = &pool_offset;
00948     driPool->poolOffset = &pool_poolOffset;
00949     driPool->flags = &pool_flags;
00950     driPool->size = &pool_size;
00951     driPool->create = &pool_create;
00952     driPool->fence = &pool_fence;
00953     driPool->kernel = &pool_kernel;
00954     driPool->validate = &pool_validate;
00955     driPool->waitIdle = &pool_waitIdle;
00956     driPool->takeDown = &pool_takedown;
00957 
00958     return driPool;
00959 
00960   out_err2:
00961     free(pool->bucketSizes);
00962   out_err1:
00963     free(pool);
00964   out_err0:
00965     free(driPool);
00966 
00967     return NULL;
00968 }


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