Commit 323db0ed authored by Gustavo Padovan's avatar Gustavo Padovan Committed by Inki Dae

drm/exynos: add cursor plane support

Set one of the planes for each crtc driver as a cursor plane enabled
window managers to fully work on exynos.
Signed-off-by: default avatarGustavo Padovan <gustavo.padovan@collabora.co.uk>
Signed-off-by: default avatarInki Dae <inki.dae@samsung.com>
parent 5d3d0995
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#include "exynos_drm_iommu.h" #include "exynos_drm_iommu.h"
#define WINDOWS_NR 3 #define WINDOWS_NR 3
#define CURSOR_WIN 2
#define MIN_FB_WIDTH_FOR_16WORD_BURST 128 #define MIN_FB_WIDTH_FOR_16WORD_BURST 128
struct decon_context { struct decon_context {
...@@ -500,8 +501,7 @@ static int decon_bind(struct device *dev, struct device *master, void *data) ...@@ -500,8 +501,7 @@ static int decon_bind(struct device *dev, struct device *master, void *data)
ctx->pipe = priv->pipe++; ctx->pipe = priv->pipe++;
for (zpos = 0; zpos < WINDOWS_NR; zpos++) { for (zpos = 0; zpos < WINDOWS_NR; zpos++) {
type = (zpos == DEFAULT_WIN) ? DRM_PLANE_TYPE_PRIMARY : type = exynos_plane_get_type(zpos, CURSOR_WIN);
DRM_PLANE_TYPE_OVERLAY;
ret = exynos_plane_init(drm_dev, &ctx->planes[zpos], ret = exynos_plane_init(drm_dev, &ctx->planes[zpos],
1 << ctx->pipe, type, decon_formats, 1 << ctx->pipe, type, decon_formats,
ARRAY_SIZE(decon_formats), zpos); ARRAY_SIZE(decon_formats), zpos);
......
...@@ -40,6 +40,7 @@ ...@@ -40,6 +40,7 @@
#define MIN_FB_WIDTH_FOR_16WORD_BURST 128 #define MIN_FB_WIDTH_FOR_16WORD_BURST 128
#define WINDOWS_NR 2 #define WINDOWS_NR 2
#define CURSOR_WIN 1
struct decon_context { struct decon_context {
struct device *dev; struct device *dev;
...@@ -689,8 +690,7 @@ static int decon_bind(struct device *dev, struct device *master, void *data) ...@@ -689,8 +690,7 @@ static int decon_bind(struct device *dev, struct device *master, void *data)
} }
for (zpos = 0; zpos < WINDOWS_NR; zpos++) { for (zpos = 0; zpos < WINDOWS_NR; zpos++) {
type = (zpos == DEFAULT_WIN) ? DRM_PLANE_TYPE_PRIMARY : type = exynos_plane_get_type(zpos, CURSOR_WIN);
DRM_PLANE_TYPE_OVERLAY;
ret = exynos_plane_init(drm_dev, &ctx->planes[zpos], ret = exynos_plane_init(drm_dev, &ctx->planes[zpos],
1 << ctx->pipe, type, decon_formats, 1 << ctx->pipe, type, decon_formats,
ARRAY_SIZE(decon_formats), zpos); ARRAY_SIZE(decon_formats), zpos);
......
...@@ -87,6 +87,7 @@ ...@@ -87,6 +87,7 @@
/* FIMD has totally five hardware windows. */ /* FIMD has totally five hardware windows. */
#define WINDOWS_NR 5 #define WINDOWS_NR 5
#define CURSOR_WIN 4
struct fimd_driver_data { struct fimd_driver_data {
unsigned int timing_base; unsigned int timing_base;
...@@ -948,8 +949,7 @@ static int fimd_bind(struct device *dev, struct device *master, void *data) ...@@ -948,8 +949,7 @@ static int fimd_bind(struct device *dev, struct device *master, void *data)
ctx->pipe = priv->pipe++; ctx->pipe = priv->pipe++;
for (zpos = 0; zpos < WINDOWS_NR; zpos++) { for (zpos = 0; zpos < WINDOWS_NR; zpos++) {
type = (zpos == DEFAULT_WIN) ? DRM_PLANE_TYPE_PRIMARY : type = exynos_plane_get_type(zpos, CURSOR_WIN);
DRM_PLANE_TYPE_OVERLAY;
ret = exynos_plane_init(drm_dev, &ctx->planes[zpos], ret = exynos_plane_init(drm_dev, &ctx->planes[zpos],
1 << ctx->pipe, type, fimd_formats, 1 << ctx->pipe, type, fimd_formats,
ARRAY_SIZE(fimd_formats), zpos); ARRAY_SIZE(fimd_formats), zpos);
......
...@@ -208,6 +208,17 @@ static void exynos_plane_attach_zpos_property(struct drm_plane *plane, ...@@ -208,6 +208,17 @@ static void exynos_plane_attach_zpos_property(struct drm_plane *plane,
drm_object_attach_property(&plane->base, prop, zpos); drm_object_attach_property(&plane->base, prop, zpos);
} }
enum drm_plane_type exynos_plane_get_type(unsigned int zpos,
unsigned int cursor_win)
{
if (zpos == DEFAULT_WIN)
return DRM_PLANE_TYPE_PRIMARY;
else if (zpos == cursor_win)
return DRM_PLANE_TYPE_CURSOR;
else
return DRM_PLANE_TYPE_OVERLAY;
}
int exynos_plane_init(struct drm_device *dev, int exynos_plane_init(struct drm_device *dev,
struct exynos_drm_plane *exynos_plane, struct exynos_drm_plane *exynos_plane,
unsigned long possible_crtcs, enum drm_plane_type type, unsigned long possible_crtcs, enum drm_plane_type type,
......
...@@ -9,6 +9,8 @@ ...@@ -9,6 +9,8 @@
* *
*/ */
enum drm_plane_type exynos_plane_get_type(unsigned int zpos,
unsigned int cursor_win);
int exynos_plane_init(struct drm_device *dev, int exynos_plane_init(struct drm_device *dev,
struct exynos_drm_plane *exynos_plane, struct exynos_drm_plane *exynos_plane,
unsigned long possible_crtcs, enum drm_plane_type type, unsigned long possible_crtcs, enum drm_plane_type type,
......
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
/* vidi has totally three virtual windows. */ /* vidi has totally three virtual windows. */
#define WINDOWS_NR 3 #define WINDOWS_NR 3
#define CURSOR_WIN 2
#define ctx_from_connector(c) container_of(c, struct vidi_context, \ #define ctx_from_connector(c) container_of(c, struct vidi_context, \
connector) connector)
...@@ -445,8 +446,7 @@ static int vidi_bind(struct device *dev, struct device *master, void *data) ...@@ -445,8 +446,7 @@ static int vidi_bind(struct device *dev, struct device *master, void *data)
vidi_ctx_initialize(ctx, drm_dev); vidi_ctx_initialize(ctx, drm_dev);
for (zpos = 0; zpos < WINDOWS_NR; zpos++) { for (zpos = 0; zpos < WINDOWS_NR; zpos++) {
type = (zpos == DEFAULT_WIN) ? DRM_PLANE_TYPE_PRIMARY : type = exynos_plane_get_type(zpos, CURSOR_WIN);
DRM_PLANE_TYPE_OVERLAY;
ret = exynos_plane_init(drm_dev, &ctx->planes[zpos], ret = exynos_plane_init(drm_dev, &ctx->planes[zpos],
1 << ctx->pipe, type, formats, 1 << ctx->pipe, type, formats,
ARRAY_SIZE(formats), zpos); ARRAY_SIZE(formats), zpos);
......
...@@ -43,6 +43,7 @@ ...@@ -43,6 +43,7 @@
#define MIXER_WIN_NR 3 #define MIXER_WIN_NR 3
#define VP_DEFAULT_WIN 2 #define VP_DEFAULT_WIN 2
#define CURSOR_WIN 1
/* The pixelformats that are natively supported by the mixer. */ /* The pixelformats that are natively supported by the mixer. */
#define MXR_FORMAT_RGB565 4 #define MXR_FORMAT_RGB565 4
...@@ -1196,8 +1197,6 @@ static int mixer_bind(struct device *dev, struct device *manager, void *data) ...@@ -1196,8 +1197,6 @@ static int mixer_bind(struct device *dev, struct device *manager, void *data)
const uint32_t *formats; const uint32_t *formats;
unsigned int fcount; unsigned int fcount;
type = (zpos == DEFAULT_WIN) ? DRM_PLANE_TYPE_PRIMARY :
DRM_PLANE_TYPE_OVERLAY;
if (zpos < VP_DEFAULT_WIN) { if (zpos < VP_DEFAULT_WIN) {
formats = mixer_formats; formats = mixer_formats;
fcount = ARRAY_SIZE(mixer_formats); fcount = ARRAY_SIZE(mixer_formats);
...@@ -1206,6 +1205,7 @@ static int mixer_bind(struct device *dev, struct device *manager, void *data) ...@@ -1206,6 +1205,7 @@ static int mixer_bind(struct device *dev, struct device *manager, void *data)
fcount = ARRAY_SIZE(vp_formats); fcount = ARRAY_SIZE(vp_formats);
} }
type = exynos_plane_get_type(zpos, CURSOR_WIN);
ret = exynos_plane_init(drm_dev, &ctx->planes[zpos], ret = exynos_plane_init(drm_dev, &ctx->planes[zpos],
1 << ctx->pipe, type, formats, fcount, 1 << ctx->pipe, type, formats, fcount,
zpos); zpos);
......
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