Skip to content

Commit bd08544

Browse files
6by9popcornmix
authored andcommitted
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 <[email protected]>
1 parent 7edbbcd commit bd08544

File tree

1 file changed

+21
-33
lines changed

1 file changed

+21
-33
lines changed

drivers/gpu/drm/vc4/vc4_firmware_kms.c

Lines changed: 21 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ struct vc4_fkms {
4848
bool bcm2711;
4949
};
5050

51-
#define PLANES_PER_CRTC 3
51+
#define PLANES_PER_CRTC 8
5252

5353
struct set_plane {
5454
u8 display;
@@ -1725,15 +1725,15 @@ static int vc4_fkms_create_screen(struct device *dev, struct drm_device *drm,
17251725
struct vc4_crtc *vc4_crtc;
17261726
struct vc4_fkms_encoder *vc4_encoder;
17271727
struct drm_crtc *crtc;
1728-
struct drm_plane *primary_plane, *overlay_plane, *cursor_plane;
17291728
struct drm_plane *destroy_plane, *temp;
17301729
struct mailbox_blank_display blank = {
17311730
.tag1 = {RPI_FIRMWARE_FRAMEBUFFER_SET_DISPLAY_NUM, 4, 0, },
17321731
.display = display_idx,
17331732
.tag2 = { RPI_FIRMWARE_FRAMEBUFFER_BLANK, 4, 0, },
17341733
.blank = 1,
17351734
};
1736-
int ret;
1735+
struct drm_plane *planes[PLANES_PER_CRTC];
1736+
int ret, i;
17371737

17381738
vc4_crtc = devm_kzalloc(dev, sizeof(*vc4_crtc), GFP_KERNEL);
17391739
if (!vc4_crtc)
@@ -1746,38 +1746,26 @@ static int vc4_fkms_create_screen(struct device *dev, struct drm_device *drm,
17461746
/* Blank the firmware provided framebuffer */
17471747
rpi_firmware_property_list(vc4->firmware, &blank, sizeof(blank));
17481748

1749-
primary_plane = vc4_fkms_plane_init(drm, DRM_PLANE_TYPE_PRIMARY,
1750-
display_ref,
1751-
0 + (display_idx * PLANES_PER_CRTC)
1752-
);
1753-
if (IS_ERR(primary_plane)) {
1754-
dev_err(dev, "failed to construct primary plane\n");
1755-
ret = PTR_ERR(primary_plane);
1756-
goto err;
1757-
}
1758-
1759-
overlay_plane = vc4_fkms_plane_init(drm, DRM_PLANE_TYPE_OVERLAY,
1760-
display_ref,
1761-
1 + (display_idx * PLANES_PER_CRTC)
1762-
);
1763-
if (IS_ERR(overlay_plane)) {
1764-
dev_err(dev, "failed to construct overlay plane\n");
1765-
ret = PTR_ERR(overlay_plane);
1766-
goto err;
1767-
}
1768-
1769-
cursor_plane = vc4_fkms_plane_init(drm, DRM_PLANE_TYPE_CURSOR,
1770-
display_ref,
1771-
2 + (display_idx * PLANES_PER_CRTC)
1772-
);
1773-
if (IS_ERR(cursor_plane)) {
1774-
dev_err(dev, "failed to construct cursor plane\n");
1775-
ret = PTR_ERR(cursor_plane);
1776-
goto err;
1749+
for (i = 0; i < PLANES_PER_CRTC; i++) {
1750+
planes[i] = vc4_fkms_plane_init(drm,
1751+
(i == 0) ?
1752+
DRM_PLANE_TYPE_PRIMARY :
1753+
(i == PLANES_PER_CRTC - 1) ?
1754+
DRM_PLANE_TYPE_CURSOR :
1755+
DRM_PLANE_TYPE_OVERLAY,
1756+
display_ref,
1757+
i + (display_idx * PLANES_PER_CRTC)
1758+
);
1759+
if (IS_ERR(planes[i])) {
1760+
dev_err(dev, "failed to construct plane %u\n", i);
1761+
ret = PTR_ERR(planes[i]);
1762+
goto err;
1763+
}
17771764
}
17781765

1779-
drm_crtc_init_with_planes(drm, crtc, primary_plane, cursor_plane,
1780-
&vc4_crtc_funcs, NULL);
1766+
drm_crtc_init_with_planes(drm, crtc, planes[0],
1767+
planes[PLANES_PER_CRTC - 1], &vc4_crtc_funcs,
1768+
NULL);
17811769
drm_crtc_helper_add(crtc, &vc4_crtc_helper_funcs);
17821770

17831771
vc4_encoder = devm_kzalloc(dev, sizeof(*vc4_encoder), GFP_KERNEL);

0 commit comments

Comments
 (0)