From patchwork Thu Mar 16 16:16:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 664063 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5CE2DC6FD19 for ; Thu, 16 Mar 2023 16:17:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230232AbjCPQRw (ORCPT ); Thu, 16 Mar 2023 12:17:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37920 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230156AbjCPQRp (ORCPT ); Thu, 16 Mar 2023 12:17:45 -0400 Received: from mail-lj1-x22e.google.com (mail-lj1-x22e.google.com [IPv6:2a00:1450:4864:20::22e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9E3BBE20CF for ; Thu, 16 Mar 2023 09:17:20 -0700 (PDT) Received: by mail-lj1-x22e.google.com with SMTP id by8so1050260ljb.12 for ; Thu, 16 Mar 2023 09:17:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1678983428; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=lMxu228UknSnm7hBHXdsSZRYK1JBi7/hMEuzH/oSPi8=; b=aLJ46BlgzGvL6ooDZJH8ibqOX5r/YNvyNA9/w7MxoIix0lZbc9aLqLsXfFQUh3MNi6 vUDsDfPyYaNdeJ0cLhncSvh2GdNCW+1rhcND+wbzLAl4eWyCaHXcf2C1kJ6OLIN7Y9Pf D7tc8kY0r9nn9fbkeQnPHGpNF3zsVt/5qWylUsGqo/dwxLtSXVIa24N1CeKQnRZ5zGbo z7V+WWsspr2FofOokzHnTlPTtdyvVD251ixOdHOersx9Cr2vqxeIDfxzKiUkHDZCV21h PxwWI2xHhSV/9QOlnJWb6zl1VO2TAlCCR9aaC0WL0ipi31m0Y7NHg4aXXLZWFl6VzYCP LrIw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678983428; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=lMxu228UknSnm7hBHXdsSZRYK1JBi7/hMEuzH/oSPi8=; b=Il4SYXKcDXvNb+mz4VmT/Yh+vCmCumJS9i2qcl+vd8zZ8RbQ7/dp6j8uCYv+ZTXWr+ S4tRI0Cv5rvk2AbST/+CBK/CZI2mHvDdNpUD1bVWfBifZ+VVGoTxphEM5fSpCO6yZzuf GpeNsjoqn7vfwV1TylKjX9VVaSjNUzO4ZDWDn10qBHWBNf00yGkioH0WGVs9I05n3qqL o0SP6o4sq5T4EwOfFQ5x6Eika8Astw+k7fAYwILNmvEssSABiO3P21J+TzNaiKdYv1AK pBB+be/UImnJHNL0mKT69VLb9NI/OsVbEeYpPqC4wZT6G2qipOZ7s0GJDJlmWb9ac7hP kYwg== X-Gm-Message-State: AO0yUKXaPnPFK57wZykQ/uPwuQXTah/NKI3p4G6UV84umWv1u5G19Q1T wWAPPuxEbg2mX+4EnBwb0aaQbw== X-Google-Smtp-Source: AK7set/SIy0LrEzwkKzeeWrTZXys5+mkGu/qEaEVOgXxaeCw69QIIu+wCMfB/TadRNoktgUIS3QU4g== X-Received: by 2002:a05:651c:2111:b0:298:6d41:a663 with SMTP id a17-20020a05651c211100b002986d41a663mr2798907ljq.23.1678983428466; Thu, 16 Mar 2023 09:17:08 -0700 (PDT) Received: from umbar.unikie.fi ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id l2-20020a2e8342000000b00298b33afe1csm549152ljh.87.2023.03.16.09.17.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Mar 2023 09:17:07 -0700 (PDT) From: Dmitry Baryshkov To: Rob Clark , Sean Paul , Abhinav Kumar Cc: Stephen Boyd , David Airlie , Daniel Vetter , Bjorn Andersson , linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org Subject: [PATCH v7 15/32] drm/msm/dpu: don't use unsupported blend stages Date: Thu, 16 Mar 2023 19:16:36 +0300 Message-Id: <20230316161653.4106395-16-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230316161653.4106395-1-dmitry.baryshkov@linaro.org> References: <20230316161653.4106395-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org The dpu_crtc_atomic_check() compares blending stage with DPU_STAGE_MAX (maximum amount of blending stages supported by the driver), however we should compare it against .max_mixer_blendstages, the maximum blend stage supported by the mixer. Reviewed-by: Abhinav Kumar Tested-by: Abhinav Kumar # sc7280 Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c index ca7a9f58a97f..3ff9c6018a5b 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c @@ -1154,6 +1154,7 @@ static int dpu_crtc_atomic_check(struct drm_crtc *crtc, crtc); struct dpu_crtc *dpu_crtc = to_dpu_crtc(crtc); struct dpu_crtc_state *cstate = to_dpu_crtc_state(crtc_state); + struct dpu_kms *dpu_kms = _dpu_crtc_get_kms(crtc); const struct drm_plane_state *pstate; struct drm_plane *plane; @@ -1189,7 +1190,7 @@ static int dpu_crtc_atomic_check(struct drm_crtc *crtc, drm_atomic_crtc_state_for_each_plane_state(plane, pstate, crtc_state) { struct dpu_plane_state *dpu_pstate = to_dpu_plane_state(pstate); struct drm_rect dst, clip = crtc_rect; - int z_pos; + int stage; if (IS_ERR_OR_NULL(pstate)) { rc = PTR_ERR(pstate); @@ -1214,17 +1215,16 @@ static int dpu_crtc_atomic_check(struct drm_crtc *crtc, return -E2BIG; } - z_pos = pstate->normalized_zpos; - - /* verify z_pos setting before using it */ - if (z_pos >= DPU_STAGE_MAX - DPU_STAGE_0) { + /* verify stage setting before using it */ + stage = DPU_STAGE_0 + pstate->normalized_zpos; + if (stage >= dpu_kms->catalog->caps->max_mixer_blendstages) { DPU_ERROR("> %d plane stages assigned\n", - DPU_STAGE_MAX - DPU_STAGE_0); + dpu_kms->catalog->caps->max_mixer_blendstages - DPU_STAGE_0); return -EINVAL; } - to_dpu_plane_state(pstate)->stage = z_pos + DPU_STAGE_0; - DRM_DEBUG_ATOMIC("%s: zpos %d\n", dpu_crtc->name, z_pos); + to_dpu_plane_state(pstate)->stage = stage; + DRM_DEBUG_ATOMIC("%s: stage %d\n", dpu_crtc->name, stage); }