From patchwork Tue Dec 15 07:27:12 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Manna, Animesh" X-Patchwork-Id: 11974145 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5A671C2BB48 for ; Tue, 15 Dec 2020 07:44:33 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2384722273 for ; Tue, 15 Dec 2020 07:44:33 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2384722273 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=intel-gfx-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id ABF8A6E174; Tue, 15 Dec 2020 07:44:32 +0000 (UTC) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by gabe.freedesktop.org (Postfix) with ESMTPS id 0B3436E170 for ; Tue, 15 Dec 2020 07:44:31 +0000 (UTC) IronPort-SDR: afV77pyjr18BhV5IEnvz8j8WsMyJ47ffALPIAxMOhY1CnpOFoZedKy1CQhC23NE81zK/N+POzz aDUw3BbB13Sg== X-IronPort-AV: E=McAfee;i="6000,8403,9835"; a="172273366" X-IronPort-AV: E=Sophos;i="5.78,420,1599548400"; d="scan'208";a="172273366" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Dec 2020 23:44:29 -0800 IronPort-SDR: 9gLy4X5QWhB4lJIMdsQmJhduzXuTX0WdDpqiboWOORGabZvOR1TojCUrgR3IwmxBRozjlBwTnC m7iwIViTPh2g== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.78,420,1599548400"; d="scan'208";a="336593466" Received: from amanna.iind.intel.com ([10.223.74.93]) by orsmga003.jf.intel.com with ESMTP; 14 Dec 2020 23:44:27 -0800 From: Animesh Manna To: intel-gfx@lists.freedesktop.org Date: Tue, 15 Dec 2020 12:57:12 +0530 Message-Id: <20201215072712.12723-4-animesh.manna@intel.com> X-Mailer: git-send-email 2.26.0 In-Reply-To: <20201215072712.12723-1-animesh.manna@intel.com> References: <20201215072712.12723-1-animesh.manna@intel.com> MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH 3/3] drm/i915/dsb: multi dsb instance support in dsb-commit() X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" Signed-off-by: Animesh Manna --- drivers/gpu/drm/i915/display/intel_dsb.c | 74 +++++++++++++----------- 1 file changed, 39 insertions(+), 35 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_dsb.c b/drivers/gpu/drm/i915/display/intel_dsb.c index c968c9785484..b3f1cc1652b8 100644 --- a/drivers/gpu/drm/i915/display/intel_dsb.c +++ b/drivers/gpu/drm/i915/display/intel_dsb.c @@ -208,46 +208,50 @@ void intel_dsb_commit(const struct intel_crtc_state *crtc_state) struct drm_i915_private *dev_priv = to_i915(dev); enum pipe pipe = crtc->pipe; u32 tail; + int i; - if (!(dsb && dsb->free_pos)) - return; + for (i = 0; i < MAX_DSB_PER_PIPE; i++) { + dsb = crtc_state->dsb[i]; + if (!(dsb && dsb->free_pos)) + continue; - if (!intel_dsb_enable_engine(dev_priv, pipe, dsb->id)) - goto reset; + if (!intel_dsb_enable_engine(dev_priv, pipe, dsb->id)) + goto reset; - if (is_dsb_busy(dev_priv, pipe, dsb->id)) { - drm_err(&dev_priv->drm, - "HEAD_PTR write failed - dsb engine is busy.\n"); - goto reset; - } - intel_de_write(dev_priv, DSB_HEAD(pipe, dsb->id), - i915_ggtt_offset(dsb->vma)); - - tail = ALIGN(dsb->free_pos * 4, CACHELINE_BYTES); - if (tail > dsb->free_pos * 4) - memset(&dsb->cmd_buf[dsb->free_pos], 0, - (tail - dsb->free_pos * 4)); - - if (is_dsb_busy(dev_priv, pipe, dsb->id)) { - drm_err(&dev_priv->drm, - "TAIL_PTR write failed - dsb engine is busy.\n"); - goto reset; - } - drm_dbg_kms(&dev_priv->drm, - "DSB execution started - head 0x%x, tail 0x%x\n", - i915_ggtt_offset(dsb->vma), tail); - intel_de_write(dev_priv, DSB_TAIL(pipe, dsb->id), - i915_ggtt_offset(dsb->vma) + tail); - if (wait_for(!is_dsb_busy(dev_priv, pipe, dsb->id), 1)) { - drm_err(&dev_priv->drm, - "Timed out waiting for DSB workload completion.\n"); - goto reset; - } + if (is_dsb_busy(dev_priv, pipe, dsb->id)) { + drm_err(&dev_priv->drm, + "HEAD_PTR write failed - dsb engine is busy\n"); + goto reset; + } + intel_de_write(dev_priv, DSB_HEAD(pipe, dsb->id), + i915_ggtt_offset(dsb->vma)); + + tail = ALIGN(dsb->free_pos * 4, CACHELINE_BYTES); + if (tail > dsb->free_pos * 4) + memset(&dsb->cmd_buf[dsb->free_pos], 0, + (tail - dsb->free_pos * 4)); + + if (is_dsb_busy(dev_priv, pipe, dsb->id)) { + drm_err(&dev_priv->drm, + "TAIL_PTR write failed - dsb engine is busy\n"); + goto reset; + } + drm_dbg_kms(&dev_priv->drm, + "DSB execution started - head 0x%x, tail 0x%x\n", + i915_ggtt_offset(dsb->vma), tail); + intel_de_write(dev_priv, DSB_TAIL(pipe, dsb->id), + i915_ggtt_offset(dsb->vma) + tail); + if (wait_for(!is_dsb_busy(dev_priv, pipe, dsb->id), 1)) { + drm_err(&dev_priv->drm, + "Timed out waiting for DSB workload completion\n"); + goto reset; + } reset: - dsb->free_pos = 0; - dsb->ins_start_offset = 0; - intel_dsb_disable_engine(dev_priv, pipe, dsb->id); + dsb->free_pos = 0; + dsb->ins_start_offset = 0; + intel_dsb_disable_engine(dev_priv, pipe, dsb->id); + } } /**