From nobody Sat Feb 7 22:34:25 2026 Received: from out-171.mta0.migadu.com (out-171.mta0.migadu.com [91.218.175.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5851233B6E9 for ; Tue, 6 Jan 2026 16:43:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.171 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767717793; cv=none; b=ibqy3djQzBCsMrFulHaDGPpx4+m+1PyPy6zu3Iu8A3rmsX17DOCrwo8EryRuYiC2jlpNV+agyZf/mThYYqbx77lBD9EYp6nbOlP/sMW8bW+7KezONkVc4MbRqKZI7lAXCNbm/fIcU3nVsHC9om2odP+pfAKCcMRqCyi0ng4nwG8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767717793; c=relaxed/simple; bh=4YP7zZNIo6r3ktztyTue65PyGnR9CBO8PU3IxNnomok=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=nhM7ZlSNor0jNNizZYS1XDU36VO4Xu+jYU2Hlq0Tq8sEY1w31JmOdn2Ztbff2OeYP/fCo6d071y68M3aD8mOoEbI8IDd4fBguWq5Tbcm78GdDD2GvsrwCE7pbhtV5ufaLRVHromwKp/dqdPk/TyKRONc23souR8xCAsAUcxsa8o= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=voJExWmW; arc=none smtp.client-ip=91.218.175.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="voJExWmW" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1767717787; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=mg7xkbHFiTIb0EaR99sjUoEZxLHlfxayhWVLcb8JQa0=; b=voJExWmWZY5vC6VbAcLmlBLrCr4D94NwTF9ZPM+per4kzkPBJemnjZ/LZOZuUewG61cifF hwkQ33GQD6sKWCDTgoMBFSoZXpjLBtL80KXNKCrGpHj5TvK3P5epXj9JBoip57EElyfbmA aDdzUb9jfv0CDGNdu9FwUqcGHG+qkS0= From: Sean Anderson To: Laurent Pinchart , Tomi Valkeinen , dri-devel@lists.freedesktop.org Cc: Simona Vetter , Thomas Zimmermann , linux-kernel@vger.kernel.org, Maxime Ripard , David Airlie , linux-arm-kernel@lists.infradead.org, Michal Simek , Anatoliy Klymenko , Maarten Lankhorst , Mike Looijmans , Sean Anderson Subject: [PATCH v2 1/4] drm/drm_blend: Allow specifying blend mode default Date: Tue, 6 Jan 2026 11:42:44 -0500 Message-Id: <20260106164247.472544-2-sean.anderson@linux.dev> In-Reply-To: <20260106164247.472544-1-sean.anderson@linux.dev> References: <20260106164247.472544-1-sean.anderson@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Migadu-Flow: FLOW_OUT Content-Type: text/plain; charset="utf-8" Not all devices support pre-multiplied blend mode. In these cases, userspace cannot expect this mode to be the default, since the hardware cannot produce it (and could not default to it before a blend mode property existed). Therefore, add a variant of drm_plane_create_blend_mode_property that allows specifying the default. Signed-off-by: Sean Anderson --- Changes in v2: - New drivers/gpu/drm/drm_blend.c | 22 ++++++++++------------ include/drm/drm_blend.h | 26 ++++++++++++++++++++++++-- 2 files changed, 34 insertions(+), 14 deletions(-) diff --git a/drivers/gpu/drm/drm_blend.c b/drivers/gpu/drm/drm_blend.c index 6852d73c931c..fac0f1478385 100644 --- a/drivers/gpu/drm/drm_blend.c +++ b/drivers/gpu/drm/drm_blend.c @@ -546,12 +546,10 @@ int drm_atomic_normalize_zpos(struct drm_device *dev, EXPORT_SYMBOL(drm_atomic_normalize_zpos); =20 /** - * drm_plane_create_blend_mode_property - create a new blend mode property + * drm_plane_create_blend_mode_default - create a new blend mode property * @plane: drm plane - * @supported_modes: bitmask of supported modes, must include - * BIT(DRM_MODE_BLEND_PREMULTI). Current DRM assumption is - * that alpha is premultiplied, and old userspace can break if - * the property defaults to anything else. + * @supported_modes: bitmask of supported modes, must include BIT(@def) + * @def: Default blend mode * * This creates a new property describing the blend mode. * @@ -571,11 +569,11 @@ EXPORT_SYMBOL(drm_atomic_normalize_zpos); * pre-multiplied and will do so when blending them to the background color * values. * - * RETURNS: - * Zero for success or -errno + * Return: Zero for success or -errno */ -int drm_plane_create_blend_mode_property(struct drm_plane *plane, - unsigned int supported_modes) +int drm_plane_create_blend_mode_default(struct drm_plane *plane, + unsigned int supported_modes, + unsigned int def) { struct drm_device *dev =3D plane->dev; struct drm_property *prop; @@ -590,7 +588,7 @@ int drm_plane_create_blend_mode_property(struct drm_pla= ne *plane, int i; =20 if (WARN_ON((supported_modes & ~valid_mode_mask) || - ((supported_modes & BIT(DRM_MODE_BLEND_PREMULTI)) =3D=3D 0))) + !(supported_modes & BIT(def)))) return -EINVAL; =20 prop =3D drm_property_create(dev, DRM_MODE_PROP_ENUM, @@ -615,9 +613,9 @@ int drm_plane_create_blend_mode_property(struct drm_pla= ne *plane, } } =20 - drm_object_attach_property(&plane->base, prop, DRM_MODE_BLEND_PREMULTI); + drm_object_attach_property(&plane->base, prop, def); plane->blend_mode_property =3D prop; =20 return 0; } -EXPORT_SYMBOL(drm_plane_create_blend_mode_property); +EXPORT_SYMBOL(drm_plane_create_blend_mode_default); diff --git a/include/drm/drm_blend.h b/include/drm/drm_blend.h index 88bdfec3bd88..244f0694d0a5 100644 --- a/include/drm/drm_blend.h +++ b/include/drm/drm_blend.h @@ -56,6 +56,28 @@ int drm_plane_create_zpos_immutable_property(struct drm_= plane *plane, unsigned int zpos); int drm_atomic_normalize_zpos(struct drm_device *dev, struct drm_atomic_state *state); -int drm_plane_create_blend_mode_property(struct drm_plane *plane, - unsigned int supported_modes); +int drm_plane_create_blend_mode_default(struct drm_plane *plane, + unsigned int supported_modes, + unsigned int def); + +/** + * drm_plane_create_blend_mode_property - create a new blend mode property + * @plane: drm plane + * @supported_modes: bitmask of supported modes, must include + * BIT(DRM_MODE_BLEND_PREMULTI). Current DRM assumption is + * that alpha is premultiplied, and old userspace can break if + * the property defaults to anything else. + * + * This creates a new property describing the blend mode. See + * drm_plane_create_blend_mode_default() for details. + * + * Return: Zero for success or -errno + */ +static inline int +drm_plane_create_blend_mode_property(struct drm_plane *plane, + unsigned int supported_modes) +{ + return drm_plane_create_blend_mode_default(plane, supported_modes, + DRM_MODE_BLEND_PREMULTI); +} #endif --=20 2.35.1.1320.gc452695387.dirty