Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Bhanuprakash Modem <bhanuprakash.modem@intel.com>
To: igt-dev@lists.freedesktop.org, ville.syrjala@linux.intel.com
Subject: [igt-dev] [i-g-t V2 3/3] tests/kms: Add missing igt_put_cairo_ctx()
Date: Mon, 13 Mar 2023 20:44:06 +0530	[thread overview]
Message-ID: <20230313151406.2113963-3-bhanuprakash.modem@intel.com> (raw)
In-Reply-To: <20230313151406.2113963-1-bhanuprakash.modem@intel.com>

Remeber to call igt_put_cairo_ctx() after rendering to make
sure the results actually end up in the framebuffer (in case
the rendering happens to a temporary buffer and there needs
to be a copy back at the end).

Signed-off-by: Bhanuprakash Modem <bhanuprakash.modem@intel.com>
---
 tests/kms_async_flips.c | 4 ++++
 tests/kms_lease.c       | 2 +-
 tests/kms_writeback.c   | 1 +
 3 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/tests/kms_async_flips.c b/tests/kms_async_flips.c
index 55be0bd87..34808f401 100644
--- a/tests/kms_async_flips.c
+++ b/tests/kms_async_flips.c
@@ -494,9 +494,11 @@ static void test_crc(data_t *data)
 
 	cr = igt_get_cairo_ctx(data->drm_fd, &data->bufs[frame]);
 	igt_paint_color(cr, 0, 0, data->bufs[frame].width, data->bufs[frame].height, 1.0, 0.0, 0.0);
+	igt_put_cairo_ctx(cr);
 
 	cr = igt_get_cairo_ctx(data->drm_fd, &data->bufs[!frame]);
 	igt_paint_color(cr, 0, 0, data->bufs[!frame].width, data->bufs[!frame].height, 1.0, 0.0, 0.0);
+	igt_put_cairo_ctx(cr);
 
 	ret = drmModeSetCrtc(data->drm_fd, data->crtc_id, data->bufs[frame].fb_id, 0, 0,
 			     &data->output->config.connector->connector_id, 1,
@@ -518,6 +520,7 @@ static void test_crc(data_t *data)
 		/* fill the next fb with the expected color */
 		cr = igt_get_cairo_ctx(data->drm_fd, &data->bufs[frame]);
 		igt_paint_color(cr, 0, 0, 1, data->bufs[frame].height, 1.0, 0.0, 0.0);
+		igt_put_cairo_ctx(cr);
 
 		data->flip_pending = true;
 		ret = drmModePageFlip(data->drm_fd, data->crtc_id, data->bufs[frame].fb_id,
@@ -530,6 +533,7 @@ static void test_crc(data_t *data)
 		frame = !frame;
 		cr = igt_get_cairo_ctx(data->drm_fd, &data->bufs[frame]);
 		igt_paint_color_rand(cr, 0, 0, 1, data->bufs[frame].height);
+		igt_put_cairo_ctx(cr);
 	}
 
 	igt_pipe_crc_stop(data->pipe_crc);
diff --git a/tests/kms_lease.c b/tests/kms_lease.c
index 7eab77078..b9b669420 100644
--- a/tests/kms_lease.c
+++ b/tests/kms_lease.c
@@ -207,7 +207,7 @@ static int paint_fb(int drm_fd, struct igt_fb *fb, const char *test_name,
 	igt_cairo_printf_line(cr, align_hcenter, 10, "%s", connector_str);
 	igt_cairo_printf_line(cr, align_hcenter, 10, "%s", pipe_str);
 
-	cairo_destroy(cr);
+	igt_put_cairo_ctx(cr);
 
 	return 0;
 }
diff --git a/tests/kms_writeback.c b/tests/kms_writeback.c
index 9d1345857..c4808b02c 100644
--- a/tests/kms_writeback.c
+++ b/tests/kms_writeback.c
@@ -414,6 +414,7 @@ static void commit_and_dump_fb(igt_display_t *display, igt_output_t *output, igt
 	snprintf(filepath_out, PATH_MAX, "%s/%s.png", path_name, file_name);
 	status = cairo_surface_write_to_png(fb_surface_out, filepath_out);
 	igt_assert_eq(status, CAIRO_STATUS_SUCCESS);
+	cairo_surface_destroy(fb_surface_out);
 
 	igt_remove_fb(display->drm_fd, &output_fb);
 }
-- 
2.39.1

  parent reply	other threads:[~2023-03-13 15:17 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-13 15:14 [igt-dev] [i-g-t V2 1/3] tests/kms: Cleanup to use linear modifier Bhanuprakash Modem
2023-03-13 15:14 ` [igt-dev] [i-g-t V2 2/3] tests/i915/kms_ccs: " Bhanuprakash Modem
2023-03-15 10:25   ` Ville Syrjälä
2023-03-13 15:14 ` Bhanuprakash Modem [this message]
2023-03-13 16:49 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,V2,1/3] tests/kms: " Patchwork
2023-03-14 19:43 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
2023-03-15 10:01 ` [igt-dev] [i-g-t V2 1/3] " Juha-Pekka Heikkila

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=20230313151406.2113963-3-bhanuprakash.modem@intel.com \
    --to=bhanuprakash.modem@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=ville.syrjala@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