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

Commit c8db72c5 authored by Sunil Khatri's avatar Sunil Khatri
Browse files

msm: kgsl: Wake up snoozing threads on marker expiry



Marker commands may not be submitted to RB but
create room in context queue on expiry which is
left uncounted. If there are too many markers
commands from a specific context then context
queue eventually gets full but wakeup is never
called for sleeping threads.

Wake up the snoozing threads when there is room
in the context queue rather than based on the
condition of real submissions from the context.

CRs-fixed: 783187
Change-Id: I0cb0002d7b641071a45d46ae50ce9f23f37b0fab
Signed-off-by: default avatarSunil Khatri <sunilkh@codeaurora.org>
parent e9ef0c2c
Loading
Loading
Loading
Loading
+25 −26
Original line number Diff line number Diff line
/* Copyright (c) 2013-2014, The Linux Foundation. All rights reserved.
/* Copyright (c) 2013-2015, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -271,6 +271,27 @@ static void _retire_marker(struct kgsl_cmdbatch *cmdbatch)
	kgsl_cmdbatch_destroy(cmdbatch);
}

static int _check_context_queue(struct adreno_context *drawctxt)
{
	int ret;

	spin_lock(&drawctxt->lock);

	/*
	 * Wake up if there is room in the context or if the whole thing got
	 * invalidated while we were asleep
	 */

	if (kgsl_context_invalid(&drawctxt->base))
		ret = 1;
	else
		ret = drawctxt->queued < _context_cmdqueue_size ? 1 : 0;

	spin_unlock(&drawctxt->lock);

	return ret;
}

/*
 * return true if this is a marker command and the dependent timestamp has
 * retired
@@ -650,12 +671,11 @@ static int dispatcher_context_sendcmds(struct adreno_device *adreno_dev,
	}

	/*
	 * If the context successfully submitted commands there will be room
	 * in the context queue so wake up any snoozing threads that want to
	 * submit commands
	 * Wake up any snoozing threads if we have consumed any real commands
	 * or marker commands and we have room in the context queue.
	 */

	if (count)
	if (_check_context_queue(drawctxt))
		wake_up_all(&drawctxt->wq);

	if (!ret)
@@ -799,27 +819,6 @@ static int adreno_dispatcher_issuecmds(struct adreno_device *adreno_dev)
	return ret;
}

static int _check_context_queue(struct adreno_context *drawctxt)
{
	int ret;

	spin_lock(&drawctxt->lock);

	/*
	 * Wake up if there is room in the context or if the whole thing got
	 * invalidated while we were asleep
	 */

	if (kgsl_context_invalid(&drawctxt->base))
		ret = 1;
	else
		ret = drawctxt->queued < _context_cmdqueue_size ? 1 : 0;

	spin_unlock(&drawctxt->lock);

	return ret;
}

/**
 * get_timestamp() - Return the next timestamp for the context
 * @drawctxt - Pointer to an adreno draw context struct