Skip to content

Commit feea420

Browse files
jernejskwens
authored andcommitted
drm/sun4i: de2/de3: Move plane type determination to mixer
Plane type determination logic inside layer init functions doesn't allow index register to be repurposed to plane sequence, which it almost is. So move out the logic to mixer, which allows further rework for DE33 support. 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-14-jernej.skrabec@gmail.com Signed-off-by: Chen-Yu Tsai <wens@kernel.org>
1 parent a7febbd commit feea420

5 files changed

Lines changed: 17 additions & 10 deletions

File tree

drivers/gpu/drm/sun4i/sun8i_mixer.c

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,7 @@ static struct drm_plane **sun8i_layers_init(struct drm_device *drm,
316316
{
317317
struct drm_plane **planes;
318318
struct sun8i_mixer *mixer = engine_to_sun8i_mixer(engine);
319+
enum drm_plane_type type;
319320
int i;
320321

321322
planes = devm_kcalloc(drm->dev,
@@ -327,7 +328,12 @@ static struct drm_plane **sun8i_layers_init(struct drm_device *drm,
327328
for (i = 0; i < mixer->cfg->vi_num; i++) {
328329
struct sun8i_layer *layer;
329330

330-
layer = sun8i_vi_layer_init_one(drm, mixer, i);
331+
if (i == 0 && !mixer->cfg->ui_num)
332+
type = DRM_PLANE_TYPE_PRIMARY;
333+
else
334+
type = DRM_PLANE_TYPE_OVERLAY;
335+
336+
layer = sun8i_vi_layer_init_one(drm, mixer, type, i);
331337
if (IS_ERR(layer)) {
332338
dev_err(drm->dev,
333339
"Couldn't initialize overlay plane\n");
@@ -340,7 +346,12 @@ static struct drm_plane **sun8i_layers_init(struct drm_device *drm,
340346
for (i = 0; i < mixer->cfg->ui_num; i++) {
341347
struct sun8i_layer *layer;
342348

343-
layer = sun8i_ui_layer_init_one(drm, mixer, i);
349+
if (i == 0)
350+
type = DRM_PLANE_TYPE_PRIMARY;
351+
else
352+
type = DRM_PLANE_TYPE_OVERLAY;
353+
354+
layer = sun8i_ui_layer_init_one(drm, mixer, type, i);
344355
if (IS_ERR(layer)) {
345356
dev_err(drm->dev, "Couldn't initialize %s plane\n",
346357
i ? "overlay" : "primary");

drivers/gpu/drm/sun4i/sun8i_ui_layer.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -267,9 +267,9 @@ static const uint64_t sun8i_layer_modifiers[] = {
267267

268268
struct sun8i_layer *sun8i_ui_layer_init_one(struct drm_device *drm,
269269
struct sun8i_mixer *mixer,
270+
enum drm_plane_type type,
270271
int index)
271272
{
272-
enum drm_plane_type type = DRM_PLANE_TYPE_OVERLAY;
273273
int channel = mixer->cfg->vi_num + index;
274274
struct sun8i_layer *layer;
275275
unsigned int plane_cnt;
@@ -284,9 +284,6 @@ struct sun8i_layer *sun8i_ui_layer_init_one(struct drm_device *drm,
284284
layer->channel = channel;
285285
layer->overlay = 0;
286286

287-
if (index == 0)
288-
type = DRM_PLANE_TYPE_PRIMARY;
289-
290287
/* possible crtcs are set later */
291288
ret = drm_universal_plane_init(drm, &layer->plane, 0,
292289
&sun8i_ui_layer_funcs,

drivers/gpu/drm/sun4i/sun8i_ui_layer.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,5 +51,6 @@ struct sun8i_layer;
5151

5252
struct sun8i_layer *sun8i_ui_layer_init_one(struct drm_device *drm,
5353
struct sun8i_mixer *mixer,
54+
enum drm_plane_type type,
5455
int index);
5556
#endif /* _SUN8I_UI_LAYER_H_ */

drivers/gpu/drm/sun4i/sun8i_vi_layer.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -412,9 +412,9 @@ static const uint64_t sun8i_layer_modifiers[] = {
412412

413413
struct sun8i_layer *sun8i_vi_layer_init_one(struct drm_device *drm,
414414
struct sun8i_mixer *mixer,
415+
enum drm_plane_type type,
415416
int index)
416417
{
417-
enum drm_plane_type type = DRM_PLANE_TYPE_OVERLAY;
418418
u32 supported_encodings, supported_ranges;
419419
unsigned int plane_cnt, format_count;
420420
struct sun8i_layer *layer;
@@ -438,9 +438,6 @@ struct sun8i_layer *sun8i_vi_layer_init_one(struct drm_device *drm,
438438
format_count = ARRAY_SIZE(sun8i_vi_layer_formats);
439439
}
440440

441-
if (!mixer->cfg->ui_num && index == 0)
442-
type = DRM_PLANE_TYPE_PRIMARY;
443-
444441
/* possible crtcs are set later */
445442
ret = drm_universal_plane_init(drm, &layer->plane, 0,
446443
&sun8i_vi_layer_funcs,

drivers/gpu/drm/sun4i/sun8i_vi_layer.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,5 +56,6 @@ struct sun8i_layer;
5656

5757
struct sun8i_layer *sun8i_vi_layer_init_one(struct drm_device *drm,
5858
struct sun8i_mixer *mixer,
59+
enum drm_plane_type type,
5960
int index);
6061
#endif /* _SUN8I_VI_LAYER_H_ */

0 commit comments

Comments
 (0)