Re: [PATCH libdrm 3/3] tests/etnaviv_2d_test: check whether the rendering is correct

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Am Di., 1. Dez. 2020 um 21:38 Uhr schrieb Lubomir Rintel <lkundrak@xxxxx>:
>
> Instead of always dumping the rendered picture, check whether it matches
> the expectations. This makes more sense for automated testing.
>
> Retain the ability to dump the picture instead of checking it when a
> file name is given as an argument. This also removes use of a hardcoded
> file name in a world writable directory, which is an unsafe thing to
> do anyway.
>
> Signed-off-by: Lubomir Rintel <lkundrak@xxxxx>

Reviewed-by: Christian Gmeiner <christian.gmeiner@xxxxxxxxx>

> ---
>  tests/etnaviv/etnaviv_2d_test.c | 29 +++++++++++++++++++++++++++--
>  1 file changed, 27 insertions(+), 2 deletions(-)
>
> diff --git a/tests/etnaviv/etnaviv_2d_test.c b/tests/etnaviv/etnaviv_2d_test.c
> index a75a4a89..9fcdae18 100644
> --- a/tests/etnaviv/etnaviv_2d_test.c
> +++ b/tests/etnaviv/etnaviv_2d_test.c
> @@ -147,6 +147,27 @@ static void gen_cmd_stream(struct etna_cmd_stream *stream, struct etna_bo *bmp,
>         etna_set_state(stream, VIVS_GL_FLUSH_CACHE, VIVS_GL_FLUSH_CACHE_PE2D);
>  }
>
> +int etna_check_image(uint32_t *p, int width, int height)
> +{
> +       int i;
> +       uint32_t expected;
> +
> +       for (i = 0; i < width * height; i++) {
> +               if (i%8 < 4 && i%(width*8) < width*4 && i%width < 8*16 && i < width*8*16)
> +                       expected = 0xff40ff40;
> +               else
> +                       expected = 0x00000000;
> +
> +               if (p[i] != expected) {
> +                       fprintf(stderr, "Offset %d: expected: 0x%08x, got: 0x%08x\n",
> +                               i, expected, p[i]);
> +                       return -1;
> +               }
> +       }
> +
> +       return 0;
> +}
> +
>  int main(int argc, char *argv[])
>  {
>         const int width = 256;
> @@ -165,7 +186,7 @@ int main(int argc, char *argv[])
>         int core = 0;
>
>         if (argc < 2) {
> -               fprintf(stderr, "Usage: %s /dev/dri/<device>\n", argv[0]);
> +               fprintf(stderr, "Usage: %s /dev/dri/<device> [<etna.bmp>]\n", argv[0]);
>                 return 1;
>         }
>
> @@ -242,7 +263,11 @@ int main(int argc, char *argv[])
>
>         etna_cmd_stream_finish(stream);
>
> -       bmp_dump32(etna_bo_map(bmp), width, height, false, "/tmp/etna.bmp");
> +       if (argc > 2)
> +               bmp_dump32(etna_bo_map(bmp), width, height, false, argv[2]);
> +
> +       if (etna_check_image(etna_bo_map(bmp), width, height))
> +               ret = 7;
>
>         etna_cmd_stream_del(stream);
>
> --
> 2.28.0
>
> _______________________________________________
> etnaviv mailing list
> etnaviv@xxxxxxxxxxxxxxxxxxxxx
> https://lists.freedesktop.org/mailman/listinfo/etnaviv



-- 
greets
--
Christian Gmeiner, MSc

https://christian-gmeiner.info/privacypolicy
_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/dri-devel



[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux