diff options
| author | Russell King <rmk+kernel@armlinux.org.uk> | 2016-08-16 17:09:09 -0400 |
|---|---|---|
| committer | Russell King <rmk+kernel@armlinux.org.uk> | 2016-11-01 16:06:54 -0400 |
| commit | 37af35c778587b3e0e42d7b816fe4f6170f9c304 (patch) | |
| tree | 42fac41b50d42c1cafa0dbc823af2dc68ad48832 /drivers/gpu/drm/armada | |
| parent | 8be523db65ad41b6119f59e5a7136c85aad6da29 (diff) | |
drm/armada: split out primary plane update
Split out the primary plane update from the mode setting.
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Diffstat (limited to 'drivers/gpu/drm/armada')
| -rw-r--r-- | drivers/gpu/drm/armada/armada_crtc.c | 52 |
1 files changed, 32 insertions, 20 deletions
diff --git a/drivers/gpu/drm/armada/armada_crtc.c b/drivers/gpu/drm/armada/armada_crtc.c index 719873be3beb..5fff7cada6f5 100644 --- a/drivers/gpu/drm/armada/armada_crtc.c +++ b/drivers/gpu/drm/armada/armada_crtc.c | |||
| @@ -527,6 +527,34 @@ static uint32_t armada_drm_crtc_calculate_csc(struct armada_crtc *dcrtc) | |||
| 527 | return val; | 527 | return val; |
| 528 | } | 528 | } |
| 529 | 529 | ||
| 530 | static void armada_drm_primary_set(struct drm_crtc *crtc, | ||
| 531 | struct drm_plane *plane, int x, int y) | ||
| 532 | { | ||
| 533 | struct armada_plane_state *state = &drm_to_armada_plane(plane)->state; | ||
| 534 | struct armada_crtc *dcrtc = drm_to_armada_crtc(crtc); | ||
| 535 | struct armada_regs regs[7]; | ||
| 536 | bool interlaced = dcrtc->interlaced; | ||
| 537 | unsigned i; | ||
| 538 | uint32_t ctrl0; | ||
| 539 | |||
| 540 | i = armada_drm_crtc_calc_fb(plane->fb, x, y, regs, interlaced); | ||
| 541 | |||
| 542 | armada_reg_queue_set(regs, i, state->src_hw, LCD_SPU_GRA_HPXL_VLN); | ||
| 543 | armada_reg_queue_set(regs, i, state->dst_hw, LCD_SPU_GZM_HPXL_VLN); | ||
| 544 | |||
| 545 | ctrl0 = state->ctrl0; | ||
| 546 | if (interlaced) | ||
| 547 | ctrl0 |= CFG_GRA_FTOGGLE; | ||
| 548 | |||
| 549 | armada_reg_queue_mod(regs, i, ctrl0, CFG_GRAFORMAT | | ||
| 550 | CFG_GRA_MOD(CFG_SWAPRB | CFG_SWAPUV | | ||
| 551 | CFG_SWAPYU | CFG_YUV2RGB) | | ||
| 552 | CFG_PALETTE_ENA | CFG_GRA_FTOGGLE, | ||
| 553 | LCD_SPU_DMA_CTRL0); | ||
| 554 | armada_reg_queue_end(regs, i); | ||
| 555 | armada_drm_crtc_update_regs(dcrtc, regs); | ||
| 556 | } | ||
| 557 | |||
| 530 | /* The mode_config.mutex will be held for this call */ | 558 | /* The mode_config.mutex will be held for this call */ |
| 531 | static int armada_drm_crtc_mode_set(struct drm_crtc *crtc, | 559 | static int armada_drm_crtc_mode_set(struct drm_crtc *crtc, |
| 532 | struct drm_display_mode *mode, struct drm_display_mode *adj, | 560 | struct drm_display_mode *mode, struct drm_display_mode *adj, |
| @@ -553,12 +581,10 @@ static int armada_drm_crtc_mode_set(struct drm_crtc *crtc, | |||
| 553 | drm_to_armada_plane(crtc->primary)->state.ctrl0 = val; | 581 | drm_to_armada_plane(crtc->primary)->state.ctrl0 = val; |
| 554 | drm_to_armada_plane(crtc->primary)->state.src_hw = | 582 | drm_to_armada_plane(crtc->primary)->state.src_hw = |
| 555 | drm_to_armada_plane(crtc->primary)->state.dst_hw = | 583 | drm_to_armada_plane(crtc->primary)->state.dst_hw = |
| 556 | adj->crtc_hdisplay << 16 | adj->crtc_vdisplay; | 584 | adj->crtc_vdisplay << 16 | adj->crtc_hdisplay; |
| 557 | drm_to_armada_plane(crtc->primary)->state.dst_yx = 0; | 585 | drm_to_armada_plane(crtc->primary)->state.dst_yx = 0; |
| 558 | 586 | ||
| 559 | i = armada_drm_crtc_calc_fb(dcrtc->crtc.primary->fb, | 587 | i = 0; |
| 560 | x, y, regs, interlaced); | ||
| 561 | |||
| 562 | rm = adj->crtc_hsync_start - adj->crtc_hdisplay; | 588 | rm = adj->crtc_hsync_start - adj->crtc_hdisplay; |
| 563 | lm = adj->crtc_htotal - adj->crtc_hsync_end; | 589 | lm = adj->crtc_htotal - adj->crtc_hsync_end; |
| 564 | bm = adj->crtc_vsync_start - adj->crtc_vdisplay; | 590 | bm = adj->crtc_vsync_start - adj->crtc_vdisplay; |
| @@ -634,12 +660,6 @@ static int armada_drm_crtc_mode_set(struct drm_crtc *crtc, | |||
| 634 | val = adj->crtc_vdisplay << 16 | adj->crtc_hdisplay; | 660 | val = adj->crtc_vdisplay << 16 | adj->crtc_hdisplay; |
| 635 | 661 | ||
| 636 | armada_reg_queue_set(regs, i, val, LCD_SPU_V_H_ACTIVE); | 662 | armada_reg_queue_set(regs, i, val, LCD_SPU_V_H_ACTIVE); |
| 637 | armada_reg_queue_set(regs, i, | ||
| 638 | drm_to_armada_plane(crtc->primary)->state.src_hw, | ||
| 639 | LCD_SPU_GRA_HPXL_VLN); | ||
| 640 | armada_reg_queue_set(regs, i, | ||
| 641 | drm_to_armada_plane(crtc->primary)->state.dst_hw, | ||
| 642 | LCD_SPU_GZM_HPXL_VLN); | ||
| 643 | armada_reg_queue_set(regs, i, (lm << 16) | rm, LCD_SPU_H_PORCH); | 663 | armada_reg_queue_set(regs, i, (lm << 16) | rm, LCD_SPU_H_PORCH); |
| 644 | armada_reg_queue_set(regs, i, dcrtc->v[0].spu_v_porch, LCD_SPU_V_PORCH); | 664 | armada_reg_queue_set(regs, i, dcrtc->v[0].spu_v_porch, LCD_SPU_V_PORCH); |
| 645 | armada_reg_queue_set(regs, i, dcrtc->v[0].spu_v_h_total, | 665 | armada_reg_queue_set(regs, i, dcrtc->v[0].spu_v_h_total, |
| @@ -651,16 +671,6 @@ static int armada_drm_crtc_mode_set(struct drm_crtc *crtc, | |||
| 651 | ADV_VSYNCOFFEN, LCD_SPU_ADV_REG); | 671 | ADV_VSYNCOFFEN, LCD_SPU_ADV_REG); |
| 652 | } | 672 | } |
| 653 | 673 | ||
| 654 | val = drm_to_armada_plane(crtc->primary)->state.ctrl0; | ||
| 655 | if (interlaced) | ||
| 656 | val |= CFG_GRA_FTOGGLE; | ||
| 657 | |||
| 658 | armada_reg_queue_mod(regs, i, val, CFG_GRAFORMAT | | ||
| 659 | CFG_GRA_MOD(CFG_SWAPRB | CFG_SWAPUV | | ||
| 660 | CFG_SWAPYU | CFG_YUV2RGB) | | ||
| 661 | CFG_PALETTE_ENA | CFG_GRA_FTOGGLE, | ||
| 662 | LCD_SPU_DMA_CTRL0); | ||
| 663 | |||
| 664 | val = adj->flags & DRM_MODE_FLAG_NVSYNC ? CFG_VSYNC_INV : 0; | 674 | val = adj->flags & DRM_MODE_FLAG_NVSYNC ? CFG_VSYNC_INV : 0; |
| 665 | armada_reg_queue_mod(regs, i, val, CFG_VSYNC_INV, LCD_SPU_DMA_CTRL1); | 675 | armada_reg_queue_mod(regs, i, val, CFG_VSYNC_INV, LCD_SPU_DMA_CTRL1); |
| 666 | 676 | ||
| @@ -669,6 +679,8 @@ static int armada_drm_crtc_mode_set(struct drm_crtc *crtc, | |||
| 669 | armada_reg_queue_end(regs, i); | 679 | armada_reg_queue_end(regs, i); |
| 670 | 680 | ||
| 671 | armada_drm_crtc_update_regs(dcrtc, regs); | 681 | armada_drm_crtc_update_regs(dcrtc, regs); |
| 682 | |||
| 683 | armada_drm_primary_set(crtc, crtc->primary, x, y); | ||
| 672 | spin_unlock_irqrestore(&dcrtc->irq_lock, flags); | 684 | spin_unlock_irqrestore(&dcrtc->irq_lock, flags); |
| 673 | 685 | ||
| 674 | armada_drm_crtc_update(dcrtc); | 686 | armada_drm_crtc_update(dcrtc); |
