Skip to content

Commit b90fa71

Browse files
Andy Yanmmind
authored andcommitted
drm/rockchip: vop2: Set plane possible crtcs by possible vp mask
In the upcoming VOP of rk3576, a window cannot attach to all Video Ports, we introduce a possible_vp_mask for every window to indicate which Video Ports this window can attach to. Signed-off-by: Andy Yan <[email protected]> Tested-by: Michael Riesch <[email protected]> # on RK3568 Tested-by: Detlev Casanova <[email protected]> Signed-off-by: Heiko Stuebner <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent 6fd4f8a commit b90fa71

File tree

3 files changed

+32
-1
lines changed

3 files changed

+32
-1
lines changed

drivers/gpu/drm/rockchip/rockchip_drm_vop2.c

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2349,6 +2349,10 @@ static int vop2_create_crtcs(struct vop2 *vop2)
23492349
if (win->base.type == DRM_PLANE_TYPE_PRIMARY)
23502350
continue;
23512351

2352+
/* If this win can not attached to this VP */
2353+
if (!(win->data->possible_vp_mask & BIT(vp->id)))
2354+
continue;
2355+
23522356
if (vop2_is_mirror_win(win))
23532357
continue;
23542358

@@ -2379,7 +2383,19 @@ static int vop2_create_crtcs(struct vop2 *vop2)
23792383

23802384
win->type = DRM_PLANE_TYPE_OVERLAY;
23812385

2382-
possible_crtcs = (1 << nvps) - 1;
2386+
possible_crtcs = 0;
2387+
nvp = 0;
2388+
for (j = 0; j < vop2_data->nr_vps; j++) {
2389+
vp = &vop2->vps[j];
2390+
2391+
if (!vp->crtc.port)
2392+
continue;
2393+
2394+
if (win->data->possible_vp_mask & BIT(vp->id))
2395+
possible_crtcs |= BIT(nvp);
2396+
nvp++;
2397+
}
2398+
23832399
ret = vop2_plane_init(vop2, win, possible_crtcs);
23842400
if (ret)
23852401
return dev_err_probe(drm->dev, ret, "failed to init overlay plane %s\n",

drivers/gpu/drm/rockchip/rockchip_drm_vop2.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,7 @@ struct vop2_win_data {
167167
unsigned int phys_id;
168168

169169
u32 base;
170+
u32 possible_vp_mask;
170171
enum drm_plane_type type;
171172

172173
u32 nformats;

drivers/gpu/drm/rockchip/rockchip_vop2_reg.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,7 @@ static const struct vop2_win_data rk3568_vop_win_data[] = {
347347
.name = "Smart0-win0",
348348
.phys_id = ROCKCHIP_VOP2_SMART0,
349349
.base = 0x1c00,
350+
.possible_vp_mask = BIT(0) | BIT(1) | BIT(2),
350351
.formats = formats_smart,
351352
.nformats = ARRAY_SIZE(formats_smart),
352353
.format_modifiers = format_modifiers,
@@ -360,6 +361,7 @@ static const struct vop2_win_data rk3568_vop_win_data[] = {
360361
}, {
361362
.name = "Smart1-win0",
362363
.phys_id = ROCKCHIP_VOP2_SMART1,
364+
.possible_vp_mask = BIT(0) | BIT(1) | BIT(2),
363365
.formats = formats_smart,
364366
.nformats = ARRAY_SIZE(formats_smart),
365367
.format_modifiers = format_modifiers,
@@ -373,6 +375,7 @@ static const struct vop2_win_data rk3568_vop_win_data[] = {
373375
}, {
374376
.name = "Esmart1-win0",
375377
.phys_id = ROCKCHIP_VOP2_ESMART1,
378+
.possible_vp_mask = BIT(0) | BIT(1) | BIT(2),
376379
.formats = formats_rk356x_esmart,
377380
.nformats = ARRAY_SIZE(formats_rk356x_esmart),
378381
.format_modifiers = format_modifiers,
@@ -386,6 +389,7 @@ static const struct vop2_win_data rk3568_vop_win_data[] = {
386389
}, {
387390
.name = "Esmart0-win0",
388391
.phys_id = ROCKCHIP_VOP2_ESMART0,
392+
.possible_vp_mask = BIT(0) | BIT(1) | BIT(2),
389393
.formats = formats_rk356x_esmart,
390394
.nformats = ARRAY_SIZE(formats_rk356x_esmart),
391395
.format_modifiers = format_modifiers,
@@ -400,6 +404,7 @@ static const struct vop2_win_data rk3568_vop_win_data[] = {
400404
.name = "Cluster0-win0",
401405
.phys_id = ROCKCHIP_VOP2_CLUSTER0,
402406
.base = 0x1000,
407+
.possible_vp_mask = BIT(0) | BIT(1) | BIT(2),
403408
.formats = formats_cluster,
404409
.nformats = ARRAY_SIZE(formats_cluster),
405410
.format_modifiers = format_modifiers_afbc,
@@ -415,6 +420,7 @@ static const struct vop2_win_data rk3568_vop_win_data[] = {
415420
.name = "Cluster1-win0",
416421
.phys_id = ROCKCHIP_VOP2_CLUSTER1,
417422
.base = 0x1200,
423+
.possible_vp_mask = BIT(0) | BIT(1) | BIT(2),
418424
.formats = formats_cluster,
419425
.nformats = ARRAY_SIZE(formats_cluster),
420426
.format_modifiers = format_modifiers_afbc,
@@ -580,6 +586,7 @@ static const struct vop2_win_data rk3588_vop_win_data[] = {
580586
.name = "Cluster0-win0",
581587
.phys_id = ROCKCHIP_VOP2_CLUSTER0,
582588
.base = 0x1000,
589+
.possible_vp_mask = BIT(0) | BIT(1) | BIT(2) | BIT(3),
583590
.formats = formats_cluster,
584591
.nformats = ARRAY_SIZE(formats_cluster),
585592
.format_modifiers = format_modifiers_afbc,
@@ -598,6 +605,7 @@ static const struct vop2_win_data rk3588_vop_win_data[] = {
598605
.name = "Cluster1-win0",
599606
.phys_id = ROCKCHIP_VOP2_CLUSTER1,
600607
.base = 0x1200,
608+
.possible_vp_mask = BIT(0) | BIT(1) | BIT(2) | BIT(3),
601609
.formats = formats_cluster,
602610
.nformats = ARRAY_SIZE(formats_cluster),
603611
.format_modifiers = format_modifiers_afbc,
@@ -616,6 +624,7 @@ static const struct vop2_win_data rk3588_vop_win_data[] = {
616624
.name = "Cluster2-win0",
617625
.phys_id = ROCKCHIP_VOP2_CLUSTER2,
618626
.base = 0x1400,
627+
.possible_vp_mask = BIT(0) | BIT(1) | BIT(2) | BIT(3),
619628
.formats = formats_cluster,
620629
.nformats = ARRAY_SIZE(formats_cluster),
621630
.format_modifiers = format_modifiers_afbc,
@@ -634,6 +643,7 @@ static const struct vop2_win_data rk3588_vop_win_data[] = {
634643
.name = "Cluster3-win0",
635644
.phys_id = ROCKCHIP_VOP2_CLUSTER3,
636645
.base = 0x1600,
646+
.possible_vp_mask = BIT(0) | BIT(1) | BIT(2) | BIT(3),
637647
.formats = formats_cluster,
638648
.nformats = ARRAY_SIZE(formats_cluster),
639649
.format_modifiers = format_modifiers_afbc,
@@ -651,6 +661,7 @@ static const struct vop2_win_data rk3588_vop_win_data[] = {
651661
}, {
652662
.name = "Esmart0-win0",
653663
.phys_id = ROCKCHIP_VOP2_ESMART0,
664+
.possible_vp_mask = BIT(0) | BIT(1) | BIT(2) | BIT(3),
654665
.formats = formats_esmart,
655666
.nformats = ARRAY_SIZE(formats_esmart),
656667
.format_modifiers = format_modifiers,
@@ -667,6 +678,7 @@ static const struct vop2_win_data rk3588_vop_win_data[] = {
667678
}, {
668679
.name = "Esmart1-win0",
669680
.phys_id = ROCKCHIP_VOP2_ESMART1,
681+
.possible_vp_mask = BIT(0) | BIT(1) | BIT(2) | BIT(3),
670682
.formats = formats_esmart,
671683
.nformats = ARRAY_SIZE(formats_esmart),
672684
.format_modifiers = format_modifiers,
@@ -684,6 +696,7 @@ static const struct vop2_win_data rk3588_vop_win_data[] = {
684696
.name = "Esmart2-win0",
685697
.phys_id = ROCKCHIP_VOP2_ESMART2,
686698
.base = 0x1c00,
699+
.possible_vp_mask = BIT(0) | BIT(1) | BIT(2) | BIT(3),
687700
.formats = formats_esmart,
688701
.nformats = ARRAY_SIZE(formats_esmart),
689702
.format_modifiers = format_modifiers,
@@ -699,6 +712,7 @@ static const struct vop2_win_data rk3588_vop_win_data[] = {
699712
}, {
700713
.name = "Esmart3-win0",
701714
.phys_id = ROCKCHIP_VOP2_ESMART3,
715+
.possible_vp_mask = BIT(0) | BIT(1) | BIT(2) | BIT(3),
702716
.formats = formats_esmart,
703717
.nformats = ARRAY_SIZE(formats_esmart),
704718
.format_modifiers = format_modifiers,

0 commit comments

Comments
 (0)