From patchwork Fri Apr 28 17:26:09 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: oscar.mateo@intel.com X-Patchwork-Id: 9705591 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id B4D83601D7 for ; Sat, 29 Apr 2017 00:26:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9D5A52869C for ; Sat, 29 Apr 2017 00:26:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9053F286AC; Sat, 29 Apr 2017 00:26:20 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00, DATE_IN_PAST_06_12, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 3000E2869C for ; Sat, 29 Apr 2017 00:26:19 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5D91789159; Sat, 29 Apr 2017 00:26:18 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by gabe.freedesktop.org (Postfix) with ESMTPS id 2196789159 for ; Sat, 29 Apr 2017 00:26:17 +0000 (UTC) Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga105.jf.intel.com with ESMTP; 28 Apr 2017 17:26:16 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.37,389,1488873600"; d="scan'208";a="95232958" Received: from omateolo-linux.fm.intel.com ([10.1.27.118]) by fmsmga005.fm.intel.com with ESMTP; 28 Apr 2017 17:26:16 -0700 From: Oscar Mateo To: intel-gfx@lists.freedesktop.org Date: Fri, 28 Apr 2017 17:26:09 +0000 Message-Id: <1493400369-33879-1-git-send-email-oscar.mateo@intel.com> X-Mailer: git-send-email 1.9.1 Subject: [Intel-gfx] [PATCH] drm/i915: New vfunc prepare_request X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 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-Virus-Scanned: ClamAV using ClamSMTP This will be more useful later to support platforms that need to emit HW commands at the beginning of every request (more general than emitting things at the beginning of every batchbuffer, which is already covered by emit_bb_start). Cc: Chris Wilson Cc: Joonas Lahtinen Signed-off-by: Oscar Mateo --- drivers/gpu/drm/i915/intel_lrc.c | 17 ++++++++++++----- drivers/gpu/drm/i915/intel_ringbuffer.h | 1 + 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_lrc.c b/drivers/gpu/drm/i915/intel_lrc.c index 9488578..a5c055a 100644 --- a/drivers/gpu/drm/i915/intel_lrc.c +++ b/drivers/gpu/drm/i915/intel_lrc.c @@ -687,6 +687,15 @@ static bool insert_request(struct i915_priotree *pt, struct rb_root *root) return first; } +static int execlists_prepare_request(struct drm_i915_gem_request *request) +{ + u32 *cs = intel_ring_begin(request, 0); + if (IS_ERR(cs)) + return PTR_ERR(cs); + + return 0; +} + static void execlists_submit_request(struct drm_i915_gem_request *request) { struct intel_engine_cs *engine = request->engine; @@ -879,7 +888,6 @@ static int execlists_request_alloc(struct drm_i915_gem_request *request) { struct intel_engine_cs *engine = request->engine; struct intel_context *ce = &request->ctx->engine[engine->id]; - u32 *cs; int ret; GEM_BUG_ON(!ce->pin_count); @@ -904,11 +912,9 @@ static int execlists_request_alloc(struct drm_i915_gem_request *request) goto err; } - cs = intel_ring_begin(request, 0); - if (IS_ERR(cs)) { - ret = PTR_ERR(cs); + ret = engine->prepare_request(request); + if (ret) goto err_unreserve; - } if (!ce->initialised) { ret = engine->init_context(request); @@ -1650,6 +1656,7 @@ void intel_logical_ring_cleanup(struct intel_engine_cs *engine) static void execlists_set_default_submission(struct intel_engine_cs *engine) { + engine->prepare_request = execlists_prepare_request; engine->submit_request = execlists_submit_request; engine->schedule = execlists_schedule; engine->irq_tasklet.func = intel_lrc_irq_handler; diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.h b/drivers/gpu/drm/i915/intel_ringbuffer.h index d901831..67de978 100644 --- a/drivers/gpu/drm/i915/intel_ringbuffer.h +++ b/drivers/gpu/drm/i915/intel_ringbuffer.h @@ -303,6 +303,7 @@ struct intel_engine_cs { void (*emit_breadcrumb)(struct drm_i915_gem_request *req, u32 *cs); int emit_breadcrumb_sz; + int (*prepare_request)(struct drm_i915_gem_request *req); /* Pass the request to the hardware queue (e.g. directly into * the legacy ringbuffer or to the end of an execlist).