Skip to contentSkip to conversation

drm/vkms: use the block height for the vertical stride

PATCH New Oarora Etimis 1 participant 1 message Dec 4

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/vkms: use the block height for the vertical stride

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")
---
 drivers/gpu/drm/vkms/vkms_formats.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/vkms/vkms_formats.c +4 -4
index 7f1f29b589e8..6f3ade34fad4 100644
@@ -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;
Signature · 1 line
2.56.1