Skip to content

Commit

Permalink
ydrm/vc4: fkms: Fix margin calculations for the right/bottom edges
Browse files Browse the repository at this point in the history
The calculations clipped the right/bottom edge of the clipped
range based on the left/top margins.

#4447

Signed-off-by: Dave Stevenson <[email protected]>
  • Loading branch information
6by9 authored and pelwell committed Jul 12, 2021
1 parent b325ac8 commit 0088c16
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions drivers/gpu/drm/vc4/vc4_firmware_kms.c
Original file line number Diff line number Diff line change
Expand Up @@ -458,15 +458,15 @@ static int vc4_fkms_margins_adj(struct drm_plane_state *pstate,
plane->dst_x = DIV_ROUND_CLOSEST(plane->dst_x * adjhdisplay,
(int)crtc_state->mode.hdisplay);
plane->dst_x += left;
if (plane->dst_x > (int)(crtc_state->mode.hdisplay - left))
plane->dst_x = crtc_state->mode.hdisplay - left;
if (plane->dst_x > (int)(crtc_state->mode.hdisplay - right))
plane->dst_x = crtc_state->mode.hdisplay - right;

adjvdisplay = crtc_state->mode.vdisplay - (top + bottom);
plane->dst_y = DIV_ROUND_CLOSEST(plane->dst_y * adjvdisplay,
(int)crtc_state->mode.vdisplay);
plane->dst_y += top;
if (plane->dst_y > (int)(crtc_state->mode.vdisplay - top))
plane->dst_y = crtc_state->mode.vdisplay - top;
if (plane->dst_y > (int)(crtc_state->mode.vdisplay - bottom))
plane->dst_y = crtc_state->mode.vdisplay - bottom;

plane->dst_w = DIV_ROUND_CLOSEST(plane->dst_w * adjhdisplay,
crtc_state->mode.hdisplay);
Expand Down

0 comments on commit 0088c16

Please sign in to comment.