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

Commit 0bf63cc8 authored by Lynus Vaz's avatar Lynus Vaz Committed by Carter Cooper
Browse files

msm: kgsl: Fix the refcounting on the A6XX context record



The user context record had an extra refcount, preventing it from
being destroyed. Fix the refcounting.

Change-Id: Iafb86f40a9898ee41e4d80880192ced2d21c82cb
Signed-off-by: default avatarLynus Vaz <lvaz@codeaurora.org>
Signed-off-by: default avatarCarter Cooper <ccooper@codeaurora.org>
parent 037d768f
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -635,6 +635,9 @@ void a6xx_preemption_context_destroy(struct kgsl_context *context)
		return;

	gpumem_free_entry(context->user_ctxt_record);

	/* Put the extra ref from gpumem_alloc_entry() */
	kgsl_mem_entry_put(context->user_ctxt_record);
}

int a6xx_preemption_context_init(struct kgsl_context *context)
@@ -645,6 +648,10 @@ int a6xx_preemption_context_init(struct kgsl_context *context)
	if (!adreno_is_preemption_setup_enabled(adreno_dev))
		return 0;

	/*
	 * gpumem_alloc_entry takes an extra refcount. Put it only when
	 * destroying the context to keep the context record valid
	 */
	context->user_ctxt_record = gpumem_alloc_entry(context->dev_priv,
			A6XX_CP_CTXRECORD_USER_RESTORE_SIZE, 0);
	if (IS_ERR(context->user_ctxt_record)) {