[PATCH v2 10/22] drm/exynos: introduce exynos_drm_plane_config structure
Inki Dae
inki.dae at samsung.com
Thu Dec 10 03:47:32 PST 2015
Hi Marek,
2015년 11월 30일 22:53에 Marek Szyprowski 이(가) 쓴 글:
> This patch adds common structure for keeping plane configuration and
> capabilities data. This patch is inspired by similar code developed by
> Tobias Jakobi.
>
> Signed-off-by: Marek Szyprowski <m.szyprowski at samsung.com>
> ---
> drivers/gpu/drm/exynos/exynos5433_drm_decon.c | 18 ++++++++---
> drivers/gpu/drm/exynos/exynos7_drm_decon.c | 23 +++++++++-----
> drivers/gpu/drm/exynos/exynos_drm_drv.h | 19 ++++++++++++
> drivers/gpu/drm/exynos/exynos_drm_fimd.c | 25 ++++++++++-----
> drivers/gpu/drm/exynos/exynos_drm_plane.c | 34 +++++++++------------
> drivers/gpu/drm/exynos/exynos_drm_plane.h | 7 ++---
> drivers/gpu/drm/exynos/exynos_drm_vidi.c | 25 ++++++++++-----
> drivers/gpu/drm/exynos/exynos_mixer.c | 44 +++++++++++++++------------
> 8 files changed, 121 insertions(+), 74 deletions(-)
>
<--snip-->
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_vidi.c b/drivers/gpu/drm/exynos/exynos_drm_vidi.c
> index 3ce141236fad..90701647aef1 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_vidi.c
> +++ b/drivers/gpu/drm/exynos/exynos_drm_vidi.c
> @@ -30,7 +30,6 @@
>
> /* vidi has totally three virtual windows. */
> #define WINDOWS_NR 3
> -#define CURSOR_WIN 2
>
> #define ctx_from_connector(c) container_of(c, struct vidi_context, \
> connector)
> @@ -90,6 +89,12 @@ static const uint32_t formats[] = {
> DRM_FORMAT_NV12,
> };
>
> +static const enum drm_plane_type vidi_win_types[WINDOWS_NR] = {
> + DRM_PLANE_TYPE_PRIMARY,
> + DRM_PLANE_TYPE_OVERLAY,
> + DRM_PLANE_TYPE_CURSOR,
> +};
> +
> static int vidi_enable_vblank(struct exynos_drm_crtc *crtc)
> {
> struct vidi_context *ctx = crtc->ctx;
> @@ -442,17 +447,21 @@ static int vidi_bind(struct device *dev, struct device *master, void *data)
> struct drm_device *drm_dev = data;
> struct drm_encoder *encoder = &ctx->encoder;
> struct exynos_drm_plane *exynos_plane;
> - enum drm_plane_type type;
> - unsigned int zpos;
> + struct exynos_drm_plane_config plane_config = { 0 };
> + unsigned int i;
> int pipe, ret;
>
> vidi_ctx_initialize(ctx, drm_dev);
>
> - for (zpos = 0; zpos < WINDOWS_NR; zpos++) {
> - type = exynos_plane_get_type(zpos, CURSOR_WIN);
> - ret = exynos_plane_init(drm_dev, &ctx->planes[zpos],
> - 1 << ctx->pipe, type, formats,
> - ARRAY_SIZE(formats), zpos);
> + plane_config.pixel_formats = formats;
> + plane_config.num_pixel_formats = ARRAY_SIZE(formats);
> +
> + for (i = 0; i < WINDOWS_NR; i++) {
> + plane_config.zpos = i;
> + plane_config.type = vidi_win_types(i);
vidi_win_types is not really a function. So this should be 'vidi_win_type[i]'
This is a trivial so I can fix it.
Thanks,
Inki Dae
> +
> + ret = exynos_plane_init(drm_dev, &ctx->planes[i],
> + 1 << ctx->pipe, &plane_config);
> if (ret)
> return ret;
> }
> diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c b/drivers/gpu/drm/exynos/exynos_mixer.c
> index 8d2ce13eb725..a229f86d221a 100644
> --- a/drivers/gpu/drm/exynos/exynos_mixer.c
> +++ b/drivers/gpu/drm/exynos/exynos_mixer.c
> @@ -43,7 +43,6 @@
>
> #define MIXER_WIN_NR 3
> #define VP_DEFAULT_WIN 2
> -#define CURSOR_WIN 1
>
> /* The pixelformats that are natively supported by the mixer. */
> #define MXR_FORMAT_RGB565 4
> @@ -112,6 +111,25 @@ struct mixer_drv_data {
> bool has_sclk;
> };
>
> +static const struct exynos_drm_plane_config plane_configs[MIXER_WIN_NR] = {
> + {
> + .zpos = 0,
> + .type = DRM_PLANE_TYPE_PRIMARY,
> + .pixel_formats = mixer_formats,
> + .num_pixel_formats = ARRAY_SIZE(mixer_formats),
> + }, {
> + .zpos = 1,
> + .type = DRM_PLANE_TYPE_CURSOR,
> + .pixel_formats = mixer_formats,
> + .num_pixel_formats = ARRAY_SIZE(mixer_formats),
> + }, {
> + .zpos = 2,
> + .type = DRM_PLANE_TYPE_OVERLAY,
> + .pixel_formats = vp_formats,
> + .num_pixel_formats = ARRAY_SIZE(vp_formats),
> + },
> +};
> +
> static const u8 filter_y_horiz_tap8[] = {
> 0, -1, -1, -1, -1, -1, -1, -1,
> -1, -1, -1, -1, -1, 0, 0, 0,
> @@ -1155,33 +1173,19 @@ static int mixer_bind(struct device *dev, struct device *manager, void *data)
> struct mixer_context *ctx = dev_get_drvdata(dev);
> struct drm_device *drm_dev = data;
> struct exynos_drm_plane *exynos_plane;
> - unsigned int zpos;
> + unsigned int i;
> int ret;
>
> ret = mixer_initialize(ctx, drm_dev);
> if (ret)
> return ret;
>
> - for (zpos = 0; zpos < MIXER_WIN_NR; zpos++) {
> - enum drm_plane_type type;
> - const uint32_t *formats;
> - unsigned int fcount;
> -
> - if (zpos == VP_DEFAULT_WIN && !ctx->vp_enabled)
> + for (i = 0; i < MIXER_WIN_NR; i++) {
> + if (i == VP_DEFAULT_WIN && !ctx->vp_enabled)
> continue;
>
> - if (zpos < VP_DEFAULT_WIN) {
> - formats = mixer_formats;
> - fcount = ARRAY_SIZE(mixer_formats);
> - } else {
> - formats = vp_formats;
> - fcount = ARRAY_SIZE(vp_formats);
> - }
> -
> - type = exynos_plane_get_type(zpos, CURSOR_WIN);
> - ret = exynos_plane_init(drm_dev, &ctx->planes[zpos],
> - 1 << ctx->pipe, type, formats, fcount,
> - zpos);
> + ret = exynos_plane_init(drm_dev, &ctx->planes[i],
> + 1 << ctx->pipe, &plane_configs[i]);
> if (ret)
> return ret;
> }
>
More information about the dri-devel
mailing list