From patchwork Tue Mar 27 10:26:18 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: kevin.rogovin@intel.com X-Patchwork-Id: 10309703 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 350F9600F6 for ; Tue, 27 Mar 2018 10:26:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 20CE229BE6 for ; Tue, 27 Mar 2018 10:26:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 15A8429BE8; Tue, 27 Mar 2018 10:26:55 +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=-4.2 required=2.0 tests=BAYES_00, 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 C6FC729BE6 for ; Tue, 27 Mar 2018 10:26:54 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 09A556E5E1; Tue, 27 Mar 2018 10:26:53 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by gabe.freedesktop.org (Postfix) with ESMTPS id 44E2E6E5DA for ; Tue, 27 Mar 2018 10:26:44 +0000 (UTC) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 27 Mar 2018 03:26:43 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.48,367,1517904000"; d="scan'208";a="38466889" Received: from sinekoff-mobl1.ger.corp.intel.com (HELO LittleBigTrouble.ger.corp.intel.com) ([10.252.34.146]) by orsmga003.jf.intel.com with ESMTP; 27 Mar 2018 03:26:29 -0700 From: kevin.rogovin@intel.com To: intel-gfx@lists.freedesktop.org, abdiel.janulgue@linux.intel.com, joonas.lahtinen@linux.intel.com Date: Tue, 27 Mar 2018 13:26:18 +0300 Message-Id: <1522146379-9358-5-git-send-email-kevin.rogovin@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1522146379-9358-1-git-send-email-kevin.rogovin@intel.com> References: <1522146379-9358-1-git-send-email-kevin.rogovin@intel.com> Subject: [Intel-gfx] [PATCH v3 4/5] i915: add doc for synchronization X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Rogovin MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP From: Kevin Rogovin Signed-off-by: Kevin Rogovin --- drivers/gpu/drm/i915/i915_request.h | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/drivers/gpu/drm/i915/i915_request.h b/drivers/gpu/drm/i915/i915_request.h index 7d6eb82..093b9d7 100644 --- a/drivers/gpu/drm/i915/i915_request.h +++ b/drivers/gpu/drm/i915/i915_request.h @@ -57,6 +57,34 @@ struct i915_dependency { #define I915_DEPENDENCY_ALLOC BIT(0) }; +/** + * DOC: Synchronization + * + * The i915 kernel driver needs to also synchronize the ordering in which + * to submit batchbuffers in following cases. + * + * 1. When a fixed file descriptor is used to submit work to different + * engines of the GPU; the issue is that the different engines run + * independently to each other but the kernel interface guarantees + * that the memory writes of previously issued commands within a + * fixed file descriptor will be seen by the next command. + * + * 2. When an ioctl to submit a batchbuffer has an in-fence that represents + * an action that needs to be completed or submitted before before the + * given command is submitted. + * + * Rather than waiting, the i915 kernel driver builds a data structure tree + * (represented by ``i915_priotree``) to store dependencies of different + * batchbuffer execute requests, the requests themselves are tracked via + * ``i915_request`` structs. The critical point that action of processing + * a user request does NOT wait for the dependencies to finish or even be + * submitted to the GPU. Instead, an ``i915_request`` structure is created + * and it is added to the dependency tree; when its dependencies are + * satisfied, then the call back updates the tail pointer of the ring buffer + * where the command was placed. This way, execute batchbuffer requests + * return from the kernel almost immediately. + */ + /* * "People assume that time is a strict progression of cause to effect, but * actually, from a nonlinear, non-subjective viewpoint, it's more like a big