The vertical step is the block pitch, i.e. pitch times the block
height, not the block width. R1/R2/R4 have a block height of 1 and a
block width of 8/4/2, so a vertical read walked 8/4/2 rows per pixel
and read past the buffer.

Fixes: b52fd27356af ("drm/vkms: Introduce pixel_read_direction enum")
Signed-off-by: Oarora Etimis <[email protected]>
---
 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 7f1f29b589e8..6f3ade34fad4 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.56.1

Reply via email to