From nobody Sat Feb 7 21:08:15 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 From nobody Sat Feb 7 21:08:15 2026 Received: from out-183.mta0.migadu.com (out-183.mta0.migadu.com [91.218.175.183]) (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 9901633ADBF for ; Tue, 6 Jan 2026 16:43:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.183 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767717794; cv=none; b=USMr+PMxoPoj6X9PhVpd12rAgzTUBULhVbEHHsc6wGmZ5dTxtluYemlzNuc3mQbBKTtrA3r83c1Ygh2Ykb444zzvGj0x/4LYC+gpS4fjK8mEApcL9INVL3rZlfiKTRIcFWGtmemDKzVtd/M4IXIKCCfUd4HXkIAirV9VehJQe3w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767717794; c=relaxed/simple; bh=GBRSbMM4ky+1LksUqZJFOdJ/OByld7XkJXVDjznOSo8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=sBXTmRmr1KHxyshpnSbSl8uf6dzAAa2pLfzSSeGETEWRzbtRU2slrKKqzu1G1Zrraj4k8o+1oVry+y0GkmoXGOhGUzHl3pEHlWFM6vYzcy3OKORVoZF7FNz4CI9ZF0SP46dyZ3xd/gSjLE75ooQgsNE2jxLVSq7LfUYvnFx0joU= 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=QlTkB4ct; arc=none smtp.client-ip=91.218.175.183 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="QlTkB4ct" 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=1767717790; 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=NkZs5zdh+IB8LwYC9eN3BRgGph4b858iwLQZ9mtjEw0=; b=QlTkB4ctl3Lk0JPk81oKR5iSzGxZW6KC9kuKtr3fVp0v+CQs0/y5iLS72FMldN2n3pHMdL nn69V2rcdReXOmRpOgbJgGFsHnF05pmgFzmCHd5iGVYjhZfeHFSu6vsIEK5eFEPzi1CBNi scXS28HikHVHZfRIKuC5Jwzfu43KmCE= 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 2/4] drm: zynqmp: Check property creation status Date: Tue, 6 Jan 2026 11:42:45 -0500 Message-Id: <20260106164247.472544-3-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" Make sure to return an error in the event that we can't create our properties. Fixes: 650f12042b85 ("drm: xlnx: zynqmp_dpsub: Add global alpha support") Fixes: 8c772f0b2b8e ("drm: xlnx: zynqmp_dpsub: Expose plane ordering to use= rspace") Signed-off-by: Sean Anderson Reviewed-by: Anatoliy Klymenko Reviewed-by: Thomas Zimmermann --- (no changes since v1) drivers/gpu/drm/xlnx/zynqmp_kms.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/xlnx/zynqmp_kms.c b/drivers/gpu/drm/xlnx/zynqm= p_kms.c index 02f3a7d78cf8..816bea4ea986 100644 --- a/drivers/gpu/drm/xlnx/zynqmp_kms.c +++ b/drivers/gpu/drm/xlnx/zynqmp_kms.c @@ -175,9 +175,15 @@ static int zynqmp_dpsub_create_planes(struct zynqmp_dp= sub *dpsub) =20 drm_plane_helper_add(plane, &zynqmp_dpsub_plane_helper_funcs); =20 - drm_plane_create_zpos_immutable_property(plane, i); - if (i =3D=3D ZYNQMP_DPSUB_LAYER_GFX) - drm_plane_create_alpha_property(plane); + ret =3D drm_plane_create_zpos_immutable_property(plane, i); + if (ret) + return ret; + + if (i =3D=3D ZYNQMP_DPSUB_LAYER_GFX) { + ret =3D drm_plane_create_alpha_property(plane); + if (ret) + return ret; + } } =20 return 0; --=20 2.35.1.1320.gc452695387.dirty From nobody Sat Feb 7 21:08:15 2026 Received: from out-173.mta0.migadu.com (out-173.mta0.migadu.com [91.218.175.173]) (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 2EFCB33C522 for ; Tue, 6 Jan 2026 16:43:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767717797; cv=none; b=XyLXVjqqi9M4PkHu02LnOgkhFuNlOjbJ2fTdOVoMyq3Snf9OXAKxeFOZYIwvUxAHdOKYKEj0/HutrgUWTgavhkJJkjgWWbX3i4yEmGyWgeHjylkg2zjZndOdiJC02jv6gvB4FKuLdZw5K+vIrCGViu2KYiX+qlXHtuM4kWqEO2g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767717797; c=relaxed/simple; bh=Ngd7eHK43OaDVAykwl8/ldDTdY+xlCIgRRkYLAKVBwE=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=G9tnWNotl8wOM7jpbU4sBNxtojQBHLhguf7rzhNm8Kkfqm4lc7LMG2bi0RungsaekKtuH7+XI0YprLLZEn93+w8GjFkWN7CKS56+WOh9KLFN8sPGtlaTFBfIffKmEjlkItJjFEi2AIiqFWVoE6Xq55gSLG643rwby2yA+lG549g= 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=NgsZzBLI; arc=none smtp.client-ip=91.218.175.173 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="NgsZzBLI" 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=1767717793; 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=195iBqV5eoJAKk9Y2KXt/3tGtboP6oculGGs/M6v76U=; b=NgsZzBLIagpOPtzt9rJ6oVaAeROC8PlfcUaVIPM1qwlX/r2tjDjPNBetjrNl3pesW0kJhY dPFpWJb6puCAcJagVNEnSkRKei483r8hm1uLJsEPJlyyB27sGotn4SJVE41APVhtluCwo4 DHUiWX2bqjtlqAeyqJznEzHh4LqzBI8= 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 3/4] drm: zynqmp: Make the video plane primary Date: Tue, 6 Jan 2026 11:42:46 -0500 Message-Id: <20260106164247.472544-4-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" The zynqmp has two planes: "video" and "graphics". The video plane - Is on the bottom (zpos=3D0) (except when chroma keying as the master plan= e) - Supports "live" input (e.g. from an external source) - Supports RGB, YUV, and YCbCr formats, including XRGB8888 - Does not support transparency, except via chroma keying (colorkey) - Must cover the entire screen (translation/resizing not supported) The graphics plane - Is on the top (zpos=3D1) - Supports "live" input (e.g. from an external source) - Supports RGB and YUV444 formats, but not XRGB8888 - Supports transparency either via - Global alpha channel, which disables per-pixel alpha when enabled - Per-pixel alpha, which cannot be used with global alpha - Chroma keying (colorkey) - Must cover the entire screen (translation/resizing not supported) Currently the graphics plane is the primary plane. Make the video plane the primary plane: - The video plane supports XRGB8888, which is the default 24-bit colorspace for X. This results in improved performance when compared to RGB565. - The graphics plane can be used as an overlay because it has a higher z-pos and supports a per-pixel alpha channel. Unfortunately, clients like weston cannot currently take advantage of this because they expect overlay planes to support translation/resizing. One downside to this approach could be that the graphics plane has worse support for YUV and YCBCr, so it may be more difficult to compose video streams into the window of a media player. However, no existing software could rely on this because there is no way to enable the per-pixel alpha channel when the graphics plane is enabled. This makes it impossible to "carve out" an area in the graphics plane where the video plane shows through. This limitation is addressed in the next patch, but it means we do not need to worry about compatibility in this area. An alternate approach could be to pretend that the graphics plane supports XRGB8888 by using the supported ARGB8888 mode instead and enabling the global alpha channel. However, this would rule out ever using the per-pixel alpha channel. Signed-off-by: Sean Anderson --- (no changes since v1) drivers/gpu/drm/xlnx/zynqmp_kms.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/xlnx/zynqmp_kms.c b/drivers/gpu/drm/xlnx/zynqm= p_kms.c index 816bea4ea986..284acb23c53e 100644 --- a/drivers/gpu/drm/xlnx/zynqmp_kms.c +++ b/drivers/gpu/drm/xlnx/zynqmp_kms.c @@ -162,8 +162,8 @@ static int zynqmp_dpsub_create_planes(struct zynqmp_dps= ub *dpsub) if (!formats) return -ENOMEM; =20 - /* Graphics layer is primary, and video layer is overlay. */ - type =3D i =3D=3D ZYNQMP_DPSUB_LAYER_VID + /* Graphics layer is overlay, and video layer is primary. */ + type =3D i =3D=3D ZYNQMP_DPSUB_LAYER_GFX ? DRM_PLANE_TYPE_OVERLAY : DRM_PLANE_TYPE_PRIMARY; ret =3D drm_universal_plane_init(&dpsub->drm->dev, plane, 0, &zynqmp_dpsub_plane_funcs, @@ -323,7 +323,7 @@ static const struct drm_crtc_funcs zynqmp_dpsub_crtc_fu= ncs =3D { =20 static int zynqmp_dpsub_create_crtc(struct zynqmp_dpsub *dpsub) { - struct drm_plane *plane =3D &dpsub->drm->planes[ZYNQMP_DPSUB_LAYER_GFX]; + struct drm_plane *plane =3D &dpsub->drm->planes[ZYNQMP_DPSUB_LAYER_VID]; struct drm_crtc *crtc =3D &dpsub->drm->crtc; int ret; =20 --=20 2.35.1.1320.gc452695387.dirty From nobody Sat Feb 7 21:08:15 2026 Received: from out-182.mta0.migadu.com (out-182.mta0.migadu.com [91.218.175.182]) (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 34F7733CEBF for ; Tue, 6 Jan 2026 16:43:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.182 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767717799; cv=none; b=eiZqbYV2RAAgu5G2XM73E7WfW47rRuCStYhZBzjsoOv6sbVgShWaxDQcd8Oo9AtOZHrhY90VZAF3A0KCu2FNnuwtykee6MPCcFlydkOl67UQ1K2MYg4UWEvULvVbCP5CUnIkGaLXVumGVOjqDS4EqsvbJ03KaqH9boOdM/tblHY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767717799; c=relaxed/simple; bh=d5/espolCXQ/1T8RPEcnI0FzrqdchcOzM7ZcrIxw5tQ=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=TZVZ0YnABMNaUD4PoZKwBnyA98Izza9KXvD1y8HqwhcQclswSMqnctX/iEIAmtzSrKNjT3opS7h+sbXqxYq4UH65VTPthKKYu8FP3bi8LQ/H7OE3pYBpQEOXzhwNXCfCfcBnH8D8GgAJwn8Vcu+xWdSGZy0Kfy6s9VTrxtGl+x8= 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=hYQwyQJj; arc=none smtp.client-ip=91.218.175.182 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="hYQwyQJj" 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=1767717795; 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=yZw3WZZYm28dE9HQYeQea/Sbj/eWbFcqNoZFr1t7j3E=; b=hYQwyQJjaehQX638QU04nMw0O9SL2XsmknEL14fxotw0BZ3t3e+XOY3BH1fsGpjNFO0Str IPvjbMHyGLvtebPz1PlLPivalacV6q0vdrGhxivOTUkKasCLwF9rZ9tm3a7ZGNreG035jc 4cf0bwTKuv2f1bph4miWnuaA2s5HuYg= 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 4/4] drm: zynqmp: Add blend mode property to graphics plane Date: Tue, 6 Jan 2026 11:42:47 -0500 Message-Id: <20260106164247.472544-5-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" When global alpha is enabled, per-pixel alpha is ignored. Allow userspace to explicitly specify whether to use per-pixel alpha by exposing it through the blend mode property. The reference manual doesn't say whether the per-pixel alpha is pre-multiplied or not, but Anatoliy created a test case that shows alpha is not pre-multiplied [1]. By default alpha is disabled, since this matches the behavior before this patch. [1] https://lore.kernel.org/dri-devel/MW4PR12MB7165CDDB17CF0855EA19AACDE6A6= A@MW4PR12MB7165.namprd12.prod.outlook.com/ Signed-off-by: Sean Anderson --- Changes in v2: - Advertise coverage instead of premulti, since that's what the hardware supports. - Set default blend mode to none since that's what the default was before this series. drivers/gpu/drm/xlnx/zynqmp_kms.c | 35 ++++++++++++++++++++++++++++--- 1 file changed, 32 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/xlnx/zynqmp_kms.c b/drivers/gpu/drm/xlnx/zynqm= p_kms.c index 284acb23c53e..aadba00921c1 100644 --- a/drivers/gpu/drm/xlnx/zynqmp_kms.c +++ b/drivers/gpu/drm/xlnx/zynqmp_kms.c @@ -62,6 +62,13 @@ static int zynqmp_dpsub_plane_atomic_check(struct drm_pl= ane *plane, if (!new_plane_state->crtc) return 0; =20 + if (new_plane_state->pixel_blend_mode !=3D DRM_MODE_BLEND_PIXEL_NONE && + new_plane_state->alpha >> 8 !=3D 0xff) { + drm_dbg_kms(plane->dev, + "Plane alpha must be 1.0 when using pixel alpha\n"); + return -EINVAL; + } + crtc_state =3D drm_atomic_get_crtc_state(state, new_plane_state->crtc); if (IS_ERR(crtc_state)) return PTR_ERR(crtc_state); @@ -118,9 +125,13 @@ static void zynqmp_dpsub_plane_atomic_update(struct dr= m_plane *plane, =20 zynqmp_disp_layer_update(layer, new_state); =20 - if (plane->index =3D=3D ZYNQMP_DPSUB_LAYER_GFX) - zynqmp_disp_blend_set_global_alpha(dpsub->disp, true, + if (plane->index =3D=3D ZYNQMP_DPSUB_LAYER_GFX) { + bool blend =3D plane->state->pixel_blend_mode =3D=3D + DRM_MODE_BLEND_PIXEL_NONE; + + zynqmp_disp_blend_set_global_alpha(dpsub->disp, blend, plane->state->alpha >> 8); + } =20 /* * Unconditionally enable the layer, as it may have been disabled @@ -137,11 +148,18 @@ static const struct drm_plane_helper_funcs zynqmp_dps= ub_plane_helper_funcs =3D { .atomic_disable =3D zynqmp_dpsub_plane_atomic_disable, }; =20 +void zynqmp_dpsub_plane_atomic_reset(struct drm_plane *plane) +{ + drm_atomic_helper_plane_reset(plane); + if (plane->state) + plane->state->pixel_blend_mode =3D DRM_MODE_BLEND_PIXEL_NONE; +} + static const struct drm_plane_funcs zynqmp_dpsub_plane_funcs =3D { .update_plane =3D drm_atomic_helper_update_plane, .disable_plane =3D drm_atomic_helper_disable_plane, .destroy =3D drm_plane_cleanup, - .reset =3D drm_atomic_helper_plane_reset, + .reset =3D zynqmp_dpsub_plane_atomic_reset, .atomic_duplicate_state =3D drm_atomic_helper_plane_duplicate_state, .atomic_destroy_state =3D drm_atomic_helper_plane_destroy_state, }; @@ -180,9 +198,20 @@ static int zynqmp_dpsub_create_planes(struct zynqmp_dp= sub *dpsub) return ret; =20 if (i =3D=3D ZYNQMP_DPSUB_LAYER_GFX) { + unsigned int blend_modes =3D + BIT(DRM_MODE_BLEND_PIXEL_NONE) | + BIT(DRM_MODE_BLEND_COVERAGE); + unsigned int def =3D DRM_MODE_BLEND_COVERAGE; + ret =3D drm_plane_create_alpha_property(plane); if (ret) return ret; + + ret =3D drm_plane_create_blend_mode_default(plane, + blend_modes, + def); + if (ret) + return ret; } } =20 --=20 2.35.1.1320.gc452695387.dirty