Skip to content

Commit 9cc9d43

Browse files
6by9pelwell
authored andcommitted
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 faebe46 commit 9cc9d43

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
@@ -2660,13 +2660,28 @@ struct drm_plane *vc4_plane_init(struct drm_device *dev,
26602660
return plane;
26612661
}
26622662

2663-
#define VC4_NUM_OVERLAY_PLANES 48
2663+
#define VC4_NUM_OVERLAY_PLANES 16
2664+
#define VC4_NUM_TXP_OVERLAY_PLANES 32
26642665

26652666
int vc4_plane_create_additional_planes(struct drm_device *drm)
26662667
{
26672668
struct drm_plane *cursor_plane;
26682669
struct drm_crtc *crtc;
26692670
unsigned int i;
2671+
struct drm_crtc *txp_crtc;
2672+
uint32_t non_txp_crtc_mask;
2673+
2674+
drm_for_each_crtc(crtc, drm) {
2675+
struct vc4_crtc *vc4_crtc = to_vc4_crtc(crtc);
2676+
2677+
if (vc4_crtc->feeds_txp) {
2678+
txp_crtc = crtc;
2679+
break;
2680+
}
2681+
}
2682+
2683+
non_txp_crtc_mask = GENMASK(drm->mode_config.num_crtc - 1, 0) -
2684+
drm_crtc_mask(txp_crtc);
26702685

26712686
/* Set up some arbitrary number of planes. We're not limited
26722687
* by a set number of physical registers, just the space in
@@ -2680,7 +2695,22 @@ int vc4_plane_create_additional_planes(struct drm_device *drm)
26802695
for (i = 0; i < VC4_NUM_OVERLAY_PLANES; i++) {
26812696
struct drm_plane *plane =
26822697
vc4_plane_init(drm, DRM_PLANE_TYPE_OVERLAY,
2683-
GENMASK(drm->mode_config.num_crtc - 1, 0));
2698+
non_txp_crtc_mask);
2699+
2700+
if (IS_ERR(plane))
2701+
continue;
2702+
2703+
/* Create zpos property. Max of all the overlays + 1 primary +
2704+
* 1 cursor plane on a crtc.
2705+
*/
2706+
drm_plane_create_zpos_property(plane, i + 1, 1,
2707+
VC4_NUM_OVERLAY_PLANES + 1);
2708+
}
2709+
2710+
for (i = 0; i < VC4_NUM_TXP_OVERLAY_PLANES; i++) {
2711+
struct drm_plane *plane =
2712+
vc4_plane_init(drm, DRM_PLANE_TYPE_OVERLAY,
2713+
drm_crtc_mask(txp_crtc));
26842714

26852715
if (IS_ERR(plane))
26862716
continue;

0 commit comments

Comments
 (0)