From 725da6ee7458c5227a2bc9a1b686dad8f3c6d854 Mon Sep 17 00:00:00 2001 From: Ville Syrjälä Date: Thu, 21 Nov 2013 19:05:17 +0200 Subject: rendercopy: Pass context to rendercopy functions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit rendercopy does the batch buffer flush internally, so if we want to use it with multiple contexts, we need to pass the context in from caller. v2: Modify rendercopy_gen8 as well Signed-off-by: Ville Syrjälä --- lib/rendercopy.h | 6 ++++++ lib/rendercopy_gen6.c | 12 +++++++----- lib/rendercopy_gen7.c | 12 +++++++----- lib/rendercopy_gen8.c | 12 +++++++----- lib/rendercopy_i830.c | 1 + lib/rendercopy_i915.c | 1 + 6 files changed, 29 insertions(+), 15 deletions(-) (limited to 'lib') diff --git a/lib/rendercopy.h b/lib/rendercopy.h index f726df6f..6312cc32 100644 --- a/lib/rendercopy.h +++ b/lib/rendercopy.h @@ -62,6 +62,7 @@ static inline unsigned buf_height(struct scratch_buf *buf) } typedef void (*render_copyfunc_t)(struct intel_batchbuffer *batch, + drm_intel_context *context, struct scratch_buf *src, unsigned src_x, unsigned src_y, unsigned width, unsigned height, struct scratch_buf *dst, unsigned dst_x, unsigned dst_y); @@ -69,22 +70,27 @@ typedef void (*render_copyfunc_t)(struct intel_batchbuffer *batch, render_copyfunc_t get_render_copyfunc(int devid); void gen8_render_copyfunc(struct intel_batchbuffer *batch, + drm_intel_context *context, struct scratch_buf *src, unsigned src_x, unsigned src_y, unsigned width, unsigned height, struct scratch_buf *dst, unsigned dst_x, unsigned dst_y); void gen7_render_copyfunc(struct intel_batchbuffer *batch, + drm_intel_context *context, struct scratch_buf *src, unsigned src_x, unsigned src_y, unsigned width, unsigned height, struct scratch_buf *dst, unsigned dst_x, unsigned dst_y); void gen6_render_copyfunc(struct intel_batchbuffer *batch, + drm_intel_context *context, struct scratch_buf *src, unsigned src_x, unsigned src_y, unsigned width, unsigned height, struct scratch_buf *dst, unsigned dst_x, unsigned dst_y); void gen3_render_copyfunc(struct intel_batchbuffer *batch, + drm_intel_context *context, struct scratch_buf *src, unsigned src_x, unsigned src_y, unsigned width, unsigned height, struct scratch_buf *dst, unsigned dst_x, unsigned dst_y); void gen2_render_copyfunc(struct intel_batchbuffer *batch, + drm_intel_context *context, struct scratch_buf *src, unsigned src_x, unsigned src_y, unsigned width, unsigned height, struct scratch_buf *dst, unsigned dst_x, unsigned dst_y); diff --git a/lib/rendercopy_gen6.c b/lib/rendercopy_gen6.c index dafee88a..457cb354 100644 --- a/lib/rendercopy_gen6.c +++ b/lib/rendercopy_gen6.c @@ -78,14 +78,15 @@ batch_copy(struct intel_batchbuffer *batch, const void *ptr, uint32_t size, uint } static void -gen6_render_flush(struct intel_batchbuffer *batch, uint32_t batch_end) +gen6_render_flush(struct intel_batchbuffer *batch, + drm_intel_context *context, uint32_t batch_end) { int ret; ret = drm_intel_bo_subdata(batch->bo, 0, 4096, batch->buffer); if (ret == 0) - ret = drm_intel_bo_mrb_exec(batch->bo, batch_end, - NULL, 0, 0, 0); + ret = drm_intel_gem_bo_context_exec(batch->bo, context, + batch_end, 0); assert(ret == 0); } @@ -529,6 +530,7 @@ static uint32_t gen6_emit_primitive(struct intel_batchbuffer *batch) } void gen6_render_copyfunc(struct intel_batchbuffer *batch, + drm_intel_context *context, struct scratch_buf *src, unsigned src_x, unsigned src_y, unsigned width, unsigned height, struct scratch_buf *dst, unsigned dst_x, unsigned dst_y) @@ -537,7 +539,7 @@ void gen6_render_copyfunc(struct intel_batchbuffer *batch, uint32_t cc_vp, cc_blend, offset; uint32_t batch_end; - intel_batchbuffer_flush(batch); + intel_batchbuffer_flush_with_context(batch, context); batch->ptr = batch->buffer + 1024; batch_alloc(batch, 64, 64); @@ -594,6 +596,6 @@ void gen6_render_copyfunc(struct intel_batchbuffer *batch, emit_vertex_normalized(batch, src_x, buf_width(src)); emit_vertex_normalized(batch, src_y, buf_height(src)); - gen6_render_flush(batch, batch_end); + gen6_render_flush(batch, context, batch_end); intel_batchbuffer_reset(batch); } diff --git a/lib/rendercopy_gen7.c b/lib/rendercopy_gen7.c index fdf741ff..f6981c7d 100644 --- a/lib/rendercopy_gen7.c +++ b/lib/rendercopy_gen7.c @@ -52,14 +52,15 @@ batch_copy(struct intel_batchbuffer *batch, const void *ptr, uint32_t size, uint } static void -gen7_render_flush(struct intel_batchbuffer *batch, uint32_t batch_end) +gen7_render_flush(struct intel_batchbuffer *batch, + drm_intel_context *context, uint32_t batch_end) { int ret; ret = drm_intel_bo_subdata(batch->bo, 0, 4096, batch->buffer); if (ret == 0) - ret = drm_intel_bo_mrb_exec(batch->bo, batch_end, - NULL, 0, 0, 0); + ret = drm_intel_gem_bo_context_exec(batch->bo, context, + batch_end, 0); assert(ret == 0); } @@ -513,13 +514,14 @@ gen7_emit_null_depth_buffer(struct intel_batchbuffer *batch) #define BATCH_STATE_SPLIT 2048 void gen7_render_copyfunc(struct intel_batchbuffer *batch, + drm_intel_context *context, struct scratch_buf *src, unsigned src_x, unsigned src_y, unsigned width, unsigned height, struct scratch_buf *dst, unsigned dst_x, unsigned dst_y) { uint32_t batch_end; - intel_batchbuffer_flush(batch); + intel_batchbuffer_flush_with_context(batch, context); batch->state = &batch->buffer[BATCH_STATE_SPLIT]; @@ -563,6 +565,6 @@ void gen7_render_copyfunc(struct intel_batchbuffer *batch, batch_end = ALIGN(batch_end, 8); assert(batch_end < BATCH_STATE_SPLIT); - gen7_render_flush(batch, batch_end); + gen7_render_flush(batch, context, batch_end); intel_batchbuffer_reset(batch); } diff --git a/lib/rendercopy_gen8.c b/lib/rendercopy_gen8.c index 660ff030..70896760 100644 --- a/lib/rendercopy_gen8.c +++ b/lib/rendercopy_gen8.c @@ -147,14 +147,15 @@ batch_copy(struct intel_batchbuffer *batch, const void *ptr, uint32_t size, uint } static void -gen6_render_flush(struct intel_batchbuffer *batch, uint32_t batch_end) +gen6_render_flush(struct intel_batchbuffer *batch, + drm_intel_context *context, uint32_t batch_end) { int ret; ret = drm_intel_bo_subdata(batch->bo, 0, 4096, batch->buffer); if (ret == 0) - ret = drm_intel_bo_mrb_exec(batch->bo, batch_end, - NULL, 0, 0, 0); + ret = drm_intel_gem_bo_context_exec(batch->bo, context, + batch_end, 0); assert(ret == 0); } @@ -848,6 +849,7 @@ static void gen8_emit_primitive(struct intel_batchbuffer *batch, uint32_t offset #define BATCH_STATE_SPLIT 2048 void gen8_render_copyfunc(struct intel_batchbuffer *batch, + drm_intel_context *context, struct scratch_buf *src, unsigned src_x, unsigned src_y, unsigned width, unsigned height, struct scratch_buf *dst, unsigned dst_x, unsigned dst_y) @@ -857,7 +859,7 @@ void gen8_render_copyfunc(struct intel_batchbuffer *batch, uint32_t vertex_buffer; uint32_t batch_end; - intel_batchbuffer_flush(batch); + intel_batchbuffer_flush_with_context(batch, context); batch_align(batch, 8); @@ -947,6 +949,6 @@ void gen8_render_copyfunc(struct intel_batchbuffer *batch, annotation_flush(&aub_annotations, batch); - gen6_render_flush(batch, batch_end); + gen6_render_flush(batch, context, batch_end); intel_batchbuffer_reset(batch); } diff --git a/lib/rendercopy_i830.c b/lib/rendercopy_i830.c index 0347597f..73edcfa5 100644 --- a/lib/rendercopy_i830.c +++ b/lib/rendercopy_i830.c @@ -191,6 +191,7 @@ static void gen2_emit_copy_pipeline(struct intel_batchbuffer *batch) } void gen2_render_copyfunc(struct intel_batchbuffer *batch, + drm_intel_context *context, struct scratch_buf *src, unsigned src_x, unsigned src_y, unsigned width, unsigned height, struct scratch_buf *dst, unsigned dst_x, unsigned dst_y) diff --git a/lib/rendercopy_i915.c b/lib/rendercopy_i915.c index 4b15dfe3..33e027e0 100644 --- a/lib/rendercopy_i915.c +++ b/lib/rendercopy_i915.c @@ -3,6 +3,7 @@ #include "rendercopy.h" void gen3_render_copyfunc(struct intel_batchbuffer *batch, + drm_intel_context *context, struct scratch_buf *src, unsigned src_x, unsigned src_y, unsigned width, unsigned height, struct scratch_buf *dst, unsigned dst_x, unsigned dst_y) -- cgit v1.2.3