Lines Matching refs:dBuf

98 ttmGetPool(struct _TTMBuffer *dBuf)  in ttmGetPool()  argument
100 return containerOf(dBuf->buf.pool, struct _TTMPool, pool); in ttmGetPool()
113 struct _TTMBuffer *dBuf = (struct _TTMBuffer *) in pool_create() local
114 calloc(1, sizeof(*dBuf)); in pool_create()
120 if (!dBuf) in pool_create()
126 ret = wsbmBufStorageInit(&dBuf->buf, pool); in pool_create()
130 ret = WSBM_COND_INIT(&dBuf->event); in pool_create()
144 dBuf->requestedSize = size; in pool_create()
145 dBuf->kBuf.gpuOffset = arg.rep.gpu_offset; in pool_create()
146 dBuf->mapHandle = arg.rep.map_handle; in pool_create()
147 dBuf->realSize = arg.rep.bo_size; in pool_create()
148 dBuf->kBuf.placement = arg.rep.placement; in pool_create()
149 dBuf->kBuf.handle = arg.rep.handle; in pool_create()
151 return &dBuf->buf; in pool_create()
154 WSBM_COND_FREE(&dBuf->event); in pool_create()
156 wsbmBufStorageTakedown(&dBuf->buf); in pool_create()
158 free(dBuf); in pool_create()
165 struct _TTMBuffer *dBuf = (struct _TTMBuffer *)calloc(1, sizeof(*dBuf)); in pool_reference() local
170 if (!dBuf) in pool_reference()
173 ret = wsbmBufStorageInit(&dBuf->buf, pool); in pool_reference()
177 ret = WSBM_COND_INIT(&dBuf->event); in pool_reference()
188 dBuf->requestedSize = arg.rep.bo_size; in pool_reference()
189 dBuf->kBuf.gpuOffset = arg.rep.gpu_offset; in pool_reference()
190 dBuf->mapHandle = arg.rep.map_handle; in pool_reference()
191 dBuf->realSize = arg.rep.bo_size; in pool_reference()
192 dBuf->kBuf.placement = arg.rep.placement; in pool_reference()
193 dBuf->kBuf.handle = arg.rep.handle; in pool_reference()
194 dBuf->kBuf.fence_type_mask = arg.rep.sync_object_arg; in pool_reference()
196 return &dBuf->buf; in pool_reference()
199 WSBM_COND_FREE(&dBuf->event); in pool_reference()
201 wsbmBufStorageTakedown(&dBuf->buf); in pool_reference()
203 free(dBuf); in pool_reference()
210 struct _TTMBuffer *dBuf = ttmBuffer(*buf); in pool_destroy() local
211 struct _TTMPool *ttmPool = ttmGetPool(dBuf); in pool_destroy()
215 if (dBuf->virtual != NULL) { in pool_destroy()
216 (void)munmap(dBuf->virtual, dBuf->requestedSize); in pool_destroy()
217 dBuf->virtual = NULL; in pool_destroy()
219 arg.handle = dBuf->kBuf.handle; in pool_destroy()
220 (void)drmCommandWrite(dBuf->buf.pool->fd, in pool_destroy()
224 WSBM_COND_FREE(&dBuf->event); in pool_destroy()
225 wsbmBufStorageTakedown(&dBuf->buf); in pool_destroy()
226 free(dBuf); in pool_destroy()
233 struct _TTMBuffer *dBuf = ttmBuffer(buf); in syncforcpu_locked() local
234 struct _TTMPool *ttmPool = ttmGetPool(dBuf); in syncforcpu_locked()
239 while (dBuf->syncInProgress) in syncforcpu_locked()
240 WSBM_COND_WAIT(&dBuf->event, &buf->mutex); in syncforcpu_locked()
242 readers = dBuf->readers; in syncforcpu_locked()
243 writers = dBuf->writers; in syncforcpu_locked()
245 if ((mode & WSBM_SYNCCPU_READ) && (++dBuf->readers == 1)) in syncforcpu_locked()
248 if ((mode & WSBM_SYNCCPU_WRITE) && (++dBuf->writers == 1)) in syncforcpu_locked()
257 dBuf->syncInProgress = 1; in syncforcpu_locked()
266 arg.handle = dBuf->kBuf.handle; in syncforcpu_locked()
270 DRMRESTARTCOMMANDWRITE(dBuf->buf.pool->fd, in syncforcpu_locked()
274 dBuf->syncInProgress = 0; in syncforcpu_locked()
275 WSBM_COND_BROADCAST(&dBuf->event); in syncforcpu_locked()
278 dBuf->readers = readers; in syncforcpu_locked()
279 dBuf->writers = writers; in syncforcpu_locked()
290 struct _TTMBuffer *dBuf = ttmBuffer(buf); in releasefromcpu_locked() local
291 struct _TTMPool *ttmPool = ttmGetPool(dBuf); in releasefromcpu_locked()
294 while (dBuf->syncInProgress) in releasefromcpu_locked()
295 WSBM_COND_WAIT(&dBuf->event, &buf->mutex); in releasefromcpu_locked()
297 if ((mode & WSBM_SYNCCPU_READ) && (--dBuf->readers == 0)) in releasefromcpu_locked()
300 if ((mode & WSBM_SYNCCPU_WRITE) && (--dBuf->writers == 0)) in releasefromcpu_locked()
306 arg.handle = dBuf->kBuf.handle; in releasefromcpu_locked()
310 DRMRESTARTCOMMANDWRITE(dBuf->buf.pool->fd, in releasefromcpu_locked()
353 struct _TTMBuffer *dBuf = ttmBuffer(buf); in pool_map() local
364 if (dBuf->virtual == NULL) { in pool_map()
366 virt = mmap(0, dBuf->requestedSize, in pool_map()
368 buf->pool->fd, dBuf->mapHandle); in pool_map()
370 virt = _temp_mmap(0, dBuf->requestedSize, in pool_map()
372 buf->pool->fd, dBuf->mapHandle); in pool_map()
378 dBuf->virtual = virt; in pool_map()
381 *virtual = dBuf->virtual; in pool_map()
398 struct _TTMBuffer *dBuf = ttmBuffer(buf); in pool_offset() local
400 return dBuf->kBuf.gpuOffset; in pool_offset()
412 struct _TTMBuffer *dBuf = ttmBuffer(buf); in pool_placement() local
414 return dBuf->kBuf.placement; in pool_placement()
420 struct _TTMBuffer *dBuf = ttmBuffer(buf); in pool_size() local
422 return dBuf->realSize; in pool_size()
437 struct _TTMBuffer *dBuf = ttmBuffer(buf); in pool_waitIdle() local
438 struct _TTMPool *ttmPool = ttmGetPool(dBuf); in pool_waitIdle()
443 req.handle = dBuf->kBuf.handle; in pool_waitIdle()
464 struct _TTMBuffer *dBuf = ttmBuffer(buf); in pool_setStatus() local
465 struct _TTMPool *ttmPool = ttmGetPool(dBuf); in pool_setStatus()
472 req->handle = dBuf->kBuf.handle; in pool_setStatus()
481 dBuf->kBuf.gpuOffset = rep->gpu_offset; in pool_setStatus()
482 dBuf->kBuf.placement = rep->placement; in pool_setStatus()
534 struct _TTMBuffer *dBuf = (struct _TTMBuffer *) in ttm_pool_ub_create() local
535 calloc(1, sizeof(*dBuf)); in ttm_pool_ub_create()
541 if (!dBuf) in ttm_pool_ub_create()
547 ret = wsbmBufStorageInit(&dBuf->buf, pool); in ttm_pool_ub_create()
551 ret = WSBM_COND_INIT(&dBuf->event); in ttm_pool_ub_create()
566 dBuf->requestedSize = size; in ttm_pool_ub_create()
567 dBuf->kBuf.gpuOffset = arg.rep.gpu_offset; in ttm_pool_ub_create()
568 dBuf->mapHandle = arg.rep.map_handle; in ttm_pool_ub_create()
569 dBuf->realSize = arg.rep.bo_size; in ttm_pool_ub_create()
570 dBuf->kBuf.placement = arg.rep.placement; in ttm_pool_ub_create()
571 dBuf->kBuf.handle = arg.rep.handle; in ttm_pool_ub_create()
573 return &dBuf->buf; in ttm_pool_ub_create()
576 WSBM_COND_FREE(&dBuf->event); in ttm_pool_ub_create()
578 wsbmBufStorageTakedown(&dBuf->buf); in ttm_pool_ub_create()
580 free(dBuf); in ttm_pool_ub_create()