From: Paul Kocialkowski <paul.kocialkowski@linux.intel.com>
To: Daniel Vetter <daniel@ffwll.ch>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH i-g-t v5 4/7] Introduce common frame dumping configuration and helpers
Date: Thu, 20 Jul 2017 17:14:14 +0300 [thread overview]
Message-ID: <1500560054.1362.6.camel@linux.intel.com> (raw)
In-Reply-To: <20170720072447.r2pmm43gkgqrbwb4@phenom.ffwll.local>
On Thu, 2017-07-20 at 09:24 +0200, Daniel Vetter wrote:
> On Wed, Jul 19, 2017 at 04:46:07PM +0300, Paul Kocialkowski wrote:
> > This introduces a common FrameDumpPath configuration field, as well
> > as
> > helper functions in dedicated igt_frame for writing cairo surfaces
> > to png files.
> >
> > Signed-off-by: Paul Kocialkowski <paul.kocialkowski@linux.intel.com>
> > ---
> > lib/Makefile.sources | 2 +
> > lib/igt.h | 1 +
> > lib/igt_core.c | 12 +++++
> > lib/igt_core.h | 2 +-
> > lib/igt_frame.c | 137
> > +++++++++++++++++++++++++++++++++++++++++++++++++++
> > lib/igt_frame.h | 43 ++++++++++++++++
>
> Please make sure you pull the new docs into the docs build too. And
> while
> doing that, please review for other stuff added in the past year and
> include that too. And please build the docs and check the result.
I've just sent out a patch for that, thanks for pointing it out!
Cheers,
Paul
> Thanks, Daniel
>
> > 6 files changed, 196 insertions(+), 1 deletion(-)
> > create mode 100644 lib/igt_frame.c
> > create mode 100644 lib/igt_frame.h
> >
> > diff --git a/lib/Makefile.sources b/lib/Makefile.sources
> > index 53fdb54c..c2e58809 100644
> > --- a/lib/Makefile.sources
> > +++ b/lib/Makefile.sources
> > @@ -83,6 +83,8 @@ lib_source_list = \
> > uwildmat/uwildmat.c \
> > igt_kmod.c \
> > igt_kmod.h \
> > + igt_frame.c \
> > + igt_frame.h \
> > $(NULL)
> >
> > .PHONY: version.h.tmp
> > diff --git a/lib/igt.h b/lib/igt.h
> > index a069deb3..d16a4991 100644
> > --- a/lib/igt.h
> > +++ b/lib/igt.h
> > @@ -34,6 +34,7 @@
> > #include "igt_draw.h"
> > #include "igt_dummyload.h"
> > #include "igt_fb.h"
> > +#include "igt_frame.h"
> > #include "igt_gt.h"
> > #include "igt_kms.h"
> > #include "igt_pm.h"
> > diff --git a/lib/igt_core.c b/lib/igt_core.c
> > index 1ba79361..5a3b00e8 100644
> > --- a/lib/igt_core.c
> > +++ b/lib/igt_core.c
> > @@ -235,6 +235,10 @@
> > * An example configuration follows:
> > *
> > * |[<!-- language="plain" -->
> > + * # The common configuration secton follows.
> > + * [Common]
> > + * FrameDumpPath=/tmp # The path to dump frames that fail
> > comparison checks
> > + *
> > * # The following section is used for configuring the
> > Device Under Test.
> > * # It is not mandatory and allows overriding default
> > values.
> > * [DUT]
> > @@ -290,6 +294,7 @@ static struct {
> > static pthread_mutex_t log_buffer_mutex =
> > PTHREAD_MUTEX_INITIALIZER;
> >
> > GKeyFile *igt_key_file;
> > +char *frame_dump_path;
> >
> > const char *igt_test_name(void)
> > {
> > @@ -621,6 +626,13 @@ static int config_parse(void)
> > if (!igt_key_file)
> > return 0;
> >
> > + frame_dump_path = getenv("IGT_FRAME_DUMP_PATH");
> > +
> > + if (!frame_dump_path)
> > + frame_dump_path =
> > g_key_file_get_string(igt_key_file, "Common",
> > + "FrameDumpP
> > ath",
> > + &error);
> > +
> > rc = g_key_file_get_integer(igt_key_file, "DUT",
> > "SuspendResumeDelay",
> > &error);
> > if (error && error->code == G_KEY_FILE_ERROR_INVALID_VALUE)
> > diff --git a/lib/igt_core.h b/lib/igt_core.h
> > index 0739ca83..1619a9d6 100644
> > --- a/lib/igt_core.h
> > +++ b/lib/igt_core.h
> > @@ -50,7 +50,7 @@
> > extern const char* __igt_test_description __attribute__((weak));
> > extern bool __igt_plain_output;
> > extern GKeyFile *igt_key_file;
> > -
> > +extern char *frame_dump_path;
> >
> > /**
> > * IGT_TEST_DESCRIPTION:
> > diff --git a/lib/igt_frame.c b/lib/igt_frame.c
> > new file mode 100644
> > index 00000000..dfafe53d
> > --- /dev/null
> > +++ b/lib/igt_frame.c
> > @@ -0,0 +1,137 @@
> > +/*
> > + * Copyright © 2017 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.
> > + *
> > + * Authors:
> > + * Paul Kocialkowski <paul.kocialkowski@linux.intel.com>
> > + */
> > +
> > +#include "config.h"
> > +
> > +#include <fcntl.h>
> > +#include <pixman.h>
> > +#include <cairo.h>
> > +
> > +#include "igt.h"
> > +
> > +/**
> > + * SECTION:igt_frame
> > + * @short_description: Library for frame-related tests
> > + * @title: Frame
> > + * @include: igt_frame.h
> > + *
> > + * This library contains helpers for frame-related tests. This
> > includes common
> > + * frame dumping as well as frame comparison helpers.
> > + */
> > +
> > +/**
> > + * igt_frame_dump_is_enabled:
> > + *
> > + * Get whether frame dumping is enabled.
> > + *
> > + * Returns: A boolean indicating whether frame dumping is enabled
> > + */
> > +bool igt_frame_dump_is_enabled(void)
> > +{
> > + return frame_dump_path != NULL;
> > +}
> > +
> > +static void igt_write_frame_to_png(cairo_surface_t *surface, int
> > fd,
> > + const char *qualifier, const
> > char *suffix)
> > +{
> > + char path[PATH_MAX];
> > + const char *test_name;
> > + const char *subtest_name;
> > + cairo_status_t status;
> > + int index;
> > +
> > + test_name = igt_test_name();
> > + subtest_name = igt_subtest_name();
> > +
> > + if (suffix)
> > + snprintf(path, PATH_MAX, "%s/frame-%s-%s-%s-
> > %s.png",
> > + frame_dump_path, test_name, subtest_name,
> > qualifier,
> > + suffix);
> > + else
> > + snprintf(path, PATH_MAX, "%s/frame-%s-%s-%s.png",
> > + frame_dump_path, test_name, subtest_name,
> > qualifier);
> > +
> > + igt_debug("Dumping %s frame to %s...\n", qualifier, path);
> > +
> > + status = cairo_surface_write_to_png(surface, path);
> > +
> > + igt_assert_eq(status, CAIRO_STATUS_SUCCESS);
> > +
> > + index = strlen(path);
> > +
> > + if (fd >= 0 && index < (PATH_MAX - 1)) {
> > + path[index++] = '\n';
> > + path[index] = '\0';
> > +
> > + write(fd, path, strlen(path));
> > + }
> > +}
> > +
> > +/**
> > + * igt_write_compared_frames_to_png:
> > + * @reference: The reference cairo surface
> > + * @capture: The captured cairo surface
> > + * @reference_suffix: The suffix to give to the reference png file
> > + * @capture_suffix: The suffix to give to the capture png file
> > + *
> > + * Write previously compared frames to png files.
> > + */
> > +void igt_write_compared_frames_to_png(cairo_surface_t *reference,
> > + cairo_surface_t *capture,
> > + const char *reference_suffix,
> > + const char *capture_suffix)
> > +{
> > + char *id;
> > + const char *test_name;
> > + const char *subtest_name;
> > + char path[PATH_MAX];
> > + int fd = -1;
> > +
> > + if (!igt_frame_dump_is_enabled())
> > + return;
> > +
> > + id = getenv("IGT_FRAME_DUMP_ID");
> > +
> > + test_name = igt_test_name();
> > + subtest_name = igt_subtest_name();
> > +
> > + if (id)
> > + snprintf(path, PATH_MAX, "%s/frame-%s-%s-%s.txt",
> > + frame_dump_path, test_name, subtest_name,
> > id);
> > + else
> > + snprintf(path, PATH_MAX, "%s/frame-%s-%s.txt",
> > + frame_dump_path, test_name, subtest_name);
> > +
> > + fd = open(path, O_WRONLY | O_CREAT | O_TRUNC, 0644);
> > + igt_assert(fd >= 0);
> > +
> > + igt_debug("Writing dump report to %s...\n", path);
> > +
> > + igt_write_frame_to_png(reference, fd, "reference",
> > reference_suffix);
> > + igt_write_frame_to_png(capture, fd, "capture",
> > capture_suffix);
> > +
> > + close(fd);
> > +}
> > diff --git a/lib/igt_frame.h b/lib/igt_frame.h
> > new file mode 100644
> > index 00000000..ec6a1643
> > --- /dev/null
> > +++ b/lib/igt_frame.h
> > @@ -0,0 +1,43 @@
> > +/*
> > + * Copyright © 2017 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.
> > + *
> > + * Authors:
> > + * Paul Kocialkowski <paul.kocialkowski@linux.intel.com>
> > + */
> > +
> > +#ifndef IGT_FRAME_H
> > +#define IGT_FRAME_H
> > +
> > +#ifdef HAVE_CONFIG_H
> > +#include "config.h"
> > +#endif
> > +
> > +#include "igt.h"
> > +#include <stdbool.h>
> > +
> > +bool igt_frame_dump_is_enabled(void);
> > +void igt_write_compared_frames_to_png(cairo_surface_t *reference,
> > + cairo_surface_t *capture,
> > + const char *reference_suffix,
> > + const char *capture_suffix);
> > +
> > +#endif
> > --
> > 2.13.2
> >
> > _______________________________________________
> > Intel-gfx mailing list
> > Intel-gfx@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/intel-gfx
>
>
--
Paul Kocialkowski <paul.kocialkowski@linux.intel.com>
Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo, Finland
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2017-07-20 14:14 UTC|newest]
Thread overview: 57+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-05 8:04 [PATCH i-g-t v3 1/4] chamelium: Calculate CRC from framebuffer instead of hardcoding it Paul Kocialkowski
2017-07-05 8:04 ` [PATCH i-g-t v3 2/4] tests/ chamelium: Remove the frame dump tests Paul Kocialkowski
2017-07-05 20:53 ` Lyude Paul
2017-07-06 7:37 ` Martin Peres
2017-07-06 13:29 ` Paul Kocialkowski
2017-07-05 8:04 ` [PATCH i-g-t v3 3/4] lib/igt_chamelium: Add support for dumping chamelium frames to a png Paul Kocialkowski
2017-07-05 21:16 ` Lyude Paul
2017-07-05 8:04 ` [PATCH i-g-t v3 4/4] chamelium: Dump obtained and reference frames to png on crc error Paul Kocialkowski
2017-07-05 21:44 ` Lyude Paul
2017-07-06 7:41 ` Martin Peres
2017-07-06 11:35 ` Paul Kocialkowski
2017-07-06 22:23 ` Lyude Paul
2017-07-10 10:12 ` Paul Kocialkowski
2017-07-06 11:31 ` Paul Kocialkowski
2017-07-06 13:33 ` Paul Kocialkowski
2017-07-06 21:57 ` Lyude Paul
2017-07-10 10:27 ` Paul Kocialkowski
2017-07-11 17:27 ` Lyude Paul
2017-07-10 10:31 ` Paul Kocialkowski
2017-07-10 10:33 ` Martin Peres
2017-07-10 12:06 ` Paul Kocialkowski
2017-07-10 13:56 ` Martin Peres
2017-07-10 14:11 ` Paul Kocialkowski
2017-07-10 16:02 ` Martin Peres
2017-07-05 20:34 ` [PATCH i-g-t v3 1/4] chamelium: Calculate CRC from framebuffer instead of hardcoding it Lyude Paul
2017-07-05 20:49 ` Lyude Paul
2017-07-06 8:49 ` Paul Kocialkowski
2017-07-06 13:14 ` Paul Kocialkowski
2017-07-06 22:33 ` Lyude Paul
2017-07-12 14:50 ` [PATCH i-g-t v4 0/7] CRC testing with Chamelium improvements Paul Kocialkowski
2017-07-12 14:50 ` [PATCH i-g-t v4 1/7] lib/igt_fb: Export the cairo surface instead of writing to a png Paul Kocialkowski
2017-07-12 14:50 ` [PATCH i-g-t v4 2/7] chamelium: Calculate CRC from framebuffer instead of hardcoding it Paul Kocialkowski
2017-07-17 16:29 ` Lyude Paul
2017-07-19 11:11 ` Paul Kocialkowski
2017-07-12 14:50 ` [PATCH i-g-t v4 3/7] lib/igt_debugfs: Introduce CRC check function, with logic made common Paul Kocialkowski
2017-07-12 14:50 ` [PATCH i-g-t v4 4/7] Introduce common frame dumping configuration and helpers Paul Kocialkowski
2017-07-12 14:50 ` [PATCH i-g-t v4 5/7] lib/igt_debugfs: Add extended helper to format crc to string Paul Kocialkowski
2017-07-12 14:50 ` [PATCH i-g-t v4 6/7] chamelium: Dump captured and reference frames to png on crc error Paul Kocialkowski
2017-07-12 14:50 ` [PATCH i-g-t v4 7/7] tests/chamelium: Merge the crc testing functions into one Paul Kocialkowski
2017-07-12 14:53 ` [PATCH i-g-t v4 0/7] CRC testing with Chamelium improvements Paul Kocialkowski
2017-07-17 17:04 ` Lyude Paul
2017-07-19 13:46 ` [PATCH i-g-t v5 " Paul Kocialkowski
2017-07-19 13:46 ` [PATCH i-g-t v5 1/7] lib/igt_fb: Export the cairo surface instead of writing to a png Paul Kocialkowski
2017-07-19 13:46 ` [PATCH i-g-t v5 2/7] chamelium: Calculate CRC from framebuffer instead of hardcoding it Paul Kocialkowski
2017-07-19 13:46 ` [PATCH i-g-t v5 3/7] lib/igt_debugfs: Introduce CRC check function, with logic made common Paul Kocialkowski
2017-07-19 13:46 ` [PATCH i-g-t v5 4/7] Introduce common frame dumping configuration and helpers Paul Kocialkowski
2017-07-20 7:24 ` Daniel Vetter
2017-07-20 14:14 ` Paul Kocialkowski [this message]
2017-07-19 13:46 ` [PATCH i-g-t v5 5/7] lib/igt_debugfs: Add extended helper to format crc to string Paul Kocialkowski
2017-07-19 13:46 ` [PATCH i-g-t v5 6/7] chamelium: Dump captured and reference frames to png on crc error Paul Kocialkowski
2017-07-19 13:46 ` [PATCH i-g-t v5 7/7] tests/chamelium: Merge the crc testing functions into one Paul Kocialkowski
2017-07-19 16:09 ` [PATCH i-g-t v5 0/7] CRC testing with Chamelium improvements Lyude Paul
2017-07-20 9:39 ` Jani Nikula
2017-07-20 11:15 ` Martin Peres
2017-07-20 11:27 ` Paul Kocialkowski
2017-07-20 12:41 ` Daniel Vetter
2017-07-20 12:44 ` Paul Kocialkowski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1500560054.1362.6.camel@linux.intel.com \
--to=paul.kocialkowski@linux.intel.com \
--cc=daniel@ffwll.ch \
--cc=intel-gfx@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).