From: Lyude Paul <lyude@redhat.com>
To: nouveau@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
linux-kernel@vger.kernel.org
Cc: "Faith Ekstrand" <faith.ekstrand@collabora.com>,
"Dave Airlie" <airlied@redhat.com>,
"Leandro Ribeiro" <leandro.ribeiro@collabora.com>,
"Maarten Lankhorst" <maarten.lankhorst@linux.intel.com>,
"Marco Crivellari" <marco.crivellari@suse.com>,
"Kees Cook" <kees@kernel.org>, "Simona Vetter" <simona@ffwll.ch>,
"Pekka Paalanen" <pekka.paalanen@collabora.com>,
"David Airlie" <airlied@gmail.com>,
"Thomas Zimmermann" <tzimmermann@suse.de>,
"Maxime Ripard" <mripard@kernel.org>,
"Danilo Krummrich" <dakr@kernel.org>,
"Jani Nikula" <jani.nikula@intel.com>,
"Daniel Stone" <daniels@collabora.com>,
"James Jones" <jajones@nvidia.com>,
"Lyude Paul" <lyude@redhat.com>
Subject: [PATCH v3 2/3] drm/nouveau/kms/nv50-: Introduce nv50_wndw_default_state()
Date: Mon, 20 Jul 2026 17:36:17 -0400 [thread overview]
Message-ID: <20260720215058.398210-3-lyude@redhat.com> (raw)
In-Reply-To: <20260720215058.398210-1-lyude@redhat.com>
While we don't currently read-in the hardware state of planes, now that
we're about to start exposing blend properties for all planes that can
support alpha channels: We need to make sure that the initial atomic state
for a wndw always starts off with a supported value in pixel_blend_mode.
The easiest way to do this is to introduce a nv50_wndw_default_state()
function, and use it in nv50_display_read_hw_state() - and use that
function to enforce a valid value for pixel_blend_mode during driver
startup.
Signed-off-by: Lyude Paul <lyude@redhat.com>
Fixes: 860e748bddcc ("drm: ensure blend mode supported if pixel format with alpha exposed")
---
V3:
* Fix incorrect bitmask checking in nv50_wndw_default_state()
drivers/gpu/drm/nouveau/dispnv50/disp.c | 4 ++++
drivers/gpu/drm/nouveau/dispnv50/wndw.c | 22 ++++++++++++++++++++++
drivers/gpu/drm/nouveau/dispnv50/wndw.h | 1 +
3 files changed, 27 insertions(+)
diff --git a/drivers/gpu/drm/nouveau/dispnv50/disp.c b/drivers/gpu/drm/nouveau/dispnv50/disp.c
index 364227f5456f1..2c66e480b5116 100644
--- a/drivers/gpu/drm/nouveau/dispnv50/disp.c
+++ b/drivers/gpu/drm/nouveau/dispnv50/disp.c
@@ -2768,6 +2768,7 @@ nv50_display_read_hw_state(struct nouveau_drm *drm)
{
struct drm_device *dev = drm->dev;
struct drm_encoder *encoder;
+ struct drm_plane *plane;
struct drm_modeset_acquire_ctx ctx;
struct nv50_disp *disp = nv50_disp(dev);
int ret;
@@ -2781,6 +2782,9 @@ nv50_display_read_hw_state(struct nouveau_drm *drm)
nv50_display_read_hw_or_state(dev, disp, nouveau_encoder(encoder));
}
+ drm_for_each_plane(plane, dev)
+ nv50_wndw_default_state(nv50_wndw(plane));
+
DRM_MODESET_LOCK_ALL_END(dev, ctx, ret);
}
diff --git a/drivers/gpu/drm/nouveau/dispnv50/wndw.c b/drivers/gpu/drm/nouveau/dispnv50/wndw.c
index 2635458d52acc..dfa1ba45acd99 100644
--- a/drivers/gpu/drm/nouveau/dispnv50/wndw.c
+++ b/drivers/gpu/drm/nouveau/dispnv50/wndw.c
@@ -848,6 +848,28 @@ static const u64 nv50_cursor_format_modifiers[] = {
DRM_FORMAT_MOD_INVALID,
};
+/*
+ * Setup defaults for the atomic wndw state
+ */
+void
+nv50_wndw_default_state(struct nv50_wndw *wndw)
+{
+ struct nv50_wndw_atom *armw = nv50_wndw_atom(wndw->plane.state);
+ const unsigned int blend_modes = wndw->func->blend_modes;
+
+ drm_modeset_lock_assert_held(&wndw->plane.mutex);
+
+ /* Ensure the plane's atomic state didn't default to a pixel_blend_mode we don't support */
+ if (blend_modes && (!(BIT(armw->state.pixel_blend_mode) & blend_modes))) {
+ if (blend_modes & BIT(DRM_MODE_BLEND_COVERAGE))
+ armw->state.pixel_blend_mode = DRM_MODE_BLEND_COVERAGE;
+ else if (blend_modes & BIT(DRM_MODE_BLEND_PREMULTI))
+ armw->state.pixel_blend_mode = DRM_MODE_BLEND_PREMULTI;
+ else if (blend_modes & BIT(DRM_MODE_BLEND_PIXEL_NONE))
+ armw->state.pixel_blend_mode = DRM_MODE_BLEND_PIXEL_NONE;
+ }
+}
+
int
nv50_wndw_new_(const struct nv50_wndw_func *func, struct drm_device *dev,
enum drm_plane_type type, const char *name, int index,
diff --git a/drivers/gpu/drm/nouveau/dispnv50/wndw.h b/drivers/gpu/drm/nouveau/dispnv50/wndw.h
index 81af5c3369d4c..13f06b7b67611 100644
--- a/drivers/gpu/drm/nouveau/dispnv50/wndw.h
+++ b/drivers/gpu/drm/nouveau/dispnv50/wndw.h
@@ -46,6 +46,7 @@ void nv50_wndw_flush_clr(struct nv50_wndw *, u32 *interlock, bool flush,
struct nv50_wndw_atom *);
void nv50_wndw_ntfy_enable(struct nv50_wndw *, struct nv50_wndw_atom *);
int nv50_wndw_wait_armed(struct nv50_wndw *, struct nv50_wndw_atom *);
+void nv50_wndw_default_state(struct nv50_wndw *wndw);
struct nv50_wndw_func {
int (*acquire)(struct nv50_wndw *, struct nv50_wndw_atom *asyw,
--
2.55.0
next prev parent reply other threads:[~2026-07-20 21:52 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-20 21:36 [PATCH v3 0/3] drm/nouveau: Fix WARN_ON() from missing blend modes Lyude Paul
2026-07-20 21:36 ` [PATCH v3 1/3] drm/nouveau/kms/nv50-: Add .blend_modes to nv50_wndw_func Lyude Paul
2026-07-20 21:36 ` Lyude Paul [this message]
2026-07-20 21:36 ` [PATCH v3 3/3] drm/nouveau/kms/nv50-: Unconditionally create blend_mode prop for wndws Lyude Paul
2026-07-25 3:49 ` [PATCH v3 0/3] drm/nouveau: Fix WARN_ON() from missing blend modes Dave Airlie
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=20260720215058.398210-3-lyude@redhat.com \
--to=lyude@redhat.com \
--cc=airlied@gmail.com \
--cc=airlied@redhat.com \
--cc=dakr@kernel.org \
--cc=daniels@collabora.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=faith.ekstrand@collabora.com \
--cc=jajones@nvidia.com \
--cc=jani.nikula@intel.com \
--cc=kees@kernel.org \
--cc=leandro.ribeiro@collabora.com \
--cc=linux-kernel@vger.kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=marco.crivellari@suse.com \
--cc=mripard@kernel.org \
--cc=nouveau@lists.freedesktop.org \
--cc=pekka.paalanen@collabora.com \
--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
all inboxes | Powered by JetHome®