mirror of
https://github.com/torvalds/linux.git
synced 2025-12-07 20:06:24 +00:00
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>
This commit is contained in:
committed by
Chen-Yu Tsai
parent
a7febbd455
commit
feea4205ef
@@ -316,6 +316,7 @@ static struct drm_plane **sun8i_layers_init(struct drm_device *drm,
|
||||
{
|
||||
struct drm_plane **planes;
|
||||
struct sun8i_mixer *mixer = engine_to_sun8i_mixer(engine);
|
||||
enum drm_plane_type type;
|
||||
int i;
|
||||
|
||||
planes = devm_kcalloc(drm->dev,
|
||||
@@ -327,7 +328,12 @@ static struct drm_plane **sun8i_layers_init(struct drm_device *drm,
|
||||
for (i = 0; i < mixer->cfg->vi_num; i++) {
|
||||
struct sun8i_layer *layer;
|
||||
|
||||
layer = sun8i_vi_layer_init_one(drm, mixer, i);
|
||||
if (i == 0 && !mixer->cfg->ui_num)
|
||||
type = DRM_PLANE_TYPE_PRIMARY;
|
||||
else
|
||||
type = DRM_PLANE_TYPE_OVERLAY;
|
||||
|
||||
layer = sun8i_vi_layer_init_one(drm, mixer, type, i);
|
||||
if (IS_ERR(layer)) {
|
||||
dev_err(drm->dev,
|
||||
"Couldn't initialize overlay plane\n");
|
||||
@@ -340,7 +346,12 @@ static struct drm_plane **sun8i_layers_init(struct drm_device *drm,
|
||||
for (i = 0; i < mixer->cfg->ui_num; i++) {
|
||||
struct sun8i_layer *layer;
|
||||
|
||||
layer = sun8i_ui_layer_init_one(drm, mixer, i);
|
||||
if (i == 0)
|
||||
type = DRM_PLANE_TYPE_PRIMARY;
|
||||
else
|
||||
type = DRM_PLANE_TYPE_OVERLAY;
|
||||
|
||||
layer = sun8i_ui_layer_init_one(drm, mixer, type, i);
|
||||
if (IS_ERR(layer)) {
|
||||
dev_err(drm->dev, "Couldn't initialize %s plane\n",
|
||||
i ? "overlay" : "primary");
|
||||
|
||||
@@ -267,9 +267,9 @@ 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)
|
||||
{
|
||||
enum drm_plane_type type = DRM_PLANE_TYPE_OVERLAY;
|
||||
int channel = mixer->cfg->vi_num + index;
|
||||
struct sun8i_layer *layer;
|
||||
unsigned int plane_cnt;
|
||||
@@ -284,9 +284,6 @@ struct sun8i_layer *sun8i_ui_layer_init_one(struct drm_device *drm,
|
||||
layer->channel = channel;
|
||||
layer->overlay = 0;
|
||||
|
||||
if (index == 0)
|
||||
type = DRM_PLANE_TYPE_PRIMARY;
|
||||
|
||||
/* possible crtcs are set later */
|
||||
ret = drm_universal_plane_init(drm, &layer->plane, 0,
|
||||
&sun8i_ui_layer_funcs,
|
||||
|
||||
@@ -51,5 +51,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);
|
||||
#endif /* _SUN8I_UI_LAYER_H_ */
|
||||
|
||||
@@ -412,9 +412,9 @@ 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)
|
||||
{
|
||||
enum drm_plane_type type = DRM_PLANE_TYPE_OVERLAY;
|
||||
u32 supported_encodings, supported_ranges;
|
||||
unsigned int plane_cnt, format_count;
|
||||
struct sun8i_layer *layer;
|
||||
@@ -438,9 +438,6 @@ struct sun8i_layer *sun8i_vi_layer_init_one(struct drm_device *drm,
|
||||
format_count = ARRAY_SIZE(sun8i_vi_layer_formats);
|
||||
}
|
||||
|
||||
if (!mixer->cfg->ui_num && index == 0)
|
||||
type = DRM_PLANE_TYPE_PRIMARY;
|
||||
|
||||
/* possible crtcs are set later */
|
||||
ret = drm_universal_plane_init(drm, &layer->plane, 0,
|
||||
&sun8i_vi_layer_funcs,
|
||||
|
||||
@@ -56,5 +56,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);
|
||||
#endif /* _SUN8I_VI_LAYER_H_ */
|
||||
|
||||
Reference in New Issue
Block a user