struct radeon_drm_buffer *buf = radeon_drm_buffer(_buf);
int write;
+ if (flags & PIPE_BUFFER_USAGE_DONTBLOCK) {
+ if (radeon_bo_is_referenced_by_cs(buf->bo, buf->mgr->rws->cs))
+ return NULL;
+ }
+
if (buf->bo->ptr != NULL)
return buf->bo->ptr;
-
+
if (flags & PIPE_BUFFER_USAGE_DONTBLOCK) {
uint32_t domain;
-
if (radeon_bo_is_busy(buf->bo, &domain))
return NULL;
}
-
if (radeon_bo_is_referenced_by_cs(buf->bo, buf->mgr->rws->cs)) {
buf->mgr->rws->flush_cb(buf->mgr->rws->flush_data);
}
if (usage & PIPE_BUFFER_USAGE_CONSTANT)
provider = ws->mman;
+ else if ((usage & PIPE_BUFFER_USAGE_VERTEX) ||
+ (usage & PIPE_BUFFER_USAGE_INDEX))
+ provider = ws->cman;
else
provider = ws->kman;
buffer = provider->create_buffer(provider, size, &desc);
struct radeon_libdrm_winsys *ws = (struct radeon_libdrm_winsys *)rws;
radeon_cs_destroy(ws->cs);
+ ws->cman->destroy(ws->cman);
ws->kman->destroy(ws->kman);
ws->mman->destroy(ws->mman);
if (!ws->kman)
goto fail;
+ ws->cman = pb_cache_manager_create(ws->kman, 100000);
+ if (!ws->cman)
+ goto fail;
+
ws->mman = pb_malloc_bufmgr_create();
if (!ws->mman)
goto fail;
if (ws->bom)
radeon_bo_manager_gem_dtor(ws->bom);
-
+ if (ws->cman)
+ ws->cman->destroy(ws->cman);
if (ws->kman)
ws->kman->destroy(ws->kman);
if (ws->mman)