diff options
-rw-r--r-- | src/mesa/drivers/dri/common/dri_bufmgr.c | 25 | ||||
-rw-r--r-- | src/mesa/drivers/dri/common/dri_bufmgr.h | 5 |
2 files changed, 30 insertions, 0 deletions
diff --git a/src/mesa/drivers/dri/common/dri_bufmgr.c b/src/mesa/drivers/dri/common/dri_bufmgr.c index 4e50be1532..f5a4945a3b 100644 --- a/src/mesa/drivers/dri/common/dri_bufmgr.c +++ b/src/mesa/drivers/dri/common/dri_bufmgr.c @@ -508,6 +508,31 @@ driBOAddListItem(struct _DriBufferList * list, struct _DriBufferObject *buf, _glthread_UNLOCK_MUTEX(buf->mutex); } + +void +driBOAddListItemAndReference(struct _DriBufferList * list, + struct _DriBufferObject *buf, + unsigned flags, unsigned mask) +{ + int newItem; + + _glthread_LOCK_MUTEX(buf->mutex); + _glthread_LOCK_MUTEX(bmMutex); + BM_CKFATAL(drmAddValidateItem(&list->drmBuffers, driBOKernel(buf), + flags, mask, &newItem)); + if (buf->pool->validate) + BM_CKFATAL(drmAddValidateItem(&list->driBuffers, (drmBO *) buf, + flags, mask, &newItem)); + + if (++buf->refCount == 1) { + BM_CKFATAL(-EINVAL); + } + + _glthread_UNLOCK_MUTEX(bmMutex); + _glthread_UNLOCK_MUTEX(buf->mutex); +} + + void driBOFence(struct _DriBufferObject *buf, struct _DriFenceObject *fence) { diff --git a/src/mesa/drivers/dri/common/dri_bufmgr.h b/src/mesa/drivers/dri/common/dri_bufmgr.h index 0fbcb29af0..4e45745668 100644 --- a/src/mesa/drivers/dri/common/dri_bufmgr.h +++ b/src/mesa/drivers/dri/common/dri_bufmgr.h @@ -87,6 +87,11 @@ extern void driBOResetList(struct _DriBufferList * list); extern void driBOAddListItem(struct _DriBufferList * list, struct _DriBufferObject *buf, unsigned flags, unsigned mask); + +extern void driBOAddListItemAndReference(struct _DriBufferList * list, + struct _DriBufferObject *buf, + unsigned flags, unsigned mask); + extern void driBOValidateList(int fd, struct _DriBufferList * list); extern void driBOFreeList(struct _DriBufferList * list); |