From: Mika Kuoppala Subject: [PATCH 4/4] drm/i915: Make next_seqno debugs entry to use i915_gem_seqno_init Date: Mon, 17 Dec 2012 18:44:29 +0200 Message-ID: <1355762669-6806-4-git-send-email-mika.kuoppala@intel.com> References: <1355762669-6806-1-git-send-email-mika.kuoppala@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by gabe.freedesktop.org (Postfix) with ESMTP id 1D83AE5D57 for ; Mon, 17 Dec 2012 08:44:56 -0800 (PST) In-Reply-To: <1355762669-6806-1-git-send-email-mika.kuoppala@intel.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: intel-gfx-bounces+gcfxdi-intel-gfx=m.gmane.org@lists.freedesktop.org Errors-To: intel-gfx-bounces+gcfxdi-intel-gfx=m.gmane.org@lists.freedesktop.org To: intel-gfx@lists.freedesktop.org List-Id: intel-gfx@lists.freedesktop.org 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 --- 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