aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/bcm27xx/patches-5.4/950-0936-drm-vc4-Increase-the-number-of-planes-per-crtc-in-FK.patch
diff options
context:
space:
mode:
Diffstat (limited to 'target/linux/bcm27xx/patches-5.4/950-0936-drm-vc4-Increase-the-number-of-planes-per-crtc-in-FK.patch')
-rw-r--r--target/linux/bcm27xx/patches-5.4/950-0936-drm-vc4-Increase-the-number-of-planes-per-crtc-in-FK.patch105
1 files changed, 105 insertions, 0 deletions
diff --git a/target/linux/bcm27xx/patches-5.4/950-0936-drm-vc4-Increase-the-number-of-planes-per-crtc-in-FK.patch b/target/linux/bcm27xx/patches-5.4/950-0936-drm-vc4-Increase-the-number-of-planes-per-crtc-in-FK.patch
new file mode 100644
index 0000000000..b2b1e7f46d
--- /dev/null
+++ b/target/linux/bcm27xx/patches-5.4/950-0936-drm-vc4-Increase-the-number-of-planes-per-crtc-in-FK.patch
@@ -0,0 +1,105 @@
+From 078e6dfcff1fc4ef0ee3b29a5f94403624c2e7ac Mon Sep 17 00:00:00 2001
+From: Dave Stevenson <dave.stevenson@raspberrypi.com>
+Date: Mon, 20 Jul 2020 16:42:57 +0100
+Subject: [PATCH] drm/vc4: Increase the number of planes per crtc in
+ FKMS.
+
+The number assigned was arbitrary as one primary, one overlay,
+and one cursor.
+The number has to be below the DRM limit of 32 planes total,
+and the current firmware API limit of 16 planes total.
+
+Increase the number to 8 planes per crtc (1 primary,
+6 overlay, and a cursor).
+
+Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
+---
+ drivers/gpu/drm/vc4/vc4_firmware_kms.c | 54 ++++++++++----------------
+ 1 file changed, 21 insertions(+), 33 deletions(-)
+
+--- a/drivers/gpu/drm/vc4/vc4_firmware_kms.c
++++ b/drivers/gpu/drm/vc4/vc4_firmware_kms.c
+@@ -48,7 +48,7 @@ struct vc4_fkms {
+ bool bcm2711;
+ };
+
+-#define PLANES_PER_CRTC 3
++#define PLANES_PER_CRTC 8
+
+ struct set_plane {
+ u8 display;
+@@ -1742,7 +1742,6 @@ static int vc4_fkms_create_screen(struct
+ struct vc4_crtc *vc4_crtc;
+ struct vc4_fkms_encoder *vc4_encoder;
+ struct drm_crtc *crtc;
+- struct drm_plane *primary_plane, *overlay_plane, *cursor_plane;
+ struct drm_plane *destroy_plane, *temp;
+ struct mailbox_blank_display blank = {
+ .tag1 = {RPI_FIRMWARE_FRAMEBUFFER_SET_DISPLAY_NUM, 4, 0, },
+@@ -1750,7 +1749,8 @@ static int vc4_fkms_create_screen(struct
+ .tag2 = { RPI_FIRMWARE_FRAMEBUFFER_BLANK, 4, 0, },
+ .blank = 1,
+ };
+- int ret;
++ struct drm_plane *planes[PLANES_PER_CRTC];
++ int ret, i;
+
+ vc4_crtc = devm_kzalloc(dev, sizeof(*vc4_crtc), GFP_KERNEL);
+ if (!vc4_crtc)
+@@ -1763,38 +1763,26 @@ static int vc4_fkms_create_screen(struct
+ /* Blank the firmware provided framebuffer */
+ rpi_firmware_property_list(vc4->firmware, &blank, sizeof(blank));
+
+- primary_plane = vc4_fkms_plane_init(drm, DRM_PLANE_TYPE_PRIMARY,
+- display_ref,
+- 0 + (display_idx * PLANES_PER_CRTC)
+- );
+- if (IS_ERR(primary_plane)) {
+- dev_err(dev, "failed to construct primary plane\n");
+- ret = PTR_ERR(primary_plane);
+- goto err;
+- }
+-
+- overlay_plane = vc4_fkms_plane_init(drm, DRM_PLANE_TYPE_OVERLAY,
+- display_ref,
+- 1 + (display_idx * PLANES_PER_CRTC)
+- );
+- if (IS_ERR(overlay_plane)) {
+- dev_err(dev, "failed to construct overlay plane\n");
+- ret = PTR_ERR(overlay_plane);
+- goto err;
+- }
+-
+- cursor_plane = vc4_fkms_plane_init(drm, DRM_PLANE_TYPE_CURSOR,
+- display_ref,
+- 2 + (display_idx * PLANES_PER_CRTC)
+- );
+- if (IS_ERR(cursor_plane)) {
+- dev_err(dev, "failed to construct cursor plane\n");
+- ret = PTR_ERR(cursor_plane);
+- goto err;
++ for (i = 0; i < PLANES_PER_CRTC; i++) {
++ planes[i] = vc4_fkms_plane_init(drm,
++ (i == 0) ?
++ DRM_PLANE_TYPE_PRIMARY :
++ (i == PLANES_PER_CRTC - 1) ?
++ DRM_PLANE_TYPE_CURSOR :
++ DRM_PLANE_TYPE_OVERLAY,
++ display_ref,
++ i + (display_idx * PLANES_PER_CRTC)
++ );
++ if (IS_ERR(planes[i])) {
++ dev_err(dev, "failed to construct plane %u\n", i);
++ ret = PTR_ERR(planes[i]);
++ goto err;
++ }
+ }
+
+- drm_crtc_init_with_planes(drm, crtc, primary_plane, cursor_plane,
+- &vc4_crtc_funcs, NULL);
++ drm_crtc_init_with_planes(drm, crtc, planes[0],
++ planes[PLANES_PER_CRTC - 1], &vc4_crtc_funcs,
++ NULL);
+ drm_crtc_helper_add(crtc, &vc4_crtc_helper_funcs);
+
+ vc4_encoder = devm_kzalloc(dev, sizeof(*vc4_encoder), GFP_KERNEL);