if (!plane_state->visible)
return -EINVAL;
- /* force 'mode_changed' when fb width changed, since
+ /* force 'mode_changed' when fb pitches changed, since
* the pitch related registers configuration of LCDIF
* can not be done when LCDIF is running.
*/
if (old_fb && likely(!crtc_state->mode_changed)) {
- if (old_fb->width != fb->width)
+ if (old_fb->pitches[0] != fb->pitches[0])
crtc_state->mode_changed = true;
}
struct drm_plane_state *state = plane->state;
struct drm_framebuffer *fb = state->fb;
struct drm_gem_cma_object *gem_obj = NULL;
- u32 fb_addr, src_off, src_w, fb_idx;
+ u32 fb_addr, src_off, src_w, fb_idx, cpp, stride;
bool crop;
/* plane and crtc is disabling */
/* config horizontal cropping if crtc needs modeset */
if (unlikely(drm_atomic_crtc_needs_modeset(state->crtc->state))) {
+ cpp = fb->format->cpp[0];
+ stride = DIV_ROUND_UP(fb->pitches[0], cpp);
+
src_w = state->src_w >> 16;
WARN_ON(src_w > fb->width);
- crop = src_w != fb->width ? true : false;
- lcdif_set_fb_hcrop(lcdif, src_w, fb->width, crop);
+ crop = src_w != stride ? true : false;
+ lcdif_set_fb_hcrop(lcdif, src_w, stride, crop);
}
lcdif_enable_controller(lcdif);