summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/sun4i/sun8i_mixer.c
diff options
context:
space:
mode:
authorJernej Skrabec <jernej.skrabec@siol.net>2017-12-01 07:05:42 +0100
committerMaxime Ripard <maxime.ripard@free-electrons.com>2017-12-05 13:22:43 +0100
commit7480ba4d75714b4f5b080aa5a53e352b303d2663 (patch)
treee294bf80eeb0c215e320c503567e288bbf37e652 /drivers/gpu/drm/sun4i/sun8i_mixer.c
parent5bb5f5dafa1ad3ac5ebb85e74a07193fda7aec4e (diff)
drm/sun4i: Add support for DE2 VI planes
This commit adds basic support for VI planes. They are meant for video overlay and because of that they support YUV formats too. However, using YUV format is not straightforward, so only RGB formats are supported for now. Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com> Link: https://patchwork.freedesktop.org/patch/msgid/20171201060550.10392-20-jernej.skrabec@siol.net
Diffstat (limited to 'drivers/gpu/drm/sun4i/sun8i_mixer.c')
-rw-r--r--drivers/gpu/drm/sun4i/sun8i_mixer.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/drivers/gpu/drm/sun4i/sun8i_mixer.c b/drivers/gpu/drm/sun4i/sun8i_mixer.c
index 1de98ad9f6c1..888620b1d3f1 100644
--- a/drivers/gpu/drm/sun4i/sun8i_mixer.c
+++ b/drivers/gpu/drm/sun4i/sun8i_mixer.c
@@ -27,6 +27,7 @@
#include "sun4i_drv.h"
#include "sun8i_mixer.h"
#include "sun8i_ui_layer.h"
+#include "sun8i_vi_layer.h"
#include "sunxi_engine.h"
static const struct de2_fmt_info de2_formats[] = {
@@ -138,11 +139,25 @@ static struct drm_plane **sun8i_layers_init(struct drm_device *drm,
struct sun8i_mixer *mixer = engine_to_sun8i_mixer(engine);
int i;
- planes = devm_kcalloc(drm->dev, mixer->cfg->ui_num + 1,
+ planes = devm_kcalloc(drm->dev,
+ mixer->cfg->vi_num + mixer->cfg->ui_num + 1,
sizeof(*planes), GFP_KERNEL);
if (!planes)
return ERR_PTR(-ENOMEM);
+ for (i = 0; i < mixer->cfg->vi_num; i++) {
+ struct sun8i_vi_layer *layer;
+
+ layer = sun8i_vi_layer_init_one(drm, mixer, i);
+ if (IS_ERR(layer)) {
+ dev_err(drm->dev,
+ "Couldn't initialize overlay plane\n");
+ return ERR_CAST(layer);
+ };
+
+ planes[i] = &layer->plane;
+ };
+
for (i = 0; i < mixer->cfg->ui_num; i++) {
struct sun8i_ui_layer *layer;
@@ -153,7 +168,7 @@ static struct drm_plane **sun8i_layers_init(struct drm_device *drm,
return ERR_CAST(layer);
};
- planes[i] = &layer->plane;
+ planes[mixer->cfg->vi_num + i] = &layer->plane;
};
return planes;