As this debugs entry can be used to set arbitrary value to next_seqno,
use i915_gem_seqno_init to set the next_seqno.

Signed-off-by: Mika Kuoppala <[email protected]>
---
 drivers/gpu/drm/i915/i915_debugfs.c |   17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_debugfs.c 
b/drivers/gpu/drm/i915/i915_debugfs.c
index 7047c4a..e669e2e 100644
--- a/drivers/gpu/drm/i915/i915_debugfs.c
+++ b/drivers/gpu/drm/i915/i915_debugfs.c
@@ -903,12 +903,17 @@ i915_next_seqno_write(struct file *filp,
        if (ret)
                return ret;
 
-       if (i915_seqno_passed(val, dev_priv->next_seqno)) {
-               dev_priv->next_seqno = val;
-               DRM_DEBUG_DRIVER("Advancing seqno to %u\n", val);
-       } else {
-               ret = -EINVAL;
-       }
+       ret = i915_gem_init_seqno(dev, val - 1);
+       if (ret)
+               return ret;
+
+       dev_priv->next_seqno = val;
+
+       /* Carefully set the last_seqno value so that
+        * wrap detection still works */
+       dev_priv->last_seqno = val - 1;
+       if (dev_priv->last_seqno == 0)
+               dev_priv->last_seqno--;
 
        mutex_unlock(&dev->struct_mutex);
 
-- 
1.7.9.5

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reply via email to