Skip to content

Commit 258905c

Browse files
hongchi.pengdliviu
authored andcommitted
drm: komeda: Fix an issue related to normalized zpos
We use komeda_crtc_normalize_zpos to normalize zpos of affected planes to their blending zorder in CU. If there's only one slave plane in affected planes and its layer_split property is enabled, order++ for its split layer, so that when calculating the normalized_zpos of master planes, the split layer of the slave plane is included, but the max_slave_zorder does not include the split layer and keep zero because there's only one slave plane in affacted planes, although we actually use two slave layers in this commit. In most cases, this bug does not result in a commit failure, but assume the following situation: slave_layer 0: zpos = 0, layer split enabled, normalized_zpos = 0;(use slave_layer 2 as its split layer) master_layer 0: zpos = 2, layer_split enabled, normalized_zpos = 2;(use master_layer 2 as its split layer) master_layer 1: zpos = 4, normalized_zpos = 4; master_layer 3: zpos = 5, normalized_zpos = 5; kcrtc_st->max_slave_zorder = 0; When we use master_layer 3 as a input of CU in function komeda_compiz_set_input and check it with function komeda_component_check_input, the parameter idx is equal to normailzed_zpos minus max_slave_zorder, the value of idx is 5 and is euqal to CU's max_active_inputs, so that komeda_component_check_input returns a -EINVAL value. To fix the bug described above, when calculating the max_slave_zorder with the layer_split enabled, count the split layer in this calculation directly. Signed-off-by: hongchi.peng <[email protected]> Acked-by: Liviu Dudau <[email protected]> Signed-off-by: Liviu Dudau <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent 9d824c7 commit 258905c

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

drivers/gpu/drm/arm/display/komeda/komeda_kms.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ static int komeda_crtc_normalize_zpos(struct drm_crtc *crtc,
160160
struct drm_plane *plane;
161161
struct list_head zorder_list;
162162
int order = 0, err;
163+
u32 slave_zpos = 0;
163164

164165
DRM_DEBUG_ATOMIC("[CRTC:%d:%s] calculating normalized zpos values\n",
165166
crtc->base.id, crtc->name);
@@ -199,10 +200,13 @@ static int komeda_crtc_normalize_zpos(struct drm_crtc *crtc,
199200
plane_st->zpos, plane_st->normalized_zpos);
200201

201202
/* calculate max slave zorder */
202-
if (has_bit(drm_plane_index(plane), kcrtc->slave_planes))
203+
if (has_bit(drm_plane_index(plane), kcrtc->slave_planes)) {
204+
slave_zpos = plane_st->normalized_zpos;
205+
if (to_kplane_st(plane_st)->layer_split)
206+
slave_zpos++;
203207
kcrtc_st->max_slave_zorder =
204-
max(plane_st->normalized_zpos,
205-
kcrtc_st->max_slave_zorder);
208+
max(slave_zpos, kcrtc_st->max_slave_zorder);
209+
}
206210
}
207211

208212
crtc_st->zpos_changed = true;

0 commit comments

Comments
 (0)