summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/sun4i/sun8i_ui_layer.c
diff options
context:
space:
mode:
authorJernej Skrabec <jernej.skrabec@gmail.com>2025-11-04 19:09:40 +0100
committerChen-Yu Tsai <wens@kernel.org>2025-11-12 17:18:25 +0800
commitbb1d2ddee5c45017e6b6e50c9eda02cb2bd600b6 (patch)
treeab9b1e2155aa7cc90710c581bf11b14fc0a0a15c /drivers/gpu/drm/sun4i/sun8i_ui_layer.c
parentd1fe2639425c121f811f73fd948dea2477ad9a19 (diff)
drm/sun4i: layer: replace mixer with layer struct
This allows to almost completely decouple layer code from mixer. This is important for DE33. 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-29-jernej.skrabec@gmail.com Signed-off-by: Chen-Yu Tsai <wens@kernel.org>
Diffstat (limited to 'drivers/gpu/drm/sun4i/sun8i_ui_layer.c')
-rw-r--r--drivers/gpu/drm/sun4i/sun8i_ui_layer.c24
1 files changed, 11 insertions, 13 deletions
diff --git a/drivers/gpu/drm/sun4i/sun8i_ui_layer.c b/drivers/gpu/drm/sun4i/sun8i_ui_layer.c
index cd19e40aefdc..a8a67241c822 100644
--- a/drivers/gpu/drm/sun4i/sun8i_ui_layer.c
+++ b/drivers/gpu/drm/sun4i/sun8i_ui_layer.c
@@ -28,10 +28,9 @@
static void sun8i_ui_layer_disable(struct sun8i_layer *layer)
{
- struct sun8i_mixer *mixer = layer->mixer;
- u32 ch_base = sun8i_channel_base(mixer, layer->channel);
+ u32 ch_base = sun8i_channel_base(layer);
- regmap_write(mixer->engine.regs,
+ regmap_write(layer->regs,
SUN8I_MIXER_CHAN_UI_LAYER_ATTR(ch_base, layer->overlay), 0);
}
@@ -39,11 +38,10 @@ static void sun8i_ui_layer_update_attributes(struct sun8i_layer *layer,
struct drm_plane *plane)
{
struct drm_plane_state *state = plane->state;
- struct sun8i_mixer *mixer = layer->mixer;
const struct drm_format_info *fmt;
u32 val, ch_base, hw_fmt;
- ch_base = sun8i_channel_base(mixer, layer->channel);
+ ch_base = sun8i_channel_base(layer);
fmt = state->fb->format;
sun8i_mixer_drm_format_to_hw(fmt->format, &hw_fmt);
@@ -62,7 +60,6 @@ static void sun8i_ui_layer_update_coord(struct sun8i_layer *layer,
struct drm_plane *plane)
{
struct drm_plane_state *state = plane->state;
- struct sun8i_mixer *mixer = layer->mixer;
u32 src_w, src_h, dst_w, dst_h;
u32 outsize, insize;
u32 hphase, vphase;
@@ -71,7 +68,7 @@ static void sun8i_ui_layer_update_coord(struct sun8i_layer *layer,
DRM_DEBUG_DRIVER("Updating UI channel %d overlay %d\n",
layer->channel, layer->overlay);
- ch_base = sun8i_channel_base(mixer, layer->channel);
+ ch_base = sun8i_channel_base(layer);
src_w = drm_rect_width(&state->src) >> 16;
src_h = drm_rect_height(&state->src) >> 16;
@@ -103,7 +100,7 @@ static void sun8i_ui_layer_update_coord(struct sun8i_layer *layer,
hscale = state->src_w / state->crtc_w;
vscale = state->src_h / state->crtc_h;
- if (mixer->cfg->de_type == SUN8I_MIXER_DE33) {
+ if (layer->cfg->de_type == SUN8I_MIXER_DE33) {
sun8i_vi_scaler_setup(layer, src_w, src_h, dst_w, dst_h,
hscale, vscale, hphase, vphase,
state->fb->format);
@@ -115,7 +112,7 @@ static void sun8i_ui_layer_update_coord(struct sun8i_layer *layer,
}
} else {
DRM_DEBUG_DRIVER("HW scaling is not needed\n");
- if (mixer->cfg->de_type == SUN8I_MIXER_DE33)
+ if (layer->cfg->de_type == SUN8I_MIXER_DE33)
sun8i_vi_scaler_enable(layer, false);
else
sun8i_ui_scaler_enable(layer, false);
@@ -126,14 +123,13 @@ static void sun8i_ui_layer_update_buffer(struct sun8i_layer *layer,
struct drm_plane *plane)
{
struct drm_plane_state *state = plane->state;
- struct sun8i_mixer *mixer = layer->mixer;
struct drm_framebuffer *fb = state->fb;
struct drm_gem_dma_object *gem;
dma_addr_t dma_addr;
u32 ch_base;
int bpp;
- ch_base = sun8i_channel_base(mixer, layer->channel);
+ ch_base = sun8i_channel_base(layer);
/* Get the physical address of the buffer in memory */
gem = drm_fb_dma_get_gem_obj(fb, 0);
@@ -190,7 +186,7 @@ static int sun8i_ui_layer_atomic_check(struct drm_plane *plane,
min_scale = DRM_PLANE_NO_SCALING;
max_scale = DRM_PLANE_NO_SCALING;
- if (layer->mixer->cfg->lay_cfg.scaler_mask & BIT(layer->channel)) {
+ if (layer->cfg->scaler_mask & BIT(layer->channel)) {
min_scale = SUN8I_UI_SCALER_SCALE_MIN;
max_scale = SUN8I_UI_SCALER_SCALE_MAX;
}
@@ -266,7 +262,8 @@ struct sun8i_layer *sun8i_ui_layer_init_one(struct drm_device *drm,
enum drm_plane_type type,
struct regmap *regs,
int index, int phy_index,
- int plane_cnt)
+ int plane_cnt,
+ const struct sun8i_layer_cfg *cfg)
{
struct sun8i_layer *layer;
int ret;
@@ -281,6 +278,7 @@ struct sun8i_layer *sun8i_ui_layer_init_one(struct drm_device *drm,
layer->channel = phy_index;
layer->overlay = 0;
layer->regs = regs;
+ layer->cfg = cfg;
/* possible crtcs are set later */
ret = drm_universal_plane_init(drm, &layer->plane, 0,