22ef7b614349e34b7812bda875fdc1b91ff2dd3b
[openwrt/staging/blogic.git] /
1 From 190eaf4f8d95196b1b66c7c356d28643a6355039 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 | 6 +++++-
16 1 file changed, 5 insertions(+), 1 deletion(-)
17
18 --- a/drivers/gpu/drm/drm_color_mgmt.c
19 +++ b/drivers/gpu/drm/drm_color_mgmt.c
20 @@ -326,8 +326,12 @@ 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 + else
30 + drm_property_blob_put(blob);
31 crtc_state->color_mgmt_changed |= replaced;
32
33 ret = drm_atomic_commit(state);