c5b06b44428b3551e196564d2de0cc41d111d60e
[openwrt/staging/pepe2k.git] /
1 From 39a1d2daa0440779a0790ca32543f30220b451da Mon Sep 17 00:00:00 2001
2 From: Dave Stevenson <dave.stevenson@raspberrypi.com>
3 Date: Tue, 2 Nov 2021 16:01:36 +0000
4 Subject: [PATCH] drm: Check whether the gamma lut has changed before
5 updating
6
7 drm_crtc_legacy_gamma_set updates the gamma_lut blob unconditionally,
8 which leads to unnecessary reprogramming of hardware.
9
10 Check whether the blob contents has actually changed before
11 signalling that it has been updated.
12
13 Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
14 ---
15 drivers/gpu/drm/drm_color_mgmt.c | 4 +++-
16 1 file changed, 3 insertions(+), 1 deletion(-)
17
18 --- a/drivers/gpu/drm/drm_color_mgmt.c
19 +++ b/drivers/gpu/drm/drm_color_mgmt.c
20 @@ -330,7 +330,9 @@ static int drm_crtc_legacy_gamma_set(str
21 replaced = drm_property_replace_blob(&crtc_state->degamma_lut,
22 use_gamma_lut ? NULL : blob);
23 replaced |= drm_property_replace_blob(&crtc_state->ctm, NULL);
24 - replaced |= drm_property_replace_blob(&crtc_state->gamma_lut,
25 + if (!crtc_state->gamma_lut || !crtc_state->gamma_lut->data ||
26 + memcmp(crtc_state->gamma_lut->data, blob_data, blob->length))
27 + replaced |= drm_property_replace_blob(&crtc_state->gamma_lut,
28 use_gamma_lut ? blob : NULL);
29 crtc_state->color_mgmt_changed |= replaced;
30