Skip to contentSkip to conversation

drm/atomic: Abuse legacy cursor update flag for legacy gamma update too

RFC In review Maarten Lankhorst 4 participants 5 messages Feb 13, 2018 – Feb 19, 2018

Subsystems (2)
lore
Share & tools
lore

Maarten Lankhorst

author maintainer
#0 lore raw

RFC 1/1 drm/atomic: Abuse legacy cursor update flag for legacy gamma update too

Programs like redshift set the legacy gamma for X.org every 5 seconds. Because atomic commits wait for vblank completion, we get a frame drop every 5 seconds because of the legacy gamma update.

Work around this by setting the legacy_cursor_update flag, to force legacy gamma updates not to be synced against vblank.

Reported-by Tholin #intel-gfx
---
 drivers/gpu/drm/drm_atomic_helper.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/gpu/drm/drm_atomic_helper.c +3 -0
index ae3cbfe9e01c..f37ab26ef4d2 100644
@@ -3806,6 +3806,9 @@ int drm_atomic_helper_legacy_gamma_set(struct drm_crtc *crtc,
 	if (!state)
 		return -ENOMEM;
 
+	/* Don't wait for vblank after updating gamma. */
+	state->legacy_cursor_update = true;
+
 	blob = drm_property_create_blob(dev,
 					sizeof(struct drm_color_lut) * size,
 					NULL);
Signature · 6 lines
2.16.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#1 lore raw

Quoting Maarten Lankhorst (2018-02-13 09:12:01)

Quoted 9 lines

Programs like redshift set the legacy gamma for X.org every 5 seconds. Because atomic commits wait for vblank completion, we get a frame drop every 5 seconds because of the legacy gamma update.

Work around this by setting the legacy_cursor_update flag, to force legacy gamma updates not to be synced against vblank.

Reported-by Tholin #intel-gfx

Reminiscing: Remember the time we had all those vblank workers patches, one of which was to do async gamma updates (apply the last one on the vblank). Motivated by gnome-shell and the ilk doing a gamma animation for fade-out on logout (which I guess they gave up on since it happened to be so slow as to extend logout ;).
-Chris
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

author maintainer
#2 lore raw

Hey,

Op 13-02-18 om 10:16 schreef Chris Wilson:

Quoted 8 lines

Quoting Maarten Lankhorst (2018-02-13 09:12:01)

Quoted 7 lines

Programs like redshift set the legacy gamma for X.org every 5 seconds. Because atomic commits wait for vblank completion, we get a frame drop every 5 seconds because of the legacy gamma update.

Work around this by setting the legacy_cursor_update flag, to force legacy gamma updates not to be synced against vblank.

Quoted 7 lines
Quoted 2 lines
Reported-by Tholin #intel-gfx

Reminiscing: Remember the time we had all those vblank workers patches, one of which was to do async gamma updates (apply the last one on the vblank). Motivated by gnome-shell and the ilk doing a gamma animation for fade-out on logout (which I guess they gave up on since it happened to be so slow as to extend logout ;).

That special case could be handled by userspace with atomic commits, I don't think it's worth optimizing it further..

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#3 lore raw
Quoted 13 lines · Maarten Lankhorst

Hey,

Op 13-02-18 om 10:16 schreef Chris Wilson:

Quoted 10 lines

Quoting Maarten Lankhorst (2018-02-13 09:12:01)

Quoted 9 lines

Programs like redshift set the legacy gamma for X.org every 5 seconds. Because atomic commits wait for vblank completion, we get a frame drop every 5 seconds because of the legacy gamma update.

Work around this by setting the legacy_cursor_update flag, to force legacy gamma updates not to be synced against vblank.

Reported-by Tholin #intel-gfx
Quoted 8 lines
Quoted 5 lines

Reminiscing: Remember the time we had all those vblank workers patches, one of which was to do async gamma updates (apply the last one on the vblank). Motivated by gnome-shell and the ilk doing a gamma animation for fade-out on logout (which I guess they gave up on since it happened to be so slow as to extend logout ;).

That special case could be handled by userspace with atomic commits, I don't think it's worth optimizing it further..

We need to eventually move the gamma updates (and other single buffered registers) to a vblank worker or something similar. Otherwise they will tear.

Signature · 6 lines
Ville Syrjälä
Intel OTC
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#4 lore raw
In reply to Maarten Lankhorst
Quoted 18 lines · Maarten Lankhorst

Programs like redshift set the legacy gamma for X.org every 5 seconds. Because atomic commits wait for vblank completion, we get a frame drop every 5 seconds because of the legacy gamma update.

Work around this by setting the legacy_cursor_update flag, to force legacy gamma updates not to be synced against vblank.

Reported-by Tholin #intel-gfx
---
 drivers/gpu/drm/drm_atomic_helper.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/gpu/drm/drm_atomic_helper.c +0 -0
index ae3cbfe9e01c..f37ab26ef4d2 100644

drivers/gpu/drm/drm_atomic_helper.c int drm_atomic_helper_legacy_gamma_set(struct drm_crtc *crtc, · line 3810

Quoted 5 lines
drivers/gpu/drm/drm_atomic_helper.c +2 -0
@@ -3806,6 +3806,9 @@ int drm_atomic_helper_legacy_gamma_set(struct drm_crtc *crtc,
 	if (!state)
 		return -ENOMEM;
 
+	/* Don't wait for vblank after updating gamma. */
+	state->legacy_cursor_update = true;

The legacy_cursor_update hack is a fairly serious hack, and I'd kinda want to avoid inflicting it on everyone. The cursor hack is a lot less minimal (because few drivers have cursors, and we'd have the async plane update stuff from Gustavo at least). Do we really need this?

Making sure that no one can trample over async gamma table updates, especially when we eventually go to a vblank worker for them, sounds like serious amounts of pain. I'd prefer we teach -modesetting to just push the gamma update with the next frame as an atomic commit, or in the blockhandler (to avoid delaying it).
-Daniel

Quoted 11 lines
drivers/gpu/drm/drm_atomic_helper.c +1 -0
+
 	blob = drm_property_create_blob(dev,
 					sizeof(struct drm_color_lut) * size,
 					NULL);
Signature · 6 lines
2.16.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel