diff options
Diffstat (limited to 'src/sna/sna_stream.c')
-rw-r--r-- | src/sna/sna_stream.c | 38 |
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); +} |