Skip to content

Commit c61a972

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 <[email protected]>
1 parent 2ea4ce0 commit c61a972

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
@@ -2402,15 +2402,26 @@ u32 vc4_plane_dlist_size(const struct drm_plane_state *state)
24022402
*/
24032403
void vc4_plane_async_set_fb(struct drm_plane *plane, struct drm_framebuffer *fb)
24042404
{
2405-
struct vc4_plane_state *vc4_state = to_vc4_plane_state(plane->state);
2405+
struct drm_plane_state *state = plane->state;
2406+
struct vc4_plane_state *vc4_state = to_vc4_plane_state(state);
24062407
struct drm_gem_dma_object *bo = drm_fb_dma_get_gem_obj(fb, 0);
24072408
struct vc4_dev *vc4 = to_vc4_dev(plane->dev);
24082409
dma_addr_t dma_addr = bo->dma_addr + fb->offsets[0];
2410+
unsigned int rotation;
24092411
int idx;
24102412

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

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

0 commit comments

Comments
 (0)