summaryrefslogtreecommitdiff
path: root/tests/gem_render_copy.c
diff options
context:
space:
mode:
authorDamien Lespiau <damien.lespiau@intel.com>2013-10-22 14:26:38 +0100
committerDamien Lespiau <damien.lespiau@intel.com>2013-10-24 13:44:32 +0100
commit145722187c30a60456df046981087f84f3c0b601 (patch)
tree23bd4b8ff3a46cd04e1d45fbfab486cc8e12bb5e /tests/gem_render_copy.c
parent9cd092fac149eb8cfe16e3652f1d535fb0698329 (diff)
tests/gem_render_copy: Only dump pngs when the -d option is given
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
Diffstat (limited to 'tests/gem_render_copy.c')
-rw-r--r--tests/gem_render_copy.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/tests/gem_render_copy.c b/tests/gem_render_copy.c
index a693ceea..b844fbb2 100644
--- a/tests/gem_render_copy.c
+++ b/tests/gem_render_copy.c
@@ -30,6 +30,7 @@
*/
#include <stdbool.h>
+#include <unistd.h>
#include "rendercopy.h"
@@ -88,8 +89,19 @@ int main(int argc, char **argv)
struct intel_batchbuffer *batch = NULL;
struct scratch_buf src, dst;
render_copyfunc_t render_copy = NULL;
+ int opt;
int opt_dump_png = false;
+ while ((opt = getopt(argc, argv, "d")) != -1) {
+ switch (opt) {
+ case 'd':
+ opt_dump_png = true;
+ break;
+ default:
+ break;
+ }
+ }
+
igt_fixture {
data.drm_fd = drm_open_any();
data.devid = intel_get_drm_devid(data.drm_fd);
@@ -111,8 +123,10 @@ int main(int argc, char **argv)
scratch_buf_check(&data, &src, WIDTH / 2, HEIGHT / 2, SRC_COLOR);
scratch_buf_check(&data, &dst, WIDTH / 2, HEIGHT / 2, DST_COLOR);
- scratch_buf_write_to_png(&src, "source.png");
- scratch_buf_write_to_png(&dst, "destination.png");
+ if (opt_dump_png) {
+ scratch_buf_write_to_png(&src, "source.png");
+ scratch_buf_write_to_png(&dst, "destination.png");
+ }
render_copy(batch,
&src, 0, 0, WIDTH, HEIGHT,
@@ -121,7 +135,8 @@ int main(int argc, char **argv)
scratch_buf_check(&data, &dst, 10, 10, DST_COLOR);
scratch_buf_check(&data, &dst, WIDTH - 10, HEIGHT - 10, SRC_COLOR);
- scratch_buf_write_to_png(&dst, "result.png");
+ if (opt_dump_png)
+ scratch_buf_write_to_png(&dst, "result.png");
return 0;
}