175 lines
6.3 KiB
Diff
175 lines
6.3 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Jernej Skrabec <[email protected]>
|
|
Date: Sun, 12 Oct 2025 21:23:22 +0200
|
|
Subject: drm/sun4i: layers: add physical index arg
|
|
|
|
This avoids plane mapping in layers code, which allows future
|
|
refactoring, when layer code will move away from accessing mixer
|
|
structure.
|
|
|
|
Reviewed-by: Chen-Yu Tsai <[email protected]>
|
|
Tested-by: Ryan Walklin <[email protected]>
|
|
Signed-off-by: Jernej Skrabec <[email protected]>
|
|
---
|
|
drivers/gpu/drm/sun4i/sun8i_mixer.c | 17 +++++++---
|
|
drivers/gpu/drm/sun4i/sun8i_mixer.h | 3 +-
|
|
drivers/gpu/drm/sun4i/sun8i_ui_layer.c | 5 +--
|
|
drivers/gpu/drm/sun4i/sun8i_ui_layer.h | 2 +-
|
|
drivers/gpu/drm/sun4i/sun8i_vi_layer.c | 5 +--
|
|
drivers/gpu/drm/sun4i/sun8i_vi_layer.h | 2 +-
|
|
6 files changed, 23 insertions(+), 11 deletions(-)
|
|
|
|
diff --git a/drivers/gpu/drm/sun4i/sun8i_mixer.c b/drivers/gpu/drm/sun4i/sun8i_mixer.c
|
|
index 111111111111..222222222222 100644
|
|
--- a/drivers/gpu/drm/sun4i/sun8i_mixer.c
|
|
+++ b/drivers/gpu/drm/sun4i/sun8i_mixer.c
|
|
@@ -283,14 +283,14 @@ static void sun8i_mixer_commit(struct sunxi_engine *engine,
|
|
h = drm_rect_height(&plane_state->dst);
|
|
|
|
DRM_DEBUG_DRIVER(" plane %d: chan=%d ovl=%d en=%d zpos=%d x=%d y=%d w=%d h=%d\n",
|
|
- plane->base.id, layer->channel, layer->overlay,
|
|
+ plane->base.id, layer->index, layer->overlay,
|
|
enable, zpos, x, y, w, h);
|
|
|
|
if (!enable)
|
|
continue;
|
|
|
|
/* Route layer to pipe based on zpos */
|
|
- route |= layer->channel << SUN8I_MIXER_BLEND_ROUTE_PIPE_SHIFT(zpos);
|
|
+ route |= layer->index << SUN8I_MIXER_BLEND_ROUTE_PIPE_SHIFT(zpos);
|
|
pipe_en |= SUN8I_MIXER_BLEND_PIPE_CTL_EN(zpos);
|
|
|
|
regmap_write(bld_regs,
|
|
@@ -317,6 +317,7 @@ static struct drm_plane **sun8i_layers_init(struct drm_device *drm,
|
|
struct sun8i_mixer *mixer = engine_to_sun8i_mixer(engine);
|
|
int plane_cnt = mixer->cfg->ui_num + mixer->cfg->vi_num;
|
|
enum drm_plane_type type;
|
|
+ unsigned int phy_index;
|
|
int i;
|
|
|
|
planes = devm_kcalloc(drm->dev, plane_cnt, sizeof(*planes), GFP_KERNEL);
|
|
@@ -331,9 +332,13 @@ static struct drm_plane **sun8i_layers_init(struct drm_device *drm,
|
|
else
|
|
type = DRM_PLANE_TYPE_OVERLAY;
|
|
|
|
+ phy_index = i;
|
|
+ if (mixer->cfg->de_type == SUN8I_MIXER_DE33)
|
|
+ phy_index = mixer->cfg->map[i];
|
|
+
|
|
layer = sun8i_vi_layer_init_one(drm, mixer, type,
|
|
mixer->engine.regs, i,
|
|
- plane_cnt);
|
|
+ phy_index, plane_cnt);
|
|
if (IS_ERR(layer)) {
|
|
dev_err(drm->dev,
|
|
"Couldn't initialize overlay plane\n");
|
|
@@ -352,9 +357,13 @@ static struct drm_plane **sun8i_layers_init(struct drm_device *drm,
|
|
else
|
|
type = DRM_PLANE_TYPE_OVERLAY;
|
|
|
|
+ phy_index = index;
|
|
+ if (mixer->cfg->de_type == SUN8I_MIXER_DE33)
|
|
+ phy_index = mixer->cfg->map[index];
|
|
+
|
|
layer = sun8i_ui_layer_init_one(drm, mixer, type,
|
|
mixer->engine.regs, index,
|
|
- plane_cnt);
|
|
+ phy_index, plane_cnt);
|
|
if (IS_ERR(layer)) {
|
|
dev_err(drm->dev, "Couldn't initialize %s plane\n",
|
|
i ? "overlay" : "primary");
|
|
diff --git a/drivers/gpu/drm/sun4i/sun8i_mixer.h b/drivers/gpu/drm/sun4i/sun8i_mixer.h
|
|
index 111111111111..222222222222 100644
|
|
--- a/drivers/gpu/drm/sun4i/sun8i_mixer.h
|
|
+++ b/drivers/gpu/drm/sun4i/sun8i_mixer.h
|
|
@@ -212,6 +212,7 @@ struct sun8i_layer {
|
|
struct drm_plane plane;
|
|
struct sun8i_mixer *mixer;
|
|
int type;
|
|
+ int index;
|
|
int channel;
|
|
int overlay;
|
|
struct regmap *regs;
|
|
@@ -246,7 +247,7 @@ static inline u32
|
|
sun8i_channel_base(struct sun8i_mixer *mixer, int channel)
|
|
{
|
|
if (mixer->cfg->de_type == SUN8I_MIXER_DE33)
|
|
- return DE33_CH_BASE + mixer->cfg->map[channel] * DE33_CH_SIZE;
|
|
+ return DE33_CH_BASE + channel * DE33_CH_SIZE;
|
|
else if (mixer->cfg->de_type == SUN8I_MIXER_DE3)
|
|
return DE3_CH_BASE + channel * DE3_CH_SIZE;
|
|
else
|
|
diff --git a/drivers/gpu/drm/sun4i/sun8i_ui_layer.c b/drivers/gpu/drm/sun4i/sun8i_ui_layer.c
|
|
index 111111111111..222222222222 100644
|
|
--- a/drivers/gpu/drm/sun4i/sun8i_ui_layer.c
|
|
+++ b/drivers/gpu/drm/sun4i/sun8i_ui_layer.c
|
|
@@ -265,7 +265,7 @@ struct sun8i_layer *sun8i_ui_layer_init_one(struct drm_device *drm,
|
|
struct sun8i_mixer *mixer,
|
|
enum drm_plane_type type,
|
|
struct regmap *regs,
|
|
- int index,
|
|
+ int index, int phy_index,
|
|
int plane_cnt)
|
|
{
|
|
struct sun8i_layer *layer;
|
|
@@ -277,7 +277,8 @@ struct sun8i_layer *sun8i_ui_layer_init_one(struct drm_device *drm,
|
|
|
|
layer->mixer = mixer;
|
|
layer->type = SUN8I_LAYER_TYPE_UI;
|
|
- layer->channel = index;
|
|
+ layer->index = index;
|
|
+ layer->channel = phy_index;
|
|
layer->overlay = 0;
|
|
layer->regs = regs;
|
|
|
|
diff --git a/drivers/gpu/drm/sun4i/sun8i_ui_layer.h b/drivers/gpu/drm/sun4i/sun8i_ui_layer.h
|
|
index 111111111111..222222222222 100644
|
|
--- a/drivers/gpu/drm/sun4i/sun8i_ui_layer.h
|
|
+++ b/drivers/gpu/drm/sun4i/sun8i_ui_layer.h
|
|
@@ -53,6 +53,6 @@ struct sun8i_layer *sun8i_ui_layer_init_one(struct drm_device *drm,
|
|
struct sun8i_mixer *mixer,
|
|
enum drm_plane_type type,
|
|
struct regmap *regs,
|
|
- int index,
|
|
+ int index, int phy_index,
|
|
int plane_cnt);
|
|
#endif /* _SUN8I_UI_LAYER_H_ */
|
|
diff --git a/drivers/gpu/drm/sun4i/sun8i_vi_layer.c b/drivers/gpu/drm/sun4i/sun8i_vi_layer.c
|
|
index 111111111111..222222222222 100644
|
|
--- a/drivers/gpu/drm/sun4i/sun8i_vi_layer.c
|
|
+++ b/drivers/gpu/drm/sun4i/sun8i_vi_layer.c
|
|
@@ -411,7 +411,7 @@ struct sun8i_layer *sun8i_vi_layer_init_one(struct drm_device *drm,
|
|
struct sun8i_mixer *mixer,
|
|
enum drm_plane_type type,
|
|
struct regmap *regs,
|
|
- int index,
|
|
+ int index, int phy_index,
|
|
int plane_cnt)
|
|
{
|
|
u32 supported_encodings, supported_ranges;
|
|
@@ -426,7 +426,8 @@ struct sun8i_layer *sun8i_vi_layer_init_one(struct drm_device *drm,
|
|
|
|
layer->mixer = mixer;
|
|
layer->type = SUN8I_LAYER_TYPE_VI;
|
|
- layer->channel = index;
|
|
+ layer->index = index;
|
|
+ layer->channel = phy_index;
|
|
layer->overlay = 0;
|
|
layer->regs = regs;
|
|
|
|
diff --git a/drivers/gpu/drm/sun4i/sun8i_vi_layer.h b/drivers/gpu/drm/sun4i/sun8i_vi_layer.h
|
|
index 111111111111..222222222222 100644
|
|
--- a/drivers/gpu/drm/sun4i/sun8i_vi_layer.h
|
|
+++ b/drivers/gpu/drm/sun4i/sun8i_vi_layer.h
|
|
@@ -58,6 +58,6 @@ struct sun8i_layer *sun8i_vi_layer_init_one(struct drm_device *drm,
|
|
struct sun8i_mixer *mixer,
|
|
enum drm_plane_type type,
|
|
struct regmap *regs,
|
|
- int index,
|
|
+ int index, int phy_index,
|
|
int plane_cnt);
|
|
#endif /* _SUN8I_VI_LAYER_H_ */
|
|
--
|
|
Armbian
|
|
|