summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Airlie <[email protected]>2010-03-21 18:25:31 +1000
committerDave Airlie <[email protected]>2010-03-21 19:39:28 +1000
commitff1c7baad241dd722341023806e00a07606de206 (patch)
treec28ddc5c0fe705546ffa6ae3c29922a2a72e2272
parent0dab3189e1d100a9a2487f7aff45589b423c386c (diff)
r300g: add bufmgr cached for vertex/index buffers.
This adds the cached bufmgr for vertex/index buffers on top of the kernel manager. Signed-off-by: Dave Airlie <[email protected]>
-rw-r--r--src/gallium/winsys/drm/radeon/core/radeon_drm_buffer.c9
-rw-r--r--src/gallium/winsys/drm/radeon/core/radeon_r300.c11
-rw-r--r--src/gallium/winsys/drm/radeon/core/radeon_winsys.h2
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 */