3b734aa940114addf8cddbc57f1946a0572bbba0
[openwrt/staging/jow.git] /
1 From b77d51293dce1ff08da64c4bb95c13d2cb4c3ee7 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 120/703] drm/vc4: Skip SET_CURSOR_INFO when the cursor
5 contents didn't change.
6
7 Signed-off-by: Eric Anholt <eric@anholt.net>
8 ---
9 drivers/gpu/drm/vc4/vc4_firmware_kms.c | 30 +++++++++++++++++---------
10 1 file changed, 20 insertions(+), 10 deletions(-)
11
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
15 state->crtc_y,
16 0
17 };
18 - u32 packet_info[] = { state->crtc_w, state->crtc_h,
19 - 0, /* unused */
20 - bo->paddr + fb->offsets[0],
21 - 0, 0, /* hotx, hoty */};
22 WARN_ON_ONCE(fb->pitches[0] != state->crtc_w * 4);
23
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]);
28
29 - ret = rpi_firmware_property(vc4->firmware,
30 - RPI_FIRMWARE_SET_CURSOR_INFO,
31 - &packet_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.
38 + */
39 + if (!old_state ||
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,
44 + 0, /* unused */
45 + bo->paddr + fb->offsets[0],
46 + 0, 0, /* hotx, hoty */};
47 +
48 + ret = rpi_firmware_property(vc4->firmware,
49 + RPI_FIRMWARE_SET_CURSOR_INFO,
50 + &packet_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]);
54 + }
55 }
56
57 static void vc4_cursor_plane_atomic_disable(struct drm_plane *plane,