aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu
diff options
context:
space:
mode:
authorTobias Jakobi <tjakobi@math.uni-bielefeld.de>2015-04-06 19:14:52 -0400
committerInki Dae <inki.dae@samsung.com>2015-04-12 22:39:41 -0400
commit2611015c7511106719bae904cac459383c55ffef (patch)
tree19c6f805dbfd09655707deefb6ceaebc0672c130 /drivers/gpu
parent7ded85885d49bac7df1836ea3ac5612d9afcc8de (diff)
drm/exynos: mixer: add 2x scaling to mixer_graph_buffer
While the VP (video processor) supports arbitrary scaling of its input, the mixer just supports a simple 2x (line doubling) scaling. Expose this functionality and exit early when an unsupported scaling configuration is encountered. This was tested with modetest's DRM plane test (from the libdrm test suite) on an Odroid-X2 (Exynos4412). v2: Put if- and return-statement on different lines. Reviewed-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk> Signed-off-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de> Acked-by: Joonyoung Shim <jy0922.shim@samsung.com> Signed-off-by: Inki Dae <inki.dae@samsung.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/drm/exynos/exynos_mixer.c36
1 files changed, 30 insertions, 6 deletions
diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c b/drivers/gpu/drm/exynos/exynos_mixer.c
index 82be65e90162..b95ed919a36f 100644
--- a/drivers/gpu/drm/exynos/exynos_mixer.c
+++ b/drivers/gpu/drm/exynos/exynos_mixer.c
@@ -499,12 +499,36 @@ static void mixer_layer_update(struct mixer_context *ctx)
499 mixer_reg_writemask(res, MXR_CFG, ~0, MXR_CFG_LAYER_UPDATE); 499 mixer_reg_writemask(res, MXR_CFG, ~0, MXR_CFG_LAYER_UPDATE);
500} 500}
501 501
502static int mixer_setup_scale(const struct exynos_drm_plane *plane,
503 unsigned int *x_ratio, unsigned int *y_ratio)
504{
505 if (plane->crtc_width != plane->src_width) {
506 if (plane->crtc_width == 2 * plane->src_width)
507 *x_ratio = 1;
508 else
509 goto fail;
510 }
511
512 if (plane->crtc_height != plane->src_height) {
513 if (plane->crtc_height == 2 * plane->src_height)
514 *y_ratio = 1;
515 else
516 goto fail;
517 }
518
519 return 0;
520
521fail:
522 DRM_DEBUG_KMS("only 2x width/height scaling of plane supported\n");
523 return -ENOTSUPP;
524}
525
502static void mixer_graph_buffer(struct mixer_context *ctx, int win) 526static void mixer_graph_buffer(struct mixer_context *ctx, int win)
503{ 527{
504 struct mixer_resources *res = &ctx->mixer_res; 528 struct mixer_resources *res = &ctx->mixer_res;
505 unsigned long flags; 529 unsigned long flags;
506 struct exynos_drm_plane *plane; 530 struct exynos_drm_plane *plane;
507 unsigned int x_ratio, y_ratio; 531 unsigned int x_ratio = 0, y_ratio = 0;
508 unsigned int src_x_offset, src_y_offset, dst_x_offset, dst_y_offset; 532 unsigned int src_x_offset, src_y_offset, dst_x_offset, dst_y_offset;
509 dma_addr_t dma_addr; 533 dma_addr_t dma_addr;
510 unsigned int fmt; 534 unsigned int fmt;
@@ -528,9 +552,9 @@ static void mixer_graph_buffer(struct mixer_context *ctx, int win)
528 fmt = ARGB8888; 552 fmt = ARGB8888;
529 } 553 }
530 554
531 /* 2x scaling feature */ 555 /* check if mixer supports requested scaling setup */
532 x_ratio = 0; 556 if (mixer_setup_scale(plane, &x_ratio, &y_ratio))
533 y_ratio = 0; 557 return;
534 558
535 dst_x_offset = plane->crtc_x; 559 dst_x_offset = plane->crtc_x;
536 dst_y_offset = plane->crtc_y; 560 dst_y_offset = plane->crtc_y;
@@ -566,8 +590,8 @@ static void mixer_graph_buffer(struct mixer_context *ctx, int win)
566 mixer_reg_write(res, MXR_RESOLUTION, val); 590 mixer_reg_write(res, MXR_RESOLUTION, val);
567 } 591 }
568 592
569 val = MXR_GRP_WH_WIDTH(plane->crtc_width); 593 val = MXR_GRP_WH_WIDTH(plane->src_width);
570 val |= MXR_GRP_WH_HEIGHT(plane->crtc_height); 594 val |= MXR_GRP_WH_HEIGHT(plane->src_height);
571 val |= MXR_GRP_WH_H_SCALE(x_ratio); 595 val |= MXR_GRP_WH_H_SCALE(x_ratio);
572 val |= MXR_GRP_WH_V_SCALE(y_ratio); 596 val |= MXR_GRP_WH_V_SCALE(y_ratio);
573 mixer_reg_write(res, MXR_GRAPHIC_WH(win), val); 597 mixer_reg_write(res, MXR_GRAPHIC_WH(win), val);