From nobody Sat Feb 7 21:08:17 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