aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/exynos
diff options
context:
space:
mode:
authorDaniel Stone <daniels@collabora.com>2015-03-17 09:24:58 -0400
committerInki Dae <daeinki@gmail.com>2015-04-02 09:37:13 -0400
commitadacb228d72b9529f8de0769cc33414c3012054d (patch)
tree8c5ff17a25e2ca2880cf1899489a87c797eb43f4 /drivers/gpu/drm/exynos
parent91fd89660ba2e8ee59a587294fa9b17761691b05 (diff)
drm: Exynos: Respect framebuffer pitch for FIMD/Mixer
When performing a modeset, use the framebuffer pitch value to set FIMD IMG_SIZE and Mixer SPAN registers. These are both defined as pitch - the distance between contiguous lines (bytes for FIMD, pixels for mixer). Fixes display on Snow (1366x768). Signed-off-by: Daniel Stone <daniels@collabora.com> Tested-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk> Signed-off-by: Inki Dae <inki.dae@samsung.com>
Diffstat (limited to 'drivers/gpu/drm/exynos')
-rw-r--r--drivers/gpu/drm/exynos/exynos_drm_fimd.c8
-rw-r--r--drivers/gpu/drm/exynos/exynos_mixer.c17
2 files changed, 15 insertions, 10 deletions
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
index c300e22da8ac..33a10ce967ea 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
@@ -147,6 +147,7 @@ struct fimd_win_data {
147 unsigned int ovl_height; 147 unsigned int ovl_height;
148 unsigned int fb_width; 148 unsigned int fb_width;
149 unsigned int fb_height; 149 unsigned int fb_height;
150 unsigned int fb_pitch;
150 unsigned int bpp; 151 unsigned int bpp;
151 unsigned int pixel_format; 152 unsigned int pixel_format;
152 dma_addr_t dma_addr; 153 dma_addr_t dma_addr;
@@ -532,13 +533,14 @@ static void fimd_win_mode_set(struct exynos_drm_crtc *crtc,
532 win_data->offset_y = plane->crtc_y; 533 win_data->offset_y = plane->crtc_y;
533 win_data->ovl_width = plane->crtc_width; 534 win_data->ovl_width = plane->crtc_width;
534 win_data->ovl_height = plane->crtc_height; 535 win_data->ovl_height = plane->crtc_height;
536 win_data->fb_pitch = plane->pitch;
535 win_data->fb_width = plane->fb_width; 537 win_data->fb_width = plane->fb_width;
536 win_data->fb_height = plane->fb_height; 538 win_data->fb_height = plane->fb_height;
537 win_data->dma_addr = plane->dma_addr[0] + offset; 539 win_data->dma_addr = plane->dma_addr[0] + offset;
538 win_data->bpp = plane->bpp; 540 win_data->bpp = plane->bpp;
539 win_data->pixel_format = plane->pixel_format; 541 win_data->pixel_format = plane->pixel_format;
540 win_data->buf_offsize = (plane->fb_width - plane->crtc_width) * 542 win_data->buf_offsize =
541 (plane->bpp >> 3); 543 plane->pitch - (plane->crtc_width * (plane->bpp >> 3));
542 win_data->line_size = plane->crtc_width * (plane->bpp >> 3); 544 win_data->line_size = plane->crtc_width * (plane->bpp >> 3);
543 545
544 DRM_DEBUG_KMS("offset_x = %d, offset_y = %d\n", 546 DRM_DEBUG_KMS("offset_x = %d, offset_y = %d\n",
@@ -704,7 +706,7 @@ static void fimd_win_commit(struct exynos_drm_crtc *crtc, int zpos)
704 writel(val, ctx->regs + VIDWx_BUF_START(win, 0)); 706 writel(val, ctx->regs + VIDWx_BUF_START(win, 0));
705 707
706 /* buffer end address */ 708 /* buffer end address */
707 size = win_data->fb_width * win_data->ovl_height * (win_data->bpp >> 3); 709 size = win_data->fb_pitch * win_data->ovl_height * (win_data->bpp >> 3);
708 val = (unsigned long)(win_data->dma_addr + size); 710 val = (unsigned long)(win_data->dma_addr + size);
709 writel(val, ctx->regs + VIDWx_BUF_END(win, 0)); 711 writel(val, ctx->regs + VIDWx_BUF_END(win, 0));
710 712
diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c b/drivers/gpu/drm/exynos/exynos_mixer.c
index 3518bc4654c5..2e3bc57ea50e 100644
--- a/drivers/gpu/drm/exynos/exynos_mixer.c
+++ b/drivers/gpu/drm/exynos/exynos_mixer.c
@@ -55,6 +55,7 @@ struct hdmi_win_data {
55 unsigned int fb_x; 55 unsigned int fb_x;
56 unsigned int fb_y; 56 unsigned int fb_y;
57 unsigned int fb_width; 57 unsigned int fb_width;
58 unsigned int fb_pitch;
58 unsigned int fb_height; 59 unsigned int fb_height;
59 unsigned int src_width; 60 unsigned int src_width;
60 unsigned int src_height; 61 unsigned int src_height;
@@ -438,7 +439,7 @@ static void vp_video_buffer(struct mixer_context *ctx, int win)
438 } else { 439 } else {
439 luma_addr[0] = win_data->dma_addr; 440 luma_addr[0] = win_data->dma_addr;
440 chroma_addr[0] = win_data->dma_addr 441 chroma_addr[0] = win_data->dma_addr
441 + (win_data->fb_width * win_data->fb_height); 442 + (win_data->fb_pitch * win_data->fb_height);
442 } 443 }
443 444
444 if (win_data->scan_flags & DRM_MODE_FLAG_INTERLACE) { 445 if (win_data->scan_flags & DRM_MODE_FLAG_INTERLACE) {
@@ -447,8 +448,8 @@ static void vp_video_buffer(struct mixer_context *ctx, int win)
447 luma_addr[1] = luma_addr[0] + 0x40; 448 luma_addr[1] = luma_addr[0] + 0x40;
448 chroma_addr[1] = chroma_addr[0] + 0x40; 449 chroma_addr[1] = chroma_addr[0] + 0x40;
449 } else { 450 } else {
450 luma_addr[1] = luma_addr[0] + win_data->fb_width; 451 luma_addr[1] = luma_addr[0] + win_data->fb_pitch;
451 chroma_addr[1] = chroma_addr[0] + win_data->fb_width; 452 chroma_addr[1] = chroma_addr[0] + win_data->fb_pitch;
452 } 453 }
453 } else { 454 } else {
454 ctx->interlace = false; 455 ctx->interlace = false;
@@ -469,10 +470,10 @@ static void vp_video_buffer(struct mixer_context *ctx, int win)
469 vp_reg_writemask(res, VP_MODE, val, VP_MODE_FMT_MASK); 470 vp_reg_writemask(res, VP_MODE, val, VP_MODE_FMT_MASK);
470 471
471 /* setting size of input image */ 472 /* setting size of input image */
472 vp_reg_write(res, VP_IMG_SIZE_Y, VP_IMG_HSIZE(win_data->fb_width) | 473 vp_reg_write(res, VP_IMG_SIZE_Y, VP_IMG_HSIZE(win_data->fb_pitch) |
473 VP_IMG_VSIZE(win_data->fb_height)); 474 VP_IMG_VSIZE(win_data->fb_height));
474 /* chroma height has to reduced by 2 to avoid chroma distorions */ 475 /* chroma height has to reduced by 2 to avoid chroma distorions */
475 vp_reg_write(res, VP_IMG_SIZE_C, VP_IMG_HSIZE(win_data->fb_width) | 476 vp_reg_write(res, VP_IMG_SIZE_C, VP_IMG_HSIZE(win_data->fb_pitch) |
476 VP_IMG_VSIZE(win_data->fb_height / 2)); 477 VP_IMG_VSIZE(win_data->fb_height / 2));
477 478
478 vp_reg_write(res, VP_SRC_WIDTH, win_data->src_width); 479 vp_reg_write(res, VP_SRC_WIDTH, win_data->src_width);
@@ -559,7 +560,7 @@ static void mixer_graph_buffer(struct mixer_context *ctx, int win)
559 /* converting dma address base and source offset */ 560 /* converting dma address base and source offset */
560 dma_addr = win_data->dma_addr 561 dma_addr = win_data->dma_addr
561 + (win_data->fb_x * win_data->bpp >> 3) 562 + (win_data->fb_x * win_data->bpp >> 3)
562 + (win_data->fb_y * win_data->fb_width * win_data->bpp >> 3); 563 + (win_data->fb_y * win_data->fb_pitch);
563 src_x_offset = 0; 564 src_x_offset = 0;
564 src_y_offset = 0; 565 src_y_offset = 0;
565 566
@@ -576,7 +577,8 @@ static void mixer_graph_buffer(struct mixer_context *ctx, int win)
576 MXR_GRP_CFG_FORMAT_VAL(fmt), MXR_GRP_CFG_FORMAT_MASK); 577 MXR_GRP_CFG_FORMAT_VAL(fmt), MXR_GRP_CFG_FORMAT_MASK);
577 578
578 /* setup geometry */ 579 /* setup geometry */
579 mixer_reg_write(res, MXR_GRAPHIC_SPAN(win), win_data->fb_width); 580 mixer_reg_write(res, MXR_GRAPHIC_SPAN(win),
581 win_data->fb_pitch / (win_data->bpp >> 3));
580 582
581 /* setup display size */ 583 /* setup display size */
582 if (ctx->mxr_ver == MXR_VER_128_0_0_184 && 584 if (ctx->mxr_ver == MXR_VER_128_0_0_184 &&
@@ -961,6 +963,7 @@ static void mixer_win_mode_set(struct exynos_drm_crtc *crtc,
961 win_data->fb_y = plane->fb_y; 963 win_data->fb_y = plane->fb_y;
962 win_data->fb_width = plane->fb_width; 964 win_data->fb_width = plane->fb_width;
963 win_data->fb_height = plane->fb_height; 965 win_data->fb_height = plane->fb_height;
966 win_data->fb_pitch = plane->pitch;
964 win_data->src_width = plane->src_width; 967 win_data->src_width = plane->src_width;
965 win_data->src_height = plane->src_height; 968 win_data->src_height = plane->src_height;
966 969