Skip to content

Commit a4a22aa

Browse files
committed
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 <[email protected]>
1 parent 957fc9f commit a4a22aa

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
@@ -2400,15 +2400,26 @@ u32 vc4_plane_dlist_size(const struct drm_plane_state *state)
24002400
*/
24012401
void vc4_plane_async_set_fb(struct drm_plane *plane, struct drm_framebuffer *fb)
24022402
{
2403-
struct vc4_plane_state *vc4_state = to_vc4_plane_state(plane->state);
2403+
struct drm_plane_state *state = plane->state;
2404+
struct vc4_plane_state *vc4_state = to_vc4_plane_state(state);
24042405
struct drm_gem_dma_object *bo = drm_fb_dma_get_gem_obj(fb, 0);
24052406
struct vc4_dev *vc4 = to_vc4_dev(plane->dev);
24062407
dma_addr_t dma_addr = bo->dma_addr + fb->offsets[0];
2408+
unsigned int rotation;
24072409
int idx;
24082410

24092411
if (!drm_dev_enter(plane->dev, &idx))
24102412
return;
24112413

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

0 commit comments

Comments
 (0)