summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2010-09-17 12:51:04 +1000
committerDave Airlie <airlied@redhat.com>2010-09-17 15:29:31 +1000
commit189a59751352208cb0386131f9ad82256ec9bed9 (patch)
treea1637cf7ad4aca4c5e7984e799dbfa349d20c8ee /src
parent7c1fcc41be15b6d648f84c8c1870a3a00575a48f (diff)
r600g: use malloc bufmgr for constant buffers
Diffstat (limited to 'src')
-rw-r--r--src/gallium/winsys/r600/drm/radeon.c7
-rw-r--r--src/gallium/winsys/r600/drm/radeon_priv.h1
-rw-r--r--src/gallium/winsys/r600/drm/radeon_ws_bo.c2
3 files changed, 9 insertions, 1 deletions
diff --git a/src/gallium/winsys/r600/drm/radeon.c b/src/gallium/winsys/r600/drm/radeon.c
index 2135b07ab6..7b88075c56 100644
--- a/src/gallium/winsys/r600/drm/radeon.c
+++ b/src/gallium/winsys/r600/drm/radeon.c
@@ -20,6 +20,7 @@
#include <unistd.h>
#include <string.h>
#include <errno.h>
+#include <pipebuffer/pb_bufmgr.h>
#include "xf86drm.h"
#include "radeon_priv.h"
#include "radeon_drm.h"
@@ -125,6 +126,10 @@ struct radeon *radeon_new(int fd, unsigned device)
__func__, radeon->device);
break;
}
+
+ radeon->mman = pb_malloc_bufmgr_create();
+ if (!radeon->mman)
+ return NULL;
return radeon;
}
@@ -143,6 +148,8 @@ struct radeon *radeon_decref(struct radeon *radeon)
if (--radeon->refcount > 0) {
return NULL;
}
+
+ radeon->mman->destroy(radeon->mman);
drmClose(radeon->fd);
free(radeon);
return NULL;
diff --git a/src/gallium/winsys/r600/drm/radeon_priv.h b/src/gallium/winsys/r600/drm/radeon_priv.h
index 49fe1a6ead..cb18d159a0 100644
--- a/src/gallium/winsys/r600/drm/radeon_priv.h
+++ b/src/gallium/winsys/r600/drm/radeon_priv.h
@@ -87,6 +87,7 @@ struct radeon {
struct radeon_stype_info *stype;
unsigned max_states;
boolean use_mem_constant; /* true for evergreen */
+ struct pb_manager *mman; /* malloc manager */
};
struct radeon_ws_bo {
diff --git a/src/gallium/winsys/r600/drm/radeon_ws_bo.c b/src/gallium/winsys/r600/drm/radeon_ws_bo.c
index 422e298a8d..09e379f837 100644
--- a/src/gallium/winsys/r600/drm/radeon_ws_bo.c
+++ b/src/gallium/winsys/r600/drm/radeon_ws_bo.c
@@ -12,7 +12,7 @@ struct radeon_ws_bo *radeon_ws_bo(struct radeon *radeon,
if (radeon->use_mem_constant && (usage & PIPE_BIND_CONSTANT_BUFFER)) {
desc.alignment = alignment;
desc.usage = usage;
- ws_bo->pb = pb_malloc_buffer_create(size, &desc);
+ ws_bo->pb = radeon->mman->create_buffer(radeon->mman, size, &desc);
if (ws_bo->pb == NULL) {
free(ws_bo);
return NULL;