All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] drm: xlnx: zynqmp_dpsub: Fix plane handling
@ 2021-03-07  4:06 ` Laurent Pinchart
  0 siblings, 0 replies; 8+ messages in thread
From: Laurent Pinchart @ 2021-03-07  4:06 UTC (permalink / raw)
  To: dri-devel; +Cc: linux-arm-kernel, Michal Simek, Rohit Visavalia

Hello,

This small patch series fixes two issues related to plane handling and
blending, and add global alpha support to the overlay plane. There isn't
much to say here, please refer to individual patches for details.

Laurent Pinchart (3):
  drm: xlnx: zynqmp_dpsub: Fix plane ordering
  drm: xlnx: zynqmp_dpsub: Fix graphics layer blending
  drm: xlnx: zynqmp_dpsub: Add global alpha support

 drivers/gpu/drm/xlnx/zynqmp_disp.c | 22 ++++++++++++++++++----
 1 file changed, 18 insertions(+), 4 deletions(-)

-- 
Regards,

Laurent Pinchart


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 0/3] drm: xlnx: zynqmp_dpsub: Fix plane handling
@ 2021-03-07  4:06 ` Laurent Pinchart
  0 siblings, 0 replies; 8+ messages in thread
From: Laurent Pinchart @ 2021-03-07  4:06 UTC (permalink / raw)
  To: dri-devel; +Cc: Rohit Visavalia, Michal Simek, linux-arm-kernel

Hello,

This small patch series fixes two issues related to plane handling and
blending, and add global alpha support to the overlay plane. There isn't
much to say here, please refer to individual patches for details.

Laurent Pinchart (3):
  drm: xlnx: zynqmp_dpsub: Fix plane ordering
  drm: xlnx: zynqmp_dpsub: Fix graphics layer blending
  drm: xlnx: zynqmp_dpsub: Add global alpha support

 drivers/gpu/drm/xlnx/zynqmp_disp.c | 22 ++++++++++++++++++----
 1 file changed, 18 insertions(+), 4 deletions(-)

-- 
Regards,

Laurent Pinchart

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 1/3] drm: xlnx: zynqmp_dpsub: Fix plane ordering
  2021-03-07  4:06 ` Laurent Pinchart
@ 2021-03-07  4:06   ` Laurent Pinchart
  -1 siblings, 0 replies; 8+ messages in thread
From: Laurent Pinchart @ 2021-03-07  4:06 UTC (permalink / raw)
  To: dri-devel; +Cc: linux-arm-kernel, Michal Simek, Rohit Visavalia

The DPSUB has a fixed plane order, with the video plane being at the
bottom and the graphics plane at the top. Register the video plane as
the primary plane, as a bottom overlay plane doesn't make sense.

While at it, add immutable zorder properties to the planes to report
this information to userspace.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 drivers/gpu/drm/xlnx/zynqmp_disp.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/xlnx/zynqmp_disp.c b/drivers/gpu/drm/xlnx/zynqmp_disp.c
index 148add0ca1d6..6296f6d5acbc 100644
--- a/drivers/gpu/drm/xlnx/zynqmp_disp.c
+++ b/drivers/gpu/drm/xlnx/zynqmp_disp.c
@@ -1236,8 +1236,11 @@ static int zynqmp_disp_create_planes(struct zynqmp_disp *disp)
 		for (j = 0; j < layer->info->num_formats; ++j)
 			drm_formats[j] = layer->info->formats[j].drm_fmt;
 
-		/* Graphics layer is primary, and video layer is overlay. */
-		type = i == ZYNQMP_DISP_LAYER_GFX
+		/*
+		 * The video layer is at the bottom of the stack and the
+		 * graphics layer at the top.
+		 */
+		type = i == ZYNQMP_DISP_LAYER_VID
 		     ? DRM_PLANE_TYPE_PRIMARY : DRM_PLANE_TYPE_OVERLAY;
 		ret = drm_universal_plane_init(disp->drm, &layer->plane, 0,
 					       &zynqmp_disp_plane_funcs,
@@ -1249,6 +1252,8 @@ 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);
 	}
 
 	return 0;
@@ -1573,7 +1578,7 @@ static const struct drm_crtc_funcs zynqmp_disp_crtc_funcs = {
 
 static int zynqmp_disp_create_crtc(struct zynqmp_disp *disp)
 {
-	struct drm_plane *plane = &disp->layers[ZYNQMP_DISP_LAYER_GFX].plane;
+	struct drm_plane *plane = &disp->layers[ZYNQMP_DISP_LAYER_VID].plane;
 	int ret;
 
 	ret = drm_crtc_init_with_planes(disp->drm, &disp->crtc, plane,
-- 
Regards,

Laurent Pinchart


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 1/3] drm: xlnx: zynqmp_dpsub: Fix plane ordering
@ 2021-03-07  4:06   ` Laurent Pinchart
  0 siblings, 0 replies; 8+ messages in thread
From: Laurent Pinchart @ 2021-03-07  4:06 UTC (permalink / raw)
  To: dri-devel; +Cc: Rohit Visavalia, Michal Simek, linux-arm-kernel

The DPSUB has a fixed plane order, with the video plane being at the
bottom and the graphics plane at the top. Register the video plane as
the primary plane, as a bottom overlay plane doesn't make sense.

While at it, add immutable zorder properties to the planes to report
this information to userspace.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 drivers/gpu/drm/xlnx/zynqmp_disp.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/xlnx/zynqmp_disp.c b/drivers/gpu/drm/xlnx/zynqmp_disp.c
index 148add0ca1d6..6296f6d5acbc 100644
--- a/drivers/gpu/drm/xlnx/zynqmp_disp.c
+++ b/drivers/gpu/drm/xlnx/zynqmp_disp.c
@@ -1236,8 +1236,11 @@ static int zynqmp_disp_create_planes(struct zynqmp_disp *disp)
 		for (j = 0; j < layer->info->num_formats; ++j)
 			drm_formats[j] = layer->info->formats[j].drm_fmt;
 
-		/* Graphics layer is primary, and video layer is overlay. */
-		type = i == ZYNQMP_DISP_LAYER_GFX
+		/*
+		 * The video layer is at the bottom of the stack and the
+		 * graphics layer at the top.
+		 */
+		type = i == ZYNQMP_DISP_LAYER_VID
 		     ? DRM_PLANE_TYPE_PRIMARY : DRM_PLANE_TYPE_OVERLAY;
 		ret = drm_universal_plane_init(disp->drm, &layer->plane, 0,
 					       &zynqmp_disp_plane_funcs,
@@ -1249,6 +1252,8 @@ 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);
 	}
 
 	return 0;
@@ -1573,7 +1578,7 @@ static const struct drm_crtc_funcs zynqmp_disp_crtc_funcs = {
 
 static int zynqmp_disp_create_crtc(struct zynqmp_disp *disp)
 {
-	struct drm_plane *plane = &disp->layers[ZYNQMP_DISP_LAYER_GFX].plane;
+	struct drm_plane *plane = &disp->layers[ZYNQMP_DISP_LAYER_VID].plane;
 	int ret;
 
 	ret = drm_crtc_init_with_planes(disp->drm, &disp->crtc, plane,
-- 
Regards,

Laurent Pinchart

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 2/3] drm: xlnx: zynqmp_dpsub: Fix graphics layer blending
  2021-03-07  4:06 ` Laurent Pinchart
@ 2021-03-07  4:06   ` Laurent Pinchart
  -1 siblings, 0 replies; 8+ messages in thread
From: Laurent Pinchart @ 2021-03-07  4:06 UTC (permalink / raw)
  To: dri-devel; +Cc: linux-arm-kernel, Michal Simek, Rohit Visavalia

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 | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/xlnx/zynqmp_disp.c b/drivers/gpu/drm/xlnx/zynqmp_disp.c
index 6296f6d5acbc..4c23ffc75343 100644
--- a/drivers/gpu/drm/xlnx/zynqmp_disp.c
+++ b/drivers/gpu/drm/xlnx/zynqmp_disp.c
@@ -1170,6 +1170,10 @@ zynqmp_disp_plane_atomic_disable(struct drm_plane *plane,
 		return;
 
 	zynqmp_disp_layer_disable(layer);
+
+	if (layer->id == ZYNQMP_DISP_LAYER_GFX)
+		zynqmp_disp_blend_set_global_alpha(&layer->disp->blend, false,
+						   0);
 }
 
 static void
@@ -1197,6 +1201,10 @@ zynqmp_disp_plane_atomic_update(struct drm_plane *plane,
 
 	zynqmp_disp_layer_update(layer, plane->state);
 
+	if (layer->id == ZYNQMP_DISP_LAYER_GFX)
+		zynqmp_disp_blend_set_global_alpha(&layer->disp->blend, true,
+						   255);
+
 	/* Enable or re-enable the plane is the format has changed. */
 	if (format_changed)
 		zynqmp_disp_layer_enable(layer);
@@ -1463,7 +1471,6 @@ zynqmp_disp_crtc_atomic_enable(struct drm_crtc *crtc,
 	zynqmp_disp_blend_set_output_format(&disp->blend,
 					    ZYNQMP_DPSUB_FORMAT_RGB);
 	zynqmp_disp_blend_set_bg_color(&disp->blend, 0, 0, 0);
-	zynqmp_disp_blend_set_global_alpha(&disp->blend, false, 0);
 
 	zynqmp_disp_enable(disp);
 
-- 
Regards,

Laurent Pinchart


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 2/3] drm: xlnx: zynqmp_dpsub: Fix graphics layer blending
@ 2021-03-07  4:06   ` Laurent Pinchart
  0 siblings, 0 replies; 8+ messages in thread
From: Laurent Pinchart @ 2021-03-07  4:06 UTC (permalink / raw)
  To: dri-devel; +Cc: Rohit Visavalia, Michal Simek, linux-arm-kernel

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 | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/xlnx/zynqmp_disp.c b/drivers/gpu/drm/xlnx/zynqmp_disp.c
index 6296f6d5acbc..4c23ffc75343 100644
--- a/drivers/gpu/drm/xlnx/zynqmp_disp.c
+++ b/drivers/gpu/drm/xlnx/zynqmp_disp.c
@@ -1170,6 +1170,10 @@ zynqmp_disp_plane_atomic_disable(struct drm_plane *plane,
 		return;
 
 	zynqmp_disp_layer_disable(layer);
+
+	if (layer->id == ZYNQMP_DISP_LAYER_GFX)
+		zynqmp_disp_blend_set_global_alpha(&layer->disp->blend, false,
+						   0);
 }
 
 static void
@@ -1197,6 +1201,10 @@ zynqmp_disp_plane_atomic_update(struct drm_plane *plane,
 
 	zynqmp_disp_layer_update(layer, plane->state);
 
+	if (layer->id == ZYNQMP_DISP_LAYER_GFX)
+		zynqmp_disp_blend_set_global_alpha(&layer->disp->blend, true,
+						   255);
+
 	/* Enable or re-enable the plane is the format has changed. */
 	if (format_changed)
 		zynqmp_disp_layer_enable(layer);
@@ -1463,7 +1471,6 @@ zynqmp_disp_crtc_atomic_enable(struct drm_crtc *crtc,
 	zynqmp_disp_blend_set_output_format(&disp->blend,
 					    ZYNQMP_DPSUB_FORMAT_RGB);
 	zynqmp_disp_blend_set_bg_color(&disp->blend, 0, 0, 0);
-	zynqmp_disp_blend_set_global_alpha(&disp->blend, false, 0);
 
 	zynqmp_disp_enable(disp);
 
-- 
Regards,

Laurent Pinchart

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 3/3] drm: xlnx: zynqmp_dpsub: Add global alpha support
  2021-03-07  4:06 ` Laurent Pinchart
@ 2021-03-07  4:06   ` Laurent Pinchart
  -1 siblings, 0 replies; 8+ messages in thread
From: Laurent Pinchart @ 2021-03-07  4:06 UTC (permalink / raw)
  To: dri-devel; +Cc: linux-arm-kernel, Michal Simek, Rohit Visavalia

The top (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 | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/xlnx/zynqmp_disp.c b/drivers/gpu/drm/xlnx/zynqmp_disp.c
index 4c23ffc75343..991dd6bebdc7 100644
--- a/drivers/gpu/drm/xlnx/zynqmp_disp.c
+++ b/drivers/gpu/drm/xlnx/zynqmp_disp.c
@@ -1173,7 +1173,7 @@ zynqmp_disp_plane_atomic_disable(struct drm_plane *plane,
 
 	if (layer->id == ZYNQMP_DISP_LAYER_GFX)
 		zynqmp_disp_blend_set_global_alpha(&layer->disp->blend, false,
-						   0);
+						   plane->state->alpha >> 8);
 }
 
 static void
@@ -1203,7 +1203,7 @@ zynqmp_disp_plane_atomic_update(struct drm_plane *plane,
 
 	if (layer->id == ZYNQMP_DISP_LAYER_GFX)
 		zynqmp_disp_blend_set_global_alpha(&layer->disp->blend, true,
-						   255);
+						   plane->state->alpha >> 8);
 
 	/* Enable or re-enable the plane is the format has changed. */
 	if (format_changed)
@@ -1262,6 +1262,8 @@ static int zynqmp_disp_create_planes(struct zynqmp_disp *disp)
 				     &zynqmp_disp_plane_helper_funcs);
 
 		drm_plane_create_zpos_immutable_property(&layer->plane, i);
+		if (type == DRM_PLANE_TYPE_OVERLAY)
+			drm_plane_create_alpha_property(&layer->plane);
 	}
 
 	return 0;
-- 
Regards,

Laurent Pinchart


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 3/3] drm: xlnx: zynqmp_dpsub: Add global alpha support
@ 2021-03-07  4:06   ` Laurent Pinchart
  0 siblings, 0 replies; 8+ messages in thread
From: Laurent Pinchart @ 2021-03-07  4:06 UTC (permalink / raw)
  To: dri-devel; +Cc: Rohit Visavalia, Michal Simek, linux-arm-kernel

The top (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 | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/xlnx/zynqmp_disp.c b/drivers/gpu/drm/xlnx/zynqmp_disp.c
index 4c23ffc75343..991dd6bebdc7 100644
--- a/drivers/gpu/drm/xlnx/zynqmp_disp.c
+++ b/drivers/gpu/drm/xlnx/zynqmp_disp.c
@@ -1173,7 +1173,7 @@ zynqmp_disp_plane_atomic_disable(struct drm_plane *plane,
 
 	if (layer->id == ZYNQMP_DISP_LAYER_GFX)
 		zynqmp_disp_blend_set_global_alpha(&layer->disp->blend, false,
-						   0);
+						   plane->state->alpha >> 8);
 }
 
 static void
@@ -1203,7 +1203,7 @@ zynqmp_disp_plane_atomic_update(struct drm_plane *plane,
 
 	if (layer->id == ZYNQMP_DISP_LAYER_GFX)
 		zynqmp_disp_blend_set_global_alpha(&layer->disp->blend, true,
-						   255);
+						   plane->state->alpha >> 8);
 
 	/* Enable or re-enable the plane is the format has changed. */
 	if (format_changed)
@@ -1262,6 +1262,8 @@ static int zynqmp_disp_create_planes(struct zynqmp_disp *disp)
 				     &zynqmp_disp_plane_helper_funcs);
 
 		drm_plane_create_zpos_immutable_property(&layer->plane, i);
+		if (type == DRM_PLANE_TYPE_OVERLAY)
+			drm_plane_create_alpha_property(&layer->plane);
 	}
 
 	return 0;
-- 
Regards,

Laurent Pinchart

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2021-03-07  4:09 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-07  4:06 [PATCH 0/3] drm: xlnx: zynqmp_dpsub: Fix plane handling Laurent Pinchart
2021-03-07  4:06 ` Laurent Pinchart
2021-03-07  4:06 ` [PATCH 1/3] drm: xlnx: zynqmp_dpsub: Fix plane ordering Laurent Pinchart
2021-03-07  4:06   ` Laurent Pinchart
2021-03-07  4:06 ` [PATCH 2/3] drm: xlnx: zynqmp_dpsub: Fix graphics layer blending Laurent Pinchart
2021-03-07  4:06   ` Laurent Pinchart
2021-03-07  4:06 ` [PATCH 3/3] drm: xlnx: zynqmp_dpsub: Add global alpha support Laurent Pinchart
2021-03-07  4:06   ` Laurent Pinchart

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.