diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/gallium/winsys/drm/radeon/core/radeon_drm_buffer.c | 9 | ||||
-rw-r--r-- | src/gallium/winsys/drm/radeon/core/radeon_r300.c | 11 | ||||
-rw-r--r-- | src/gallium/winsys/drm/radeon/core/radeon_winsys.h | 2 |
3 files changed, 18 insertions, 4 deletions
diff --git a/src/gallium/winsys/drm/radeon/core/radeon_drm_buffer.c b/src/gallium/winsys/drm/radeon/core/radeon_drm_buffer.c index 2472b6bf952..1d29b0b727a 100644 --- a/src/gallium/winsys/drm/radeon/core/radeon_drm_buffer.c +++ b/src/gallium/winsys/drm/radeon/core/radeon_drm_buffer.c @@ -72,17 +72,20 @@ radeon_drm_buffer_map(struct pb_buffer *_buf, 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); } diff --git a/src/gallium/winsys/drm/radeon/core/radeon_r300.c b/src/gallium/winsys/drm/radeon/core/radeon_r300.c index 5b82a776a81..62d66d31dc1 100644 --- a/src/gallium/winsys/drm/radeon/core/radeon_r300.c +++ b/src/gallium/winsys/drm/radeon/core/radeon_r300.c @@ -44,6 +44,9 @@ radeon_r300_winsys_buffer_create(struct r300_winsys_screen *rws, 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); @@ -260,6 +263,7 @@ radeon_winsys_destroy(struct r300_winsys_screen *rws) 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); @@ -281,6 +285,10 @@ radeon_setup_winsys(int fd, struct radeon_libdrm_winsys* ws) 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; @@ -325,7 +333,8 @@ 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) diff --git a/src/gallium/winsys/drm/radeon/core/radeon_winsys.h b/src/gallium/winsys/drm/radeon/core/radeon_winsys.h index 16cc701ad6f..ad7b976abd2 100644 --- a/src/gallium/winsys/drm/radeon/core/radeon_winsys.h +++ b/src/gallium/winsys/drm/radeon/core/radeon_winsys.h @@ -38,6 +38,8 @@ struct radeon_libdrm_winsys { struct pb_manager *kman; + struct pb_manager *cman; + struct pb_manager *mman; /* PCI ID */ |