Hello,
This small patch series fixes an issue related to plane blending (patch 1/3), add global alpha support to the overlay plane (patch 2/3) and exposes plane ordering to userspace (patch 3/3). There isn't much to say here, please refer to individual patches for details.
Compared to v1, I've dropped making the video plane primary, as that seems to cause issues with existing userspace, and I've been told in the meantime that the DRM/KMS API doesn't require the overlay planes to be on top of the primary plane (even if not doing so is somehow counterintuitive, given the name "overlay").
Laurent Pinchart (3): drm: xlnx: zynqmp_dpsub: Fix graphics layer blending drm: xlnx: zynqmp_dpsub: Add global alpha support drm: xlnx: zynqmp_dpsub: Expose plane ordering to userspace
drivers/gpu/drm/xlnx/zynqmp_disp.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-)
To display the graphics layer, the global alpha needs to be enabled. Enable it when the graphics plane is enabled (with full opacity), and disable it otherwise.
Signed-off-by: Laurent Pinchart laurent.pinchart@ideasonboard.com --- drivers/gpu/drm/xlnx/zynqmp_disp.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/xlnx/zynqmp_disp.c b/drivers/gpu/drm/xlnx/zynqmp_disp.c index a061a75a9de7..27b3829fb7e0 100644 --- a/drivers/gpu/drm/xlnx/zynqmp_disp.c +++ b/drivers/gpu/drm/xlnx/zynqmp_disp.c @@ -415,6 +415,11 @@ static void zynqmp_disp_avbuf_write(struct zynqmp_disp *disp, int reg, u32 val) writel(val, disp->avbuf.base + reg); }
+static bool zynqmp_disp_layer_is_gfx(const struct zynqmp_disp_layer *layer) +{ + return layer->id == ZYNQMP_DISP_LAYER_GFX; +} + static bool zynqmp_disp_layer_is_video(const struct zynqmp_disp_layer *layer) { return layer->id == ZYNQMP_DISP_LAYER_VID; @@ -1157,6 +1162,9 @@ zynqmp_disp_plane_atomic_disable(struct drm_plane *plane, return;
zynqmp_disp_layer_disable(layer); + + if (zynqmp_disp_layer_is_gfx(layer)) + zynqmp_disp_blend_set_global_alpha(layer->disp, false, 0); }
static void @@ -1186,6 +1194,9 @@ zynqmp_disp_plane_atomic_update(struct drm_plane *plane,
zynqmp_disp_layer_update(layer, new_state);
+ if (zynqmp_disp_layer_is_gfx(layer)) + zynqmp_disp_blend_set_global_alpha(layer->disp, true, 255); + /* Enable or re-enable the plane is the format has changed. */ if (format_changed) zynqmp_disp_layer_enable(layer); @@ -1447,7 +1458,6 @@ zynqmp_disp_crtc_atomic_enable(struct drm_crtc *crtc,
zynqmp_disp_blend_set_output_format(disp, ZYNQMP_DPSUB_FORMAT_RGB); zynqmp_disp_blend_set_bg_color(disp, 0, 0, 0); - zynqmp_disp_blend_set_global_alpha(disp, false, 0);
zynqmp_disp_enable(disp);
The graphics plane has a global alpha setting. Expose it through the plane's alpha property.
Signed-off-by: Laurent Pinchart laurent.pinchart@ideasonboard.com --- drivers/gpu/drm/xlnx/zynqmp_disp.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/xlnx/zynqmp_disp.c b/drivers/gpu/drm/xlnx/zynqmp_disp.c index 27b3829fb7e0..d87af7cb3340 100644 --- a/drivers/gpu/drm/xlnx/zynqmp_disp.c +++ b/drivers/gpu/drm/xlnx/zynqmp_disp.c @@ -1164,7 +1164,8 @@ zynqmp_disp_plane_atomic_disable(struct drm_plane *plane, zynqmp_disp_layer_disable(layer);
if (zynqmp_disp_layer_is_gfx(layer)) - zynqmp_disp_blend_set_global_alpha(layer->disp, false, 0); + zynqmp_disp_blend_set_global_alpha(layer->disp, false, + plane->state->alpha >> 8); }
static void @@ -1195,7 +1196,8 @@ zynqmp_disp_plane_atomic_update(struct drm_plane *plane, zynqmp_disp_layer_update(layer, new_state);
if (zynqmp_disp_layer_is_gfx(layer)) - zynqmp_disp_blend_set_global_alpha(layer->disp, true, 255); + zynqmp_disp_blend_set_global_alpha(layer->disp, true, + plane->state->alpha >> 8);
/* Enable or re-enable the plane is the format has changed. */ if (format_changed) @@ -1249,6 +1251,9 @@ static int zynqmp_disp_create_planes(struct zynqmp_disp *disp)
drm_plane_helper_add(&layer->plane, &zynqmp_disp_plane_helper_funcs); + + if (zynqmp_disp_layer_is_gfx(layer)) + drm_plane_create_alpha_property(&layer->plane); }
return 0;
While the DPSUB has a fixed plane order, it still makes sense to expose it to userspace to avoid hardcoding assumptions. Do so by adding an immutable zpos property to planes.
Signed-off-by: Laurent Pinchart laurent.pinchart@ideasonboard.com --- drivers/gpu/drm/xlnx/zynqmp_disp.c | 1 + 1 file changed, 1 insertion(+)
diff --git a/drivers/gpu/drm/xlnx/zynqmp_disp.c b/drivers/gpu/drm/xlnx/zynqmp_disp.c index d87af7cb3340..e377974f8198 100644 --- a/drivers/gpu/drm/xlnx/zynqmp_disp.c +++ b/drivers/gpu/drm/xlnx/zynqmp_disp.c @@ -1252,6 +1252,7 @@ static int zynqmp_disp_create_planes(struct zynqmp_disp *disp) drm_plane_helper_add(&layer->plane, &zynqmp_disp_plane_helper_funcs);
+ drm_plane_create_zpos_immutable_property(&layer->plane, i); if (zynqmp_disp_layer_is_gfx(layer)) drm_plane_create_alpha_property(&layer->plane); }
dri-devel@lists.freedesktop.org