All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ville Syrjala <ville.syrjala@linux.intel.com>
To: igt-dev@lists.freedesktop.org
Subject: [igt-dev] [PATCH i-g-t v3 3/3] lib/kms: Optimize out redundant plane color encoding/range prop changes
Date: Wed, 21 Apr 2021 01:17:20 +0300	[thread overview]
Message-ID: <20210420221720.14656-3-ville.syrjala@linux.intel.com> (raw)
In-Reply-To: <20210420221720.14656-1-ville.syrjala@linux.intel.com>

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Skip updates to the plane color encoding/range props when changing
the fb, iff the prop values aren't changing.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 lib/igt_kms.c | 33 ++++++++++++++++++++++++---------
 1 file changed, 24 insertions(+), 9 deletions(-)

diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index 9aba7b6e4b40..41dbd8b8c3aa 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -3117,9 +3117,9 @@ static bool igt_mode_object_get_prop_enum_value(int drm_fd, uint32_t id, const c
 	return false;
 }
 
-bool igt_plane_try_prop_enum(igt_plane_t *plane,
-			     enum igt_atomic_plane_properties prop,
-			     const char *val)
+static bool _igt_plane_try_prop_enum(igt_plane_t *plane,
+				     enum igt_atomic_plane_properties prop,
+				     const char *val, bool force)
 {
 	igt_display_t *display = plane->pipe->display;
 	uint64_t uval;
@@ -3130,15 +3130,30 @@ bool igt_plane_try_prop_enum(igt_plane_t *plane,
 						 plane->props[prop], val, &uval))
 		return false;
 
-	igt_plane_set_prop_value(plane, prop, uval);
+	if (force || plane->values[prop] != uval)
+		igt_plane_set_prop_value(plane, prop, uval);
 	return true;
 }
 
+bool igt_plane_try_prop_enum(igt_plane_t *plane,
+			     enum igt_atomic_plane_properties prop,
+			     const char *val)
+{
+	return _igt_plane_try_prop_enum(plane, prop, val, true);
+}
+
 void igt_plane_set_prop_enum(igt_plane_t *plane,
 			     enum igt_atomic_plane_properties prop,
 			     const char *val)
 {
-	igt_assert(igt_plane_try_prop_enum(plane, prop, val));
+	igt_assert(_igt_plane_try_prop_enum(plane, prop, val, true));
+}
+
+static void igt_plane_set_prop_enum_if_changed(igt_plane_t *plane,
+					       enum igt_atomic_plane_properties prop,
+					       const char *val)
+{
+	igt_assert(_igt_plane_try_prop_enum(plane, prop, val, false));
 }
 
 /**
@@ -3979,11 +3994,11 @@ void igt_plane_set_fb(igt_plane_t *plane, struct igt_fb *fb)
 		igt_fb_set_size(fb, plane, fb->width, fb->height);
 
 		if (igt_plane_has_prop(plane, IGT_PLANE_COLOR_ENCODING))
-			igt_plane_set_prop_enum(plane, IGT_PLANE_COLOR_ENCODING,
-				igt_color_encoding_to_str(fb->color_encoding));
+			igt_plane_set_prop_enum_if_changed(plane, IGT_PLANE_COLOR_ENCODING,
+							   igt_color_encoding_to_str(fb->color_encoding));
 		if (igt_plane_has_prop(plane, IGT_PLANE_COLOR_RANGE))
-			igt_plane_set_prop_enum(plane, IGT_PLANE_COLOR_RANGE,
-				igt_color_range_to_str(fb->color_range));
+			igt_plane_set_prop_enum_if_changed(plane, IGT_PLANE_COLOR_RANGE,
+							   igt_color_range_to_str(fb->color_range));
 
 		/* Hack to prioritize the plane on the pipe that last set fb */
 		igt_plane_set_pipe(plane, pipe);
-- 
2.26.3

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

  parent reply	other threads:[~2021-04-20 22:17 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-20 22:17 [igt-dev] [PATCH i-g-t v3 1/3] lib/kms: Commit primary plane props with COMMIT_LEGACY Ville Syrjala
2021-04-20 22:17 ` [igt-dev] [PATCH i-g-t v3 2/3] lib/kms: Reset color encoding to BT.709 Ville Syrjala
2021-04-20 22:17 ` Ville Syrjala [this message]
2021-04-21  0:40 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,v3,1/3] lib/kms: Commit primary plane props with COMMIT_LEGACY Patchwork
2021-04-21  3:42 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
2021-04-21 17:11   ` Ville Syrjälä
2021-04-22 10:01     ` Daniel Vetter
2021-04-22 13:25       ` Ville Syrjälä
2021-04-22 18:00         ` Ville Syrjälä

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=20210420221720.14656-3-ville.syrjala@linux.intel.com \
    --to=ville.syrjala@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 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.