mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-16 10:11:38 -04:00
drm/sun4i: layer: move num of planes calc out of layer code
With DE33, number of planes no longer depends on mixer because layers are shared between all mixers. Get this value via parameter, so DE specific code can fill in proper value. 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-16-jernej.skrabec@gmail.com Signed-off-by: Chen-Yu Tsai <wens@kernel.org>
This commit is contained in:
committed by
Chen-Yu Tsai
parent
32ca21b97f
commit
4fa45b04a4
@@ -316,12 +316,11 @@ static struct drm_plane **sun8i_layers_init(struct drm_device *drm,
|
||||
{
|
||||
struct drm_plane **planes;
|
||||
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;
|
||||
int i;
|
||||
|
||||
planes = devm_kcalloc(drm->dev,
|
||||
mixer->cfg->vi_num + mixer->cfg->ui_num + 1,
|
||||
sizeof(*planes), GFP_KERNEL);
|
||||
planes = devm_kcalloc(drm->dev, plane_cnt, sizeof(*planes), GFP_KERNEL);
|
||||
if (!planes)
|
||||
return ERR_PTR(-ENOMEM);
|
||||
|
||||
@@ -333,7 +332,7 @@ static struct drm_plane **sun8i_layers_init(struct drm_device *drm,
|
||||
else
|
||||
type = DRM_PLANE_TYPE_OVERLAY;
|
||||
|
||||
layer = sun8i_vi_layer_init_one(drm, mixer, type, i);
|
||||
layer = sun8i_vi_layer_init_one(drm, mixer, type, i, plane_cnt);
|
||||
if (IS_ERR(layer)) {
|
||||
dev_err(drm->dev,
|
||||
"Couldn't initialize overlay plane\n");
|
||||
@@ -352,7 +351,8 @@ static struct drm_plane **sun8i_layers_init(struct drm_device *drm,
|
||||
else
|
||||
type = DRM_PLANE_TYPE_OVERLAY;
|
||||
|
||||
layer = sun8i_ui_layer_init_one(drm, mixer, type, index);
|
||||
layer = sun8i_ui_layer_init_one(drm, mixer, type, index,
|
||||
plane_cnt);
|
||||
if (IS_ERR(layer)) {
|
||||
dev_err(drm->dev, "Couldn't initialize %s plane\n",
|
||||
i ? "overlay" : "primary");
|
||||
|
||||
@@ -268,10 +268,10 @@ static const uint64_t sun8i_layer_modifiers[] = {
|
||||
struct sun8i_layer *sun8i_ui_layer_init_one(struct drm_device *drm,
|
||||
struct sun8i_mixer *mixer,
|
||||
enum drm_plane_type type,
|
||||
int index)
|
||||
int index,
|
||||
int plane_cnt)
|
||||
{
|
||||
struct sun8i_layer *layer;
|
||||
unsigned int plane_cnt;
|
||||
int ret;
|
||||
|
||||
layer = devm_kzalloc(drm->dev, sizeof(*layer), GFP_KERNEL);
|
||||
@@ -294,8 +294,6 @@ struct sun8i_layer *sun8i_ui_layer_init_one(struct drm_device *drm,
|
||||
return ERR_PTR(ret);
|
||||
}
|
||||
|
||||
plane_cnt = mixer->cfg->ui_num + mixer->cfg->vi_num;
|
||||
|
||||
ret = drm_plane_create_alpha_property(&layer->plane);
|
||||
if (ret) {
|
||||
dev_err(drm->dev, "Couldn't add alpha property\n");
|
||||
|
||||
@@ -52,5 +52,6 @@ struct sun8i_layer;
|
||||
struct sun8i_layer *sun8i_ui_layer_init_one(struct drm_device *drm,
|
||||
struct sun8i_mixer *mixer,
|
||||
enum drm_plane_type type,
|
||||
int index);
|
||||
int index,
|
||||
int plane_cnt);
|
||||
#endif /* _SUN8I_UI_LAYER_H_ */
|
||||
|
||||
@@ -413,10 +413,11 @@ static const uint64_t sun8i_layer_modifiers[] = {
|
||||
struct sun8i_layer *sun8i_vi_layer_init_one(struct drm_device *drm,
|
||||
struct sun8i_mixer *mixer,
|
||||
enum drm_plane_type type,
|
||||
int index)
|
||||
int index,
|
||||
int plane_cnt)
|
||||
{
|
||||
u32 supported_encodings, supported_ranges;
|
||||
unsigned int plane_cnt, format_count;
|
||||
unsigned int format_count;
|
||||
struct sun8i_layer *layer;
|
||||
const u32 *formats;
|
||||
int ret;
|
||||
@@ -449,8 +450,6 @@ struct sun8i_layer *sun8i_vi_layer_init_one(struct drm_device *drm,
|
||||
return ERR_PTR(ret);
|
||||
}
|
||||
|
||||
plane_cnt = mixer->cfg->ui_num + mixer->cfg->vi_num;
|
||||
|
||||
if (mixer->cfg->vi_num == 1 || mixer->cfg->de_type >= SUN8I_MIXER_DE3) {
|
||||
ret = drm_plane_create_alpha_property(&layer->plane);
|
||||
if (ret) {
|
||||
|
||||
@@ -57,5 +57,6 @@ struct sun8i_layer;
|
||||
struct sun8i_layer *sun8i_vi_layer_init_one(struct drm_device *drm,
|
||||
struct sun8i_mixer *mixer,
|
||||
enum drm_plane_type type,
|
||||
int index);
|
||||
int index,
|
||||
int plane_cnt);
|
||||
#endif /* _SUN8I_VI_LAYER_H_ */
|
||||
|
||||
Reference in New Issue
Block a user