[igt-dev] [PATCH i-g-t 1/2] lib: Refactor common store code into helper function

Dixit, Ashutosh ashutosh.dixit at intel.com
Tue Nov 30 23:18:37 UTC 2021


On Sat, 27 Nov 2021 23:08:22 -0800, <priyanka.dandamudi at intel.com> wrote:
>
> From: John Harrison <John.C.Harrison at Intel.com>
>
> A lot of tests use almost identical code for creating a batch buffer
> which does a single write to memory. This patch collects three such
> instances into a common helper function.

Here we are submitting just a single instance so maybe change the commit
message to something like:

"A lot of tests use almost identical code for creating a batch buffer which
does a single write to memory. Create a common helper function for doing
this. It is possible that other uses for store dword are all subtly
different enough to make it not so trivial to try to use the helper. This
patch proves the concept, if people like it enough then it can be extended".

@Zbigniew: Another issue is that igt_store_word() lacks softpin
(no-relocation) support (dGfx doesn't have relocations). Do you think we
can add the no-reloc support after we merge? (In CI, DG1 which doesn't have
relocations is only in BAT, not in shards, so the tests which use this
function will not break after we merge). Thanks.

> diff --git a/lib/igt_store.c b/lib/igt_store.c
> new file mode 100644
> index 00000000..dc4d466a
> --- /dev/null
> +++ b/lib/igt_store.c
> @@ -0,0 +1,103 @@
> +/*
> + * Copyright © 2020 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.
> + *
> + */

Please use the SPDX header here. See e.g. intel_ctx.c.

> diff --git a/lib/igt_store.h b/lib/igt_store.h
> new file mode 100644
> index 00000000..709d87e3
> --- /dev/null
> +++ b/lib/igt_store.h
> @@ -0,0 +1,30 @@
> +/*
> + * Copyright © 2020 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.
> + *
> + */

Here too, please use the SPDX header. See intel_ctx.h (.c and .h SPDX
header is different).

Please make these changes and resubmit. We can handle the no-reloc case
later if Zbigniew agrees. Thanks.


More information about the igt-dev mailing list