Skip to content

Commit 4286cce

Browse files
6by9popcornmix
authored andcommitted
drm: Check whether the gamma lut has changed before updating
drm_crtc_legacy_gamma_set updates the gamma_lut blob unconditionally, which leads to unnecessary reprogramming of hardware. Check whether the blob contents has actually changed before signalling that it has been updated. Signed-off-by: Dave Stevenson <[email protected]>
1 parent db14fc7 commit 4286cce

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

drivers/gpu/drm/drm_color_mgmt.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,8 +326,12 @@ static int drm_crtc_legacy_gamma_set(struct drm_crtc *crtc,
326326
replaced = drm_property_replace_blob(&crtc_state->degamma_lut,
327327
use_gamma_lut ? NULL : blob);
328328
replaced |= drm_property_replace_blob(&crtc_state->ctm, NULL);
329-
replaced |= drm_property_replace_blob(&crtc_state->gamma_lut,
329+
if (!crtc_state->gamma_lut || !crtc_state->gamma_lut->data ||
330+
memcmp(crtc_state->gamma_lut->data, blob_data, blob->length))
331+
replaced |= drm_property_replace_blob(&crtc_state->gamma_lut,
330332
use_gamma_lut ? blob : NULL);
333+
else
334+
drm_property_blob_put(blob);
331335
crtc_state->color_mgmt_changed |= replaced;
332336

333337
ret = drm_atomic_commit(state);

0 commit comments

Comments
 (0)