Skip to content

Commit

Permalink
Merge branch 'exynos-drm-next' of git://git.kernel.org/pub/scm/linux/…
Browse files Browse the repository at this point in the history
…kernel/git/daeinki/drm-exynos into drm-next

Summary:
- Clean up HDMI and MIXER parts
- Clean up legacy structures specific to Exynos DRM
  . This patch series removes existing exyons_drm_display and
    exynos_drm_encoder structures specific to Exynos DRM, and
    makes them to replace with common drm_encoder structure.
    With cleanup patch, we removes exynos_drm_encoder module.
- Clean up gem, dmabuf and buffer modules
  . This patch series replaces existing Exynos DRM dmabuf codes
    with common drm prime ones, and embeds all codes of exynos_drm_buf
    into exynos_drm_gem module.
    With cleanup patch, we removes exynos_drm_buf and exynos_drm_dmabuf
    modules.
- And some fixups.

* 'exynos-drm-next' of git://git.kernel.org/pub/scm/linux/kernel/git/daeinki/drm-exynos: (53 commits)
  drm/exynos: merge exynos_drm_buf.c to exynos_drm_gem.c
  drm/exynos: use prime helpers
  drm/exynos: remove function roundup_gem_size
  drm/exynos: remove function update_vm_cache_attr
  drm/exynos: remove function check_gem_flags
  drm/exynos: use ERR_PTR instead of NULL in exynos_drm_gem_init
  drm/exynos: remove unused fields of struct exynos_drm_gem_buf
  drm/exynos: stop copying sg table
  drm/exynos: remove function exynos_drm_gem_map_buf
  drm/exynos: remove mutex locking in pagefault handler
  drm/exynos: remove function convert_to_vm_err_msg
  drm/exynos: stop using sgtable in page fault handler
  drm/exynos: remove struct exynos_drm_encoder layer
  drm/exynos: fold encoder setup into exynos_drm_load()
  drm/exynos: remove exynos_drm_create_enc_conn()
  drm/exynos: remove exynos_encoder's .commit() op
  drm/exynos: remove extra call to exynos_dp_commit()
  drm/exynos: remove extra call to hdmi_commit()
  drm/exynos: remove struct exynos_drm_display
  drm/exynos: simplify calculation of possible CRTCs
  ...
  • Loading branch information
Dave Airlie committed Aug 17, 2015
2 parents 3be6671 + 2a8cb48 commit 3ff8e50
Show file tree
Hide file tree
Showing 33 changed files with 1,139 additions and 2,301 deletions.
7 changes: 3 additions & 4 deletions drivers/gpu/drm/exynos/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@
# Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher.

ccflags-y := -Iinclude/drm -Idrivers/gpu/drm/exynos
exynosdrm-y := exynos_drm_drv.o exynos_drm_encoder.o \
exynos_drm_crtc.o exynos_drm_fbdev.o exynos_drm_fb.o \
exynos_drm_buf.o exynos_drm_gem.o exynos_drm_core.o \
exynos_drm_plane.o exynos_drm_dmabuf.o
exynosdrm-y := exynos_drm_drv.o exynos_drm_crtc.o exynos_drm_fbdev.o \
exynos_drm_fb.o exynos_drm_gem.o exynos_drm_core.o \
exynos_drm_plane.o

exynosdrm-$(CONFIG_DRM_EXYNOS_IOMMU) += exynos_drm_iommu.o
exynosdrm-$(CONFIG_DRM_EXYNOS_FIMD) += exynos_drm_fimd.o
Expand Down
65 changes: 30 additions & 35 deletions drivers/gpu/drm/exynos/exynos5433_drm_decon.c
Original file line number Diff line number Diff line change
Expand Up @@ -152,15 +152,15 @@ static void decon_commit(struct exynos_drm_crtc *crtc)
#define OFFSIZE(x) (((x) & 0x3fff) << 14)
#define PAGEWIDTH(x) ((x) & 0x3fff)

static void decon_win_set_pixfmt(struct decon_context *ctx, unsigned int win)
static void decon_win_set_pixfmt(struct decon_context *ctx, unsigned int win,
struct drm_framebuffer *fb)
{
struct exynos_drm_plane *plane = &ctx->planes[win];
unsigned long val;

val = readl(ctx->addr + DECON_WINCONx(win));
val &= ~WINCONx_BPPMODE_MASK;

switch (plane->pixel_format) {
switch (fb->pixel_format) {
case DRM_FORMAT_XRGB1555:
val |= WINCONx_BPPMODE_16BPP_I1555;
val |= WINCONx_HAWSWP_F;
Expand All @@ -186,7 +186,7 @@ static void decon_win_set_pixfmt(struct decon_context *ctx, unsigned int win)
return;
}

DRM_DEBUG_KMS("bpp = %u\n", plane->bpp);
DRM_DEBUG_KMS("bpp = %u\n", fb->bits_per_pixel);

/*
* In case of exynos, setting dma-burst to 16Word causes permanent
Expand All @@ -196,7 +196,7 @@ static void decon_win_set_pixfmt(struct decon_context *ctx, unsigned int win)
* movement causes unstable DMA which results into iommu crash/tear.
*/

if (plane->fb_width < MIN_FB_WIDTH_FOR_16WORD_BURST) {
if (fb->width < MIN_FB_WIDTH_FOR_16WORD_BURST) {
val &= ~WINCONx_BURSTLEN_MASK;
val |= WINCONx_BURSTLEN_8WORD;
}
Expand All @@ -219,17 +219,16 @@ static void decon_shadow_protect_win(struct decon_context *ctx, int win,
writel(val, ctx->addr + DECON_SHADOWCON);
}

static void decon_win_commit(struct exynos_drm_crtc *crtc, unsigned int win)
static void decon_update_plane(struct exynos_drm_crtc *crtc,
struct exynos_drm_plane *plane)
{
struct decon_context *ctx = crtc->ctx;
struct exynos_drm_plane *plane;
struct drm_plane_state *state = plane->base.state;
unsigned int win = plane->zpos;
unsigned int bpp = state->fb->bits_per_pixel >> 3;
unsigned int pitch = state->fb->pitches[0];
u32 val;

if (win < 0 || win >= WINDOWS_NR)
return;

plane = &ctx->planes[win];

if (ctx->suspended)
return;

Expand All @@ -238,8 +237,8 @@ static void decon_win_commit(struct exynos_drm_crtc *crtc, unsigned int win)
val = COORDINATE_X(plane->crtc_x) | COORDINATE_Y(plane->crtc_y);
writel(val, ctx->addr + DECON_VIDOSDxA(win));

val = COORDINATE_X(plane->crtc_x + plane->crtc_width - 1) |
COORDINATE_Y(plane->crtc_y + plane->crtc_height - 1);
val = COORDINATE_X(plane->crtc_x + plane->crtc_w - 1) |
COORDINATE_Y(plane->crtc_y + plane->crtc_h - 1);
writel(val, ctx->addr + DECON_VIDOSDxB(win));

val = VIDOSD_Wx_ALPHA_R_F(0x0) | VIDOSD_Wx_ALPHA_G_F(0x0) |
Expand All @@ -252,14 +251,14 @@ static void decon_win_commit(struct exynos_drm_crtc *crtc, unsigned int win)

writel(plane->dma_addr[0], ctx->addr + DECON_VIDW0xADD0B0(win));

val = plane->dma_addr[0] + plane->pitch * plane->crtc_height;
val = plane->dma_addr[0] + pitch * plane->crtc_h;
writel(val, ctx->addr + DECON_VIDW0xADD1B0(win));

val = OFFSIZE(plane->pitch - plane->crtc_width * (plane->bpp >> 3))
| PAGEWIDTH(plane->crtc_width * (plane->bpp >> 3));
val = OFFSIZE(pitch - plane->crtc_w * bpp)
| PAGEWIDTH(plane->crtc_w * bpp);
writel(val, ctx->addr + DECON_VIDW0xADD2(win));

decon_win_set_pixfmt(ctx, win);
decon_win_set_pixfmt(ctx, win, state->fb);

/* window enable */
val = readl(ctx->addr + DECON_WINCONx(win));
Expand All @@ -277,17 +276,13 @@ static void decon_win_commit(struct exynos_drm_crtc *crtc, unsigned int win)
atomic_set(&ctx->win_updated, 1);
}

static void decon_win_disable(struct exynos_drm_crtc *crtc, unsigned int win)
static void decon_disable_plane(struct exynos_drm_crtc *crtc,
struct exynos_drm_plane *plane)
{
struct decon_context *ctx = crtc->ctx;
struct exynos_drm_plane *plane;
unsigned int win = plane->zpos;
u32 val;

if (win < 0 || win >= WINDOWS_NR)
return;

plane = &ctx->planes[win];

if (ctx->suspended)
return;

Expand Down Expand Up @@ -378,7 +373,7 @@ static void decon_disable(struct exynos_drm_crtc *crtc)
* a destroyed buffer later.
*/
for (i = 0; i < WINDOWS_NR; i++)
decon_win_disable(crtc, i);
decon_disable_plane(crtc, &ctx->planes[i]);

decon_swreset(ctx);

Expand Down Expand Up @@ -407,7 +402,7 @@ void decon_te_irq_handler(struct exynos_drm_crtc *crtc)
writel(val, ctx->addr + DECON_TRIGCON);
}

drm_handle_vblank(ctx->drm_dev, ctx->pipe);
drm_crtc_handle_vblank(&ctx->crtc->base);
}

static void decon_clear_channels(struct exynos_drm_crtc *crtc)
Expand Down Expand Up @@ -460,10 +455,9 @@ static struct exynos_drm_crtc_ops decon_crtc_ops = {
.enable_vblank = decon_enable_vblank,
.disable_vblank = decon_disable_vblank,
.commit = decon_commit,
.win_commit = decon_win_commit,
.win_disable = decon_win_disable,
.update_plane = decon_update_plane,
.disable_plane = decon_disable_plane,
.te_handler = decon_te_irq_handler,
.clear_channels = decon_clear_channels,
};

static int decon_bind(struct device *dev, struct device *master, void *data)
Expand Down Expand Up @@ -497,7 +491,9 @@ static int decon_bind(struct device *dev, struct device *master, void *data)
goto err;
}

ret = drm_iommu_attach_device_if_possible(ctx->crtc, drm_dev, dev);
decon_clear_channels(ctx->crtc);

ret = drm_iommu_attach_device(drm_dev, dev);
if (ret)
goto err;

Expand All @@ -514,8 +510,7 @@ static void decon_unbind(struct device *dev, struct device *master, void *data)
decon_disable(ctx->crtc);

/* detach this sub driver from iommu mapping if supported. */
if (is_drm_iommu_supported(ctx->drm_dev))
drm_iommu_detach_device(ctx->drm_dev, ctx->dev);
drm_iommu_detach_device(ctx->drm_dev, ctx->dev);
}

static const struct component_ops decon_component_ops = {
Expand All @@ -533,7 +528,7 @@ static irqreturn_t decon_vsync_irq_handler(int irq, void *dev_id)

val = readl(ctx->addr + DECON_VIDINTCON1);
if (val & VIDINTCON1_INTFRMPEND) {
drm_handle_vblank(ctx->drm_dev, ctx->pipe);
drm_crtc_handle_vblank(&ctx->crtc->base);

/* clear */
writel(VIDINTCON1_INTFRMPEND, ctx->addr + DECON_VIDINTCON1);
Expand All @@ -553,7 +548,7 @@ static irqreturn_t decon_lcd_sys_irq_handler(int irq, void *dev_id)

val = readl(ctx->addr + DECON_VIDINTCON1);
if (val & VIDINTCON1_INTFRMDONEPEND) {
exynos_drm_crtc_finish_pageflip(ctx->drm_dev, ctx->pipe);
exynos_drm_crtc_finish_pageflip(ctx->crtc);

/* clear */
writel(VIDINTCON1_INTFRMDONEPEND,
Expand Down
Loading

0 comments on commit 3ff8e50

Please sign in to comment.