From: Daniel Vetter <daniel@ffwll.ch>
To: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
Cc: Intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH i-g-t 02/12] lib: Extract igt_buf_write_to_png() from gem_render_copy
Date: Tue, 24 Feb 2015 22:49:14 +0100 [thread overview]
Message-ID: <20150224214914.GK24485@phenom.ffwll.local> (raw)
In-Reply-To: <1424707075-27605-3-git-send-email-tvrtko.ursulin@linux.intel.com>
On Mon, Feb 23, 2015 at 03:57:45PM +0000, Tvrtko Ursulin wrote:
> From: Damien Lespiau <damien.lespiau@intel.com>
>
> Now that the Android build has cairo, we can put cairo-dependant code
> back into lib/
>
> Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
> ---
> lib/intel_batchbuffer.c | 25 +++++++++++++++++++++++++
> lib/intel_batchbuffer.h | 2 ++
> tests/gem_render_copy.c | 24 +++---------------------
> 3 files changed, 30 insertions(+), 21 deletions(-)
>
> diff --git a/lib/intel_batchbuffer.c b/lib/intel_batchbuffer.c
> index c70f6d8..5226910 100644
> --- a/lib/intel_batchbuffer.c
> +++ b/lib/intel_batchbuffer.c
> @@ -31,6 +31,8 @@
> #include <string.h>
> #include <assert.h>
>
> +#include <cairo.h>
> +
> #include "drm.h"
> #include "drmtest.h"
> #include "intel_batchbuffer.h"
> @@ -458,6 +460,29 @@ unsigned igt_buf_height(struct igt_buf *buf)
> }
>
> /**
> + * igt_buf_write_to_png:
> + * @buf: an i-g-t buffer object
> + *
> + * Writes the content of @buf as a PNG file
Maybe mention that the buffer is interpreted as rgbx pixels, too.
-Daniel
> + */
> +void igt_buf_write_to_png(struct igt_buf *buf, const char *filename)
> +{
> + cairo_surface_t *surface;
> + cairo_status_t ret;
> +
> + drm_intel_bo_map(buf->bo, 0);
> + surface = cairo_image_surface_create_for_data(buf->bo->virtual,
> + CAIRO_FORMAT_RGB24,
> + igt_buf_width(buf),
> + igt_buf_height(buf),
> + buf->stride);
> + ret = cairo_surface_write_to_png(surface, filename);
> + igt_assert(ret == CAIRO_STATUS_SUCCESS);
> + cairo_surface_destroy(surface);
> + drm_intel_bo_unmap(buf->bo);
> +}
> +
> +/**
> * igt_get_render_copyfunc:
> * @devid: pci device id
> *
> diff --git a/lib/intel_batchbuffer.h b/lib/intel_batchbuffer.h
> index 12f7be1..e2afc3b 100644
> --- a/lib/intel_batchbuffer.h
> +++ b/lib/intel_batchbuffer.h
> @@ -210,6 +210,8 @@ struct igt_buf {
> unsigned igt_buf_width(struct igt_buf *buf);
> unsigned igt_buf_height(struct igt_buf *buf);
>
> +void igt_buf_write_to_png(struct igt_buf *buf, const char *filename);
> +
> /**
> * igt_render_copyfunc_t:
> * @batch: batchbuffer object
> diff --git a/tests/gem_render_copy.c b/tests/gem_render_copy.c
> index 6348eee..6aa9e0d 100644
> --- a/tests/gem_render_copy.c
> +++ b/tests/gem_render_copy.c
> @@ -31,7 +31,6 @@
>
> #include <stdbool.h>
> #include <unistd.h>
> -#include <cairo.h>
> #include <stdlib.h>
> #include <sys/ioctl.h>
> #include <stdio.h>
> @@ -71,23 +70,6 @@ typedef struct {
> static int opt_dump_png = false;
> static int check_all_pixels = false;
>
> -static void scratch_buf_write_to_png(struct igt_buf *buf, const char *filename)
> -{
> - cairo_surface_t *surface;
> - cairo_status_t ret;
> -
> - drm_intel_bo_map(buf->bo, 0);
> - surface = cairo_image_surface_create_for_data(buf->bo->virtual,
> - CAIRO_FORMAT_RGB24,
> - igt_buf_width(buf),
> - igt_buf_height(buf),
> - buf->stride);
> - ret = cairo_surface_write_to_png(surface, filename);
> - igt_assert(ret == CAIRO_STATUS_SUCCESS);
> - cairo_surface_destroy(surface);
> - drm_intel_bo_unmap(buf->bo);
> -}
> -
> static void scratch_buf_init(data_t *data, struct igt_buf *buf,
> int width, int height, int stride, uint32_t color)
> {
> @@ -165,8 +147,8 @@ int main(int argc, char **argv)
> scratch_buf_check(&data, &dst, WIDTH / 2, HEIGHT / 2, DST_COLOR);
>
> if (opt_dump_png) {
> - scratch_buf_write_to_png(&src, "source.png");
> - scratch_buf_write_to_png(&dst, "destination.png");
> + igt_buf_write_to_png(&src, "source.png");
> + igt_buf_write_to_png(&dst, "destination.png");
> }
>
> if (opt_dump_aub) {
> @@ -188,7 +170,7 @@ int main(int argc, char **argv)
> &dst, WIDTH / 2, HEIGHT / 2);
>
> if (opt_dump_png)
> - scratch_buf_write_to_png(&dst, "result.png");
> + igt_buf_write_to_png(&dst, "result.png");
>
> if (opt_dump_aub) {
> drm_intel_gem_bo_aub_dump_bmp(dst.bo,
> --
> 2.3.0
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2015-02-24 21:47 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-23 15:57 [PATCH i-g-t 00/12] Testing the Y tiled display Tvrtko Ursulin
2015-02-23 15:57 ` [PATCH i-g-t 01/12] tests/kms_addfb: Add support for fb modifiers Tvrtko Ursulin
2015-02-23 15:57 ` [PATCH i-g-t 02/12] lib: Extract igt_buf_write_to_png() from gem_render_copy Tvrtko Ursulin
2015-02-24 21:49 ` Daniel Vetter [this message]
2015-02-23 15:57 ` [PATCH i-g-t 03/12] tests/kms_addfb: Y tiled testcases Tvrtko Ursulin
2015-02-23 15:57 ` [PATCH i-g-t 04/12] lib/skl: Add gen9 specific igt_blitter_fast_copy() Tvrtko Ursulin
2015-02-23 15:57 ` [PATCH i-g-t 05/12] lib: Don't give a struct igt_buf * to fast_copy_pitch() Tvrtko Ursulin
2015-02-23 15:57 ` [PATCH i-g-t 06/12] lib: Split two helpers to build fast copy's dword0 and dword1 Tvrtko Ursulin
2015-02-23 15:57 ` [PATCH i-g-t 07/12] lib: Provide a raw version of the gen9 fast copy blits Tvrtko Ursulin
2015-02-23 15:57 ` [PATCH i-g-t 08/12] tiling: Convert framebuffer helpers to use fb modifiers Tvrtko Ursulin
2015-02-23 15:57 ` [PATCH i-g-t 09/12] lib: Add support for new extension to the ADDFB2 ioctl Tvrtko Ursulin
2015-02-23 15:57 ` [PATCH i-g-t 10/12] lib/igt_fb: Use new ADDFB2 extension for new tiling modes Tvrtko Ursulin
2015-02-23 15:57 ` [PATCH i-g-t 11/12] lib: Allow the creation of Ys/Yf tiled FBs Tvrtko Ursulin
2015-02-23 15:57 ` [PATCH i-g-t 12/12] testdisplay/skl: Add command line options for Yb/Yf tiled fbs Tvrtko Ursulin
2015-02-24 21:51 ` Daniel Vetter
2015-02-25 10:55 ` Tvrtko Ursulin
2015-02-25 15:05 ` Daniel Vetter
2015-02-24 21:53 ` [PATCH i-g-t 00/12] Testing the Y tiled display Daniel Vetter
2015-02-25 10:58 ` Tvrtko Ursulin
2015-02-25 17:08 ` [PATCH v5 01/13] tests/kms_addfb: Add support for fb modifiers Tvrtko Ursulin
2015-02-25 21:17 ` Daniel Vetter
2015-02-25 17:27 ` [PATCH v2 02/12] lib: Extract igt_buf_write_to_png() from gem_render_copy Tvrtko Ursulin
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=20150224214914.GK24485@phenom.ffwll.local \
--to=daniel@ffwll.ch \
--cc=Intel-gfx@lists.freedesktop.org \
--cc=tvrtko.ursulin@linux.intel.com \
/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