Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/imx: ipuv3-plane: Fix overlay plane width

ipu_src_rect_width() was introduced to support odd screen resolutions
such as 1366x768 by internally rounding up primary plane width to a
multiple of 8 and compensating with reduced horizontal blanking.
This also caused overlay plane width to be rounded up, which was not
intended. Fix overlay plane width by limiting the rounding up to the
primary plane.

drm_rect_width(&new_state->src) >> 16 is the same value as
drm_rect_width(dst) because there is no plane scaling support.

Fixes: 94dfec48fca7 ("drm/imx: Add 8 pixel alignment fix")
Reviewed-by: Lucas Stach <l.stach@pengutronix.de>
Link: https://lore.kernel.org/r/20221108141420.176696-1-p.zabel@pengutronix.de
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Link: https://patchwork.freedesktop.org/patch/msgid/20221108141420.176696-1-p.zabel@pengutronix.de

+8 -6
+8 -6
drivers/gpu/drm/imx/ipuv3-plane.c
··· 614 614 break; 615 615 } 616 616 617 + if (ipu_plane->dp_flow == IPU_DP_FLOW_SYNC_BG) 618 + width = ipu_src_rect_width(new_state); 619 + else 620 + width = drm_rect_width(&new_state->src) >> 16; 621 + 617 622 eba = drm_plane_state_to_eba(new_state, 0); 618 623 619 624 /* ··· 627 622 */ 628 623 if (ipu_state->use_pre) { 629 624 axi_id = ipu_chan_assign_axi_id(ipu_plane->dma); 630 - ipu_prg_channel_configure(ipu_plane->ipu_ch, axi_id, 631 - ipu_src_rect_width(new_state), 625 + ipu_prg_channel_configure(ipu_plane->ipu_ch, axi_id, width, 632 626 drm_rect_height(&new_state->src) >> 16, 633 627 fb->pitches[0], fb->format->format, 634 628 fb->modifier, &eba); ··· 682 678 break; 683 679 } 684 680 685 - ipu_dmfc_config_wait4eot(ipu_plane->dmfc, ALIGN(drm_rect_width(dst), 8)); 681 + ipu_dmfc_config_wait4eot(ipu_plane->dmfc, width); 686 682 687 - width = ipu_src_rect_width(new_state); 688 683 height = drm_rect_height(&new_state->src) >> 16; 689 684 info = drm_format_info(fb->format->format); 690 685 ipu_calculate_bursts(width, info->cpp[0], fb->pitches[0], ··· 747 744 ipu_cpmem_set_burstsize(ipu_plane->ipu_ch, 16); 748 745 749 746 ipu_cpmem_zero(ipu_plane->alpha_ch); 750 - ipu_cpmem_set_resolution(ipu_plane->alpha_ch, 751 - ipu_src_rect_width(new_state), 747 + ipu_cpmem_set_resolution(ipu_plane->alpha_ch, width, 752 748 drm_rect_height(&new_state->src) >> 16); 753 749 ipu_cpmem_set_format_passthrough(ipu_plane->alpha_ch, 8); 754 750 ipu_cpmem_set_high_priority(ipu_plane->alpha_ch);