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

Commit d7ae274e authored by Yashwanth's avatar Yashwanth
Browse files

disp: msm: sde: hold vmlock only during transition in check phase



In the current code, vmlock is always acquired in check
phase even if there is no transition between vm's. This
might result in janks if vmlock is held concurrently by
other processes such as backlight update. This change
ensures that vmlock is held only if there is a valid
transition request between vm's in check phase.

Change-Id: I022f04c19ba04fdd5494580cc1436747620b9354
Signed-off-by: default avatarYashwanth <yvulapu@codeaurora.org>
parent 9122159c
Loading
Loading
Loading
Loading
+9 −2
Original line number Diff line number Diff line
@@ -2750,7 +2750,6 @@ static int sde_kms_check_vm_request(struct msm_kms *kms,
				!vm_ops->vm_acquire)
		return -EINVAL;

	sde_vm_lock(sde_kms);

	for_each_oldnew_crtc_in_state(state, crtc, old_cstate, new_cstate, i) {
		struct sde_crtc_state *old_state = NULL, *new_state = NULL;
@@ -2771,6 +2770,9 @@ static int sde_kms_check_vm_request(struct msm_kms *kms,
		 * VM_REQ_NONE to VM_REQ_NONE
		 */
		if (old_vm_req || new_vm_req) {
			if (!vm_req_active)
				sde_vm_lock(sde_kms);

			rc = vm_ops->vm_request_valid(sde_kms,
					old_vm_req, new_vm_req);
			if (rc) {
@@ -2778,11 +2780,15 @@ static int sde_kms_check_vm_request(struct msm_kms *kms,
				"VM transition check failed; o_state:%d, n_state:%d, hw_owner:%d, rc:%d\n",
					old_vm_req, new_vm_req,
					vm_ops->vm_owns_hw(sde_kms), rc);
				if (!vm_req_active)
					sde_vm_unlock(sde_kms);
				goto end;
			} else if (old_vm_req == VM_REQ_ACQUIRE &&
					new_vm_req == VM_REQ_NONE) {
				SDE_DEBUG(
				"VM transition valid; ignore further checks\n");
				if (!vm_req_active)
					sde_vm_unlock(sde_kms);
			} else {
				vm_req_active = true;
			}
@@ -2880,6 +2886,7 @@ static int sde_kms_check_vm_request(struct msm_kms *kms,
	}

end:
	if (vm_req_active)
		sde_vm_unlock(sde_kms);

	return rc;