From patchwork Mon Feb 4 14:04:39 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mika Kuoppala X-Patchwork-Id: 2092411 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by patchwork2.kernel.org (Postfix) with ESMTP id A0569DFE82 for ; Mon, 4 Feb 2013 14:05:46 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8CB5AE600A for ; Mon, 4 Feb 2013 06:05:46 -0800 (PST) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by gabe.freedesktop.org (Postfix) with ESMTP id 74647E600B for ; Mon, 4 Feb 2013 06:03:04 -0800 (PST) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga102.jf.intel.com with ESMTP; 04 Feb 2013 06:01:49 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.84,600,1355126400"; d="scan'208";a="280669710" Received: from rosetta.fi.intel.com (HELO rosetta) ([10.237.72.84]) by orsmga002.jf.intel.com with ESMTP; 04 Feb 2013 06:02:53 -0800 Received: by rosetta (Postfix, from userid 1000) id 1C311800BD; Mon, 4 Feb 2013 16:04:56 +0200 (EET) From: Mika Kuoppala To: intel-gfx@lists.freedesktop.org Date: Mon, 4 Feb 2013 16:04:39 +0200 Message-Id: <1359986683-29788-4-git-send-email-mika.kuoppala@intel.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1359986683-29788-1-git-send-email-mika.kuoppala@intel.com> References: <1359986683-29788-1-git-send-email-mika.kuoppala@intel.com> Subject: [Intel-gfx] [RFC] [PATCH 3/7] drm/i915: add reset_status for hw_contexts X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: intel-gfx-bounces+patchwork-intel-gfx=patchwork.kernel.org@lists.freedesktop.org Errors-To: intel-gfx-bounces+patchwork-intel-gfx=patchwork.kernel.org@lists.freedesktop.org For arb-robustness, every context needs to have it's own reset status. Default context will be handled in a identical way as the no-context case in further down in the patch set. For no-context case, the reset status will be stored in the file_priv part. Signed-off-by: Mika Kuoppala --- drivers/gpu/drm/i915/i915_drv.h | 5 +++++ drivers/gpu/drm/i915/i915_gem_context.c | 33 +++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+) diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index b87240f..42fcfb6 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h @@ -1674,6 +1674,11 @@ void i915_gem_context_fini(struct drm_device *dev); void i915_gem_context_close(struct drm_device *dev, struct drm_file *file); int i915_switch_context(struct intel_ring_buffer *ring, struct drm_file *file, int to_id); +void i915_gem_context_free(struct kref *ctx_ref); +int i915_gem_context_get_reset_stats(struct intel_ring_buffer *ring, + struct drm_file *file, + u32 id, + struct i915_reset_stats **rs); int i915_gem_context_create_ioctl(struct drm_device *dev, void *data, struct drm_file *file); int i915_gem_context_destroy_ioctl(struct drm_device *dev, void *data, diff --git a/drivers/gpu/drm/i915/i915_gem_context.c b/drivers/gpu/drm/i915/i915_gem_context.c index a3f06bc..8e0d50c 100644 --- a/drivers/gpu/drm/i915/i915_gem_context.c +++ b/drivers/gpu/drm/i915/i915_gem_context.c @@ -299,6 +299,39 @@ static int context_idr_cleanup(int id, void *p, void *data) return 0; } +int i915_gem_context_get_reset_stats(struct intel_ring_buffer *ring, + struct drm_file *file, + u32 id, + struct i915_reset_stats **rs) +{ + struct drm_i915_private *dev_priv = ring->dev->dev_private; + struct i915_hw_context *to; + + if (dev_priv->hw_contexts_disabled) + return -ENOENT; + + if (ring->id != RCS) + return -EINVAL; + + /* No reset status for default context id, it is in file_priv */ + if (id == DEFAULT_CONTEXT_ID) + return -EINVAL; + + if (rs == NULL) + return -EINVAL; + + if (file == NULL) + return -EINVAL; + + to = i915_gem_context_get(file->driver_priv, id); + if (to == NULL) + return -ENOENT; + + *rs = &to->reset_stats; + + return 0; +} + void i915_gem_context_close(struct drm_device *dev, struct drm_file *file) { struct drm_i915_file_private *file_priv = file->driver_priv;