aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/bcm27xx/patches-5.15/950-0781-drm-vc4-Support-zpos-on-all-planes.patch
diff options
context:
space:
mode:
authorÁlvaro Fernández Rojas <noltari@gmail.com>2022-05-16 23:40:32 +0200
committerÁlvaro Fernández Rojas <noltari@gmail.com>2022-05-17 15:11:22 +0200
commit20ea6adbf199097c4f5f591ffee088340630dae4 (patch)
treed6719d95e136611a1c25bbf7789652d6d402779d /target/linux/bcm27xx/patches-5.15/950-0781-drm-vc4-Support-zpos-on-all-planes.patch
parentbca05bd072180dc38ef740b37ded9572a6db1981 (diff)
downloadupstream-20ea6adbf199097c4f5f591ffee088340630dae4.tar.gz
upstream-20ea6adbf199097c4f5f591ffee088340630dae4.tar.bz2
upstream-20ea6adbf199097c4f5f591ffee088340630dae4.zip
bcm27xx: add support for linux v5.15
Build system: x86_64 Build-tested: bcm2708, bcm2709, bcm2710, bcm2711 Run-tested: bcm2708/RPiB+, bcm2709/RPi3B, bcm2710/RPi3B, bcm2711/RPi4B Signed-off-by: Marty Jones <mj8263788@gmail.com> Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
Diffstat (limited to 'target/linux/bcm27xx/patches-5.15/950-0781-drm-vc4-Support-zpos-on-all-planes.patch')
-rw-r--r--target/linux/bcm27xx/patches-5.15/950-0781-drm-vc4-Support-zpos-on-all-planes.patch145
1 files changed, 145 insertions, 0 deletions
diff --git a/target/linux/bcm27xx/patches-5.15/950-0781-drm-vc4-Support-zpos-on-all-planes.patch b/target/linux/bcm27xx/patches-5.15/950-0781-drm-vc4-Support-zpos-on-all-planes.patch
new file mode 100644
index 0000000000..62ee1255b9
--- /dev/null
+++ b/target/linux/bcm27xx/patches-5.15/950-0781-drm-vc4-Support-zpos-on-all-planes.patch
@@ -0,0 +1,145 @@
+From 0e096c4f431ccd7f73e9baa930821dd3bbe93e35 Mon Sep 17 00:00:00 2001
+From: Dave Stevenson <dave.stevenson@raspberrypi.com>
+Date: Tue, 25 Jan 2022 17:28:18 +0000
+Subject: [PATCH] drm/vc4: Support zpos on all planes
+
+Adds the zpos property to all planes, and creates the dlist
+by placing the fragments in the correct order based on zpos.
+
+Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
+---
+ drivers/gpu/drm/vc4/vc4_hvs.c | 43 +++++++++++++++++++++------------
+ drivers/gpu/drm/vc4/vc4_kms.c | 3 +--
+ drivers/gpu/drm/vc4/vc4_plane.c | 22 ++++++++++++++---
+ 3 files changed, 48 insertions(+), 20 deletions(-)
+
+--- a/drivers/gpu/drm/vc4/vc4_hvs.c
++++ b/drivers/gpu/drm/vc4/vc4_hvs.c
+@@ -854,6 +854,8 @@ void vc4_hvs_atomic_flush(struct drm_crt
+ bool debug_dump_regs = false;
+ bool enable_bg_fill = false;
+ u32 __iomem *dlist_start, *dlist_next;
++ unsigned int zpos = 0;
++ bool found = false;
+
+ if (vc4_state->assigned_channel == VC4_HVS_CHANNEL_DISABLED)
+ return;
+@@ -867,23 +869,34 @@ void vc4_hvs_atomic_flush(struct drm_crt
+ dlist_next = dlist_start;
+
+ /* Copy all the active planes' dlist contents to the hardware dlist. */
+- drm_atomic_crtc_for_each_plane(plane, crtc) {
+- /* Is this the first active plane? */
+- if (dlist_next == dlist_start) {
+- /* We need to enable background fill when a plane
+- * could be alpha blending from the background, i.e.
+- * where no other plane is underneath. It suffices to
+- * consider the first active plane here since we set
+- * needs_bg_fill such that either the first plane
+- * already needs it or all planes on top blend from
+- * the first or a lower plane.
+- */
+- vc4_plane_state = to_vc4_plane_state(plane->state);
+- enable_bg_fill = vc4_plane_state->needs_bg_fill;
++ do {
++ found = false;
++
++ drm_atomic_crtc_for_each_plane(plane, crtc) {
++ if (plane->state->normalized_zpos != zpos)
++ continue;
++
++ /* Is this the first active plane? */
++ if (dlist_next == dlist_start) {
++ /* We need to enable background fill when a plane
++ * could be alpha blending from the background, i.e.
++ * where no other plane is underneath. It suffices to
++ * consider the first active plane here since we set
++ * needs_bg_fill such that either the first plane
++ * already needs it or all planes on top blend from
++ * the first or a lower plane.
++ */
++ vc4_plane_state = to_vc4_plane_state(plane->state);
++ enable_bg_fill = vc4_plane_state->needs_bg_fill;
++ }
++
++ dlist_next += vc4_plane_write_dlist(plane, dlist_next);
++
++ found = true;
+ }
+
+- dlist_next += vc4_plane_write_dlist(plane, dlist_next);
+- }
++ zpos++;
++ } while (found);
+
+ writel(SCALER_CTL0_END, dlist_next);
+ dlist_next++;
+--- a/drivers/gpu/drm/vc4/vc4_kms.c
++++ b/drivers/gpu/drm/vc4/vc4_kms.c
+@@ -1042,8 +1042,7 @@ int vc4_kms_load(struct drm_device *dev)
+ dev->mode_config.helper_private = &vc4_mode_config_helpers;
+ dev->mode_config.preferred_depth = 24;
+ dev->mode_config.async_page_flip = true;
+- if (vc4->firmware_kms)
+- dev->mode_config.normalize_zpos = true;
++ dev->mode_config.normalize_zpos = true;
+
+ ret = vc4_ctm_obj_init(vc4);
+ if (ret)
+--- a/drivers/gpu/drm/vc4/vc4_plane.c
++++ b/drivers/gpu/drm/vc4/vc4_plane.c
+@@ -1572,9 +1572,14 @@ struct drm_plane *vc4_plane_init(struct
+ DRM_COLOR_YCBCR_BT709,
+ DRM_COLOR_YCBCR_LIMITED_RANGE);
+
++ if (type == DRM_PLANE_TYPE_PRIMARY)
++ drm_plane_create_zpos_immutable_property(plane, 0);
++
+ return plane;
+ }
+
++#define VC4_NUM_OVERLAY_PLANES 16
++
+ int vc4_plane_create_additional_planes(struct drm_device *drm)
+ {
+ struct drm_plane *cursor_plane;
+@@ -1590,7 +1595,7 @@ int vc4_plane_create_additional_planes(s
+ * modest number of planes to expose, that should hopefully
+ * still cover any sane usecase.
+ */
+- for (i = 0; i < 16; i++) {
++ for (i = 0; i < VC4_NUM_OVERLAY_PLANES; i++) {
+ struct drm_plane *plane =
+ vc4_plane_init(drm, DRM_PLANE_TYPE_OVERLAY);
+
+@@ -1599,17 +1604,28 @@ int vc4_plane_create_additional_planes(s
+
+ plane->possible_crtcs =
+ GENMASK(drm->mode_config.num_crtc - 1, 0);
++
++ /* Create zpos property. Max of all the overlays + 1 primary +
++ * 1 cursor plane on a crtc.
++ */
++ drm_plane_create_zpos_property(plane, i + 1, 1,
++ VC4_NUM_OVERLAY_PLANES + 1);
+ }
+
+ drm_for_each_crtc(crtc, drm) {
+ /* Set up the legacy cursor after overlay initialization,
+- * since we overlay planes on the CRTC in the order they were
+- * initialized.
++ * since the zpos fallback is that planes are rendered by plane
++ * ID order, and that then puts the cursor on top.
+ */
+ cursor_plane = vc4_plane_init(drm, DRM_PLANE_TYPE_CURSOR);
+ if (!IS_ERR(cursor_plane)) {
+ cursor_plane->possible_crtcs = drm_crtc_mask(crtc);
+ crtc->cursor = cursor_plane;
++
++ drm_plane_create_zpos_property(cursor_plane,
++ VC4_NUM_OVERLAY_PLANES + 1,
++ 1,
++ VC4_NUM_OVERLAY_PLANES + 1);
+ }
+ }
+