Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3087271rwb; Mon, 15 Aug 2022 17:49:12 -0700 (PDT) X-Google-Smtp-Source: AA6agR6YIKeB52IZXWRB5b2UpXU98YPHuJ6hq5lDBPY25Hc9MNZjsS0M1drJ2Ev0DVoTZ9k601dX X-Received: by 2002:a05:6402:42c3:b0:43d:682f:c0ca with SMTP id i3-20020a05640242c300b0043d682fc0camr16676177edc.334.1660610951816; Mon, 15 Aug 2022 17:49:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660610951; cv=none; d=google.com; s=arc-20160816; b=JQCpHyTiUg3DQGZj25nUBXnEmA1jJw8/6bTQD9Y7LbkAL7ElCd4tlbp6NHMce8ZfHS XkhqNIbqTueaAcfn+hZjbYCjxhSO/RQqlTor8sSlvGqm3g0n7XJ3RSsPk0fsSPrDwxtV muQbLN8dAHqbCifwDsdBrrQn36+MUwK9WSzA7T1vIgMza+p65VxT+HC0GoUg6Ejuv4Z8 Bo4UtwEDy2+vXGYaEvozapus2xRoAkDbKFWqfD4EAOc4IkOv50leZohhL4i8aunIpmAS yxSog18RJJEVcDMlohqofEhy1Jesr24cRy33KtUGsLQ35XhKieTPNlqRs5PYxu+qJOfv m5Aw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=yBjpY5QjeS18LcgaRY7zd38SMv/oZjlXvKdpcSr+9xs=; b=ueBHsWOOCkz2VK1wqM2CLipli2u1cK/Obd3UYx6CarMnw5c8dt8Xflcdgy2h0M8qtp vvU97KuH9QtdvVwflN2cD9QrHePPtNqK3GgQgbswN9lD5xcIF01kklS9NCc3aI7OBarn rg7ZKb6Yq2X1A0xyXl023KHTJex1FfcVfEZTg6ndT0UhGKzmKu4R+VdD5/08y/cUC6TP SVqYlQhmlq11YqeMyk3KXIc8hAOcFHgUv0GI8LEQkeciP2yeyEUaOjgGHprR0fGmZLcx rYKFmq0qLM4koDz1/nA4bMosaFYtV/m31SiWveh3C2CxlHBw6o6oxP08TtV1S/THsoq3 Bu8g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=BemnqsKA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id md17-20020a170906ae9100b0072a92eb16b7si8019974ejb.5.2022.08.15.17.48.46; Mon, 15 Aug 2022 17:49:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=BemnqsKA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354569AbiHOXsf (ORCPT + 99 others); Mon, 15 Aug 2022 19:48:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40394 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354467AbiHOXmO (ORCPT ); Mon, 15 Aug 2022 19:42:14 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5B685491CA; Mon, 15 Aug 2022 13:13:32 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 95B27B81154; Mon, 15 Aug 2022 20:13:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F2224C433D7; Mon, 15 Aug 2022 20:13:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660594409; bh=NyLGZrmkN/d+RhugtN39rrIWi6Tif1siwmp5jXnzoNU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BemnqsKAMlgCeEgbnJJ1IRFp47bqjHgDoDOlrDpgonvmSaWB5XsML47Tn7t3azKFq x770NlOx+WlSRbaUp7ousj6wv2KRdk7WWw6whjvGYLdIfdrVpV+0CkWT7od+99RvZm 1srwhaZWa3L0yqzL0TKdIZBGZGYP+feq8ti7IxZs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Abhinav Kumar , Dmitry Baryshkov , Sasha Levin Subject: [PATCH 5.19 0436/1157] drm/msm/dpu: move intf and wb assignment to dpu_encoder_setup_display() Date: Mon, 15 Aug 2022 19:56:32 +0200 Message-Id: <20220815180457.083799772@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180439.416659447@linuxfoundation.org> References: <20220815180439.416659447@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Abhinav Kumar [ Upstream commit b4a624acabe99f2ea912e895529b8b37d1fa909d ] intf and wb resources are not dependent on the rm global state so need not be allocated during dpu_encoder_virt_atomic_mode_set(). Move the allocation of intf and wb resources to dpu_encoder_setup_display() so that we can utilize the hw caps even during atomic_check() phase. Since dpu_encoder_setup_display() already has protection against setting invalid intf_idx and wb_idx, these checks can now be dropped as well. changes in v2: - add phys->hw_intf and phys->hw_wb checks back changes in v3: - correct the Fixes tag Fixes: e02a559a720f ("drm/msm/dpu: make changes to dpu_encoder to support virtual encoder") Signed-off-by: Abhinav Kumar Reviewed-by: Dmitry Baryshkov Patchwork: https://patchwork.freedesktop.org/patch/489885/ Link: https://lore.kernel.org/r/1655406084-17407-1-git-send-email-quic_abhinavk@quicinc.com Signed-off-by: Dmitry Baryshkov Signed-off-by: Sasha Levin --- drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c | 36 ++++++++++----------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c index a1b8c4592943..9b4df3084366 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c @@ -1048,24 +1048,6 @@ static void dpu_encoder_virt_atomic_mode_set(struct drm_encoder *drm_enc, phys->hw_pp = dpu_enc->hw_pp[i]; phys->hw_ctl = to_dpu_hw_ctl(hw_ctl[i]); - if (phys->intf_idx >= INTF_0 && phys->intf_idx < INTF_MAX) - phys->hw_intf = dpu_rm_get_intf(&dpu_kms->rm, phys->intf_idx); - - if (phys->wb_idx >= WB_0 && phys->wb_idx < WB_MAX) - phys->hw_wb = dpu_rm_get_wb(&dpu_kms->rm, phys->wb_idx); - - if (!phys->hw_intf && !phys->hw_wb) { - DPU_ERROR_ENC(dpu_enc, - "no intf or wb block assigned at idx: %d\n", i); - return; - } - - if (phys->hw_intf && phys->hw_wb) { - DPU_ERROR_ENC(dpu_enc, - "invalid phys both intf and wb block at idx: %d\n", i); - return; - } - phys->cached_mode = crtc_state->adjusted_mode; if (phys->ops.atomic_mode_set) phys->ops.atomic_mode_set(phys, crtc_state, conn_state); @@ -2294,7 +2276,25 @@ static int dpu_encoder_setup_display(struct dpu_encoder_virt *dpu_enc, struct dpu_encoder_phys *phys = dpu_enc->phys_encs[i]; atomic_set(&phys->vsync_cnt, 0); atomic_set(&phys->underrun_cnt, 0); + + if (phys->intf_idx >= INTF_0 && phys->intf_idx < INTF_MAX) + phys->hw_intf = dpu_rm_get_intf(&dpu_kms->rm, phys->intf_idx); + + if (phys->wb_idx >= WB_0 && phys->wb_idx < WB_MAX) + phys->hw_wb = dpu_rm_get_wb(&dpu_kms->rm, phys->wb_idx); + + if (!phys->hw_intf && !phys->hw_wb) { + DPU_ERROR_ENC(dpu_enc, "no intf or wb block assigned at idx: %d\n", i); + ret = -EINVAL; + } + + if (phys->hw_intf && phys->hw_wb) { + DPU_ERROR_ENC(dpu_enc, + "invalid phys both intf and wb block at idx: %d\n", i); + ret = -EINVAL; + } } + mutex_unlock(&dpu_enc->enc_lock); return ret; -- 2.35.1