Skip to content

Commit 1d8967d

Browse files
committed
drm/vc4: Assign 32 overlay planes to writeback only
Instead of having 48 generic overlay planes, assign 32 to the writeback connector so that there is no ambiguity in wlroots when trying to find a plane for composition using the writeback connector vs display. Signed-off-by: Dave Stevenson <[email protected]>
1 parent 9eecda8 commit 1d8967d

File tree

1 file changed

+32
-2
lines changed

1 file changed

+32
-2
lines changed

drivers/gpu/drm/vc4/vc4_plane.c

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2450,13 +2450,28 @@ struct drm_plane *vc4_plane_init(struct drm_device *dev,
24502450
return plane;
24512451
}
24522452

2453-
#define VC4_NUM_OVERLAY_PLANES 48
2453+
#define VC4_NUM_OVERLAY_PLANES 16
2454+
#define VC4_NUM_TXP_OVERLAY_PLANES 32
24542455

24552456
int vc4_plane_create_additional_planes(struct drm_device *drm)
24562457
{
24572458
struct drm_plane *cursor_plane;
24582459
struct drm_crtc *crtc;
24592460
unsigned int i;
2461+
struct drm_crtc *txp_crtc;
2462+
uint32_t non_txp_crtc_mask;
2463+
2464+
drm_for_each_crtc(crtc, drm) {
2465+
struct vc4_crtc *vc4_crtc = to_vc4_crtc(crtc);
2466+
2467+
if (vc4_crtc->feeds_txp) {
2468+
txp_crtc = crtc;
2469+
break;
2470+
}
2471+
}
2472+
2473+
non_txp_crtc_mask = GENMASK(drm->mode_config.num_crtc - 1, 0) -
2474+
drm_crtc_mask(txp_crtc);
24602475

24612476
/* Set up some arbitrary number of planes. We're not limited
24622477
* by a set number of physical registers, just the space in
@@ -2470,7 +2485,22 @@ int vc4_plane_create_additional_planes(struct drm_device *drm)
24702485
for (i = 0; i < VC4_NUM_OVERLAY_PLANES; i++) {
24712486
struct drm_plane *plane =
24722487
vc4_plane_init(drm, DRM_PLANE_TYPE_OVERLAY,
2473-
GENMASK(drm->mode_config.num_crtc - 1, 0));
2488+
non_txp_crtc_mask);
2489+
2490+
if (IS_ERR(plane))
2491+
continue;
2492+
2493+
/* Create zpos property. Max of all the overlays + 1 primary +
2494+
* 1 cursor plane on a crtc.
2495+
*/
2496+
drm_plane_create_zpos_property(plane, i + 1, 1,
2497+
VC4_NUM_OVERLAY_PLANES + 1);
2498+
}
2499+
2500+
for (i = 0; i < VC4_NUM_TXP_OVERLAY_PLANES; i++) {
2501+
struct drm_plane *plane =
2502+
vc4_plane_init(drm, DRM_PLANE_TYPE_OVERLAY,
2503+
drm_crtc_mask(txp_crtc));
24742504

24752505
if (IS_ERR(plane))
24762506
continue;

0 commit comments

Comments
 (0)