public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
To: intel-gfx@lists.freedesktop.org
Subject: [PATCH i-g-t v2 08/14] lib/igt_kms: Add igt_$obj_has_prop functions
Date: Thu, 12 Oct 2017 13:54:29 +0200	[thread overview]
Message-ID: <20171012115435.18880-9-maarten.lankhorst@linux.intel.com> (raw)
In-Reply-To: <20171012115435.18880-1-maarten.lankhorst@linux.intel.com>

This allows test to test whether a property is supported, in
a nice and clean way. It removes the need for special case
functions like igt_plane_supports_rotation.

Convert the users of igt_plane_supports_rotation and remove the
extra check in drm_plane_commit, this is already checked below
when setting plane properties.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
---
 lib/igt_kms.c                     |  4 ---
 lib/igt_kms.h                     | 62 ++++++++++++++++++++++++++++++++++++---
 tests/kms_crtc_background_color.c |  2 +-
 tests/kms_rotation_crc.c          |  6 ++--
 4 files changed, 62 insertions(+), 12 deletions(-)

diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index ad0855d0c8fa..339c11843154 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -2110,10 +2110,6 @@ static int igt_drm_plane_commit(igt_plane_t *plane,
 
 	igt_assert(plane->drm_plane);
 
-	/* it's an error to try an unsupported feature */
-	igt_assert(igt_plane_supports_rotation(plane) ||
-		   !igt_plane_is_prop_changed(plane, IGT_PLANE_ROTATION));
-
 	fb_id = igt_plane_get_fb_id(plane);
 	crtc_id = pipe->crtc_id;
 
diff --git a/lib/igt_kms.h b/lib/igt_kms.h
index b8a04af73e2f..916cd359519a 100644
--- a/lib/igt_kms.h
+++ b/lib/igt_kms.h
@@ -374,10 +374,6 @@ bool igt_pipe_get_property(igt_pipe_t *pipe, const char *name,
 			   uint32_t *prop_id, uint64_t *value,
 			   drmModePropertyPtr *prop);
 
-static inline bool igt_plane_supports_rotation(igt_plane_t *plane)
-{
-	return plane->props[IGT_PLANE_ROTATION] != 0;
-}
 void igt_pipe_request_out_fence(igt_pipe_t *pipe);
 
 void igt_plane_set_fb(igt_plane_t *plane, struct igt_fb *fb);
@@ -493,6 +489,20 @@ static inline bool igt_output_is_connected(igt_output_t *output)
 
 #define IGT_FIXED(i,f)	((i) << 16 | (f))
 
+/**
+ * igt_plane_has_prop - Check whether plane supports a given property.
+ *
+ * @plane: Plane to check.
+ * @prop: Property to check.
+ *
+ * Returns: True if the property is supported, otherwise false.
+ */
+static inline bool
+igt_plane_has_prop(igt_plane_t *plane, enum igt_atomic_plane_properties prop)
+{
+	return plane->props[prop];
+}
+
 #define igt_plane_is_prop_changed(plane, prop) \
 	(!!((plane)->changed & (1 << (prop))))
 
@@ -512,6 +522,20 @@ extern void igt_plane_replace_prop_blob(igt_plane_t *plane,
 					enum igt_atomic_plane_properties prop,
 					const void *ptr, size_t length);
 
+/**
+ * igt_output_has_prop - Check whether output supports a given property.
+ *
+ * @output: Output to check.
+ * @prop: Property to check.
+ *
+ * Returns: True if the property is supported, otherwise false.
+ */
+static inline bool
+igt_output_has_prop(igt_output_t *output, enum igt_atomic_connector_properties prop)
+{
+	return output->props[prop];
+}
+
 #define igt_output_is_prop_changed(output, prop) \
 	(!!((output)->changed & (1 << (prop))))
 #define igt_output_set_prop_changed(output, prop) \
@@ -530,6 +554,36 @@ extern void igt_output_replace_prop_blob(igt_output_t *output,
 					 enum igt_atomic_connector_properties prop,
 					 const void *ptr, size_t length);
 
+/**
+ * igt_pipe_obj_has_prop - Check whether pipe supports a given property.
+ *
+ * @pipe: Pipe to check.
+ * @prop: Property to check.
+ *
+ * Returns: True if the property is supported, otherwise false.
+ */
+static inline bool
+igt_pipe_obj_has_prop(igt_pipe_t *pipe, enum igt_atomic_crtc_properties prop)
+{
+	return pipe->props[prop];
+}
+
+/**
+ * igt_pipe_has_prop - Check whether pipe supports a given property.
+ *
+ * @display: Pointer to display.
+ * @pipe: Pipe to check.
+ * @prop: Property to check.
+ *
+ * Returns: True if the property is supported, otherwise false.
+ */
+static inline bool
+igt_pipe_has_prop(igt_display_t *display, enum pipe pipe,
+		  enum igt_atomic_connector_properties prop)
+{
+	return display->pipes[pipe].props[prop];
+}
+
 #define igt_pipe_obj_is_prop_changed(pipe_obj, prop) \
 	(!!((pipe_obj)->changed & (1 << (prop))))
 
diff --git a/tests/kms_crtc_background_color.c b/tests/kms_crtc_background_color.c
index 659a30b90219..414cc82f3e8b 100644
--- a/tests/kms_crtc_background_color.c
+++ b/tests/kms_crtc_background_color.c
@@ -137,7 +137,7 @@ static void test_crtc_background(data_t *data)
 		igt_output_set_pipe(output, pipe);
 
 		plane = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY);
-		igt_require(plane->pipe->props[IGT_CRTC_BACKGROUND]);
+		igt_require(igt_plane_has_prop(plane, IGT_CRTC_BACKGROUND));
 
 		prepare_crtc(data, output, pipe, plane, 1, PURPLE, BLACK64);
 
diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c
index b8327dfa0d83..27d1f8060234 100644
--- a/tests/kms_rotation_crc.c
+++ b/tests/kms_rotation_crc.c
@@ -351,7 +351,7 @@ static void test_plane_rotation(data_t *data, int plane_type)
 		igt_output_set_pipe(output, pipe);
 
 		plane = igt_output_get_plane_type(output, plane_type);
-		igt_require(igt_plane_supports_rotation(plane));
+		igt_require(igt_plane_has_prop(plane, IGT_PLANE_ROTATION));
 
 		prepare_crtc(data, output, pipe, plane, commit);
 
@@ -438,7 +438,7 @@ static void test_plane_rotation_ytiled_obj(data_t *data,
 	int ret;
 
 	plane = igt_output_get_plane_type(output, plane_type);
-	igt_require(igt_plane_supports_rotation(plane));
+	igt_require(igt_plane_has_prop(plane, IGT_PLANE_ROTATION));
 
 	if (plane_type == DRM_PLANE_TYPE_PRIMARY || plane_type == DRM_PLANE_TYPE_CURSOR)
 		commit = COMMIT_UNIVERSAL;
@@ -504,7 +504,7 @@ static void test_plane_rotation_exhaust_fences(data_t *data,
 	int i, ret;
 
 	plane = igt_output_get_plane_type(output, plane_type);
-	igt_require(igt_plane_supports_rotation(plane));
+	igt_require(igt_plane_has_prop(plane, IGT_PLANE_ROTATION));
 
 	if (plane_type == DRM_PLANE_TYPE_PRIMARY || plane_type == DRM_PLANE_TYPE_CURSOR)
 		commit = COMMIT_UNIVERSAL;
-- 
2.14.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  parent reply	other threads:[~2017-10-12 11:54 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-12 11:54 [PATCH i-g-t v2 00/14] lib/igt_kms: Rewrite property handling to better match atomic Maarten Lankhorst
2017-10-12 11:54 ` [PATCH i-g-t v2 01/14] lib/igt_kms: Rework connector properties to be more atomic, v2 Maarten Lankhorst
2017-10-12 11:54 ` [PATCH i-g-t v2 02/14] lib/igt_kms: Rework plane properties to be more atomic, v5 Maarten Lankhorst
2017-10-19  9:08   ` Mika Kahola
2017-10-19  9:44     ` Maarten Lankhorst
2017-10-20  8:03       ` Mika Kahola
2017-10-12 11:54 ` [PATCH i-g-t v2 03/14] lib/igt_kms: Rework pipe properties to be more atomic, v7 Maarten Lankhorst
2017-10-19 10:28   ` Mika Kahola
2018-03-05 14:37   ` Maxime Ripard
2018-03-06 13:41     ` Daniel Vetter
2018-03-06 13:47       ` Maarten Lankhorst
2017-10-12 11:54 ` [PATCH i-g-t v2 04/14] lib/igt_kms: Allow setting any plane property through the universal path Maarten Lankhorst
2017-10-19 11:04   ` Mika Kahola
2017-10-12 11:54 ` [PATCH i-g-t v2 05/14] lib/igt_kms: Allow setting any output property through the !atomic paths Maarten Lankhorst
2017-10-20  9:38   ` Mika Kahola
2017-10-12 11:54 ` [PATCH i-g-t v2 06/14] lib/igt_kms: Export property blob functions for output/pipe/plane, v2 Maarten Lankhorst
2017-10-19 11:24   ` Mika Kahola
2017-10-12 11:54 ` [PATCH i-g-t v2 07/14] lib/igt_kms: Unexport broadcast rgb API Maarten Lankhorst
2017-10-19 11:28   ` Mika Kahola
2017-10-12 11:54 ` Maarten Lankhorst [this message]
2017-10-12 15:33   ` [PATCH i-g-t v2] lib/igt_kms: Add igt_$obj_has_prop functions, v2 Maarten Lankhorst
2017-10-19 12:06     ` Mika Kahola
2017-10-12 11:54 ` [PATCH i-g-t v2 09/14] lib/igt_kms: Add igt_$obj_get_prop functions Maarten Lankhorst
2017-10-19 12:58   ` Mika Kahola
2017-10-12 11:54 ` [PATCH i-g-t v2 10/14] lib/igt_kms: Remove igt_pipe_get_property Maarten Lankhorst
2017-10-19 13:18   ` Mika Kahola
2017-10-12 11:54 ` [PATCH i-g-t v2 11/14] lib/igt_kms: Remove igt_crtc_set_background() Maarten Lankhorst
2017-10-20  6:33   ` Mika Kahola
2017-10-12 11:54 ` [PATCH i-g-t v2 12/14] tests/kms_color: Rework tests slightly to work better with new atomic api Maarten Lankhorst
2017-10-20  7:14   ` Mika Kahola
2017-10-12 11:54 ` [PATCH i-g-t v2 13/14] tests/chamelium: Remove reliance on output->config.pipe Maarten Lankhorst
2017-10-20  7:15   ` Mika Kahola
2017-10-12 11:54 ` [PATCH i-g-t v2 14/14] tests/kms_atomic: Convert/rewrite tests to use igt_kms framework Maarten Lankhorst
2017-10-12 15:33   ` [PATCH i-g-t v2] tests/kms_atomic: Convert/rewrite tests to use igt_kms framework, v2 Maarten Lankhorst
2017-10-20 10:02     ` Mika Kahola
2017-10-20 10:08       ` Maarten Lankhorst
2017-10-20 10:16         ` Mika Kahola
2017-10-20 11:43           ` Maarten Lankhorst
2017-10-12 12:28 ` ✓ Fi.CI.BAT: success for lib/igt_kms: Rewrite property handling to better match atomic. (rev4) Patchwork
2017-10-12 15:01 ` ✗ Fi.CI.IGT: failure " Patchwork
2017-10-12 16:04 ` ✓ Fi.CI.BAT: success for lib/igt_kms: Rewrite property handling to better match atomic. (rev6) Patchwork
2017-10-12 23:47 ` ✗ Fi.CI.IGT: failure " 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=20171012115435.18880-9-maarten.lankhorst@linux.intel.com \
    --to=maarten.lankhorst@linux.intel.com \
    --cc=intel-gfx@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