From patchwork Tue Sep 3 03:22:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 825002 Received: from mail-lj1-f170.google.com (mail-lj1-f170.google.com [209.85.208.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6DD90433BC for ; Tue, 3 Sep 2024 03:22:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.170 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725333779; cv=none; b=IpSyOhKXhI2Cq2nM01J0D0flrfdOR66EJD9qvi6tqvFWj1jLrZs7Wee+qT1iUi4arp/E1lVQBc5KFjSqudyty0WRikQED8dhZTLmNaBVfbpSDks/Id7Z1aQpiZ57LzuSwiDEkmz29LkAW6iqE65TxXn+L8+4eeIs90Wqe3VzBGs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725333779; c=relaxed/simple; bh=9hiBNik93uZFwi3I0kzx7lGjwl8YmM6Oy86cQrRvVmE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=svtP0YRitTgb8GgYGgSqCMgbi1m459JdVUyTICGM18t85FUtGx7e/jtq/ZHdwuNAiELrjXTsVSaOleOdfkBm832uAfiYzTCiPvZbW9V0dsrNXzr/OET3UkujkkggSBQVgZOuo/27XtjhU4MZBd06fwAJGz9pQvy7sNUaXKrteYQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=UterggER; arc=none smtp.client-ip=209.85.208.170 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="UterggER" Received: by mail-lj1-f170.google.com with SMTP id 38308e7fff4ca-2f4f2868710so51723431fa.1 for ; Mon, 02 Sep 2024 20:22:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1725333775; x=1725938575; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=t8t12yUPj7e8mb7vqEqGXgnNpICOFF3VwhWmBnR3jP0=; b=UterggERPFuHzFaDeR1C9LqTVraP1EIEj1Qrq4+ti3KW1L3zlZCs8jhFfDHzYiWedD gC3U3bckR/JfEcZzRhIIh5W4GMvqP4UUVZPJByoMtD2ZJXT4JybdbweFvxPbmyb6QV6w yLyHpQ0YqLw4+LbuVJ4vHt5xFQpEgISgO0xCG+WxGRgSmyfpod0yutTrEIxZkZAwly85 C+p1rywoOgwuNlCpUPRJ4k+F//zdBZs/8eBFKFpeChrSHwkuS2Gr9jmb6VhnjAJKdQSP EveIVKPNSbXgsxpWMjM8ocuBCdeRL0l68IJnIOnpiI/zJ7zujEgqqp29RlzVaq0sBZgJ NEpg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725333775; x=1725938575; 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=t8t12yUPj7e8mb7vqEqGXgnNpICOFF3VwhWmBnR3jP0=; b=ooyiI3PBC1kwywHPMtrYb5po4bA8nwmUuBW/KNSy95fNzIzetcwtIy4yy9BjSqK9LZ qoEYYvuwrGZJayk1Bakcht5pilqmp21Xp1lfMhLv8aPckWFN0ahaZZuwQ3xmV9c11C+9 1WQ4XhXroOTOCNI7doyJ5nNfi2T831Ha2fg4qhznp/8nv5a2qdEkkqqisLeR2XPdHjLl zRsIQZVI7EkPLXVJ/GiYzexZPh/sLT983VL/cEFhUWBMzp29+7zwmI1ZebhtVKd80r9x YzPKncBceaiz3dy7Lmku1qfFB5ougQzvfSRz5pt233UOoHgW16Ir/9u0XGfaEUFmO2F+ jQXw== X-Forwarded-Encrypted: i=1; AJvYcCXenuq6bBj5Q++RvKsjnUo9czGTlZzmSTwnC5eIn/zYNlR8aWj3iE4XWuvHp9KjoKh/PdVQZ9bMu7EwnZEQ@vger.kernel.org X-Gm-Message-State: AOJu0YzZ6HMTYQazBq4xJWmjWtyutAeS9egVgeIwxwlbMlRMEWgtc7Ma tvZAg/J4Cnxktf5kQwNgB4ydCXy60tiwggt1GBA3G0s+NuYKRKbdlMyaYNAMx1Q= X-Google-Smtp-Source: AGHT+IGTh9Dwb7pkkxXKkDP242kXyVpn9BHR6Ast3Q1izqpsDPXTt0iIBv644h0se6VkdS6Eg+y/bA== X-Received: by 2002:a2e:1312:0:b0:2f3:d82b:1959 with SMTP id 38308e7fff4ca-2f64441ec9fmr11810191fa.23.1725333774462; Mon, 02 Sep 2024 20:22:54 -0700 (PDT) Received: from umbar.lan ([192.130.178.90]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-2f614ed15a5sm21003961fa.8.2024.09.02.20.22.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Sep 2024 20:22:54 -0700 (PDT) From: Dmitry Baryshkov Date: Tue, 03 Sep 2024 06:22:44 +0300 Subject: [PATCH v6 01/15] drm/msm/dpu: make sure phys resources are properly initialized Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240903-dpu-mode-config-width-v6-1-617e1ecc4b7a@linaro.org> References: <20240903-dpu-mode-config-width-v6-0-617e1ecc4b7a@linaro.org> In-Reply-To: <20240903-dpu-mode-config-width-v6-0-617e1ecc4b7a@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.14.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1849; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=9hiBNik93uZFwi3I0kzx7lGjwl8YmM6Oy86cQrRvVmE=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBm1oEKxWGO3YydUMBY3XruJjJyYMN06dPEnug/J vWyj4bB7YOJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZtaBCgAKCRCLPIo+Aiko 1TBRB/9JjK9bNDkipN2L++V/P9kllEmOlC5pKEHKSTthCTD86R3p1mBRjVDpnr2naySQVy7Ft+V /khY5l/aDueIB9Sr6YGQbaB4rf3ZsrG9mL8c3V2xgw+60qtcLncikmD32e86nqR2lVmvpnAU4Wf NAXXf4UoR5Jec0mb45LmD5bOdIuCI45MiK1joxXb+eHACJrbYFEWvfmq18kuSY1gzeMoSYCXhXw 3I/TFEGVvjaThzJAtBWuchqyBSTw9otRq/njo7lx06SsnVbXoJNo//O6eDgAggWfSFdlmB/RILj plc9tN5Zcu/2nwXJvGDcu6SY9QVu4nWmcVTEEhPuhfY+p6zH X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A The commit b954fa6baaca ("drm/msm/dpu: Refactor rm iterator") removed zero-init of the hw_ctl array, but didn't change the error condition, that checked for hw_ctl[i] being NULL. At the same time because of the early returns in case of an error dpu_encoder_phys might be left with the resources assigned in the previous state. Rework assigning of hw_pp / hw_ctl to the dpu_encoder_phys in order to make sure they are always set correctly. Fixes: b954fa6baaca ("drm/msm/dpu: Refactor rm iterator") Suggested-by: Abhinav Kumar Signed-off-by: Dmitry Baryshkov Reviewed-by: Abhinav Kumar --- drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c index 3b171bf227d1..949ebda2fa82 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c @@ -1174,21 +1174,20 @@ static void dpu_encoder_virt_atomic_mode_set(struct drm_encoder *drm_enc, for (i = 0; i < dpu_enc->num_phys_encs; i++) { struct dpu_encoder_phys *phys = dpu_enc->phys_encs[i]; - if (!dpu_enc->hw_pp[i]) { + phys->hw_pp = dpu_enc->hw_pp[i]; + if (!phys->hw_pp) { DPU_ERROR_ENC(dpu_enc, "no pp block assigned at idx: %d\n", i); return; } - if (!hw_ctl[i]) { + phys->hw_ctl = i < num_ctl ? to_dpu_hw_ctl(hw_ctl[i]) : NULL; + if (!phys->hw_ctl) { DPU_ERROR_ENC(dpu_enc, "no ctl block assigned at idx: %d\n", i); return; } - phys->hw_pp = dpu_enc->hw_pp[i]; - phys->hw_ctl = to_dpu_hw_ctl(hw_ctl[i]); - phys->cached_mode = crtc_state->adjusted_mode; if (phys->ops.atomic_mode_set) phys->ops.atomic_mode_set(phys, crtc_state, conn_state); From patchwork Tue Sep 3 03:22:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 825001 Received: from mail-lj1-f182.google.com (mail-lj1-f182.google.com [209.85.208.182]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BE6581CDFC8 for ; Tue, 3 Sep 2024 03:22:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.182 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725333780; cv=none; b=ZuyDF3IDuKIMvsSOZLc0Jc2WUerg5NaN7RhVerGtLWnFUa3i1J00KHP0JHmKnY6mMmv//DI2GOrg1oJqL1f5mK07zLxm/+RJW/K/kAdHQ2AS9rGxC5bPI+LhnVS7RIUmgozFzNp5sv5Avf0J4oIYY0YzCdR6mc1J8nh1/2xE6rc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725333780; c=relaxed/simple; bh=pmjRO8yJThNX7l3z3gVUhe1TCXTyBOLqoZGUg4MJPFA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=aBTBEorA8llFwxO1esjpo3CQQS5U8mQ4l9c1SbC8HVtt+3W4nBdD+YS0PaEtyL1d4mWc6t1+actsq3+vXAV38Gjsuv10W3x2De/+1dw77TqT8feqh2e0ioXXi0ssiuBlRptlOHVJ08Ju/6dixNi1iTchFYG2SnR0qa3JWEd0c7g= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=Dp3LjM9U; arc=none smtp.client-ip=209.85.208.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="Dp3LjM9U" Received: by mail-lj1-f182.google.com with SMTP id 38308e7fff4ca-2f3f07ac2dcso53528341fa.2 for ; Mon, 02 Sep 2024 20:22:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1725333777; x=1725938577; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=FEeo10BRWPxe0eGwbZzKhWDPMOBcNt8ddVJ+z2RIuvo=; b=Dp3LjM9UOjIUkv/8kkXGXhGStidvvWRemE4BaXDLO+hOPhO96Fl+BNly3STPDgs2sQ dgp3JiXLfg2kaDOYtOGslq2acwO73vE2ErlNSpFzZ2ZsloyjyzXPx93uQ1Dc+cH1s9OO UXpGsbFttr4PepUQkTvsv/yOZDyYjpJijrVqycY62HJVoZWsus0/i74t7P41xwNS4tsJ 1cQlGSC4w3ZO6wB5ZMu8V3IjUukTvWHv4Yris1v8o+92GfgR4geGvA5O6AwP67sbepL8 AAP8J1rTVh1bo853zC1s7qTgE/uJQv6dWSwhggLbCVQpPBq36a9AkBN3gqY9Mv5wL+xn wLKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725333777; x=1725938577; 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=FEeo10BRWPxe0eGwbZzKhWDPMOBcNt8ddVJ+z2RIuvo=; b=cWUXxAfShAeE07mBnNB4M6TUrmEwyEo5Mf8/KoRRenfURpqDvpeBtlnkI5Gal/BwuH jnDMndEbHsWl1mUZk8JsNiQnbYwjfNl4ptfx3/Bc/Fbi4LWi6jzDs09rLOTkONENAjN9 4mis2TLAu5dI/nWcBiBVW+iQC5M2y3zYuK0e1LL0YtV2298QGmPxE3DDaB7dlhkDjC1/ RnzdJb/djpW8eS8lw+A03TamgaTp5LxCnwCz1z1sSwpq21aRThEff/2yIOtwb5Jx7W5R Stn9DWPO1wCvGtN0n5n1mY4ToWQYvDTLXN6EdyvYzkZ2InXi+gkuIRupNR+5uJi3c3Qc 800w== X-Forwarded-Encrypted: i=1; AJvYcCW/ZVx2uLVsZBOTq735LXJYOi8RVAvzPecj8O90V52F8mhDlhl961eSYnjOCFrrbdrMRVOfSn3JJX/p5Mgz@vger.kernel.org X-Gm-Message-State: AOJu0Yz+a5eZyreMwYA7/VIcOSPQuaJspR01QWFSdkMkX9Xmpxq+BpEr bznI0O229l2ZwmEImU5Kq2aw5LFzpqU+XcPRRCcm2lC/4A9AP9nh/sQ5B4ZHA2Q= X-Google-Smtp-Source: AGHT+IGXj0Ycp6Qxb6XPj05g2bVPLU/ugFin4/hG5m/GbsQNUGZJ3yr87dUxf+keCpynMg8xGFEw3Q== X-Received: by 2002:a05:651c:211f:b0:2ef:2016:2637 with SMTP id 38308e7fff4ca-2f610220cccmr116756151fa.0.1725333775771; Mon, 02 Sep 2024 20:22:55 -0700 (PDT) Received: from umbar.lan ([192.130.178.90]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-2f614ed15a5sm21003961fa.8.2024.09.02.20.22.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Sep 2024 20:22:55 -0700 (PDT) From: Dmitry Baryshkov Date: Tue, 03 Sep 2024 06:22:46 +0300 Subject: [PATCH v6 03/15] drm/msm/dpu: check for overflow in _dpu_crtc_setup_lm_bounds() Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240903-dpu-mode-config-width-v6-3-617e1ecc4b7a@linaro.org> References: <20240903-dpu-mode-config-width-v6-0-617e1ecc4b7a@linaro.org> In-Reply-To: <20240903-dpu-mode-config-width-v6-0-617e1ecc4b7a@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.14.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2549; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=pmjRO8yJThNX7l3z3gVUhe1TCXTyBOLqoZGUg4MJPFA=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBm1oELev1LF4GTrHwQWUvET4afCIWSGRpfCbEmI cTdtY7Dt8qJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZtaBCwAKCRCLPIo+Aiko 1dmrB/9PgPcJPUTqwgXdNCCuBaC4ZqEIQTyeXB0DyaSSP1DtibF19sOhD1AUfIXeYBLqT+ScxRn togfAlcziaBjNbHFbhzmoB3AHNohSvaU6OX9UNrKe56JGc8V6sx9cfiGxyX6zspd7qQcDuP9Jgr R7ubXFT4m/apLrrxNT7go6sI4XSzT0L7iVNcMiAxuQmuZUsz1XaB9W9o3x0N0aRL6F5/FVQ3D6s yI1tfTVOuqCMo0o5cDuAtnbqQkIcDp2CHfg7L60Ug4JJACLHix2FzvTMTt02Zbp2DjDSbfFwa0Y J6NBC9Sdj9y7/rwaXxm36F/Gicj3q5q9RIoRhCtsXv9tVc6C X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A 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 e81feb0d67f3..db6c57900781 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) @@ -1189,8 +1195,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 Tue Sep 3 03:22:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 825000 Received: from mail-lj1-f182.google.com (mail-lj1-f182.google.com [209.85.208.182]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 775C91CDFDF for ; Tue, 3 Sep 2024 03:23:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.182 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725333782; cv=none; b=Gh0StgsV6vURa9KgQzj68miFocAG+dNbhKfw7avCf3DoohxL18njQr8geVMoaPrHGgwo83Eodxo4jfx7YVFzSyzYUDzXTlfnjvf6JcNhCqDBRp68EB7FpEC5J+edva96UkK7tBQDG8pG/DPr1BaaNTKy2Z0CRcopZb5bIrhnyh4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725333782; c=relaxed/simple; bh=/gi8zyo7FWjCT4xdT9G2skDFV4BfLSyAVjvvmb1/W1Q=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=eJgN8P0iVfetjU6935Hd2vL3CRWlxoAiiddw9lgPws3k6lc+NlA53fOHMPnigTYtiFDMHzFWzbvRlM6kbMgNGyD8ax3SfOEfmeurq1OEtHB5HMA3nG/Y5/3tJNc71WEULEizb68BFwg0a3nBBWz+3/VBNBCaVfWkQTUjI4j2Ftc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=LGItREw3; arc=none smtp.client-ip=209.85.208.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="LGItREw3" Received: by mail-lj1-f182.google.com with SMTP id 38308e7fff4ca-2f3f90295a9so54275291fa.0 for ; Mon, 02 Sep 2024 20:23:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1725333779; x=1725938579; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=H51nDEtY+afzUBw+OBIFePQrJsO4/hqhDKfTqoHMhGE=; b=LGItREw3mXO9haqDPEuUUsJPgZVOmtcGQ4BPF7xtvAx8eO4jByN6P0bNzIy4+7JEOZ l+hgi3XxIPi5t8/qpfU0yr8yziPfuRufl5trCqhzwXAA81OjNxQ3T2Ecg6KFFyqR+oJG a/HYqYZoY01PczeM+BPk1/ydlvO4A4ZTxKd3bvbUSn2A3UF9wNQjKF6lUv4Yv224zXZn BrkER1AhlsjMR0P2LVnG3IcGq4M2zdOKhG4pCx5XJXXNOikQvBptbu8YpsqiTeYQ9nOa czgGWrqBryFu7H4tiTfSEm9aEt9fJCWGcs80fGQ/1F2JokXY17Hq9PhWHVs9cWusQ0s8 82Wg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725333779; x=1725938579; 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=H51nDEtY+afzUBw+OBIFePQrJsO4/hqhDKfTqoHMhGE=; b=UdKneVR20b3UC2kDWYJ75WnJlETHIs8KudQKBTdxoCyeLMbx12yGyJR8rwoybiJD6/ dQfAxZqkPJ9WaoP3zmkKT6XVbSEt/zmklz7xkv2daWXVUDWKWftwdfSNBQ2h4bZrElNT OAXpCZ+iQpLOv0ZunST5MuVJk762l/XYLmYTzAx07pHKXXt817Lf7tTTz72hs28unGjA en8VUglu4f06x3MzFU4it8M1aTw0V5NIcWL1KIsnb/9jFfyiuNYpRZ1QlEBhH/9ewJYu O6F3Of67HOUyw1t9Rafz5Kvk3ID21WU4UYEotmQV2hY5gqud4a5M6tJ+WkpUgg4DhRlF qyZg== X-Forwarded-Encrypted: i=1; AJvYcCUo39fOR0Gbv9lKvCviNTKI73FyHde373KMCdC/o7q5QUWzVLATBFrMHsZnJEIFav21ZDitDirLZAOKieeq@vger.kernel.org X-Gm-Message-State: AOJu0YzJxb266uDy9lkw7jVKi5H203kQpKHA4/dMWcXQp3XjhvZnJWD+ spjTPxFY6Mdj+qS8YLv+3ZanZHjPhYg1uJ1sUYC3/+dCaxePir7v2shf9tFCVa8= X-Google-Smtp-Source: AGHT+IHvR+jurlZsKzIDNM0asSCNRqANs4oGztcoGqbByKt7wGpQYTBtE+sHgm9pv7JUfTEwHa9CJw== X-Received: by 2002:a05:651c:1a0c:b0:2ef:2ef5:ae98 with SMTP id 38308e7fff4ca-2f636a7fec3mr30331801fa.34.1725333777985; Mon, 02 Sep 2024 20:22:57 -0700 (PDT) Received: from umbar.lan ([192.130.178.90]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-2f614ed15a5sm21003961fa.8.2024.09.02.20.22.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Sep 2024 20:22:57 -0700 (PDT) From: Dmitry Baryshkov Date: Tue, 03 Sep 2024 06:22:49 +0300 Subject: [PATCH v6 06/15] drm/msm/dpu: drop extra aspace checks in dpu_formats Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240903-dpu-mode-config-width-v6-6-617e1ecc4b7a@linaro.org> References: <20240903-dpu-mode-config-width-v6-0-617e1ecc4b7a@linaro.org> In-Reply-To: <20240903-dpu-mode-config-width-v6-0-617e1ecc4b7a@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.14.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1560; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=/gi8zyo7FWjCT4xdT9G2skDFV4BfLSyAVjvvmb1/W1Q=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBm1oEL5SIIxYpAg9zdiK85yFFvln8osR7Wiviq+ zJULHAWC86JATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZtaBCwAKCRCLPIo+Aiko 1SAZB/9JPst8EHWsbRbm4MesqNi8DzrxHHkAE0teXhnyAJlvKBx4hf40U00LS77SDfEsU8r/p+Y yIA1YrHYugT91eLtIgj9+6nHNtLXkx1Lvr6WDPHVxhyp2rL0gYCT35XyZ/M+ejZ3eEhBgMUTeNS hWwXLja1YfIy2gVMbH7dc6Py/V3e3Erg6Zkko9Upksr2MiZ4UK06ukLXzesFxR1BAiKkNvkV4Yq BPyqa6AO/CgwyDPc+KRu/6vkA1K+8gqQ1li9btXT3Thjxcj6kclGdWNM0KM1Depm5xsEabgZNIB 3MfnPj79OThmx9FlyrsQcJ7eaj7Snw3nPon9oG3/5eKchRMI X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A The DPU driver isn't expected to be used without an IOMMU. Thus the aspace will be always present. Not to mention that mdp4/mdp5 drivers call msm_framebuffer_iova() without such checks, as the whole msm_framebuffer layer is expected to support both IOMMU and IOMMU-less configurations. Drop these useless if (aspace) checks. Reviewed-by: Abhinav Kumar 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 Tue Sep 3 03:22:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 824999 Received: from mail-lj1-f179.google.com (mail-lj1-f179.google.com [209.85.208.179]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 275741A4E6B for ; Tue, 3 Sep 2024 03:23:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.179 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725333784; cv=none; b=MpsKYugHS1a1bf9XqQFIY7YdC9AZuh++EJ0KC/N7V9tbfH0rxdjiXNwWxmj7ODBrim60AKIR3beRq7aLD3yMLgdsu/s02NETDZT0gz2OuJXKjVY9dgUox4cz5qx0XF6cAsfC9q1QIbkxBfW+p+QtBha9Pwvz7iXGF1JfIbZklM4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725333784; c=relaxed/simple; bh=WhNMdLAggb/eibU1w9vVgTPCuDUCOFkENzZfVbCfH8I=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=kRVsWpcl8OMn8T/gBtY4e3K+7KhbXGHSRrnaE0lWx5XKX/dRSf9+ThCAlZS8AqjpMYJ89CrnmK5+MKetF5aYPl0YMAQMJBmk9ZdO/jYhCbWaSDjA1ChsZrpFnmFSEaB+tgtuX8vBZRnNwlrFYKkdBCRIJwe60LTy3wsLf/u6d3c= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=arhyNWEu; arc=none smtp.client-ip=209.85.208.179 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="arhyNWEu" Received: by mail-lj1-f179.google.com with SMTP id 38308e7fff4ca-2f3f0a31ab2so55104811fa.0 for ; Mon, 02 Sep 2024 20:23:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1725333780; x=1725938580; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=R3qV8L03p4INw6SLIS9yvfnIJMmwDeBJ05lkHS8t470=; b=arhyNWEu4Jqk03z+gvdW/B4z4wg3IPDGdyNG6v6lM8cGuD+n+mSzjr1GHDxl4mxXKH fSU2cIG+5No61QJF2R9XrtemBFsERNo8WwKcWe2XomPLMwJUmdjxaMTBU2uZ4WVjcHsi 0Ncp5lYYLaQEl/MjJ9FeSFyxssS+LnMN+y1K/emdebWv7ohVWbFyWAm0KYXvf+cprZ2D 1EQ5lHKqPSK3f/oynBkW6OMJqtJfqSaML11KdU6yQi6gCIInF3z+0L/fqH6wWwx9dwwi BS8Ofz1bDEM0WmgGyRVV9HUVxNM/TNRkpgxxD2OVncbmbZY6IQFMCthPLYvmxcec9LRJ zmiA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725333780; x=1725938580; 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=R3qV8L03p4INw6SLIS9yvfnIJMmwDeBJ05lkHS8t470=; b=TWmDihdLwiJS5rb89WFJdmMAN83TwcYWdgi/S3zXXS/YYAs9l/Yg5o0L7pWawKQPQi 6WILXaWxEXU1VxU+CjhNpf0mnHAlQ4gFIIJtJ9JpHCjMz1ygRfn1HMH+r+M22CeP/Aj3 72/2r5ouHOrQhB+U+i+/6uFVn9mSV+kGBlBgTnHwhSVyiBwuxDBApT5tFOell03hOw+o v3K1Wqcc5mqb1HxVDepdtt+mgVZpKtNeW9cbipq0MT7qln8l9xhhIgFG70utjUxaqoWe R3a7wxHh5j0p75n/hUSLZsfnsA7k99f7daBJDQADoeQbBQkncf4JpMcd+FO/3zr3kMe4 LqQQ== X-Forwarded-Encrypted: i=1; AJvYcCV0iyI/3AaHqeHCsMEr13ngAuu1uYacX6YksQ68YoFoRmpSBE7s/EqcKr1XcgCOLXZYC4R+Lu3go5jP1aAC@vger.kernel.org X-Gm-Message-State: AOJu0YxURBuNDZd0xO8GWKJwOhJVvbzq2zeIcQ1eJrxCSBQezHjSzaDe kj/oeelfKBMi9QuL3vTWeL6t53szWV8qHRb8jxPh58xftecdJK9c8DBnFAafZJI= X-Google-Smtp-Source: AGHT+IG+HO5b6Qz94fF9oVVqE7YS8sUB7eYarqOMt4TcLyHXYih282lm5RYr+HbQKmy1EQGdMi/TLQ== X-Received: by 2002:a2e:a99b:0:b0:2f1:59ed:879d with SMTP id 38308e7fff4ca-2f61038cbe8mr120348401fa.1.1725333779260; Mon, 02 Sep 2024 20:22:59 -0700 (PDT) Received: from umbar.lan ([192.130.178.90]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-2f614ed15a5sm21003961fa.8.2024.09.02.20.22.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Sep 2024 20:22:58 -0700 (PDT) From: Dmitry Baryshkov Date: Tue, 03 Sep 2024 06:22:50 +0300 Subject: [PATCH v6 07/15] drm/msm/dpu: drop msm_format from struct dpu_hw_fmt_layout Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240903-dpu-mode-config-width-v6-7-617e1ecc4b7a@linaro.org> References: <20240903-dpu-mode-config-width-v6-0-617e1ecc4b7a@linaro.org> In-Reply-To: <20240903-dpu-mode-config-width-v6-0-617e1ecc4b7a@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.14.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=9657; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=WhNMdLAggb/eibU1w9vVgTPCuDUCOFkENzZfVbCfH8I=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBm1oELd0nAD/K5A3bffo5f0hUsBEMBFcWOaPd4G yKm9oy6gpCJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZtaBCwAKCRCLPIo+Aiko 1f67CACss1F/Wh4m9FutydnGF20c2PN8v5/+I9DXMms47HalNLx8WW8ytC2o0J9R+KEz9/ZY8pm EzHhA1iafUZzlCl57JHWRG5nITJ9IRqmitQ7r047ZwAEzihXVZz+0kBTgmU0Ws8QIj7BakeY7HO RZQEu4h61SG7B283dwCTgADyGglhoEUCWgtO4SwOAv6bp0iYeHAGKOI8zRR1xiMNBI+rNLbT76E 4KQ7s7FNvoez0iB4L2ATsOV+bALzhJX1/+LAKgwc4VdpexhCl678MI2y3LXVVKeVTVLkZMV2f4D tzkeK1yslVrhRP6xor/Ih56oC8dSfia74PtyBBp1M6kfNN2Z X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A 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. Reviewed-by: Abhinav Kumar Signed-off-by: Dmitry Baryshkov --- .../gpu/drm/msm/disp/dpu1/dpu_encoder_phys_wb.c | 31 +++++++--------------- 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, 25 insertions(+), 38 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..c4a16a73bc97 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 @@ -166,10 +166,10 @@ static void dpu_encoder_phys_wb_set_qos(struct dpu_encoder_phys *phys_enc) /** * dpu_encoder_phys_wb_setup_fb - setup output framebuffer * @phys_enc: Pointer to physical encoder - * @fb: Pointer to output framebuffer + * @format: Format of the framebuffer */ static void dpu_encoder_phys_wb_setup_fb(struct dpu_encoder_phys *phys_enc, - struct drm_framebuffer *fb) + const struct msm_format *format) { struct dpu_encoder_phys_wb *wb_enc = to_dpu_encoder_phys_wb(phys_enc); struct dpu_hw_wb *hw_wb; @@ -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, format); 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, format, perf->cdp_cfg[DPU_PERF_CDP_USAGE_NRT].wr_enable); } @@ -318,15 +318,10 @@ static void dpu_encoder_phys_wb_setup( { struct dpu_hw_wb *hw_wb = phys_enc->hw_wb; struct drm_display_mode mode = phys_enc->cached_mode; - struct drm_framebuffer *fb = NULL; struct dpu_encoder_phys_wb *wb_enc = to_dpu_encoder_phys_wb(phys_enc); - struct drm_writeback_job *wb_job; const struct msm_format *format; - const struct msm_format *dpu_fmt; - wb_job = wb_enc->wb_job; format = msm_framebuffer_format(wb_enc->wb_job->fb); - dpu_fmt = mdp_get_format(&phys_enc->dpu_kms->base, format->pixel_format, wb_job->fb->modifier); DPU_DEBUG("[mode_set:%d, \"%s\",%d,%d]\n", hw_wb->idx - WB_0, mode.name, @@ -338,9 +333,9 @@ static void dpu_encoder_phys_wb_setup( dpu_encoder_phys_wb_set_qos(phys_enc); - dpu_encoder_phys_wb_setup_fb(phys_enc, fb); + dpu_encoder_phys_wb_setup_fb(phys_enc, format); - dpu_encoder_helper_phys_setup_cdm(phys_enc, dpu_fmt, CDM_CDWN_OUTPUT_WB); + dpu_encoder_helper_phys_setup_cdm(phys_enc, format, CDM_CDWN_OUTPUT_WB); dpu_encoder_phys_wb_setup_ctl(phys_enc); } @@ -584,14 +579,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 +587,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 Tue Sep 3 03:22:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 824998 Received: from mail-lj1-f171.google.com (mail-lj1-f171.google.com [209.85.208.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 38C061CDA2F for ; Tue, 3 Sep 2024 03:23:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.171 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725333785; cv=none; b=Zpz2GeGjS65YhYKMuqJPKHCBn4fWvSXigGikwQmRWkNs/Jf6/iPlfk7wGfDMqUmd24tDIyvUhOqhdQxdB/tkQ/hnogu18BmIngfmKxBfLArurck7xtL9Nrcowbzw5IVB8tHfGnnkYaLYv67WaSsVnqNDacofSblg7qorFmXMkyg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725333785; c=relaxed/simple; bh=Fbj8uMqodekZoSHu891oRcXYi7bheHJqE14udy7BZ7c=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=WdUsuLUC9ZedrFDW8Q4ogyCVF3yRLzQ9jH/anl/9N21SNzzWvX8X9xoChSmPmgljjdNy3CqepCZRsxnFVLdKoCKvKdWIGoYqXZSD2zqPAdpcBCDKvndkeNdaLeFVE7HSDhY/+jD4cb8ynnDHFDeEtIPSzNWgbFSoMc0DNTEgggQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=oeMNhGJp; arc=none smtp.client-ip=209.85.208.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="oeMNhGJp" Received: by mail-lj1-f171.google.com with SMTP id 38308e7fff4ca-2f51e5f0656so54060521fa.1 for ; Mon, 02 Sep 2024 20:23:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1725333781; x=1725938581; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=3Uo1WJaoJi5l7x5tFLTltWmiX3GtjP7d94O/uZZbrMc=; b=oeMNhGJpQXUDJhdpwrqh+bL2SDtnNcVZ2xCUct4z8bUOtJIpHBRuqDe0eoheTZyP2K lTa11hQfW/PCD1uGk8D04a2jKXe7npQLa3o1OKi69dpVEDZUO55BTMtZfXzQ0BY59zFq zuCyXdS19adnhq3l8/6Q9r4xanPh6KK2T9eyn8p2iM5w3VhlUMgF2DtaWCH6cZlxBb+5 ISwyiAa3kC9O59fe4ZvCGAxWcOyVVvgl6Y2eT/goVEqZsFe3foA75J8kZsXIry3r0fRW BjYGhHcZuSkHtEy/JlS/O2t6Q+wwQY/aqDmBx2LErSR/LBX5YVSEGzf4utNPNSz2/qsT h9Fg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725333781; x=1725938581; 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=3Uo1WJaoJi5l7x5tFLTltWmiX3GtjP7d94O/uZZbrMc=; b=jLxwmqVOke8xRtykTzi8ttINwys0Noba4W52hRhYbf4Kx3xIgl6p/miKsKZJRnZuDR BoVXGMbzp7imYEYgnlVqf9atQMTrM7l1Td8rx0KwPC6SqDbbRhCxGQJB6ii6NE2iz0J5 hpil6v9zEYANVlbg32JlIgayr/O7bOGuHoJg7ZRoXVN0N+WYw+/Gd3prt9yTA7+KkjbA Z4AmRaX1udnatckozPbI07+73DBEs9ErjfsDWLVqW5srySlMBRydFwt3deBSjQKT9WZQ SQhjkX4p0n6pTn0DajGZFVuSxIVdJd9Q3S5XIUFd/tLegW0jx5mNAt1ndVVXj1oJ640k y96w== X-Forwarded-Encrypted: i=1; AJvYcCXYfwucOqepQkJPpH+EPL6oKUgMVSaRU8XJC7/6Ttf1U93XiP22QJWwKSL/PIOR6RFDP0YIGZDkGeeXpohP@vger.kernel.org X-Gm-Message-State: AOJu0YzIblnf3SGXbermr9lr9y4HpgaaMCi7uWJcU1bFPQ8i1PkLl/vk 7EHHIg3UAIT1huLYXe3DlKHzWPgEqVsBrO2FHo7zGlU4pN4ts6KOS9ib3YqqiLE= X-Google-Smtp-Source: AGHT+IFOljbQ3f4QkvdnlpYaQ9zXmZPHExDy7nUsyA0Aa+cGyuQ/SwxvvjywoyhGAqzKJ1hmCWs14w== X-Received: by 2002:a2e:80cc:0:b0:2f0:2a55:8c4a with SMTP id 38308e7fff4ca-2f610552deemr85722471fa.49.1725333780606; Mon, 02 Sep 2024 20:23:00 -0700 (PDT) Received: from umbar.lan ([192.130.178.90]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-2f614ed15a5sm21003961fa.8.2024.09.02.20.23.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Sep 2024 20:23:00 -0700 (PDT) From: Dmitry Baryshkov Date: Tue, 03 Sep 2024 06:22:52 +0300 Subject: [PATCH v6 09/15] drm/msm/dpu: move pitch check to _dpu_format_get_plane_sizes_linear() Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240903-dpu-mode-config-width-v6-9-617e1ecc4b7a@linaro.org> References: <20240903-dpu-mode-config-width-v6-0-617e1ecc4b7a@linaro.org> In-Reply-To: <20240903-dpu-mode-config-width-v6-0-617e1ecc4b7a@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.14.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1833; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=Fbj8uMqodekZoSHu891oRcXYi7bheHJqE14udy7BZ7c=; b=owGbwMvMwMXYbdNlx6SpcZXxtFoSQ9q1Rp4n+5Zq7ts1/Yj/6qMdc0Je2d9tX11T3rx57uYgI 2VpnoNanYzGLAyMXAyyYoosPgUtU2M2JYd92DG1HmYQKxPIFAYuTgGYiOxm9t8sjczprSbVct+i hBWdE6r62N7N0vrqVf1UobRExPvP1R3vpfXM2laLVpV9ORQk0hr47+OPTZmBthdC10tf0dK9O1X wzkRlq7qdsc2OPhHravN86/wuT/+T9Ji38Lm6vIG4wb18/YfXNobV2Kv5Lvjp+S6wJPXhlkOlU3 UjOj6Jx2jqOfxmiNmrnpq5b5uKgtbpffcv5+1+L+798au3SCDb8wbrisvz2gIk10qqzzQoTdB3T TnxfW/IqRNLqlIrDpUv+6K59nAFd3zBe1m+9hNbHtjKO96QD77g+607q9dbP9Gk7U+I8SX1DCdX Pmu10q08uxsSxNxj/i1YbMMQyOFixXdlgdTOB0z2GuYA X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A 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. Reviewed-by: Abhinav Kumar 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 Tue Sep 3 03:22:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 824997 Received: from mail-lf1-f53.google.com (mail-lf1-f53.google.com [209.85.167.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7CA661CDFA5 for ; Tue, 3 Sep 2024 03:23:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725333786; cv=none; b=SaPoNrlDZmIjnEmWIl5Nn+YQRKfE0t+PU9EVpZcJ8huOQlPxyyBpz2zPyu8LEiK/eyErOuToDcLZDtq66/fS4Y/KbSL4ss3T5XXnTT813+iLc4SqLZCe22lYlIKDhZECHkjBOIm2CYeJIRl5kcx7nBYRD53a+h80u6AMFvv0vWg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725333786; c=relaxed/simple; bh=a5YA8kACmUxKYMvgtfD3Fq4LeNyE8luDzWDo6+BmD4A=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=q+XDHNmbBy7xkciPCiOib1EGMBcQwok54DeiSbDl1QYlU9z2PdJam5HWs/V4W8w7fi5TiypiNKxItG3Hajj0XpxhP4abxxCsUGt3UTm6NVLUHeXGd/QjZFSktUo85b1a+vRSXaY7cvuogiWuU6bREMok6wZP27a+vgLQ/INNE/w= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=LFM5PP6V; arc=none smtp.client-ip=209.85.167.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="LFM5PP6V" Received: by mail-lf1-f53.google.com with SMTP id 2adb3069b0e04-533463f6b16so6170211e87.1 for ; Mon, 02 Sep 2024 20:23:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1725333783; x=1725938583; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=NflveyYnYovtLQMxEVFjp15kyCZCViM9R8H2odXJ1rY=; b=LFM5PP6VluudRoXLTbib5aZqd4DtX1gIfHraqyHUV8cGNnvYblwcBZMQIQSnYLqzjQ euWzjjmtrFFcfJuRlbIC0YM+n57OtS6dDcKLY1IyIucKHbkp1xhYGNP/fdGezDoxjfjJ ljqO2tQxjHsqdAYCZv7U3g6Glp/vtIb5STgqUBUmV0WTgbrqws/6cnNgaQ3aF+wc9yfA XCcmGZz8lJ5B1gqxRLctVfFqx1N3QfS6nCzGCLAnUUza9jnrjds2sBuD6GZsnozHj5/r UFwzvIMkSN0r5i1SCPGg0P63yH4E0ikthBgr3Y2vAArQm5Id9cW0QIP+05yq8zyUOCiR 56dA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725333783; x=1725938583; 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=NflveyYnYovtLQMxEVFjp15kyCZCViM9R8H2odXJ1rY=; b=Mkoe4YKeg4iIQDWy036zA1qs/VLzilIdYDkFYGvXQKgmWvbPZYEKNeu87TI7xPAkN2 AuBsCJDw5Q1ev7zu6GCraDD1jty2J93umoW3hqWNHjGLScENfXLsxl392+P3uWuHInA0 5u3/vWFvl1yPwurjAb39xFeTAVZw6Ek12HNRBZkyjl8qLR18OE504U1XFpR5LiqbAex3 dZondnfF3A/87OozH/O+Pkt3aLDK9jCmw6AEIzHx6U3amTQhQMzevWPUaX3QKNUOjTe3 TlKRDBHEtTWqbVeJsWIDXvCEShxqjXfT/QGCzljkk6Y3HsFMOHA51fAR//L3fFElYJHw sGMw== X-Forwarded-Encrypted: i=1; AJvYcCURzzkHuMDUAvDnuRd2tjo6mdyA+4UviPIi4oXJRFsb/6lDziDIsnNXYsxPUm3VT4U13Re3LVGAUVm6lIFI@vger.kernel.org X-Gm-Message-State: AOJu0YyCmI3D5iOdzQ66MMuYr9a1R5UqeAH063rYOZAV/2VlFAq30Z4o j/3kJnBDVIanRIsuIO2WceMekUujFQfzeA6nMeagD+NF2TFsYs13I8k05MSUPok= X-Google-Smtp-Source: AGHT+IHmpDXUO/+323A+Df6iLkPew0fV3iI32Kjgczv5HI9HhabWequ+lZjuah4Bc4penrDsvq/srw== X-Received: by 2002:a2e:b8c1:0:b0:2ee:7a54:3b08 with SMTP id 38308e7fff4ca-2f636a032acmr41569391fa.3.1725333782059; Mon, 02 Sep 2024 20:23:02 -0700 (PDT) Received: from umbar.lan ([192.130.178.90]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-2f614ed15a5sm21003961fa.8.2024.09.02.20.23.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Sep 2024 20:23:01 -0700 (PDT) From: Dmitry Baryshkov Date: Tue, 03 Sep 2024 06:22:54 +0300 Subject: [PATCH v6 11/15] drm/msm/dpu: make dpu_format_populate_addrs return void Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240903-dpu-mode-config-width-v6-11-617e1ecc4b7a@linaro.org> References: <20240903-dpu-mode-config-width-v6-0-617e1ecc4b7a@linaro.org> In-Reply-To: <20240903-dpu-mode-config-width-v6-0-617e1ecc4b7a@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.14.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=6556; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=a5YA8kACmUxKYMvgtfD3Fq4LeNyE8luDzWDo6+BmD4A=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBm1oEM8OcZxI5bpAzLdNY54tTkPNftNTdkiKfh3 lBMJrBGKnCJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZtaBDAAKCRCLPIo+Aiko 1W2uB/wKOAr5v55fqCfpkkEHSiCrgHg+oaUC4J0w0jNenqrAcG69R0J7ITByRh8QGM+zAzHwjup AmdwjnuqH8/BZiaAxc20y3gZBiW3g8yyFee1CfyI+BewRJaAziwnG3jpclJgYT9Sc7dbf3HaSs9 140VEx6iGol1pVGF/VMCiz34Sbd2cxohDGOPIz4q41w04zJWkxaSdyDP7afKKatqeqLFIc/r5Ze CwrGs//dn1cKKHhfHIpta+dOd9fw7rvI249FaUYuMlZdagQpaEZhWrOl77WNBmPOKTpwunrosHb TJoSMKpr7JoPv0qCkkQDWXPOttS/B8081LMuIKRtA1TzMNP1 X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A 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. Reviewed-by: Abhinav Kumar 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 ede926d30285..30d87ff3c227 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 @@ -585,11 +585,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 39ceb7b65318..df95377b98fc 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c @@ -684,17 +684,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 Tue Sep 3 03:22:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 824996 Received: from mail-lj1-f170.google.com (mail-lj1-f170.google.com [209.85.208.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DC6161CE6FD for ; Tue, 3 Sep 2024 03:23:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.170 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725333787; cv=none; b=QY/w2uYTtCCt3P+mXWEoIuKMaF6FkddPHMVa20uWevqR5sizkKna8dtcjBhNaHgkWkaPFoQdntH3WXxTS4HLn6xYOMUNMdZUOWyRIIKx8hZULKMJeiL97VdzvCSLuoO21JCwgVss3thJ21S909ZCEOnKd1mXDtEwvtfPMjMu95U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725333787; c=relaxed/simple; bh=XPsvsitt1q1/pSPR8E1pmuiZ9IMdCJRZ86FgRWBJlZE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=suQA0Uo0O+/Uv+wPxbZb1oRwKbwhu727Pxg9G40evPgy/dcZBJHMvB59Rda0VN2b8mSGqC6QsbvGnQbKIUyTaAYqG5UYa1quR5J+0875ZcdCsDCbVJzqtfsBuqx9SqsMBy0ttPRafYuOzCFFO5+Wcq74lIlvk5o0GdDjGd6qFOs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=QWnNDrPz; arc=none smtp.client-ip=209.85.208.170 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="QWnNDrPz" Received: by mail-lj1-f170.google.com with SMTP id 38308e7fff4ca-2f5064816edso54876241fa.3 for ; Mon, 02 Sep 2024 20:23:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1725333784; x=1725938584; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=nNcyVVvZk5loLiufOoESYV0Fl75NGNrg1mqZRy+YG+o=; b=QWnNDrPzE/fZD4CeEHzpaL+/PgTflDSCJWtIbEW3ggsJAmXpWDAnP8Mm5mRi/VXdZn kUI18sMGOBAKPLuAPX3iqSZXm/1aFMYN0rOP0GVDFFZEw3ReFI+lfm8h6e9ZhFLPyW3B sZ7EKXRSUnMEq9FWGXdSrAbm0NEUItnZKF84wD9w0RlFAL2djSF8mqpsfEuYhMu1zx0z DNvb1KGKUJIF3ixk7wydFHkN5qUFUuiHcaoB7Ad4Z9E8yjJifaOjTIl2AQIaFaZkxwwP 3t+8pkWgegbwl9032w1CUjEIqx53Tr3uOhxGxfdwMKKKShM2KGJf1bhKTXBuDi6zdRsX bZug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725333784; x=1725938584; 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=nNcyVVvZk5loLiufOoESYV0Fl75NGNrg1mqZRy+YG+o=; b=W+DWrM1w2Jhi9Pvqa5dIZRAfe5bLbEB6vYTtsqrE0iNHAG6RytG0WE+eb0mqH2Tq5j raSc6mn8LmCfawSHzMSIscfd1ytpi1kEDfS1Hqc07ynr3A1QTLHKEQfmPpN2kkO4B9oX WbydFNCAZcsEvsyucqvwl2fJ1kISdDTtSzZVQ/fwJ6ufilb62ylzl8OWxeMxNUAwW6+a ZbO+vowXmWnr0U8XJsaNr1E+d4bUZG70i5sxFVvwvyI6p3JmerBXo4o1UcG92kRv2eXt GJbHFNqvU18wuuZNqglzQWLgaMJk+3oa6o3WxqKTEocEuXX38w1FgGUWlUjozzrfJ/lA RicQ== X-Forwarded-Encrypted: i=1; AJvYcCUsaL/3nsPSv9z6sh2blQG/Zj76z3ZFa8XQMq7e+yvS4OfASm8kMMgvRrS/pxZxmmkCoFG7sT/dCv1L9FPP@vger.kernel.org X-Gm-Message-State: AOJu0YyFkmd4YBzAunJ/g1DxkZq4KCLKAVLsWsjY5kEkYpEA8QSEyFQy zrGPumhaOCTlFHKnBuRiIGSuEME4ruV/g3DPQ6aXzP74MpY9FjlQ99vb2b1zIiw= X-Google-Smtp-Source: AGHT+IHOxIlT4SuY36W/z8DrCYweOAxrs+1iXepanIFfvFeHHaelsiCTrgeQYczKg8X0mf/jree25A== X-Received: by 2002:a2e:4609:0:b0:2ef:3126:390d with SMTP id 38308e7fff4ca-2f61054aaf9mr101064971fa.42.1725333783444; Mon, 02 Sep 2024 20:23:03 -0700 (PDT) Received: from umbar.lan ([192.130.178.90]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-2f614ed15a5sm21003961fa.8.2024.09.02.20.23.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Sep 2024 20:23:03 -0700 (PDT) From: Dmitry Baryshkov Date: Tue, 03 Sep 2024 06:22:56 +0300 Subject: [PATCH v6 13/15] drm/msm/dpu: check for the plane pitch overflow Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240903-dpu-mode-config-width-v6-13-617e1ecc4b7a@linaro.org> References: <20240903-dpu-mode-config-width-v6-0-617e1ecc4b7a@linaro.org> In-Reply-To: <20240903-dpu-mode-config-width-v6-0-617e1ecc4b7a@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.14.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1824; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=XPsvsitt1q1/pSPR8E1pmuiZ9IMdCJRZ86FgRWBJlZE=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBm1oEM5yi+wct8hrTlmYoAn+9Ei59ElyUyoj8WD 4JcHT2FZiSJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZtaBDAAKCRCLPIo+Aiko 1aLgB/9+zx1fLDKaiXhu0s2o9e1/WxNm3q+pEqD9GEUvWsZ2ruuv3/us/a2E3sWA1xfeD6j+x6P PLQNgXQUiVsHtPkyyBV/bKHE8vZ8ZsexfiVTqJV1N4VW1lYY3a+Exk1Obtj2kydjkK0q+k6s2LO 2l3WBM7vowl7zwQnqf0sREz/bDPBVaYX5g5gwfmAhiQj8gR+T1HG0eaj4sERZuhiMobz8iS8AFo bNSuD6yLzMdbRjXg4QjmcE1i+mMVlCerTG4J+jkD7QLuioNf6LAgcj4dDdDabBfXx09ez4mCUg6 5m35FR4+pASI75ScJ+7gOFAmUXCU6OX58qU+QfPckcYhmwcD X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A 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 3045bda8a7b7..f686588bf896 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 Tue Sep 3 03:22:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 824995 Received: from mail-lj1-f171.google.com (mail-lj1-f171.google.com [209.85.208.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1CA431CDFAA for ; Tue, 3 Sep 2024 03:23:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.171 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725333788; cv=none; b=bLxCF2UiQs0x3RLxLVU9cnklgQ+h9yRBUIGnujDIQ87NtbRth7fuqlJoIoJ7fXCU57JX6DkGGVq+St2cY+1AQ0ifD6oa0twT/dG0kPmYR7BDn+2S6EBRGOpmFkXPlqxdLeDVLfdtRO72BrBAxvWS6DqO7oG6874j2tZDAom2a60= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725333788; c=relaxed/simple; bh=UDjBz+OwSb+7oXTheaAi3fvbBJbmIDiMCaat2ECDIjs=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=ZIag8I3gEw4+Jdk/aalRdmv0JyvL0j6BqcSIQVfzkh+Ac5JJa8iWXDa1lGwU7VwIRTYoj5h8WLK6JAbKyMe5bctBMQnp3ei6vhwnnDe9j+P8CDhA9LWY4tr//L+r0yZp5P1tuALJwG57aYG1V9BxZkE21F6rrWPtVDhPcDBQSZ0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=bMCxVmh9; arc=none smtp.client-ip=209.85.208.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="bMCxVmh9" Received: by mail-lj1-f171.google.com with SMTP id 38308e7fff4ca-2f50f1d864fso55370581fa.1 for ; Mon, 02 Sep 2024 20:23:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1725333785; x=1725938585; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=TdplmJxptUI5vC4a8O6uUv9gCPQGqO+K3YZJZ67p41c=; b=bMCxVmh9MgSnrdnIfhZgVPWTsUbM8Sc3B69Wv1ycgDM+bQZOSlX2fnRulBV+VPUTXh O1whAszAQd56QMyBkwRyVTekmHOd/K3PUs+FuDsavUfc5dZCSfO7fEm7ryK1IBvARs5L nQmMyLRq9KYt3EADWUOyRvykw13FP8O7LblgQFSxLZTlP9L6jcvhNHRwK5Td/FrwdWrH D9NA6JuhmS98uVyg94pxkYY0/ft+EFO/XcUaxZRfusLROolHbXYfwsTJuaJ98VOdZcmX aXzfdugppzJVl/KUB9yTNWP3WyEgAN56WDZCZmKs6vJrUyYPWZDdCJDyMW9NyTuke5Od 3JdQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725333785; x=1725938585; 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=TdplmJxptUI5vC4a8O6uUv9gCPQGqO+K3YZJZ67p41c=; b=LNN5/PQwWhlzWPqaFWd8jQ07UdzVCHXS4yXKH8YSOVPfJ1+aHag+zkpb7YBLNGXWAi h0soGOHodeQUd1te0bz9PLUXqpJgmOBlQWUI2/FC+EKsyDyiVlM6Zhyok/aTMEGc6BZq ILHlikFPwI9VkMC8q1+eCtL2YaQFujn3SHO0Se5rUl+RdByN9jVQU8op6KIdgg2Di9ZV Tt4GYR+9ZQtUK6jHKyANBnGVPTfKDuOI6qDOO8ZSTZZNo8QwWhdendr0Vi732V+4eNk3 o/zfwnPxCMAzU3TmnEnzLSv4F5qfUK4BnUoO5bDQpxk6ccl362kSmR6MHq07jAcFBK43 TKeA== X-Forwarded-Encrypted: i=1; AJvYcCVpvd/+7amHBk0q1TVeEBsOYyZ2+i27aLLGSQ2dNSgev6iovmXYqPjhmi407jJG5LhwjB/LZOVq8VMrkmEa@vger.kernel.org X-Gm-Message-State: AOJu0Yyyk1mQb6r7uqa4UA9FI6Km8ZA4xVjAtvXttYh5DdHEJLXUBJdF qXu34x0ZQ76AgyQFCjLZYa3VKzzdogWfMGsW3iDlInVXWFWvtZp7T3PW0/BzbZk= X-Google-Smtp-Source: AGHT+IEOgwK1uzPezT8AfH6qRHEtNuFp5jh6ed6Oxbz/+Ff0gSLazpkDyq2/79FYkyfQ5VYW0A6ORA== X-Received: by 2002:a2e:a54f:0:b0:2f3:f068:b107 with SMTP id 38308e7fff4ca-2f62dc25bfbmr60611641fa.40.1725333784770; Mon, 02 Sep 2024 20:23:04 -0700 (PDT) Received: from umbar.lan ([192.130.178.90]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-2f614ed15a5sm21003961fa.8.2024.09.02.20.23.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Sep 2024 20:23:04 -0700 (PDT) From: Dmitry Baryshkov Date: Tue, 03 Sep 2024 06:22:58 +0300 Subject: [PATCH v6 15/15] drm/msm/dpu: sync mode_config limits to the FB limits in dpu_plane.c Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240903-dpu-mode-config-width-v6-15-617e1ecc4b7a@linaro.org> References: <20240903-dpu-mode-config-width-v6-0-617e1ecc4b7a@linaro.org> In-Reply-To: <20240903-dpu-mode-config-width-v6-0-617e1ecc4b7a@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.14.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2539; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=UDjBz+OwSb+7oXTheaAi3fvbBJbmIDiMCaat2ECDIjs=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBm1oENYwMah92zPW3oip3MLKiZnIUYlUa1xd+3t /kh6S7kh0+JATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZtaBDQAKCRCLPIo+Aiko 1cilCACqQ65UqNGu66yj8Yc5UtNC4Bxr5eciWwcxSeEPiNBcvfgPl6Z/KH0YARNLuYG3fmD6KlW wAgWGaQj30qYfW9QlswHwi6fZuKIeEgyPlAbh7EdYng5U/RtXh8CkZ/7ypJrA74SNcxeRNsNYBD Dm/6c+To2HvdKqwrSFjmIipYV/BP8MBa+yEMBqk8QQ1mD3Ypydo8qVht1lu0f6/usIxo3fUjG7K TBvASFRwvgP8id0dUeerPnDPOqcbHiMYimEjrv9Iyd9EOvGWSPw9WD83HflHZURv12dXgSw2EOr DwIf1EXXOTm29dCsQcc7HoniYrAM2OIIPzCfygu5IhQn1TME X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A 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 | 14 ++++++++++++++ drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 9 ++------- 2 files changed, 16 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 db6c57900781..58595dcc3889 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c @@ -1230,6 +1230,19 @@ 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 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); @@ -1445,6 +1458,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 daa42f289d2e..7083baf7d5ce 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c @@ -1201,13 +1201,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 */