Skip to content

Commit 0668220

Browse files
ldesrochesmanikandan-m11
authored andcommitted
drm/atmel-hlcdc: don't reject the commit if the src rect has fractional parts
Don’t reject the commit when the source rectangle has fractional parts. This can occur due to scaling: drm_atomic_helper_check_plane_state() calls drm_rect_clip_scaled(), which may introduce fractional parts while computing the clipped source rectangle. This does not imply the commit is invalid, so we should accept it instead of discarding it. Signed-off-by: Ludovic Desroches <ludovic.desroches@microchip.com> Reviewed-by: Manikandan Muralidharan <manikandan.m@microchip.com> Link: https://patch.msgid.link/20251120-lcd_scaling_fix-v1-1-5ffc98557923@microchip.com Signed-off-by: Manikandan Muralidharan <manikandan.m@microchip.com>
1 parent bc84778 commit 0668220

1 file changed

Lines changed: 4 additions & 15 deletions

File tree

drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,6 @@ drm_plane_state_to_atmel_hlcdc_plane_state(struct drm_plane_state *s)
7979
return container_of(s, struct atmel_hlcdc_plane_state, base);
8080
}
8181

82-
#define SUBPIXEL_MASK 0xffff
83-
8482
static uint32_t rgb_formats[] = {
8583
DRM_FORMAT_C8,
8684
DRM_FORMAT_XRGB4444,
@@ -745,24 +743,15 @@ static int atmel_hlcdc_plane_atomic_check(struct drm_plane *p,
745743
if (ret || !s->visible)
746744
return ret;
747745

748-
hstate->src_x = s->src.x1;
749-
hstate->src_y = s->src.y1;
750-
hstate->src_w = drm_rect_width(&s->src);
751-
hstate->src_h = drm_rect_height(&s->src);
746+
hstate->src_x = s->src.x1 >> 16;
747+
hstate->src_y = s->src.y1 >> 16;
748+
hstate->src_w = drm_rect_width(&s->src) >> 16;
749+
hstate->src_h = drm_rect_height(&s->src) >> 16;
752750
hstate->crtc_x = s->dst.x1;
753751
hstate->crtc_y = s->dst.y1;
754752
hstate->crtc_w = drm_rect_width(&s->dst);
755753
hstate->crtc_h = drm_rect_height(&s->dst);
756754

757-
if ((hstate->src_x | hstate->src_y | hstate->src_w | hstate->src_h) &
758-
SUBPIXEL_MASK)
759-
return -EINVAL;
760-
761-
hstate->src_x >>= 16;
762-
hstate->src_y >>= 16;
763-
hstate->src_w >>= 16;
764-
hstate->src_h >>= 16;
765-
766755
hstate->nplanes = fb->format->num_planes;
767756
if (hstate->nplanes > ATMEL_HLCDC_LAYER_MAX_PLANES)
768757
return -EINVAL;

0 commit comments

Comments
 (0)