[igt-dev] [PATCH i-g-t] lib/rendercopy: Fix lack of const throughout gen4 rendercopy

Chris Wilson chris at chris-wilson.co.uk
Fri Jul 20 17:07:43 UTC 2018


The gen4 code was pushed without being fixed up for the constification
of igt_render_copyfunc_t

../lib/intel_batchbuffer.c: In function ‘igt_get_render_copyfunc’:
../lib/intel_batchbuffer.c:837:8: warning: assignment to ‘igt_render_copyfunc_t’ {aka ‘void (*)(struct intel_batchbuffer *, struct _drm_intel_context *, const struct igt_buf *, unsigned int,  unsigned int,  unsigned int,  unsigned int,  const struct igt_buf *, unsigned int,  unsigned int)’} from incompatible pointer type ‘void (*)(struct intel_batchbuffer *, drm_intel_context *, struct igt_buf *, unsigned int,  unsigned int,  unsigned int,  unsigned int,  struct igt_buf *, unsigned int,  unsigned int)’ {aka ‘void (*)(struct intel_batchbuffer *, struct _drm_intel_context *, struct igt_buf *, unsigned int,  unsigned int,  unsigned int,  unsigned int,  struct igt_buf *, unsigned int,  unsigned int)’} [-Wincompatible-pointer-types]
   copy = gen4_render_copyfunc;

Fixes: 61370b2d43db ("lib/rendercopy: Add gen4/5 rendercopy")
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
---
 lib/rendercopy.h      |  4 ++--
 lib/rendercopy_gen4.c | 14 ++++++++------
 2 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/lib/rendercopy.h b/lib/rendercopy.h
index 2eb67b21a..d1bb6284e 100644
--- a/lib/rendercopy.h
+++ b/lib/rendercopy.h
@@ -45,9 +45,9 @@ void gen6_render_copyfunc(struct intel_batchbuffer *batch,
 			  const struct igt_buf *dst, unsigned dst_x, unsigned dst_y);
 void gen4_render_copyfunc(struct intel_batchbuffer *batch,
 			  drm_intel_context *context,
-			  struct igt_buf *src, unsigned src_x, unsigned src_y,
+			  const struct igt_buf *src, unsigned src_x, unsigned src_y,
 			  unsigned width, unsigned height,
-			  struct igt_buf *dst, unsigned dst_x, unsigned dst_y);
+			  const struct igt_buf *dst, unsigned dst_x, unsigned dst_y);
 void gen3_render_copyfunc(struct intel_batchbuffer *batch,
 			  drm_intel_context *context,
 			  const struct igt_buf *src, unsigned src_x, unsigned src_y,
diff --git a/lib/rendercopy_gen4.c b/lib/rendercopy_gen4.c
index 5cf150ec5..0416b8d6d 100644
--- a/lib/rendercopy_gen4.c
+++ b/lib/rendercopy_gen4.c
@@ -135,7 +135,7 @@ gen4_render_flush(struct intel_batchbuffer *batch,
 
 static uint32_t
 gen4_bind_buf(struct intel_batchbuffer *batch,
-	      struct igt_buf *buf,
+	      const struct igt_buf *buf,
 	      uint32_t format, int is_dst)
 {
 	struct gen4_surface_state *ss;
@@ -175,8 +175,8 @@ gen4_bind_buf(struct intel_batchbuffer *batch,
 
 static uint32_t
 gen4_bind_surfaces(struct intel_batchbuffer *batch,
-		   struct igt_buf *src,
-		   struct igt_buf *dst)
+		   const struct igt_buf *src,
+		   const struct igt_buf *dst)
 {
 	uint32_t *binding_table;
 
@@ -415,7 +415,7 @@ gen4_emit_binding_table(struct intel_batchbuffer *batch,
 
 static void
 gen4_emit_drawing_rectangle(struct intel_batchbuffer *batch,
-			    struct igt_buf *dst)
+			    const struct igt_buf *dst)
 {
 	OUT_BATCH(GEN4_3DSTATE_DRAWING_RECTANGLE | (4 - 2));
 	OUT_BATCH(0);
@@ -638,9 +638,11 @@ static uint32_t gen4_emit_primitive(struct intel_batchbuffer *batch)
 
 void gen4_render_copyfunc(struct intel_batchbuffer *batch,
 			  drm_intel_context *context,
-			  struct igt_buf *src, unsigned src_x, unsigned src_y,
+			  const struct igt_buf *src,
+			  unsigned src_x, unsigned src_y,
 			  unsigned width, unsigned height,
-			  struct igt_buf *dst, unsigned dst_x, unsigned dst_y)
+			  const struct igt_buf *dst,
+			  unsigned dst_x, unsigned dst_y)
 {
 	uint32_t cc, cc_vp;
 	uint32_t wm, wm_sampler, wm_kernel, wm_table;
-- 
2.18.0



More information about the igt-dev mailing list