Go to the source code of this file.
Data Structures | |
struct | _drmBONode |
struct | _drmBOList |
Typedefs | |
typedef struct _drmBONode | drmBONode |
typedef struct _drmBOList | drmBOList |
Functions | |
drmBO * | driBOKernel (struct _DriBufferObject *buf) |
void * | driBOMap (struct _DriBufferObject *buf, unsigned flags, unsigned hint) |
void | driBOUnmap (struct _DriBufferObject *buf) |
unsigned long | driBOOffset (struct _DriBufferObject *buf) |
unsigned long | driBOPoolOffset (struct _DriBufferObject *buf) |
uint64_t | driBOFlags (struct _DriBufferObject *buf) |
struct _DriBufferObject * | driBOReference (struct _DriBufferObject *buf) |
void | driBOUnReference (struct _DriBufferObject *buf) |
int | driBOData (struct _DriBufferObject *r_buf, unsigned size, const void *data, struct _DriBufferPool *pool, uint64_t flags) |
void | driBOSubData (struct _DriBufferObject *buf, unsigned long offset, unsigned long size, const void *data) |
void | driBOGetSubData (struct _DriBufferObject *buf, unsigned long offset, unsigned long size, void *data) |
int | driGenBuffers (struct _DriBufferPool *pool, const char *name, unsigned n, struct _DriBufferObject *buffers[], unsigned alignment, uint64_t flags, unsigned hint) |
void | driGenUserBuffer (struct _DriBufferPool *pool, const char *name, struct _DriBufferObject *buffers[], void *ptr, unsigned bytes) |
void | driDeleteBuffers (unsigned n, struct _DriBufferObject *buffers[]) |
void | driInitBufMgr (int fd) |
struct _DriBufferList * | driBOCreateList (int target) |
int | driBOResetList (struct _DriBufferList *list) |
void | driBOAddListItem (struct _DriBufferList *list, struct _DriBufferObject *buf, uint64_t flags, uint64_t mask, int *itemLoc, struct _drmBONode **node) |
void | driBOValidateList (int fd, struct _DriBufferList *list) |
void | driBOFreeList (struct _DriBufferList *list) |
struct _DriFenceObject * | driBOFenceUserList (struct _DriFenceMgr *mgr, struct _DriBufferList *list, const char *name, drmFence *kFence) |
void | driBOUnrefUserList (struct _DriBufferList *list) |
void | driBOValidateUserList (struct _DriBufferList *list) |
drmBOList * | driGetdrmBOList (struct _DriBufferList *list) |
void | driPutdrmBOList (struct _DriBufferList *list) |
void | driBOFence (struct _DriBufferObject *buf, struct _DriFenceObject *fence) |
void | driPoolTakeDown (struct _DriBufferPool *pool) |
void | driBOSetReferenced (struct _DriBufferObject *buf, unsigned long handle) |
unsigned long | driBOSize (struct _DriBufferObject *buf) |
void | driBOWaitIdle (struct _DriBufferObject *buf, int lazy) |
void | driReadLockKernelBO (void) |
void | driReadUnlockKernelBO (void) |
void | driWriteLockKernelBO (void) |
void | driWriteUnlockKernelBO (void) |
drmBOList * | driBOGetDRMBuffers (struct _DriBufferList *list) |
drmBOList * | driBOGetDRIBuffers (struct _DriBufferList *list) |
typedef struct _drmBOList drmBOList |
typedef struct _drmBONode drmBONode |
void driBOAddListItem | ( | struct _DriBufferList * | list, | |
struct _DriBufferObject * | buf, | |||
uint64_t | flags, | |||
uint64_t | mask, | |||
int * | itemLoc, | |||
struct _drmBONode ** | node | |||
) |
Definition at line 814 of file ws_dri_bufmgr.c.
References BM_CKFATAL, driAddValidateItem(), _DriBufferList::driBuffers, drmAddValidateItem(), _DriBufferList::drmBuffers, _DriBufferPool::kernel, _DriBufferObject::mutex, pipe_mutex_lock, pipe_mutex_unlock, _DriBufferObject::pool, and _DriBufferObject::private.
00818 { 00819 int newItem; 00820 00821 pipe_mutex_lock(buf->mutex); 00822 BM_CKFATAL(driAddValidateItem(&list->drmBuffers, 00823 buf->pool->kernel(buf->pool, buf->private), 00824 flags, mask, itemLoc, node)); 00825 BM_CKFATAL(drmAddValidateItem(&list->driBuffers, (drmBO *) buf, 00826 flags, mask, &newItem)); 00827 if (newItem) 00828 buf->refCount++; 00829 00830 pipe_mutex_unlock(buf->mutex);
struct _DriBufferList* driBOCreateList | ( | int | target | ) | [read] |
Definition at line 700 of file ws_dri_bufmgr.c.
References BM_CKFATAL, _DriBufferList::driBuffers, drmBOCreateList(), _DriBufferList::drmBuffers, and list.
00702 { 00703 struct _DriBufferList *list = calloc(sizeof(*list), 1); 00704 00705 BM_CKFATAL(drmBOCreateList(target, &list->drmBuffers)); 00706 BM_CKFATAL(drmBOCreateList(target, &list->driBuffers)); 00707 return list;
int driBOData | ( | struct _DriBufferObject * | r_buf, | |
unsigned | size, | |||
const void * | data, | |||
struct _DriBufferPool * | pool, | |||
uint64_t | flags | |||
) |
Definition at line 459 of file ws_dri_bufmgr.c.
References _DriBufferObject::alignment, assert, BM_CKFATAL, _DriBufferPool::create, _DriBufferObject::createdByReference, _DriBufferPool::destroy, ENOMEM, _DriBufferObject::flags, _DriBufferPool::map, _DriBufferObject::mutex, pipe_mutex_lock, pipe_mutex_unlock, _DriBufferObject::pool, _DriBufferObject::private, _DriBufferPool::setStatus, _DriBufferPool::size, _DriBufferPool::unmap, and _DriBufferObject::userBuffer.
00464 { 00465 void *virtual = NULL; 00466 int newBuffer; 00467 int retval = 0; 00468 struct _DriBufferPool *pool; 00469 00470 assert(!buf->userBuffer); /* XXX just do a memcpy? */ 00471 00472 pipe_mutex_lock(buf->mutex); 00473 pool = buf->pool; 00474 00475 if (pool == NULL && newPool != NULL) { 00476 buf->pool = newPool; 00477 pool = newPool; 00478 } 00479 if (newPool == NULL) 00480 newPool = pool; 00481 00482 if (!pool->create) { 00483 assert((size_t)"driBOData called on invalid buffer\n" & 0); 00484 BM_CKFATAL(-EINVAL); 00485 } 00486 00487 newBuffer = (!buf->private || pool != newPool || 00488 pool->size(pool, buf->private) < size); 00489 00490 if (!flags) 00491 flags = buf->flags; 00492 00493 if (newBuffer) { 00494 00495 if (buf->createdByReference) { 00496 assert((size_t)"driBOData requiring resizing called on shared buffer.\n" & 0); 00497 BM_CKFATAL(-EINVAL); 00498 } 00499 00500 if (buf->private) 00501 buf->pool->destroy(buf->pool, buf->private); 00502 00503 pool = newPool; 00504 buf->pool = newPool; 00505 buf->private = pool->create(pool, size, flags, DRM_BO_HINT_DONT_FENCE, 00506 buf->alignment); 00507 if (!buf->private) 00508 retval = -ENOMEM; 00509 00510 if (retval == 0) 00511 retval = pool->map(pool, buf->private, 00512 DRM_BO_FLAG_WRITE, 00513 DRM_BO_HINT_DONT_BLOCK, &buf->mutex, &virtual); 00514 } else if (pool->map(pool, buf->private, DRM_BO_FLAG_WRITE, 00515 DRM_BO_HINT_DONT_BLOCK, &buf->mutex, &virtual)) { 00516 /* 00517 * Buffer is busy. need to create a new one. 00518 */ 00519 00520 void *newBuf; 00521 00522 newBuf = pool->create(pool, size, flags, DRM_BO_HINT_DONT_FENCE, 00523 buf->alignment); 00524 if (newBuf) { 00525 buf->pool->destroy(buf->pool, buf->private); 00526 buf->private = newBuf; 00527 } 00528 00529 retval = pool->map(pool, buf->private, 00530 DRM_BO_FLAG_WRITE, 0, &buf->mutex, &virtual); 00531 } else { 00532 uint64_t flag_diff = flags ^ buf->flags; 00533 00534 /* 00535 * We might need to change buffer flags. 00536 */ 00537 00538 if (flag_diff){ 00539 assert(pool->setStatus != NULL); 00540 BM_CKFATAL(pool->unmap(pool, buf->private)); 00541 BM_CKFATAL(pool->setStatus(pool, buf->private, flag_diff, 00542 buf->flags)); 00543 if (!data) 00544 goto out; 00545 00546 retval = pool->map(pool, buf->private, 00547 DRM_BO_FLAG_WRITE, 0, &buf->mutex, &virtual); 00548 } 00549 } 00550 00551 if (retval == 0) { 00552 if (data) 00553 memcpy(virtual, data, size); 00554 00555 BM_CKFATAL(pool->unmap(pool, buf->private)); 00556 } 00557 00558 out: 00559 pipe_mutex_unlock(buf->mutex); 00560 00561 return retval;
void driBOFence | ( | struct _DriBufferObject * | buf, | |
struct _DriFenceObject * | fence | |||
) |
Definition at line 845 of file ws_dri_bufmgr.c.
References BM_CKFATAL, _DriBufferPool::fence, _DriBufferObject::mutex, pipe_mutex_lock, pipe_mutex_unlock, _DriBufferObject::pool, and _DriBufferObject::private.
00847 { 00848 pipe_mutex_lock(buf->mutex); 00849 if (buf->pool->fence) 00850 BM_CKFATAL(buf->pool->fence(buf->pool, buf->private, fence)); 00851 pipe_mutex_unlock(buf->mutex); 00852
struct _DriFenceObject* driBOFenceUserList | ( | struct _DriFenceMgr * | mgr, | |
struct _DriBufferList * | list, | |||
const char * | name, | |||
drmFence * | kFence | |||
) | [read] |
Definition at line 869 of file ws_dri_bufmgr.c.
References driBOFence(), driBOResetList(), driBOUnReference(), _DriBufferList::driBuffers, driFenceCreate(), drmBOListBuf(), drmBOListIterator(), and drmBOListNext().
00873 { 00874 struct _DriFenceObject *fence; 00875 struct _DriBufferObject *buf; 00876 void *curBuf; 00877 00878 fence = driFenceCreate(mgr, kFence->fence_class, kFence->type, 00879 kFence, sizeof(*kFence)); 00880 curBuf = drmBOListIterator(&list->driBuffers); 00881 00882 /* 00883 * User-space fencing callbacks. 00884 */ 00885 00886 while (curBuf) { 00887 buf = (struct _DriBufferObject *) drmBOListBuf(curBuf); 00888 driBOFence(buf, fence); 00889 driBOUnReference(buf); 00890 curBuf = drmBOListNext(&list->driBuffers, curBuf); 00891 } 00892 00893 driBOResetList(list); 00894 return fence;
uint64_t driBOFlags | ( | struct _DriBufferObject * | buf | ) |
Definition at line 403 of file ws_dri_bufmgr.c.
References assert, driReadLockKernelBO(), driReadUnlockKernelBO(), _DriBufferPool::flags, _DriBufferObject::mutex, pipe_mutex_lock, pipe_mutex_unlock, _DriBufferObject::pool, and _DriBufferObject::private.
00405 { 00406 uint64_t ret; 00407 00408 assert(buf->private != NULL); 00409 00410 driReadLockKernelBO(); 00411 pipe_mutex_lock(buf->mutex); 00412 ret = buf->pool->flags(buf->pool, buf->private); 00413 pipe_mutex_unlock(buf->mutex); 00414 driReadUnlockKernelBO(); 00415 return ret;
void driBOFreeList | ( | struct _DriBufferList * | list | ) |
Definition at line 721 of file ws_dri_bufmgr.c.
References _DriBufferList::driBuffers, drmBOFreeList(), and _DriBufferList::drmBuffers.
00723 { 00724 drmBOFreeList(&list->drmBuffers); 00725 drmBOFreeList(&list->driBuffers); 00726 free(list);
drmBOList* driBOGetDRIBuffers | ( | struct _DriBufferList * | list | ) |
Definition at line 944 of file ws_dri_bufmgr.c.
References _DriBufferList::driBuffers.
00946 { 00947 return &list->driBuffers;
drmBOList* driBOGetDRMBuffers | ( | struct _DriBufferList * | list | ) |
Definition at line 939 of file ws_dri_bufmgr.c.
References _DriBufferList::drmBuffers.
00941 { 00942 return &list->drmBuffers;
void driBOGetSubData | ( | struct _DriBufferObject * | buf, | |
unsigned long | offset, | |||
unsigned long | size, | |||
void * | data | |||
) |
Definition at line 583 of file ws_dri_bufmgr.c.
References assert, BM_CKFATAL, _DriBufferPool::map, _DriBufferObject::mutex, pipe_mutex_lock, pipe_mutex_unlock, _DriBufferObject::pool, _DriBufferObject::private, _DriBufferPool::unmap, and _DriBufferObject::userBuffer.
00586 { 00587 void *virtual; 00588 00589 assert(!buf->userBuffer); /* XXX just do a memcpy? */ 00590 00591 pipe_mutex_lock(buf->mutex); 00592 if (size && data) { 00593 BM_CKFATAL(buf->pool->map(buf->pool, buf->private, 00594 DRM_BO_FLAG_READ, 0, &buf->mutex, &virtual)); 00595 memcpy(data, (unsigned char *) virtual + offset, size); 00596 BM_CKFATAL(buf->pool->unmap(buf->pool, buf->private)); 00597 } 00598 pipe_mutex_unlock(buf->mutex);
drmBO* driBOKernel | ( | struct _DriBufferObject * | buf | ) |
Definition at line 315 of file ws_dri_bufmgr.c.
References assert, BM_CKFATAL, driReadLockKernelBO(), driReadUnlockKernelBO(), _DriBufferPool::kernel, _DriBufferObject::mutex, pipe_mutex_lock, pipe_mutex_unlock, _DriBufferObject::pool, and _DriBufferObject::private.
00317 { 00318 drmBO *ret; 00319 00320 driReadLockKernelBO(); 00321 pipe_mutex_lock(buf->mutex); 00322 assert(buf->private != NULL); 00323 ret = buf->pool->kernel(buf->pool, buf->private); 00324 if (!ret) 00325 BM_CKFATAL(-EINVAL); 00326 pipe_mutex_unlock(buf->mutex); 00327 driReadUnlockKernelBO(); 00328 00329 return ret;
void* driBOMap | ( | struct _DriBufferObject * | buf, | |
unsigned | flags, | |||
unsigned | hint | |||
) |
Definition at line 346 of file ws_dri_bufmgr.c.
References assert, _DriBufferPool::map, _DriBufferObject::mutex, pipe_mutex_lock, pipe_mutex_unlock, _DriBufferObject::pool, _DriBufferObject::private, _DriBufferObject::userBuffer, and _DriBufferObject::userData.
00348 { 00349 void *virtual; 00350 int retval; 00351 00352 if (buf->userBuffer) { 00353 return buf->userData; 00354 } 00355 00356 pipe_mutex_lock(buf->mutex); 00357 assert(buf->private != NULL); 00358 retval = buf->pool->map(buf->pool, buf->private, flags, hint, 00359 &buf->mutex, &virtual); 00360 pipe_mutex_unlock(buf->mutex); 00361 00362 return retval == 0 ? virtual : NULL;
unsigned long driBOOffset | ( | struct _DriBufferObject * | buf | ) |
Definition at line 377 of file ws_dri_bufmgr.c.
References assert, _DriBufferObject::mutex, _DriBufferPool::offset, pipe_mutex_lock, pipe_mutex_unlock, _DriBufferObject::pool, and _DriBufferObject::private.
00379 { 00380 unsigned long ret; 00381 00382 assert(buf->private != NULL); 00383 00384 pipe_mutex_lock(buf->mutex); 00385 ret = buf->pool->offset(buf->pool, buf->private); 00386 pipe_mutex_unlock(buf->mutex); 00387 return ret;
unsigned long driBOPoolOffset | ( | struct _DriBufferObject * | buf | ) |
Definition at line 390 of file ws_dri_bufmgr.c.
References assert, _DriBufferObject::mutex, pipe_mutex_lock, pipe_mutex_unlock, _DriBufferObject::pool, _DriBufferPool::poolOffset, and _DriBufferObject::private.
00392 { 00393 unsigned long ret; 00394 00395 assert(buf->private != NULL); 00396 00397 pipe_mutex_lock(buf->mutex); 00398 ret = buf->pool->poolOffset(buf->pool, buf->private); 00399 pipe_mutex_unlock(buf->mutex); 00400 return ret;
struct _DriBufferObject* driBOReference | ( | struct _DriBufferObject * | buf | ) | [read] |
Definition at line 418 of file ws_dri_bufmgr.c.
References BM_CKFATAL, _DriBufferObject::mutex, pipe_mutex_lock, pipe_mutex_unlock, and _DriBufferObject::refCount.
00420 { 00421 pipe_mutex_lock(buf->mutex); 00422 if (++buf->refCount == 1) { 00423 pipe_mutex_unlock(buf->mutex); 00424 BM_CKFATAL(-EINVAL); 00425 } 00426 pipe_mutex_unlock(buf->mutex); 00427 return buf;
int driBOResetList | ( | struct _DriBufferList * | list | ) |
Definition at line 710 of file ws_dri_bufmgr.c.
References _DriBufferList::driBuffers, drmBOResetList(), and _DriBufferList::drmBuffers.
00712 { 00713 int ret; 00714 ret = drmBOResetList(&list->drmBuffers); 00715 if (ret) 00716 return ret; 00717 ret = drmBOResetList(&list->driBuffers); 00718 return ret;
void driBOSetReferenced | ( | struct _DriBufferObject * | buf, | |
unsigned long | handle | |||
) |
Definition at line 601 of file ws_dri_bufmgr.c.
References assert, BM_CKFATAL, _DriBufferObject::createdByReference, ENOMEM, _DriBufferObject::flags, _DriBufferPool::kernel, _DriBufferObject::mutex, pipe_mutex_lock, pipe_mutex_unlock, _DriBufferObject::pool, _DriBufferObject::private, _DriBufferPool::reference, and TRUE.
00604 { 00605 pipe_mutex_lock(buf->mutex); 00606 if (buf->private != NULL) { 00607 assert((size_t)"Invalid buffer for setReferenced\n" & 0); 00608 BM_CKFATAL(-EINVAL); 00609 00610 } 00611 if (buf->pool->reference == NULL) { 00612 assert((size_t)"Invalid buffer pool for setReferenced\n" & 0); 00613 BM_CKFATAL(-EINVAL); 00614 } 00615 buf->private = buf->pool->reference(buf->pool, handle); 00616 if (!buf->private) { 00617 assert((size_t)"Invalid buffer pool for setStatic\n" & 0); 00618 BM_CKFATAL(-ENOMEM); 00619 } 00620 buf->createdByReference = TRUE; 00621 buf->flags = buf->pool->kernel(buf->pool, buf->private)->flags; 00622 pipe_mutex_unlock(buf->mutex);
unsigned long driBOSize | ( | struct _DriBufferObject * | buf | ) |
Definition at line 927 of file ws_dri_bufmgr.c.
References _DriBufferObject::mutex, pipe_mutex_lock, pipe_mutex_unlock, _DriBufferObject::pool, _DriBufferObject::private, and _DriBufferPool::size.
00929 { 00930 unsigned long size; 00931 00932 pipe_mutex_lock(buf->mutex); 00933 size = buf->pool->size(buf->pool, buf->private); 00934 pipe_mutex_unlock(buf->mutex); 00935 00936 return size; 00937
void driBOSubData | ( | struct _DriBufferObject * | buf, | |
unsigned long | offset, | |||
unsigned long | size, | |||
const void * | data | |||
) |
Definition at line 564 of file ws_dri_bufmgr.c.
References assert, BM_CKFATAL, _DriBufferPool::map, _DriBufferObject::mutex, pipe_mutex_lock, pipe_mutex_unlock, _DriBufferObject::pool, _DriBufferObject::private, _DriBufferPool::unmap, and _DriBufferObject::userBuffer.
00567 { 00568 void *virtual; 00569 00570 assert(!buf->userBuffer); /* XXX just do a memcpy? */ 00571 00572 pipe_mutex_lock(buf->mutex); 00573 if (size && data) { 00574 BM_CKFATAL(buf->pool->map(buf->pool, buf->private, 00575 DRM_BO_FLAG_WRITE, 0, &buf->mutex, 00576 &virtual)); 00577 memcpy((unsigned char *) virtual + offset, data, size); 00578 BM_CKFATAL(buf->pool->unmap(buf->pool, buf->private)); 00579 } 00580 pipe_mutex_unlock(buf->mutex);
void driBOUnmap | ( | struct _DriBufferObject * | buf | ) |
Definition at line 365 of file ws_dri_bufmgr.c.
References assert, BM_CKFATAL, _DriBufferObject::mutex, pipe_mutex_lock, pipe_mutex_unlock, _DriBufferObject::pool, _DriBufferObject::private, _DriBufferPool::unmap, and _DriBufferObject::userBuffer.
00367 { 00368 if (buf->userBuffer) 00369 return; 00370 00371 assert(buf->private != NULL); 00372 pipe_mutex_lock(buf->mutex); 00373 BM_CKFATAL(buf->pool->unmap(buf->pool, buf->private)); 00374 pipe_mutex_unlock(buf->mutex);
void driBOUnReference | ( | struct _DriBufferObject * | buf | ) |
Definition at line 430 of file ws_dri_bufmgr.c.
References _DriBufferObject::createdByReference, _DriBufferPool::destroy, _DriBufferObject::mutex, num_buffers, num_user_buffers, pipe_mutex_lock, pipe_mutex_unlock, _DriBufferObject::pool, _DriBufferObject::private, _DriBufferObject::refCount, _DriBufferPool::unreference, and _DriBufferObject::userBuffer.
00432 { 00433 int tmp; 00434 00435 if (!buf) 00436 return; 00437 00438 pipe_mutex_lock(buf->mutex); 00439 tmp = --buf->refCount; 00440 if (!tmp) { 00441 pipe_mutex_unlock(buf->mutex); 00442 if (buf->private) { 00443 if (buf->createdByReference) 00444 buf->pool->unreference(buf->pool, buf->private); 00445 else 00446 buf->pool->destroy(buf->pool, buf->private); 00447 } 00448 if (buf->userBuffer) 00449 num_user_buffers--; 00450 else 00451 num_buffers--; 00452 free(buf); 00453 } else 00454 pipe_mutex_unlock(buf->mutex); 00455
void driBOUnrefUserList | ( | struct _DriBufferList * | list | ) |
Definition at line 855 of file ws_dri_bufmgr.c.
References driBOUnReference(), _DriBufferList::driBuffers, drmBOListBuf(), drmBOListIterator(), and drmBOListNext().
00857 { 00858 struct _DriBufferObject *buf; 00859 void *curBuf; 00860 00861 curBuf = drmBOListIterator(&list->driBuffers); 00862 while (curBuf) { 00863 buf = (struct _DriBufferObject *)drmBOListBuf(curBuf); 00864 driBOUnReference(buf); 00865 curBuf = drmBOListNext(&list->driBuffers, curBuf); 00866 }
void driBOValidateList | ( | int | fd, | |
struct _DriBufferList * | list | |||
) |
void driBOValidateUserList | ( | struct _DriBufferList * | list | ) |
Definition at line 897 of file ws_dri_bufmgr.c.
References BM_CKFATAL, _DriBufferList::driBuffers, drmBOListBuf(), drmBOListIterator(), drmBOListNext(), _DriBufferObject::mutex, pipe_mutex_lock, pipe_mutex_unlock, _DriBufferObject::pool, _DriBufferObject::private, and _DriBufferPool::validate.
00899 { 00900 void *curBuf; 00901 struct _DriBufferObject *buf; 00902 00903 curBuf = drmBOListIterator(&list->driBuffers); 00904 00905 /* 00906 * User-space validation callbacks. 00907 */ 00908 00909 while (curBuf) { 00910 buf = (struct _DriBufferObject *) drmBOListBuf(curBuf); 00911 pipe_mutex_lock(buf->mutex); 00912 if (buf->pool->validate) 00913 BM_CKFATAL(buf->pool->validate(buf->pool, buf->private, &buf->mutex)); 00914 pipe_mutex_unlock(buf->mutex); 00915 curBuf = drmBOListNext(&list->driBuffers, curBuf); 00916 }
void driBOWaitIdle | ( | struct _DriBufferObject * | buf, | |
int | lazy | |||
) |
Definition at line 332 of file ws_dri_bufmgr.c.
References BM_CKFATAL, _DriBufferObject::mutex, pipe_mutex_lock, pipe_mutex_unlock, _DriBufferObject::pool, _DriBufferObject::private, and _DriBufferPool::waitIdle.
00334 { 00335 00336 /* 00337 * This function may block. Is it sane to keep the mutex held during 00338 * that time?? 00339 */ 00340 00341 pipe_mutex_lock(buf->mutex); 00342 BM_CKFATAL(buf->pool->waitIdle(buf->pool, buf->private, &buf->mutex, lazy)); 00343 pipe_mutex_unlock(buf->mutex);
void driDeleteBuffers | ( | unsigned | n, | |
struct _DriBufferObject * | buffers[] | |||
) |
Definition at line 679 of file ws_dri_bufmgr.c.
References driBOUnReference().
00681 { 00682 int i; 00683 00684 for (i = 0; i < n; ++i) { 00685 driBOUnReference(buffers[i]); 00686 }
int driGenBuffers | ( | struct _DriBufferPool * | pool, | |
const char * | name, | |||
unsigned | n, | |||
struct _DriBufferObject * | buffers[], | |||
unsigned | alignment, | |||
uint64_t | flags, | |||
unsigned | hint | |||
) |
Definition at line 625 of file ws_dri_bufmgr.c.
References _DriBufferObject::alignment, assert, _DriBufferObject::createdByReference, ENOMEM, _DriBufferObject::flags, _DriBufferObject::hint, _DriBufferObject::mutex, _DriBufferObject::name, num_buffers, pipe_mutex_init, pipe_mutex_lock, pipe_mutex_unlock, _DriBufferObject::pool, and _DriBufferObject::refCount.
00631 { 00632 struct _DriBufferObject *buf; 00633 int i; 00634 00635 flags = (flags) ? flags : DRM_BO_FLAG_MEM_TT | DRM_BO_FLAG_MEM_VRAM | 00636 DRM_BO_FLAG_MEM_LOCAL | DRM_BO_FLAG_READ | DRM_BO_FLAG_WRITE; 00637 00638 ++num_buffers; 00639 00640 assert(pool); 00641 00642 for (i = 0; i < n; ++i) { 00643 buf = (struct _DriBufferObject *) calloc(1, sizeof(*buf)); 00644 if (!buf) 00645 return -ENOMEM; 00646 00647 pipe_mutex_init(buf->mutex); 00648 pipe_mutex_lock(buf->mutex); 00649 buf->refCount = 1; 00650 buf->flags = flags; 00651 buf->hint = hint; 00652 buf->name = name; 00653 buf->alignment = alignment; 00654 buf->pool = pool; 00655 buf->createdByReference = 0; 00656 pipe_mutex_unlock(buf->mutex); 00657 buffers[i] = buf; 00658 } 00659 return 0;
void driGenUserBuffer | ( | struct _DriBufferPool * | pool, | |
const char * | name, | |||
struct _DriBufferObject * | buffers[], | |||
void * | ptr, | |||
unsigned | bytes | |||
) |
drmBOList* driGetdrmBOList | ( | struct _DriBufferList * | list | ) |
Definition at line 832 of file ws_dri_bufmgr.c.
References driWriteLockKernelBO(), and _DriBufferList::drmBuffers.
00834 { 00835 driWriteLockKernelBO(); 00836 return &list->drmBuffers;
void driInitBufMgr | ( | int | fd | ) |
void driPoolTakeDown | ( | struct _DriBufferPool * | pool | ) |
Definition at line 920 of file ws_dri_bufmgr.c.
References _DriBufferPool::takeDown.
00922 { 00923 pool->takeDown(pool); 00924
void driPutdrmBOList | ( | struct _DriBufferList * | list | ) |
Definition at line 838 of file ws_dri_bufmgr.c.
References driWriteUnlockKernelBO().
00840 { 00841 driWriteUnlockKernelBO();
void driReadLockKernelBO | ( | void | ) |
Definition at line 254 of file ws_dri_bufmgr.c.
References kernelReaders, pipe_mutex_lock, and pipe_mutex_unlock.
00255 { 00256 pipe_mutex_lock(bmMutex); 00257 kernelReaders++; 00258 pipe_mutex_unlock(bmMutex); 00259 }
void driReadUnlockKernelBO | ( | void | ) |
Definition at line 261 of file ws_dri_bufmgr.c.
References kernelReaders, pipe_condvar_broadcast, pipe_mutex_lock, and pipe_mutex_unlock.
00262 { 00263 pipe_mutex_lock(bmMutex); 00264 if (--kernelReaders == 0) 00265 pipe_condvar_broadcast(bmCond); 00266 pipe_mutex_unlock(bmMutex); 00267 }
void driWriteLockKernelBO | ( | void | ) |
Definition at line 242 of file ws_dri_bufmgr.c.
References kernelReaders, pipe_condvar_wait, and pipe_mutex_lock.
00243 { 00244 pipe_mutex_lock(bmMutex); 00245 while(kernelReaders != 0) 00246 pipe_condvar_wait(bmCond, bmMutex); 00247 }
void driWriteUnlockKernelBO | ( | void | ) |
Definition at line 249 of file ws_dri_bufmgr.c.
References pipe_mutex_unlock.
00250 { 00251 pipe_mutex_unlock(bmMutex); 00252 }