From patchwork Mon Jun 24 21:13:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 807077 Received: from mail-lf1-f54.google.com (mail-lf1-f54.google.com [209.85.167.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 64E1D1A08BD for ; Mon, 24 Jun 2024 21:13:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719263631; cv=none; b=ppLNzskYzvrUAldQ8kdHGsEmTUKViGMlRiVYW4EQ74kbdgmiS8j3S5quI9dMQ7GRxzz68BYyXSMrKbPeZ0PB7oDWItnctWbpR2hKZL4sIbnGY+rwTEegu2kT9nfNp4PRYeHtjqCK19T39I30VB4jWJGd0RuVL/HRt/PNSeS7FFA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719263631; c=relaxed/simple; bh=7vP7o0FochLbD0Xxzl9C2B538GRcwP3COb8crkPmUOU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=E/Ma0Wcd1cBpmXpb32bJNsQdRtp12XMUeCYknn7tAn15QV8f+rGrAfDAacWMljKUiQPtdHPbqUtuERPGfd1YueOKVDG9gT/RCPhBftfFRN/7C3E7zzGojwWl6IrFee2L1JDr3Esduw9k60hCPBPY6MBg7gCiXEpFCI9L7CCi66g= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=J3m+0Gvr; arc=none smtp.client-ip=209.85.167.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="J3m+0Gvr" Received: by mail-lf1-f54.google.com with SMTP id 2adb3069b0e04-52ce09b76e0so1786124e87.0 for ; Mon, 24 Jun 2024 14:13:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1719263627; x=1719868427; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=4VRgd5asHo3we7JJsAH8XR2VQncsaeqG+/tWCDM9GWs=; b=J3m+0GvrMZxTXAI9AIKVBOhnTP1/7Uek0KxqrBU4RYXHuUrJTbREww8nChIHA9TFt5 3LF3zbpxcBJWvhQBkDU4hozXV0SNkV5N90Ib8rMU7J31nDVzvC+CLpBTvLpKDMLaxKd9 IDpS2tR1+cOBB9zhSX8Kne1IWH6giN4Cfv1JHpTzZ2haTvlfOum6G8Gn/WIc5HssNSer e+LeaahTdhsVjEB0+DY/VORnVXqWCBMzOHK+6Eo63JcPmbjK1T617gema0cA15Q9KViX fqwIb9HvODlFUehtIrAy1+s7jk9RXdxI+svTzSUpKch+pfE16IBO2R3P/1Ot7mfseEsI FLWQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719263627; x=1719868427; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=4VRgd5asHo3we7JJsAH8XR2VQncsaeqG+/tWCDM9GWs=; b=sWDTmsZf4yxMlvVcJIcDbNSrmQEhFsZ+IxWX5PQ3gs8L98S+usQxxWEKBH7ZSwHoM2 7a68w3VYiMuUcIUYBjJkZ0agTkhkFZ8KoLaflgXNvu8K8EbsfMraALwtbUgyXEez9lne wzwl5Exc/7Q3k4ae3WQ2z1zg5JDgdWhCLgFP6zfVqT5+I9QYQCzkPZ/p2YA1VmiqivAk 25C/jEg4anRFehiN+ghIHE7yom8nC8kYquUUeGRgLNNt2R0ajncfY+eRc1n0myQRHSZx mcpUt+mjvzHuByq8YhHBx0gAg4K4Dr3MXfjpPxKOoI73AFfE7DfVEv5qX9AZYWF9nf/9 e/Ug== X-Forwarded-Encrypted: i=1; AJvYcCUratTLYHG1QGSL73pZmMi7/tLLJc+Zi322BC/lXTACmkVPDXayHiEhfYs6Pcldxqq69llKEQ9BHngYk8Nau1c5Cn9jXBnfZOKggHQwew== X-Gm-Message-State: AOJu0YxMShXdHEPaV+sX4n+0O5/Ad/sZvTEaFW/E6MP9LVvYKWZ55ME7 JkTgZTtYs/GSp1GNw6rlhmYlx4F9Tj0PmUt95y4j9D3nY09SObbOyyAuHQLUK8A= X-Google-Smtp-Source: AGHT+IEwwnEhYl95QqDTbCLmeV/4bzp4M63Zy4b8eegGdrh8TiiSCNUzZrU/Jfb+Oa1fUkPxJX3HBw== X-Received: by 2002:ac2:4474:0:b0:52c:86e0:97b5 with SMTP id 2adb3069b0e04-52cdf34655cmr2015909e87.16.1719263627711; Mon, 24 Jun 2024 14:13:47 -0700 (PDT) Received: from umbar.lan ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-52cd63b49f2sm1057512e87.56.2024.06.24.14.13.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Jun 2024 14:13:47 -0700 (PDT) From: Dmitry Baryshkov Date: Tue, 25 Jun 2024 00:13:42 +0300 Subject: [PATCH v5 02/16] drm/msm/dpu: fix error condition in dpu_encoder_virt_atomic_mode_set Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240625-dpu-mode-config-width-v5-2-501d984d634f@linaro.org> References: <20240625-dpu-mode-config-width-v5-0-501d984d634f@linaro.org> In-Reply-To: <20240625-dpu-mode-config-width-v5-0-501d984d634f@linaro.org> To: Rob Clark , Abhinav Kumar , Sean Paul , Marijn Suijten , David Airlie , Daniel Vetter Cc: Abel Vesa , Johan Hovold , linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, Dmitry Baryshkov X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=957; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=7vP7o0FochLbD0Xxzl9C2B538GRcwP3COb8crkPmUOU=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBmeeGHjmcqZL5bh8Vey1taJSCXeNBj8b511MU54 qCCasjSnJ6JATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZnnhhwAKCRCLPIo+Aiko 1TINB/9xlBhS2fVzyaXFtuw9d8tMN5rB0L2hhdoYdifhgvf4g/MNWuwlgGfwOPl7jKcNblqMqj0 ozKXND4ugksr3fPBlRlaxtITj0/rT7jqcPvijl7zBNupG8Rulzw4jrhdR++cdnmDLeouYrfVDed vhgZbrlmhmkBvZOjAaQkvVT1/+PsKsj9QNz4X0ZmMIpkPuMwgmPKXf2U3XH3oRfi7eCgs1MG6/T kgcCRney7KT+mzmT5MxbeC6xqa2IwmSJyr0WXXgm8i/5on6A5vad7zwpBK/QywGtEV8uFUX+NIB 3VqiUXUYZllOU5c3R+PrDwKz6T7XQcybosxQm3E2nij78o8w X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A The commit b954fa6baaca ("drm/msm/dpu: Refactor rm iterator") removed zero-init of the hw_ctl array, but didn't change the error condition, that checked for hw_ctl[i] being NULL. Use indices check instead. Fixes: b954fa6baaca ("drm/msm/dpu: Refactor rm iterator") Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c index 5d205e09cf45..7613005fbfea 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c @@ -1186,7 +1186,7 @@ static void dpu_encoder_virt_atomic_mode_set(struct drm_encoder *drm_enc, return; } - if (!hw_ctl[i]) { + if (i >= num_ctl) { DPU_ERROR_ENC(dpu_enc, "no ctl block assigned at idx: %d\n", i); return; From patchwork Mon Jun 24 21:13:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 807076 Received: from mail-lf1-f41.google.com (mail-lf1-f41.google.com [209.85.167.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 261081A08C3 for ; Mon, 24 Jun 2024 21:13:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719263632; cv=none; b=Y5Ipi0PI0T1jbU2POlq4nsGiJEj+5uDACU5kk4v7kr4HhrXhW6DHS4cNrsjurKStQKi6K4KuBP2ly1MITdeugeoLpgXkJGDRp9Wsxz6JDUF6mbckrn3tJLMwQVhlROYaSoXbtlmrLNkpv1m1Q+cIkNH9FsZkDq2VqTmeccVWkCs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719263632; c=relaxed/simple; bh=+m6EcRPOVuIQ4Ug721Qf+o7LpvWeO2gPaRzcMB1CAms=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=rR5s4M7Z6opMIzwiKp1cc3hg5fyJxomFTuHfXA/F08yZ5LObCfIhEFKhYgLPwOSYnTNNmZiSE7srftmkb+ZEDjY0iJu3JUFTRppVo0jof5mgeLRhRaxBZAMSFZoR8NX2lGwRHWNZgR4p/dJTbozGTim4NO4ITcgtgJcuoHo05PA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=pQXJmj51; arc=none smtp.client-ip=209.85.167.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="pQXJmj51" Received: by mail-lf1-f41.google.com with SMTP id 2adb3069b0e04-52cdf579dd2so2284944e87.3 for ; Mon, 24 Jun 2024 14:13:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1719263628; x=1719868428; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=HKZSiV9G3gFkGj7hwm8fSGNfiB8+3czA2DqUvgFsmYA=; b=pQXJmj51zoHfxCZ3eVM7EOVwiWdpEF8f8Pv536KWC+VUjx4paD1fvI5Ryag1asRKlT 6S3/9HPdZO1pvvmSKmdIPUTgNBxcQMHKDOWg7p0BremXoP76HrhY534CP5BP+O2X366F XBcS0BzmXZP4o/kweJzmBTPldQqra2xEUkBnGxl9lcIp7dA3ncRhnJJAELseEVUCP9hz Jft6YFZnjPhEOrG/tDc8b5VMdbslQeY3XlNl0OE0rUccFOURTHO3LhnZMJmdv2hkosaj UpygUz/dfX78nK/6JWOQZZe+M+0XZRJ++VO6Vh8H/kvfQijmPc/zoVyhoq5kJruOWnve +zfQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719263628; x=1719868428; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=HKZSiV9G3gFkGj7hwm8fSGNfiB8+3czA2DqUvgFsmYA=; b=vP+mVmJHB1f+TqPbXL/7o18HLAkTqBtw5DF8TawXzez1LA5sSFc+ixAnY+se7YxHls jDj1ALztNjfIhmFUBY9eET32ZbCzak92IDwC9k3ueeSYMUu5jaTNA4/o4IIldgJgvuLj swbNHWmK6o2Zad1v28q867Rz7tEjnu2caO0c4kXj/GyuwRbcGwsjpxtH5sThFx8qRMWE odgOweh4KtplF7h34JfftnYxkk52jgOks6DaKaT6wmw+OohvQ2UlVepF777x4Q+xqwSU WH7Z6IrGlh4N9+EAJ4+hs9aoYFF11BAKnXdbffM114C2MmNLUme3jGJE3cUfXm4o3g7s kDjA== X-Forwarded-Encrypted: i=1; AJvYcCWzl1j1JtrSHYfkLUfxmXv3gpymlR1506fzbBg+Hu/DWTL8rfynWJnm/NwUr8d7/fI9ZXSCtAn2L0FDMBnxZOtl+qHbgvwOZVwUd7xeIw== X-Gm-Message-State: AOJu0YzshDeKJX0oza2rPtYovjDzcj+mjZO+N/utexIDamdY0nM1XoiP FmWAT6tRE2tXbiGodB7JyxqhLneIjfkzA7Moabh14vGOzaBSON9DNd/4lyI60Zm4QfhlmlOmrWt 2Vso= X-Google-Smtp-Source: AGHT+IF6LNrOvvqTzVzX9h7Xhymezjdfemr/jc2WZQK7AgtER9k4c1m+jefDl2JNq4omI6ew87Fasg== X-Received: by 2002:a19:9155:0:b0:52c:8a39:83d7 with SMTP id 2adb3069b0e04-52cdf8209cfmr3228372e87.52.1719263628370; Mon, 24 Jun 2024 14:13:48 -0700 (PDT) Received: from umbar.lan ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-52cd63b49f2sm1057512e87.56.2024.06.24.14.13.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Jun 2024 14:13:48 -0700 (PDT) From: Dmitry Baryshkov Date: Tue, 25 Jun 2024 00:13:43 +0300 Subject: [PATCH v5 03/16] drm/msm/dpu: move CRTC resource assignment to dpu_encoder_virt_atomic_mode_set Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240625-dpu-mode-config-width-v5-3-501d984d634f@linaro.org> References: <20240625-dpu-mode-config-width-v5-0-501d984d634f@linaro.org> In-Reply-To: <20240625-dpu-mode-config-width-v5-0-501d984d634f@linaro.org> To: Rob Clark , Abhinav Kumar , Sean Paul , Marijn Suijten , David Airlie , Daniel Vetter Cc: Abel Vesa , Johan Hovold , linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, Dmitry Baryshkov X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=5674; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=+m6EcRPOVuIQ4Ug721Qf+o7LpvWeO2gPaRzcMB1CAms=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBmeeGHnYt4E8EYGiHRBPHG8GXqC43TBbSloAIAL m7O1FTjOhWJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZnnhhwAKCRCLPIo+Aiko 1c8CCACJA5qJ/m5TBHkrNRIs29eb5WCiMyYN5NY+xBeqbvVhHAlF+asUm/fhDUHCkg2e+M40pZA jK1bMAAwVeHfKWVLRLU7rDiRCxoZlOhbNeAZZg0qS9V2ITOIh1jgkUi6kiGchoCa8jKuzuhIrTX 7sWcgRv8i4IAaeCE9EMDs+bHrDb8omJ6ParlCzHNpi0e7wSe9a7FQkKHBbynU5iucdwktbEv04o 0qQo4bauys8h1F4gULZ6LnfbQHLtZqd1k5gkL8VI4jDrvw8m3E+2in7jslLF/+K0C78l8fAU8u3 vMxVvJGMKBle+fXAl8gxD0rkVJj3yUOyf4OKTumVfRVHdgUX X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A Historically CRTC resources (LMs and CTLs) were assigned in dpu_crtc_atomic_begin(). The commit 9222cdd27e82 ("drm/msm/dpu: move hw resource tracking to crtc state") simply moved resources to struct dpu_crtc_state, without changing the code sequence. Later on the commit b107603b4ad0 ("drm/msm/dpu: map mixer/ctl hw blocks in encoder modeset") rearanged the code, but still kept the cstate->num_mixers assignment to happen during commit phase. This makes dpu_crtc_state inconsistent between consequent atomic_check() calls. Move CRTC resource assignment to happen at the end of dpu_encoder_virt_atomic_check(). Fixes: b107603b4ad0 ("drm/msm/dpu: map mixer/ctl hw blocks in encoder modeset") Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c | 3 -- drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c | 60 +++++++++++++++++++---------- 2 files changed, 39 insertions(+), 24 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c index 9f2164782844..7399794d75eb 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c @@ -1094,9 +1094,6 @@ static void dpu_crtc_disable(struct drm_crtc *crtc, drm_for_each_encoder_mask(encoder, crtc->dev, crtc->state->encoder_mask) dpu_encoder_register_frame_event_callback(encoder, NULL, NULL); - memset(cstate->mixers, 0, sizeof(cstate->mixers)); - cstate->num_mixers = 0; - /* disable clk & bw control until clk & bw properties are set */ cstate->bw_control = false; cstate->bw_split_vote = false; diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c index 7613005fbfea..98f3a8d84300 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c @@ -628,6 +628,41 @@ static struct msm_display_topology dpu_encoder_get_topology( return topology; } +static void dpu_encoder_assign_crtc_resources(struct dpu_kms *dpu_kms, + struct drm_encoder *drm_enc, + struct dpu_global_state *global_state, + struct drm_crtc_state *crtc_state) +{ + struct dpu_crtc_state *cstate; + struct dpu_hw_blk *hw_ctl[MAX_CHANNELS_PER_ENC]; + struct dpu_hw_blk *hw_lm[MAX_CHANNELS_PER_ENC]; + struct dpu_hw_blk *hw_dspp[MAX_CHANNELS_PER_ENC]; + int num_lm, num_ctl, num_dspp, i; + + cstate = to_dpu_crtc_state(crtc_state); + + memset(cstate->mixers, 0, sizeof(cstate->mixers)); + + num_ctl = dpu_rm_get_assigned_resources(&dpu_kms->rm, global_state, + drm_enc->base.id, DPU_HW_BLK_CTL, hw_ctl, ARRAY_SIZE(hw_ctl)); + num_lm = dpu_rm_get_assigned_resources(&dpu_kms->rm, global_state, + drm_enc->base.id, DPU_HW_BLK_LM, hw_lm, ARRAY_SIZE(hw_lm)); + num_dspp = dpu_rm_get_assigned_resources(&dpu_kms->rm, global_state, + drm_enc->base.id, DPU_HW_BLK_DSPP, hw_dspp, + ARRAY_SIZE(hw_dspp)); + + for (i = 0; i < num_lm; i++) { + int ctl_idx = (i < num_ctl) ? i : (num_ctl-1); + + cstate->mixers[i].hw_lm = to_dpu_hw_mixer(hw_lm[i]); + cstate->mixers[i].lm_ctl = to_dpu_hw_ctl(hw_ctl[ctl_idx]); + if (i < num_dspp) + cstate->mixers[i].hw_dspp = to_dpu_hw_dspp(hw_dspp[i]); + } + + cstate->num_mixers = num_lm; +} + static int dpu_encoder_virt_atomic_check( struct drm_encoder *drm_enc, struct drm_crtc_state *crtc_state, @@ -698,6 +733,9 @@ static int dpu_encoder_virt_atomic_check( drm_enc, crtc_state, topology); } + if (!ret) + dpu_encoder_assign_crtc_resources(dpu_kms, drm_enc, global_state, crtc_state); + trace_dpu_enc_atomic_check_flags(DRMID(drm_enc), adj_mode->flags); return ret; @@ -1097,14 +1135,11 @@ static void dpu_encoder_virt_atomic_mode_set(struct drm_encoder *drm_enc, struct dpu_encoder_virt *dpu_enc; struct msm_drm_private *priv; struct dpu_kms *dpu_kms; - struct dpu_crtc_state *cstate; struct dpu_global_state *global_state; struct dpu_hw_blk *hw_pp[MAX_CHANNELS_PER_ENC]; struct dpu_hw_blk *hw_ctl[MAX_CHANNELS_PER_ENC]; - struct dpu_hw_blk *hw_lm[MAX_CHANNELS_PER_ENC]; - struct dpu_hw_blk *hw_dspp[MAX_CHANNELS_PER_ENC] = { NULL }; struct dpu_hw_blk *hw_dsc[MAX_CHANNELS_PER_ENC]; - int num_lm, num_ctl, num_pp, num_dsc; + int num_ctl, num_pp, num_dsc; unsigned int dsc_mask = 0; int i; @@ -1133,11 +1168,6 @@ static void dpu_encoder_virt_atomic_mode_set(struct drm_encoder *drm_enc, ARRAY_SIZE(hw_pp)); num_ctl = dpu_rm_get_assigned_resources(&dpu_kms->rm, global_state, drm_enc->base.id, DPU_HW_BLK_CTL, hw_ctl, ARRAY_SIZE(hw_ctl)); - num_lm = dpu_rm_get_assigned_resources(&dpu_kms->rm, global_state, - drm_enc->base.id, DPU_HW_BLK_LM, hw_lm, ARRAY_SIZE(hw_lm)); - dpu_rm_get_assigned_resources(&dpu_kms->rm, global_state, - drm_enc->base.id, DPU_HW_BLK_DSPP, hw_dspp, - ARRAY_SIZE(hw_dspp)); for (i = 0; i < MAX_CHANNELS_PER_ENC; i++) dpu_enc->hw_pp[i] = i < num_pp ? to_dpu_hw_pingpong(hw_pp[i]) @@ -1163,18 +1193,6 @@ static void dpu_encoder_virt_atomic_mode_set(struct drm_encoder *drm_enc, dpu_enc->cur_master->hw_cdm = hw_cdm ? to_dpu_hw_cdm(hw_cdm) : NULL; } - cstate = to_dpu_crtc_state(crtc_state); - - for (i = 0; i < num_lm; i++) { - int ctl_idx = (i < num_ctl) ? i : (num_ctl-1); - - cstate->mixers[i].hw_lm = to_dpu_hw_mixer(hw_lm[i]); - cstate->mixers[i].lm_ctl = to_dpu_hw_ctl(hw_ctl[ctl_idx]); - cstate->mixers[i].hw_dspp = to_dpu_hw_dspp(hw_dspp[i]); - } - - cstate->num_mixers = num_lm; - dpu_enc->connector = conn_state->connector; for (i = 0; i < dpu_enc->num_phys_encs; i++) { From patchwork Mon Jun 24 21:13:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 807075 Received: from mail-lj1-f177.google.com (mail-lj1-f177.google.com [209.85.208.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B2CE01A08BD for ; Mon, 24 Jun 2024 21:13:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.177 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719263633; cv=none; b=YKlSMikaUQFWS+ghS2sN8RORzB/appT5omp2XbyGCuXQIGHyepuh5PtFAnghHIJ8FtDjgiX4A6sPuET4c32yT+OgNSP2+jYBPtGhmz3YaAMDcNp8DJGvfeGeMcdh9BYR9aIsZmN4uGbgutX32wsBUcdqnGpXlLjiEON2QfL1iVc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719263633; c=relaxed/simple; bh=ejH+ol5T532KyZrIFuLloTm2XyxOOkDo+QG+9a6aKvc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=NqKcK/ms9ZTcuFsSzrrViCxxlue9e41POOKOYC51lHF/07GfABbBasce42kvcw5qyCulPzuXABWqhM6SV3kw0kQuSOJe6mdI0zCqTNs+8Mh/cZT0B0JMDBIlHMiW4fwT/splMS/kv3ZP+7FoO5y/3BsgkcFtBifzJ7wS7DhiGvE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=oJPMiOGc; arc=none smtp.client-ip=209.85.208.177 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="oJPMiOGc" Received: by mail-lj1-f177.google.com with SMTP id 38308e7fff4ca-2ec1ac1aed2so58415421fa.3 for ; Mon, 24 Jun 2024 14:13:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1719263630; x=1719868430; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=Ly9zxPF6kK6qWFLi6AuRER/W3ug3hHlZgBrdmIg0PXo=; b=oJPMiOGcL+NeL9z361qTRZ+xYP9wJp5eoVmzmYbDeK1dvJQ1v9vIKwOQn0bMec8yMz yGhJ90ZoQvL34E2gZUfziyhL3O1/Jt1eOI9a9Bkq9konvcTGlEX2qi8NlAxaBVQmHWjJ pfYU1R9C+MUtSyPeKkK/PbzmonN6tOc4DPx8/YaO5QAv2mhCtiL9VpDzAEYUbMvGNIUo XfEGZL3wqTIKbzB7vfrYpFsHyYGXLy4gMTIdm1zshgEZ2L9zvbFbff0GQlwn8PCA+0xy Oo6JMer/FOMJ2j51O3UMLJuuRlgdShRbQIJfcql+vzP5XbMwgK0NfWVuyNBEyUInwt6F SuvA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719263630; x=1719868430; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Ly9zxPF6kK6qWFLi6AuRER/W3ug3hHlZgBrdmIg0PXo=; b=Lrs6Ngul/ivVeVrBmOgPYVp2KN8M66FZRprW5/J2Y01CxBOnSl0oVAQ5e/GCFVpqCk /A1THdB0NpjGJOh8/sMFGVJWv28g1NoWkjzrfwvdLJkPggidFOEvO7x9Tle7UxVDaAqA wSi8mc8QCsf7eG1kiiOWXAnAIR5pbEohdtdouycD9MSsJPgBkycssVYS6gOYt3Uy4Z6R P6FpeHZquBzx+26ZzCZJ4a9M//GcJIcupDK66NK1A67wWnxHTl9UKZ7YTWSEj7sx8L3h 1O+GGM7TBx5zOtBd/0z2ptF2bqfBVr1x70oCfNAlTF+jvB8djtaui2n6JQufDGtqJsxu aS0w== X-Forwarded-Encrypted: i=1; AJvYcCXXpZYO8jnjgw7UOIu5yR67WZM4NGZOMAZIPzZ79RvqslO2pwPmuBcnyB+gtLb3oml0tMbdoMSVrtTavntNBPFHNGerzmPlHCfJ/zmO7g== X-Gm-Message-State: AOJu0YzzX+bItW7JtKg9Px10+C6VMlj9A0tEM+S/NjlAOcyY9owhllKw OnbxR0nRNJZaNn/nchewpJ7bf6Dr8fgYko/rOLQPOkvz5yh/Cyj1mf+oaSlsZsI= X-Google-Smtp-Source: AGHT+IGrf2DRTDknZzyb3RY+ew3v9yoG+1gZs23M7/VYPdu7dDBXRLNv41FsamkSs/sJPWRjFc/dWg== X-Received: by 2002:a19:5f58:0:b0:52c:d717:2c90 with SMTP id 2adb3069b0e04-52ce1864854mr3127500e87.59.1719263629854; Mon, 24 Jun 2024 14:13:49 -0700 (PDT) Received: from umbar.lan ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-52cd63b49f2sm1057512e87.56.2024.06.24.14.13.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Jun 2024 14:13:49 -0700 (PDT) From: Dmitry Baryshkov Date: Tue, 25 Jun 2024 00:13:45 +0300 Subject: [PATCH v5 05/16] drm/msm/dpu: drop dpu_format_check_modified_format Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240625-dpu-mode-config-width-v5-5-501d984d634f@linaro.org> References: <20240625-dpu-mode-config-width-v5-0-501d984d634f@linaro.org> In-Reply-To: <20240625-dpu-mode-config-width-v5-0-501d984d634f@linaro.org> To: Rob Clark , Abhinav Kumar , Sean Paul , Marijn Suijten , David Airlie , Daniel Vetter Cc: Abel Vesa , Johan Hovold , linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, Dmitry Baryshkov X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=4305; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=ejH+ol5T532KyZrIFuLloTm2XyxOOkDo+QG+9a6aKvc=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBmeeGHnaEOUyaAnU9Vrpz5Mh9HXPbkf3XE4HcnG ViR5o3QS2eJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZnnhhwAKCRCLPIo+Aiko 1f3yB/0QyeMDGZYEeg10fm81Ysz/VbVWbOawpU/XBHxUjH88pvzJnTghZ48aAQFBejtzZfweZbh Gjq5sqLoVcJau1jy3cPTV0+q+Q0BckZE+AMlpijBnoS0dgC5oAvCvcFkc+E4iahD+On8mc8ysDP 0L8fwkFThOdI7jF6JoJM6BpAqnKCmRn8D1BTV+JoVg8p/O3Zrwv83otWlyyIeh7gHXLUZVznCsz d5HiCNbC22/LEar/7+gk7XC9+3h+vbYFpIUdBvsrLyAd5uFvxam9F7N/fNn6vo1pTZYXgJzj+QJ N613YIA0+GuMPIco16iHAjvgxKgxakcUsT6qGL8p8Fr474vy X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A The msm_kms_funcs::check_modified_format() callback is not used by the driver. Drop it completely. Reviewed-by: Abhinav Kumar Tested-by: Abhinav Kumar # sc7280 Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c | 43 ----------------------------- drivers/gpu/drm/msm/disp/dpu1/dpu_formats.h | 16 ----------- drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 1 - drivers/gpu/drm/msm/msm_kms.h | 6 ---- 4 files changed, 66 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c index 6b1e9a617da3..027eb5ecff08 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c @@ -423,46 +423,3 @@ int dpu_format_populate_layout( return ret; } - -int dpu_format_check_modified_format( - const struct msm_kms *kms, - const struct msm_format *fmt, - const struct drm_mode_fb_cmd2 *cmd, - struct drm_gem_object **bos) -{ - const struct drm_format_info *info; - struct dpu_hw_fmt_layout layout; - uint32_t bos_total_size = 0; - int ret, i; - - if (!fmt || !cmd || !bos) { - DRM_ERROR("invalid arguments\n"); - return -EINVAL; - } - - info = drm_format_info(fmt->pixel_format); - if (!info) - return -EINVAL; - - ret = dpu_format_get_plane_sizes(fmt, cmd->width, cmd->height, - &layout, cmd->pitches); - if (ret) - return ret; - - for (i = 0; i < info->num_planes; i++) { - if (!bos[i]) { - DRM_ERROR("invalid handle for plane %d\n", i); - return -EINVAL; - } - if ((i == 0) || (bos[i] != bos[0])) - bos_total_size += bos[i]->size; - } - - if (bos_total_size < layout.total_size) { - DRM_ERROR("buffers total size too small %u expected %u\n", - bos_total_size, layout.total_size); - return -EINVAL; - } - - return 0; -} diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_formats.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_formats.h index 210d0ed5f0af..ef1239c95058 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_formats.h +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_formats.h @@ -31,22 +31,6 @@ static inline bool dpu_find_format(u32 format, const u32 *supported_formats, return false; } -/** - * dpu_format_check_modified_format - validate format and buffers for - * dpu non-standard, i.e. modified format - * @kms: kms driver - * @msm_fmt: pointer to the msm_fmt base pointer of an msm_format - * @cmd: fb_cmd2 structure user request - * @bos: gem buffer object list - * - * Return: error code on failure, 0 on success - */ -int dpu_format_check_modified_format( - const struct msm_kms *kms, - const struct msm_format *msm_fmt, - const struct drm_mode_fb_cmd2 *cmd, - struct drm_gem_object **bos); - /** * dpu_format_populate_layout - populate the given format layout based on * mmu, fb, and format found in the fb diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c index d1e2143110f2..40e4b829b9da 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c @@ -1025,7 +1025,6 @@ static const struct msm_kms_funcs kms_funcs = { .complete_commit = dpu_kms_complete_commit, .enable_vblank = dpu_kms_enable_vblank, .disable_vblank = dpu_kms_disable_vblank, - .check_modified_format = dpu_format_check_modified_format, .destroy = dpu_kms_destroy, .snapshot = dpu_kms_mdp_snapshot, #ifdef CONFIG_DEBUG_FS diff --git a/drivers/gpu/drm/msm/msm_kms.h b/drivers/gpu/drm/msm/msm_kms.h index 1e0c54de3716..e60162744c66 100644 --- a/drivers/gpu/drm/msm/msm_kms.h +++ b/drivers/gpu/drm/msm/msm_kms.h @@ -92,12 +92,6 @@ struct msm_kms_funcs { * Format handling: */ - /* do format checking on format modified through fb_cmd2 modifiers */ - int (*check_modified_format)(const struct msm_kms *kms, - const struct msm_format *msm_fmt, - const struct drm_mode_fb_cmd2 *cmd, - struct drm_gem_object **bos); - /* misc: */ long (*round_pixclk)(struct msm_kms *kms, unsigned long rate, struct drm_encoder *encoder); From patchwork Mon Jun 24 21:13:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 807074 Received: from mail-lj1-f175.google.com (mail-lj1-f175.google.com [209.85.208.175]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0C0691A0AE1 for ; Mon, 24 Jun 2024 21:13:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.175 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719263634; cv=none; b=L9l/ro0c6GWjxHiSxxVcCDzz+wcO07dSFf5yNIE6QLWk2uTwd3QuVv+9Ax3ncoIyW93NS8UIGxKh/1QZdK8QIK04EU2savd6volFlPPR+yQAZtbsGeJXld/quBJGW21dydzkaVUNRf3pZZp4iOhmrVCImnhjSCgZzuUvtFyvVok= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719263634; c=relaxed/simple; bh=BXjW3vQxsmZuyH1IlNRwIHSsrpZblZLTmW9M+NxSCGU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=MpMaHpGt+iyB1b+rwBTV1lMux+SqjYJ0+XfeF+3c/8WafMi2RBK2Kf0aEKh7b7C6gJ5hvWJskiSb6WzyafrSw+vyW1h3NvtUug2MD2VPE6+Z9MR9OQA0LhsiLocn0vimpG/rztIlMGyuXhbWLQRj+O6rtPQk7nVqXNWP0wxoQKo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=n5rTs+M7; arc=none smtp.client-ip=209.85.208.175 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="n5rTs+M7" Received: by mail-lj1-f175.google.com with SMTP id 38308e7fff4ca-2ebe40673d8so54401491fa.3 for ; Mon, 24 Jun 2024 14:13:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1719263631; x=1719868431; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=EqToHdwoMaw/kv+eoY0j/pTtTd0pz39pRc2HfSbi9b8=; b=n5rTs+M7AScCqH9UeLMYZPv1dvw0d3fPOVnzAmmkzYqpyZuxfOCD4LrgZC1DVbHrLY IaNjmcJn2fVnOdqCBswa3gu4RuqHu+aqm44Nk0i1KvE8bTiMu9Kq/WNFZSOz+4CPO4a0 BOc4vvxCX82mh0mA7iaCNs225n9y8VqPEK13B6J8kWr8vKEKpvKAIzkVPnz0+BnRBx0Y 3yOG2tj/4UxhArfd7hbTRa9yFzolCiBA7cNbh8RXOyimdAy3Bat8Jk2DT83nvxWALGhU Q1zY5s29QahtC4RLfsIHXFhd8L9ittLg57PGRleF/QWw9GDjRbOcUY2/Bqv33J6K/8J/ QVhw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719263631; x=1719868431; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=EqToHdwoMaw/kv+eoY0j/pTtTd0pz39pRc2HfSbi9b8=; b=Kv7p+XwHJba9M5E2gYMNL2UllKhPUAuSrizEvXQMlqNMSnOJBfLeD0+kbBZCnlUfiO p7ovuhO0yPlmng27POrroYLDlzUMxEqztyu8o3Y2Hj8o1S1Txax+aQTSKmw7K0wGQRa1 ampWOOZdv6Lsh64Pz14PTSlOaZva4m3rRC21UF08GrF+Am+DeamnRWxc1B9tUsHtx+Lf t7zxBujrfgpQuwvVwJOQmPY7AaKhmH5cZ1oYM/Wa04JishIfUiGUHpRlTW9z+AZBFaY+ T4DGkMNhSf18eNr3Y/8gk7C0fc61Yx6sO9+ySzbiNl7eYvvN++cV3FmGgxZFrEliivtJ FYrA== X-Forwarded-Encrypted: i=1; AJvYcCUbmPld8eYgBf4DuRReE73r8MoplSls7VT5eTWILBv5ai5xaSqxLPvX6Aoob6aKB9DrJaQQGQeq8mkWrtH60v8vztaDBk0Y8wg1HRyKrA== X-Gm-Message-State: AOJu0YwNDSBHUrWT1WAibNw2yplzMqz2T6FA4KzRvKnYfEBF255qf388 OjB7/cQS2BkRr5KoxyGZs1xdv4GFWeS9fnG8dkftzJNFIGzlxSv80Aa2jjyKAg4= X-Google-Smtp-Source: AGHT+IE2xQondEQZvECIFmiPxReGgcme3MZOLqHLKQMr4bEDKDZ+8huGlEQUTrO9SnmdfBGF1L7SYQ== X-Received: by 2002:ac2:5dc9:0:b0:52c:dec1:4578 with SMTP id 2adb3069b0e04-52ce1864495mr3199012e87.60.1719263631270; Mon, 24 Jun 2024 14:13:51 -0700 (PDT) Received: from umbar.lan ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-52cd63b49f2sm1057512e87.56.2024.06.24.14.13.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Jun 2024 14:13:50 -0700 (PDT) From: Dmitry Baryshkov Date: Tue, 25 Jun 2024 00:13:47 +0300 Subject: [PATCH v5 07/16] drm/msm/dpu: drop extra aspace checks in dpu_formats Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240625-dpu-mode-config-width-v5-7-501d984d634f@linaro.org> References: <20240625-dpu-mode-config-width-v5-0-501d984d634f@linaro.org> In-Reply-To: <20240625-dpu-mode-config-width-v5-0-501d984d634f@linaro.org> To: Rob Clark , Abhinav Kumar , Sean Paul , Marijn Suijten , David Airlie , Daniel Vetter Cc: Abel Vesa , Johan Hovold , linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, Dmitry Baryshkov X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1504; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=BXjW3vQxsmZuyH1IlNRwIHSsrpZblZLTmW9M+NxSCGU=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBmeeGISnjCTywn2asiMABQvbQvd1ljz/cfGpMTD lRXzy5D8xqJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZnnhiAAKCRCLPIo+Aiko 1dCJB/0ShsSArMHTi9IBz9sHfFnkzMWY0Ey6MPeT3/MK1ctjOSmp3OfLxxeyUA+XTznNd3FiJDz wXAYdLFjI0H4EtiHWcvD19PPYc7Auh4tQAW8qSTsp+/qi5PpTwCcK1HFDd54kT4ARtB65her9a/ 61qkiyldUEk4XRbX08zEvqaMkKx9hpapZviYoHx5TRfxF2SnekApor/VVDltxIHdZEziNqSOQmK GKRr1Y+qP1tg6MY5WiVNh6fKXV1rdqxmPf8RmXPvFDFDFMzIqhirG/bxZxOk80n9/aKVRQhQSBU O/C74mUeQmt+F9zvRLmY+Wx8ZsmBfZq78DPoanwgt7wKVlyg X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A The DPU driver isn't expected to be used without an IOMMU. Thus the aspace will be always present. Not to mention that mdp4/mdp5 drivers call msm_framebuffer_iova() without such checks, as the whole msm_framebuffer layer is expected to support both IOMMU and IOMMU-less configurations. Drop these useless if (aspace) checks. Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c index 027eb5ecff08..8c2dc5b59bb0 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c @@ -280,8 +280,7 @@ static int _dpu_format_populate_addrs_ubwc( return -EINVAL; } - if (aspace) - base_addr = msm_framebuffer_iova(fb, aspace, 0); + base_addr = msm_framebuffer_iova(fb, aspace, 0); if (!base_addr) { DRM_ERROR("failed to retrieve base addr\n"); return -EFAULT; @@ -376,9 +375,7 @@ static int _dpu_format_populate_addrs_linear( /* Populate addresses for simple formats here */ for (i = 0; i < layout->num_planes; ++i) { - if (aspace) - layout->plane_addr[i] = - msm_framebuffer_iova(fb, aspace, i); + layout->plane_addr[i] = msm_framebuffer_iova(fb, aspace, i); if (!layout->plane_addr[i]) { DRM_ERROR("failed to retrieve base addr\n"); return -EFAULT; From patchwork Mon Jun 24 21:13:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 807073 Received: from mail-lf1-f46.google.com (mail-lf1-f46.google.com [209.85.167.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B2CAB1A08DD for ; Mon, 24 Jun 2024 21:13:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719263636; cv=none; b=hTtW4YER9dNT5opZyl4FH18SpPxqAWKgjVa1ztQo1itHQsVtHanOYjc5X0O0wZBb2QF0lU3YelHpMVCw/fqHqwbYuWW+ppC77v0xPTLl3k+OErIvNU0J+i9WEUg/xIGFcVwNEeythVSDFVFT8anNnTx+W4JcTmAqMm8R2ltQjcg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719263636; c=relaxed/simple; bh=bp6A68kJPDBcsi8eZULofLfrBBdJDRmZZyWTdQOEhY4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=EdhgCEnroSOTOgBsAgGU+HSEefwn67F8BIuQ61fjAsUq+R7e+vyPBbpAhfL6YC0BdmLkrakSS9HWedpGJL8cJRcW7GVLeZCFR5oEOopJROfiO1nXvTbFegiNsY0OGxDPr0gnY9pO+o7eocR+63vL7+eqKhqBnJpVnjptStYPLm0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=pk48JVwq; arc=none smtp.client-ip=209.85.167.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="pk48JVwq" Received: by mail-lf1-f46.google.com with SMTP id 2adb3069b0e04-52ce6a9fd5cso1335946e87.3 for ; Mon, 24 Jun 2024 14:13:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1719263633; x=1719868433; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=cXiVV87C7egKKo/oKQCbPR7p6Dyhi+8Wd+RPKOL1+cA=; b=pk48JVwqOS/TWz8+Lf78j9Y6KfHt8yRXTqyPfiWzXBo+ZDEcS6i/K5uZITz2FgDm1+ YNEL6nPlEBbczRGh/ij067532tQBVa94aIQMbshWWW+Z4xivE41CtbUMc2JqRVxgidqo kE7Cj/azWWRnzyRhVgE1Cj4XecNw2D1rAsTUiMtxEXfYAC0tTSDx5fuOA5XNVRilleYe VxK5dpXS590242hwfcAxRmksvw3HZiUff3Ni9eC1KBbgmY2mQJZOOMXzcuiHJ4DuqUy/ xc/F3C7hWp7Mjr4GrNcvQlYUxuFvsO632eoO0BMk9bJTYGhbshfsRZop76pZnZHYMWyv rjcQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719263633; x=1719868433; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=cXiVV87C7egKKo/oKQCbPR7p6Dyhi+8Wd+RPKOL1+cA=; b=KU9EEND6b2+rtXKYK3gqeX1N8gxtAVdo71u1iWGl90zmOMtaozZqukLiSpdWhWhcKa 4YN8Xb0tPon75GEZBnSvQy2c4RmOVgWP7p9GMrNXGRD1WfEC+Z+0QnDeIegxO0ba80lH cUdni/sgRxqpHFdjhbNnpt+qmYh8tp+H1XCPSqBPZMQmMniOGW9QEDjY3rDeMaz3PGCt n1tNiz7EygNEvIhvf186Uo0kPjb2xzGwIs0QLgvZkMxnX95I0y1LLQMejk7IhVwL9CQD WGYyjONV1FbPDxc8CmMBMJATjROucV523lslLu0SAoC9uVxOIUsBYDk5LlwHM08vxRzk lmag== X-Forwarded-Encrypted: i=1; AJvYcCUSl97H4cUxQrzf/sCx0ooY/3i/dC8ScUIaIsMaTF5jC0KkpFZKSEAucr6WogV1Kv7/LWKxfOpQ/QiqsFJC/ITUFZ37ABKLCgDboelLhQ== X-Gm-Message-State: AOJu0YzOnhULpnu/3mNS96Yloe+DW58UK0unQUnGoxUgggGc9Lf0vuBe bMk5pFNdh/Ivve7VyUbyfRYEgSnbDOze3fi9NJELv0dkJU4suK0grEmpkwbKYgE= X-Google-Smtp-Source: AGHT+IFrnIpDZgkP7y6H7BTVxwu85K6IvesChUCQcKOzhKixAVLyJck212RPQw7QISbMxyYtgL49dQ== X-Received: by 2002:a05:6512:e95:b0:52c:8a3a:fe2c with SMTP id 2adb3069b0e04-52ce185d049mr3843315e87.45.1719263632882; Mon, 24 Jun 2024 14:13:52 -0700 (PDT) Received: from umbar.lan ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-52cd63b49f2sm1057512e87.56.2024.06.24.14.13.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Jun 2024 14:13:52 -0700 (PDT) From: Dmitry Baryshkov Date: Tue, 25 Jun 2024 00:13:49 +0300 Subject: [PATCH v5 09/16] drm/msm/dpu: pass drm_framebuffer to _dpu_format_get_plane_sizes() Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240625-dpu-mode-config-width-v5-9-501d984d634f@linaro.org> References: <20240625-dpu-mode-config-width-v5-0-501d984d634f@linaro.org> In-Reply-To: <20240625-dpu-mode-config-width-v5-0-501d984d634f@linaro.org> To: Rob Clark , Abhinav Kumar , Sean Paul , Marijn Suijten , David Airlie , Daniel Vetter Cc: Abel Vesa , Johan Hovold , linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, Dmitry Baryshkov X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=7789; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=bp6A68kJPDBcsi8eZULofLfrBBdJDRmZZyWTdQOEhY4=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBmeeGIwzbLTAsfFmiI2P6P05NPGjUe5AyrxDACr LjvmxiGqb2JATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZnnhiAAKCRCLPIo+Aiko 1ZjSB/9AcpvZqbp20Zhiaj9faz2xHE4Rc5/tsrtW2/LViAcvxgE2XdLNDDUBbHRjtMC5EJJ3fv0 XLbktIMqOJxHlcBKIpninS1Wb8Sh3ptrMlxEcbsvTMbyMJ3tzwVUwWRG5B+uZyq2IMUPanquN4U FMWEXWx2+A0YONhroJmAMFeWHYA8j0BRimPxKxyh3lob8Q3/IhOcmMIftSOrQ9H+CvNBueAcbVA rco2swrmq4it38bLqQRKdpnmTv3G+9ZMZKkAKhY/Ceel/omcPHIl/GUFsXEnDMHJxRa/edGBpUR oNyHrn6n9Ug9Yz1WmAh1Orbr5AMiu944UNwuaYAWAY1ES6Y+ X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A Instead of passing width / height / pitches, pass drm_framebuffer directly. This allows us to drop the useless check for !pitches, since an array can not be NULL. Signed-off-by: Dmitry Baryshkov Reviewed-by: Abhinav Kumar --- drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c | 73 ++++++++++++++--------------- 1 file changed, 34 insertions(+), 39 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c index 46237a1ca6a5..df046bc88715 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c @@ -95,8 +95,7 @@ static int _dpu_format_get_media_color_ubwc(const struct msm_format *fmt) static int _dpu_format_get_plane_sizes_ubwc( const struct msm_format *fmt, - const uint32_t width, - const uint32_t height, + struct drm_framebuffer *fb, struct dpu_hw_fmt_layout *layout) { int i; @@ -104,8 +103,8 @@ static int _dpu_format_get_plane_sizes_ubwc( bool meta = MSM_FORMAT_IS_UBWC(fmt); memset(layout, 0, sizeof(struct dpu_hw_fmt_layout)); - layout->width = width; - layout->height = height; + layout->width = fb->width; + layout->height = fb->height; layout->num_planes = fmt->num_planes; color = _dpu_format_get_media_color_ubwc(fmt); @@ -121,13 +120,13 @@ static int _dpu_format_get_plane_sizes_ubwc( uint32_t uv_meta_scanlines = 0; layout->num_planes = 2; - layout->plane_pitch[0] = VENUS_Y_STRIDE(color, width); - y_sclines = VENUS_Y_SCANLINES(color, height); + layout->plane_pitch[0] = VENUS_Y_STRIDE(color, fb->width); + y_sclines = VENUS_Y_SCANLINES(color, fb->height); layout->plane_size[0] = MSM_MEDIA_ALIGN(layout->plane_pitch[0] * y_sclines, DPU_UBWC_PLANE_SIZE_ALIGNMENT); - layout->plane_pitch[1] = VENUS_UV_STRIDE(color, width); - uv_sclines = VENUS_UV_SCANLINES(color, height); + layout->plane_pitch[1] = VENUS_UV_STRIDE(color, fb->width); + uv_sclines = VENUS_UV_SCANLINES(color, fb->height); layout->plane_size[1] = MSM_MEDIA_ALIGN(layout->plane_pitch[1] * uv_sclines, DPU_UBWC_PLANE_SIZE_ALIGNMENT); @@ -135,13 +134,13 @@ static int _dpu_format_get_plane_sizes_ubwc( goto done; layout->num_planes += 2; - layout->plane_pitch[2] = VENUS_Y_META_STRIDE(color, width); - y_meta_scanlines = VENUS_Y_META_SCANLINES(color, height); + layout->plane_pitch[2] = VENUS_Y_META_STRIDE(color, fb->width); + y_meta_scanlines = VENUS_Y_META_SCANLINES(color, fb->height); layout->plane_size[2] = MSM_MEDIA_ALIGN(layout->plane_pitch[2] * y_meta_scanlines, DPU_UBWC_PLANE_SIZE_ALIGNMENT); - layout->plane_pitch[3] = VENUS_UV_META_STRIDE(color, width); - uv_meta_scanlines = VENUS_UV_META_SCANLINES(color, height); + layout->plane_pitch[3] = VENUS_UV_META_STRIDE(color, fb->width); + uv_meta_scanlines = VENUS_UV_META_SCANLINES(color, fb->height); layout->plane_size[3] = MSM_MEDIA_ALIGN(layout->plane_pitch[3] * uv_meta_scanlines, DPU_UBWC_PLANE_SIZE_ALIGNMENT); @@ -150,16 +149,16 @@ static int _dpu_format_get_plane_sizes_ubwc( layout->num_planes = 1; - layout->plane_pitch[0] = VENUS_RGB_STRIDE(color, width); - rgb_scanlines = VENUS_RGB_SCANLINES(color, height); + layout->plane_pitch[0] = VENUS_RGB_STRIDE(color, fb->width); + rgb_scanlines = VENUS_RGB_SCANLINES(color, fb->height); layout->plane_size[0] = MSM_MEDIA_ALIGN(layout->plane_pitch[0] * rgb_scanlines, DPU_UBWC_PLANE_SIZE_ALIGNMENT); if (!meta) goto done; layout->num_planes += 2; - layout->plane_pitch[2] = VENUS_RGB_META_STRIDE(color, width); - rgb_meta_scanlines = VENUS_RGB_META_SCANLINES(color, height); + layout->plane_pitch[2] = VENUS_RGB_META_STRIDE(color, fb->width); + rgb_meta_scanlines = VENUS_RGB_META_SCANLINES(color, fb->height); layout->plane_size[2] = MSM_MEDIA_ALIGN(layout->plane_pitch[2] * rgb_meta_scanlines, DPU_UBWC_PLANE_SIZE_ALIGNMENT); } @@ -173,23 +172,21 @@ static int _dpu_format_get_plane_sizes_ubwc( static int _dpu_format_get_plane_sizes_linear( const struct msm_format *fmt, - const uint32_t width, - const uint32_t height, - struct dpu_hw_fmt_layout *layout, - const uint32_t *pitches) + struct drm_framebuffer *fb, + struct dpu_hw_fmt_layout *layout) { int i; memset(layout, 0, sizeof(struct dpu_hw_fmt_layout)); - layout->width = width; - layout->height = height; + layout->width = fb->width; + layout->height = fb->height; layout->num_planes = fmt->num_planes; /* Due to memset above, only need to set planes of interest */ if (fmt->fetch_type == MDP_PLANE_INTERLEAVED) { layout->num_planes = 1; - layout->plane_size[0] = width * height * fmt->bpp; - layout->plane_pitch[0] = width * fmt->bpp; + layout->plane_size[0] = fb->width * fb->height * fmt->bpp; + layout->plane_pitch[0] = fb->width * fmt->bpp; } else { uint32_t v_subsample, h_subsample; uint32_t chroma_samp; @@ -199,7 +196,7 @@ static int _dpu_format_get_plane_sizes_linear( _dpu_get_v_h_subsample_rate(chroma_samp, &v_subsample, &h_subsample); - if (width % h_subsample || height % v_subsample) { + if (fb->width % h_subsample || fb->height % v_subsample) { DRM_ERROR("mismatch in subsample vs dimensions\n"); return -EINVAL; } @@ -207,11 +204,11 @@ static int _dpu_format_get_plane_sizes_linear( if ((fmt->pixel_format == DRM_FORMAT_NV12) && (MSM_FORMAT_IS_DX(fmt))) bpp = 2; - layout->plane_pitch[0] = width * bpp; + layout->plane_pitch[0] = fb->width * bpp; layout->plane_pitch[1] = layout->plane_pitch[0] / h_subsample; - layout->plane_size[0] = layout->plane_pitch[0] * height; + layout->plane_size[0] = layout->plane_pitch[0] * fb->height; layout->plane_size[1] = layout->plane_pitch[1] * - (height / v_subsample); + (fb->height / v_subsample); if (fmt->fetch_type == MDP_PLANE_PSEUDO_PLANAR) { layout->num_planes = 2; @@ -232,8 +229,8 @@ static int _dpu_format_get_plane_sizes_linear( * all the components based on ubwc specifications. */ for (i = 0; i < layout->num_planes && i < DPU_MAX_PLANES; ++i) { - if (pitches && layout->plane_pitch[i] < pitches[i]) - layout->plane_pitch[i] = pitches[i]; + if (layout->plane_pitch[i] < fb->pitches[i]) + layout->plane_pitch[i] = fb->pitches[i]; } for (i = 0; i < DPU_MAX_PLANES; i++) @@ -244,25 +241,24 @@ static int _dpu_format_get_plane_sizes_linear( static int dpu_format_get_plane_sizes( const struct msm_format *fmt, - const uint32_t w, - const uint32_t h, - struct dpu_hw_fmt_layout *layout, - const uint32_t *pitches) + struct drm_framebuffer *fb, + struct dpu_hw_fmt_layout *layout) { if (!layout || !fmt) { DRM_ERROR("invalid pointer\n"); return -EINVAL; } - if ((w > DPU_MAX_IMG_WIDTH) || (h > DPU_MAX_IMG_HEIGHT)) { + if (fb->width > DPU_MAX_IMG_WIDTH || + fb->height > DPU_MAX_IMG_HEIGHT) { DRM_ERROR("image dimensions outside max range\n"); return -ERANGE; } if (MSM_FORMAT_IS_UBWC(fmt) || MSM_FORMAT_IS_TILE(fmt)) - return _dpu_format_get_plane_sizes_ubwc(fmt, w, h, layout); + return _dpu_format_get_plane_sizes_ubwc(fmt, fb, layout); - return _dpu_format_get_plane_sizes_linear(fmt, w, h, layout, pitches); + return _dpu_format_get_plane_sizes_linear(fmt, fb, layout); } static int _dpu_format_populate_addrs_ubwc( @@ -407,8 +403,7 @@ int dpu_format_populate_layout( fmt = msm_framebuffer_format(fb); /* Populate the plane sizes etc via get_format */ - ret = dpu_format_get_plane_sizes(fmt, fb->width, fb->height, - layout, fb->pitches); + ret = dpu_format_get_plane_sizes(fmt, fb, layout); if (ret) return ret; From patchwork Mon Jun 24 21:13:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 807072 Received: from mail-lf1-f49.google.com (mail-lf1-f49.google.com [209.85.167.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 332251A08DB for ; Mon, 24 Jun 2024 21:13:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719263638; cv=none; b=UpzqjgXoplwLWjBubp2up/4EEyfbCcW+jGzKlO+qS1dyh/ZvDWpU8AkedhpjD+zTp/eTUtkYZmxm/weuZD9WKGEiZfglo914Xbl7ox/QmNMj6qdpGqSqNuyQwlm4RqJBPr+Pq465hMPtaRyDIea20aTg+l4gCJFztJlQ+uYQAUI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719263638; c=relaxed/simple; bh=kOHwFWSqYJBJbCyJFtpt9tNQmg4Dnx6ZWsh7BLAo25w=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=uU3CaVGDi575xpn67fF/f6kbF3R9ds+6FANeKcEfNn/JW6+46fSSj1Feyx78SnLUFfDXOMMCGqbKlJd1DulKA4V5fKF9obJCazFTH9bzz18li9LOphwWEZIB7tFg/fb6fIE0RDfUYzraMBubbVxz8MWbnRU/OGru6QRb/RNJGX0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=bhMY0eEJ; arc=none smtp.client-ip=209.85.167.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="bhMY0eEJ" Received: by mail-lf1-f49.google.com with SMTP id 2adb3069b0e04-52cc671f170so4991526e87.1 for ; Mon, 24 Jun 2024 14:13:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1719263634; x=1719868434; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=PhAklPolawPNyeTmdPVqMJihu3ESGbzrA6xKl3WUL4Q=; b=bhMY0eEJ8YE6FlWgsHxhKiVIGFQcth+lb694ttubc1pZ8z/T5qvNTufFoqSg3bjuo9 liJXfpKxLjDObspv0zIT5So4nZabG6amXTWFVsSRLMq/UQfwOP9PhiDt1/NCX2W3/LmE H1PyorNWix19kCRU9YHQHhV3j4VGmMNUWFlkw6Ro/p2eEPZQDLSbd28nKAT7ban09U1M BKC+hQWFKVVaw3B3ekYc1CR5Bla9IfFK86eioReZ+Z7HD6+BTubKaw/LDZ7ZgGNm57Zz YAx9hd5jyhUZXxOhUE8VkZQL2TiASo1zQPVAcQc6TVlgoQRGJ75rpNJ3vzk4axoG4KRs a9dA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719263634; x=1719868434; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=PhAklPolawPNyeTmdPVqMJihu3ESGbzrA6xKl3WUL4Q=; b=duzV1mJ7jKoN4/UZ4AAOCCAK1lfrkj2wAEDLHiOYvdmG7kf06NA9SeEZNgYHBq5m0e hZQjf4lzRaA/KPEQz2veJQItiiBmoAO04LUc37MYj3LEve+U1NueVn/yU44ASa1WbJdt 3LgV2Uun/E+hIp+bfQspfawQBJLav25UD8x4+ba89BJRggR55FMRhcmapzcUtOy5/hpV lv/ekdPTxNLSV8dswOONsvfsD/z/Z2zuecRDfXYXI4MVJWKrGktYctVqEpMWKvZi+bYJ Lci7mKxbUv0ZoG3IpOJqB0lTr9FICOjmDUSlqg4PlaZ0sM2jh3bAHCdtRuLZpue4ESDR WY3A== X-Forwarded-Encrypted: i=1; AJvYcCWzUt0VWOdtnv6XVBDzoBd1c5v9YfvumC898qJHwHoL1IdBAfqEa0c00/Qcu72JjJn0Zw2i2siOU3mIJ+845WplARU8zv4dkAFEW/fSDw== X-Gm-Message-State: AOJu0YwJ7ja7+9w8smIAjFS/HDppfDnWDr7o7kAcowxz9BKRlbNJ1bs3 lFXbb+WMAkLZ1PawW6cRAZQOmP0soVOi6ianPIH3t4mWaPdRoUkskfTq7hZd6PU= X-Google-Smtp-Source: AGHT+IHhdzEZ+ZWrnvqcw1YESQv/ZCQKNsThdSxXfFNenYQAtNa5t8FE9yntzcrZNc+dr3XDZ1IONQ== X-Received: by 2002:ac2:4984:0:b0:52c:816c:814b with SMTP id 2adb3069b0e04-52cdf3463a1mr2001841e87.18.1719263634375; Mon, 24 Jun 2024 14:13:54 -0700 (PDT) Received: from umbar.lan ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-52cd63b49f2sm1057512e87.56.2024.06.24.14.13.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Jun 2024 14:13:54 -0700 (PDT) From: Dmitry Baryshkov Date: Tue, 25 Jun 2024 00:13:51 +0300 Subject: [PATCH v5 11/16] drm/msm/dpu: split dpu_format_populate_layout Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240625-dpu-mode-config-width-v5-11-501d984d634f@linaro.org> References: <20240625-dpu-mode-config-width-v5-0-501d984d634f@linaro.org> In-Reply-To: <20240625-dpu-mode-config-width-v5-0-501d984d634f@linaro.org> To: Rob Clark , Abhinav Kumar , Sean Paul , Marijn Suijten , David Airlie , Daniel Vetter Cc: Abel Vesa , Johan Hovold , linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, Dmitry Baryshkov X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=6392; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=kOHwFWSqYJBJbCyJFtpt9tNQmg4Dnx6ZWsh7BLAo25w=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBmeeGIud0IZhVoI8kIxrjZXCuQ1bsyWWJYjRfvK lXJHP4j3ziJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZnnhiAAKCRCLPIo+Aiko 1biWB/oDtOoRZe07adS2bwGVxrauaTm8jPFD6Gxc4tBH9n2tXoVYY8QU700qy3OqcTN2nAA4BgJ RzArduR3A4FtCpjrDNczHqSxEmLaxPE/ZQDFN2nZfgLtm5nJVaV5MD14rowJHIJxTWFV7Jdrvi7 uPznwKp26Rh6WV7iJpEmM71UUagoH/MYggvu1TQB1n+EbA0FiyCcsfbcH8usbZWf70pcsFAIfe4 vvGqpjXDYzlcJkPi8bwjv1cbucUrdShd1YDbdndBf4EyxPK/nRq9eP+UEnPs/9jPKn1Y7ey0E0k aAEkLSFAwKreSFty+Q5rW5focmGjWfuQGUGY0NVtSwgMTc5c X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A Split dpu_format_populate_layout() into addess-related and pitch/format-related parts. Reviewed-by: Abhinav Kumar Tested-by: Abhinav Kumar # sc7280 Signed-off-by: Dmitry Baryshkov --- .../gpu/drm/msm/disp/dpu1/dpu_encoder_phys_wb.c | 8 +++++- drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c | 32 +++++++++++++--------- drivers/gpu/drm/msm/disp/dpu1/dpu_formats.h | 8 ++++-- drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c | 15 ++++++++-- 4 files changed, 44 insertions(+), 19 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_wb.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_wb.c index c4a16a73bc97..ede926d30285 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_wb.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_wb.c @@ -579,7 +579,13 @@ static void dpu_encoder_phys_wb_prepare_wb_job(struct dpu_encoder_phys *phys_enc format = msm_framebuffer_format(job->fb); - ret = dpu_format_populate_layout(aspace, job->fb, &wb_cfg->dest); + ret = dpu_format_populate_plane_sizes(job->fb, &wb_cfg->dest); + if (ret) { + DPU_DEBUG("failed to populate plane sizes%d\n", ret); + return; + } + + ret = dpu_format_populate_addrs(aspace, job->fb, &wb_cfg->dest); if (ret) { DPU_DEBUG("failed to populate layout %d\n", ret); return; diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c index 4d17eb88af40..abe3a1c0e409 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c @@ -93,7 +93,7 @@ static int _dpu_format_get_media_color_ubwc(const struct msm_format *fmt) return color_fmt; } -static int _dpu_format_get_plane_sizes_ubwc( +static int _dpu_format_populate_plane_sizes_ubwc( const struct msm_format *fmt, struct drm_framebuffer *fb, struct dpu_hw_fmt_layout *layout) @@ -170,7 +170,7 @@ static int _dpu_format_get_plane_sizes_ubwc( return 0; } -static int _dpu_format_get_plane_sizes_linear( +static int _dpu_format_populate_plane_sizes_linear( const struct msm_format *fmt, struct drm_framebuffer *fb, struct dpu_hw_fmt_layout *layout) @@ -244,12 +244,21 @@ static int _dpu_format_get_plane_sizes_linear( return 0; } -static int dpu_format_get_plane_sizes( - const struct msm_format *fmt, +/* + * dpu_format_populate_addrs - populate non-address part of the layout based on + * fb, and format found in the fb + * @fb: framebuffer pointer + * @layout: format layout structure to populate + * + * Return: error code on failure or 0 if new addresses were populated + */ +int dpu_format_populate_plane_sizes( struct drm_framebuffer *fb, struct dpu_hw_fmt_layout *layout) { - if (!layout || !fmt) { + const struct msm_format *fmt; + + if (!layout || !fb) { DRM_ERROR("invalid pointer\n"); return -EINVAL; } @@ -260,10 +269,12 @@ static int dpu_format_get_plane_sizes( return -ERANGE; } + fmt = msm_framebuffer_format(fb); + if (MSM_FORMAT_IS_UBWC(fmt) || MSM_FORMAT_IS_TILE(fmt)) - return _dpu_format_get_plane_sizes_ubwc(fmt, fb, layout); + return _dpu_format_populate_plane_sizes_ubwc(fmt, fb, layout); - return _dpu_format_get_plane_sizes_linear(fmt, fb, layout); + return _dpu_format_populate_plane_sizes_linear(fmt, fb, layout); } static int _dpu_format_populate_addrs_ubwc( @@ -377,7 +388,7 @@ static int _dpu_format_populate_addrs_linear( return 0; } -int dpu_format_populate_layout( +int dpu_format_populate_addrs( struct msm_gem_address_space *aspace, struct drm_framebuffer *fb, struct dpu_hw_fmt_layout *layout) @@ -398,11 +409,6 @@ int dpu_format_populate_layout( fmt = msm_framebuffer_format(fb); - /* Populate the plane sizes etc via get_format */ - ret = dpu_format_get_plane_sizes(fmt, fb, layout); - if (ret) - return ret; - /* Populate the addresses given the fb */ if (MSM_FORMAT_IS_UBWC(fmt) || MSM_FORMAT_IS_TILE(fmt)) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_formats.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_formats.h index ef1239c95058..2f2bff14c0db 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_formats.h +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_formats.h @@ -32,7 +32,7 @@ static inline bool dpu_find_format(u32 format, const u32 *supported_formats, } /** - * dpu_format_populate_layout - populate the given format layout based on + * dpu_format_populate_addrs - populate buffer addresses based on * mmu, fb, and format found in the fb * @aspace: address space pointer * @fb: framebuffer pointer @@ -41,9 +41,13 @@ static inline bool dpu_find_format(u32 format, const u32 *supported_formats, * Return: error code on failure, -EAGAIN if success but the addresses * are the same as before or 0 if new addresses were populated */ -int dpu_format_populate_layout( +int dpu_format_populate_addrs( struct msm_gem_address_space *aspace, struct drm_framebuffer *fb, struct dpu_hw_fmt_layout *fmtl); +int dpu_format_populate_plane_sizes( + struct drm_framebuffer *fb, + struct dpu_hw_fmt_layout *layout); + #endif /*_DPU_FORMATS_H */ diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c index 241c2d7a218a..8191282b8819 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c @@ -674,10 +674,19 @@ static int dpu_plane_prepare_fb(struct drm_plane *plane, } } + ret = dpu_format_populate_plane_sizes(new_state->fb, &pstate->layout); + if (ret) { + DPU_ERROR_PLANE(pdpu, "failed to get format plane sizes, %d\n", ret); + if (pstate->aspace) + msm_framebuffer_cleanup(new_state->fb, pstate->aspace, + pstate->needs_dirtyfb); + return ret; + } + /* validate framebuffer layout before commit */ - ret = dpu_format_populate_layout(pstate->aspace, - new_state->fb, - &pstate->layout); + ret = dpu_format_populate_addrs(pstate->aspace, + new_state->fb, + &pstate->layout); if (ret) { DPU_ERROR_PLANE(pdpu, "failed to get format layout, %d\n", ret); if (pstate->aspace) From patchwork Mon Jun 24 21:13:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 807071 Received: from mail-lf1-f45.google.com (mail-lf1-f45.google.com [209.85.167.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id ADFDA19F48D for ; Mon, 24 Jun 2024 21:13:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719263639; cv=none; b=Kmj6OVwggMeQ9XyM1zGnA7PmvSw3GIqJ7Enj3VNUfNSzAK+uY1nc8JrVL9mHMGvu0HiSa+pmx2n4qGe8u2DoCUJApR3gkzq1Whdi6QG+PlvAwe8EsmpOe4VUP795qXPrYYF0wj/dbSGWelVJxYOnpesg7ng0nFjXgkWnETfQlu0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719263639; c=relaxed/simple; bh=KA3D+m/a7g73ZaHa7e8wf9n+neLVMHpRovLAs28rnZU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=FsBE7TdDWcuyGaxvfGcK8p47GkAcOBy9R9YGk2VsITflvwMlSPHe1RjWyEqFtYv98sdd/VW4uZiBesr2tU9hHHKUf2uVswdfA6tjrjeaV2lR+7rTFU+oIFSWBexyXLB5c99vRD1Yd9EsPjIztnrxDqk1knYiteM1m3ItKtZO9Z0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=jPC5A9u5; arc=none smtp.client-ip=209.85.167.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="jPC5A9u5" Received: by mail-lf1-f45.google.com with SMTP id 2adb3069b0e04-52cdb0d8107so4040717e87.1 for ; Mon, 24 Jun 2024 14:13:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1719263636; x=1719868436; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=fQ+DHa1toN2+n7TWo7+TJQaBjFWVOUMw0Gcw8PZtG9Y=; b=jPC5A9u55Cz8/99Nxv8IXnLTO0p2M81i4DcuF3PqzPhAcsW1xEgUdM3bzhYSEniXBF Mm0MjaMc7j5oJjRpf5UEP3X7PSrPCuWvr/LuJLzXuKkcSz3rR5MzBSfOA8CaHFhTscgR LtoWj63K6bhp/vCWK4OJpN3HgQ9TJPiaRYSaAoeZ2M+xQ4Dcn2lIZSYZ/GjeCZ+fpqvy 0UNGFbVPBWloKYnZjafDz2HQMi2u0Rqx06/i7Fgjpe8tQ9Xwziml0eKSqlMDqrMSY53o YKarmhMU9cIYSHNrzJpmdxM6MPvOtDLIvgr26WXBLRn+giuWfPxbI25tKLBj45XRvG0b O2ow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719263636; x=1719868436; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=fQ+DHa1toN2+n7TWo7+TJQaBjFWVOUMw0Gcw8PZtG9Y=; b=FCPB3P+x2E2nMAt5tjyO/BYsolGsF1OqISbeSyFh/uhVrWhIOVS7CbDgb1eSBffcp6 h53nN5sr8t4FkrktdqcxGUZbI0JHx0qpqmnJnRZ02OELdijV0r3XyAVQjG1IH/WMRg39 xM578fGGhzPn+NgUr6W0SvtZsaYl2h8c0WyXzvMPLq2J3Ayd4zCNZs26pogyHg5GHsBI g5Ro6PIYLWo7tVSEuh2KdIFpbWkzf27tNNtGze5AHSv8D/zER/oYDm3o+40lIfEqqFBc 0D+XO4hn/n+Aaokd9gFIcpaXVVhJjuml+JQmt11YgQK4hUijtZxFe1jfkcqdHuw1/FtM 3SmQ== X-Forwarded-Encrypted: i=1; AJvYcCWtzDLaVidqlYNmnHdlq0t6jYx8kO2tY23lgytcxkhqn6gnDhIH/Pv0xN8PIVFGhQeNr9tgpjq9pr036fDhHUVWrRi8SJLxqlJ7005znA== X-Gm-Message-State: AOJu0YyNMNSdx9RPgKfk1y6oAJGHE+D+bKPsVUQlEt1b2gH9JJPb44Pf jDricT4r6flxHQUCg7iC4Bl/3oyfWyzbM/bVfFNd+aUwWCni7ejT37PpcRObCoo= X-Google-Smtp-Source: AGHT+IGWt/LXA2KMs7RS+iu+Bu8klNrfjdBf/mEJe/fEN6UonHslShDU5B6mjmWqj3kffaWDvXxzCw== X-Received: by 2002:a19:6b08:0:b0:52c:8944:2427 with SMTP id 2adb3069b0e04-52cdf7f65f3mr4135378e87.31.1719263636039; Mon, 24 Jun 2024 14:13:56 -0700 (PDT) Received: from umbar.lan ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-52cd63b49f2sm1057512e87.56.2024.06.24.14.13.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Jun 2024 14:13:55 -0700 (PDT) From: Dmitry Baryshkov Date: Tue, 25 Jun 2024 00:13:53 +0300 Subject: [PATCH v5 13/16] drm/msm/dpu: move layout setup population out of dpu_plane_prepare_fb() Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240625-dpu-mode-config-width-v5-13-501d984d634f@linaro.org> References: <20240625-dpu-mode-config-width-v5-0-501d984d634f@linaro.org> In-Reply-To: <20240625-dpu-mode-config-width-v5-0-501d984d634f@linaro.org> To: Rob Clark , Abhinav Kumar , Sean Paul , Marijn Suijten , David Airlie , Daniel Vetter Cc: Abel Vesa , Johan Hovold , linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, Dmitry Baryshkov X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=3077; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=KA3D+m/a7g73ZaHa7e8wf9n+neLVMHpRovLAs28rnZU=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBmeeGJc+UK3nuvzNMK7zG+4jXibMyipXO8oslij VTDrAuOQteJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZnnhiQAKCRCLPIo+Aiko 1bBuB/9DPqusQEDVhZuLT89pAyYTgat2sPdMAaMwHfJeW3Bk0ixx0YJaxEWbW/ikxoly3EVJJeP 6jXMU8CGkewneOhqb+yl2G+2oIzK9rbpqBIi0jf8xuJ67/hlOa6XR5oeVZ4PtNuUtqWMgXJvgFs HJxuVy2VuqN2/+XNhoP05xpreYUb7mjCQN8GT0uxBQwZO3aJPt1uOc5MVjun1eQPTcu5wIWTCdJ aIbpzB8Lz4NUFyDPVvBdN286xMwHN/gvLNw5Z1A6/z9OWGlYHq2lDdswJXMwNYgPyI5j9r1JfjO xZlFo1kQNW7vDUcrZjNhnlnxLmFZo4hrThNBN1s8wzMXrdGb X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A Move the call to dpu_format_populate_plane_sizes() to the atomic_check step, so that any issues with the FB layout can be reported as early as possible. At the same time move the call to dpu_format_populate_addrs() to dpu_plane_sspp_atomic_update(). This way the all layout management is performed only for the visible planes: the .prepare_fb callback is called for not visible planes too, so keeping dpu_format_populate_addrs in dpu_plane_prepare_fb() will require dpu_format_populate_plane_sizes() to be called for !visible planes too. Signed-off-by: Dmitry Baryshkov Reviewed-by: Abhinav Kumar --- drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c index 1431ea753a4f..a309b06b0992 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c @@ -674,19 +674,6 @@ static int dpu_plane_prepare_fb(struct drm_plane *plane, } } - ret = dpu_format_populate_plane_sizes(new_state->fb, &pstate->layout); - if (ret) { - DPU_ERROR_PLANE(pdpu, "failed to get format plane sizes, %d\n", ret); - if (pstate->aspace) - msm_framebuffer_cleanup(new_state->fb, pstate->aspace, - pstate->needs_dirtyfb); - return ret; - } - - dpu_format_populate_addrs(pstate->aspace, - new_state->fb, - &pstate->layout); - return 0; } @@ -863,6 +850,12 @@ static int dpu_plane_atomic_check(struct drm_plane *plane, return -E2BIG; } + ret = dpu_format_populate_plane_sizes(new_plane_state->fb, &pstate->layout); + if (ret) { + DPU_ERROR_PLANE(pdpu, "failed to get format plane sizes, %d\n", ret); + return ret; + } + fmt = msm_framebuffer_format(new_plane_state->fb); max_linewidth = pdpu->catalog->caps->max_linewidth; @@ -1090,7 +1083,8 @@ static void dpu_plane_sspp_update_pipe(struct drm_plane *plane, _dpu_plane_set_qos_remap(plane, pipe); } -static void dpu_plane_sspp_atomic_update(struct drm_plane *plane) +static void dpu_plane_sspp_atomic_update(struct drm_plane *plane, + struct drm_plane_state *new_state) { struct dpu_plane *pdpu = to_dpu_plane(plane); struct drm_plane_state *state = plane->state; @@ -1111,6 +1105,8 @@ static void dpu_plane_sspp_atomic_update(struct drm_plane *plane) pstate->needs_qos_remap |= (is_rt_pipe != pdpu->is_rt_pipe); pdpu->is_rt_pipe = is_rt_pipe; + dpu_format_populate_addrs(pstate->aspace, new_state->fb, &pstate->layout); + DPU_DEBUG_PLANE(pdpu, "FB[%u] " DRM_RECT_FP_FMT "->crtc%u " DRM_RECT_FMT ", %p4cc ubwc %d\n", fb->base.id, DRM_RECT_FP_ARG(&state->src), crtc->base.id, DRM_RECT_ARG(&state->dst), @@ -1175,7 +1171,7 @@ static void dpu_plane_atomic_update(struct drm_plane *plane, if (!new_state->visible) { _dpu_plane_atomic_disable(plane); } else { - dpu_plane_sspp_atomic_update(plane); + dpu_plane_sspp_atomic_update(plane, new_state); } } From patchwork Mon Jun 24 21:13:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 807070 Received: from mail-lf1-f46.google.com (mail-lf1-f46.google.com [209.85.167.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1D2151A0AF0 for ; Mon, 24 Jun 2024 21:13:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719263640; cv=none; b=oFvykaN8qLq1rTJsL99iQKhLG0vvqOmTmPisEFf2YTaY7mESOz+Ac3sD/FXlOJx8Xmt/rwl/JYTOXv4kChXnA0daICCi/RTAoNX9ng4VnT7lBveYjyfceJN50L4E2mzPFvThSUtlf4sLQHgaCDTEWs+pvTN+A3FyeXeObJnpxPs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719263640; c=relaxed/simple; bh=ga/ZJbhrUVk+TaFBI1WYIbgIC50tjM64eskl8EV4ahM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Zh/1pfqcKfdDynE6aeVi0qIWw2vAy4iE/IZj8CFqad/xZm6layl1vJdEFaPLe73Gme7QQyYkAvTw5X/O/8M7kfe4xgSjaG0FTAPk2ZBs2Feo28QkkgD4G0WtMmYzEdlO0bWnqif+ayVkU06C//dDFaKFC9tJo+5XudaE7N8NA3c= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=L9YpOSUG; arc=none smtp.client-ip=209.85.167.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="L9YpOSUG" Received: by mail-lf1-f46.google.com with SMTP id 2adb3069b0e04-52ce6a9fd5cso1336002e87.3 for ; Mon, 24 Jun 2024 14:13:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1719263637; x=1719868437; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=nhtUg4xKtrM2KIw9xkdeNLk1MwemvpEptf/1N559jEI=; b=L9YpOSUGGvi0jf1r0/SDPx4SDlRnR4L9vYxk7Y1FzfngIs7UIa51klvQJkJjSuF/RS iN2g8qo89gA42ovP2HcMsXnNze94Gu6gBabgd8pFXWyc1EHZ4Bn3RcMu+XcpcMRMhfNT rZ/DLvA6PN9Tlvh3ojUI0wxjZ3mIu0Zi4yfvvH5BuM+r40CKY3Xqlrj95GjNzUcIfs19 Tr/9jP1Es0FyAgnYU3igTUhXTM16v47yBv3iVdNlMyRJJFPmNZGlIAkSN8VErFaawMOP hlezhLwyFsscbJacjIOCRGi83zSSjeFFDXLkBGuQ3gW94UDWPZQyPQ0DYuIdT+u37Etc tDqw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719263637; x=1719868437; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=nhtUg4xKtrM2KIw9xkdeNLk1MwemvpEptf/1N559jEI=; b=jX1j3LkpGRhErwMSx8TC3RbSdX4PS9FFZDJAIaFBExcmOlm5dEruEVNTk1ZEXQ9RqV 7kEe50UKUU9ZFsi/PZ2XblbfWkPOvFcOKiUxwfbs480hqXvrLspPM1Yasnw5LQCXIFI7 o8f01/eWIJB+9XxmWhydyFYXbBnCY8qSuMddovGYxKnqXzbHwfjpVj7JomnncDdInWYd /3ZRm4hvMXUgdZ+GRh9LHKiZ7maEk1ZSmlQ7IAdtNasyUNQ6B5bmau5Kd5wK3fuFrTwT QAdViBoRtZgVvC2u045pefsVY7ri8VshtCp9I/LZW46aVHYkqTwgznTQXjdgyhKrZjKW qdcA== X-Forwarded-Encrypted: i=1; AJvYcCUJ6sDpEqhgw8L8FnKB/M4A4J0MB/IMvPaoNb7zcfd4f67nuTza7TEqKj8TmClVbavtYQt34QXjeZDbOyDaYyvxIRH2P5ESlnt+zLEeFQ== X-Gm-Message-State: AOJu0YyZBbzhNHF2jl0dEbo1tAoL1Rz/+09KB4uw1L2zUHKUIza25K/j tPjRD6009loNpTLUVoRvyv76BRWeYMWdE15cnGApZs+8x9ehhbga+B7yHOBLdMw= X-Google-Smtp-Source: AGHT+IEn/8pYFHHsUYsCUA3AH0wMuD8BbY+Hf+vcS8G2aWxv4w8Ud3QJK2CWcY8TABy4XijCrjJkOQ== X-Received: by 2002:a05:6512:3285:b0:52c:df9c:5983 with SMTP id 2adb3069b0e04-52ce183b3d6mr2919217e87.40.1719263637413; Mon, 24 Jun 2024 14:13:57 -0700 (PDT) Received: from umbar.lan ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-52cd63b49f2sm1057512e87.56.2024.06.24.14.13.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Jun 2024 14:13:57 -0700 (PDT) From: Dmitry Baryshkov Date: Tue, 25 Jun 2024 00:13:55 +0300 Subject: [PATCH v5 15/16] drm/msm/dpu: merge MAX_IMG_WIDTH/HEIGHT with DPU_MAX_IMG_WIDTH/HEIGHT Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240625-dpu-mode-config-width-v5-15-501d984d634f@linaro.org> References: <20240625-dpu-mode-config-width-v5-0-501d984d634f@linaro.org> In-Reply-To: <20240625-dpu-mode-config-width-v5-0-501d984d634f@linaro.org> To: Rob Clark , Abhinav Kumar , Sean Paul , Marijn Suijten , David Airlie , Daniel Vetter Cc: Abel Vesa , Johan Hovold , linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, Dmitry Baryshkov X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2318; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=ga/ZJbhrUVk+TaFBI1WYIbgIC50tjM64eskl8EV4ahM=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBmeeGJAq5u69LbJZTDB43AiTQO6FQYIkCXkTmRu eVRk56LecGJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZnnhiQAKCRCLPIo+Aiko 1Z1cB/95kYcJ6MM1VT/CFKPYNkgMpsCb2dVm/zUSYjD8VQyqepy6r/jXYCQLbayClbStTkVmKGV ecp/6RAjzsqNpArXEBQosfscQujCR50Sy3DEzZjTGM1GAOwng2rGPtDSaYv3GBd1R38c4F6jCEA gulNrLuWrdCMm4zW8R+/k0EJ9LtXWfhjjU4vajHA8WCdUEfbQ6BWYha9UzJbf31z0/bwwh/LedY +sBllkx2Up+Rgo8c4utPMZkWJ8xi+yQmeY5tELoColQmuWEeYAvoz+GQciVDj6Rhy9tnhvtnBQj ctKJ9Y3juol4cMER9MaCxjDz5uqhTev0JwdVH389Dxq5KFQ5 X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A dpu_formats.c defines DPU_MAX_IMG_WIDTH and _HEIGHT, while dpu_hw_catalog.h defines just MAX_IMG_WIDTH and _HEIGHT. Merge these constants to remove duplication. Reviewed-by: Abhinav Kumar Tested-by: Abhinav Kumar # sc7280 Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c | 3 --- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h | 4 ++-- drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c | 4 ++-- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c index 095bb947f1ff..b0909cbd91cb 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c @@ -13,9 +13,6 @@ #define DPU_UBWC_PLANE_SIZE_ALIGNMENT 4096 -#define DPU_MAX_IMG_WIDTH 0x3FFF -#define DPU_MAX_IMG_HEIGHT 0x3FFF - /* * struct dpu_media_color_map - maps drm format to media format * @format: DRM base pixel format diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h index 37e18e820a20..34e60483fbcf 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h @@ -21,8 +21,8 @@ #define DPU_HW_BLK_NAME_LEN 16 -#define MAX_IMG_WIDTH 0x3fff -#define MAX_IMG_HEIGHT 0x3fff +#define DPU_MAX_IMG_WIDTH 0x3fff +#define DPU_MAX_IMG_HEIGHT 0x3fff #define CRTC_DUAL_MIXERS 2 diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c index a629eb3a6436..4712aa6f7929 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c @@ -843,8 +843,8 @@ static int dpu_plane_atomic_check(struct drm_plane *plane, fb_rect.y2 = new_plane_state->fb->height; /* Ensure fb size is supported */ - if (drm_rect_width(&fb_rect) > MAX_IMG_WIDTH || - drm_rect_height(&fb_rect) > MAX_IMG_HEIGHT) { + if (drm_rect_width(&fb_rect) > DPU_MAX_IMG_WIDTH || + drm_rect_height(&fb_rect) > DPU_MAX_IMG_HEIGHT) { DPU_DEBUG_PLANE(pdpu, "invalid framebuffer " DRM_RECT_FMT "\n", DRM_RECT_ARG(&fb_rect)); return -E2BIG;