From patchwork Thu Jun 26 17:24:31 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Harrison X-Patchwork-Id: 4429381 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 B3B07BEEAA for ; Thu, 26 Jun 2014 17:26:34 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D7CDD201B4 for ; Thu, 26 Jun 2014 17:26:31 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 01FF7201F4 for ; Thu, 26 Jun 2014 17:26:26 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 170576E2E3; Thu, 26 Jun 2014 10:26:25 -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 F41C26E2CF for ; Thu, 26 Jun 2014 10:26:03 -0700 (PDT) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga101.fm.intel.com with ESMTP; 26 Jun 2014 10:26:03 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.01,554,1400050800"; d="scan'208";a="561435013" Received: from johnharr-linux.iwi.intel.com ([172.28.253.52]) by fmsmga002.fm.intel.com with ESMTP; 26 Jun 2014 10:25:49 -0700 From: John.C.Harrison@Intel.com To: Intel-GFX@lists.freedesktop.org Date: Thu, 26 Jun 2014 18:24:31 +0100 Message-Id: <1403803475-16337-41-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 40/44] drm/i915: REVERTME Hack to allow IGT to test pre-emption 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 In order to test pre-emption, a flag has been added to the execbuffer() API to explicitly request that a given batch buffer is made pre-emptive. This is purely a temporary measure to allow an IGT test to queue pre-emptive and non-preemptive work loads. Note that the final solution will be to add an IOCTL to set the priority of a batch buffer (work in progress elsewhere). The scheduler will then decide to pre-empt or not based on the assigned priority level. --- drivers/gpu/drm/i915/i915_gem_execbuffer.c | 12 ++++++++++++ include/uapi/drm/i915_drm.h | 5 +++++ 2 files changed, 17 insertions(+) diff --git a/drivers/gpu/drm/i915/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/i915_gem_execbuffer.c index 81acdf2..b7d0737 100644 --- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c +++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c @@ -1361,6 +1361,18 @@ i915_gem_do_execbuffer(struct drm_device *dev, void *data, qe.params.mask = mask; qe.params.mode = mode; + /* Hack for testing pre-empting prior to having an official priority API */ + if (qe.params.args_flags & I915_EXEC_PREEMPT) { +#ifdef CONFIG_DRM_I915_SCHEDULER_PREEMPTION + struct i915_scheduler *scheduler = dev_priv->scheduler; + qe.priority += scheduler->priority_level_preempt; +#else + DRM_DEBUG("Buffer flags 0x%X includes PREEMPT!\n", + qe.params.args_flags); +#endif + } + /* Hack for testing pre-empting prior to having an official priority API */ + #ifdef CONFIG_DRM_I915_SCHEDULER /* * Save away the list of objects used by this batch buffer for the diff --git a/include/uapi/drm/i915_drm.h b/include/uapi/drm/i915_drm.h index de6f603..d391222 100644 --- a/include/uapi/drm/i915_drm.h +++ b/include/uapi/drm/i915_drm.h @@ -694,6 +694,11 @@ struct drm_i915_gem_execbuffer2 { #define I915_EXEC_BLT (3<<0) #define I915_EXEC_VEBOX (4<<0) +/* Pre-emption flag + * If this flag is set, this batchbuffer preempts those already submitted + */ +#define I915_EXEC_PREEMPT (1<<5) + /* Used for switching the constants addressing mode on gen4+ RENDER ring. * Gen6+ only supports relative addressing to dynamic state (default) and * absolute addressing.