From patchwork Thu Jun 13 22:36:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13697561 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 EF66FC27C4F for ; Thu, 13 Jun 2024 22:36:30 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id DEDB510EBE4; Thu, 13 Jun 2024 22:36:29 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="lnT6vuIX"; dkim-atps=neutral Received: from mail-lj1-f175.google.com (mail-lj1-f175.google.com [209.85.208.175]) by gabe.freedesktop.org (Postfix) with ESMTPS id 8ECA510EBE3 for ; Thu, 13 Jun 2024 22:36:26 +0000 (UTC) Received: by mail-lj1-f175.google.com with SMTP id 38308e7fff4ca-2ec002caeb3so19990611fa.2 for ; Thu, 13 Jun 2024 15:36:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1718318184; x=1718922984; 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=d7jMEkdSEDz299yHKQKIQ1jrFL+ApUnOqabXFYC3R64=; b=lnT6vuIXwL5eWniLMeEAdo7xiVLvQ492NRnoCda0wY01p8L3KkXKLeKhNNramlL6br GuM/MGMBrfKsf7F4akUdRjX/cxgDmyaYBkoHx/eYR9GKkGkm47+wv6zQJxtNdLuNaXun 8JF2k6l1qGlhKsYvxl/XL2lC4PJRTHI5kR0wquJayZkPmOrD4EOTnmGU4tBHN1w4eIUD mRhqGXkc27W+eCWEpK8yenHyy+lsXk8VX9XpnbAjqELT//9ed66DQubs6PFUHskO704k 9q5972SwkgnAahDcZpxjYI23iyqrD5rd+dpWQ73JDZIEMI7n8KXI7KCo8B5Q7+o6lm72 V36Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718318184; x=1718922984; 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=d7jMEkdSEDz299yHKQKIQ1jrFL+ApUnOqabXFYC3R64=; b=xJ1ZFLJobhGizTDrxBhJPV4vSBRWyu9rywvYZBns6xCEF8gBDXtGsxwPtD5YPIBiFh HBehYrDKu+3ZBjjnNf3voBBMMm5nu6QGElm7pW6WbxoPW05NKRK6autRV+kKo6f8vXRO 5LfeNpvKfC6qvp098y8VvxEia3hrLaFzwwpaDtAWMdw+seYBVK8hn261cZeUzUAYDKS6 btjZRJ1KnjqvwinZGgOBHWWinPonW1aQMTWkI6QRck1ZXA1uKCtwKVU7/sC9YhEC+LDo KrkJwVQ9CAQnMF/eUogoqAQPHFP4FmnB/9x7kfIV21pJ1Uc71+6W3A1HxqA121nuhh55 Z7WQ== X-Forwarded-Encrypted: i=1; AJvYcCWFJPRT5dffXNQ1phPUX+9UDGJvDA0OGKk7NrpXJqT14apPaXBJVzSU0kvxurMTjjKnyl1iI04K963ICpFiEynBLyAlXOMFLN/300AJDjxn X-Gm-Message-State: AOJu0YwEhGHb2FCj5YKMVjTpB9QcKqzTijMhwgHHRbQuVkFnlvaxdq4A Mpy+A0HUGdm+if4l3rBlWlf3ee+6tscqzKmgcvDs5TAd+Aaw6k2UQ7jJzg6GTbE= X-Google-Smtp-Source: AGHT+IFgPLu1htnP2BmoSQebGt9vmn8eoCydTJyPqNrbYznyW63TchUlHfy0rHpjJiXh+A/1b1oLlQ== X-Received: by 2002:a2e:7018:0:b0:2ea:e56c:f898 with SMTP id 38308e7fff4ca-2ec0e600462mr6546041fa.33.1718318184487; Thu, 13 Jun 2024 15:36:24 -0700 (PDT) Received: from umbar.lan ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-2ec05c04a08sm3865191fa.29.2024.06.13.15.36.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Jun 2024 15:36:24 -0700 (PDT) From: Dmitry Baryshkov Date: Fri, 14 Jun 2024 01:36:02 +0300 Subject: [PATCH v3 1/9] drm/msm/dpu: check for overflow in _dpu_crtc_setup_lm_bounds() MIME-Version: 1.0 Message-Id: <20240614-dpu-mode-config-width-v3-1-29ec4069c99b@linaro.org> References: <20240614-dpu-mode-config-width-v3-0-29ec4069c99b@linaro.org> In-Reply-To: <20240614-dpu-mode-config-width-v3-0-29ec4069c99b@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 X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2430; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=k5AxVBAg751483RoZdOy+nlKC8NcuvgV+fnhcffv2Yw=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBma3RlW49OCTPpG27+0A2iHGeKFky/sqczxDH6O H6UZukjW32JATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZmt0ZQAKCRCLPIo+Aiko 1UlbB/99EudEEatLMPGrK0OVB23kjtre2i0vranT3Ug9A2So+6arY6Mc+OqDNo1nh0tbLgH6Iuq bzI8z4a9F3qBS2SXWbWXWacjMsA2L7Ot9qMVc9Y222EIsFho8e8jZBG0L+7bQ0VCeemUt0TNab0 jNW7LlCCXNxDYngjhj2WOKdwYB1hgKn02eLQOelFo+184NQWQNV752fbxRHT5DQp76fq+8AaHEp w1bLZ+RERCUt6ZhWeNFWJfdfdysa5mneSQl66WG5M1mf8hhR6nyQZ9dRRjPaIm5PxAdUqQBa45O Y2GH1SEPDeEXMDXr7Y6RWjRHCTDK58hY/gM6ugOYJv8eg1oz 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") Signed-off-by: Dmitry Baryshkov Reviewed-by: Abhinav Kumar Tested-by: Abhinav Kumar # sc7280 --- 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 9f2164782844..b0d81e8ea765 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) @@ -1197,8 +1203,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 Thu Jun 13 22:36:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13697562 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 08FC3C27C79 for ; Thu, 13 Jun 2024 22:36:36 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1800E10EBE6; Thu, 13 Jun 2024 22:36:30 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="rQZWTuqI"; dkim-atps=neutral Received: from mail-lj1-f172.google.com (mail-lj1-f172.google.com [209.85.208.172]) by gabe.freedesktop.org (Postfix) with ESMTPS id 6499E10EBE0 for ; Thu, 13 Jun 2024 22:36:27 +0000 (UTC) Received: by mail-lj1-f172.google.com with SMTP id 38308e7fff4ca-2ec002caeb3so19990731fa.2 for ; Thu, 13 Jun 2024 15:36:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1718318185; x=1718922985; 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=Axn0CffF4ZXu41BfYhRYHrbH241ZyeeHoXr5qagjCJ0=; b=rQZWTuqIGmCu4DtmtMFg/+PC0cNMJAXaNtlSadGbCPZndCRQKywYRNIKxBNgvMWf+J tBYIB1yzTvsUzeIIpm2eqemQKbR+EnFb0n9tpfHwpBsjzogejbvFbPn0oByw17CBGZi/ uINFeT4tged9tBkMy3jmGjnyYSl1H1FZtWvVX+g1qrsF2NAhlD55bhw3HJReAqZjR6/3 eH7QD0ynqMxK4ynFewJI9fqp5iJWcG7dopq1jOkcQ7ue6kWHlQD7BuwQ8ZufGBym+n5p 9BmsvWvKGZyDew1sy0UFjP0XkyaimMVwrUVwIPhrLkXAITOzYJVptQ1oUHJYHeRxBDb5 leyg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718318185; x=1718922985; 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=Axn0CffF4ZXu41BfYhRYHrbH241ZyeeHoXr5qagjCJ0=; b=JzkGwRrpbBrUU3flvhONsqCKBsAUCGYgubCRlzg5G2lTI4aK7KhTq8ixM/NUnVM29s s34edn5MHaRwpGHGWFt8Bi+6yKz1KEB1AhkhiuTWZ2CyoSWu2L16EPryDXUkt0OrsL4s PgNrJ8b7m9fqbQefx5UslXzVv+s/UprnRcCodPbQhiV9VZNOqX/4zVjCadwzAQSXPTKe 0hDWSm4w2iYS0itSVUznLn6NXnXSjf5mo11Kes7kXrHKBdIb9vlHKObapaK12r09DRJ0 y+LaKoTgYDU2A/ffVZzoCGNhDXFpQee0zbucT36QnMNs7sTBireHv8yc0p7YnDSi0GXm OY6Q== X-Forwarded-Encrypted: i=1; AJvYcCXNM0svAgpLcbpkVGLL81HCj12d+O5cFIE8BX2ncnlwwNQ+j+ziPtLPnrHH2EJ8/2MxHuflJJzlG1kNWyb9YMj3Ck7JhNzL/ouL1+A6pf3I X-Gm-Message-State: AOJu0YxhPy+od2tRMQNMcl+ggC/SI3pyu1yEFcj1JilVO6KlWMvU+SOY A7Eva39KvKtCc49EZ9kNv6gj1fNv/EYV+tao0ivPi8xJVKISY7uN94AMLJz/ONbtGYivV92mR/z UzCk= X-Google-Smtp-Source: AGHT+IHCGXVz8lmVwtJZmyRAiRUNsUm7GaCgW5618J6o8Zn/pXZpXzZ1TjoxBsWQRycODYBBi47/xw== X-Received: by 2002:a2e:9616:0:b0:2eb:e9cf:e179 with SMTP id 38308e7fff4ca-2ec0e5c6d69mr6125901fa.21.1718318185457; Thu, 13 Jun 2024 15:36:25 -0700 (PDT) Received: from umbar.lan ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-2ec05c04a08sm3865191fa.29.2024.06.13.15.36.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Jun 2024 15:36:24 -0700 (PDT) From: Dmitry Baryshkov Date: Fri, 14 Jun 2024 01:36:03 +0300 Subject: [PATCH v3 2/9] drm/msm/dpu: drop dpu_format_check_modified_format MIME-Version: 1.0 Message-Id: <20240614-dpu-mode-config-width-v3-2-29ec4069c99b@linaro.org> References: <20240614-dpu-mode-config-width-v3-0-29ec4069c99b@linaro.org> In-Reply-To: <20240614-dpu-mode-config-width-v3-0-29ec4069c99b@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 X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=4184; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=nHy/s501BKISDY/viUTlwbtLfmlHRF5tf45zr5mVRjI=; b=owGbwMvMwMXYbdNlx6SpcZXxtFoSQ1p2SeoUzS7VA35Cp89zJVTt+ZD8z7O1juXDftnApI/bX eW++md2MhqzMDByMciKKbL4FLRMjdmUHPZhx9R6mEGsTCBTGLg4BWAiHvrs/ysj3u5LEqiNfz+x iuOSbs72sOTtluXJK68G7ujcyZx/+8Xsvtdhyvuvb+a5UqX9fv3zfhvX4EVtzu+U7DVqoq6kfZJ hv290TN5dxPWNo3n3fi2t+QXc96NPPt2/Psxd9tJCr0MZy9dcOrRBeum7r5Mqn1lVutd5SqXfL2 J6/fdb4esIFW43rve1LewT6+VnHj7QdXGWWvU0Wz3VWr0L9r4ZdRc0N8m9Sv3q0qUho/B+nUHc4 w6W70r3ttTv/j5/hgj3/rd8Yc33yiWTbu53cK842srBc9Fjy14293Kx+u/+z95KeJ28d3Jdfb7Q yQ8ShgE8Ly+2y8g9/8lrvkbqZ9w5L9GijkPdaodbxSITAA== 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. Signed-off-by: Dmitry Baryshkov Reviewed-by: Abhinav Kumar Tested-by: Abhinav Kumar # sc7280 --- 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 1955848b1b78..0d1dcc94455c 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c @@ -981,7 +981,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 Thu Jun 13 22:36:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13697567 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 C2031C27C4F for ; Thu, 13 Jun 2024 22:36:46 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id F3AC610EBEE; Thu, 13 Jun 2024 22:36:35 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="MXEiI+zu"; dkim-atps=neutral Received: from mail-lj1-f171.google.com (mail-lj1-f171.google.com [209.85.208.171]) by gabe.freedesktop.org (Postfix) with ESMTPS id 20A2E10EBE0 for ; Thu, 13 Jun 2024 22:36:28 +0000 (UTC) Received: by mail-lj1-f171.google.com with SMTP id 38308e7fff4ca-2ebed33cb65so16296691fa.2 for ; Thu, 13 Jun 2024 15:36:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1718318186; x=1718922986; 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=0oXOVdRHNNnObgLlS+JRiMGauu/PqHbIdd79rxd9IUg=; b=MXEiI+zuLLU0aQpHusmE3iG2nHLVI3fGx9tnB4ONT6qAUd3kq6cNKZL99uy6UPLwRF UFtHPS2rP21Su1+Sf8umrxnFa8yn2IzI5vvLoNCDtSb12oKpji7rYQ/PRgbMkby/NL43 9BjomWFh+ug6Vg49E4nedAQKuty4WuG5d/bpVNIzbZny27A6RR9Eme20dckX3BiNdW2W ZLBkjfgFxiTL8AOpnqWW3yVQkQK0Rke2bBpg1XHzds1IIW1MrQ9xiIdXruGHwPr4X6l/ 0CL0qM2mKfjkqlrw9Yq7HBqi8V5m5u0TiiTVR3WFAYFb7YOPtczNdAsatVRiPDQTn5CE 9JSg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718318186; x=1718922986; 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=0oXOVdRHNNnObgLlS+JRiMGauu/PqHbIdd79rxd9IUg=; b=BEfvQkMI1UzLoC/4BUlq0KzAv0anIU8cyBfNIkKfDfq/iMxu3fgW6PkMGnKT9xZsEq QmxgLN7tGZ8De5ZCfKQ37r/kDeHVep9HFk4qzC/gwCo79eBfdOk2qjFq5Wog/YjcVGf3 z0rh3ezhlx/WMuy9/XrTSUTyvqFL5wys4wU1gtjXV54bvSDBmyMKyQSvG1UFSdHVl7Og MYdsR6qUviXckQyLsMPyLC4ECysYwjQbCxAeAOy1TkBGSZrlxLIxAoz/sQ39P/ZStrVN pYsTSe1FrJm88rVZ4XLRF3xgRHzzRhxQ7a/ozEeppFkmFokEOh0LLMtwpcLSjA/pnkcj JOjQ== X-Forwarded-Encrypted: i=1; AJvYcCUpb+51524r9yyv2ChBdSTfREdqnxPBz/MmrY5yqrMjb+X1uSAYmdsZi/fmUhKKUrBQ/iBCZdC36XCtFGf17qcAbxL/l19Ex9Q6nLAmhSu/ X-Gm-Message-State: AOJu0Yyxz+JYkF7+3NtkelFYnDsnMhIdxmQLntd9JkGEOpfRXpESixzO 2PkEElP6bHxztqwNJ5GbsaMZbK0tynUwPjVFiDdPJhFlx1xJ9OKnUq5ovF+ZHoY= X-Google-Smtp-Source: AGHT+IGInrYLWQtlrQXLhQ4Fn4kMM+TkC/CKnLcZaun/7ZLsRJVyvJLpQDWNJbCrFaCALcESKJUw9w== X-Received: by 2002:a2e:9b4b:0:b0:2eb:fded:a5c6 with SMTP id 38308e7fff4ca-2ec0e5abf16mr6549171fa.51.1718318186257; Thu, 13 Jun 2024 15:36:26 -0700 (PDT) Received: from umbar.lan ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-2ec05c04a08sm3865191fa.29.2024.06.13.15.36.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Jun 2024 15:36:25 -0700 (PDT) From: Dmitry Baryshkov Date: Fri, 14 Jun 2024 01:36:04 +0300 Subject: [PATCH v3 3/9] drm/msm/dpu: drop dpu_format_populate_layout from dpu_plane_sspp_atomic_update MIME-Version: 1.0 Message-Id: <20240614-dpu-mode-config-width-v3-3-29ec4069c99b@linaro.org> References: <20240614-dpu-mode-config-width-v3-0-29ec4069c99b@linaro.org> In-Reply-To: <20240614-dpu-mode-config-width-v3-0-29ec4069c99b@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 X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=3293; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=b8kT7uNMoxyE9AV8a51TAAbK8IFnReILBdf2NuP/B5g=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBma3RlQ4b4UFtQ4hs13DaK5VdWZWyeacZvvgTSI rmJHgwS0xeJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZmt0ZQAKCRCLPIo+Aiko 1WqmCAChOYvOsWwRTgWuhRjG3petU3qQ51O4u5DNklC8Hq8IHtZ+fSuxnCiwdPdx7vWnSgqE+VX 6LR9REmrxxt/uT+IrRUXNW8kReqN39GWOEG5prNQCXsIEKkiOIlfEnRVo9xp+hVKhpTbEO0egji auEjWflaqOQRkUq7HhCo3i5cfRPSRMhVewDvKndHSc9qEtCQpsWPPLOmv6/JdixnVbCEuWm3gWD Jnd7ShmuETOgQnzEzepbG54Cl0sgI29P8BYv+evqMKGx9Z2JLOaRAgt5M5/EsZcYG5cw+a/X/ba 3GoliQbr8iURjjzbRMtiZDcBPWA5c/xB5bzdp2D9K7F9/jln 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 Signed-off-by: Dmitry Baryshkov Tested-by: Abhinav Kumar # sc7280 --- 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 1c3a2657450c..9ee178a09a3b 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); return ret; @@ -1100,17 +1100,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; @@ -1125,12 +1114,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 Thu Jun 13 22:36:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13697563 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 65C15C27C4F for ; Thu, 13 Jun 2024 22:36:41 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4AC1D10EBE9; Thu, 13 Jun 2024 22:36:32 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="Ej9Yp1jK"; dkim-atps=neutral Received: from mail-lj1-f169.google.com (mail-lj1-f169.google.com [209.85.208.169]) by gabe.freedesktop.org (Postfix) with ESMTPS id 27E2210EBE3 for ; Thu, 13 Jun 2024 22:36:29 +0000 (UTC) Received: by mail-lj1-f169.google.com with SMTP id 38308e7fff4ca-2ebec2f11b7so15087071fa.2 for ; Thu, 13 Jun 2024 15:36:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1718318187; x=1718922987; 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=XPP7TmA+2loPDbWoPi/CAkxj5Sf30vQLf/NX5YqEivU=; b=Ej9Yp1jKRCWFKYfxgwWgK2oKi3Pngu/Kr9fnXHbCyT13EdxQMb+8PceCRRvTOXCXaX JATaQxYsnRvB5Ihok/Ishq0r/ONY5ffLv9H0k6ncMfPEvzZfJk837KZaOZ3XPEOsNkOO 34EzG1lIG/6lGM3r8FlqcGhPQ6htF3Smj/1Z4Ohta97jWZNojx02E3C6XZwQkORSoaPd tbrgY+3CWp16iYAcYW3FmAT4BfuxsmBbXj4SV2LT++yveAuS8ze83oVjnF2iiz0HJFOI bbC9Wt/qoTx20t+sQ/IHvPL4cl8Q8U7EGIgzEyCst9VOAuzbHKfVLKw/Cg3ce7OKe+xn Ty+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718318187; x=1718922987; 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=XPP7TmA+2loPDbWoPi/CAkxj5Sf30vQLf/NX5YqEivU=; b=atuqd2yoq2aucp+x7HDjpt5sT6nvemlQxuzEjTgb/5fvCnGWFbaQzOcoaUUGQCKG3L 3WQsJ4Ktrf0uSlE0h4YdfzfBuSFdVoiwS2Rlv8tInNYfEGFQZqezHIE45xC4nZC3FJOu oYytizD7igcEF2YCpaj/X+BiFTcm6XbFuSWENuHmV1T75ixTbEwA+ngco81YKV4HFkhu VwuMyocdahz7e6gzeYs353f1xUgLcRwGfqOuZVCCCFQ47UkoOsMELjyImOMGKcTqEEBP sAjylmB4V8E1pZ0h8/F37RRWK/lO63jkI8HYgdqHOsHWCZSsKK0DiLrjAi2dNhLL7yoI W6Qg== X-Forwarded-Encrypted: i=1; AJvYcCVXRdTfJ80vltCA4bY83iJQ72BjwSavB74XXRVkjZGzE23V5nr/QFGKiq7DXdVWgJEoG1fFiltOuILlZ2dljhradiehv1LtL4axCP2Eaz2Q X-Gm-Message-State: AOJu0Yx0sXk9A5ysyBObWdu9DVzPfIVQqSrt6Ks12qN+LsTIZeK894Di bfBPv2w4VI9FSnprGYorAd1rDNBVedjfSE3d0DW4D9qJA+6GS8fAVsy3s7G8miI= X-Google-Smtp-Source: AGHT+IEtT1RLQLYQZhL+kRkUTG5moJCCd6vMBf0jLsTImrnkqPzggwnP+12Nd0OXVqD3k7ThUoYiFw== X-Received: by 2002:a2e:83d0:0:b0:2ea:eb13:daca with SMTP id 38308e7fff4ca-2ec0e60dd22mr5816261fa.47.1718318187184; Thu, 13 Jun 2024 15:36:27 -0700 (PDT) Received: from umbar.lan ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-2ec05c04a08sm3865191fa.29.2024.06.13.15.36.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Jun 2024 15:36:26 -0700 (PDT) From: Dmitry Baryshkov Date: Fri, 14 Jun 2024 01:36:05 +0300 Subject: [PATCH v3 4/9] drm/msm/dpu: split dpu_format_populate_layout MIME-Version: 1.0 Message-Id: <20240614-dpu-mode-config-width-v3-4-29ec4069c99b@linaro.org> References: <20240614-dpu-mode-config-width-v3-0-29ec4069c99b@linaro.org> In-Reply-To: <20240614-dpu-mode-config-width-v3-0-29ec4069c99b@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 X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=6568; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=jDftnbrj2pWC+/GjrBG3nHnjwOHiP63BF0nUNAmtu+4=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBma3RmjY/PFvNS4jwP40VqiySiYmQITbsp0JjkT XzQwQFCvfmJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZmt0ZgAKCRCLPIo+Aiko 1f9VB/0cD+Oy7iGotBJW/a078s2OPWlUbQui2XcomeWReIsh/EgWCThXXiHCksSbsYu7Y2yqwSr k7zl6Yjpx1nAHgFkwmrfG+4dCSojD0K//YXGym+Iku/AiPhrOXG/fa8Bf6cvX+gwfMIAaDCCwKk W0YaD4tXz2chXn0KYWNh9NG28qBtPAtm3nR1p1x3CqO8PseNFZledXEDLbJCF5DYeLglm4uJyoI d2X45Ii5xSwxEBTqQt2C254gxEM6j8ZGKTHW6sius1jO0h3HV60FVEOxbfbJtZw+7gYgTwVQR/w 3uKV3Qvy06WXwElWb9jyztUemc0v1kk6VdUsGpkF0sND8r0N 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 Signed-off-by: Dmitry Baryshkov Tested-by: Abhinav Kumar # sc7280 --- .../gpu/drm/msm/disp/dpu1/dpu_encoder_phys_wb.c | 8 +++- drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c | 45 ++++++++++++---------- drivers/gpu/drm/msm/disp/dpu1/dpu_formats.h | 8 +++- drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c | 12 ++++-- 4 files changed, 46 insertions(+), 27 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 d3ea91c1d7d2..ccf2d030cf20 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 return; } - 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 027eb5ecff08..c6485cb6f1d2 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, const uint32_t width, const uint32_t height, @@ -172,7 +172,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, const uint32_t width, const uint32_t height, @@ -244,27 +244,38 @@ static int _dpu_format_get_plane_sizes_linear( return 0; } -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) +/* + * 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; } - 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; } + fmt = msm_framebuffer_format(fb); + 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_populate_plane_sizes_ubwc(fmt, fb->width, fb->height, layout); - return _dpu_format_get_plane_sizes_linear(fmt, w, h, layout, pitches); + return _dpu_format_populate_plane_sizes_linear(fmt, fb->width, fb->height, + layout, fb->pitches); } static int _dpu_format_populate_addrs_ubwc( @@ -388,7 +399,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) @@ -406,14 +417,6 @@ int dpu_format_populate_layout( return -ERANGE; } - layout->format = msm_framebuffer_format(fb); - - /* Populate the plane sizes etc via get_format */ - ret = dpu_format_get_plane_sizes(layout->format, 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)) 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 9ee178a09a3b..a57853ac70b1 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c @@ -674,10 +674,16 @@ 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); + 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); return ret; From patchwork Thu Jun 13 22:36:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13697566 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 2F239C27C75 for ; Thu, 13 Jun 2024 22:36:45 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 779B810EBE8; Thu, 13 Jun 2024 22:36:34 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="TMiZRiPV"; dkim-atps=neutral Received: from mail-lj1-f175.google.com (mail-lj1-f175.google.com [209.85.208.175]) by gabe.freedesktop.org (Postfix) with ESMTPS id AB15710EBE3 for ; Thu, 13 Jun 2024 22:36:29 +0000 (UTC) Received: by mail-lj1-f175.google.com with SMTP id 38308e7fff4ca-2ebe785b234so14693401fa.1 for ; Thu, 13 Jun 2024 15:36:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1718318188; x=1718922988; 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=+uEsmC6Fs93CtWuR8khej7lWUC750pqp8djwlJQOosQ=; b=TMiZRiPVTcQ2imvN1JKbv2CByXm7BNw7C2ovxjRibfYKg6h7ZWBnJmfveaF9iyIeEa HGeq4iKZH5ospIsOq8jZBFkeQqR6loPK7xoU9G4/ocPmZ1GDhDhKrb8OhNr47rC9qZq6 35UFF8vdG/IvaEdqAF0x4jbngfzVau0llc8zI+dY/s8QDgd6C+BPhoFB7Di3jmkfzARA Gfs0l6/4b7Uk9ti/6utQfxfqGtd5XDYP6L4/z0kIssTPLV55qfXOrXJmV7rA74Llb6+c 96hU0wIXDOO3WMaJv0CXG3aapEkg5P96nG5LmgoIi8rFyJw6513jYAhbDNf66iu4mIHp GYEQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718318188; x=1718922988; 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=+uEsmC6Fs93CtWuR8khej7lWUC750pqp8djwlJQOosQ=; b=VKixzBZNdaSfD8RhY2UR8vo51qhETuDRu8i9ALH6rlN+qBrROrxYYMp5Xz22vIyjCQ opJQKkMMN9THm3RAymqnwIrQAZhohJrG1v/Y2WZQ5E+gaQOVqrU0OkQWQntXU+tCAYzF lGwfZnpIQExPdNwZRiWu983389U36uNonL7lourvNakgKULQ+ujDQjAdbq05z05Dbp+7 EuRB+TaAfFdbwVlGkVPfmj43aywfKzrvPFsHFdFZfj6EFMzNysFqnJVqzC2K34bUgNq1 M/vlfoq3wZakZBK3mII5Y+KI7pvYwf6IsSbKTOF1zOBA7sEiKU6KCirYJ24NzLShI6JR m8ZA== X-Forwarded-Encrypted: i=1; AJvYcCUE00hN23PF8q3ylvlXj2CIdFtqZLTmw1EdJsOCo+NPtuqeBlVfwnrWTD2SHQtBRC51jnCW1j9Rx3EmayrykHCInVfszgb2u5AvUHbkTRSj X-Gm-Message-State: AOJu0YzHIsWEoTqfJBR1tLGlaArG4aJJi2jYZF33yS1ue1LkYAejdLEf xS9dKl55cgoGoogDpQ9Hj6ripkOAN6mE4L4YrXW3XK2Zmfk60Qb5/Zpecb9G1O8= X-Google-Smtp-Source: AGHT+IGFssZf/ZlI4LKs67bZV6Ozo6EnylG8kZfq6joUVujfu+aQgfOnZQIxwNBEHAM1HFjYfKskIA== X-Received: by 2002:a2e:98c3:0:b0:2eb:fe40:c345 with SMTP id 38308e7fff4ca-2ec0e463248mr6941271fa.11.1718318187869; Thu, 13 Jun 2024 15:36:27 -0700 (PDT) Received: from umbar.lan ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-2ec05c04a08sm3865191fa.29.2024.06.13.15.36.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Jun 2024 15:36:27 -0700 (PDT) From: Dmitry Baryshkov Date: Fri, 14 Jun 2024 01:36:06 +0300 Subject: [PATCH v3 5/9] drm/msm/dpu: move dpu_format_populate_plane_sizes to atomic_check MIME-Version: 1.0 Message-Id: <20240614-dpu-mode-config-width-v3-5-29ec4069c99b@linaro.org> References: <20240614-dpu-mode-config-width-v3-0-29ec4069c99b@linaro.org> In-Reply-To: <20240614-dpu-mode-config-width-v3-0-29ec4069c99b@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 X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1407; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=snF0WgX3Uzkz2+5I0055uCAP2cYsbGgSQ2GyOQRAHdc=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBma3RmW0TTeUi2rB56wD/1RdcHJO05cYTxQGOdb jtQ0YSU1S+JATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZmt0ZgAKCRCLPIo+Aiko 1ZliCACUWB1VPjIZWfsRkXyRAPxoJImYLrFW5Ln+oV36Or+JycieIOKeDTgM1w5ylsfSNmErxHB KYLiFSUdVsq7L5LBsNOt7SgenxS3zQytkXrhi69yYkhGRzWL2I1Pp4Ii9wnjjvR/GFFP6ufbOXU 20WtayHo5Q4VnxAoPKTGIZqYcL7X70Y+lgSxosmztebNjwKOqkLo1GWP5maqSwgFikhi+p3rDPd e+3tu1yzunAmE6L/Bg93ir/I2mjdHK7q6n4fKbupMt+9zgecBsp/DpL1UTdK814PoLsMd1aB+n2 NlNadDk0viM5HH4/So1r2mHNNJeZ3WrgyvIFFtkJNsebZrzX 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 a 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. Signed-off-by: Dmitry Baryshkov Reviewed-by: Abhinav Kumar Tested-by: Abhinav Kumar # sc7280 --- drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c index a57853ac70b1..927fde2f1391 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c @@ -674,12 +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); - return ret; - } - /* validate framebuffer layout before commit */ ret = dpu_format_populate_addrs(pstate->aspace, new_state->fb, @@ -865,6 +859,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; From patchwork Thu Jun 13 22:36: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: 13697570 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 EA60EC27C4F for ; Thu, 13 Jun 2024 22:36:50 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A8D0110EBEB; Thu, 13 Jun 2024 22:36:46 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="RZHFrm/M"; dkim-atps=neutral Received: from mail-lj1-f178.google.com (mail-lj1-f178.google.com [209.85.208.178]) by gabe.freedesktop.org (Postfix) with ESMTPS id 70E4010EBE3 for ; Thu, 13 Jun 2024 22:36:30 +0000 (UTC) Received: by mail-lj1-f178.google.com with SMTP id 38308e7fff4ca-2e724bc46c4so16883521fa.2 for ; Thu, 13 Jun 2024 15:36:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1718318188; x=1718922988; 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=J8NGTZXoOFTfLmhsazwKT2UsGEPrRF8ia337hm+GXXs=; b=RZHFrm/Miy/Lvgr4mxhVen0E69BvkbxIMgjHYiXJJBDog07axWyBm7HhnZy6OagQqa ARUtXYarnHE9Lbd9oHrFytfNQBg7dPlU1ZtXxRQVcV9AKJV+V/yhWB0IOvJ+pgbW13BZ XjMpfiWqU4eSENyh6KtexWjJuurlCjCGXe8STA+ZzKtPjL909PUO0szpu7ezHy/NylUV 0nPjDwH/zdNP0nK97ZY0ErMJZAHYZal6loyiw/v8yNplbeqGGnf3jQodakgVjrSNZ0Zk OeJCQb1CAg+zbUu8t6WuaFkIcewvHQ3aSCU/BQZta4KudkTqHJIQeSR4NPqjYO0tQ+qO ZeQg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718318188; x=1718922988; 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=J8NGTZXoOFTfLmhsazwKT2UsGEPrRF8ia337hm+GXXs=; b=mFdvsLSvNN9PLrJQYoRpy4U/UBRQZ7qnTLYHCDPW7CJQnAYvWSphLR5ue+gON/2sSn v0OJppiGCk16FholOoK6iVR3T8FyKWc1zkI+KpH+bmHnNBc+xCrOvx+h88HkMjrNPruL SHZd8vIj/nqfmTXXhHvMDhXzr1VPpxEQXssVV0Sn1d/ArjCEfNtHn442TN1ZQjFUbyJ0 9uXBaW/blMMkk09AV9an+nxNfdNx74sqt/R9vMySMKeRGlK2+F2Z+zDm644laU50IMBb 2ipu75XdDA77JAIhwq5QfR3AJHysDN9upD5/cIdT9HILPrnpLS9sun+ZooCN8XhYL2dj ZloQ== X-Forwarded-Encrypted: i=1; AJvYcCWZn1NCt5rvKya6jSOTwCAOnwrtVSGCBNsOqbT0Uc8ybsL3ECT4GYkClj82YxWtOS8541ODiu8Ult0yjbp+0VTQMWsLWP4aIC7eVq+vWM4v X-Gm-Message-State: AOJu0Yz26Q7sUYxboe2w0nJ6BcP/MmHr8NCDC4pJCkH1eOx7gW1GGcus L52DmHzjOgOI7SPSyv60xQ2m9limbGAVaLeAPybYLDzdaTI+yOQD7ZuUY9YqYrEeOGphnsFK20H vFbM= X-Google-Smtp-Source: AGHT+IHjnAgMZOb126beQwLBaABOMPxG56SlKC98+RTdmKWdSV+pY6of3i2I3dGzuV4k1XNP+EZZWQ== X-Received: by 2002:a2e:904c:0:b0:2eb:eb0f:a822 with SMTP id 38308e7fff4ca-2ec0e5d0c7emr5470821fa.24.1718318188647; Thu, 13 Jun 2024 15:36:28 -0700 (PDT) Received: from umbar.lan ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-2ec05c04a08sm3865191fa.29.2024.06.13.15.36.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Jun 2024 15:36:28 -0700 (PDT) From: Dmitry Baryshkov Date: Fri, 14 Jun 2024 01:36:07 +0300 Subject: [PATCH v3 6/9] drm/msm/dpu: check for the plane pitch overflow MIME-Version: 1.0 Message-Id: <20240614-dpu-mode-config-width-v3-6-29ec4069c99b@linaro.org> References: <20240614-dpu-mode-config-width-v3-0-29ec4069c99b@linaro.org> In-Reply-To: <20240614-dpu-mode-config-width-v3-0-29ec4069c99b@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 X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1761; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=4803hWNpcHudkouDSAWKTu5smpjA3R/H+DmuPg5Dn0I=; b=owGbwMvMwMXYbdNlx6SpcZXxtFoSQ1p2SdqUL53vFQ8s+nGjaJruG+mDfzqnZZ8/Xbg/ycrll nDa7ZeqnYzGLAyMXAyyYoosPgUtU2M2JYd92DG1HmYQKxPIFAYuTgGYyKVuDoYF5r4B6/xFP2/Q dtF0MfL9WPRA+f0xnwznNWssGSfLW1dO/7CCQ1JJT/j1k5tVHzPcNrpF1Tt5zlK5nNq4yU/73NN 8LX0J7nn7prk5a3oun+8eFd/2wi1UbpdYdYt8TeT/RS35xbHtfw6fnaAYJP2ktixjW+K/q/aLzq qZlLVk86w4lPzLZpb75vkOavHvU2a0TOESUS39w5CilLv+pWJGmrXhGm+X7iChg47nmxpZL5xa1 JLof033UXSCoMXJvG/WZ+TPv9GY7tIRYvUmcxp/odAT6/6IAzGbJ8/McNoRHewVKVeVtmBhsVBa afIBfZXHKiVPnr6qdw5eFBfKdrrx91s2g5SNHzbxmSUDAA== 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 Signed-off-by: Dmitry Baryshkov Tested-by: Abhinav Kumar # sc7280 --- 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 927fde2f1391..b5848fae14ce 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c @@ -791,7 +791,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; @@ -865,6 +865,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 Thu Jun 13 22:36: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: 13697569 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 AA45FC27C79 for ; Thu, 13 Jun 2024 22:36:49 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2FB4210EBF2; Thu, 13 Jun 2024 22:36:37 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="dy1uPI4F"; dkim-atps=neutral Received: from mail-lj1-f169.google.com (mail-lj1-f169.google.com [209.85.208.169]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3E74F10EBE3 for ; Thu, 13 Jun 2024 22:36:31 +0000 (UTC) Received: by mail-lj1-f169.google.com with SMTP id 38308e7fff4ca-2ebf5b259ffso24258881fa.1 for ; Thu, 13 Jun 2024 15:36:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1718318189; x=1718922989; 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=FlN072hhw0fBKiJsgk2J9BeVUDiEV3EKvdHtXHIJvno=; b=dy1uPI4FiC+ptmCZ2ZDs77CddRf1ykv5dHHaGLGqiKxCmo2RcekHeawJWOK2YnBXO5 XZNphA3hJD7eXsIAfO3k2wV/Q3yULt4/gtZbOnk9t6sYRhwdrt7nZD1gvhpA1o+/PkiV DjA/sq6sWlWLn05sek13KA4uKmXifsCWCx6GNKRc7dko5SSAmJdnwoPHmPMZxSg7UrCM UTKzdtszKlaPwOYlLQnK7mf03p69LniuSSQwepHfVOg4OOD5ZFtZ8+8+fq7LPZFTnF8z 87yc272eLuZsxxQAiMjN24YO7QAGnsFDy/hO2UDjzZdyJVzeIuhh2Vbf/6Ax98/9mkTi shjQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718318189; x=1718922989; 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=FlN072hhw0fBKiJsgk2J9BeVUDiEV3EKvdHtXHIJvno=; b=EB/RJsRO+vDohHhKO95qkwTPXr9KolI8VPvE1yNaJVxQbunod0TaPHfn1qwh+rbtWL wAswoysfEpzsaqzVi1b3RVfC2diu2lk/xe5jAiYr6TtrWhySv8wl291Gl0mlYUAGg1k+ EjJ4yDvqop2tiI3pLZtUIS4jhYdFayLeOmZZGUqJjD23lSYM8iO9uV25c5P1bHs0hOHh v8MEaOge7chUJIN87RX+hzUyGQ1kA7t3MFlA+EDwB4BtwasQP28eaB3VauAoI8ltLHQ+ mQfvNI5100iz55TILnDpsA6OreYH9oXNUIrICTk+p3n03edPdB00sROyo/wgqjKdf6Yi CPMA== X-Forwarded-Encrypted: i=1; AJvYcCUh85klzUNwfMfjVlunmBQtPRZgJk5JlLvgw1yKPomPzwPX/IL6AfJ6aln13rsEKS0jt+8Z2AN1egDRDIpz7fVVvBRcy9yy98Zy2higSQCn X-Gm-Message-State: AOJu0YywaTpliusz/hpqa4TgiotFL/kjij5vytn7fBm5sacHzwYt/sDz YgMcqHdCLOc9hWGzbYMaN2gckHFLC5jPNwY9If+K1RTXPEbDcC+6Vvwnev1xc4g= X-Google-Smtp-Source: AGHT+IH6QppQUoYrdkNvnK2t5Jhmp6XGoEKLvdCUf9/Pzsg4JY7mpWQnrjFwhF8ZL+LfKFken4NG7Q== X-Received: by 2002:a2e:2e18:0:b0:2ea:8d49:c063 with SMTP id 38308e7fff4ca-2ec02b833a9mr12655111fa.13.1718318189423; Thu, 13 Jun 2024 15:36:29 -0700 (PDT) Received: from umbar.lan ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-2ec05c04a08sm3865191fa.29.2024.06.13.15.36.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Jun 2024 15:36:28 -0700 (PDT) From: Dmitry Baryshkov Date: Fri, 14 Jun 2024 01:36:08 +0300 Subject: [PATCH v3 7/9] drm/msm/dpu: drop _dpu_crtc_check_and_setup_lm_bounds from atomic_begin MIME-Version: 1.0 Message-Id: <20240614-dpu-mode-config-width-v3-7-29ec4069c99b@linaro.org> References: <20240614-dpu-mode-config-width-v3-0-29ec4069c99b@linaro.org> In-Reply-To: <20240614-dpu-mode-config-width-v3-0-29ec4069c99b@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 X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=934; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=/ebMwYAo85KjvumV8JrThFY1ICZfff/QWK4oXrEtQu0=; b=owGbwMvMwMXYbdNlx6SpcZXxtFoSQ1p2SdreK+p3WL8/aNd9JN2a4x1X3ralpXS7Gl+/lNJmL k3R7N5ORmMWBkYuBlkxRRafgpapMZuSwz7smFoPM4iVCWQKAxenAEzEwJv9n3li0aWA3K/6N9xM EoOvlEkIat2/UHLc6os7d23giXS2d2Ld9gmvJ8ZwSXkrNMxnfRwpqbA0a4Ud/zlBn1krzrk/k2r Zo1Lq/KxQdu38xwXZJvE7PqT65v46nb1On4nh7h6RGy/PanHr9FYuDXpdFhPO7bfLVY71+/U7k/ SdrZ/UcXx54M0juvuBnvv8zddznZJyQplCvRSWeLVqBJxKCJjl46SdfUmn0OLb5TP8/lZT5OM9X jJ5FhaVanNwnzIxW/LlfbaIYUdqhqmVyLesnGlxM56kszz8xyVgOX39g7KFvvsCfMJXpOZ6aBhy BD8w9zp70inj+77Z4hqT1rtOr89enrBx5qyqNJff9wA= 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_crtc_atomic_check() already calls the function _dpu_crtc_check_and_setup_lm_bounds(). There is no need to call it again from dpu_crtc_atomic_begin(). Signed-off-by: Dmitry Baryshkov Reviewed-by: Abhinav Kumar --- drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c index b0d81e8ea765..5dbf5254d310 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c @@ -809,8 +809,6 @@ static void dpu_crtc_atomic_begin(struct drm_crtc *crtc, DRM_DEBUG_ATOMIC("crtc%d\n", crtc->base.id); - _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) dpu_encoder_trigger_kickoff_pending(encoder); From patchwork Thu Jun 13 22:36: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: 13697565 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 62A3AC27C79 for ; Thu, 13 Jun 2024 22:36:43 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5A20F10EBE3; Thu, 13 Jun 2024 22:36:34 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="L9YSPNoK"; dkim-atps=neutral Received: from mail-lj1-f171.google.com (mail-lj1-f171.google.com [209.85.208.171]) by gabe.freedesktop.org (Postfix) with ESMTPS id EF65610EBE3 for ; Thu, 13 Jun 2024 22:36:31 +0000 (UTC) Received: by mail-lj1-f171.google.com with SMTP id 38308e7fff4ca-2ebf961e504so16181351fa.2 for ; Thu, 13 Jun 2024 15:36:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1718318190; x=1718922990; 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=EcbpVWRjdcbUgJJRZuH7Bn/JQTVuo4vjsCW3dScHVqc=; b=L9YSPNoKHuF0Ry05Swchl1P+iTpi8w4/xOaZp3nlLroafM6cYSM+qZpoOyhoJp9lut LbqZhCZHbAUHBYoJqG305cdB8pWDWp1qAq0JNXuUTOMJOIPDg3+jp27rNzdmYYQmEgLW m3dBKo4ICwkMBe39zBGvJItg5WURqfbG7rseCyUzVwubES5jk9QF1c0enX3bKBDgKFMB rqnN5NwP+G2RT0oB1ye6sx2AI97DCa8DdTEyNkVmHnbmL5rbYYI9waiqHzH9dr/3k3ad U6IKYUk3JEO/+Z8m/ZwgnVDMcDOlFm3Z+1PpDm0uuf+t0FQJAjuTGLmxi7gc4zTy5Rol 9U4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718318190; x=1718922990; 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=EcbpVWRjdcbUgJJRZuH7Bn/JQTVuo4vjsCW3dScHVqc=; b=xK8Q4T08mFnzfvdeC7OryC0mk33Epfq3Y8XmjdtUs1LE14uo2Rw0rH/REqcGOoJkZN PoUsGepaDfdCYtqxE0wH8VZfgGa5jSZMWfyV2D4NMaauX5A+0vdgxhltKg6yHmBbogZE LQbIItQBwUk26lUAGQboNaUAlbP1nn4UgJ9IWsOQRWFb1/Hee5jpmsHOwkj4/oly04M1 8msWzc/GwRrw2axyFeuWybiDqihWu6sgPan4dza1I8WKsVzWTCoTQQEvmkQaC1gFRL6q Gx+qDZ5wk2A4ANRXzOswJIi50Gs2iFJ4IeRHUluO4JZsPINJ3i99j0ND5y57xy8WGMN7 F7rQ== X-Forwarded-Encrypted: i=1; AJvYcCX5GifjS5Nw+UcGFITvygDczvxR1KEoUywwz5eGPzIwv6X0AbrZZ3Zx0NI2LAB2lGnNc9cKFo7UFCFK/hucjEF+nA24PCGTnznRE/rtk1AA X-Gm-Message-State: AOJu0YzOYeE40psqbwoWu2790sTeqFpGOnLw66DtFAlhvN9HNyDcwXfC 1yF8cSgxYWmYftXs3iy4DLlx0wrYw+UzGrD8enerK7wh/Fbnf4oHZ9WvC6HIeK4= X-Google-Smtp-Source: AGHT+IGsyaawUFf+4gUUXghFvDdv4y1xpvcJvVUMNGD0sljbuiH+giwWWJTcUPZQ25fOTrL/LhS5JQ== X-Received: by 2002:a2e:8916:0:b0:2ec:95:d6fe with SMTP id 38308e7fff4ca-2ec0e5d0c72mr6566751fa.24.1718318190174; Thu, 13 Jun 2024 15:36:30 -0700 (PDT) Received: from umbar.lan ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-2ec05c04a08sm3865191fa.29.2024.06.13.15.36.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Jun 2024 15:36:29 -0700 (PDT) From: Dmitry Baryshkov Date: Fri, 14 Jun 2024 01:36:09 +0300 Subject: [PATCH v3 8/9] drm/msm/dpu: merge MAX_IMG_WIDTH/HEIGHT with DPU_MAX_IMG_WIDTH/HEIGHT MIME-Version: 1.0 Message-Id: <20240614-dpu-mode-config-width-v3-8-29ec4069c99b@linaro.org> References: <20240614-dpu-mode-config-width-v3-0-29ec4069c99b@linaro.org> In-Reply-To: <20240614-dpu-mode-config-width-v3-0-29ec4069c99b@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 X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2255; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=kt+mUO/v24R5t4QFhxIPYKNo9RIjNHA9NWWDdfrHipk=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBma3RmO/n8oQ7m5GUV6PCv8vjZRnk1Wb8KG772c axat1t0r7GJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZmt0ZgAKCRCLPIo+Aiko 1RdTB/wIZcYOQP5hBApus8nkFn5cIUqfCapzLOFiJnMZfNs1ExujIjR5U7kQpdIWH+KnRkHdblr Py5jgqxWCXG9w7EYES87j9Kyzsvmqp558qv1ZFu1cX2uXtkdzU3gCrE7hitxMOEgusHioLnuJYO XyQYgRybIoExMJie0qOQYnb32UUQBk1PrvRC0hHMdq7s7LP9quIJBn0irPVJwkuG+ZJS1GPNUe9 Op0vjgNMfALEitbxs/3qpM29/ZpCATB+qdW/PSODR8hvjPugS0cJSyKI/xPpVEfar44RlzwtWYe x6G9ORhxBMXMLVeaBW0KxLMXbC0VT9LvaC84Uew0QqkkJDCc 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 Signed-off-by: Dmitry Baryshkov Tested-by: Abhinav Kumar # sc7280 --- 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 c6485cb6f1d2..6d7c4373bf84 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 d1aef778340b..af2ead1c4886 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 b5848fae14ce..6000e84598c2 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c @@ -852,8 +852,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 Thu Jun 13 22:36: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: 13697568 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 66976C27C75 for ; Thu, 13 Jun 2024 22:36:48 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 7E73D10EBF0; Thu, 13 Jun 2024 22:36:36 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="RsduB2Y0"; dkim-atps=neutral Received: from mail-lj1-f176.google.com (mail-lj1-f176.google.com [209.85.208.176]) by gabe.freedesktop.org (Postfix) with ESMTPS id DE10210EBE8 for ; Thu, 13 Jun 2024 22:36:32 +0000 (UTC) Received: by mail-lj1-f176.google.com with SMTP id 38308e7fff4ca-2eadaac1d28so14656451fa.3 for ; Thu, 13 Jun 2024 15:36:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1718318191; x=1718922991; 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=bY4Fdj8LBem1j0JhiZYvE2hhGJdtm9/4wNp5qRC1HxM=; b=RsduB2Y0IGuljOixZ8z7o+GrRdekx8VjZJB53cX9PyxuBGeSLAAHW0oXnQY0b5gqBG qNlKJ0RfqePtcNLlR5+17G8iTU6JiHO0tHDZiWkYVPWdtmhKA8Xa477NxVeVzU09To3g T4QTv5tE7Eq8DtU2e6pO6I+zBnSNHB35G1hrx0iw/x6q3pYK2rtiK2xV7HLIfCEL9Rfu Dc0hr9Gxd6X+s+s2FsBHU5uu//fOM6SV78/IRDpVdiWhIOtd9YlSegumw7cE/RzksuWh kiOfX+MBcfAJ06iMSI8mj18k9iDQzmLp2QhQ6+wYg+Zb8F2fQ/7fq6lfXySPEQrqfJ+z Ei6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718318191; x=1718922991; 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=bY4Fdj8LBem1j0JhiZYvE2hhGJdtm9/4wNp5qRC1HxM=; b=KfbrhGUEfZiH5gUpyrPpnO00edT4aOWpxsD7aTmMiXny+WNrpu+SfKDR5dKd84JEPy CJ2RmrGIXg+SkW43ddCoX+4u8eiIwdS3td9CYWKwthPcZ0OHJXWKmF8p168on5D78Z+2 U6T/9QHdael9DoBbySPFQR0v/1gvEVH6y6eoRkE8vwFUZX0aaKwAXprftKc0fyXs8OZm L1EBlipp0n2j1GSM7ygCRSV1zKwj1ccnyg8eRZSG1hY4evX2OTfl6RKBWDbJv1BeQDvR Cj7EQxn1n7usuy39q0FYA2+QnmAradeD3sYYzS9OC/jj3b/amwv8IDM2q2SGO2ZX/L4n u04Q== X-Forwarded-Encrypted: i=1; AJvYcCUF6iAc2VX0RhAz8Yy/X9bO7KbNDkBS0F4uw+o7HMkPX7iz9KeIKYHd+yt/rHTcWvGLrj/ldiWlHUNhU0uDRp40Kx6hk6AivvNKwH4aKgkg X-Gm-Message-State: AOJu0Yyvg+VRyrDTHR6G1dGe+/k3Jc7s/WnGAA9qJX9sQbAL7IksuP5w e0jBVn9yd9S5Tnc5JKRwdcef7tTs283i/bzdAq82TcynYSOM0SkEswlb+6w4q78= X-Google-Smtp-Source: AGHT+IG2py+4H7jt37FBEfwRxv0sXfQYiHwnRpgTcq1yNZuakide7ZoahBL0t1WvLFAHnD4eErzECQ== X-Received: by 2002:a2e:7205:0:b0:2ea:e4e6:f227 with SMTP id 38308e7fff4ca-2ec0e59e337mr7131841fa.35.1718318190997; Thu, 13 Jun 2024 15:36:30 -0700 (PDT) Received: from umbar.lan ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-2ec05c04a08sm3865191fa.29.2024.06.13.15.36.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Jun 2024 15:36:30 -0700 (PDT) From: Dmitry Baryshkov Date: Fri, 14 Jun 2024 01:36:10 +0300 Subject: [PATCH v3 9/9] drm/msm/dpu: sync mode_config limits to the FB limits in dpu_plane.c MIME-Version: 1.0 Message-Id: <20240614-dpu-mode-config-width-v3-9-29ec4069c99b@linaro.org> References: <20240614-dpu-mode-config-width-v3-0-29ec4069c99b@linaro.org> In-Reply-To: <20240614-dpu-mode-config-width-v3-0-29ec4069c99b@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 X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2430; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=2Gk0OMDHQiW3uhDmJLEQ/urAc6vwlA6k4JGigLg8AG0=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBma3RnU2cAhfsW0kpryawy2or81SC35WoohLjIt OyEwH+9gv+JATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZmt0ZwAKCRCLPIo+Aiko 1ZnjB/4mC7hCuKEZDzh+Akh97KN/xGwFn6VRH1/8fEb7ME9Y1HkeGiQk2DERDy1KHd4U6y2tDbe uEsPl+1gbs+TMxEFC9VPMmap6BB7ir92uClFDSh9efVmtApZRu/ztJUf6edgFlLcxtLpmc1vqfs 7dtsXPS3y8sqe5OQAJd4vo5Qns+dt3AvQs+0rDSq4KRvgl6i4acI+qVIlVgwm8hNtxHf8fYvrH+ Ea3jF8umIA7E9euQjr3PRctyD5yUSBsQcDyTf9FJ2qtd+Bqx8mZVy0zf9D3ib9nJqNqtUSZaBPB 3flRryxais5gC4QhHT2GDAhp8qCASqoUNwR2VUsoi252bou3 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. Signed-off-by: Dmitry Baryshkov Reviewed-by: Abhinav Kumar Tested-by: Abhinav Kumar # sc7280 --- 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 5dbf5254d310..44531666edf2 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c @@ -1236,6 +1236,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); @@ -1451,6 +1465,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 0d1dcc94455c..d1b937e127b0 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c @@ -1147,13 +1147,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 */