Skip to content

Commit 32ca21b

Browse files
jernejskwens
authored andcommitted
drm/sun4i: ui_layer: Change index meaning
In the pursuit of making UI/VI layer code independent of DE version, change meaning of UI index to index of the plane within mixer. DE33 can split amount of VI and UI planes between multiple mixer in whatever way it deems acceptable, so simple calculation VI num + UI index won't be meaningful anymore. Reviewed-by: Chen-Yu Tsai <wens@kernel.org> Tested-by: Ryan Walklin <ryan@testtoast.com> Signed-off-by: Jernej Skrabec <jernej.skrabec@gmail.com> Link: https://patch.msgid.link/20251104180942.61538-15-jernej.skrabec@gmail.com Signed-off-by: Chen-Yu Tsai <wens@kernel.org>
1 parent feea420 commit 32ca21b

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

drivers/gpu/drm/sun4i/sun8i_mixer.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -344,21 +344,22 @@ static struct drm_plane **sun8i_layers_init(struct drm_device *drm,
344344
}
345345

346346
for (i = 0; i < mixer->cfg->ui_num; i++) {
347+
unsigned int index = mixer->cfg->vi_num + i;
347348
struct sun8i_layer *layer;
348349

349350
if (i == 0)
350351
type = DRM_PLANE_TYPE_PRIMARY;
351352
else
352353
type = DRM_PLANE_TYPE_OVERLAY;
353354

354-
layer = sun8i_ui_layer_init_one(drm, mixer, type, i);
355+
layer = sun8i_ui_layer_init_one(drm, mixer, type, index);
355356
if (IS_ERR(layer)) {
356357
dev_err(drm->dev, "Couldn't initialize %s plane\n",
357358
i ? "overlay" : "primary");
358359
return ERR_CAST(layer);
359360
}
360361

361-
planes[mixer->cfg->vi_num + i] = &layer->plane;
362+
planes[index] = &layer->plane;
362363
}
363364

364365
return planes;

drivers/gpu/drm/sun4i/sun8i_ui_layer.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,6 @@ struct sun8i_layer *sun8i_ui_layer_init_one(struct drm_device *drm,
270270
enum drm_plane_type type,
271271
int index)
272272
{
273-
int channel = mixer->cfg->vi_num + index;
274273
struct sun8i_layer *layer;
275274
unsigned int plane_cnt;
276275
int ret;
@@ -281,7 +280,7 @@ struct sun8i_layer *sun8i_ui_layer_init_one(struct drm_device *drm,
281280

282281
layer->mixer = mixer;
283282
layer->type = SUN8I_LAYER_TYPE_UI;
284-
layer->channel = channel;
283+
layer->channel = index;
285284
layer->overlay = 0;
286285

287286
/* possible crtcs are set later */
@@ -303,7 +302,7 @@ struct sun8i_layer *sun8i_ui_layer_init_one(struct drm_device *drm,
303302
return ERR_PTR(ret);
304303
}
305304

306-
ret = drm_plane_create_zpos_property(&layer->plane, channel,
305+
ret = drm_plane_create_zpos_property(&layer->plane, index,
307306
0, plane_cnt - 1);
308307
if (ret) {
309308
dev_err(drm->dev, "Couldn't add zpos property\n");

0 commit comments

Comments
 (0)