From patchwork Mon Jun 24 14:47:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13709658 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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id EDF54C2D0D1 for ; Mon, 24 Jun 2024 14:47:24 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 81B7B10E48B; Mon, 24 Jun 2024 14:47:22 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="q8sEKT5U"; dkim-atps=neutral Received: from mail-lf1-f51.google.com (mail-lf1-f51.google.com [209.85.167.51]) by gabe.freedesktop.org (Postfix) with ESMTPS id DA54C10E47E for ; Mon, 24 Jun 2024 14:47:16 +0000 (UTC) Received: by mail-lf1-f51.google.com with SMTP id 2adb3069b0e04-52cdd03d6aaso2274747e87.0 for ; Mon, 24 Jun 2024 07:47:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1719240435; x=1719845235; darn=lists.freedesktop.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=QnAQMhTqxkoTHi2sUlyi5iGRZ0J/13FG1QGdqL66JnI=; b=q8sEKT5U/CMqlkxSdbj3aEOok4ZIDQgjQm82+63Iitk13PsWCCJcZjB2vTH1u2lP7R a0rFiQVt4VI1seJVs87egIhPYWEFLrvkMchth2WUxCqC+SzQn4zu5bK7oknVDCbgHfZs KtAz7YpJxPFQeF5NRTyS/vMo1E66IZcT8ly8TY2Ru2AixYAbCJofM19c6xk+kRHxq/Y9 8ryn0mkLzjs3TfpYj3Zg2tBHKHy3HuH+7YKb886nOV/7vTOSKIjrIOxOt7z7EWuaMwvJ G4G8FA4QIawwWgndaBaxBGFtvV7xoS8KZ7WnzoflSh7yIIqBNctehgumtSi1qCXgwyO5 FR9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719240435; x=1719845235; 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=QnAQMhTqxkoTHi2sUlyi5iGRZ0J/13FG1QGdqL66JnI=; b=ZXWUWMzpEpRCKhGmuGKmqrOwLplRZI9bk47zDrTchwzmpmGdGntxHYup3RxHPdZ7BT hVQlCURPYroWMEfsxbUyhqJ4N0L2wv4FE4WLb9JfKW94S4ufXH/8neH5jLZmHScN2tK3 kd3fxzEj8bPbQ3WBn2fQr9qeakYSPeDV8XBCHo9PVliZByNpAumMad0WLwPh/YnxdZrd OTif02upffVzhIO4YV6GYXtwnIDwAFiS3ypbGuLGzHUblIHGoTjtzLd/MPRBhc56FT9K I2rqYOFHIetk63bWsLy9tKYdrFpVnhdCWprj8cDCZ1ghzKKtlyJnEzBhdlIvepLQSYvm uaUw== X-Forwarded-Encrypted: i=1; AJvYcCVOIjKTw5Ov+o9IUwugWYHKILpc0Gv1oxGIQdLTtUnh77I81kVz7igvwq8vDSoa8MGJOUMcgXzIaU0PXB40V6RaVwoaXzaptO59t8tXMKbo X-Gm-Message-State: AOJu0YzVAyHx3EL1S0wXQ9lhoxaTP3qEGWzjefBeJwhhmCYsxv6673Nw owUZ++jpAG7snJHWd+gKbEuShuMV4iIj1LRzbmeArFcWU+qUlcLhcOBsfCcEXPQ= X-Google-Smtp-Source: AGHT+IGR6c9ZmdfMXtWz3IjqPg4XkHqNQRscHzayqBpLuf0iLJj+JC5OfMgRfjVGlG5LupzTQ9MqUA== X-Received: by 2002:a05:6512:118e:b0:52c:ab83:d783 with SMTP id 2adb3069b0e04-52ce063d63emr3920439e87.6.1719240434879; Mon, 24 Jun 2024 07:47:14 -0700 (PDT) Received: from umbar.lan ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-52ce88b0119sm212699e87.222.2024.06.24.07.47.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Jun 2024 07:47:14 -0700 (PDT) From: Dmitry Baryshkov Date: Mon, 24 Jun 2024 17:47:07 +0300 Subject: [PATCH v4 01/16] drm/msm/dpu: cleanup FB if dpu_format_populate_layout fails MIME-Version: 1.0 Message-Id: <20240624-dpu-mode-config-width-v4-1-1038c13da3a5@linaro.org> References: <20240624-dpu-mode-config-width-v4-0-1038c13da3a5@linaro.org> In-Reply-To: <20240624-dpu-mode-config-width-v4-0-1038c13da3a5@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=2033; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=CRnQPNrk6tMn0RWlkSywOwQLtsZdvuYbpLeYPQfOvOQ=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBmeYbu+jggU2r5wb55W+ZbzfufMt2fcPzor3sSw rUcv0Se2GiJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZnmG7gAKCRCLPIo+Aiko 1aqlB/9g7BBBZ26cS0eSgzqsLSSvrm6ZAuiCyVP1eUlsUiDQA5gCvnvZGreQjEHhTAjrEAQGkc8 FtKaWDgY7btLUi+DYxZ3zJiPOMy/Tqt9NaRV4HF77sS2baOrKIW41AvZk1dR7rYGACfbP3hqnlR diczBoF49Hp8YVnNuaQUs2TEFv+3SLVK6SjarADQiA0ZaLksy+0sJVIPviT8rK9l2hs3s/Pp0yE SIcj8k9POpjtz5+pSJQVF5uA4z0pjBoqLuhziHsxvOWmbXHc2oVXEe1u+nvB0Vb9vuPGHIH9N93 kRnUG9P6t6m5amGJvwOuwK2jW9XDFSKNlXZPEHbIgv4PsJ91 X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" If the dpu_format_populate_layout() fails, then FB is prepared, but not cleaned up. This ends up leaking the pin_count on the GEM object and causes a splat during DRM file closure: msm_obj->pin_count WARNING: CPU: 2 PID: 569 at drivers/gpu/drm/msm/msm_gem.c:121 update_lru_locked+0xc4/0xcc [...] Call trace: update_lru_locked+0xc4/0xcc put_pages+0xac/0x100 msm_gem_free_object+0x138/0x180 drm_gem_object_free+0x1c/0x30 drm_gem_object_handle_put_unlocked+0x108/0x10c drm_gem_object_release_handle+0x58/0x70 idr_for_each+0x68/0xec drm_gem_release+0x28/0x40 drm_file_free+0x174/0x234 drm_release+0xb0/0x160 __fput+0xc0/0x2c8 __fput_sync+0x50/0x5c __arm64_sys_close+0x38/0x7c invoke_syscall+0x48/0x118 el0_svc_common.constprop.0+0x40/0xe0 do_el0_svc+0x1c/0x28 el0_svc+0x4c/0x120 el0t_64_sync_handler+0x100/0x12c el0t_64_sync+0x190/0x194 irq event stamp: 129818 hardirqs last enabled at (129817): [] console_unlock+0x118/0x124 hardirqs last disabled at (129818): [] el1_dbg+0x24/0x8c softirqs last enabled at (129808): [] handle_softirqs+0x4c8/0x4e8 softirqs last disabled at (129785): [] __do_softirq+0x14/0x20 Fixes: 25fdd5933e4c ("drm/msm: Add SDM845 DPU support") Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c index 1c3a2657450c..eabc4813c649 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c @@ -680,6 +680,9 @@ static int dpu_plane_prepare_fb(struct drm_plane *plane, new_state->fb, &layout); if (ret) { DPU_ERROR_PLANE(pdpu, "failed to get format layout, %d\n", ret); + if (pstate->aspace) + msm_framebuffer_cleanup(new_state->fb, pstate->aspace, + pstate->needs_dirtyfb); return ret; } From patchwork Mon Jun 24 14:47:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13709656 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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 22372C30659 for ; Mon, 24 Jun 2024 14:47:20 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8528510E482; Mon, 24 Jun 2024 14:47:18 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="GMYVu7p5"; dkim-atps=neutral Received: from mail-lf1-f44.google.com (mail-lf1-f44.google.com [209.85.167.44]) by gabe.freedesktop.org (Postfix) with ESMTPS id 63B5310E481 for ; Mon, 24 Jun 2024 14:47:17 +0000 (UTC) Received: by mail-lf1-f44.google.com with SMTP id 2adb3069b0e04-52ce6c93103so1259752e87.3 for ; Mon, 24 Jun 2024 07:47:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1719240435; x=1719845235; darn=lists.freedesktop.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=GMYVu7p5ssfkhAmcsYTe8E2OJjGHm68wM2e+FBMGUl/X61J+aauNxqMXq8QEIKWW+Y j5f4lCOrGmeJuJhzVEvCVZVqX511S66vcuhFO+1KxSeT4RpiNfFsZE/hOWT8RRLlhNy3 6s6IBUwF3syA68966bT3GYNfauLNR0zRhHvuPpqfxPM2hl1vn4FpfjFEaq/JKJuG8+Cl i2b30FpieJoWDkSEyIMgaYqY8gDw01VsF4Cz25mB5wmOg0SnZhm5XSjXftryHQ4RmXNS sya4eis7CGpA8hFgj/tOJ1DYNMNTL7oaiFkxddZDtaYQpPbP8JfG0hN+Phba0bphDl9r ghZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719240435; x=1719845235; 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=miJhgkt304rFB+zuQtw6R8nI5GvBphrrsrBcVQmB9OEA5J/D7Bv9oJ+SQCV0VuZBXo Cca9A7sm46OyHtTlNkLCnZnilIyrFtowh/7fNmvTczN90RTatt8/9Oa9vGXPewQIySYS WXK2TZRhxjleyuVieoJMmhLH5x8gJHtNlrHy7Gr016EGuW3k2AklzS3K+LHee+M7KYsM yJ70a8n1F4mRNBcNG+CMiL9GY3buEWtuj5NdUDzk0DQywNXiTgF3ulAlA1DSmOft4GpZ E6mVtJqLMcTcn6abkC9tl9msi+hNnWxFGnjSQwl/d7g6SD+JVofupqVr1V69sxc2jAHI vuFg== X-Forwarded-Encrypted: i=1; AJvYcCWpokceMkdHDptSmM0hGOetumMgl9zasMBjBclhELJNnXUpq127s7IygSq+tLuN6qkeGcQKaeuP9VYMxvdNrWtQAQikZlZhZd1uFrXkEsPk X-Gm-Message-State: AOJu0YzFQWjPBYY7Lfgh3oiD7Gw7PEg/iYtA5aa/R0lG6Ytqan7ul/tr 9sZPEwd9EgxFxGx2JbVFfQNxejmEG/12ZwEP5JmCERgTmHWsFosIA1Ts8Mp+WlU= X-Google-Smtp-Source: AGHT+IG9XQZH8vVq5U1wPy03/Dvvg6G4k8zrzQteJbpTunyDlaiRdE1Gt9CrbeLQb42jxx0g8S8k4g== X-Received: by 2002:ac2:5323:0:b0:52b:c08d:2da4 with SMTP id 2adb3069b0e04-52ce1832bb1mr3251520e87.25.1719240435499; Mon, 24 Jun 2024 07:47:15 -0700 (PDT) Received: from umbar.lan ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-52ce88b0119sm212699e87.222.2024.06.24.07.47.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Jun 2024 07:47:15 -0700 (PDT) From: Dmitry Baryshkov Date: Mon, 24 Jun 2024 17:47:08 +0300 Subject: [PATCH v4 02/16] drm/msm/dpu: fix error condition in dpu_encoder_virt_atomic_mode_set MIME-Version: 1.0 Message-Id: <20240624-dpu-mode-config-width-v4-2-1038c13da3a5@linaro.org> References: <20240624-dpu-mode-config-width-v4-0-1038c13da3a5@linaro.org> In-Reply-To: <20240624-dpu-mode-config-width-v4-0-1038c13da3a5@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/pANAwAKAYs8ij4CKSjVAcsmYgBmeYbuJwKa24N4M3csWqmLjl/yvXWGrIS5Dbxc/ fnHgz2KVlKJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZnmG7gAKCRCLPIo+Aiko 1etuB/oC/397sgNrRpSvQW3fYMrq4rjPdn53SDAEGzYshP1DLO0GM7Axckw0GgwOGDG9SKNvfrF wA11CMfdcB1BCrgedxzmu25sDLHGQIoIB0H+a5X6fnLaQoqYt9H7jshYymwHugSNClQdSODpDJN VK0oUzbNSL8X2OwxmpVRuU2/KLdH8/BW3yc+AJL2lnFZGeGKGiSJXdjug/fz5DyVp8J/mXaa/Ek bReNuzxc5kPlv48WomDg9DjdoMUU/Lg5/FkX1scY8zojVeOsJO9J1h/u5sxuOS3zFxcTVVway4H u+f2MUbBxirh6ugA9Qyf+T/KheEQSaVndcrCZ3MJaw9EtRzC X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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 14:47:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13709661 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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 1D9CFC2BD09 for ; Mon, 24 Jun 2024 14:47:30 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8D54F10E495; Mon, 24 Jun 2024 14:47:23 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="C4Ae3zWo"; dkim-atps=neutral Received: from mail-lf1-f47.google.com (mail-lf1-f47.google.com [209.85.167.47]) by gabe.freedesktop.org (Postfix) with ESMTPS id E4E4610E482 for ; Mon, 24 Jun 2024 14:47:17 +0000 (UTC) Received: by mail-lf1-f47.google.com with SMTP id 2adb3069b0e04-52ce6c93103so1259769e87.3 for ; Mon, 24 Jun 2024 07:47:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1719240436; x=1719845236; darn=lists.freedesktop.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=C4Ae3zWoSGfX2OSueQf1cg9heYDd6w9cm+kIR1PO2YGggzbFGHV6PBIRrgrOVhjfwQ mGaN78tieCPPl3/Hdm/soHEA5ZX1E2mkNHROkorSME8dHdf9MgcleFm9DAqE3GkZMwHi rcDWfY/I/BfJ6O3SiQNqRavrPxtcm0keFq8bELTWQ6tqy+eCts6GEGatMTvTvDXAAwJT LsmXkwTAIVEjFeqZvspE7CcZxYakctHCfuUDzbh6c6jnTXfAVlGXnnVC2/RfIN/SVeni G6FouXcRinkeuvcsyskXHae7qEzOtZWwrX97uYCUQ/UKw1Cl8dd0/HKYrtjRJEUKyPlT XoiA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719240436; x=1719845236; 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=qbmiqpwsnNMVLT/vLhG1GiwDkc9BaSuysWPyQS9p9oiLMygrjKJ+C5vFXFc4cRpl99 6gs7F+E0OUYuSsqyMWI57n/ow6lUB4V7biNNcvgw593M8dVnEMQ13NprIGH/3ZGgIHqC 8JKxbFHL0Bk8h+531Rht15nqUUregygmm2XFz7OgGeStLlZ6aWowoTbCOMCCQydMWDJe t3NjjobJidgiul2ZmYzF2nBTsGlSLmmMNJlko2NavFLjlq5m8tLkY8PUK/SWhP/OVdVu zo7t0L6v22r8Yv1jvq5dzhwMQ0g1dpkP4hZ6w1BUCzxbdJt/mkQtsAk87cGzUwKaZ6Qz 8CGA== X-Forwarded-Encrypted: i=1; AJvYcCX3kpVXHcnrqeMOiPk7o+KNmakl3y8LUCNZ2W24KMnvmZmZXeWdOLRGgrj0/7scR9w+0+gKDieOIst3uOqgnB0ul2iUVgd+bMWfmTIdzEr9 X-Gm-Message-State: AOJu0YykEpq2q2OLN2eanpsM+WTioN+2SNtogIqfhz2qAtHlGdLdXjuQ 1kZoRlOCLSSDidMEJz2Wd7tNSrC6DHFyrBumeQs2Q0f6uPIy28Zy8Cc1TJg1OVo= X-Google-Smtp-Source: AGHT+IGjWyw92lHNP7WN9sIPkY0MlaC5IXBfkIA1CI8Fj49YsgxAjvxPMLiq67r0wc0OT8gL23ScEQ== X-Received: by 2002:a19:e048:0:b0:52c:da18:618a with SMTP id 2adb3069b0e04-52ce185d011mr3404343e87.68.1719240436105; Mon, 24 Jun 2024 07:47:16 -0700 (PDT) Received: from umbar.lan ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-52ce88b0119sm212699e87.222.2024.06.24.07.47.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Jun 2024 07:47:15 -0700 (PDT) From: Dmitry Baryshkov Date: Mon, 24 Jun 2024 17:47:09 +0300 Subject: [PATCH v4 03/16] drm/msm/dpu: move CRTC resource assignment to dpu_encoder_virt_atomic_mode_set MIME-Version: 1.0 Message-Id: <20240624-dpu-mode-config-width-v4-3-1038c13da3a5@linaro.org> References: <20240624-dpu-mode-config-width-v4-0-1038c13da3a5@linaro.org> In-Reply-To: <20240624-dpu-mode-config-width-v4-0-1038c13da3a5@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/pANAwAKAYs8ij4CKSjVAcsmYgBmeYbv+lCDZcmtttJ+Vyy/aLapjmxxlpslC/UCp zEViRKo3VeJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZnmG7wAKCRCLPIo+Aiko 1dXoB/oD8Bb3sqlC33TAJAskbzM1jPxUaR8zv+D4s8LxmWRJDDod4NdeKjMZfVWXRhObKnjXPWF DE9M10kPevPDUG4SVwFiLLEVJdEOQSOmXjlArP+FPTAfqCkUuMKMe7rgT+C591Bdugwyj/wVVvj VdmJdKCQgDwSYjnHou7fbHcnJwqBm2N7IcrRgA9+qDwalZKGuNn6jWdZyZtYgSD0ftf7XwSaW/Y iQqsVCiEZiDJ51tFns9pYIzODC8YXAzd2jK6zQ+Yfa9pKxdg/jMxZSHuf/qr+5+GDdqs3VFwu2G SQGXpCFuhmQ620bLb+MIoWj7XJXWrhydqa4UJNKqaUB/iamX X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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 14:47:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13709665 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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 1641BC2D0D1 for ; Mon, 24 Jun 2024 14:47:36 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C871D10E4A0; Mon, 24 Jun 2024 14:47:29 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="ly1Q63vk"; dkim-atps=neutral Received: from mail-lf1-f50.google.com (mail-lf1-f50.google.com [209.85.167.50]) by gabe.freedesktop.org (Postfix) with ESMTPS id 8D8F610E484 for ; Mon, 24 Jun 2024 14:47:18 +0000 (UTC) Received: by mail-lf1-f50.google.com with SMTP id 2adb3069b0e04-52cdfb69724so2032227e87.1 for ; Mon, 24 Jun 2024 07:47:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1719240436; x=1719845236; darn=lists.freedesktop.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=r3jPJKGj8OxSKPS5o2ejJIGV+0itdtJDT4TJvhzbiLM=; b=ly1Q63vkA5bzu0Diulr9wEQRbFJtYUwhZJq283cXOS7K8yElSQNMeUUrYST8HxXbCM iAvRakZ+Vbg3z5lztkKjinHMtIQvlLGMm+k/NQnf/KaJaVBH/oV/V7rmzaxE5Bt054Q2 loF9uUaesKwemm/9fj4DAva+FL992xfNV4VYVCYg87sxAepLxCNAKZALZXk+gVCa3Yau Mf/PIfwPKWqkgKbRmPR7nXcTiHF3FPV+F18Xpv9NDBP7nFSn48sIrFfVjhI3DGpr3fyz 4PdXA0E4kIuiG+mRXw6Tg6mutvLxnRKoTQH1MNGxd5WNEBUeGb5BFkyBHkoSYa2Wf70Z JEUQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719240436; x=1719845236; 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=r3jPJKGj8OxSKPS5o2ejJIGV+0itdtJDT4TJvhzbiLM=; b=el+WINsql7xABQtsOodyxKu9/mzCFZWNxKtGg5ett0mizMSGQrMtz+cyo1cFzXVeX7 cvePmAK4F4FlACF/ZwtLve2nuIbYECqpTLMiZ94PH8JUe2bQ2h0aX4vETAVnvBgUMRzT CFGj86WX+TjtIkoBkngfO1MLGClDOqF1Cw7GIJij0vZksAT3syapYTCjU1+ve1tiVZNH Q5deqGQUbEs6PS1i6YZJaOycfC/kvfGE8qS1v+gHCHtDixgIiVCAyyBEOltJ9uqyYYBN oR+TSHP7GI99GwM3E1kQV4IFCU6sRvMt7VvDVJYdysUJpaUcoAThFLJFpAQsiNWvmF2T gbrQ== X-Forwarded-Encrypted: i=1; AJvYcCXZgdVZ1K7zLj/U2AT73Kha/gJNnphMFKYrDTWnw+wrw00kqKH5Kj10EV3ATNgtggR/6KQxQGbrRd2qHmrJrrTuuNeHL5aAYmf/FGSeiD5Z X-Gm-Message-State: AOJu0YwusQIRHvwmm56CBwIOzkGKBIjIace8n5kJTuyNs4PTCAgNvL0p l3cNCjuIEy+fgNTBGO/a/d4HzjshAvlPv4R7KC0pdAzkMUzJK8RdEMqkjDQ3tKc= X-Google-Smtp-Source: AGHT+IG2rVpRnuC/or1aoJ3OgIsBYkfVlsZjqYs6+9vSqSRP0WPwAHekhHe2O4QoX9mTOt+dKai73w== X-Received: by 2002:a19:911e:0:b0:52c:de9e:194 with SMTP id 2adb3069b0e04-52ce1835b48mr2505822e87.28.1719240436733; Mon, 24 Jun 2024 07:47:16 -0700 (PDT) Received: from umbar.lan ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-52ce88b0119sm212699e87.222.2024.06.24.07.47.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Jun 2024 07:47:16 -0700 (PDT) From: Dmitry Baryshkov Date: Mon, 24 Jun 2024 17:47:10 +0300 Subject: [PATCH v4 04/16] drm/msm/dpu: check for overflow in _dpu_crtc_setup_lm_bounds() MIME-Version: 1.0 Message-Id: <20240624-dpu-mode-config-width-v4-4-1038c13da3a5@linaro.org> References: <20240624-dpu-mode-config-width-v4-0-1038c13da3a5@linaro.org> In-Reply-To: <20240624-dpu-mode-config-width-v4-0-1038c13da3a5@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=2549; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=CZE5vDwajgZiWlqIb9olYzIUdaIeeSo/h+Ci8Lw3dmw=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBmeYbv8tPawkIlNzBU4WuRY5zvu7hLWv5V80J4r b43g5OLjhqJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZnmG7wAKCRCLPIo+Aiko 1aLOB/9TRPnoQotfNBwvjifZD/Pvgrbrm8iQ5GUzJNnUHUiyeYJvB1iNjVIOcXqvtv4T/QeaNQP Khr5m8POepERwJDFEt/ZTbPdHsaQ7l7piTZ+F7MGFvG6m6zQ01ng/NqeD8UNDju1QLGhjD9GhVK qyiBtOiJEfrTP6tYmBLh9fsNE9Cb9Pr7mDZW9p4x/prlW05o11nxvQvxHt4gQlbiknlb6AA6ZNQ JrbbDfVV1K9Whyu9HS5tdnPh5DSq6/4nHP6l1lco2dGyiz3RKPmNnbWHr7uSQaZlAbkWeuRUbcR cMYfWBjBS6IQpYWumvOaiyRvRTpTXHJy7ig1882+S834duvo X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Make _dpu_crtc_setup_lm_bounds() check that CRTC width is not overflowing LM requirements. Rename the function accordingly. Fixes: 25fdd5933e4c ("drm/msm: Add SDM845 DPU support") Reviewed-by: Abhinav Kumar Tested-by: Abhinav Kumar # sc7280 Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c index 7399794d75eb..2a87dd7188b8 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c @@ -711,12 +711,13 @@ void dpu_crtc_complete_commit(struct drm_crtc *crtc) _dpu_crtc_complete_flip(crtc); } -static void _dpu_crtc_setup_lm_bounds(struct drm_crtc *crtc, +static int _dpu_crtc_check_and_setup_lm_bounds(struct drm_crtc *crtc, struct drm_crtc_state *state) { struct dpu_crtc_state *cstate = to_dpu_crtc_state(state); struct drm_display_mode *adj_mode = &state->adjusted_mode; u32 crtc_split_width = adj_mode->hdisplay / cstate->num_mixers; + struct dpu_kms *dpu_kms = _dpu_crtc_get_kms(crtc); int i; for (i = 0; i < cstate->num_mixers; i++) { @@ -727,7 +728,12 @@ static void _dpu_crtc_setup_lm_bounds(struct drm_crtc *crtc, r->y2 = adj_mode->vdisplay; trace_dpu_crtc_setup_lm_bounds(DRMID(crtc), i, r); + + if (drm_rect_width(r) > dpu_kms->catalog->caps->max_mixer_width) + return -E2BIG; } + + return 0; } static void _dpu_crtc_get_pcc_coeff(struct drm_crtc_state *state, @@ -803,7 +809,7 @@ static void dpu_crtc_atomic_begin(struct drm_crtc *crtc, DRM_DEBUG_ATOMIC("crtc%d\n", crtc->base.id); - _dpu_crtc_setup_lm_bounds(crtc, crtc->state); + _dpu_crtc_check_and_setup_lm_bounds(crtc, crtc->state); /* encoder will trigger pending mask now */ drm_for_each_encoder_mask(encoder, crtc->dev, crtc->state->encoder_mask) @@ -1194,8 +1200,11 @@ static int dpu_crtc_atomic_check(struct drm_crtc *crtc, if (crtc_state->active_changed) crtc_state->mode_changed = true; - if (cstate->num_mixers) - _dpu_crtc_setup_lm_bounds(crtc, crtc_state); + if (cstate->num_mixers) { + rc = _dpu_crtc_check_and_setup_lm_bounds(crtc, crtc_state); + if (rc) + return rc; + } /* FIXME: move this to dpu_plane_atomic_check? */ drm_atomic_crtc_state_for_each_plane_state(plane, pstate, crtc_state) { From patchwork Mon Jun 24 14:47:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13709663 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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 1ED53C2BD09 for ; Mon, 24 Jun 2024 14:47:33 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 3635E10E48E; Mon, 24 Jun 2024 14:47:24 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="dfQa3eGW"; dkim-atps=neutral Received: from mail-lf1-f44.google.com (mail-lf1-f44.google.com [209.85.167.44]) by gabe.freedesktop.org (Postfix) with ESMTPS id 2CE4E10E485 for ; Mon, 24 Jun 2024 14:47:19 +0000 (UTC) Received: by mail-lf1-f44.google.com with SMTP id 2adb3069b0e04-52cdf4bc083so2883407e87.2 for ; Mon, 24 Jun 2024 07:47:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1719240437; x=1719845237; darn=lists.freedesktop.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=dfQa3eGWtxw3jWz4CVM2hRhkhRzRmeyHkXHm/ziwfc8CLK6UTSoaGHlfZDWwgjxPvn qMzmY62jYB2TvPQd0GzCS41gwUxx8Kn/Uix31cIoQ6cZgQanjACCO6hP5gnRysgJSrBP 4uiwTRmXEPEpycSR8sLoo7LONOJUUk+QUnx1UtEJBBgqJRn5eWk2o/jNMqI4v2D6HCta MA+6A/0YrXF+py5hM8/JlO9ZY+kbotUproJXdD6zyE/rpjYT+3iJiCmOVRTc9P2eTmre KXJ54CUT335vBOyzWBsqetO96BPPEKSxYg5yCuf+IRpnG2JoXtVX+EdIpEcgbOmCAbH1 0BUg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719240437; x=1719845237; 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=HqTmUMrYgUTcdLGKgcA+EQ02vIUeZOR8bTMoM0lUIBwG1pEEUgKBo5xYOMx2EXNsFC ySjPdCWuCG/jCziWsClazNtIl+7llDA/hIZXGjW1rZ4SanBdpowgihyol5HHP8ccLBg0 xm3kSUaa1/rxJn8dg9uTUsm+msiX+9bU3ABdnrZhdAS6Dpon5ULrCuYL1Pv5KG+wBKz0 ObD2yCUB/mhh1lYxQMP7baW9oLnIuSMvv5eko9JowLFSStIA6A5F2QjPVVUsvXzvXVlm Je7ZYuQV2aH4AZALJhcfdrxiicc+N3eEUEtnWiC3PxhRPdspavDlXUNmR73EP4gdoE6U R/gg== X-Forwarded-Encrypted: i=1; AJvYcCXG/XtRRJplZ4a/fZvblChlVc4Rs9S7FtpvA2swV2h/azq4LmwnwNSL17+e2MWEejtx94yzsc6xIpQNPGjPyahPgwpli8vPiEL9qQf6ugRU X-Gm-Message-State: AOJu0YyuX5ck2AMXqipRMHuSfoZbKqYRRRRwk4FEp3znyZ7H/aX5dsZI KwVX6MC1v6aKwN3gbmDM6WHgevwhQf5QkJ/oJtRPD28wNkm/nyzubOVk47LFsTY= X-Google-Smtp-Source: AGHT+IH04ATCRnDq4dxRR2coL1lBGrXGyEbLbPgLDKDt2z7UORAPjyBa3IRaIMrGxV291tvd52qkCA== X-Received: by 2002:a19:e04a:0:b0:52c:d819:f896 with SMTP id 2adb3069b0e04-52ce061fda6mr3703448e87.35.1719240437307; Mon, 24 Jun 2024 07:47:17 -0700 (PDT) Received: from umbar.lan ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-52ce88b0119sm212699e87.222.2024.06.24.07.47.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Jun 2024 07:47:17 -0700 (PDT) From: Dmitry Baryshkov Date: Mon, 24 Jun 2024 17:47:11 +0300 Subject: [PATCH v4 05/16] drm/msm/dpu: drop dpu_format_check_modified_format MIME-Version: 1.0 Message-Id: <20240624-dpu-mode-config-width-v4-5-1038c13da3a5@linaro.org> References: <20240624-dpu-mode-config-width-v4-0-1038c13da3a5@linaro.org> In-Reply-To: <20240624-dpu-mode-config-width-v4-0-1038c13da3a5@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=owGbwMvMwMXYbdNlx6SpcZXxtFoSQ1pl2/sliq/t4pod9azmRz9cezTSbPmGpPR573jEX3i6e T5PmL2vk9GYhYGRi0FWTJHFp6Blasym5LAPO6bWwwxiZQKZwsDFKQATschn/+9Sm3b0peCbriX8 MgGe4uUnvJWXvTO/UbT9rNHDioisxOxFBx5YXzxRvf/sTddgP3uHCWyak17Nneyf9u683JrpPzc 9+F7VfvWBzu/bhYk9mU+7jvaacMr05m8PuK8t1/loz+SzsxJ1DppZ2N/kN0uJifASMPPkOrTCLE rc/3HKgfWZnYqTzBN/C91qbbfSKD3o+3GPdtryQL5FQvkFdRfT9NZH8U5mDY6ecPGs+tmDqzS6k pff1q+ctMr/cNGeeonQtJcKjaafE8waedh4oqS9+0XzZKVvbj4us1DcQOdVt9HvK3u3cpYs/8Sd 01G4/KhnaKSzXu2C31tvlsmEHudRy77BfujaxqQg8zQBAA== X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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 14:47:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13709657 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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id F2638C3065A for ; Mon, 24 Jun 2024 14:47:23 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 73F3710E48A; Mon, 24 Jun 2024 14:47:22 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="X5Ht5zzp"; dkim-atps=neutral Received: from mail-lf1-f47.google.com (mail-lf1-f47.google.com [209.85.167.47]) by gabe.freedesktop.org (Postfix) with ESMTPS id BD94310E480 for ; Mon, 24 Jun 2024 14:47:19 +0000 (UTC) Received: by mail-lf1-f47.google.com with SMTP id 2adb3069b0e04-52ce6a9fd5cso976118e87.3 for ; Mon, 24 Jun 2024 07:47:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1719240438; x=1719845238; darn=lists.freedesktop.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=kIsQ9jyOskAThgejEXOc+20Ndgc1zU0T9DxoSge/dGM=; b=X5Ht5zzpsxshtjpvfJyfBWJPC0L9/5eiTx8F3b7TALa274RATOiupEwFBIkW6D6CVc mPsu0zjSGO+InErbvp7Xp4qRm4tctV/xYYx7P5N2/rIap+XUCCba+tsdAMvAQ0mtC+ii kPBbH7KUQiYQqw/zuDwPWcdxwXwAvDhRFTzoUgPXEPholGsyWzy0mxluu2HmJK56GbLa 1mQfVLy/jk8RmH/zBN1fXig0uRUbN6GvD+D/1+gqSFU3y62pd6g5QKPhP3nIAAYMQAc8 Gfl51xu5nt/XONWP3E25kNz8aZ8ep/VbdqdkIm8DGEqL+dAcLYM70AFTaFBfFmDJF/Np U4mw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719240438; x=1719845238; 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=kIsQ9jyOskAThgejEXOc+20Ndgc1zU0T9DxoSge/dGM=; b=cRNsPKvZIyUwtn4GPVXZCozdOapcOTPbaZZUY/gUcmmCk1wUa24c2k+DtDkrOOx7bW aIVRlxNbyCkpIGHJXI6VKVztq0z+mRTz5Pr/XUOozNY91iquGhaLs8B08DfcH0xOWAy4 q7WB9iY4ApIg69TcM4uIg2CKGC2hZ9Yyh5ykjbAex3YNDhWRUwVcypHudUeN2oV32m8K vGQdknzwLHfjesDDZG3qUlJs+0ujo1qintrSJFdPz6Mz/AtRz2jhxqKWE3oxb60y7KWJ tNxH9Rem2feSO9lPdStSBGx7GvJuIRbdSecuN68pvFVRZkLVAUYpDUwomBMyazq+8c6M lo1g== X-Forwarded-Encrypted: i=1; AJvYcCWVprSX4DxvtrH4LcwbdvHLgv2uP+iNNjKkrGYngvi/CuGGysbS1r74rYfdrnEajKW5CBesPSZR4i57757D1rng/KAqtCprIVEIQluwKEW0 X-Gm-Message-State: AOJu0Yxbot+JbPrAV3431xP4j/0Gsqc1AW025eUlPGR+NHovepTnXVhq 0uLhf9AKWZj4Y0mVBzgEoiI/gVFLVmp57iF2MNYjaB8/fO0Jrg66SxFa5v9HNHs= X-Google-Smtp-Source: AGHT+IHwn4mRcNgV5Qui2ZZtG9U+fDFH4wKxNBRIQDXWFZ5liYEi6+aF7gwp9ETB6Ys9QB5FWdWudw== X-Received: by 2002:ac2:4c41:0:b0:52c:db28:4d92 with SMTP id 2adb3069b0e04-52ce1832653mr3384526e87.11.1719240437910; Mon, 24 Jun 2024 07:47:17 -0700 (PDT) Received: from umbar.lan ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-52ce88b0119sm212699e87.222.2024.06.24.07.47.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Jun 2024 07:47:17 -0700 (PDT) From: Dmitry Baryshkov Date: Mon, 24 Jun 2024 17:47:12 +0300 Subject: [PATCH v4 06/16] drm/msm/dpu: drop dpu_format_populate_layout from dpu_plane_sspp_atomic_update MIME-Version: 1.0 Message-Id: <20240624-dpu-mode-config-width-v4-6-1038c13da3a5@linaro.org> References: <20240624-dpu-mode-config-width-v4-0-1038c13da3a5@linaro.org> In-Reply-To: <20240624-dpu-mode-config-width-v4-0-1038c13da3a5@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=3364; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=EolmHRhwGXXQUzrkytdeQx4Mh8dKlNx5sMNxyMkQHl4=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBmeYbv72B9V3iefGPWeIHr1+B/BabWUEjMIFcJC wUzvrn/t0uJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZnmG7wAKCRCLPIo+Aiko 1RknB/9bSdIVf5ZCOI+Rzc50netnzopJnWbRMkvL6CV+axROugiqdEMHL416YrhuSaZhYrubJbP LVOnd43VVOo4BJJfAkZhDCv8CSXUfWO5zj/RWee7YLy4m8bKqNpGxb4dMPXz3/Ni7k4EQnYsAjQ tkUcPMimbrPCTaE3zrk8bHG57NQkX4vZAuI+/sJxzeJboPLlz4c9WW1rdNwfSwVu2H3EhK5U6Du c0m+YcfQRum8gH/JjIMxe5ei44+XFIx2wBRNs62JRUtLPN8Zvqkrua6q6SpzHZVldaHgMcVQxsU HgQgFiKDqLk6DUncpBpKrKyYv4YpwLgyQWHLcnt0GId/511W X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The dpu_plane_prepare_fb() already calls dpu_format_populate_layout(). Store the generated layout in the plane state and drop this call from dpu_plane_sspp_update(). Reviewed-by: Abhinav Kumar Tested-by: Abhinav Kumar # sc7280 Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c | 19 ++++--------------- drivers/gpu/drm/msm/disp/dpu1/dpu_plane.h | 3 +++ 2 files changed, 7 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 eabc4813c649..241c2d7a218a 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c @@ -647,7 +647,6 @@ static int dpu_plane_prepare_fb(struct drm_plane *plane, struct drm_framebuffer *fb = new_state->fb; struct dpu_plane *pdpu = to_dpu_plane(plane); struct dpu_plane_state *pstate = to_dpu_plane_state(new_state); - struct dpu_hw_fmt_layout layout; struct dpu_kms *kms = _dpu_plane_get_kms(&pdpu->base); int ret; @@ -677,7 +676,8 @@ static int dpu_plane_prepare_fb(struct drm_plane *plane, /* validate framebuffer layout before commit */ ret = dpu_format_populate_layout(pstate->aspace, - new_state->fb, &layout); + new_state->fb, + &pstate->layout); if (ret) { DPU_ERROR_PLANE(pdpu, "failed to get format layout, %d\n", ret); if (pstate->aspace) @@ -1103,17 +1103,6 @@ static void dpu_plane_sspp_atomic_update(struct drm_plane *plane) msm_framebuffer_format(fb); struct dpu_sw_pipe_cfg *pipe_cfg = &pstate->pipe_cfg; struct dpu_sw_pipe_cfg *r_pipe_cfg = &pstate->r_pipe_cfg; - struct dpu_kms *kms = _dpu_plane_get_kms(&pdpu->base); - struct msm_gem_address_space *aspace = kms->base.aspace; - struct dpu_hw_fmt_layout layout; - bool layout_valid = false; - int ret; - - ret = dpu_format_populate_layout(aspace, fb, &layout); - if (ret) - DPU_ERROR_PLANE(pdpu, "failed to get format layout, %d\n", ret); - else - layout_valid = true; pstate->pending = true; @@ -1128,12 +1117,12 @@ static void dpu_plane_sspp_atomic_update(struct drm_plane *plane) dpu_plane_sspp_update_pipe(plane, pipe, pipe_cfg, fmt, drm_mode_vrefresh(&crtc->mode), - layout_valid ? &layout : NULL); + &pstate->layout); if (r_pipe->sspp) { dpu_plane_sspp_update_pipe(plane, r_pipe, r_pipe_cfg, fmt, drm_mode_vrefresh(&crtc->mode), - layout_valid ? &layout : NULL); + &pstate->layout); } if (pstate->needs_qos_remap) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.h index abd6b21a049b..348b0075d1ce 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.h +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.h @@ -31,6 +31,7 @@ * @plane_clk: calculated clk per plane * @needs_dirtyfb: whether attached CRTC needs pixel data explicitly flushed * @rotation: simplified drm rotation hint + * @layout: framebuffer memory layout */ struct dpu_plane_state { struct drm_plane_state base; @@ -48,6 +49,8 @@ struct dpu_plane_state { bool needs_dirtyfb; unsigned int rotation; + + struct dpu_hw_fmt_layout layout; }; #define to_dpu_plane_state(x) \ From patchwork Mon Jun 24 14:47:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13709659 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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id DD010C2BD09 for ; Mon, 24 Jun 2024 14:47:26 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8FE5010E48F; Mon, 24 Jun 2024 14:47:22 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="mGuMyACO"; dkim-atps=neutral Received: from mail-lf1-f50.google.com (mail-lf1-f50.google.com [209.85.167.50]) by gabe.freedesktop.org (Postfix) with ESMTPS id 9C3AC10E485 for ; Mon, 24 Jun 2024 14:47:20 +0000 (UTC) Received: by mail-lf1-f50.google.com with SMTP id 2adb3069b0e04-52caebc6137so4271298e87.0 for ; Mon, 24 Jun 2024 07:47:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1719240439; x=1719845239; darn=lists.freedesktop.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=mGuMyACOey7YsD4kOuBH5ux2EFnh95ricZMyFS3/+ck2McbxN+GG5FZlOBHFtbTtVJ u9kyG8VfVM39Dq4DkhMKxjvKg0DGjQa5rYJxFudOwkUudFhx1krgFzl5UqxHetnYOSP9 sTHdR27pl+/+1gMjuOIg1/xFoN6etNFz80+NXCVuvXtgR6+r8xCbNtH7+N77jqlk2dnB ZII/wX3gU6MSE7gyr5gvs/TG5QAblsK84eMxHe7srTOi19Rbrj7axU+EnRXB+d8SzjDO 875wQjWTUXFUJsuFOsQzzgLUv18zulkxIbWjKwjX4M0KhsN9O2V/JgffYL564xOA3D1q l+Ww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719240439; x=1719845239; 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=iZBeU2rBSaEwTm/b41KDogTpTiFxhpM7REr6r+lLtxlUCJUkRbO1JTEqd35i3UQGlE XHFJlmvnZwbakglgudkYD/WywBLQpdV2Tf7wtm4tqEE/q9g7dPrh5NCgKNRrrtRBF+WG d4Bkxuuugbm6YyLQgbuhXfSB55l1y/UG/iBqMdUy8oFRAboQUTYQZi5OXkkyASSyTFai AF1yK+G6CSQ78Grbbi3zRnpoQ77r51n//g4Ci4PY4dyS04t+lJdAJFpIVWpUPA9iynjL ytH8wYSJs1S700eG8e2lTSmsuXK/a/sMZ8udzAsD6TjX2nXgDmi/SrlQr/nw6B8kAyzi Gm2A== X-Forwarded-Encrypted: i=1; AJvYcCXFNwUEJRGNZ5cbHXo98lHA4fDEvR4A7KPm63PYT4X//H+9AIFUEf4U3Ph055Y/EOT3SM3diDBUh1AjLAckGO0VLV+m/+U9yijgBSzD1eOq X-Gm-Message-State: AOJu0YyvavKqpzKXTqVFleeNX47a5WTfyG984sWoU4UbpMyQU36qr60z 2MtPXas90dPdlj0Hw3u0wXmOMzcUl64/lSV61x0+bEQNFLGi8x8V+lrPpqBfFlU= X-Google-Smtp-Source: AGHT+IFo0+mMu75zJsoc9saWGs2TMZTXLwFCHVCfi7bX+JMa6h2za2Gs063bgucAWT7eFH/l/fHgoQ== X-Received: by 2002:a05:6512:10d1:b0:52c:e982:8457 with SMTP id 2adb3069b0e04-52ce9828502mr1762990e87.32.1719240438806; Mon, 24 Jun 2024 07:47:18 -0700 (PDT) Received: from umbar.lan ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-52ce88b0119sm212699e87.222.2024.06.24.07.47.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Jun 2024 07:47:18 -0700 (PDT) From: Dmitry Baryshkov Date: Mon, 24 Jun 2024 17:47:13 +0300 Subject: [PATCH v4 07/16] drm/msm/dpu: drop extra aspace checks in dpu_formats MIME-Version: 1.0 Message-Id: <20240624-dpu-mode-config-width-v4-7-1038c13da3a5@linaro.org> References: <20240624-dpu-mode-config-width-v4-0-1038c13da3a5@linaro.org> In-Reply-To: <20240624-dpu-mode-config-width-v4-0-1038c13da3a5@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/pANAwAKAYs8ij4CKSjVAcsmYgBmeYbv084XpneWPffyXo4xAWuPs5p8u2l9ugMFU bL+pUaBr2uJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZnmG7wAKCRCLPIo+Aiko 1bxfCACR9EzuNAh0cZysy87aKSG7MkjSjyEdt/RZsPW/aaLTwYXAfah8bhHwMuWeF0M957zNJFl jiZNivfmAYo615w2F507VQG5nhoM1xlZZXYNrOsfCu2pUegu6LPz49ov52QZDeQb5VIRK/0Z0RQ Znj63lqLU6qkX1jpGb9dJ92LNWT5QMzKnZJwv4fqKnICXYcvMmGOqgIKHzAxm9YG0Ivawa2+1L5 Z3FZH0PqhfkJmpAa4g35+9ZQL/smVan9AO1csAW+22Dp3pZHZGhjFswd5qH8krfToolUcyJjeLo WOnEPTc2lKqnljPmBf2vKqCXxTHKe8JuRvj7NIjbIUiC8YDx X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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 14:47:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13709660 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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 7E16AC2D0D1 for ; Mon, 24 Jun 2024 14:47:28 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 7D25B10E492; Mon, 24 Jun 2024 14:47:23 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="CibEN0Fi"; dkim-atps=neutral Received: from mail-lf1-f49.google.com (mail-lf1-f49.google.com [209.85.167.49]) by gabe.freedesktop.org (Postfix) with ESMTPS id 5E5CD10E48A for ; Mon, 24 Jun 2024 14:47:21 +0000 (UTC) Received: by mail-lf1-f49.google.com with SMTP id 2adb3069b0e04-52ce9ba0cedso958196e87.2 for ; Mon, 24 Jun 2024 07:47:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1719240439; x=1719845239; darn=lists.freedesktop.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=r1aDr6u3CKZwSplcaxUZ1CNtB7aEvGZWL0nJBmKn1vU=; b=CibEN0FiquMW1U0yvJM5qi9ZoREehXi3rmUECTedSPLyg+2jXThEA7AbfoX67SrOGG BmqfHbhlsrZuow3WSQ3ssjD2O7Cj27t0eVkrqr0Eu31B5IQC33GQHR6bFGnWajn4BHoG HmmID2vYbdZUD1KhK1aKPFpWhVM2O0/7FqwPuaPx6JZUrB17y7lu2fSg/1r4fuNWgD5w gmYx8Ev7GHAcvvGEZhn77AaA23OKPejftRecboSyFH4Y+PYFk9q1DWq8a3pEfg4pIMG5 3I2QH2O0PyB7UH0g7cdYPVVrA9cq9w+j55O64nA24KTGm14YdkJaDRH6i4A26C1656/g grCw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719240439; x=1719845239; 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=r1aDr6u3CKZwSplcaxUZ1CNtB7aEvGZWL0nJBmKn1vU=; b=J2pYZTy4virslZRqFOB7iJsZF3ykMyUswtTeew7i8K8Ho9KQldsOBV1GxP8hdgcqJp ncAsEP+z+8Bj+PoAII7QObuiY5ShzlbYcc1jByeFNlT8MR0F27bt38e2Lbq4Li4/zcft GpYLmVRevol9cANepMCASOdYTXISK8R7kYfJTdaNS/HXmZbu5piWleX8/RA1/Bbh9uz7 MBIXbrV8r+spIs+NM68BgHafZ4zcw1eH2W8fkFkh8nexkDyfRsp3OYS8gLbbsDyif4nS qkN6//zvYAcqdzrOtM1cEIUx2kADCY7O2u53735SxBgMhrX5X0+LG8rWrCBqq/W90ZpY VEBQ== X-Forwarded-Encrypted: i=1; AJvYcCXDQa01y3omrWKyB2StURSJZqKP+ongQvyZ+LSiRiyO6jtsA4MugwMzNolOijRxQVFlC+UdclM9HWix1bK98QxUq+hGzQuYio55E8dx+7EN X-Gm-Message-State: AOJu0YxvE7nPy9LYJMemxSuKtBB5wH1j+jg6iL2+2gAB4L/FW0x69SnD +gp4Kr7xbclY99LsKXDmCRNwVEBKbVQQOYEa5bIeoXOBd2vXQmuXXepNjsshxEA= X-Google-Smtp-Source: AGHT+IGFhG+6WbUsy4m0CwawGc/lF5c6/cpPh90H2d8Pmpri/4cvAON0Y0BmFOMxDx40iimqoChUWg== X-Received: by 2002:ac2:5293:0:b0:52c:deb9:904b with SMTP id 2adb3069b0e04-52ce1835924mr2974353e87.38.1719240439423; Mon, 24 Jun 2024 07:47:19 -0700 (PDT) Received: from umbar.lan ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-52ce88b0119sm212699e87.222.2024.06.24.07.47.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Jun 2024 07:47:19 -0700 (PDT) From: Dmitry Baryshkov Date: Mon, 24 Jun 2024 17:47:14 +0300 Subject: [PATCH v4 08/16] drm/msm/dpu: drop msm_format from struct dpu_hw_fmt_layout MIME-Version: 1.0 Message-Id: <20240624-dpu-mode-config-width-v4-8-1038c13da3a5@linaro.org> References: <20240624-dpu-mode-config-width-v4-0-1038c13da3a5@linaro.org> In-Reply-To: <20240624-dpu-mode-config-width-v4-0-1038c13da3a5@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=8016; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=Gya5f4ZwULk71hxrRoz5QSdtb64ucMxjJc7p3y8Bcb8=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBmeYbvUa3G+dgmIzjoA0aVhlyC+LGx7erNQaKBr QYhsV2Dm62JATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZnmG7wAKCRCLPIo+Aiko 1a0aB/9bel8aZo3E5z5ATF6iNEHVV63Y7LCW7v1nN1+aT01IMD+Ddi/0SdqUPcj3RtAQMP7ATqA ZEmKj3B4ylE1hy9FqTc4+qeyNuJKgucilGeQqk+mnkjM6n2scNxOtfR2k7o1sGtf01CwfgSykHt 6FhhGOnttXapAN89r6Luiyol4JUBy+fec5eIRJo5uiuEfDkUpjTgJDkew7aKQR9UvVDWrxTZino LTag5J7KlmR81CRwCU0VKOQGkw4jZ6ILLX9x39L24XjPyb1kw3xRLO/vRxsgr1LEhKMMjVc1p85 Bh/VTDGHu6MLHl8BE84yVch25Z2fbpY3bO0bZt86yky63DQz X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The struct dpu_hw_fmt_layout defines hardware data layout (addresses, sizes and pitches. Drop format field from this structure as it's not a part of the data layout. Signed-off-by: Dmitry Baryshkov --- .../gpu/drm/msm/disp/dpu1/dpu_encoder_phys_wb.c | 18 +++++------------ drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c | 23 +++++++++++----------- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_mdss.h | 2 -- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_wb.c | 4 ++-- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_wb.h | 3 ++- 5 files changed, 21 insertions(+), 29 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 882c717859ce..acbba6d4e68c 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 @@ -193,12 +193,12 @@ static void dpu_encoder_phys_wb_setup_fb(struct dpu_encoder_phys *phys_enc, hw_wb->ops.setup_roi(hw_wb, wb_cfg); if (hw_wb->ops.setup_outformat) - hw_wb->ops.setup_outformat(hw_wb, wb_cfg); + hw_wb->ops.setup_outformat(hw_wb, wb_cfg, msm_framebuffer_format(fb)); if (hw_wb->ops.setup_cdp) { const struct dpu_perf_cfg *perf = phys_enc->dpu_kms->catalog->perf; - hw_wb->ops.setup_cdp(hw_wb, wb_cfg->dest.format, + hw_wb->ops.setup_cdp(hw_wb, msm_framebuffer_format(fb), perf->cdp_cfg[DPU_PERF_CDP_USAGE_NRT].wr_enable); } @@ -584,14 +584,6 @@ static void dpu_encoder_phys_wb_prepare_wb_job(struct dpu_encoder_phys *phys_enc format = msm_framebuffer_format(job->fb); - wb_cfg->dest.format = mdp_get_format(&phys_enc->dpu_kms->base, - format->pixel_format, job->fb->modifier); - if (!wb_cfg->dest.format) { - /* this error should be detected during atomic_check */ - DPU_ERROR("failed to get format %p4cc\n", &format->pixel_format); - return; - } - ret = dpu_format_populate_layout(aspace, job->fb, &wb_cfg->dest); if (ret) { DPU_DEBUG("failed to populate layout %d\n", ret); @@ -600,10 +592,10 @@ static void dpu_encoder_phys_wb_prepare_wb_job(struct dpu_encoder_phys *phys_enc wb_cfg->dest.width = job->fb->width; wb_cfg->dest.height = job->fb->height; - wb_cfg->dest.num_planes = wb_cfg->dest.format->num_planes; + wb_cfg->dest.num_planes = format->num_planes; - if ((wb_cfg->dest.format->fetch_type == MDP_PLANE_PLANAR) && - (wb_cfg->dest.format->element[0] == C1_B_Cb)) + if ((format->fetch_type == MDP_PLANE_PLANAR) && + (format->element[0] == C1_B_Cb)) swap(wb_cfg->dest.plane_addr[1], wb_cfg->dest.plane_addr[2]); DPU_DEBUG("[fb_offset:%8.8x,%8.8x,%8.8x,%8.8x]\n", diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c index 8c2dc5b59bb0..46237a1ca6a5 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c @@ -104,7 +104,6 @@ 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->format = fmt; layout->width = width; layout->height = height; layout->num_planes = fmt->num_planes; @@ -116,7 +115,7 @@ static int _dpu_format_get_plane_sizes_ubwc( return -EINVAL; } - if (MSM_FORMAT_IS_YUV(layout->format)) { + if (MSM_FORMAT_IS_YUV(fmt)) { uint32_t y_sclines, uv_sclines; uint32_t y_meta_scanlines = 0; uint32_t uv_meta_scanlines = 0; @@ -182,7 +181,6 @@ static int _dpu_format_get_plane_sizes_linear( int i; memset(layout, 0, sizeof(struct dpu_hw_fmt_layout)); - layout->format = fmt; layout->width = width; layout->height = height; layout->num_planes = fmt->num_planes; @@ -190,8 +188,8 @@ static int _dpu_format_get_plane_sizes_linear( /* 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 * layout->format->bpp; - layout->plane_pitch[0] = width * layout->format->bpp; + layout->plane_size[0] = width * height * fmt->bpp; + layout->plane_pitch[0] = width * fmt->bpp; } else { uint32_t v_subsample, h_subsample; uint32_t chroma_samp; @@ -272,6 +270,7 @@ static int _dpu_format_populate_addrs_ubwc( struct drm_framebuffer *fb, struct dpu_hw_fmt_layout *layout) { + const struct msm_format *fmt; uint32_t base_addr = 0; bool meta; @@ -286,10 +285,11 @@ static int _dpu_format_populate_addrs_ubwc( return -EFAULT; } - meta = MSM_FORMAT_IS_UBWC(layout->format); + fmt = msm_framebuffer_format(fb); + meta = MSM_FORMAT_IS_UBWC(fmt); /* Per-format logic for verifying active planes */ - if (MSM_FORMAT_IS_YUV(layout->format)) { + if (MSM_FORMAT_IS_YUV(fmt)) { /************************************************/ /* UBWC ** */ /* buffer ** DPU PLANE */ @@ -390,6 +390,7 @@ int dpu_format_populate_layout( struct drm_framebuffer *fb, struct dpu_hw_fmt_layout *layout) { + const struct msm_format *fmt; int ret; if (!fb || !layout) { @@ -403,17 +404,17 @@ int dpu_format_populate_layout( return -ERANGE; } - layout->format = msm_framebuffer_format(fb); + fmt = msm_framebuffer_format(fb); /* Populate the plane sizes etc via get_format */ - ret = dpu_format_get_plane_sizes(layout->format, fb->width, fb->height, + ret = dpu_format_get_plane_sizes(fmt, fb->width, fb->height, layout, fb->pitches); if (ret) return ret; /* Populate the addresses given the fb */ - if (MSM_FORMAT_IS_UBWC(layout->format) || - MSM_FORMAT_IS_TILE(layout->format)) + if (MSM_FORMAT_IS_UBWC(fmt) || + MSM_FORMAT_IS_TILE(fmt)) ret = _dpu_format_populate_addrs_ubwc(aspace, fb, layout); else ret = _dpu_format_populate_addrs_linear(aspace, fb, layout); diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_mdss.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_mdss.h index a2eff36a2224..f8806a4d317b 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_mdss.h +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_mdss.h @@ -293,7 +293,6 @@ enum dpu_3d_blend_mode { /** * struct dpu_hw_fmt_layout - format information of the source pixel data - * @format: pixel format parameters * @num_planes: number of planes (including meta data planes) * @width: image width * @height: image height @@ -303,7 +302,6 @@ enum dpu_3d_blend_mode { * @plane_pitch: pitch of each plane */ struct dpu_hw_fmt_layout { - const struct msm_format *format; uint32_t num_planes; uint32_t width; uint32_t height; diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_wb.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_wb.c index 93ff01c889b5..f39db534697d 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_wb.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_wb.c @@ -64,10 +64,10 @@ static void dpu_hw_wb_setup_outaddress(struct dpu_hw_wb *ctx, } static void dpu_hw_wb_setup_format(struct dpu_hw_wb *ctx, - struct dpu_hw_wb_cfg *data) + struct dpu_hw_wb_cfg *data, + const struct msm_format *fmt) { struct dpu_hw_blk_reg_map *c = &ctx->hw; - const struct msm_format *fmt = data->dest.format; u32 dst_format, pattern, ystride0, ystride1, outsize, chroma_samp; u32 write_config = 0; u32 opmode = 0; diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_wb.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_wb.h index 37497473e16c..b240a4f7b33a 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_wb.h +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_wb.h @@ -37,7 +37,8 @@ struct dpu_hw_wb_ops { struct dpu_hw_wb_cfg *wb); void (*setup_outformat)(struct dpu_hw_wb *ctx, - struct dpu_hw_wb_cfg *wb); + struct dpu_hw_wb_cfg *wb, + const struct msm_format *fmt); void (*setup_roi)(struct dpu_hw_wb *ctx, struct dpu_hw_wb_cfg *wb); From patchwork Mon Jun 24 14:47:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13709662 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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id A79C9C2D0D1 for ; Mon, 24 Jun 2024 14:47:31 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2F38910E48D; Mon, 24 Jun 2024 14:47:24 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="OjHuRQAj"; dkim-atps=neutral Received: from mail-lf1-f52.google.com (mail-lf1-f52.google.com [209.85.167.52]) by gabe.freedesktop.org (Postfix) with ESMTPS id E58DF10E48B for ; Mon, 24 Jun 2024 14:47:21 +0000 (UTC) Received: by mail-lf1-f52.google.com with SMTP id 2adb3069b0e04-52cdf2c7454so3303799e87.1 for ; Mon, 24 Jun 2024 07:47:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1719240440; x=1719845240; darn=lists.freedesktop.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=OjHuRQAjRLKeOwY3huHWDHicDvZyHtlUZ/Cfxh8InZLqr1LjV4HTn68GzpYKrnAa9m l/iTzO/7qgt8gDG9vCO2kEU1c9MM+9DpbMS8OKPA/WR9CTldyE9VqidSIMokbjaa0N9H /nYYQD4eww4VIOFrtHlARcve2EAbZHbmRgrPg1mlsg+lSRgp9vVuJFBOi8TA+E60WQwn +fYQDen5fq/MbveB6YAwvm3+/0F2DYim3ayMOZGcHj7Rjsi2kx2yceLvEu4dBT8A3v9V maSts6/GnMvYYeBJITC6jO1JN5MleI35Tg3IQ2PhGDrdF8vAcyZMSLSEaKqN/pdSRLHv YOUQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719240440; x=1719845240; 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=oHTrNRF1JLf9TAn9T2HufyCbn40XIv4lDH2WMB3/3cx4BAMskVI9eK+Bvdd9Nn+SOr S+DQD+WqWk2Ej13HaIX/DokExgGh3gMzrRk+nju6RzbO+bLVrxalLGK3WUmCUrCj9Wcw r1bOXT+Y2rI8G7/G5AEoGHdHF3RV2+/o4Un0A8WcCebmNE3fOXMmTpGoxG7/bv44Lvw3 hxbFbH+xufmFgTxrmC1b73SDboNu3Gv0Pl84Q8n9FFDBdP56mSVJzCuhuf+q21Nc0uXN najL2dIgw7ECEMuo4NCqCA/C6c7ItP3dPaOCk5YNvvMNdhvoP6lR03g1umC6XuzpAxWW 5sXQ== X-Forwarded-Encrypted: i=1; AJvYcCXlCYa6gef2weOKKYcmqyMAi7ghniqBd1jqwFcpEYHMCCdgbReakSFZu/+0MPmqjUeXhbrq8CWO1hthZvqPVJtv7OGenFHcRLf3mTDDn9Vn X-Gm-Message-State: AOJu0Yz+PG4KuFaXoe9o4UoISYEf98ibz8J3NjCQsCOw70YP1655vgWm HnxQJqK+qFLafyB0VbF2/9O4aV2I2iN0II4S0+zhVBUdORG2pGQfhr5cQ3o9boE= X-Google-Smtp-Source: AGHT+IGTxBcoHd7DNv/2AA/tt4TDriG718Qkr4irYi2DtC/ykenFbXCOlNxW/Uutwb9xNdWMv1KiDg== X-Received: by 2002:a05:6512:360f:b0:52c:df55:e110 with SMTP id 2adb3069b0e04-52ce182bc79mr2964259e87.12.1719240440011; Mon, 24 Jun 2024 07:47:20 -0700 (PDT) Received: from umbar.lan ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-52ce88b0119sm212699e87.222.2024.06.24.07.47.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Jun 2024 07:47:19 -0700 (PDT) From: Dmitry Baryshkov Date: Mon, 24 Jun 2024 17:47:15 +0300 Subject: [PATCH v4 09/16] drm/msm/dpu: pass drm_framebuffer to _dpu_format_get_plane_sizes() MIME-Version: 1.0 Message-Id: <20240624-dpu-mode-config-width-v4-9-1038c13da3a5@linaro.org> References: <20240624-dpu-mode-config-width-v4-0-1038c13da3a5@linaro.org> In-Reply-To: <20240624-dpu-mode-config-width-v4-0-1038c13da3a5@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=owGbwMvMwMXYbdNlx6SpcZXxtFoSQ1pl24fvyu4akw/UT8q//WNf7ZEvz73rt3D8aWbOPXgpN oIr4VZSJ6MxCwMjF4OsmCKLT0HL1JhNyWEfdkythxnEygQyhYGLUwAm8n0T+/+Qyw27WgtOP7aY KZw8lefdqupELdXYwkJrro6tAapK6rsFfskdFQq3jn/EaVL8zkZO5Wufq/ty1hj5biuf98zbj4d ctBCa/cioxULkh3m3sVZbhc0S5a/yRyKPrU3WcDV8Xbwx4pJ4cezHtORvz97P9zDaeWm/hcLsp0 w1y94KSweUPfM8c0tq2fLTE2vPXm23V31vnJq05J747PeR2QHPi6/O0xYxWDBry4HkmJzXIlHt/ KtnWzsI9t01CJX9sHZbUMKfNY8+b7lS+Hm/SLZ6HnOt63v2zE9Pf/On1zvanH/bxPE4Wzt4lkNj hxz/RsaoyW7zH7qdLtHi4ug83/pN/ayoAbdT+E/fFFNPAA== X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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 --- 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 14:47:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13709664 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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id E81ACC41513 for ; Mon, 24 Jun 2024 14:47:34 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1014E10E485; Mon, 24 Jun 2024 14:47:29 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="hfL7CEZ/"; dkim-atps=neutral Received: from mail-lf1-f49.google.com (mail-lf1-f49.google.com [209.85.167.49]) by gabe.freedesktop.org (Postfix) with ESMTPS id 85F9F10E48E for ; Mon, 24 Jun 2024 14:47:22 +0000 (UTC) Received: by mail-lf1-f49.google.com with SMTP id 2adb3069b0e04-52c7f7fdd24so5085946e87.1 for ; Mon, 24 Jun 2024 07:47:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1719240441; x=1719845241; darn=lists.freedesktop.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=SPozXOfnQpkwCjUxXDexUWZWPSk8EJlZgnDGsjKSuG0=; b=hfL7CEZ/VFHIn3TqZnR6+lmBzzixkuTRjBkj463ZKsGsYDTRBCq2R/dLtDmZZrzzmT 99K0IGptTX4UKh2S1g6qv+kt6X9z/+m1/Cjqvo7Izi5iMNaQkXjOma0Omv12kQW42F/J KYCHotiBGa6aJeDqLMkmejnqeHYL8qUyUo/11AtkqPWK56c/lKjYaI2bkxpCqrlKWerH mCls/Lx96Y9+oQsKKEtCUpVVEd54n6CQOSccQsEXPpsrwB4dKqWttX/OHMt9Z3YNq339 QVYnuqL3iUw4CYk43waFGwNC9RqkrigD8c+PJ1FhpyIxrZE72CKRUjsaNfAfhi12AoMi YrVA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719240441; x=1719845241; 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=SPozXOfnQpkwCjUxXDexUWZWPSk8EJlZgnDGsjKSuG0=; b=Zf9O1FH/7Mb1I+797FvuMiawlMi4A22eY1uvPifpwGSCTYZnVWHR4bAVlE/aZFLAUI kRLEppLiuP5gph0yvm4fXUOL7fhLF6UXychPf243Lr++aAF0gT4JAg+BmEgTuKwx0qeM Zi6KjsWZju9p/XmulfbmAs3Ccnd3luTHaLVIm88JHoAy0kfG1U/gSfjIXUZTniffW4BW jaFegKFClWKdmG20q8sDFapVOcilVw0ig0HXf5EKM9E9a/3rADAR0+PKeaUU09yvfvz5 iWq7oIlQf7wNWowc0t3kveUyXcCRvh0uGfI7k+XxC9qHNIYZoe1Kqea+ThP5GtdrjU3X mrWA== X-Forwarded-Encrypted: i=1; AJvYcCUUgQrX+LFL3JUbHAEjSJusTB6x2uXq6qyAxU30z9R4HeXdQ7OxwTzC18oPXSO5b+4L2kKWJCIxaSbVy+j8BjV9OlxdGDv5aZVWGleEMYoW X-Gm-Message-State: AOJu0Yy8UtP0+8hUXcYj4fOGGWuLrK+LAmjnVY26sKo9ZJCdqG6leQbt qc6vCTJdaxXO1a8UPzP1jZkgsh5wlsqwQzoWibk7KUmCvjc49ecfYErNKeO8HBA= X-Google-Smtp-Source: AGHT+IEWEVedxizz7wL35346SfuzkwcOxrGhZmWmTesVJLBvRgGjQKJ0LKJ3PlJSSoWZaVRtugvtNQ== X-Received: by 2002:a05:6512:10d1:b0:52c:e982:8457 with SMTP id 2adb3069b0e04-52ce9828502mr1763058e87.32.1719240440814; Mon, 24 Jun 2024 07:47:20 -0700 (PDT) Received: from umbar.lan ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-52ce88b0119sm212699e87.222.2024.06.24.07.47.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Jun 2024 07:47:20 -0700 (PDT) From: Dmitry Baryshkov Date: Mon, 24 Jun 2024 17:47:16 +0300 Subject: [PATCH v4 10/16] drm/msm/dpu: move pitch check to _dpu_format_get_plane_sizes_linear() MIME-Version: 1.0 Message-Id: <20240624-dpu-mode-config-width-v4-10-1038c13da3a5@linaro.org> References: <20240624-dpu-mode-config-width-v4-0-1038c13da3a5@linaro.org> In-Reply-To: <20240624-dpu-mode-config-width-v4-0-1038c13da3a5@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=1777; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=PvarS7GjKhySpbWrpwCTIA/zEFMlNGs5eUuK3EGV4IQ=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBmeYbwE4Ng1KUwuMPQqNNhl2jUNCi/sq3YbTvFP cvNquVeUEaJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZnmG8AAKCRCLPIo+Aiko 1YbqB/47/wo7upDky0O43P8ivMBAIsvt8g0v+bXSkiq4FPPYOc3hJZsLeINCaUhMIc7Wa2KmZNs h9R0S1zzHNHGc+3rh3q6fTqGyw63KQfBuZXy4eooA+zKwfZf2rlh0XxGxLkfNsF2r1AsoThb4ws Ba2NbIVLFKFlmmYnFnxhafHXCSCJQs2s+TQhb7Sk7NtcWq2M1QWOdwCd7/5IDkQ6V9fvNqqUUzt P7I5QypLz62J3Q1/rDUEsKAJaCT6ZCAvcZKjh+MBtTUENBECJWddDR7Gqw7HmA+vSW2ea+OFSDO gSEyXd6VtGc5OaWG7JxXvwyMgWv9TUlfPnIim/oLQL/g74QF X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The _dpu_format_get_plane_sizes_linear() already compares pitches of the framebuffer with the calculated pitches. Move the check to the same place, demoting DPU_ERROR to DPU_DEBUG to prevent user from spamming the kernel log. Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c index df046bc88715..4d17eb88af40 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c @@ -229,8 +229,13 @@ 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 (layout->plane_pitch[i] < fb->pitches[i]) + if (layout->plane_pitch[i] <= fb->pitches[i]) { layout->plane_pitch[i] = fb->pitches[i]; + } else { + DRM_DEBUG("plane %u expected pitch %u, fb %u\n", + i, layout->plane_pitch[i], fb->pitches[i]); + return -EINVAL; + } } for (i = 0; i < DPU_MAX_PLANES; i++) @@ -360,15 +365,6 @@ static int _dpu_format_populate_addrs_linear( { unsigned int i; - /* Can now check the pitches given vs pitches expected */ - for (i = 0; i < layout->num_planes; ++i) { - if (layout->plane_pitch[i] > fb->pitches[i]) { - DRM_ERROR("plane %u expected pitch %u, fb %u\n", - i, layout->plane_pitch[i], fb->pitches[i]); - return -EINVAL; - } - } - /* Populate addresses for simple formats here */ for (i = 0; i < layout->num_planes; ++i) { layout->plane_addr[i] = msm_framebuffer_iova(fb, aspace, i); From patchwork Mon Jun 24 14:47:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13709670 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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 6F2AFC2D0D1 for ; Mon, 24 Jun 2024 14:47:49 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2B10810E4A3; Mon, 24 Jun 2024 14:47:48 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="MrsplaiA"; dkim-atps=neutral Received: from mail-lf1-f49.google.com (mail-lf1-f49.google.com [209.85.167.49]) by gabe.freedesktop.org (Postfix) with ESMTPS id 4A39810E48E for ; Mon, 24 Jun 2024 14:47:23 +0000 (UTC) Received: by mail-lf1-f49.google.com with SMTP id 2adb3069b0e04-52cdea1387eso2148881e87.0 for ; Mon, 24 Jun 2024 07:47:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1719240441; x=1719845241; darn=lists.freedesktop.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=GqnaJ5AjjFaixpPDS11Y462kVHejpQNyVm4rRV0MBdo=; b=MrsplaiAvX34Q2HZDdWCAzFecZ6OnEa53gmmWHI5lMTB0h9iDI6y36t17r5JWw7t3z 7QfiTGI7IV/iGPt3Pl5QrtNHVQ6zPhOv4kH/GWPjamb2vWq20q7lFT5xilIhYd9Tms1w UvMbGOmoLfZXj6Y0zsb+7pBdbZHURqVWs8tdDOS3+lxsDWEdPK7H6KFRL045H6VSBhdJ QPYBGAfdHRk+yDXYTzupkHwdZLRSpA2OC44Uz+p/y+eH1kEqZFH/VnXJLMjJJWvLfbXB 7g8/QZD8hzmTDc37P37Py7tLXFRPNpX1XxI5RgFNh1GSFkV210ThMCBDhvBTxAz41F/m v1oA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719240441; x=1719845241; 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=GqnaJ5AjjFaixpPDS11Y462kVHejpQNyVm4rRV0MBdo=; b=BYRZ0gLGUEK1uja2Q7H9fdBTVpSPPARREbZMOCajsuiZpl9cdFXroVvfF9Q1J4wFcM 5VcN+bItu0bH45lxTsTkHrGKdP5UjAvTqzliKZ6nefjUkWjknNSIbeSXU/5r66rkQvCM 65JvBEM+GMc+Tj40Y7LvaR6Ni8IDy7IHn0u0RzLRpYir+VViTPYnR4m42uy9wYYpXpj5 iBY5xwkgbYjW1mW7nRtUrGnF4aXMuWnoSia/IlYSty2zCNd9CXlCRXDWI6of2IpKZKhv YqQ8nEMAwfZ7BJ71wPTzP01loeu7pk/WY+l3HZQ/y3uxjiKqEEq1sUHcefB0kIQQTCdL DzTw== X-Forwarded-Encrypted: i=1; AJvYcCV5Z3VNwL0gegOHKrzKyKC/gJx5ad2+Bt0yHyAWWB9iEtueMmWCFOFvDnZS7JaizwP2tE+guhWGPwasQvXRmXZy9NC5DFiR7Okh0W6+eYi5 X-Gm-Message-State: AOJu0Yyn/AhsceumPL/ilr7J4i3h3XD020yTqCXbwDrtY9hsy7Zkis3t n6g0NhxiUA1jy6J/BcdOXK2kIQ1nwIy2N6crhvqWEHbJIMfqtGdYjCXFWCN4TYw= X-Google-Smtp-Source: AGHT+IHfoaJv978Czlxz2gm9072BTwY+BS2IF2pnRlm1dcwmT8qxoPjG5rodOyD+ZLhqCUX5vkqwAQ== X-Received: by 2002:ac2:4838:0:b0:52b:c27c:ea1f with SMTP id 2adb3069b0e04-52ce185faa8mr2458055e87.55.1719240441554; Mon, 24 Jun 2024 07:47:21 -0700 (PDT) Received: from umbar.lan ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-52ce88b0119sm212699e87.222.2024.06.24.07.47.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Jun 2024 07:47:21 -0700 (PDT) From: Dmitry Baryshkov Date: Mon, 24 Jun 2024 17:47:17 +0300 Subject: [PATCH v4 11/16] drm/msm/dpu: split dpu_format_populate_layout MIME-Version: 1.0 Message-Id: <20240624-dpu-mode-config-width-v4-11-1038c13da3a5@linaro.org> References: <20240624-dpu-mode-config-width-v4-0-1038c13da3a5@linaro.org> In-Reply-To: <20240624-dpu-mode-config-width-v4-0-1038c13da3a5@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=zqoTIjqPYIYWXKg68mMznSRJO1h39pUrDrqziijLBcc=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBmeYbwPdixzEzKzF2XAW2L0kXnE0sAJGbfHiPHa QAPnApaMB+JATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZnmG8AAKCRCLPIo+Aiko 1WnLCACyXlV+KDnQNmk8XONoRWF2Rx7ZlX/sNe697OhldnXiCsXyB8Fkb8XR4EEQrPlSIz/ywED XV8MY/bXq0+QO4QMIAYudw4Gp4+kS97fmOTdXrimneXtpWcwYpv2A1x3e0em2vvj6ZEtNYZCqVa 3fUR3xMIXhP4V1hJX+3GwqxaXP2z+HLz2hA9Zso2Vj9JDiibT52ek2CcGNXOLLGgBVd96YVUnwh Jp3gLcMXkKnd/pGSXwPa+g4K4mSay5zUHQzSJ46FILJ8lYb8DflqNxvW29hjcEGNyvmIgktDEm9 i+bqWujYD/0bt737z3WKzaXYeXi8y4iPvnhowc7ay4lZ9Ghj X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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 acbba6d4e68c..d8e37400d852 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 @@ -584,7 +584,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 14:47:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13709666 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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 3F83DC30659 for ; Mon, 24 Jun 2024 14:47:37 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1B89110E4A4; Mon, 24 Jun 2024 14:47:30 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="j3SOw44F"; dkim-atps=neutral Received: from mail-lf1-f51.google.com (mail-lf1-f51.google.com [209.85.167.51]) by gabe.freedesktop.org (Postfix) with ESMTPS id E71C910E480 for ; Mon, 24 Jun 2024 14:47:23 +0000 (UTC) Received: by mail-lf1-f51.google.com with SMTP id 2adb3069b0e04-52cdea1387eso2148904e87.0 for ; Mon, 24 Jun 2024 07:47:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1719240442; x=1719845242; darn=lists.freedesktop.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=/wMlH4i9aSiV8SpOBL/K+Len1cl9ltJo+1Pe77n/oAQ=; b=j3SOw44FUby/kMkcTx4IVsJNaCUVxf3dwEx6DK3X9/Lua+S6wyGbndZ3/GCdxPepzn 4FLcAMSyyMa1zCilnllh1OARBfjSCj/+0kizhj9//tXtNP2lG8wzSCrsLe0aE5Ug1G9K j6e2SVJLinETmsdHdLosq4NYzwZWnF2fpu8dSkGGkvYSCw51Hl93PUJaAk7LLqNxYjDL lZrV1zzl3nXtgTzcvdebEBg9scGiUfm0v89EO+2n9ia4MhWU1jCY1mpcFU6ZID7NwTvr +wKtCnOykJWcBUwAX2Yndu1s2qLjh16dxO8ysAKvu+E2V+EIsxqui//rJWzUwzVl69Te QmHQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719240442; x=1719845242; 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=/wMlH4i9aSiV8SpOBL/K+Len1cl9ltJo+1Pe77n/oAQ=; b=I7yHRHyy5hL9h+0+Weyct2R5PRVM8z69Qq0LoBMFfNnPT816meyAv+JS1nXP93S597 +wBKJLodGaEpiYpAXVVGZiFdxtz0h5Fv8SVXK1gIfW4PN6hnAOSndRYk9h1j1eMDHpuV UtCZDHRqg+rzuXGBMd3flJdoksA20Hy50vBPw7l0smWO7FF58PWdNiLpQtsTYDkI1fVH uyZykaY/bilDAUdLndV2ED3Fri1eSB0HJlWLxrSuEcQpHuftiIehSVjc7NiAaa0ZKgVG hHSofX59Mx8Olb5CoBGVblRPkARBJZf8KgEb5cRp6baV3vc4Yyf3L5D/U97zZjJILsOf 7rHg== X-Forwarded-Encrypted: i=1; AJvYcCUtX1fYkrkf2Zu7uv0EYfyoqmeRXmQHJiKbUzpx3L36Z2ecn+KySWhRoiqqo2B0JC6yTujqz9N7GnNs4Py93b/XD7eltZphO0eQtXVAhkT4 X-Gm-Message-State: AOJu0YwapYtjGxmUKvxdKk9hbk0EdaMpVqhhfZUrnMUGRSudwR44+LzV qCH/6/EWhjNcRzsdgur+Ui9AZbdD+MrnhFv7LuJz3sDC1mNfBzKFHMQKvsb9AZ8= X-Google-Smtp-Source: AGHT+IHOAxN9ePVbrTB/XoAtFimmZlfCa9n5Eop29aMQVEk6fxSv+SAQazRrzqA5y2KgIZ/nhOoaow== X-Received: by 2002:ac2:57c5:0:b0:52c:dda1:5db1 with SMTP id 2adb3069b0e04-52ce1865a6bmr2557315e87.67.1719240442190; Mon, 24 Jun 2024 07:47:22 -0700 (PDT) Received: from umbar.lan ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-52ce88b0119sm212699e87.222.2024.06.24.07.47.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Jun 2024 07:47:21 -0700 (PDT) From: Dmitry Baryshkov Date: Mon, 24 Jun 2024 17:47:18 +0300 Subject: [PATCH v4 12/16] drm/msm/dpu: make dpu_format_populate_addrs return void MIME-Version: 1.0 Message-Id: <20240624-dpu-mode-config-width-v4-12-1038c13da3a5@linaro.org> References: <20240624-dpu-mode-config-width-v4-0-1038c13da3a5@linaro.org> In-Reply-To: <20240624-dpu-mode-config-width-v4-0-1038c13da3a5@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=6500; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=qX2/vlKkitTc/3eHEtcQg+VzMmr91mJSwt7zTMIK2v0=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBmeYbwP+C8Kgs2yJXNSVMG5XxxthJCfV/2LqRY4 XR+FA5VIHiJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZnmG8AAKCRCLPIo+Aiko 1bkuB/0azRQzUUAJKmL7Pp/O+zBzpDN7D4xgBbW1LWy9yRjB/kNTRpF0VNVIl6fJ4d+7hYnt4ur 2lXVT2rxKrsg5LHM/cg0p70r4xKhLBf+2O/U+jUfONVkpJ+Ofl6YKwQdMFYNmZRHp9mwI4vL1Cn 4CWL1TNewA2UQobpkoyEuSJGQp1g4I4+TQ9lYnEBwUTaal8Fm1fqy53zPJlaOeN241qM/CbUGwH D7VMx8lzr45oGsuS39AnK8yHVFiqgnfzJWPjdJZ8OoqcEtqKeBrnQiabPJC2newYC1eEBQrBavX nmqf+bRXr15wZKktvGPy6UBvssktFQJjdRkc8xBBOT/I6t7j X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The function msm_framebuffer_iova() can not fail, it always returns a valid address. Drop the useless checks (that were already performed at the time) and make dpu_format_populate_addrs() return void. Signed-off-by: Dmitry Baryshkov --- .../gpu/drm/msm/disp/dpu1/dpu_encoder_phys_wb.c | 6 +-- drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c | 62 +++++----------------- drivers/gpu/drm/msm/disp/dpu1/dpu_formats.h | 10 ++-- drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c | 14 ++--- 4 files changed, 21 insertions(+), 71 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 d8e37400d852..fcd5a073e2b7 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 @@ -590,11 +590,7 @@ static void dpu_encoder_phys_wb_prepare_wb_job(struct dpu_encoder_phys *phys_enc return; } - ret = dpu_format_populate_addrs(aspace, job->fb, &wb_cfg->dest); - if (ret) { - DPU_DEBUG("failed to populate layout %d\n", ret); - return; - } + dpu_format_populate_addrs(aspace, job->fb, &wb_cfg->dest); wb_cfg->dest.width = job->fb->width; wb_cfg->dest.height = job->fb->height; diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c index abe3a1c0e409..095bb947f1ff 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c @@ -277,25 +277,15 @@ int dpu_format_populate_plane_sizes( return _dpu_format_populate_plane_sizes_linear(fmt, fb, layout); } -static int _dpu_format_populate_addrs_ubwc( - struct msm_gem_address_space *aspace, - struct drm_framebuffer *fb, - struct dpu_hw_fmt_layout *layout) +static void _dpu_format_populate_addrs_ubwc(struct msm_gem_address_space *aspace, + struct drm_framebuffer *fb, + struct dpu_hw_fmt_layout *layout) { const struct msm_format *fmt; uint32_t base_addr = 0; bool meta; - if (!fb || !layout) { - DRM_ERROR("invalid pointers\n"); - return -EINVAL; - } - base_addr = msm_framebuffer_iova(fb, aspace, 0); - if (!base_addr) { - DRM_ERROR("failed to retrieve base addr\n"); - return -EFAULT; - } fmt = msm_framebuffer_format(fb); meta = MSM_FORMAT_IS_UBWC(fmt); @@ -330,7 +320,7 @@ static int _dpu_format_populate_addrs_ubwc( + layout->plane_size[2] + layout->plane_size[3]; if (!meta) - return 0; + return; /* configure Y metadata plane */ layout->plane_addr[2] = base_addr; @@ -361,60 +351,36 @@ static int _dpu_format_populate_addrs_ubwc( layout->plane_addr[1] = 0; if (!meta) - return 0; + return; layout->plane_addr[2] = base_addr; layout->plane_addr[3] = 0; } - return 0; } -static int _dpu_format_populate_addrs_linear( - struct msm_gem_address_space *aspace, - struct drm_framebuffer *fb, - struct dpu_hw_fmt_layout *layout) +static void _dpu_format_populate_addrs_linear(struct msm_gem_address_space *aspace, + struct drm_framebuffer *fb, + struct dpu_hw_fmt_layout *layout) { unsigned int i; /* Populate addresses for simple formats here */ - for (i = 0; i < layout->num_planes; ++i) { + for (i = 0; i < layout->num_planes; ++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; - } - } - - return 0; } -int dpu_format_populate_addrs( - struct msm_gem_address_space *aspace, - struct drm_framebuffer *fb, - struct dpu_hw_fmt_layout *layout) +void dpu_format_populate_addrs(struct msm_gem_address_space *aspace, + struct drm_framebuffer *fb, + struct dpu_hw_fmt_layout *layout) { const struct msm_format *fmt; - int ret; - - if (!fb || !layout) { - DRM_ERROR("invalid arguments\n"); - return -EINVAL; - } - - if ((fb->width > DPU_MAX_IMG_WIDTH) || - (fb->height > DPU_MAX_IMG_HEIGHT)) { - DRM_ERROR("image dimensions outside max range\n"); - return -ERANGE; - } fmt = msm_framebuffer_format(fb); /* Populate the addresses given the fb */ if (MSM_FORMAT_IS_UBWC(fmt) || MSM_FORMAT_IS_TILE(fmt)) - ret = _dpu_format_populate_addrs_ubwc(aspace, fb, layout); + _dpu_format_populate_addrs_ubwc(aspace, fb, layout); else - ret = _dpu_format_populate_addrs_linear(aspace, fb, layout); - - return ret; + _dpu_format_populate_addrs_linear(aspace, fb, layout); } diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_formats.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_formats.h index 2f2bff14c0db..256ca25c37a0 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_formats.h +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_formats.h @@ -37,14 +37,10 @@ static inline bool dpu_find_format(u32 format, const u32 *supported_formats, * @aspace: address space pointer * @fb: framebuffer pointer * @fmtl: format layout structure to populate - * - * 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_addrs( - struct msm_gem_address_space *aspace, - struct drm_framebuffer *fb, - struct dpu_hw_fmt_layout *fmtl); +void dpu_format_populate_addrs(struct msm_gem_address_space *aspace, + struct drm_framebuffer *fb, + struct dpu_hw_fmt_layout *layout); int dpu_format_populate_plane_sizes( struct drm_framebuffer *fb, diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c index 8191282b8819..1431ea753a4f 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c @@ -683,17 +683,9 @@ static int dpu_plane_prepare_fb(struct drm_plane *plane, return ret; } - /* validate framebuffer layout before commit */ - 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) - 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; } From patchwork Mon Jun 24 14:47:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13709667 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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 49EA5C3065A for ; Mon, 24 Jun 2024 14:47:38 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id CB63A10E4A6; Mon, 24 Jun 2024 14:47:30 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="qsFByJDb"; dkim-atps=neutral Received: from mail-lf1-f53.google.com (mail-lf1-f53.google.com [209.85.167.53]) by gabe.freedesktop.org (Postfix) with ESMTPS id D7D4210E498 for ; Mon, 24 Jun 2024 14:47:24 +0000 (UTC) Received: by mail-lf1-f53.google.com with SMTP id 2adb3069b0e04-52cdf9f934fso1954777e87.1 for ; Mon, 24 Jun 2024 07:47:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1719240443; x=1719845243; darn=lists.freedesktop.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=qsFByJDbwEkl7aLWRaRoY78fMNsHlawnkoFXYQ98n0tTgcy77tLkqeBtOuCHNdhzW8 Dr3BeYx6Ai2wYPE2zlCyxY/qOUYdYWZMKLfoGIZojdlKHWq8LEWYBYfT45Xg7gAQwntO myou0XADq929wFNNvP7XGowNL2ahf7z89EUVBWo9A3wf3Wy0jnhfkob5pMtXk0HMldqS 4hwgmuXXKBpk7JVqr8mucFx+PSu+5JmfaSDW8hD9qYSqMEeTk3NmPJqU93jaTp9bFKLH MiJJ077VrVdwnw35aKKTPpgK3WgUMh257cxEuo96pqI3IRGrTTfcZZlSNkM2R+nltuA+ YG5A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719240443; x=1719845243; 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=UtOW67Xy7pt+Pdz75bpyS4UTzKqJc12h3UvEi22JX6PbC0Q8JFTsY+EQzYuxQrQKAQ ao4fj9eugIVnRjAjRoTKpo3yj6RNQjCLY1aLSNfDW5RPY6pfCgKRS1rvQhPpw7Tlg+er qKLN9BG4L3jC/wIAKvadgLneqHVAXO83Fe2n4PYC/jC8mdcF2k8UEvxdoMWr31Sw2V5X FKJb6HGOpLCOUk9xI0ckj2fLUQmUULZlrIjrv8XcGg4HumhxsnmG/XdxWQnb/BzaIl3+ QpQPFWqxRuufyxDBSLV8tpPo5da46w/0FnMZ0ISBJRBztUqmW6JS67/I5sxP7B9KzK4j gYLA== X-Forwarded-Encrypted: i=1; AJvYcCX5QbRVfv9orIBjRvyMIc2AbdexIs73mmrbiS5atRkwbphA3H7OA8YDS9yXxH8HJWygQqnLZFRB3RBMV5PKJmkMTz0oNS12TeVHkSefh0EO X-Gm-Message-State: AOJu0YyA5tVFQp1v9GDaxxP7Uvv3a4fKe7yH4aYrliEw5Iz3O9oJ7bdD u6jFQchzEyUVf3Q42YOGxFw6fBMFtARaNBAN+iDoCrvp1JK60+s+3rX+wH+0sbo= X-Google-Smtp-Source: AGHT+IFYs+QdZxu7xVQC/R0vHG0CMkV/ehojX1Swu7BBcnrWQIzEquRrVkOeQ2GviNaYZZN8p7mwKg== X-Received: by 2002:ac2:5617:0:b0:52c:b606:2b2 with SMTP id 2adb3069b0e04-52ce0673b84mr3108321e87.46.1719240442967; Mon, 24 Jun 2024 07:47:22 -0700 (PDT) Received: from umbar.lan ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-52ce88b0119sm212699e87.222.2024.06.24.07.47.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Jun 2024 07:47:22 -0700 (PDT) From: Dmitry Baryshkov Date: Mon, 24 Jun 2024 17:47:19 +0300 Subject: [PATCH v4 13/16] drm/msm/dpu: move layout setup population out of dpu_plane_prepare_fb() MIME-Version: 1.0 Message-Id: <20240624-dpu-mode-config-width-v4-13-1038c13da3a5@linaro.org> References: <20240624-dpu-mode-config-width-v4-0-1038c13da3a5@linaro.org> In-Reply-To: <20240624-dpu-mode-config-width-v4-0-1038c13da3a5@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/pANAwAKAYs8ij4CKSjVAcsmYgBmeYbwdB+x33XFTd68Bqk8Qd+8V4zPpzKguQLAR TFcquTWZnaJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZnmG8AAKCRCLPIo+Aiko 1eSSCACG2Aiq6eqYvlJ1pnYozr1SXoRLqOGO1q+bShx1C6vjZbh5Z6y/wdiF3rAyoipMEGmQ/vD sUh5RW+GxShGjICYW8qelvlGt/5a3fGm9mhT0WDtagmkRIdqG5jLlx4LrYbfVAM0IyHmy8Voszr rgIAFFs6yXy+V3Z1tI28DUiqJ3UqSWDrM3kq3hjgJ9LG0sotymjdR3Zxid6fa9kG96sQP+1h9Dx qxM7Ctl05l0P8DMGILbqqs0MRkc0kOq2MsK/+3P3ZOcniLw2MhTHI9YYlhWWTvvSl5+rfw9b0Pl 8wDXuRZwpH1GqKEO0CIBriNoesdaxCOm+vtBXBp0ITPo+jc/ X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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 --- 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 14:47:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13709668 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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 665D7C3064D for ; Mon, 24 Jun 2024 14:47:39 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9AFD310E4A5; Mon, 24 Jun 2024 14:47:30 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="UM1JLjkV"; dkim-atps=neutral Received: from mail-lf1-f44.google.com (mail-lf1-f44.google.com [209.85.167.44]) by gabe.freedesktop.org (Postfix) with ESMTPS id 8B90210E49E for ; Mon, 24 Jun 2024 14:47:25 +0000 (UTC) Received: by mail-lf1-f44.google.com with SMTP id 2adb3069b0e04-52cdebf9f6fso2605410e87.0 for ; Mon, 24 Jun 2024 07:47:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1719240443; x=1719845243; darn=lists.freedesktop.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=uLeNak1YIohIAUEGI7HbWPLoyZnkDUw0ZR1m0kfOocM=; b=UM1JLjkVjTanncnBHPWySOudmTrV9us4d7bkEWTm1pI+klgP1xFm6DrlaygY5HKxkQ PdFwjvDl/qJuUMzYAJd4ZJICWrDsvdCDaIOJ/9GY9C06Go5j8d8SiN5JfoskqwGdeXDC d4XjEWFjAlH/xDgSn5LuIQmEB+OwkSwO9gDCXYQMShF9sdAzrlVKFIJ4xTD11XSt2sym 0HCIYpA5hoiY9XqIp/5oQmQ22zSSakcsg+8Gkn20482U+tHiI/hchHD2BAfHg1nf5KMR WoZT8KNp2RA0pae36Z/APdvQrYzP80d7hh7pRYeY1C1iE2ABOWauqGu+Ae3+yQ8rBaTZ biXQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719240443; x=1719845243; 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=uLeNak1YIohIAUEGI7HbWPLoyZnkDUw0ZR1m0kfOocM=; b=i7BuxfzsZm+BOGU1cukT3X5jaXnrUU07Evm1g6K/lynXbLGuyNuRtbJLPZMklznT5h vbIUzLhWrTCrKPboITGoTYqkBQuUREBRzsUVDqtHTZE2gftJdrEpbphWmfVcYgq+b9Fo ebUqkNzMOqnSxaz6WvlwmEL6ZPVZ4ZM/aorsFXABFiow+kkSDd/iE6p9lm1vlLSaur6n wvWC55qRXt14gznWTjp8biXHbf83QD+Gc9IBcy/N1If0iO2DbxBumtBjKwuwDXAOvznj sVgRc1zAHeSEJY2dT00LwOYgh16CW9FS+StWFdl3tKmuq0FxwNd5rNe4cX85oDDY1axF lMUg== X-Forwarded-Encrypted: i=1; AJvYcCWmXEOgWN7Wz1YBOlqZl+r41+dk8gmcr0zwM9ZpUwjUpRo2/IcPSrlh9sxtyJcH6r/tCClgial0s2yEB5sMNcWGXFpOc6oPPYOLrRIm7b92 X-Gm-Message-State: AOJu0YzG4g3VGAnyHAqYctkDl4oXb+QzpYAmQ+5EsDGH1LVLzcIxdPst /FEOSgq8JmXzEVZh/b6Z4PXb7AFXbaqhWwAn3p3cHNjFpF4fNIClM3VTIM2q58g= X-Google-Smtp-Source: AGHT+IGV2jXTmAq5MqKAg19g+k6KP+0JooI2IY873ixMRNSqDGlFusMrG+d7Dz2rksdlMT0CLSzUMA== X-Received: by 2002:ac2:5f4c:0:b0:52c:84a2:d848 with SMTP id 2adb3069b0e04-52ce186272dmr3454109e87.65.1719240443604; Mon, 24 Jun 2024 07:47:23 -0700 (PDT) Received: from umbar.lan ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-52ce88b0119sm212699e87.222.2024.06.24.07.47.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Jun 2024 07:47:23 -0700 (PDT) From: Dmitry Baryshkov Date: Mon, 24 Jun 2024 17:47:20 +0300 Subject: [PATCH v4 14/16] drm/msm/dpu: check for the plane pitch overflow MIME-Version: 1.0 Message-Id: <20240624-dpu-mode-config-width-v4-14-1038c13da3a5@linaro.org> References: <20240624-dpu-mode-config-width-v4-0-1038c13da3a5@linaro.org> In-Reply-To: <20240624-dpu-mode-config-width-v4-0-1038c13da3a5@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=1824; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=+RF/P7K64SGg/tQu4deWbHOf+YbNZCIL5VEgg9w8tfc=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBmeYbwypWamkbFYHq9xCHZcfNfWOlbHlrnsCxGg bTNoVOgA+iJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZnmG8AAKCRCLPIo+Aiko 1Xz0B/9Z9dIa7gvw1tz29gjmfw9mynEEq6c75eE8Dl0jOAaIhdd8r3QXg4E4UWFWzxN/fhoglZR 795Au+mAhB/wRq4ARHBsaMjO+WTy4/ct5d9viewJWN699MF3NAmaTCDe7UQTYu6jHdmT49CEJ50 ebg5FcWkDU7LwibB/zomy9M2ZetfyXaCjHCBSvRDbW8uWZRMCwIK5zYnbOHpKP+dIlK4m6CN8ET +MoZMA6BuJBhpV9j2Xdnq3pOD9Lg+xfzjF0EJlskA8r1L063Fg/8Eoydk13Rcklc4MMxcNI1Sv8 LaZMXZRy9IwxdldlYXdU6okAgekN04HAmLheULbvg3JIXHDL X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Check that the plane pitch doesn't overflow the maximum pitch size allowed by the hardware. Reviewed-by: Abhinav Kumar Tested-by: Abhinav Kumar # sc7280 Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.h | 2 ++ drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.h index 4a910b808687..8998d1862e16 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.h +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.h @@ -12,6 +12,8 @@ struct dpu_hw_sspp; +#define DPU_SSPP_MAX_PITCH_SIZE 0xffff + /** * Flags */ diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c index a309b06b0992..a629eb3a6436 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c @@ -782,7 +782,7 @@ static int dpu_plane_atomic_check(struct drm_plane *plane, { struct drm_plane_state *new_plane_state = drm_atomic_get_new_plane_state(state, plane); - int ret = 0, min_scale; + int i, ret = 0, min_scale; struct dpu_plane *pdpu = to_dpu_plane(plane); struct dpu_kms *kms = _dpu_plane_get_kms(&pdpu->base); u64 max_mdp_clk_rate = kms->perf.max_core_clk_rate; @@ -856,6 +856,10 @@ static int dpu_plane_atomic_check(struct drm_plane *plane, return ret; } + for (i = 0; i < pstate->layout.num_planes; i++) + if (pstate->layout.plane_pitch[i] > DPU_SSPP_MAX_PITCH_SIZE) + return -E2BIG; + fmt = msm_framebuffer_format(new_plane_state->fb); max_linewidth = pdpu->catalog->caps->max_linewidth; From patchwork Mon Jun 24 14:47:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13709669 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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 62CE6C30659 for ; Mon, 24 Jun 2024 14:47:50 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D582C10E4AB; Mon, 24 Jun 2024 14:47:48 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="Ivq6fzLd"; dkim-atps=neutral Received: from mail-lf1-f42.google.com (mail-lf1-f42.google.com [209.85.167.42]) by gabe.freedesktop.org (Postfix) with ESMTPS id DC89610E4A0 for ; Mon, 24 Jun 2024 14:47:25 +0000 (UTC) Received: by mail-lf1-f42.google.com with SMTP id 2adb3069b0e04-52cd8897c73so3125613e87.2 for ; Mon, 24 Jun 2024 07:47:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1719240444; x=1719845244; darn=lists.freedesktop.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=Ivq6fzLdrZmPbF5RLGc6a2DXQEHuUDh6BD2Q8EniRqK3GHFOsy/DflTVpNOLbh5/LQ HhgCDwyaqLpjufBdySEtYzdjVgTR5unt44sdjYssd+1Zmy7kDiWyIVBi9PdPoluziq/k DON1P88ragm3bNo7HI9v/Iednvnne07C64KxEC8bif8nMO/Cf/lvuwz5KpIOzmoAEDGM tYUd9NGBQ6QarOBb6bGGuGjPrTHyqqc2fLmpEbvHSVlYv1xJWrU9CpBrmYdEd9nyrR7Y 4fSccHZjwFD9oNG7gMpQG6yfTTTHtuDWM237pDdIUysq/bYQBYShUz+w7aeoJJkdqbWB trcw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719240444; x=1719845244; 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=QjFBtT/nn7DrxlMRLoYaRozoDpKFYaYT6vgc5tTnEnlEXn77MC4kP0TkvLy7n2YncR lMkBcxGbU/LjqU7hrzUjCkO4oDGTBwUmaKJJt9Mylse0nqvTs4HTFx1sGCZHKwaPPEWu 3VXxQyWxeBB5+KHYAKg35ai5t1xW1NUwXqguKMOBzWRFcYpfDtcCdsOeJrFq/zC2fuon EWmf1MVN+o+T/q+4vx8i8vFfJZEx9EIlUk55Ld/UDtNrLUXBTcDaU+soeRNYXvNtpcYT TKjgN+6HSasvjuK80aozFpFYkpvW3mXgdu1IAkvKSUaujrW4Xxwxpt2E3WBS2yUZUkR6 E6hA== X-Forwarded-Encrypted: i=1; AJvYcCUpQ5re3B/Oj1KifORv/AsKg6D0Es2HqmfdM8qghC0dmefcyvvpbVXNGQdI57cjCrvuUKVe6hqMePdSEGvFGpIbw+LvefktUkff/MeSdnIW X-Gm-Message-State: AOJu0YwOlk82jYs19ReaSvT1Kqq4SeYdWqzDTQLqvAxC8kvFZnmWsHQL XlNkPZCsEsLBYWEqQz1pRQYIAaFa9heAsF5WAlGX75I2SPJGU0iX74p/bZtRXQw= X-Google-Smtp-Source: AGHT+IHkOF2Y2zANjunOdHDWnrdOGAYMf0TLfoEW8ALlmk76VDM90aqYcMM61GQSCR25Fkvk941mUg== X-Received: by 2002:a05:6512:10d1:b0:52c:e982:8457 with SMTP id 2adb3069b0e04-52ce9828502mr1763157e87.32.1719240444218; Mon, 24 Jun 2024 07:47:24 -0700 (PDT) Received: from umbar.lan ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-52ce88b0119sm212699e87.222.2024.06.24.07.47.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Jun 2024 07:47:23 -0700 (PDT) From: Dmitry Baryshkov Date: Mon, 24 Jun 2024 17:47:21 +0300 Subject: [PATCH v4 15/16] drm/msm/dpu: merge MAX_IMG_WIDTH/HEIGHT with DPU_MAX_IMG_WIDTH/HEIGHT MIME-Version: 1.0 Message-Id: <20240624-dpu-mode-config-width-v4-15-1038c13da3a5@linaro.org> References: <20240624-dpu-mode-config-width-v4-0-1038c13da3a5@linaro.org> In-Reply-To: <20240624-dpu-mode-config-width-v4-0-1038c13da3a5@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/pANAwAKAYs8ij4CKSjVAcsmYgBmeYbxcu71N+9INNfPPkK2CIB3z1cLlD5fiPt7C 6XiRIHuMeCJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZnmG8QAKCRCLPIo+Aiko 1UaEB/928OC54/bQndPdLYJkjPxLl/SCr//YwTjXVSHMNXnSgrecsYMJhPKDnEW8qNexGyVS8+a wF7OxggT5HQncRADsqPElHILbu9D09xgpxqijJcgPR6hsxKKO8wJKc2GBkpxfgOC3MyvJ2K+2KL Uf5+lVNKy5Zb+6CyTP8GzZqIlAJwL0+bTplxXneIQiAidLaqkLrj6+0oEQmCOCxDs1yXXjLXW2K QRJ+KcCeAz+K2waUsMXJVZzQoYy6E9XobyvKF/bagF4Vpb/rVD5qcuHeXB8hi6hFW9dD3YCSsB+ B16QlaDN86TJ1l7K+ToJBIjmEWjrNLQTOIlS7U5NNqy8qua/ X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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; From patchwork Mon Jun 24 14:47:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13709671 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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 06830C2BD09 for ; Mon, 24 Jun 2024 14:47:51 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2F1F610E4AA; Mon, 24 Jun 2024 14:47:49 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="rdpP0T0h"; dkim-atps=neutral Received: from mail-lf1-f48.google.com (mail-lf1-f48.google.com [209.85.167.48]) by gabe.freedesktop.org (Postfix) with ESMTPS id A7A9E10E49E for ; Mon, 24 Jun 2024 14:47:26 +0000 (UTC) Received: by mail-lf1-f48.google.com with SMTP id 2adb3069b0e04-52cdcd26d61so2527535e87.2 for ; Mon, 24 Jun 2024 07:47:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1719240445; x=1719845245; darn=lists.freedesktop.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=y1x4u/WFQ3yi7lWZK3LSC04Q6VFcnkANEfAcENz04sk=; b=rdpP0T0h7UzIekVImvkzWl6DpXrn3srS1B7fnE1B0np6vUEKivEgpcgm7kchMA7p49 rvSFwwr2WCMCcoLpZmx58T0BAfb8xDyC4j+u69fqTaU8UwGVao7KVPZPYJbzcrYABmQU 1cOUAoDXmzPJOGJbxe33uL0jjJxYOlXnIFZh2lDqEDVtsM3btZfKTatu0rw2v3f7KqOL qUsmZH683g4Sji4cy9q8EIezfaYdDgXEpn2LUrGCjg02p/jo7yGA8ffbELtL6lPU2/Tb tULNMEolEs0O8QTKmGgzSbIKOh0LUmlMXuTjJxAPdqoqQv3SQa/ORDBEbfIN+dgF/NOF W5+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719240445; x=1719845245; 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=y1x4u/WFQ3yi7lWZK3LSC04Q6VFcnkANEfAcENz04sk=; b=e6V3+DsaBJDUHKtUS2ITe4TuviD4zTYnHi0QDkUscKufn9ukZTsIp8Y5eA2OUNjD+D NiNYfgBkvHnlm/ZYukk+qMpWgdgvkO4+kNNaits97L2DKUktb20urp6EyfVH+H2upFwg e0tUe5E5HHiqDYw1h4p9lAvbiWCvrRK4n/m40/NoufQ5GZYAsOKvLzQ8GkCpHySON1OQ kBU7DqLl2NMj0uRk5twUuZ+tY6tvWAMEHupxMUqtnTnn1lF80BPRKZBToRFMYBpbLZGK fq4ebRv5d6TmVWdV4Y4B+1wp7jVvbnDOnSMWpa0g2SsnEC42Ecs6DkFKxtAOmj7hMVoZ ZtgQ== X-Forwarded-Encrypted: i=1; AJvYcCW0FyCGIWdy5MbR63eX/DuF3Qw3rEGKKTccCUbjJZ+n4VqEQoqaSeWFv21BQMcf1qKilW1LzxWua60WdysHNsxZwLLV8Qt7w+ADWGRFpoZE X-Gm-Message-State: AOJu0Yyl/ifZ66lyPALQgHuFMB3JCIzTVz5+jmfE/AJAJD2a/dz2sr7A djfZ6dzVJ8R8BML+sKgc+MGr2Z0guQUgGhhQEeTbv1kHvUZSDfKv6zVm+nuqlz4= X-Google-Smtp-Source: AGHT+IE2tq5O6bSrI55XWg6dyvThtBg2EX196a2jkj5KUfUF2VK4A2DrFZtJeJOGcRqTct6QoQtMVg== X-Received: by 2002:a05:6512:3da5:b0:52c:e3bd:c70b with SMTP id 2adb3069b0e04-52ce3bdc788mr2974341e87.1.1719240444851; Mon, 24 Jun 2024 07:47:24 -0700 (PDT) Received: from umbar.lan ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-52ce88b0119sm212699e87.222.2024.06.24.07.47.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Jun 2024 07:47:24 -0700 (PDT) From: Dmitry Baryshkov Date: Mon, 24 Jun 2024 17:47:22 +0300 Subject: [PATCH v4 16/16] drm/msm/dpu: sync mode_config limits to the FB limits in dpu_plane.c MIME-Version: 1.0 Message-Id: <20240624-dpu-mode-config-width-v4-16-1038c13da3a5@linaro.org> References: <20240624-dpu-mode-config-width-v4-0-1038c13da3a5@linaro.org> In-Reply-To: <20240624-dpu-mode-config-width-v4-0-1038c13da3a5@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=2549; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=N3YZKN6loeIt7zXSx7uKEpsl5ti+ONaIe5A6G3FjkBU=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBmeYbxG1j08vEex/AL+/BKNEehGKP1/V7s07UNY 2qFA6lUUwaJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZnmG8QAKCRCLPIo+Aiko 1cesB/9YdDl3hmZOd1LdElWwNw3tnumm7aoxG3qajMAgQoVZG9l5Af7/QSMFT5rJeg24+eT2xRR KwiOITmSJtgIX08d/mALiMq1UPSBaWRGRpT8Y+Lmtwd+lHH7HuDJbpLpQIkPjVswji7eNhr6Gyc f9qNh7lnuE+QWuockHzCMI3jGHfE7/TwlUq/G0gFzkREVIk6zILia3bs+obsGcVGsb+zogmvigQ JL5Ejw7z4DpQaBrXacCmVTY0UuFLgxxZzxTe61tuxhCuK1vZhs/d4/4KTGoU217byGDcQrKxxWQ f3WpUuRAT69uS7x/Z7Bs7Gvq78qbrbHJ2PTeeehDjzxL/aNw X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Lift mode_config limits set by the DPU driver to the actual FB limits as handled by the dpu_plane.c. Move 2*max_lm_width check where it belongs, to the drm_crtc_helper_funcs::mode_valid() callback. Reviewed-by: Abhinav Kumar Tested-by: Abhinav Kumar # sc7280 Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c | 15 +++++++++++++++ drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 9 ++------- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c index 2a87dd7188b8..f4ec3df45536 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c @@ -1235,6 +1235,20 @@ static int dpu_crtc_atomic_check(struct drm_crtc *crtc, return 0; } +static enum drm_mode_status dpu_crtc_mode_valid(struct drm_crtc *crtc, + const struct drm_display_mode *mode) +{ + struct dpu_kms *dpu_kms = _dpu_crtc_get_kms(crtc); + + /* + * max crtc width is equal to the max mixer width * 2 and max height is + * is 4K + */ + return drm_mode_validate_size(mode, + 2 * dpu_kms->catalog->caps->max_mixer_width, + 4096); +} + int dpu_crtc_vblank(struct drm_crtc *crtc, bool en) { struct dpu_crtc *dpu_crtc = to_dpu_crtc(crtc); @@ -1450,6 +1464,7 @@ static const struct drm_crtc_helper_funcs dpu_crtc_helper_funcs = { .atomic_check = dpu_crtc_atomic_check, .atomic_begin = dpu_crtc_atomic_begin, .atomic_flush = dpu_crtc_atomic_flush, + .mode_valid = dpu_crtc_mode_valid, .get_scanout_position = dpu_crtc_get_scanout_position, }; diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c index 40e4b829b9da..1c86f22859fa 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c @@ -1191,13 +1191,8 @@ static int dpu_kms_hw_init(struct msm_kms *kms) dev->mode_config.min_width = 0; dev->mode_config.min_height = 0; - /* - * max crtc width is equal to the max mixer width * 2 and max height is - * is 4K - */ - dev->mode_config.max_width = - dpu_kms->catalog->caps->max_mixer_width * 2; - dev->mode_config.max_height = 4096; + dev->mode_config.max_width = DPU_MAX_IMG_WIDTH; + dev->mode_config.max_height = DPU_MAX_IMG_HEIGHT; dev->max_vblank_count = 0xffffffff; /* Disable vblank irqs aggressively for power-saving */