[PATCH] drm/vkms: Fix vertical read step for R1/R2/R4 formats
From: oushixiong1025
Date: Thu Aug 20 2026 - 04:32:40 EST
From: Shixiong Ou <oushixiong@xxxxxxxxxx>
get_block_step_bytes() returns pitches * block_w as the vertical step for
READ_TOP_TO_BOTTOM and READ_BOTTOM_TO_TOP, but consecutive rows are
pitches * block_h bytes apart (block_h is 1 for R1/R2/R4). Vertical reads
therefore sample every block_w-th row instead of every row, and walk past
the end of the framebuffer, when 90/270-rotating or reflecting R1/R2/R4
planes. Use the block height instead, matching packed_pixels_offset().
Signed-off-by: Shixiong Ou <oushixiong@xxxxxxxxxx>
---
drivers/gpu/drm/vkms/vkms_formats.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/gpu/drm/vkms/vkms_formats.c b/drivers/gpu/drm/vkms/vkms_formats.c
index dfb8e13cba87..1e3a6af9cea5 100644
--- a/drivers/gpu/drm/vkms/vkms_formats.c
+++ b/drivers/gpu/drm/vkms/vkms_formats.c
@@ -103,11 +103,11 @@ static int get_block_step_bytes(struct drm_framebuffer *fb, enum pixel_read_dire
case READ_RIGHT_TO_LEFT:
return -fb->format->char_per_block[plane_index];
case READ_TOP_TO_BOTTOM:
- return (int)fb->pitches[plane_index] * drm_format_info_block_width(fb->format,
- plane_index);
- case READ_BOTTOM_TO_TOP:
- return -(int)fb->pitches[plane_index] * drm_format_info_block_width(fb->format,
+ return (int)fb->pitches[plane_index] * drm_format_info_block_height(fb->format,
plane_index);
+ case READ_BOTTOM_TO_TOP:
+ return -(int)fb->pitches[plane_index] * drm_format_info_block_height(fb->format,
+ plane_index);
}
return 0;
--
2.25.1
No virus found
Checked by Hillstone Network AntiVirus