Commit 3d705fb0 authored by Paul Cercueil's avatar Paul Cercueil

drm/ingenic: Support handling different pixel formats in F0/F1 planes

Until now the ingenic-drm driver supported the same pixel formats on the
F0 and F1 planes, and across all SoCs. However, the F0 plane does support
paletted 8bpp, while the F1 plane doesn't.

Furthermore, the three SoCs currently supported all have different pixel
formats available; 24bpp was added in JZ4725B, 30bpp was added in
JZ4770.

Prepare the inclusion of paletted 8bpp, 24bpp and 30bpp support by
having separate pixel format lists for F0 and F1 planes.
Signed-off-by: default avatarPaul Cercueil <paul@crapouillou.net>
Reviewed-by: default avatarSam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20200926170501.1109197-5-paul@crapouillou.net
parent 174d8e52
...@@ -56,6 +56,8 @@ struct jz_soc_info { ...@@ -56,6 +56,8 @@ struct jz_soc_info {
bool needs_dev_clk; bool needs_dev_clk;
bool has_osd; bool has_osd;
unsigned int max_width, max_height; unsigned int max_width, max_height;
const u32 *formats_f0, *formats_f1;
unsigned int num_formats_f0, num_formats_f1;
}; };
struct ingenic_drm { struct ingenic_drm {
...@@ -95,12 +97,6 @@ struct ingenic_drm { ...@@ -95,12 +97,6 @@ struct ingenic_drm {
struct notifier_block clock_nb; struct notifier_block clock_nb;
}; };
static const u32 ingenic_drm_primary_formats[] = {
DRM_FORMAT_XRGB1555,
DRM_FORMAT_RGB565,
DRM_FORMAT_XRGB8888,
};
static bool ingenic_drm_cached_gem_buf; static bool ingenic_drm_cached_gem_buf;
module_param_named(cached_gem_buffers, ingenic_drm_cached_gem_buf, bool, 0400); module_param_named(cached_gem_buffers, ingenic_drm_cached_gem_buf, bool, 0400);
MODULE_PARM_DESC(cached_gem_buffers, MODULE_PARM_DESC(cached_gem_buffers,
...@@ -963,8 +959,8 @@ static int ingenic_drm_bind(struct device *dev, bool has_components) ...@@ -963,8 +959,8 @@ static int ingenic_drm_bind(struct device *dev, bool has_components)
ret = drm_universal_plane_init(drm, &priv->f1, 1, ret = drm_universal_plane_init(drm, &priv->f1, 1,
&ingenic_drm_primary_plane_funcs, &ingenic_drm_primary_plane_funcs,
ingenic_drm_primary_formats, priv->soc_info->formats_f1,
ARRAY_SIZE(ingenic_drm_primary_formats), priv->soc_info->num_formats_f1,
NULL, DRM_PLANE_TYPE_PRIMARY, NULL); NULL, DRM_PLANE_TYPE_PRIMARY, NULL);
if (ret) { if (ret) {
dev_err(dev, "Failed to register plane: %i\n", ret); dev_err(dev, "Failed to register plane: %i\n", ret);
...@@ -988,8 +984,8 @@ static int ingenic_drm_bind(struct device *dev, bool has_components) ...@@ -988,8 +984,8 @@ static int ingenic_drm_bind(struct device *dev, bool has_components)
ret = drm_universal_plane_init(drm, &priv->f0, 1, ret = drm_universal_plane_init(drm, &priv->f0, 1,
&ingenic_drm_primary_plane_funcs, &ingenic_drm_primary_plane_funcs,
ingenic_drm_primary_formats, priv->soc_info->formats_f0,
ARRAY_SIZE(ingenic_drm_primary_formats), priv->soc_info->num_formats_f0,
NULL, DRM_PLANE_TYPE_OVERLAY, NULL, DRM_PLANE_TYPE_OVERLAY,
NULL); NULL);
if (ret) { if (ret) {
...@@ -1204,11 +1200,44 @@ static int ingenic_drm_remove(struct platform_device *pdev) ...@@ -1204,11 +1200,44 @@ static int ingenic_drm_remove(struct platform_device *pdev)
return 0; return 0;
} }
static const u32 jz4740_formats[] = {
DRM_FORMAT_XRGB1555,
DRM_FORMAT_RGB565,
DRM_FORMAT_XRGB8888,
};
static const u32 jz4725b_formats_f1[] = {
DRM_FORMAT_XRGB1555,
DRM_FORMAT_RGB565,
DRM_FORMAT_XRGB8888,
};
static const u32 jz4725b_formats_f0[] = {
DRM_FORMAT_XRGB1555,
DRM_FORMAT_RGB565,
DRM_FORMAT_XRGB8888,
};
static const u32 jz4770_formats_f1[] = {
DRM_FORMAT_XRGB1555,
DRM_FORMAT_RGB565,
DRM_FORMAT_XRGB8888,
};
static const u32 jz4770_formats_f0[] = {
DRM_FORMAT_XRGB1555,
DRM_FORMAT_RGB565,
DRM_FORMAT_XRGB8888,
};
static const struct jz_soc_info jz4740_soc_info = { static const struct jz_soc_info jz4740_soc_info = {
.needs_dev_clk = true, .needs_dev_clk = true,
.has_osd = false, .has_osd = false,
.max_width = 800, .max_width = 800,
.max_height = 600, .max_height = 600,
.formats_f1 = jz4740_formats,
.num_formats_f1 = ARRAY_SIZE(jz4740_formats),
/* JZ4740 has only one plane */
}; };
static const struct jz_soc_info jz4725b_soc_info = { static const struct jz_soc_info jz4725b_soc_info = {
...@@ -1216,6 +1245,10 @@ static const struct jz_soc_info jz4725b_soc_info = { ...@@ -1216,6 +1245,10 @@ static const struct jz_soc_info jz4725b_soc_info = {
.has_osd = true, .has_osd = true,
.max_width = 800, .max_width = 800,
.max_height = 600, .max_height = 600,
.formats_f1 = jz4725b_formats_f1,
.num_formats_f1 = ARRAY_SIZE(jz4725b_formats_f1),
.formats_f0 = jz4725b_formats_f0,
.num_formats_f0 = ARRAY_SIZE(jz4725b_formats_f0),
}; };
static const struct jz_soc_info jz4770_soc_info = { static const struct jz_soc_info jz4770_soc_info = {
...@@ -1223,6 +1256,10 @@ static const struct jz_soc_info jz4770_soc_info = { ...@@ -1223,6 +1256,10 @@ static const struct jz_soc_info jz4770_soc_info = {
.has_osd = true, .has_osd = true,
.max_width = 1280, .max_width = 1280,
.max_height = 720, .max_height = 720,
.formats_f1 = jz4770_formats_f1,
.num_formats_f1 = ARRAY_SIZE(jz4770_formats_f1),
.formats_f0 = jz4770_formats_f0,
.num_formats_f0 = ARRAY_SIZE(jz4770_formats_f0),
}; };
static const struct of_device_id ingenic_drm_of_match[] = { static const struct of_device_id ingenic_drm_of_match[] = {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment