1 From a87af130d6feadfea3146a78c58408a8be9a0635 Mon Sep 17 00:00:00 2001
2 From: Eric Anholt <eric@anholt.net>
3 Date: Mon, 5 Feb 2018 18:02:30 +0000
4 Subject: [PATCH] drm/vc4: Skip SET_CURSOR_INFO when the cursor
5 contents didn't change.
7 Signed-off-by: Eric Anholt <eric@anholt.net>
9 drivers/gpu/drm/vc4/vc4_firmware_kms.c | 30 +++++++++++++++++---------
10 1 file changed, 20 insertions(+), 10 deletions(-)
12 --- a/drivers/gpu/drm/vc4/vc4_firmware_kms.c
13 +++ b/drivers/gpu/drm/vc4/vc4_firmware_kms.c
14 @@ -204,10 +204,6 @@ static void vc4_cursor_plane_atomic_upda
18 - u32 packet_info[] = { state->crtc_w, state->crtc_h,
20 - bo->paddr + fb->offsets[0],
21 - 0, 0, /* hotx, hoty */};
22 WARN_ON_ONCE(fb->pitches[0] != state->crtc_w * 4);
24 DRM_DEBUG_ATOMIC("[PLANE:%d:%s] update %dx%d cursor at %d,%d (0x%08x/%d)",
25 @@ -232,12 +228,26 @@ static void vc4_cursor_plane_atomic_upda
26 if (ret || packet_state[0] != 0)
27 DRM_ERROR("Failed to set cursor state: 0x%08x\n", packet_state[0]);
29 - ret = rpi_firmware_property(vc4->firmware,
30 - RPI_FIRMWARE_SET_CURSOR_INFO,
32 - sizeof(packet_info));
33 - if (ret || packet_info[0] != 0)
34 - DRM_ERROR("Failed to set cursor info: 0x%08x\n", packet_info[0]);
35 + /* Note: When the cursor contents change, the modesetting
36 + * driver calls drm_mode_cursor_univeral() with
37 + * DRM_MODE_CURSOR_BO, which means a new fb will be allocated.
40 + state->crtc_w != old_state->crtc_w ||
41 + state->crtc_h != old_state->crtc_h ||
42 + fb != old_state->fb) {
43 + u32 packet_info[] = { state->crtc_w, state->crtc_h,
45 + bo->paddr + fb->offsets[0],
46 + 0, 0, /* hotx, hoty */};
48 + ret = rpi_firmware_property(vc4->firmware,
49 + RPI_FIRMWARE_SET_CURSOR_INFO,
51 + sizeof(packet_info));
52 + if (ret || packet_info[0] != 0)
53 + DRM_ERROR("Failed to set cursor info: 0x%08x\n", packet_info[0]);
57 static void vc4_cursor_plane_atomic_disable(struct drm_plane *plane,