From: Gustavo Piaz Da Silva <gustavopiazdasilva2102@gmail.com>
To: dri-devel@lists.freedesktop.org
Cc: maarten.lankhorst@linux.intel.com, mripard@kernel.org,
tzimmermann@suse.de, airlied@gmail.com, simona@ffwll.ch,
linux-kernel@vger.kernel.org,
Gustavo Piaz Da Silva <gustavopiazdasilva2102@gmail.com>
Subject: [PATCH 1/1] drm/blend: size zpos array to active planes instead of total
Date: Thu, 30 Apr 2026 21:13:00 -0300 [thread overview]
Message-ID: <20260501001301.7666-2-gustavopiazdasilva2102@gmail.com> (raw)
In-Reply-To: <20260501001301.7666-1-gustavopiazdasilva2102@gmail.com>
drm_atomic_helper_crtc_normalize_zpos() allocates a temporary
array with num_total_plane entries, which is the total number of
planes registered across the entire DRM device. However, the
function only processes planes active on the given CRTC, as
described by crtc_state->plane_mask.
Replace num_total_plane with hweight32(crtc_state->plane_mask),
which counts exactly the planes that drm_for_each_plane_mask will
visit. This ensures the allocation is sized precisely for the work
being done, reducing memory pressure on devices where
num_total_plane is significantly larger than the number of active
planes per CRTC.
Signed-off-by: Gustavo Piaz Da Silva <gustavopiazdasilva2102@gmail.com>
---
drivers/gpu/drm/drm_blend.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/drm_blend.c b/drivers/gpu/drm/drm_blend.c
index 1f3af27d2418e..ffa1870528726 100644
--- a/drivers/gpu/drm/drm_blend.c
+++ b/drivers/gpu/drm/drm_blend.c
@@ -465,7 +465,7 @@ static int drm_atomic_helper_crtc_normalize_zpos(struct drm_crtc *crtc,
{
struct drm_atomic_state *state = crtc_state->state;
struct drm_device *dev = crtc->dev;
- int total_planes = dev->mode_config.num_total_plane;
+ int total_planes = hweight32(crtc_state->plane_mask);
struct drm_plane_state **states;
struct drm_plane *plane;
int i, n = 0;
--
2.43.0
next prev parent reply other threads:[~2026-05-01 7:10 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-01 0:12 [PATCH 0/1] drm/blend: size zpos array to active planes instead of total Gustavo Piaz Da Silva
2026-05-01 0:13 ` Gustavo Piaz Da Silva [this message]
2026-05-04 23:43 ` Claude review: " Claude Code Review Bot
2026-05-04 23:43 ` Claude Code Review Bot
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=20260501001301.7666-2-gustavopiazdasilva2102@gmail.com \
--to=gustavopiazdasilva2102@gmail.com \
--cc=airlied@gmail.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mripard@kernel.org \
--cc=simona@ffwll.ch \
--cc=tzimmermann@suse.de \
/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