summaryrefslogtreecommitdiff
path: root/src/mesa/drivers/dri/i965/brw_state_pool.c
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2007-12-07 16:15:49 -0800
committerEric Anholt <eric@anholt.net>2007-12-07 16:19:10 -0800
commite3a6e60040b7f6ea7965e52f8f9881ed31e0347c (patch)
tree6fadf576b904bb479936a355ed716ca305556848 /src/mesa/drivers/dri/i965/brw_state_pool.c
parent3ecdae82d751f9f404d10332f030e3280949ce4e (diff)
[965] Convert the driver to dri_bufmgr interface and enable TTM.
This is currently believed to work but be a significant performance loss. Performance recovery should be soon to follow. The dri_bo_fake_disable_backing_store() call was added to allow backing store disable like bufmgr_fake.c did, which is a significant performance win (though it's missing the no-fence-subdata part). This commit is a squash merge of the 965-ttm branch, which had some history I wanted to avoid pulling due to noisiness and brokenness at many points for git-bisecting.
Diffstat (limited to 'src/mesa/drivers/dri/i965/brw_state_pool.c')
-rw-r--r--src/mesa/drivers/dri/i965/brw_state_pool.c49
1 files changed, 20 insertions, 29 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_state_pool.c b/src/mesa/drivers/dri/i965/brw_state_pool.c
index eda92a2fa8..0fc3a1a871 100644
--- a/src/mesa/drivers/dri/i965/brw_state_pool.c
+++ b/src/mesa/drivers/dri/i965/brw_state_pool.c
@@ -34,7 +34,7 @@
#include "imports.h"
#include "intel_ioctl.h"
-#include "bufmgr.h"
+#include "dri_bufmgr.h"
GLboolean brw_pool_alloc( struct brw_mem_pool *pool,
GLuint size,
@@ -64,28 +64,21 @@ void brw_invalidate_pool( struct intel_context *intel,
{
if (INTEL_DEBUG & DEBUG_STATE)
_mesa_printf("\n\n\n %s \n\n\n", __FUNCTION__);
-
- bmBufferData(intel,
- pool->buffer,
- pool->size,
- NULL,
- 0);
pool->offset = 0;
brw_clear_all_caches(pool->brw);
}
-static void brw_invalidate_pool_cb( struct intel_context *intel, void *ptr )
+static void
+brw_invalidate_pool_cb(dri_bo *bo, void *ptr)
{
- struct brw_mem_pool *pool = (struct brw_mem_pool *) ptr;
+ struct brw_mem_pool *pool = ptr;
+ struct brw_context *brw = pool->brw;
- pool->offset = 0;
- brw_clear_all_caches(pool->brw);
+ brw_invalidate_pool(&brw->intel, pool);
}
-
-
static void brw_init_pool( struct brw_context *brw,
GLuint pool_id,
GLuint size )
@@ -94,30 +87,28 @@ static void brw_init_pool( struct brw_context *brw,
pool->size = size;
pool->brw = brw;
-
- bmGenBuffers(&brw->intel, "pool", 1, &pool->buffer, 12);
- /* Also want to say not to wait on fences when data is presented
- */
- bmBufferSetInvalidateCB(&brw->intel, pool->buffer,
- brw_invalidate_pool_cb,
- pool,
- GL_TRUE);
-
- bmBufferData(&brw->intel,
- pool->buffer,
- pool->size,
- NULL,
- 0);
+ pool->buffer = dri_bo_alloc(brw->intel.intelScreen->bufmgr,
+ (pool_id == BRW_GS_POOL) ? "GS pool" : "SS pool",
+ size, 4096, DRM_BO_FLAG_MEM_TT);
+ /* Disable the backing store for the state cache. It's not worth the
+ * cost of keeping a backing store copy, since we can just regenerate
+ * the contents at approximately the same cost as the memcpy, and only
+ * if the contents are lost.
+ */
+ if (!brw->intel.intelScreen->ttm) {
+ dri_bo_fake_disable_backing_store(pool->buffer, brw_invalidate_pool_cb,
+ pool);
+ }
}
static void brw_destroy_pool( struct brw_context *brw,
GLuint pool_id )
{
struct brw_mem_pool *pool = &brw->pool[pool_id];
-
- bmDeleteBuffers(&brw->intel, 1, &pool->buffer);
+
+ dri_bo_unreference(pool->buffer);
}