From patchwork Sun Jun 2 21:39:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13683091 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 4AA08C25B74 for ; Sun, 2 Jun 2024 21:40:04 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5B1BA10E0AD; Sun, 2 Jun 2024 21:39:56 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="DCFlMBms"; dkim-atps=neutral Received: from mail-lf1-f54.google.com (mail-lf1-f54.google.com [209.85.167.54]) by gabe.freedesktop.org (Postfix) with ESMTPS id 1C01910E094 for ; Sun, 2 Jun 2024 21:39:54 +0000 (UTC) Received: by mail-lf1-f54.google.com with SMTP id 2adb3069b0e04-52b82d57963so3650085e87.2 for ; Sun, 02 Jun 2024 14:39:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1717364392; x=1717969192; 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=DCFlMBms7OqoBH7fWub4TM/CiMBclO9KQ2LJkcfvMw8PaaJuTTGz/5fZRnSrFo2x1Z uUuSLk/C5EqirGfmXu9Hok8A/c3O8Wb5ljCE8jMp7QCsiSgFwmm3kTgZvKX7a7T+jczX t7GxQ8mPVeh++y4kC5GngC51IQGXW+pi/zfmlfJwCvxJXMLZOlCs/eQcQSF7pwYH7RXF kk3P7rcpy29GyBq0ZbByqRPUEG6Um1S21bUiVsZVK1KI2cbrUvg/vcVHLE1zhADZeheT e82JlZFhsuTwUVbf9qbfH+PFP3uUtez2wyxRefk2y+LOCyz3vhnhdTKDULIuLqPKxg6x j5ww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717364392; x=1717969192; 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=FW1lEPWrzo8GwkedD0mpsWfOeTMYstUL/82pqaGwku/S/iFja7Dz3QX/E1ZUq/Pxqm Bx1AWuCjGtzUR9PpcNOEo8fvg8i0G2iYNOJufgzXJ9H5u7wkVbZSzunjnvvVIIgTcBJF nIJcHpkPMF3eBsQh9X9vWNqyyPmFiQXhqyXB50UzbweicvRKbDsOoLd3idQjYpI6Zzsn IzZMvrE6HKmYkav6SQh4G+PtR3EfINjACwXDNitUqgCLRCdwbxBtEqbZgoWIAIBxEzPL m88py7pydTvj6zTV3T5q/OP9+u1nHes+Hn8pmudv/FtfFR2A5p7mAefyss1Zujo8fq8B t1DA== X-Forwarded-Encrypted: i=1; AJvYcCVxwervdX1MLnrXrQGpr7be7yGQ6JkzAPlqjLUMOdNcBPPvyHoRistRxgk0vRd4I1klFarxAQmOQI54i7e41OQm++0K0+E0TtQKmGxEdhZB X-Gm-Message-State: AOJu0YyS5pWcZ3vtgwyK0+0wjfJWZvzO4v7XNGZPY+nOQmrTNzZx9mGF Ls/0ZTCkNWxqlQme383/zwkKtwLlN9jb1Da6eAplDA5zAg70xt1rt792WVm0YTQ= X-Google-Smtp-Source: AGHT+IFfReYRhO/HiJhMNiFndyCOAnoEs/0TBIkJ4a6aBxNSnQZ3JaNQvEPnqjZNZRCjA4ePM7CNwA== X-Received: by 2002:a19:ca17:0:b0:528:649b:d7bb with SMTP id 2adb3069b0e04-52b8949e1a9mr4408779e87.0.1717364392118; Sun, 02 Jun 2024 14:39:52 -0700 (PDT) Received: from umbar.lan ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-52b84d3f648sm1021563e87.73.2024.06.02.14.39.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 02 Jun 2024 14:39:51 -0700 (PDT) From: Dmitry Baryshkov Date: Mon, 03 Jun 2024 00:39:47 +0300 Subject: [PATCH v2 1/9] drm/msm/dpu: drop dpu_format_check_modified_format MIME-Version: 1.0 Message-Id: <20240603-dpu-mode-config-width-v2-1-16af520575a6@linaro.org> References: <20240603-dpu-mode-config-width-v2-0-16af520575a6@linaro.org> In-Reply-To: <20240603-dpu-mode-config-width-v2-0-16af520575a6@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=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBmXOakbZRQAWT1SrHe2d4rp3wBk6oRcDx5dtv92 q7JRPvfocyJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZlzmpAAKCRCLPIo+Aiko 1T+5B/935Z6X8ffnw1vTDzVAMCOqiaH0eDbY03Q5LjZT49O5xZEuZe15kolZhjlB6mgWpF5PbR/ CSI4fUcTPvN9h4v6TOkwldQJXXV+PcUBprbMFuMOD/9T3O5SL+aLJIKnw9mwGZmWIqXLcePiFyq 0MFiprqUusppYPnWSB2aAJgbu6ExTjTBPxYWZq33Um+qKGl9ls32tW+HnA1EObepxmn67ef7Nzk wd6gM5mVXWbZwq/dNEOGSYHZ6bDF7bfNfRCHBSh6GQD1BbHGC9JSzo7puXZpNOLpMyyf2MtYEGV Eq4nfvxZo+KvOEQGdB5h03JDeX5Q3y5pU2n/ptJVmW7daxAh 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 --- 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 Sun Jun 2 21:39:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13683092 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 866D5C25B74 for ; Sun, 2 Jun 2024 21:40:07 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5017810E06E; Sun, 2 Jun 2024 21:39:57 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="nNEOw5a1"; dkim-atps=neutral Received: from mail-lf1-f51.google.com (mail-lf1-f51.google.com [209.85.167.51]) by gabe.freedesktop.org (Postfix) with ESMTPS id B571B10E0BF for ; Sun, 2 Jun 2024 21:39:54 +0000 (UTC) Received: by mail-lf1-f51.google.com with SMTP id 2adb3069b0e04-52b88335dd7so3178100e87.1 for ; Sun, 02 Jun 2024 14:39:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1717364393; x=1717969193; 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=M3T0GM5JMpgLQCvQ9pF3I+zflChZzD3iJo1siLxt7j8=; b=nNEOw5a1AIqP7AS7KA9gkB8JdsAVyCVqxwviXu4TsDz4lhEuILoASFj/J+5QElqi4X dsTCdoP4wgFJ9fcX9fjxu8FqWFT9Bre5OJMSkzYAdKhAHnI62j5ecC2g1P11SYwAN04+ TzWApLu64lVmW6N3yaTRqvtkx+lE8pTR5GB5d0CfKdWaNU9jqbwO30Atx0rqslNqTAhO qYWu44mOhSFVFHGZDogVcuHh9WRCdjQ0VDm2bk+A5fSZjG5ycQ3CPY4YquT6m1ORU1Ws MgPJbL8O1nTcjEhS2AqcAfbRWyzRd5iYVGFmTE9geSEZDIn5T0f1B347fQUeCASV0pDb +b2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717364393; x=1717969193; 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=M3T0GM5JMpgLQCvQ9pF3I+zflChZzD3iJo1siLxt7j8=; b=rj57g0zT/Q1QWc4j26NHp8crnpJNPlPZcUPIHYpMwJoTRTFTEcmUyIUJpkFWi1ZVIK TvaX7rD3U31mt+cbHSPjpIeHANGzl5puEm8VMig/hu9c1iOLH9OKR9CnmFiuTCzgVKnF ziEt6j11uZnRxRC1paxzOog3c3klQ4+jj/h13dsTxzZJRkWDBiEgahbiQAqNaWO4TBDQ rWwTTOEaQHlx8hY1bziFUOAKizRvaV76B4x3Tif+NQdY8l8RKkjzX/8ueEoZu/gaZY3U cZA0p1cPIIhhi3S3oPlG3TrgMRBI4aeNPEqHyFmOkhkiqyqYBlp+0jKOI6HhskXjNh4U BqzQ== X-Forwarded-Encrypted: i=1; AJvYcCV5jxDinZoECdeG+kqmvFomMEpl05eVqXlszrvBs06yjp3/Sjg73DtMapPSVtpZ/2cPoPoSl3i7jK84q9hOQuNI4b6Xl48UNlcXVEqxUg9F X-Gm-Message-State: AOJu0Ywo44wjiTFicTubYyMw5TgDw13nEkmXhS/qSE2BlAYjx7+Ykdxm coTn/v67T/2nJIZI7wUbCSb0N5VnuCllgdtehXQDPZMDZZO3vt3Do4Kzs84O2OY= X-Google-Smtp-Source: AGHT+IHK5OeYERzx3nhecYuMqLKg8fOyqhhISkQdGxBmJrro7xmuK/5pjgZHa7cdn/WMoIkjFlxUYA== X-Received: by 2002:a19:2d4b:0:b0:518:dae6:d0ec with SMTP id 2adb3069b0e04-52b89562d1dmr4826617e87.4.1717364392959; Sun, 02 Jun 2024 14:39:52 -0700 (PDT) Received: from umbar.lan ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-52b84d3f648sm1021563e87.73.2024.06.02.14.39.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 02 Jun 2024 14:39:52 -0700 (PDT) From: Dmitry Baryshkov Date: Mon, 03 Jun 2024 00:39:48 +0300 Subject: [PATCH v2 2/9] drm/msm/dpu: drop dpu_format_populate_layout from dpu_plane_sspp_atomic_update MIME-Version: 1.0 Message-Id: <20240603-dpu-mode-config-width-v2-2-16af520575a6@linaro.org> References: <20240603-dpu-mode-config-width-v2-0-16af520575a6@linaro.org> In-Reply-To: <20240603-dpu-mode-config-width-v2-0-16af520575a6@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=hWYhkAdByN+pW4M02a+sJl2cy100VyTvE/D0nMj3Emk=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBmXOakYZO0S50JStaLxVwdPh6TtLl+/JpC6PJ7u yekVJ0xeseJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZlzmpAAKCRCLPIo+Aiko 1aEdCACpbJ/bSoiXYhSiHOtxXNBm8Oy4JPYqL5u4etM+29PF6Eh7DXUUwOx1HsiGRh7kCde7r9t i4nF0YTNJK1WcCzZll1PYuCNv0L9R79+GEl5hMndfLN+quhKYgWXfO3KKwLpwwyv7VE29yPNn0t eJjNR/i7/hFQmJ77BfeOb9lPOFp7zgNlPc9Gh76jm+Z1D9mLQV1dQqYo/M0T4BviirKAJ4XvXrp PnAsXVZj7DOapIF3iqM4wezwWyO6jljcOrJMKgnv3Qe/UdDK+xI5TBfTkaIrLfJzJh12vJN4/k9 24hdS2ye/zsLFmj50gWiuzv6wQn+D0dpVWA5KGGduPEggXHx 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 layour in the plane state and drop this call from dpu_plane_sspp_update(). Reviewed-by: Abhinav Kumar Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c | 19 ++++--------------- drivers/gpu/drm/msm/disp/dpu1/dpu_plane.h | 3 +++ 2 files changed, 7 insertions(+), 15 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c index 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 Sun Jun 2 21:39: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: 13683093 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 8E015C27C44 for ; Sun, 2 Jun 2024 21:40:09 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5EEB210E0DB; Sun, 2 Jun 2024 21:39:58 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="Z6Xq8bB7"; 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 AA07510E093 for ; Sun, 2 Jun 2024 21:39:55 +0000 (UTC) Received: by mail-lj1-f178.google.com with SMTP id 38308e7fff4ca-2eaa80cb573so12723011fa.1 for ; Sun, 02 Jun 2024 14:39:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1717364393; x=1717969193; 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=Z6Xq8bB7Z4q5wvRK/np0TBX2vjFJ/FyukewN5n0QUCao4AaDNCbh0Gb4vL4cmfXuDo hnviCikoxSJDg9gZxAdSQ3jbujYQV5MexqbZ9nhVLvlUkFC/sMLBq/DSLmms95Fml9Ed qfeBfvrxlNE6O+bRTsFrRvEi7+QX1dERsIodZana+gWjKpFQt5SeQ2uGA+g5XTiBomN/ KdYBWix5jJGVsCCOasCvnl3wSx1tGxAZFxbKBcD5SEWbqVN7jLO3MyHxpaRJUIUU08N9 1sgGfJuO9Yq3mz0VYWx1kpoOE01HxHyOPso1N90MGUspzpASbWmXiRGljh8/XuseOUoX HM6A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717364393; x=1717969193; 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=faPuSc5n3rFwx6JtTF4fjVEJEc3rov4v/+0uxuHtm29NnMxmdt6CxiveUu3qLptqIV OuIGIRAz+DYKsM1Xy9B0r6lLAZQVLvoNjczpniygLZpykW9e9Or17UYpIWYwtg/ZC8Dm N3wnHgliLM16rKeHCOu2r2KVPQ+yUv7ZjYQfXFy5IqO2FKp+X/8LnUHpoatuig7+CTCX EobABebV+uQKgPH83WAgsn9eOiPpa5tXvE7chLHz6LqWhfmB7fQE5L7pOfpj8/OKO9EM mSlLmHPFVxqugLrJTr+FTf3cschhXFUuDV+2mm9/7TOJWo4DVIFn7kCdwYMM3jALkROj 0rrg== X-Forwarded-Encrypted: i=1; AJvYcCVudx/8Gg4MosQaYN6k2q0timNzcSrmwLtD9lot3/Zi1/TOtXjC9dHGAuFEa7f7UePSRmpZ/ftWECLQviLnfev51mkNIt/bLKt+6tdA+UYS X-Gm-Message-State: AOJu0YwrOoE3hSco1BSfIZy/bBEi9BmgcHdVM5jpCi6yDKxp+vlsglfA Dn6cwfgiUGpsY1QZBKI+ZkTmXFu9m5etjN+m0VnZ5NT4034fqdZFkMOlaFqVw7s= X-Google-Smtp-Source: AGHT+IEbxYhfr5BWh0fY46RehGCiDe1M1me+3HU/84kF94fWyajmCzJKEqCdJbVVi31oObLZ+j1wnA== X-Received: by 2002:ac2:5226:0:b0:51b:214c:5239 with SMTP id 2adb3069b0e04-52b897039f7mr4247950e87.62.1717364393634; Sun, 02 Jun 2024 14:39:53 -0700 (PDT) Received: from umbar.lan ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-52b84d3f648sm1021563e87.73.2024.06.02.14.39.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 02 Jun 2024 14:39:53 -0700 (PDT) From: Dmitry Baryshkov Date: Mon, 03 Jun 2024 00:39:49 +0300 Subject: [PATCH v2 3/9] drm/msm/dpu: split dpu_format_populate_layout MIME-Version: 1.0 Message-Id: <20240603-dpu-mode-config-width-v2-3-16af520575a6@linaro.org> References: <20240603-dpu-mode-config-width-v2-0-16af520575a6@linaro.org> In-Reply-To: <20240603-dpu-mode-config-width-v2-0-16af520575a6@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/pANAwAKAYs8ij4CKSjVAcsmYgBmXOalMcxLGyi3hvL/tcFt6Pa0SyDpzweV1gsgR 8F4X4NgvHKJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZlzmpQAKCRCLPIo+Aiko 1VJ8B/99Sl3EQgmrIPMsnA5GQ9v5T4fVl61vvtVJFXO291kSCyt7W1itHf2HBNzs8NatqELP1tN bj6YcBuHV/W5NI4RCqQ3VGW+lPx7mbFOmOABGnt6D+XAFf8DQ10EPVOuv9SPsYoghrhXPNEdWhZ uVw51W9A0+sYgtPSNLxB8rrRQUTbcRQSICs+Ys6zXeN/6ICxuQyGrwkFcRSKbaWQGbFEyppQk/3 2G0A8guAM/ZoiBmQgEG1Z74PCnSTpxIuVrrXjIE7lDGdwPWuApB9QI7VkFmNqRP9ND8hGHXFU4p hspwe9jevPUlH0w3dqcw5ylnkxjyxBMlxFn1L5s+4km6Z/yL 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 --- .../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 Sun Jun 2 21:39: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: 13683094 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 760E1C27C50 for ; Sun, 2 Jun 2024 21:40:11 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9414A10E16B; Sun, 2 Jun 2024 21:39:59 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="d96/5mHE"; dkim-atps=neutral Received: from mail-lf1-f52.google.com (mail-lf1-f52.google.com [209.85.167.52]) by gabe.freedesktop.org (Postfix) with ESMTPS id 2162B10E06E for ; Sun, 2 Jun 2024 21:39:56 +0000 (UTC) Received: by mail-lf1-f52.google.com with SMTP id 2adb3069b0e04-5295eb47b48so4178317e87.1 for ; Sun, 02 Jun 2024 14:39:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1717364394; x=1717969194; 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=d96/5mHETRe0ONfnXMF6IIEtfOdPzaent7RRyYhVhyXz6InV1wSuHuj0TYxlOPJWlI ntVKXqXUlrEl3LhQkxD2F80YbN/0UaKIbptsZygu+FYGgin8ggeWfDzaZHANfl10Y3zH cxbdWvwjOLmG5zEkeJcsdjc/x/mrbVgMX+9tr5WYe5+em7ltYcwC9EFavnYM6bDpRNq/ 8JjNTbx0sCsPq9xcvd9dWDfX6UPK/SiEZuae13WBIpwZe2UaSrd/7OPchvjMEsPAyIYg IZ0wt2P98ndgjWj7mwiIAdoHUea12P3rUIzejjXeF+Qm6D4jmGTUV/MT9WY3XpkAQcqn hadQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717364394; x=1717969194; 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=a6Tp3RUbyUErPObgCoNLN7oSf+K1Lzqm7agYSAEE5z45CP0Er3bL2sLhSH+U+UP/Rw jl7kRFRSkkIHSfQf6Kmm3vu0U6Uxn7XqgPuXjzgzz0YXxD/iCPwVAY6yEkpPEZeXkXrA +hvvrGJIWzwVwUyQ9ymDqu5QW64lsDYoEfetiKor+jwZcyIXA43tXceXaAzBxt8WgScF j6HoX/co0xDs8lCLFo/c1lsY9HsEhlKeNSlnWyZk/LxCTB2frC+sXIHFsWjB3OEd+bq9 94aTGnhJzVIkHj1ScsFhmBkE15/S2Fw/1sS94t1b+Q1V1P6gyRgXVQVL0IbMpTg+deZD x1Eg== X-Forwarded-Encrypted: i=1; AJvYcCUYXXarQxkczS4nkEYPCI89DgR0rmgD/dev4v6nC3ZZbBMBLMOqfLc9fUMxO+v9fNimK7fzkiOymLnqGWx65GmYAaz+GcdeAK5vkkgf4YyZ X-Gm-Message-State: AOJu0Yxz7WR9clI2zYaCF28bcPsptb+U4Qlx6zGB5U6HA/F9lJcVN1JS 8eaXgHOgpDeg0eTPOYv6FcoPfONJkyuMxRG4LBjMo6jDWw93qSHI2jGs2vx7eJc= X-Google-Smtp-Source: AGHT+IGraiOrh//2iVqXW+yWmUJCNiUOLMZnjgqJjUSn/Gflfmxt4LJkXTjjAJ3McUyifF6aR9SLBQ== X-Received: by 2002:a05:6512:74c:b0:52b:2f78:9c92 with SMTP id 2adb3069b0e04-52b895694a3mr4169462e87.5.1717364394346; Sun, 02 Jun 2024 14:39:54 -0700 (PDT) Received: from umbar.lan ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-52b84d3f648sm1021563e87.73.2024.06.02.14.39.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 02 Jun 2024 14:39:53 -0700 (PDT) From: Dmitry Baryshkov Date: Mon, 03 Jun 2024 00:39:50 +0300 Subject: [PATCH v2 4/9] drm/msm/dpu: move dpu_format_populate_plane_sizes to atomic_check MIME-Version: 1.0 Message-Id: <20240603-dpu-mode-config-width-v2-4-16af520575a6@linaro.org> References: <20240603-dpu-mode-config-width-v2-0-16af520575a6@linaro.org> In-Reply-To: <20240603-dpu-mode-config-width-v2-0-16af520575a6@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/pANAwAKAYs8ij4CKSjVAcsmYgBmXOalEj7K/et5w8ArfSrqPzQvVoUCrqytS9Ekt R7LzyoaZOCJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZlzmpQAKCRCLPIo+Aiko 1a6NCACE40Mt5owlIaVRYYPMHs2kfEaF7aKJAnhZ8wPuMRSpTxBrdJ6o4yZBMZ84cvtBu0YELEn ev21zL8SG3E2ASOo08wsa/7ZJWJxURdPwL6f1oVnGoHbs8uvaEioXCE5JBnA6rp4HERXUSRDP2T ia4tF5vzPaTuCuMNKVaOPcrb9nNAz5jGvjuc06deWox6GE48zuC7tnVblwbR7ait4W+eRm6OMZ7 aVhYn2ncV7QHf1ORB/LeE/OYX2Zrl0RxQLe0yuuifr0peggvhhTlQeyxxMS5E0oZbE1cc/62TIq OPBikQ47OT7+DmDRFc1wyRTTOUzIwp7m0oisnwmefGGVGvWh 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 --- 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 Sun Jun 2 21:39:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13683095 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 23DD9C25B74 for ; Sun, 2 Jun 2024 21:40:13 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9EB1310E17E; Sun, 2 Jun 2024 21:40:01 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="WIaNXFXR"; dkim-atps=neutral Received: from mail-lf1-f49.google.com (mail-lf1-f49.google.com [209.85.167.49]) by gabe.freedesktop.org (Postfix) with ESMTPS id F1CE310E0DF for ; Sun, 2 Jun 2024 21:39:56 +0000 (UTC) Received: by mail-lf1-f49.google.com with SMTP id 2adb3069b0e04-52b8b7b8698so2737192e87.1 for ; Sun, 02 Jun 2024 14:39:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1717364395; x=1717969195; 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=WIaNXFXRZziUCzSI9ntWSePzEs3XO9cM7A0fRDmpAZNLuZicYnt0L83T6KnmabDhL7 +cbwf0UG0jtvelZcJkAIW7ktTYPWhIUckJ0+ndK+8vesYz21A6HkAp2JQ6dKcZFnOv8L 05O8odaBSZtI2ibqfLm5sA2Nqjh1RCYlzbSULCaSP0eQsZTcJDDts7Y38+86JO/Eqyzl 6psdXjNMhDXQlc2lBkeOeySFoY23vCG6cSI+AqUZZQfdkw1uWenlV8l6nvdL6l4vJrE9 F5wqGZKzkwh4d6Ezu3NzQv/x4FMagi5oSDkhtnTbGRm9QV7untZMYBjWK2SPM/WSAZxV snjA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717364395; x=1717969195; 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=bnUKqi2EYymNORX8nFmlggsFf0hrwPJHz3sNTeSpVemVk4K8768GbS8YWseSup1k9m vVZbeJczW4tdKnLTC4qM45ly3C9cOKdx49Ag8kgHiuXT3ojs1yE0vhqhrE4B3rUWemZ7 sBEXqHlvJpEHwX42iIq0wom1X2JQA+E7kIOf/qlvcZA1GIoNZTdVIUcG4oWDsyHa2etH kkpezcpE4qr8srm90Tdu94PGfjfJOadMFsSmf1PcCPWon5HkR8kOjWwrT0+chBjYOWwH n/n29c7IIk6c8kX3Hqn4cB7wsqJ2KoOFWQmdtK5e/hgyONM9O5WWg6xyf/ZQo7YcxOtg 1HcQ== X-Forwarded-Encrypted: i=1; AJvYcCWxuBpkhsat7o4SrlxHmpqmU2bJw3tjOKbSEAEJUpwyUqGllHP3B5K4JDcL8OUnhbCZeT513rS0IUXEgqwFKiGx05ZGqhhi9qZ9Y+hUODVM X-Gm-Message-State: AOJu0YwwSfRRfhXoJvIrSgOMb9IcAkkg47l25/11P0SB7TkwcEbXdm12 BLvhpAZsjNIJn+Fdh0ThVTAVFCViZJ/xCNFXStw+ND0lnf54eR1BW/ZQhLyGX0E= X-Google-Smtp-Source: AGHT+IFodRA7wtJWYqOP42HP+r2Eadd15Zax69RlOlDxQZO9sG316AaJi09FuIzx3GCZSw504C4ZBw== X-Received: by 2002:a19:8c1e:0:b0:52b:8280:8c10 with SMTP id 2adb3069b0e04-52b8956b5b3mr4664626e87.18.1717364395030; Sun, 02 Jun 2024 14:39:55 -0700 (PDT) Received: from umbar.lan ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-52b84d3f648sm1021563e87.73.2024.06.02.14.39.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 02 Jun 2024 14:39:54 -0700 (PDT) From: Dmitry Baryshkov Date: Mon, 03 Jun 2024 00:39:51 +0300 Subject: [PATCH v2 5/9] drm/msm/dpu: check for the plane pitch overflow MIME-Version: 1.0 Message-Id: <20240603-dpu-mode-config-width-v2-5-16af520575a6@linaro.org> References: <20240603-dpu-mode-config-width-v2-0-16af520575a6@linaro.org> In-Reply-To: <20240603-dpu-mode-config-width-v2-0-16af520575a6@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=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBmXOal57sL8VMNXDeoG/fMtixB373FIQWN8gw/p Jsq7M8PeNyJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZlzmpQAKCRCLPIo+Aiko 1SS8B/9IvoUaga2Nmr6zLxDaPC0Pc/bQ9umyzktyaqzhu5FrXAUTstXPTkXN/Vvvm4IgHL7Oifm WcQeu9aesYxb/ZJPQ9o8vy36CGWa35+aCrBfj8HB9h/IHRsCXNKIZGdKg9TzZi4bnYOuSAnGiae roe0B46ZN0KiaM5s0ZS916amsyfzrXGBUTq5YkK6vWozKe4spG4H/JLLyrGee8y91BOfhjj5UtR dpDVLc3WUp65moHflX0M1QkiW6L/w9O/SKw8QQZ/Im24w8SS84aULi/YwCxDO1SP3DdHux9xecx 98Aj0bzISAffMSqrXlRQ6NhYl61qevbjcTGXb7aPmBYGevrW 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 --- 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 Sun Jun 2 21:39: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: 13683096 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 D3C49C27C44 for ; Sun, 2 Jun 2024 21:40:14 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id BA34F10E0E8; Sun, 2 Jun 2024 21:40:00 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="YRM/SSxi"; dkim-atps=neutral Received: from mail-lf1-f44.google.com (mail-lf1-f44.google.com [209.85.167.44]) by gabe.freedesktop.org (Postfix) with ESMTPS id C152C10E0DB for ; Sun, 2 Jun 2024 21:39:57 +0000 (UTC) Received: by mail-lf1-f44.google.com with SMTP id 2adb3069b0e04-5295eb47b48so4178323e87.1 for ; Sun, 02 Jun 2024 14:39:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1717364396; x=1717969196; 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=phfbeBe/wHZzaldGp3CTSm4jkvtTaBdaWvDYoOuNwVE=; b=YRM/SSxivLp3CJbt+JViMHeOkpwAgPXYPQf89YvCM/wiJwRv7AA4Z0kXutQAS8rzT+ Yj8LGXa0ZehLmPov7Z78wSQ4hx+5RdH75FPRBkxnZiAyeqT54jITwoFlDNth4jQlwEoK Z3n7tbxNN4i6KDTOJmPNsYxgzJ57ObSYboGLjOy1YONHo8OUdzzN2k7JrGaSQeWZjIvd +YF94oPeqz89UxaClJKPr5JnrosKwOYeO1WWMG8TZ0HU8W1ILCTmXcJ/Eqphcebhjy53 e/Nhdw1qbwybd2GBpjPVOJa7PuqDMzyu32124c4rQAqUlOPdUN8HmB4SlzJV1PMI71i3 ri1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717364396; x=1717969196; 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=phfbeBe/wHZzaldGp3CTSm4jkvtTaBdaWvDYoOuNwVE=; b=S5Ynv6PGlqLBkd+W4C6f9RIXpqLI0t2Rsai/WDvJEl88GTHtnwZqXYK0z+iuif4I7w 6QgKQmvMdh2ofWXdPKWI0x36M3s0TEjVDAG0/VxIrsttizfZZYpLvIlYO+LDDkimHDML NsSoY9DDljUGNHU8CWeL4BKL/vMppOssLq0YqGFtiL5zb8NaTI28JsuiHHYkNQXhUw4a YNSWXhsOWbUOSKGsIsSiluVO0pzBowMSg9WllNPf4tzfiIBwZl56lTmlPswiv48nx6Hq 9tF1w3LRW8jSyD8JhPOeZpm0reEWVxyp6cIXellGZMH+bjULhzozakyZJP7Z7DoFASqZ q0bA== X-Forwarded-Encrypted: i=1; AJvYcCXa5D9VU1s1z+ujXcx34KFrUh+UIxhviOxZZvghQagXhkDjadKdOT8ysgiHkieYeltwx+L5rSof6f4e3aJJmf3n9Fh2gi+o//kYutpyKgXC X-Gm-Message-State: AOJu0YwwqX+r9K4aOK4QTKa/kefHKFXlXESeN3pMvpf+3JC9/st0QHCN 3sVPuaWqBAppeks0UZeusoYbWDTirWMrcWw7c/soHR23JXIpcNP/LOwbjz+TzSs= X-Google-Smtp-Source: AGHT+IGxRw+MhZXwLFb5hrNZP2u+vz4lRcl9eHFkm0LNpEaolt2v0LY1NkMZg/P1qibIuuIkHVUuAA== X-Received: by 2002:a19:7403:0:b0:523:b272:c73 with SMTP id 2adb3069b0e04-52b89569542mr4347003e87.7.1717364395710; Sun, 02 Jun 2024 14:39:55 -0700 (PDT) Received: from umbar.lan ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-52b84d3f648sm1021563e87.73.2024.06.02.14.39.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 02 Jun 2024 14:39:55 -0700 (PDT) From: Dmitry Baryshkov Date: Mon, 03 Jun 2024 00:39:52 +0300 Subject: [PATCH v2 6/9] drm/msm/dpu: drop call to _dpu_crtc_setup_lm_bounds from atomic_begin MIME-Version: 1.0 Message-Id: <20240603-dpu-mode-config-width-v2-6-16af520575a6@linaro.org> References: <20240603-dpu-mode-config-width-v2-0-16af520575a6@linaro.org> In-Reply-To: <20240603-dpu-mode-config-width-v2-0-16af520575a6@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=893; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=7R5XEZiZYJZfV3EIl1ZYgtEVpBJ16B4QkvSZSHsPzGA=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBmXOalI8O2Gf9SxPwCXo1gr5Krf6S3U1zjqsmVd jLGSJZ+Jm2JATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZlzmpQAKCRCLPIo+Aiko 1fOEB/4g7Qy70gGV6VTyC8hNhK+NYtc6tOoGcIm0WmQZhwToK8OfvQ9J4VMZn0xxqYJvKLLrGt4 9zfYGnpuYD8LKcpDlqmi70GSz/E49iYgwoh4IjJWAg+rxSUikIkWyJjDfFRY0KTtMUxzXrToRni R6EcAlwQnPscsCRBjgsOIRTwS7F4czKxDMnRAWoMUkQF5oGN8wG6oRTUvAn+VTQaS5D9947SX7s kauLgM5n5CwnXNCFChuvJRxxcNKu01o0e6z3RhErUr4SOF7p5UJ3eJCvd5vgH5TCC9+1iq7MOsB NEXyWBfv7jBiO30j+QlkPqtd7uqNmrfWMfwk8zg5Wrr4rm0V 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 _dpu_crtc_setup_lm_bounds(). There is no need to call it 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 9f2164782844..e3b1e5f55a92 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c @@ -803,8 +803,6 @@ 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); - /* 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 Sun Jun 2 21:39:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13683097 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 B952BC25B74 for ; Sun, 2 Jun 2024 21:40:16 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D8BF210E196; Sun, 2 Jun 2024 21:40:13 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="YBN8Ntsn"; dkim-atps=neutral Received: from mail-lf1-f50.google.com (mail-lf1-f50.google.com [209.85.167.50]) by gabe.freedesktop.org (Postfix) with ESMTPS id 6055710E0E8 for ; Sun, 2 Jun 2024 21:39:58 +0000 (UTC) Received: by mail-lf1-f50.google.com with SMTP id 2adb3069b0e04-52b92e73e2fso1549896e87.2 for ; Sun, 02 Jun 2024 14:39:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1717364396; x=1717969196; 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=JUUdtGcMBRz5mB58GbECTLRyDS/sCIhf8D+cG1hOc6E=; b=YBN8NtsnbQi8qVXp2TPWYKcrbWDO8YNrieaB412A74nD1HpNRXnb+bCeEQb5zMBgsG fZWp55Jld1L8ZgwsrLK9ldXWJHgBPgd2Oc750/Yp152TDw/LVPAHC0mCkQ3+VDyPh8vu igKKpguJ2fsuI5Qqd+HrAeGVWO9Gq39yFUk85XcSORKchwzV0xfzmWs9y2Ax8hBCI2vD YGKGSq0I2YssuPkvX3gsALsUKjJ/VWA+Qj2aOrD3h9oauCI/hq0wlyk4hb1vKBGWsJ4Y GFsz5eKgUi+lvRYP4HYhNpkV/yzRn3mUy4G+GMt0KCee8gFIowsyWIriQEqo9oVj2JzO ip4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717364396; x=1717969196; 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=JUUdtGcMBRz5mB58GbECTLRyDS/sCIhf8D+cG1hOc6E=; b=CO2EwDUY1hs7FKe2sdCvyrSuK8NzaaiXdJlJkhLasfaZKQjIFr4GiQ2Iid1/1u2T0f Y2mgDgL4GI/Up+BFklC+bwlPvYSxmk+keQ2OM8pDd6MxGNHIIeIUtjO1bMq5VrSOacP4 B2IwErSSpcANASV24YfMxh5fst738434LTVBtJOvuqgficffNAp5vo754mIXt9uux11E pHrlUQGYYP0uAbwpm6nG0W0RXXTCWq9PyCu/U5d9UfMFRr8wda/QvWyuRTE3ENFI7qH5 VUJHwYVAte8a1KybW+QsYxy65y85oOYm5oV5N9+aTBX0w/Oe+sjc3daayc0NNUtPNBB3 qFUg== X-Forwarded-Encrypted: i=1; AJvYcCXFVf8ssR+IcvZfVCP/UtxRvOAa5y5Ai9Gpp627e/BMCnBDizoktjECQqTb1E7nAoC3g7qdw5qt/3BmVXs7AB7udSr+T8WovyiBkRK3ZPmx X-Gm-Message-State: AOJu0YwOz0En5zsUhrv9uSVz5bAYyJdFElJSY5lKq4Rg8Yyr1BnemtO1 xjwQkjbLGwjI4K6nlkNcpd31B2i7Q7BiSgTAeg+KaaFubxpKsraT2/9qhBp3t/A= X-Google-Smtp-Source: AGHT+IERKRhebLd0DtZWfojK8IucTmKmWzvBp99C1cHcHY5sB2GB/oyBCAAz99JJzRgoGrv0DkVShw== X-Received: by 2002:a19:7508:0:b0:523:48f2:e3fd with SMTP id 2adb3069b0e04-52b8956b5f5mr4551111e87.16.1717364396401; Sun, 02 Jun 2024 14:39:56 -0700 (PDT) Received: from umbar.lan ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-52b84d3f648sm1021563e87.73.2024.06.02.14.39.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 02 Jun 2024 14:39:56 -0700 (PDT) From: Dmitry Baryshkov Date: Mon, 03 Jun 2024 00:39:53 +0300 Subject: [PATCH v2 7/9] drm/msm/dpu: check for overflow in _dpu_crtc_setup_lm_bounds() MIME-Version: 1.0 Message-Id: <20240603-dpu-mode-config-width-v2-7-16af520575a6@linaro.org> References: <20240603-dpu-mode-config-width-v2-0-16af520575a6@linaro.org> In-Reply-To: <20240603-dpu-mode-config-width-v2-0-16af520575a6@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=1950; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=fxq7vANQU/H+21S6fq9RrLi0S38AJrmn17I2cOqu7a0=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBmXOalNHFtJfQwnpk7w7QKXCOSLvuRdnL1hc3VK 9mBYppZ23aJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZlzmpQAKCRCLPIo+Aiko 1VUwB/48+an/TqOGKy4wHXt7deIegErq3Uk6r3EcdLqx4Yeh0/2cEv+vkhdfgAAzHwyoFl9srKh fnDk04zzpLg6mCwOqHn+KNkq33EbVjt8QgE5WV3/c1kfoflAqswrtPYTHGsy8bBv513jKaXC+K/ ZlPXB5qLHpOzAIA9YL9ASp2OPZf8xxexoiPgMzu/YYq9qGssUaOyBG+uggIeiOwLROsrANKHx9z S0LqqVkB2tfhlB45gqEztPnzw57zWSRPCGAK0ST2vAwW3pf6r0P+t/70Gss95q1LK1hMdSVFmHD nqAsXsCMpVbYoipvspdq9WTgw2gRJ7iQLF3cC0rMgPRJ+GoE 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 in _dpu_crtc_setup_lm_bounds() that CRTC width is not overflowing LM requirements. Signed-off-by: Dmitry Baryshkov Reviewed-by: Abhinav Kumar --- drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c index e3b1e5f55a92..c5e874a3656a 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_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, @@ -1195,8 +1201,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_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 Sun Jun 2 21:39: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: 13683098 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 17D5FC25B74 for ; Sun, 2 Jun 2024 21:40:37 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D96DB10E094; Sun, 2 Jun 2024 21:40:34 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="Y0V4EYIm"; dkim-atps=neutral Received: from mail-lf1-f41.google.com (mail-lf1-f41.google.com [209.85.167.41]) by gabe.freedesktop.org (Postfix) with ESMTPS id D302510E0E8 for ; Sun, 2 Jun 2024 21:39:58 +0000 (UTC) Received: by mail-lf1-f41.google.com with SMTP id 2adb3069b0e04-52b950aa47bso1238002e87.1 for ; Sun, 02 Jun 2024 14:39:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1717364397; x=1717969197; 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=Y0V4EYImn3oLPEl/9OQ2LHNYN8eTCWxv8XmF8hvmZk39kjovO8AkroQwBImg4ro8w9 eDsJ5BsHXsIt+cy5V81rFEvKQPxkxK9Y8tQ8yJa3v7Svc+fenikg0VWOFI6k3vtp7mCS 4HLxU15C4kX9K7TSxXaGaCJTj/Y+1qIDOtuwi2tx3xU2USkoOp1m3SN+PWHt0NceLcls 1SWl14g5RJP1M4f/db3Sl/FprrcPPjwQCjFXcFDuNutONjI80seu5bIiJDuhzioQO1/b OtrdaedTWzRto/TA8uea7xM/Lyjrm4W6djoJgjAeESgcrh9U4MhHnq6EsmXl+IBQfPzB BVjQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717364397; x=1717969197; 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=roeU+mzJNp/BBjSGc939eSHU/zdWOxXoyXHW1eEVRDmLaDC68uCv+5lNWEotPVgD88 NxkTzePQfP7+jydLDnP0FLHoj6d9SNcehoFxb+aZXTCePoPzczT6o+/S+PHZqFBevwDK HFlPFEM+qyvrRt8Rp8p6k2M8qF1O2lYc3eVKsZKHpf4cDF8/1RxLrxyeWVARQsAaYNFc 0wWgbWMcw2+PH+KBAZGN7ldcby1bxJ5ypWgbyctxOr2Ur4yQVbp3Qox3fjU7w5RjyiLz W9zl78X2N3u7U7fHr7paq591jQM4FenZbJDYydQTkzDl5wcbrottghsn3bYp3SxzRyqt R2PQ== X-Forwarded-Encrypted: i=1; AJvYcCVaaBVvZPVHOHVsRk8cIJGSmvbBe9w7B1JViHGKeRfl3tQYX+wlWlLuaRKJbt1ICy4dDn8BK5UvuKJu4rvEv5Lxuw6nOzZQnq0mF4MXTHqX X-Gm-Message-State: AOJu0YwaUz0wKktMh2fIHa5t7VeVa3VIoQ1ADX3jGxNmeJvuJLEiKoUS I9Uf7tvuQMDpqnunThY6lXL9JDZHYqdjQoMhxDEAXeGyIqvCEb1ZnxLzCuz6T6k= X-Google-Smtp-Source: AGHT+IHz60PkWKk1NRMpJcn8TjxRZTtqgum1tGKy+1VleEMZYuUYgpb3OZofDSjCZ7qHmtMWyzKO+A== X-Received: by 2002:a05:6512:3592:b0:523:87b6:2ac2 with SMTP id 2adb3069b0e04-52b896bfd01mr4266965e87.40.1717364397106; Sun, 02 Jun 2024 14:39:57 -0700 (PDT) Received: from umbar.lan ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-52b84d3f648sm1021563e87.73.2024.06.02.14.39.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 02 Jun 2024 14:39:56 -0700 (PDT) From: Dmitry Baryshkov Date: Mon, 03 Jun 2024 00:39:54 +0300 Subject: [PATCH v2 8/9] drm/msm/dpu: merge MAX_IMG_WIDTH/HEIGHT with DPU_MAX_IMG_WIDTH/HEIGHT MIME-Version: 1.0 Message-Id: <20240603-dpu-mode-config-width-v2-8-16af520575a6@linaro.org> References: <20240603-dpu-mode-config-width-v2-0-16af520575a6@linaro.org> In-Reply-To: <20240603-dpu-mode-config-width-v2-0-16af520575a6@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/pANAwAKAYs8ij4CKSjVAcsmYgBmXOalyn6cTyjM6xpyhZWng8UYIofhWpakKWUPq +h2aXcd8dGJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZlzmpQAKCRCLPIo+Aiko 1fDYB/9fA+ZSwXraqbAljD5cg9JXqZZRR+1Gw+8Ov7NP/tRx8yN/hIMDapaQRnCPWZ+UO9k8bdc NHLyrtOpm1iHwR1mom4Ytm1dJpPUXQiQJCr4nxGJlgI5GZNZJDdSDiSHu1TwJuJyyFFzTimHvQr imzVFisFINLY28RRPLMdktZJpKKQzOOvxFl4lOU6tC6CzNhAfx2APRUCMKbZoyiysCUYVUzliVz I/10D4b86ZIG84BgJIGnPJXxYR4bAp1IHYY5FJkUXFvn8s58hNjYq5691UlhCdr7TAc7l8rTuEE Ufnlyam2nISIKlakzFPbc696wveo6RXXvAGr000Bw7tFrnEV 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 --- 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 Sun Jun 2 21:39:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13683099 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 7CF34C25B74 for ; Sun, 2 Jun 2024 21:40:40 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id EBDF510E1BC; Sun, 2 Jun 2024 21:40:38 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="NI+3vyEf"; dkim-atps=neutral Received: from mail-lf1-f41.google.com (mail-lf1-f41.google.com [209.85.167.41]) by gabe.freedesktop.org (Postfix) with ESMTPS id 8BA0B10E168 for ; Sun, 2 Jun 2024 21:39:59 +0000 (UTC) Received: by mail-lf1-f41.google.com with SMTP id 2adb3069b0e04-52b7ffd9f6eso3408188e87.3 for ; Sun, 02 Jun 2024 14:39:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1717364398; x=1717969198; 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=Qp9FZ/KZqeOjUAWYJu0Xh72B89CvM0oCuzm0aVvXT1M=; b=NI+3vyEfHriqBqZqZ6oNFJs8Vr5GCJblsP1rzF7F1pD6laDP7VgLbRsAhVSlNlo07m CfKSZjLV2G4pbfhL+RdnRMFW8HQGXr/Ios5Uq/mfMdUl1ylV4u7ZSMXf6eKEQKygvhwH +rdeA+/UGoSepIrdTpKYJUtv+BMj6qGiM/e/48QAa+vpuiJQ4tqjiF4sIG4EGRgzBYjk uU2Jco8wNQ2LdGeRln9fi/Jq/kLDcn97KKhrWcY+bxmqKQIV1Cwtb1D1zct9qb50PG8L +5c1IAtufevfY26DeYu/CxWFrkL5EMRKRthR6U+YUIeEYrxDLE0ipJYY9YANMQIQsfen 8ADA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717364398; x=1717969198; 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=Qp9FZ/KZqeOjUAWYJu0Xh72B89CvM0oCuzm0aVvXT1M=; b=Y3bHLwimipxak5Cs+O+narS2GVLQYvM7OczvL3CCwu/iBtcjJlqLbuu9H4YMzhGFJ1 0msipsv64hXAGC4DqOs3jjRoXlF64wrHK3yWzWTI+PsgdbLq7fCjIULlmjNJjUGHbwlk sRDhUKRLgek8kLf7XevnTKHnbuV5bpY3BSWbmlckoEJJ6V35hjuEM7L5ypLOCrzBSkuZ vHsk57pQXCjiSdsJvnFKfFk06tes/zn41IBu43ea7xRK+CiV6MtnITU3juMjFOCQUuJo ZypeODGXM7cnKqDxTw09qHtyF9wVG8JsHpLqfk4KuWVhik2N/TFEGgBPKC5pUXzeMoF+ pXCw== X-Forwarded-Encrypted: i=1; AJvYcCWIW/5oRTPTv8IgBEDPUiZHs3C/p5Insqc9kfSOuQ37aGtaCm/NzuR2JhWwdEXuXhwfC2X/3mUoOa5bYEK2VBfDkXBbRqGY2DxpriuNJJ54 X-Gm-Message-State: AOJu0YxEOtKgrhhKvyytX1mJcBe7zkq3fqZ7oSPT/0yunvWFl2xGMlm6 j75ed+3BAigH+W3x7TZrsPh8HWHfUqhBhWPvBfntQ5Zqu5VQGOr7C2/Pvi00TLA= X-Google-Smtp-Source: AGHT+IEAwm0w8+Z8Ipt9kYIObuKscTEAB+n6TxakwofZucyV59zCcLs50ECCLJ2Qdyb4B8ImhnL9MA== X-Received: by 2002:ac2:5059:0:b0:51f:5760:dd34 with SMTP id 2adb3069b0e04-52b896c210emr4440368e87.55.1717364397772; Sun, 02 Jun 2024 14:39:57 -0700 (PDT) Received: from umbar.lan ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-52b84d3f648sm1021563e87.73.2024.06.02.14.39.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 02 Jun 2024 14:39:57 -0700 (PDT) From: Dmitry Baryshkov Date: Mon, 03 Jun 2024 00:39:55 +0300 Subject: [PATCH v2 9/9] drm/msm/dpu: sync mode_config limits to the FB limits in dpu_plane.c MIME-Version: 1.0 Message-Id: <20240603-dpu-mode-config-width-v2-9-16af520575a6@linaro.org> References: <20240603-dpu-mode-config-width-v2-0-16af520575a6@linaro.org> In-Reply-To: <20240603-dpu-mode-config-width-v2-0-16af520575a6@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=2423; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=jidBMydco/5DfITBWsZBXtE9R50V90I/Z1ZObhQMr4Y=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBmXOam196bo+wcCbur0w0TxnWzapo7bLGi8eHyh 1s1b/+FagWJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZlzmpgAKCRCLPIo+Aiko 1QGsB/4jqxWpfJt2CtymybHgjeXtamR2wwkPVI7lUOVx/6tFVCh/kFSjNQIvSNTrSAjGc9raLAY UzV2uXTJfHj47KMauiF0MIRILFtI+NYgJI20prq1qL8LRbIg8objny7nkKq4yaOGSkg4uBJWhyA dh8N6h6TgMhkjfn6RDK35RDnSB11cx8scH66TxthrzPUZp+UDcXGV6pffQ2L3Sc9+iVH1k90Yip sdavL0VRZ0jggtaQLBIJ9D4b9qUQkAwMAjKxYVlXFLjYQI6XKd7DEeQ0nr21OmHY91VdzCeCfBM LBuZ5quRWDiK7bjYJR/KO0Rt5YKuICjTSHHzbBU1drr9ANYC 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 --- 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 c5e874a3656a..8cf063e4c09d 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; } +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 */