All of lore.kernel.org
 help / color / mirror / Atom feed
From: Swati Sharma <swati2.sharma@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: Petri Latvala <petri.latvala@intel.com>
Subject: [igt-dev] [PATCH i-g-t 4/4] tests/kms_flip_scaled_crc: Validate NN scaling filter
Date: Wed, 29 Jun 2022 00:13:04 +0530	[thread overview]
Message-ID: <20220628184304.19496-4-swati2.sharma@intel.com> (raw)
In-Reply-To: <20220628184304.19496-1-swati2.sharma@intel.com>

SCALING_FILTER can be used either as plane scaler property
or CRTC scaler property.
The value of this property can be one of the following:
    Default:
             Driver's default scaling filter
    Nearest Neighbor:
             Nearest Neighbor scaling filter
If NN is used for scaling, sharpness is preserved
whereas if we use default scaling we can see blurriness
at edges.

v2: -no need to set pipe scaler filter property
v3: -addition of new lines to improve readability
    -use of SPDX licence placeholder
    -close(data.drm_fd)
v4: -instead of creating new i-g-t, tweaked kms_flip_scaled_crc
     to validate both default and nn scaling filters

Cc: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
Cc: Petri Latvala <petri.latvala@intel.com>
Cc: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
Signed-off-by: Swati Sharma <swati2.sharma@intel.com>
---
 lib/igt_kms.c                    | 16 +++++++++++
 lib/igt_kms.h                    |  1 +
 tests/i915/kms_flip_scaled_crc.c | 48 +++++++++++++++++++++++++++++---
 3 files changed, 61 insertions(+), 4 deletions(-)

diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index 626a2567..fc3ad68b 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -912,6 +912,22 @@ const char *kmstest_connector_status_str(int status)
 	return find_type_name(connector_status_names, status);
 }
 
+enum drm_scaling_filter {
+	DRM_SCALING_FILTER_DEFAULT,
+	DRM_SCALING_FILTER_NEAREST_NEIGHBOR,
+};
+
+static const struct type_name drm_scaling_filter[] = {
+	{ DRM_SCALING_FILTER_DEFAULT, "Default" },
+	{ DRM_SCALING_FILTER_NEAREST_NEIGHBOR, "Nearest Neighbor" },
+	{}
+};
+
+const char *kmstest_scaling_filter_str(int filter)
+{
+	return find_type_name(drm_scaling_filter, filter);
+}
+
 static const struct type_name connector_type_names[] = {
 	{ DRM_MODE_CONNECTOR_Unknown, "Unknown" },
 	{ DRM_MODE_CONNECTOR_VGA, "VGA" },
diff --git a/lib/igt_kms.h b/lib/igt_kms.h
index bd05a13b..4b67708d 100644
--- a/lib/igt_kms.h
+++ b/lib/igt_kms.h
@@ -107,6 +107,7 @@ enum igt_custom_edid_type {
 const char *kmstest_encoder_type_str(int type);
 const char *kmstest_connector_status_str(int status);
 const char *kmstest_connector_type_str(int type);
+const char *kmstest_scaling_filter_str(int filter);
 
 void kmstest_dump_mode(drmModeModeInfo *mode);
 #define MAX_HDISPLAY_PER_PIPE 5120
diff --git a/tests/i915/kms_flip_scaled_crc.c b/tests/i915/kms_flip_scaled_crc.c
index e291add4..91851e5e 100644
--- a/tests/i915/kms_flip_scaled_crc.c
+++ b/tests/i915/kms_flip_scaled_crc.c
@@ -26,6 +26,11 @@
 
 IGT_TEST_DESCRIPTION("Test flipping between scaled/nonscaled framebuffers");
 
+enum {
+	DRM_SCALING_FILTER_DEFAULT,
+	DRM_SCALING_FILTER_NEAREST_NEIGHBOR,
+};
+
 typedef struct {
 	int drm_fd;
 	igt_display_t display;
@@ -476,7 +481,7 @@ static void clear_lut(data_t *data, enum pipe pipe)
 
 static void test_flip_to_scaled(data_t *data, uint32_t index,
 				enum pipe pipe, igt_output_t *output,
-				drmModeModeInfoPtr modetoset)
+				drmModeModeInfoPtr modetoset, int flags)
 {
 	igt_plane_t *primary;
 	igt_crc_t small_crc, big_crc;
@@ -513,6 +518,7 @@ static void test_flip_to_scaled(data_t *data, uint32_t index,
 	igt_output_set_pipe(output, pipe);
 
 	primary = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY);
+	igt_skip_on_f (!igt_plane_has_prop(primary, IGT_PLANE_SCALING_FILTER), "Plane scaling filter prop not supported");
 	igt_skip_on_f (!igt_plane_has_format_mod(primary, data->small_fb.drm_format,
 				      data->small_fb.modifier) ||
 		       !igt_plane_has_format_mod(primary, data->big_fb.drm_format,
@@ -528,6 +534,8 @@ static void test_flip_to_scaled(data_t *data, uint32_t index,
 	data->pipe_crc = igt_pipe_crc_new(data->drm_fd, pipe,
 					  INTEL_PIPE_CRC_SOURCE_AUTO);
 
+	igt_plane_set_prop_enum(primary, IGT_PLANE_SCALING_FILTER, kmstest_scaling_filter_str(flags));
+
 	igt_plane_set_position(primary, 0, 0);
 	igt_plane_set_fb(primary, &data->small_fb);
 	igt_plane_set_size(primary, data->attemptmodewidth,
@@ -613,9 +621,39 @@ igt_main
 		}
 	}
 
+	igt_describe("Tests with default plane scaling filter");
+	for (int index = 0; index < ARRAY_SIZE(flip_scenario_test); index++) {
+		igt_describe(flip_scenario_test[index].describe);
+		igt_subtest_with_dynamic_f("default-%s", flip_scenario_test[index].name) {
+			free_fbs(&data);
+			for_each_pipe(&data.display, pipe) {
+				bool found = false;
+				for_each_valid_output_on_pipe(&data.display, pipe, output) {
+					modetoset = find_mode(&data, output);
+					if (modetoset) {
+						found = true;
+						igt_dynamic_f("pipe-%s-valid-mode", kmstest_pipe_name(pipe))
+							test_flip_to_scaled(&data, index, pipe, output, modetoset,
+									    DRM_SCALING_FILTER_DEFAULT);
+						break;
+					}
+				}
+				if (!found) {
+					for_each_valid_output_on_pipe(&data.display, pipe, output) {
+						igt_dynamic_f("pipe-%s-default-mode", kmstest_pipe_name(pipe))
+							test_flip_to_scaled(&data, index, pipe, output, NULL,
+									    DRM_SCALING_FILTER_DEFAULT);
+					}
+				}
+				break;
+			}
+		}
+	}
+
+	igt_describe("Tests with nearest neighbor plane scaling filter");
 	for (int index = 0; index < ARRAY_SIZE(flip_scenario_test); index++) {
 		igt_describe(flip_scenario_test[index].describe);
-		igt_subtest_with_dynamic(flip_scenario_test[index].name) {
+		igt_subtest_with_dynamic_f("nn-%s", flip_scenario_test[index].name) {
 			free_fbs(&data);
 			for_each_pipe(&data.display, pipe) {
 				bool found = false;
@@ -624,14 +662,16 @@ igt_main
 					if (modetoset) {
 						found = true;
 						igt_dynamic_f("pipe-%s-valid-mode", kmstest_pipe_name(pipe))
-							test_flip_to_scaled(&data, index, pipe, output, modetoset);
+							test_flip_to_scaled(&data, index, pipe, output, modetoset,
+									    DRM_SCALING_FILTER_NEAREST_NEIGHBOR);
 						break;
 					}
 				}
 				if (!found) {
 					for_each_valid_output_on_pipe(&data.display, pipe, output) {
 						igt_dynamic_f("pipe-%s-default-mode", kmstest_pipe_name(pipe))
-							test_flip_to_scaled(&data, index, pipe, output, NULL);
+							test_flip_to_scaled(&data, index, pipe, output, NULL,
+									    DRM_SCALING_FILTER_NEAREST_NEIGHBOR);
 					}
 				}
 				break;
-- 
2.25.1

  parent reply	other threads:[~2022-06-28 18:42 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-28 18:43 [igt-dev] [PATCH i-g-t 1/4] tests/i915/kms_flip_scaled_crc: Convert tests to dynamic Swati Sharma
2022-06-28 18:43 ` [igt-dev] [PATCH i-g-t 2/4] tests/i915/kms_flip_scaled_crc: Add new tests covering modifiers and pixel-formats Swati Sharma
2022-06-28 18:43 ` [igt-dev] [PATCH i-g-t 3/4] lib/igt_kms: Add scaling filter property Swati Sharma
2022-06-28 18:43 ` Swati Sharma [this message]
2022-06-28 20:08 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,1/4] tests/i915/kms_flip_scaled_crc: Convert tests to dynamic Patchwork
2022-06-29 13:11 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork
2022-06-30 10:15 [igt-dev] [PATCH i-g-t 1/4] " Juha-Pekka Heikkila
2022-06-30 10:15 ` [igt-dev] [PATCH i-g-t 4/4] tests/kms_flip_scaled_crc: Validate NN scaling filter Juha-Pekka Heikkila
2022-07-01  6:11   ` Kahola, Mika

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=20220628184304.19496-4-swati2.sharma@intel.com \
    --to=swati2.sharma@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=petri.latvala@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.