summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2014-05-20 11:09:57 -0700
committerKenneth Graunke <[email protected]>2014-07-02 12:45:58 -0700
commit44c63bdd401df9bd4095f4f081e5ab48c9044ce6 (patch)
tree1af379115acaa12ffc2071a26c6b01710fb6d8e9 /src/mesa/drivers
parentfea996c2aaf47707bd3f89ef493ae5760b4fe608 (diff)
i965: Reuse intel_upload.c for gen4/5 constant buffers.
No performance difference on glamor with copywinwin10 (n=40) on my gm45. Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/mesa/drivers')
-rw-r--r--src/mesa/drivers/dri/i965/brw_context.h6
-rw-r--r--src/mesa/drivers/dri/i965/brw_curbe.c31
-rw-r--r--src/mesa/drivers/dri/i965/intel_batchbuffer.c1
3 files changed, 7 insertions, 31 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h
index c68167f848a..f9e0c8c51d0 100644
--- a/src/mesa/drivers/dri/i965/brw_context.h
+++ b/src/mesa/drivers/dri/i965/brw_context.h
@@ -1227,11 +1227,13 @@ struct brw_context
GLuint vs_size;
GLuint total_size;
+ /**
+ * Pointer to the (intel_upload.c-generated) BO containing the uniforms
+ * for upload to the CURBE.
+ */
drm_intel_bo *curbe_bo;
/** Offset within curbe_bo of space for current curbe entry */
GLuint curbe_offset;
- /** Offset within curbe_bo of space for next curbe entry */
- GLuint curbe_next_offset;
/**
* Copy of the last set of CURBEs uploaded. Frequently we'll end up
diff --git a/src/mesa/drivers/dri/i965/brw_curbe.c b/src/mesa/drivers/dri/i965/brw_curbe.c
index e5ca2ce6b66..b776bdc8c8f 100644
--- a/src/mesa/drivers/dri/i965/brw_curbe.c
+++ b/src/mesa/drivers/dri/i965/brw_curbe.c
@@ -39,6 +39,7 @@
#include "program/prog_print.h"
#include "program/prog_statevars.h"
#include "intel_batchbuffer.h"
+#include "intel_buffer_objects.h"
#include "brw_context.h"
#include "brw_defines.h"
#include "brw_state.h"
@@ -264,34 +265,8 @@ brw_upload_constant_buffer(struct brw_context *brw)
memcpy(brw->curbe.last_buf, buf, bufsz);
brw->curbe.last_bufsz = bufsz;
- if (brw->curbe.curbe_bo != NULL &&
- brw->curbe.curbe_next_offset + bufsz > brw->curbe.curbe_bo->size)
- {
- drm_intel_gem_bo_unmap_gtt(brw->curbe.curbe_bo);
- drm_intel_bo_unreference(brw->curbe.curbe_bo);
- brw->curbe.curbe_bo = NULL;
- }
-
- if (brw->curbe.curbe_bo == NULL) {
- /* Allocate a single page for CURBE entries for this batchbuffer.
- * They're generally around 64b.
- */
- brw->curbe.curbe_bo = drm_intel_bo_alloc(brw->bufmgr, "CURBE",
- 4096, 1 << 6);
- brw->curbe.curbe_next_offset = 0;
- drm_intel_gem_bo_map_gtt(brw->curbe.curbe_bo);
- assert(bufsz < 4096);
- }
-
- brw->curbe.curbe_offset = brw->curbe.curbe_next_offset;
- brw->curbe.curbe_next_offset += bufsz;
- brw->curbe.curbe_next_offset = ALIGN(brw->curbe.curbe_next_offset, 64);
-
- /* Copy data to the buffer:
- */
- memcpy(brw->curbe.curbe_bo->virtual + brw->curbe.curbe_offset,
- buf,
- bufsz);
+ intel_upload_data(brw, buf, bufsz, 64,
+ &brw->curbe.curbe_bo, &brw->curbe.curbe_offset);
}
/* Because this provokes an action (ie copy the constants into the
diff --git a/src/mesa/drivers/dri/i965/intel_batchbuffer.c b/src/mesa/drivers/dri/i965/intel_batchbuffer.c
index 818ac61cd5d..cba81bce7e2 100644
--- a/src/mesa/drivers/dri/i965/intel_batchbuffer.c
+++ b/src/mesa/drivers/dri/i965/intel_batchbuffer.c
@@ -225,7 +225,6 @@ brw_finish_batch(struct brw_context *brw)
brw_perf_monitor_finish_batch(brw);
if (brw->curbe.curbe_bo) {
- drm_intel_gem_bo_unmap_gtt(brw->curbe.curbe_bo);
drm_intel_bo_unreference(brw->curbe.curbe_bo);
brw->curbe.curbe_bo = NULL;
}