AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Mario Limonciello <superm1@kernel.org>
To: roman.li@amd.com, amd-gfx@lists.freedesktop.org
Cc: Mario Limonciello <mario.limonciello@amd.com>,
	Luke Jones <luke@ljones.dev>
Subject: [PATCH 1/4] drm/amd/display: Adjust plane init for off by one error
Date: Tue, 21 Jan 2025 07:57:16 -0600	[thread overview]
Message-ID: <20250121135719.2883833-2-superm1@kernel.org> (raw)
In-Reply-To: <20250121135719.2883833-1-superm1@kernel.org>

From: Mario Limonciello <mario.limonciello@amd.com>

The number of active surfaces is initialized to the number
of active planes.  If the number of planes aren't initialized
properly then the last plane can end up not getting initialized
which can be a divide by zero error.

Reported-and-tested-by: Luke Jones <luke@ljones.dev>
Closes: https://gitlab.freedesktop.org/drm/amd/-/issues/3794
Closes: https://gitlab.freedesktop.org/drm/amd/-/issues/3533
Fixes: 7966f319c66d9 ("drm/amd/display: Introduce DML2")
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
---
 drivers/gpu/drm/amd/display/dc/dml2/display_mode_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/display/dc/dml2/display_mode_core.c b/drivers/gpu/drm/amd/display/dc/dml2/display_mode_core.c
index 8dabb1ac0b684..45147b812d7d9 100644
--- a/drivers/gpu/drm/amd/display/dc/dml2/display_mode_core.c
+++ b/drivers/gpu/drm/amd/display/dc/dml2/display_mode_core.c
@@ -6787,7 +6787,7 @@ dml_bool_t dml_core_mode_support(struct display_mode_lib_st *mode_lib)
 		}
 	}
 
-	for (k = 0; k <= mode_lib->ms.num_active_planes - 1; k++) {
+	for (k = 0; k <= mode_lib->ms.num_active_planes; k++) {
 		CalculateBytePerPixelAndBlockSizes(
 								mode_lib->ms.cache_display_cfg.surface.SourcePixelFormat[k],
 								mode_lib->ms.cache_display_cfg.surface.SurfaceTiling[k],
-- 
2.43.0


  reply	other threads:[~2025-01-21 13:57 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-21 13:57 [PATCH 0/4] Correct a series of off by 1 errors in DML and DML2 Mario Limonciello
2025-01-21 13:57 ` Mario Limonciello [this message]
2025-01-21 16:32   ` [PATCH 1/4] drm/amd/display: Adjust plane init for off by one error Harry Wentland
2025-01-21 16:52     ` Mario Limonciello
2025-01-21 13:57 ` [PATCH 2/4] drm/amd/display: Correct off by one errors in DML Mario Limonciello
2025-01-21 13:57 ` [PATCH 3/4] drm/amd/display: Correct some suspect code indentation Mario Limonciello
2025-01-21 13:57 ` [PATCH 4/4] drm/amd/display: Correct off by one errors in DML2 Mario Limonciello

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250121135719.2883833-2-superm1@kernel.org \
    --to=superm1@kernel.org \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=luke@ljones.dev \
    --cc=mario.limonciello@amd.com \
    --cc=roman.li@amd.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox