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

Commit fdb36682 authored by Jayaprakash's avatar Jayaprakash
Browse files

disp: msm: sde: remove fb's attached to a drm_file in preclose



Add changes to remove framebuffers attached to a drm_file
in preclose whose refcount is not managed by composer kill
and issue null flush to hardware in such cases. This will
avoid upstream issuing drm_atomic_commit's in drm_fb_release
which is leading to artifacts on screen or atomic_check failures
due to atomically unstaging each fb from plane_state and
committing remaining planes on hardware.

Change-Id: Ic197fb596a1dcfd1ebe2c83e759e619a1ab2f798
Signed-off-by: default avatarJayaprakash <jmadiset@codeaurora.org>
parent 7c913380
Loading
Loading
Loading
Loading
+20 −6
Original line number Diff line number Diff line
@@ -2102,8 +2102,9 @@ static int _sde_kms_remove_fbs(struct sde_kms *sde_kms, struct drm_file *file,
	struct drm_framebuffer *fb, *tfb;
	struct list_head fbs;
	struct drm_plane *plane;
	struct drm_crtc *crtc = NULL;
	unsigned int crtc_mask = 0;
	int ret = 0;
	u32 plane_mask = 0;

	INIT_LIST_HEAD(&fbs);

@@ -2112,9 +2113,11 @@ static int _sde_kms_remove_fbs(struct sde_kms *sde_kms, struct drm_file *file,
			list_move_tail(&fb->filp_head, &fbs);

			drm_for_each_plane(plane, dev) {
				if (plane->fb == fb) {
					plane_mask |=
						1 << drm_plane_index(plane);
				if (plane->state &&
					plane->state->fb == fb) {
					if (plane->state->crtc)
						crtc_mask |= drm_crtc_mask(
							plane->state->crtc);
					 _sde_kms_plane_force_remove(
								plane, state);
				}
@@ -2127,11 +2130,22 @@ static int _sde_kms_remove_fbs(struct sde_kms *sde_kms, struct drm_file *file,

	if (list_empty(&fbs)) {
		SDE_DEBUG("skip commit as no fb(s)\n");
		drm_atomic_state_put(state);
		return 0;
	}

	SDE_DEBUG("committing after removing all the pipes\n");
	drm_for_each_crtc(crtc, dev) {
		if ((crtc_mask & drm_crtc_mask(crtc)) && crtc->state->active) {
			struct drm_encoder *drm_enc;

			drm_for_each_encoder_mask(drm_enc, crtc->dev,
					crtc->state->encoder_mask)
				ret = sde_kms_set_crtc_for_conn(
					dev, drm_enc, state);
		}
	}

	SDE_EVT32(state, crtc_mask);
	SDE_DEBUG("null commit after removing all the pipes\n");
	ret = drm_atomic_commit(state);

	if (ret) {