Re: [Intel-gfx] [PATCH i-g-t 1/7] igt: lib/igt_crc: Split out CRC functionality
On Mon, Jul 17, 2017 at 04:50:27PM +0300, Arkadiusz Hiler wrote: > On Thu, Jul 06, 2017 at 05:14:18PM +0100, Liviu Dudau wrote: > > From: Brian Starkey> > > > Separate out the CRC code for better compartmentalisation. Should ease > > the addition of more/different CRC sources in the future. > > > > Signed-off-by: Brian Starkey > > Signed-off-by: Liviu Dudau > > > > --- > > lib/Makefile.sources | 2 + > > lib/igt_chamelium.h | 1 + > > lib/igt_crc.c | 563 > > ++ > > lib/igt_crc.h | 125 + > > lib/igt_debugfs.c | 547 > > > > lib/igt_debugfs.h | 81 -- > > tests/chamelium.c | 1 + > > tests/kms_atomic_transition.c | 1 + > > tests/kms_ccs.c | 1 + > > tests/kms_chv_cursor_fail.c | 1 + > > tests/kms_crtc_background_color.c | 1 + > > tests/kms_cursor_crc.c| 1 + > > tests/kms_cursor_legacy.c | 1 + > > tests/kms_draw_crc.c | 1 + > > tests/kms_fbc_crc.c | 1 + > > tests/kms_flip_tiling.c | 1 + > > tests/kms_frontbuffer_tracking.c | 1 + > > tests/kms_mmap_write_crc.c| 1 + > > tests/kms_mmio_vs_cs_flip.c | 1 + > > tests/kms_pipe_color.c| 1 + > > tests/kms_pipe_crc_basic.c| 1 + > > tests/kms_plane.c | 1 + > > tests/kms_plane_lowres.c | 1 + > > tests/kms_plane_multiple.c| 1 + > > tests/kms_plane_scaling.c | 1 + > > tests/kms_pwrite_crc.c| 1 + > > tests/kms_rotation_crc.c | 1 + > > tests/kms_universal_plane.c | 1 + > > tools/intel_display_crc.c | 1 + > > 29 files changed, 714 insertions(+), 628 deletions(-) > > create mode 100644 lib/igt_crc.c > > create mode 100644 lib/igt_crc.h > > > > diff --git a/lib/Makefile.sources b/lib/Makefile.sources > > index 53fdb54c..cfba15c9 100644 > > --- a/lib/Makefile.sources > > +++ b/lib/Makefile.sources > > @@ -11,6 +11,8 @@ lib_source_list = \ > > igt_debugfs.h \ > > igt_aux.c \ > > igt_aux.h \ > > + igt_crc.c \ > > + igt_crc.h \ > > igt_edid_template.h \ > > igt_gt.c\ > > igt_gt.h\ > > diff --git a/lib/igt_chamelium.h b/lib/igt_chamelium.h > > index 81322ad2..ea5abc2e 100644 > > --- a/lib/igt_chamelium.h > > +++ b/lib/igt_chamelium.h > > @@ -31,6 +31,7 @@ > > #endif > > > > #include "igt.h" > > +#include "igt_crc.h" > > #include > > > > struct chamelium; > > diff --git a/lib/igt_crc.c b/lib/igt_crc.c > > new file mode 100644 > > index ..91a0b5a8 > > --- /dev/null > > +++ b/lib/igt_crc.c > > @@ -0,0 +1,563 @@ > > +/* > > + * Copyright © 2013 Intel Corporation > > + * > > + * Permission is hereby granted, free of charge, to any person obtaining a > > + * copy of this software and associated documentation files (the > > "Software"), > > + * to deal in the Software without restriction, including without > > limitation > > + * the rights to use, copy, modify, merge, publish, distribute, sublicense, > > + * and/or sell copies of the Software, and to permit persons to whom the > > + * Software is furnished to do so, subject to the following conditions: > > + * > > + * The above copyright notice and this permission notice (including the > > next > > + * paragraph) shall be included in all copies or substantial portions of > > the > > + * Software. > > + * > > + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS > > OR > > + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, > > + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL > > + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR > > OTHER > > + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING > > + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER > > DEALINGS > > + * IN THE SOFTWARE. > > + * > > + */ > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > + > > +#include "igt_aux.h" > > +#include "igt_crc.h" > > +#include "igt_core.h" > > +#include "igt_debugfs.h" > > +#include "igt_kms.h" > > + > > +/** > > + * igt_assert_crc_equal: > > + * @a: first pipe CRC value > > + * @b: second pipe CRC value > > + * > > + * Compares two CRC values and fails the testcase if they don't match with > > + * igt_fail(). Note that due to CRC collisions CRC based testcase can only > > + * assert that CRCs match, never that they are different. Otherwise there > > might > > + * be random testcase failures when different screen contents end up with >
Re: [Intel-gfx] [PATCH i-g-t 1/7] igt: lib/igt_crc: Split out CRC functionality
On Thu, Jul 06, 2017 at 05:14:18PM +0100, Liviu Dudau wrote: > From: Brian Starkey> > Separate out the CRC code for better compartmentalisation. Should ease > the addition of more/different CRC sources in the future. > > Signed-off-by: Brian Starkey > Signed-off-by: Liviu Dudau > > --- > lib/Makefile.sources | 2 + > lib/igt_chamelium.h | 1 + > lib/igt_crc.c | 563 > ++ > lib/igt_crc.h | 125 + > lib/igt_debugfs.c | 547 > lib/igt_debugfs.h | 81 -- > tests/chamelium.c | 1 + > tests/kms_atomic_transition.c | 1 + > tests/kms_ccs.c | 1 + > tests/kms_chv_cursor_fail.c | 1 + > tests/kms_crtc_background_color.c | 1 + > tests/kms_cursor_crc.c| 1 + > tests/kms_cursor_legacy.c | 1 + > tests/kms_draw_crc.c | 1 + > tests/kms_fbc_crc.c | 1 + > tests/kms_flip_tiling.c | 1 + > tests/kms_frontbuffer_tracking.c | 1 + > tests/kms_mmap_write_crc.c| 1 + > tests/kms_mmio_vs_cs_flip.c | 1 + > tests/kms_pipe_color.c| 1 + > tests/kms_pipe_crc_basic.c| 1 + > tests/kms_plane.c | 1 + > tests/kms_plane_lowres.c | 1 + > tests/kms_plane_multiple.c| 1 + > tests/kms_plane_scaling.c | 1 + > tests/kms_pwrite_crc.c| 1 + > tests/kms_rotation_crc.c | 1 + > tests/kms_universal_plane.c | 1 + > tools/intel_display_crc.c | 1 + > 29 files changed, 714 insertions(+), 628 deletions(-) > create mode 100644 lib/igt_crc.c > create mode 100644 lib/igt_crc.h > > diff --git a/lib/Makefile.sources b/lib/Makefile.sources > index 53fdb54c..cfba15c9 100644 > --- a/lib/Makefile.sources > +++ b/lib/Makefile.sources > @@ -11,6 +11,8 @@ lib_source_list = \ > igt_debugfs.h \ > igt_aux.c \ > igt_aux.h \ > + igt_crc.c \ > + igt_crc.h \ > igt_edid_template.h \ > igt_gt.c\ > igt_gt.h\ > diff --git a/lib/igt_chamelium.h b/lib/igt_chamelium.h > index 81322ad2..ea5abc2e 100644 > --- a/lib/igt_chamelium.h > +++ b/lib/igt_chamelium.h > @@ -31,6 +31,7 @@ > #endif > > #include "igt.h" > +#include "igt_crc.h" > #include > > struct chamelium; > diff --git a/lib/igt_crc.c b/lib/igt_crc.c > new file mode 100644 > index ..91a0b5a8 > --- /dev/null > +++ b/lib/igt_crc.c > @@ -0,0 +1,563 @@ > +/* > + * Copyright © 2013 Intel Corporation > + * > + * Permission is hereby granted, free of charge, to any person obtaining a > + * copy of this software and associated documentation files (the "Software"), > + * to deal in the Software without restriction, including without limitation > + * the rights to use, copy, modify, merge, publish, distribute, sublicense, > + * and/or sell copies of the Software, and to permit persons to whom the > + * Software is furnished to do so, subject to the following conditions: > + * > + * The above copyright notice and this permission notice (including the next > + * paragraph) shall be included in all copies or substantial portions of the > + * Software. > + * > + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR > + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, > + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL > + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER > + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING > + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER > DEALINGS > + * IN THE SOFTWARE. > + * > + */ > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > + > +#include "igt_aux.h" > +#include "igt_crc.h" > +#include "igt_core.h" > +#include "igt_debugfs.h" > +#include "igt_kms.h" > + > +/** > + * igt_assert_crc_equal: > + * @a: first pipe CRC value > + * @b: second pipe CRC value > + * > + * Compares two CRC values and fails the testcase if they don't match with > + * igt_fail(). Note that due to CRC collisions CRC based testcase can only > + * assert that CRCs match, never that they are different. Otherwise there > might > + * be random testcase failures when different screen contents end up with the > + * same CRC by chance. > + */ > +void igt_assert_crc_equal(const igt_crc_t *a, const igt_crc_t *b) > +{ > + int i; > + > + for (i = 0; i < a->n_words; i++) > + igt_assert_eq_u32(a->crc[i], b->crc[i]); > +} > + > +/** > + * igt_crc_to_string: > + * @crc: pipe CRC value to print > + * > + * This formats