Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
To: igt-dev@lists.freedesktop.org
Subject: [igt-dev] [PATCH i-g-t 1/9] tests/kms_panel_fitting: Remove dead code
Date: Thu,  1 Feb 2018 16:39:06 +0100	[thread overview]
Message-ID: <20180201153914.74639-2-maarten.lankhorst@linux.intel.com> (raw)
In-Reply-To: <20180201153914.74639-1-maarten.lankhorst@linux.intel.com>

fb3 is unused, and fb_id1/2 are also set in igt_framebuffer, so
it doesn't need separate member values.

image_w/h are also unused and create_fb will always succeed, so
more elimination of dead code.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
---
 tests/kms_panel_fitting.c | 52 +++++++++++++++--------------------------------
 1 file changed, 16 insertions(+), 36 deletions(-)

diff --git a/tests/kms_panel_fitting.c b/tests/kms_panel_fitting.c
index e4ea355611c3..e0ca6cca8e6a 100644
--- a/tests/kms_panel_fitting.c
+++ b/tests/kms_panel_fitting.c
@@ -32,15 +32,8 @@ typedef struct {
 	int drm_fd;
 	igt_display_t display;
 
-	int image_w;
-	int image_h;
-
 	struct igt_fb fb1;
 	struct igt_fb fb2;
-	struct igt_fb fb3;
-	int fb_id1;
-	int fb_id2;
-	int fb_id3;
 
 	igt_plane_t *plane1;
 	igt_plane_t *plane2;
@@ -58,18 +51,17 @@ static void prepare_crtc(data_t *data, igt_output_t *output, enum pipe pipe,
 	igt_output_set_pipe(output, pipe);
 
 	/* before allocating, free if any older fb */
-	if (data->fb_id1) {
+	if (data->fb1.fb_id) {
 		igt_remove_fb(data->drm_fd, &data->fb1);
-		data->fb_id1 = 0;
+		data->fb1.fb_id = 0;
 	}
 
 	/* allocate fb for plane 1 */
-	data->fb_id1 = igt_create_pattern_fb(data->drm_fd,
-						mode->hdisplay, mode->vdisplay,
-						DRM_FORMAT_XRGB8888,
-						LOCAL_DRM_FORMAT_MOD_NONE,
-						&data->fb1);
-	igt_assert(data->fb_id1);
+	igt_create_pattern_fb(data->drm_fd,
+			      mode->hdisplay, mode->vdisplay,
+			      DRM_FORMAT_XRGB8888,
+			      LOCAL_DRM_FORMAT_MOD_NONE,
+			      &data->fb1);
 
 	/*
 	 * We always set the primary plane to actually enable the pipe as
@@ -91,17 +83,13 @@ static void cleanup_crtc(data_t *data, igt_output_t *output, igt_plane_t *plane)
 {
 	igt_display_t *display = &data->display;
 
-	if (data->fb_id1) {
+	if (data->fb1.fb_id) {
 		igt_remove_fb(data->drm_fd, &data->fb1);
-		data->fb_id1 = 0;
+		data->fb1.fb_id = 0;
 	}
-	if (data->fb_id2) {
+	if (data->fb2.fb_id) {
 		igt_remove_fb(data->drm_fd, &data->fb2);
-		data->fb_id2 = 0;
-	}
-	if (data->fb_id3) {
-		igt_remove_fb(data->drm_fd, &data->fb3);
-		data->fb_id3 = 0;
+		data->fb2.fb_id = 0;
 	}
 
 	if (plane->type != DRM_PLANE_TYPE_PRIMARY) {
@@ -121,7 +109,6 @@ static void test_panel_fitting(data_t *d)
 {
 	igt_display_t *display = &d->display;
 	igt_output_t *output;
-	cairo_surface_t *image;
 	enum pipe pipe;
 	int valid_tests = 0;
 
@@ -146,18 +133,11 @@ static void test_panel_fitting(data_t *d)
 		mode = igt_output_get_mode(output);
 		native_mode = *mode;
 
-		/* allocate fb2 with image size */
-		image = igt_cairo_image_surface_create_from_png(FILE_NAME);
-		igt_assert(cairo_surface_status(image) == CAIRO_STATUS_SUCCESS);
-		d->image_w = cairo_image_surface_get_width(image);
-		d->image_h = cairo_image_surface_get_height(image);
-		cairo_surface_destroy(image);
-
-		d->fb_id2 = igt_create_image_fb(d->drm_fd, 0, 0,
-						DRM_FORMAT_XRGB8888,
-						LOCAL_DRM_FORMAT_MOD_NONE,
-						FILE_NAME, &d->fb2);
-		igt_assert(d->fb_id2);
+		/* allocate fb2 with image */
+		igt_create_image_fb(d->drm_fd, 0, 0,
+				    DRM_FORMAT_XRGB8888,
+				    LOCAL_DRM_FORMAT_MOD_NONE,
+				    FILE_NAME, &d->fb2);
 
 		/* Set up display to enable panel fitting */
 		mode->hdisplay = 640;
-- 
2.15.1

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

  reply	other threads:[~2018-02-01 15:39 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-01 15:39 [igt-dev] [PATCH i-g-t 0/9] tests: Cleanups and NV12 preparations Maarten Lankhorst
2018-02-01 15:39 ` Maarten Lankhorst [this message]
2018-02-05 10:50   ` [igt-dev] [PATCH i-g-t 1/9] tests/kms_panel_fitting: Remove dead code Mika Kahola
2018-02-01 15:39 ` [igt-dev] [PATCH i-g-t 2/9] tests/kms_atomic: Add the test for CRTC_ID/FB_ID mismatch Maarten Lankhorst
2018-02-05 10:53   ` Mika Kahola
2018-02-01 15:39 ` [igt-dev] [PATCH i-g-t 3/9] tests/kms_plane_scaling: Test all pixel formats in pipe-*-scaler-with-rotation Maarten Lankhorst
2018-02-05 11:14   ` Mika Kahola
2018-02-05 11:15     ` Mika Kahola
2018-02-01 15:39 ` [igt-dev] [PATCH i-g-t 4/9] tests/kms_plane_scaling: Test all pixel formats with clamping and clipping too Maarten Lankhorst
2018-02-05 11:47   ` Mika Kahola
2018-02-01 15:39 ` [igt-dev] [PATCH i-g-t 5/9] tests/kms_rotation_crc: Fix bad-tiling testcase Maarten Lankhorst
2018-02-06 10:50   ` Mika Kahola
2018-02-01 15:39 ` [igt-dev] [PATCH i-g-t 6/9] tests/kms_rotation_crc: Move bad_format parameter to test_plane_rotation Maarten Lankhorst
2018-02-06 10:57   ` Mika Kahola
2018-02-01 15:39 ` [igt-dev] [PATCH i-g-t 7/9] tests/kms_rotation_crc: Always run the flip tests when available Maarten Lankhorst
2018-02-06 11:39   ` Mika Kahola
2018-02-01 15:39 ` [igt-dev] [PATCH i-g-t 8/9] tests/kms_rotation_crc: Remove primary-rotation-90-Y-tiled Maarten Lankhorst
2018-02-06 13:01   ` Mika Kahola
2018-02-01 15:39 ` [igt-dev] [PATCH i-g-t 9/9] tests/kms_rotation_crc: Perform lazy cleanup and require atomic Maarten Lankhorst
2018-02-07  8:55   ` Mika Kahola
2018-02-07  9:46     ` Maarten Lankhorst
2018-02-07 10:37       ` Mika Kahola
2018-02-01 16:04 ` [igt-dev] ✓ Fi.CI.BAT: success for tests: Cleanups and NV12 preparations Patchwork
2018-02-01 19:07 ` [igt-dev] ✗ Fi.CI.IGT: warning " Patchwork

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=20180201153914.74639-2-maarten.lankhorst@linux.intel.com \
    --to=maarten.lankhorst@linux.intel.com \
    --cc=igt-dev@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