summaryrefslogtreecommitdiff
path: root/src/sna/sna_stream.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2012-07-29 09:50:39 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2012-07-30 13:12:04 +0100
commit7c9dbc980b760e0053d83ca2d7cb147613285680 (patch)
tree7c1f85208d7b10a009282387bc95a9bf0b197e77 /src/sna/sna_stream.c
parent8ebafa0493c0fa08ab9d80eeb1191b7560dc0863 (diff)
sna: Assemble SF and WM kernels using brw
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src/sna/sna_stream.c')
-rw-r--r--src/sna/sna_stream.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/sna/sna_stream.c b/src/sna/sna_stream.c
index aab15498..66a8c461 100644
--- a/src/sna/sna_stream.c
+++ b/src/sna/sna_stream.c
@@ -27,6 +27,7 @@
#include "sna.h"
#include "sna_render.h"
+#include "brw/brw.h"
int sna_static_stream_init(struct sna_static_stream *stream)
{
@@ -92,3 +93,40 @@ struct kgem_bo *sna_static_stream_fini(struct sna *sna,
return bo;
}
+
+unsigned
+sna_static_stream_compile_sf(struct sna *sna,
+ struct sna_static_stream *stream,
+ void (*compile)(struct brw_compile *))
+{
+ struct brw_compile p;
+
+ brw_compile_init(&p, sna->kgem.gen,
+ sna_static_stream_map(stream,
+ 64*sizeof(uint32_t), 64));
+
+ compile(&p);
+ assert(p.nr_insn*sizeof(struct brw_instruction) <= 64*sizeof(uint32_t));
+
+ stream->used -= 64*sizeof(uint32_t) - p.nr_insn*sizeof(struct brw_instruction);
+ return sna_static_stream_offsetof(stream, p.store);
+}
+
+unsigned
+sna_static_stream_compile_wm(struct sna *sna,
+ struct sna_static_stream *stream,
+ void (*compile)(struct brw_compile *, int),
+ int dispatch_width)
+{
+ struct brw_compile p;
+
+ brw_compile_init(&p, sna->kgem.gen,
+ sna_static_stream_map(stream,
+ 256*sizeof(uint32_t), 64));
+
+ compile(&p, dispatch_width);
+ assert(p.nr_insn*sizeof(struct brw_instruction) <= 256*sizeof(uint32_t));
+
+ stream->used -= 256*sizeof(uint32_t) - p.nr_insn*sizeof(struct brw_instruction);
+ return sna_static_stream_offsetof(stream, p.store);
+}