Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 92890583 authored by Matt Roper's avatar Matt Roper Committed by Daniel Vetter
Browse files

drm/plane-helper: Skip prepare_fb/cleanup_fb when newfb==oldfb



When commiting a plane update where the framebuffer doesn't change, we
can skip the prepare_fb/cleanup_fb steps.  This also allows us to avoid
an unnecessary vblank wait at the end of the operation when we're just
moving a plane and not changing its image (e.g., for a cursor).

At the moment, i915 is the only upstream driver using the transitional
plane helpers, and thus the only driver affected by this change.

Note that this replicates a corresponding change in the atomic helpers
implemented in

commit ab58e338
Author: Daniel Vetter <daniel.vetter@ffwll.ch>
Date:   Mon Nov 24 20:42:42 2014 +0100

    drm/atomic-helper: Skip vblank waits for unchanged fbs

Reported-by: default avatarJeremiah Mahler <jmmahler@gmail.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=88540


Signed-off-by: default avatarMatt Roper <matthew.d.roper@intel.com>
Tested-by: default avatarTested-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
parent 281d1bbd
Loading
Loading
Loading
Loading
+9 −1
Original line number Original line Diff line number Diff line
@@ -435,7 +435,8 @@ int drm_plane_helper_commit(struct drm_plane *plane,
			goto out;
			goto out;
	}
	}


	if (plane_funcs->prepare_fb && plane_state->fb) {
	if (plane_funcs->prepare_fb && plane_state->fb &&
	    plane_state->fb != old_fb) {
		ret = plane_funcs->prepare_fb(plane, plane_state->fb);
		ret = plane_funcs->prepare_fb(plane, plane_state->fb);
		if (ret)
		if (ret)
			goto out;
			goto out;
@@ -456,6 +457,13 @@ int drm_plane_helper_commit(struct drm_plane *plane,
			crtc_funcs[i]->atomic_flush(crtc[i]);
			crtc_funcs[i]->atomic_flush(crtc[i]);
	}
	}


	/*
	 * If we only moved the plane and didn't change fb's, there's no need to
	 * wait for vblank.
	 */
	if (plane->state->fb == old_fb)
		goto out;

	for (i = 0; i < 2; i++) {
	for (i = 0; i < 2; i++) {
		if (!crtc[i])
		if (!crtc[i])
			continue;
			continue;