[PATCH 1/2] drm/i915/selftests: Don't try to queue a request with zero delay

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

 



Instead of trying to create a timer with zero delay (i.e. with expires
set to the current jiffies and not the future, an already expired
timer), execute that request immediately.

Signed-off-by: Chris Wilson <chris@xxxxxxxxxxxxxxxxxx>
---
 drivers/gpu/drm/i915/selftests/mock_engine.c | 22 +++++++++++++++-------
 1 file changed, 15 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/i915/selftests/mock_engine.c b/drivers/gpu/drm/i915/selftests/mock_engine.c
index 331c2b09869e..24ea1ef7efec 100644
--- a/drivers/gpu/drm/i915/selftests/mock_engine.c
+++ b/drivers/gpu/drm/i915/selftests/mock_engine.c
@@ -39,15 +39,16 @@ static void hw_delay_complete(struct timer_list *t)
 
 	spin_lock(&engine->hw_lock);
 
-	request = first_request(engine);
-	if (request) {
+	while ((request = first_request(engine))) {
 		list_del_init(&request->link);
 		mock_seqno_advance(&engine->base, request->base.global_seqno);
+		if (request->delay)
+			break;
 	}
-
-	request = first_request(engine);
-	if (request)
+	if (request) {
+		GEM_BUG_ON(!request->delay);
 		mod_timer(&engine->hw_delay, jiffies + request->delay);
+	}
 
 	spin_unlock(&engine->hw_lock);
 }
@@ -98,8 +99,15 @@ static void mock_submit_request(struct drm_i915_gem_request *request)
 
 	spin_lock_irq(&engine->hw_lock);
 	list_add_tail(&mock->link, &engine->hw_queue);
-	if (mock->link.prev == &engine->hw_queue)
-		mod_timer(&engine->hw_delay, jiffies + mock->delay);
+	if (mock->link.prev == &engine->hw_queue) {
+		if (mock->delay) {
+			mod_timer(&engine->hw_delay, jiffies + mock->delay);
+		} else {
+			list_del_init(&mock->link);
+			mock_seqno_advance(&engine->base,
+					   mock->base.global_seqno);
+		}
+	}
 	spin_unlock_irq(&engine->hw_lock);
 }
 
-- 
2.15.0.rc2

_______________________________________________
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