Skip to content

Commit 70d5b7e

Browse files
yueshunumbqq
authored andcommitted
drm/rockchip: vop: set plane's zpos according to type
The zpos currently configure is the order in vop_win_data array, which is related to the actual hardware plane. But in the Linux platform, such as video hardware and camera preview, it can only be played on the nv12 plane. So set the order of zpos to PRIMARY < OVERLAY (if have) < CURSOR (if have). Change-Id: Ia9ab3cb9225fd2c385703109afbfbb42a1564110 Signed-off-by: Nickey Yang <[email protected]>
1 parent 037df79 commit 70d5b7e

File tree

1 file changed

+26
-2
lines changed

1 file changed

+26
-2
lines changed

drivers/gpu/drm/rockchip/rockchip_drm_vop.c

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,7 @@ struct vop_win {
197197

198198
int win_id;
199199
int area_id;
200+
int zpos;
200201
uint32_t offset;
201202
enum drm_plane_type type;
202203
const struct vop_win_phy *phy;
@@ -1852,7 +1853,7 @@ static void vop_atomic_plane_reset(struct drm_plane *plane)
18521853
if (!vop_plane_state)
18531854
return;
18541855

1855-
vop_plane_state->zpos = win->win_id;
1856+
vop_plane_state->zpos = win->zpos;
18561857
vop_plane_state->global_alpha = 0xff;
18571858
plane->state = &vop_plane_state->base;
18581859
plane->state->plane = plane;
@@ -4295,6 +4296,26 @@ static void vop_destroy_crtc(struct vop *vop)
42954296
drm_flip_work_cleanup(&vop->fb_unref_work);
42964297
}
42974298

4299+
/*
4300+
* Win_id is the order in vop_win_data array.
4301+
* This is related to the actual hardware plane.
4302+
* But in the Linux platform, such as video hardware and camera preview,
4303+
* it can only be played on the nv12 plane.
4304+
* So set the order of zpos to PRIMARY < OVERLAY (if have) < CURSOR (if have).
4305+
*/
4306+
static int vop_plane_get_zpos(enum drm_plane_type type, unsigned int size)
4307+
{
4308+
switch (type) {
4309+
case DRM_PLANE_TYPE_PRIMARY:
4310+
return 0;
4311+
case DRM_PLANE_TYPE_OVERLAY:
4312+
return 1;
4313+
case DRM_PLANE_TYPE_CURSOR:
4314+
return size - 1;
4315+
}
4316+
return 0;
4317+
}
4318+
42984319
/*
42994320
* Initialize the vop->win array elements.
43004321
*/
@@ -4333,6 +4354,9 @@ static int vop_win_init(struct vop *vop)
43334354
vop_win->vop = vop;
43344355
vop_win->win_id = i;
43354356
vop_win->area_id = 0;
4357+
vop_win->zpos = vop_plane_get_zpos(win_data->type,
4358+
vop_data->win_size);
4359+
43364360
num_wins++;
43374361

43384362
for (j = 0; j < win_data->area_size; j++) {
@@ -4353,7 +4377,7 @@ static int vop_win_init(struct vop *vop)
43534377
}
43544378

43554379
prop = drm_property_create_range(vop->drm_dev, DRM_MODE_PROP_ATOMIC,
4356-
"ZPOS", 0, vop->data->win_size);
4380+
"ZPOS", 0, vop->data->win_size - 1);
43574381
if (!prop) {
43584382
DRM_ERROR("failed to create zpos property\n");
43594383
return -EINVAL;

0 commit comments

Comments
 (0)