[PATCH v2 3/4] drm/i915: Throttle cursor flip updates.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Throttle after every vblank and when > 64 updates are queued, to prevent running
higher than max pin count.

For now there's no good way to do fold crtc updates, and to ensure that
we don't run out of cursor pins the best option is to throttle.

Testcase: kms_cursor_legacy
Cc: Ville Syrjälä <ville.syrjala@xxxxxxxxxxxxxxx>
Fixes: a6747b7304a9 ("drm/i915: Make unpin async.")
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@xxxxxxxxxxxxxxx>
---
 drivers/gpu/drm/i915/intel_display.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 21c0a2f3102b..876484270cd2 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -12740,14 +12740,22 @@ static int intel_atomic_prepare_commit(struct drm_device *dev,
 		struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
 		struct intel_flip_work *work;
 
-		if (!state->legacy_cursor_update) {
+		if (!state->legacy_cursor_update ||
+		    atomic_read(&intel_crtc->unpin_work_count) >= 64) {
 			ret = intel_crtc_wait_for_pending_flips(crtc, true);
 			if (ret)
 				return ret;
 
 			if (atomic_read(&intel_crtc->unpin_work_count) >= 2)
 				flush_workqueue(dev_priv->wq);
-		}
+		} else if (list_empty_careful(&intel_crtc->flip_work) &&
+			   atomic_read(&intel_crtc->unpin_work_count) >= 2)
+			/*
+			 * When running a legacy_cursor_update only load,
+			 * unpin_work may never run. Flush after a vblank
+			 * happened to ensure it does.
+			 */
+			flush_workqueue(dev_priv->wq);
 
 		/* test if we need to update something */
 		if (!needs_work(crtc_state))
-- 
2.5.5

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




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux