summaryrefslogtreecommitdiff
path: root/lib/igt_fb.h
diff options
context:
space:
mode:
authorBrian Starkey <rodrigosiqueiramelo@gmail.com>2020-08-30 13:44:09 -0400
committerPetri Latvala <petri.latvala@intel.com>2020-09-04 14:51:17 +0300
commitfa23d371fb3899408dc2cfdb4ccc4474e7f8eee8 (patch)
tree732b8b132f47711168939119f897b850bd6e25d7 /lib/igt_fb.h
parent150948b9fdac87135b04f767bfa0617ff0bb1f84 (diff)
lib: Add function to hash a framebuffer
To use writeback buffers as a CRC source, we need to be able to hash them. Implement a simple FVA-1a hashing routine for this purpose. Doing a bytewise hash on the framebuffer directly can be very slow if the memory is noncached. By making a copy of each line in the FB first (which can take advantage of word-access speedup), we can do the hash on a cached copy, which is much faster (10x speedup on my platform). Changes since V7 (Maxime Ripard): * Maxime Ripard: - Replace `gem_mmap__gtt` by `igt_fb_map_buffer` on `igt_fb_get_crc()` * Rodrigo Siqueira: - Rename igt_fb_get_crc to igt_fb_get_fnv1a_crc Changes since V6 (Simon Ser): * Use plain uint32_t for FNV1a_OFFSET_BIAS and FNV1a_PRIME * Return -EINVAL in case fb->num_planes != 1 * Just copy fb->width * cpp instead of copy the whole stride v5: use igt_memcpy_from_wc() instead of plain memcpy, as suggested by Chris Wilson Signed-off-by: Brian Starkey <brian.starkey@arm.com> [rebased and updated to the most recent API] Signed-off-by: Liviu Dudau <liviu.dudau@arm.com> [rebased and updated] Signed-off-by: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com> Reviewed-by: Simon Ser <simon.ser@intel.com> Reviewed-by: Liviu Dudau <liviu.dudau@arm.com>
Diffstat (limited to 'lib/igt_fb.h')
-rw-r--r--lib/igt_fb.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/igt_fb.h b/lib/igt_fb.h
index 5ec906b7..debfb5ad 100644
--- a/lib/igt_fb.h
+++ b/lib/igt_fb.h
@@ -207,5 +207,7 @@ int igt_format_plane_bpp(uint32_t drm_format, int plane);
void igt_format_array_fill(uint32_t **formats_array, unsigned int *count,
bool allow_yuv);
+int igt_fb_get_fnv1a_crc(struct igt_fb *fb, igt_crc_t *crc);
+
#endif /* __IGT_FB_H__ */