[igt-dev] [PATCH i-g-t 05/12] chamelium: Make chamelium_calculate_fb_crc private

Maxime Ripard maxime.ripard at bootlin.com
Tue Apr 24 07:46:39 UTC 2018


The function chamelium_calculate_fb_crc has no user outside of
lib/igt_chamelium.c, but is still part of the global functions exposed in
lib/igt_chamelium.h.

Remove that.

Signed-off-by: Maxime Ripard <maxime.ripard at bootlin.com>
---
 lib/igt_chamelium.c | 146 ++++++++++++++++++++++-----------------------
 lib/igt_chamelium.h |   1 +-
 2 files changed, 73 insertions(+), 74 deletions(-)

diff --git a/lib/igt_chamelium.c b/lib/igt_chamelium.c
index b25855a41ceb..ce2f5d6e3bf5 100644
--- a/lib/igt_chamelium.c
+++ b/lib/igt_chamelium.c
@@ -1064,6 +1064,79 @@ void chamelium_assert_crc_eq_or_dump(struct chamelium *chamelium,
 	igt_assert(eq);
 }
 
+static uint32_t chamelium_xrgb_hash16(const unsigned char *buffer, int width,
+				      int height, int k, int m)
+{
+	unsigned char r, g, b;
+	uint64_t sum = 0;
+	uint64_t count = 0;
+	uint64_t value;
+	uint32_t hash;
+	int index;
+	int i;
+
+	for (i=0; i < width * height; i++) {
+		if ((i % m) != k)
+			continue;
+
+		index = i * 4;
+
+		r = buffer[index + 2];
+		g = buffer[index + 1];
+		b = buffer[index + 0];
+
+		value = r | (g << 8) | (b << 16);
+		sum += ++count * value;
+	}
+
+	hash = ((sum >> 0) ^ (sum >> 16) ^ (sum >> 32) ^ (sum >> 48)) & 0xffff;
+
+	return hash;
+}
+
+static void chamelium_do_calculate_fb_crc(cairo_surface_t *fb_surface,
+					  igt_crc_t *out)
+{
+	unsigned char *buffer;
+	int n = 4;
+	int w, h;
+	int i, j;
+
+	buffer = cairo_image_surface_get_data(fb_surface);
+	w = cairo_image_surface_get_width(fb_surface);
+	h = cairo_image_surface_get_height(fb_surface);
+
+	for (i = 0; i < n; i++) {
+		j = n - i - 1;
+		out->crc[i] = chamelium_xrgb_hash16(buffer, w, h, j, n);
+	}
+
+	out->n_words = n;
+}
+
+/**
+ * chamelium_calculate_fb_crc:
+ * @fd: The drm file descriptor
+ * @fb: The framebuffer to calculate the CRC for
+ *
+ * Calculates the CRC for the provided framebuffer, using the Chamelium's CRC
+ * algorithm. This calculates the CRC in a synchronous fashion.
+ *
+ * Returns: The calculated CRC
+ */
+static igt_crc_t *chamelium_calculate_fb_crc(int fd, struct igt_fb *fb)
+{
+	igt_crc_t *ret = calloc(1, sizeof(igt_crc_t));
+	cairo_surface_t *fb_surface;
+
+	/* Get the cairo surface for the framebuffer */
+	fb_surface = igt_get_cairo_surface(fd, fb);
+
+	chamelium_do_calculate_fb_crc(fb_surface, ret);
+
+	return ret;
+}
+
 /**
  * chamelium_assert_analog_frame_match_or_dump:
  * @chamelium: The chamelium instance the frame dump belongs to
@@ -1245,79 +1318,6 @@ int chamelium_get_frame_limit(struct chamelium *chamelium,
 	return ret;
 }
 
-static uint32_t chamelium_xrgb_hash16(const unsigned char *buffer, int width,
-				      int height, int k, int m)
-{
-	unsigned char r, g, b;
-	uint64_t sum = 0;
-	uint64_t count = 0;
-	uint64_t value;
-	uint32_t hash;
-	int index;
-	int i;
-
-	for (i=0; i < width * height; i++) {
-		if ((i % m) != k)
-			continue;
-
-		index = i * 4;
-
-		r = buffer[index + 2];
-		g = buffer[index + 1];
-		b = buffer[index + 0];
-
-		value = r | (g << 8) | (b << 16);
-		sum += ++count * value;
-	}
-
-	hash = ((sum >> 0) ^ (sum >> 16) ^ (sum >> 32) ^ (sum >> 48)) & 0xffff;
-
-	return hash;
-}
-
-static void chamelium_do_calculate_fb_crc(cairo_surface_t *fb_surface,
-					  igt_crc_t *out)
-{
-	unsigned char *buffer;
-	int n = 4;
-	int w, h;
-	int i, j;
-
-	buffer = cairo_image_surface_get_data(fb_surface);
-	w = cairo_image_surface_get_width(fb_surface);
-	h = cairo_image_surface_get_height(fb_surface);
-
-	for (i = 0; i < n; i++) {
-		j = n - i - 1;
-		out->crc[i] = chamelium_xrgb_hash16(buffer, w, h, j, n);
-	}
-
-	out->n_words = n;
-}
-
-/**
- * chamelium_calculate_fb_crc:
- * @fd: The drm file descriptor
- * @fb: The framebuffer to calculate the CRC for
- *
- * Calculates the CRC for the provided framebuffer, using the Chamelium's CRC
- * algorithm. This calculates the CRC in a synchronous fashion.
- *
- * Returns: The calculated CRC
- */
-igt_crc_t *chamelium_calculate_fb_crc(int fd, struct igt_fb *fb)
-{
-	igt_crc_t *ret = calloc(1, sizeof(igt_crc_t));
-	cairo_surface_t *fb_surface;
-
-	/* Get the cairo surface for the framebuffer */
-	fb_surface = igt_get_cairo_surface(fd, fb);
-
-	chamelium_do_calculate_fb_crc(fb_surface, ret);
-
-	return ret;
-}
-
 static void *chamelium_calculate_fb_crc_async_work(void *data)
 {
 	struct chamelium_fb_crc_async_data *fb_crc;
diff --git a/lib/igt_chamelium.h b/lib/igt_chamelium.h
index af9655a0b1cf..1a6ad9b93ee8 100644
--- a/lib/igt_chamelium.h
+++ b/lib/igt_chamelium.h
@@ -95,7 +95,6 @@ struct chamelium_frame_dump *chamelium_port_dump_pixels(struct chamelium *chamel
 							struct chamelium_port *port,
 							int x, int y,
 							int w, int h);
-igt_crc_t *chamelium_calculate_fb_crc(int fd, struct igt_fb *fb);
 struct chamelium_fb_crc_async_data *chamelium_calculate_fb_crc_async_start(int fd,
 									   struct igt_fb *fb);
 igt_crc_t *chamelium_calculate_fb_crc_async_finish(struct chamelium_fb_crc_async_data *fb_crc);
-- 
git-series 0.9.1


More information about the igt-dev mailing list