Skip to content

Commit e3e63c0

Browse files
6by9pelwell
authored andcommitted
drm/vc4: Correct buffer address on async commit when vertically flipped
The buffer address needs to be for the last line of the image if vertically flipped. The main commit code was handling this, but the async path wasn't. Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
1 parent 76d6279 commit e3e63c0

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

drivers/gpu/drm/vc4/vc4_plane.c

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2403,15 +2403,26 @@ u32 vc4_plane_dlist_size(const struct drm_plane_state *state)
24032403
*/
24042404
void vc4_plane_async_set_fb(struct drm_plane *plane, struct drm_framebuffer *fb)
24052405
{
2406-
struct vc4_plane_state *vc4_state = to_vc4_plane_state(plane->state);
2406+
struct drm_plane_state *state = plane->state;
2407+
struct vc4_plane_state *vc4_state = to_vc4_plane_state(state);
24072408
struct drm_gem_dma_object *bo = drm_fb_dma_get_gem_obj(fb, 0);
24082409
struct vc4_dev *vc4 = to_vc4_dev(plane->dev);
24092410
dma_addr_t dma_addr = bo->dma_addr + fb->offsets[0];
2411+
unsigned int rotation;
24102412
int idx;
24112413

24122414
if (!drm_dev_enter(plane->dev, &idx))
24132415
return;
24142416

2417+
rotation = drm_rotation_simplify(state->rotation,
2418+
DRM_MODE_ROTATE_0 |
2419+
DRM_MODE_REFLECT_X |
2420+
DRM_MODE_REFLECT_Y);
2421+
2422+
/* We must point to the last line when Y reflection is enabled. */
2423+
if (rotation & DRM_MODE_REFLECT_Y)
2424+
dma_addr += fb->pitches[0] * ((vc4_state->src_h[0] >> 16) - 1);
2425+
24152426
/* We're skipping the address adjustment for negative origin,
24162427
* because this is only called on the primary plane.
24172428
*/

0 commit comments

Comments
 (0)