[Intel-gfx] [PATCH i-g-t 1/3] gem_render_copy: Make render_copyfunc more generic

Antti Koskipaa antti.koskipaa at linux.intel.com
Mon Oct 5 04:42:23 PDT 2015


This will allow adding more tests that use this function without excessive
copying and pasting.

Signed-off-by: Antti Koskipaa <antti.koskipaa at linux.intel.com>
---
 lib/rendercopy_gen8.c | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)

diff --git a/lib/rendercopy_gen8.c b/lib/rendercopy_gen8.c
index a7fc2c4..4a9a283 100644
--- a/lib/rendercopy_gen8.c
+++ b/lib/rendercopy_gen8.c
@@ -49,7 +49,7 @@ struct {
 } viewport;
 
 /* see shaders/ps/blit.g7a */
-static const uint32_t ps_kernel[][4] = {
+static const uint32_t ps_kernel_copy[][4] = {
 #if 1
    { 0x0060005a, 0x21403ae8, 0x3a0000c0, 0x008d0040 },
    { 0x0060005a, 0x21603ae8, 0x3a0000c0, 0x008d0080 },
@@ -920,11 +920,12 @@ 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,
+static void _gen8_render_func(struct intel_batchbuffer *batch,
 			  drm_intel_context *context,
 			  struct igt_buf *src, unsigned src_x, unsigned src_y,
 			  unsigned width, unsigned height,
-			  struct igt_buf *dst, unsigned dst_x, unsigned dst_y)
+			  struct igt_buf *dst, unsigned dst_x, unsigned dst_y,
+			  const uint32_t ps_kernel[][4], int kernel_size)
 {
 	struct annotations_context aub_annotations;
 	uint32_t ps_sampler_state, ps_kernel_off, ps_binding_table;
@@ -944,7 +945,7 @@ void gen8_render_copyfunc(struct intel_batchbuffer *batch,
 					       src, dst);
 	ps_sampler_state  = gen8_create_sampler(batch, &aub_annotations);
 	ps_kernel_off = gen8_fill_ps(batch, &aub_annotations,
-				     ps_kernel, sizeof(ps_kernel));
+				     ps_kernel, kernel_size);
 	vertex_buffer = gen7_fill_vertex_buffer_data(batch, &aub_annotations,
 						     src,
 						     src_x, src_y,
@@ -1030,3 +1031,13 @@ void gen8_render_copyfunc(struct intel_batchbuffer *batch,
 	gen6_render_flush(batch, context, batch_end);
 	intel_batchbuffer_reset(batch);
 }
+
+void gen8_render_copyfunc(struct intel_batchbuffer *batch,
+				 drm_intel_context *context,
+				 struct igt_buf *src, unsigned src_x, unsigned src_y,
+				 unsigned width, unsigned height,
+				 struct igt_buf *dst, unsigned dst_x, unsigned dst_y)
+{
+	_gen8_render_func(batch, context, src, src_x, src_y, width, height,
+			  dst, dst_x, dst_y, ps_kernel_copy, sizeof(ps_kernel_copy));
+}
-- 
2.3.6



More information about the Intel-gfx mailing list