From patchwork Thu Jun 26 17:24:32 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Harrison X-Patchwork-Id: 4429301 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 750A6BEECB for ; Thu, 26 Jun 2014 17:26:21 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 618062038D for ; Thu, 26 Jun 2014 17:26:20 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id E38B6201F4 for ; Thu, 26 Jun 2014 17:26:15 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 05D616E2E8; Thu, 26 Jun 2014 10:26:15 -0700 (PDT) X-Original-To: Intel-GFX@lists.freedesktop.org Delivered-To: Intel-GFX@lists.freedesktop.org Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by gabe.freedesktop.org (Postfix) with ESMTP id 190336E262 for ; Thu, 26 Jun 2014 10:26:07 -0700 (PDT) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga101.fm.intel.com with ESMTP; 26 Jun 2014 10:26:06 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.01,554,1400050800"; d="scan'208";a="561435018" Received: from johnharr-linux.iwi.intel.com ([172.28.253.52]) by fmsmga002.fm.intel.com with ESMTP; 26 Jun 2014 10:25:51 -0700 From: John.C.Harrison@Intel.com To: Intel-GFX@lists.freedesktop.org Date: Thu, 26 Jun 2014 18:24:32 +0100 Message-Id: <1403803475-16337-42-git-send-email-John.C.Harrison@Intel.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1403803475-16337-1-git-send-email-John.C.Harrison@Intel.com> References: <1403803475-16337-1-git-send-email-John.C.Harrison@Intel.com> Organization: Intel Corporation (UK) Ltd. - Co. Reg. #1134945 - Pipers Way, Swindon SN3 1RJ Subject: [Intel-gfx] [RFC 41/44] drm/i915: Added validation callback to trace points X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: John Harrison The validation tests require hooks into the GPU scheduler to allow them to analyse what the scheduler is doing internally. --- drivers/gpu/drm/i915/i915_scheduler.c | 4 ++++ drivers/gpu/drm/i915/i915_scheduler.h | 16 ++++++++++++++++ drivers/gpu/drm/i915/i915_trace.h | 16 ++++++++++++++++ 3 files changed, 36 insertions(+) diff --git a/drivers/gpu/drm/i915/i915_scheduler.c b/drivers/gpu/drm/i915/i915_scheduler.c index 0eb6a31..8d45b73 100644 --- a/drivers/gpu/drm/i915/i915_scheduler.c +++ b/drivers/gpu/drm/i915/i915_scheduler.c @@ -26,6 +26,10 @@ #include "intel_drv.h" #include "i915_scheduler.h" +i915_scheduler_validation_callback_type + i915_scheduler_validation_callback = NULL; +EXPORT_SYMBOL(i915_scheduler_validation_callback); + bool i915_scheduler_is_enabled(struct drm_device *dev) { #ifdef CONFIG_DRM_I915_SCHEDULER diff --git a/drivers/gpu/drm/i915/i915_scheduler.h b/drivers/gpu/drm/i915/i915_scheduler.h index f86b687..2f8c566 100644 --- a/drivers/gpu/drm/i915/i915_scheduler.h +++ b/drivers/gpu/drm/i915/i915_scheduler.h @@ -196,4 +196,20 @@ void i915_scheduler_file_queue_dec(struct drm_file *file); int i915_gem_do_execbuffer_final(struct i915_execbuffer_params *params); +/* A callback mechanism to allow validation tests to hook into the internal + * state of the scheduler. */ +enum i915_scheduler_validation_op { + i915_scheduler_validation_op_state_change = 1, + i915_scheduler_validation_op_queue, + i915_scheduler_validation_op_dispatch, + i915_scheduler_validation_op_complete, +}; +typedef int (*i915_scheduler_validation_callback_type) + (enum i915_scheduler_validation_op op, + struct intel_engine_cs *ring, + uint32_t seqno, + struct i915_scheduler_queue_entry *node); +extern i915_scheduler_validation_callback_type + i915_scheduler_validation_callback; + #endif /* _I915_SCHEDULER_H_ */ diff --git a/drivers/gpu/drm/i915/i915_trace.h b/drivers/gpu/drm/i915/i915_trace.h index 40b1c6f..2029d8b 100644 --- a/drivers/gpu/drm/i915/i915_trace.h +++ b/drivers/gpu/drm/i915/i915_trace.h @@ -369,6 +369,10 @@ TRACE_EVENT(i915_gem_ring_dispatch, __entry->seqno = seqno; __entry->flags = flags; i915_trace_irq_get(ring, seqno); + if (i915_scheduler_validation_callback) + i915_scheduler_validation_callback( + i915_scheduler_validation_op_dispatch, + ring, seqno, NULL); ), TP_printk("dev=%u, ring=%u, seqno=%u, flags=%x", @@ -660,6 +664,10 @@ TRACE_EVENT(i915_scheduler_landing, __entry->ring = ring->id; __entry->seqno = seqno; __entry->status = node ? node->status : ~0U; + if (i915_scheduler_validation_callback) + i915_scheduler_validation_callback( + i915_scheduler_validation_op_complete, + ring, seqno, node); ), TP_printk("ring=%d, seqno=%d, status=%d", @@ -740,6 +748,10 @@ TRACE_EVENT(i915_scheduler_node_state_change, __entry->ring = ring->id; __entry->seqno = node->params.seqno; __entry->status = node->status; + if (i915_scheduler_validation_callback) + i915_scheduler_validation_callback( + i915_scheduler_validation_op_state_change, + ring, node->params.seqno, node); ), TP_printk("ring=%d, seqno=%d, status=%d", @@ -789,6 +801,10 @@ TRACE_EVENT(i915_gem_ring_queue, TP_fast_assign( __entry->ring = ring->id; __entry->seqno = node->params.seqno; + if (i915_scheduler_validation_callback) + i915_scheduler_validation_callback( + i915_scheduler_validation_op_queue, + ring, node->params.seqno, node); ), TP_printk("ring=%d, seqno=%d", __entry->ring, __entry->seqno)