[PATCH -v2 3/8] drm/exynos: remove struct *_win_data abstraction on planes
Hi, On 03/26/2015 11:10 PM, Gustavo Padovan wrote: > From: Gustavo Padovan > > struct {fimd,mixer,vidi}_win_data was just keeping the same data > as struct exynos_drm_plane thus get ride of it and use exynos_drm_plane > directly. > > It changes how planes are created and remove .win_mode_set() callback > that was only filling all *_win_data structs. > > Signed-off-by: Gustavo Padovan > --- > drivers/gpu/drm/exynos/exynos7_drm_decon.c | 164 -- > drivers/gpu/drm/exynos/exynos_drm_crtc.c | 9 +- > drivers/gpu/drm/exynos/exynos_drm_crtc.h | 1 + > drivers/gpu/drm/exynos/exynos_drm_drv.c| 14 -- > drivers/gpu/drm/exynos/exynos_drm_drv.h| 5 +- > drivers/gpu/drm/exynos/exynos_drm_fimd.c | 182 + > drivers/gpu/drm/exynos/exynos_drm_plane.c | 23 +--- > drivers/gpu/drm/exynos/exynos_drm_plane.h | 6 +- > drivers/gpu/drm/exynos/exynos_drm_vidi.c | 123 - > drivers/gpu/drm/exynos/exynos_mixer.c | 212 > ++--- > 10 files changed, 242 insertions(+), 497 deletions(-) > [snip] > @@ -818,7 +762,9 @@ static int decon_bind(struct device *dev, struct device > *master, void *data) > { > struct decon_context *ctx = dev_get_drvdata(dev); > struct drm_device *drm_dev = data; > - int ret; > + struct exynos_drm_plane *exynos_plane; > + enum drm_plane_type type; > + int zpos, ret; > > ret = decon_ctx_initialize(ctx, drm_dev); > if (ret) { > @@ -826,8 +772,16 @@ static int decon_bind(struct device *dev, struct device > *master, void *data) > return ret; > } > > - ctx->crtc = exynos_drm_crtc_create(drm_dev, ctx->pipe, > -EXYNOS_DISPLAY_TYPE_LCD, > + for (zpos = 0; zpos < WINDOWS_NR; zpos++) { > + type = (zpos == ctx->default_win) ? DRM_PLANE_TYPE_PRIMARY : > + DRM_PLANE_TYPE_OVERLAY; > + exynos_plane_init(drm_dev, >planes[zpos], 1 << ctx->pipe, > + type); Doesn't error checking need about return value of exynos_plane_init? Thanks.
[PATCH -v2 3/8] drm/exynos: remove struct *_win_data abstraction on planes
2015-03-31 Joonyoung Shim : > Hi, > > On 03/26/2015 11:10 PM, Gustavo Padovan wrote: > > From: Gustavo Padovan > > > > struct {fimd,mixer,vidi}_win_data was just keeping the same data > > as struct exynos_drm_plane thus get ride of it and use exynos_drm_plane > > directly. > > > > It changes how planes are created and remove .win_mode_set() callback > > that was only filling all *_win_data structs. > > > > Signed-off-by: Gustavo Padovan > > --- > > drivers/gpu/drm/exynos/exynos7_drm_decon.c | 164 -- > > drivers/gpu/drm/exynos/exynos_drm_crtc.c | 9 +- > > drivers/gpu/drm/exynos/exynos_drm_crtc.h | 1 + > > drivers/gpu/drm/exynos/exynos_drm_drv.c| 14 -- > > drivers/gpu/drm/exynos/exynos_drm_drv.h| 5 +- > > drivers/gpu/drm/exynos/exynos_drm_fimd.c | 182 + > > drivers/gpu/drm/exynos/exynos_drm_plane.c | 23 +--- > > drivers/gpu/drm/exynos/exynos_drm_plane.h | 6 +- > > drivers/gpu/drm/exynos/exynos_drm_vidi.c | 123 - > > drivers/gpu/drm/exynos/exynos_mixer.c | 212 > > ++--- > > 10 files changed, 242 insertions(+), 497 deletions(-) > > > > [snip] > > > @@ -818,7 +762,9 @@ static int decon_bind(struct device *dev, struct device > > *master, void *data) > > { > > struct decon_context *ctx = dev_get_drvdata(dev); > > struct drm_device *drm_dev = data; > > - int ret; > > + struct exynos_drm_plane *exynos_plane; > > + enum drm_plane_type type; > > + int zpos, ret; > > > > ret = decon_ctx_initialize(ctx, drm_dev); > > if (ret) { > > @@ -826,8 +772,16 @@ static int decon_bind(struct device *dev, struct > > device *master, void *data) > > return ret; > > } > > > > - ctx->crtc = exynos_drm_crtc_create(drm_dev, ctx->pipe, > > - EXYNOS_DISPLAY_TYPE_LCD, > > + for (zpos = 0; zpos < WINDOWS_NR; zpos++) { > > + type = (zpos == ctx->default_win) ? DRM_PLANE_TYPE_PRIMARY : > > + DRM_PLANE_TYPE_OVERLAY; > > + exynos_plane_init(drm_dev, >planes[zpos], 1 << ctx->pipe, > > + type); > > Doesn't error checking need about return value of exynos_plane_init? Sure, I think it is needed too. I'll send a new patch set shortly. Gustavo
[PATCH -v2 3/8] drm/exynos: remove struct *_win_data abstraction on planes
From: Gustavo Padovanstruct {fimd,mixer,vidi}_win_data was just keeping the same data as struct exynos_drm_plane thus get ride of it and use exynos_drm_plane directly. It changes how planes are created and remove .win_mode_set() callback that was only filling all *_win_data structs. Signed-off-by: Gustavo Padovan --- drivers/gpu/drm/exynos/exynos7_drm_decon.c | 164 -- drivers/gpu/drm/exynos/exynos_drm_crtc.c | 9 +- drivers/gpu/drm/exynos/exynos_drm_crtc.h | 1 + drivers/gpu/drm/exynos/exynos_drm_drv.c| 14 -- drivers/gpu/drm/exynos/exynos_drm_drv.h| 5 +- drivers/gpu/drm/exynos/exynos_drm_fimd.c | 182 + drivers/gpu/drm/exynos/exynos_drm_plane.c | 23 +--- drivers/gpu/drm/exynos/exynos_drm_plane.h | 6 +- drivers/gpu/drm/exynos/exynos_drm_vidi.c | 123 - drivers/gpu/drm/exynos/exynos_mixer.c | 212 ++--- 10 files changed, 242 insertions(+), 497 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos7_drm_decon.c b/drivers/gpu/drm/exynos/exynos7_drm_decon.c index 63f02e2..2cbe328 100644 --- a/drivers/gpu/drm/exynos/exynos7_drm_decon.c +++ b/drivers/gpu/drm/exynos/exynos7_drm_decon.c @@ -28,6 +28,7 @@ #include #include "exynos_drm_crtc.h" +#include "exynos_drm_plane.h" #include "exynos_drm_drv.h" #include "exynos_drm_fbdev.h" #include "exynos_drm_iommu.h" @@ -41,32 +42,16 @@ #define WINDOWS_NR 2 -struct decon_win_data { - unsigned intovl_x; - unsigned intovl_y; - unsigned intoffset_x; - unsigned intoffset_y; - unsigned intovl_width; - unsigned intovl_height; - unsigned intfb_width; - unsigned intfb_height; - unsigned intbpp; - unsigned intpixel_format; - dma_addr_t dma_addr; - boolenabled; - boolresume; -}; - struct decon_context { struct device *dev; struct drm_device *drm_dev; struct exynos_drm_crtc *crtc; + struct exynos_drm_plane planes[WINDOWS_NR]; struct clk *pclk; struct clk *aclk; struct clk *eclk; struct clk *vclk; void __iomem*regs; - struct decon_win_data win_data[WINDOWS_NR]; unsigned intdefault_win; unsigned long irq_flags; booli80_if; @@ -296,59 +281,16 @@ static void decon_disable_vblank(struct exynos_drm_crtc *crtc) } } -static void decon_win_mode_set(struct exynos_drm_crtc *crtc, - struct exynos_drm_plane *plane) -{ - struct decon_context *ctx = crtc->ctx; - struct decon_win_data *win_data; - int win, padding; - - if (!plane) { - DRM_ERROR("plane is NULL\n"); - return; - } - - win = plane->zpos; - if (win == DEFAULT_ZPOS) - win = ctx->default_win; - - if (win < 0 || win >= WINDOWS_NR) - return; - - - win_data = >win_data[win]; - - padding = (plane->pitch / (plane->bpp >> 3)) - plane->fb_width; - win_data->offset_x = plane->fb_x; - win_data->offset_y = plane->fb_y; - win_data->fb_width = plane->fb_width + padding; - win_data->fb_height = plane->fb_height; - win_data->ovl_x = plane->crtc_x; - win_data->ovl_y = plane->crtc_y; - win_data->ovl_width = plane->crtc_width; - win_data->ovl_height = plane->crtc_height; - win_data->dma_addr = plane->dma_addr[0]; - win_data->bpp = plane->bpp; - win_data->pixel_format = plane->pixel_format; - - DRM_DEBUG_KMS("offset_x = %d, offset_y = %d\n", - win_data->offset_x, win_data->offset_y); - DRM_DEBUG_KMS("ovl_width = %d, ovl_height = %d\n", - win_data->ovl_width, win_data->ovl_height); - DRM_DEBUG_KMS("paddr = 0x%lx\n", (unsigned long)win_data->dma_addr); - DRM_DEBUG_KMS("fb_width = %d, crtc_width = %d\n", - plane->fb_width, plane->crtc_width); -} - static void decon_win_set_pixfmt(struct decon_context *ctx, unsigned int win) { - struct decon_win_data *win_data = >win_data[win]; + struct exynos_drm_plane *plane = >planes[win]; unsigned long val; + int padding; val = readl(ctx->regs + WINCON(win)); val &= ~WINCONx_BPPMODE_MASK; - switch (win_data->pixel_format) { + switch (plane->pixel_format) { case DRM_FORMAT_RGB565: val |= WINCONx_BPPMODE_16BPP_565; val |= WINCONx_BURSTLEN_16WORD; @@ -397,7 +339,7 @@ static void