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

Commit 730a4dba authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: kgsl: Don't block on detach if the context is invalid"

parents f8713273 3fa1f137
Loading
Loading
Loading
Loading
+17 −10
Original line number Diff line number Diff line
@@ -159,15 +159,13 @@ static void global_wait_callback(struct kgsl_device *device, void *priv, u32 id,
}

static int _check_global_timestamp(struct kgsl_device *device,
		unsigned int timestamp)
		struct adreno_context *drawctxt, unsigned int timestamp)
{
	int ret;

	mutex_lock(&device->mutex);
	ret = kgsl_check_timestamp(device, NULL, timestamp);
	mutex_unlock(&device->mutex);
	/* Stop waiting if the context is invalidated */
	if (drawctxt->state == ADRENO_CONTEXT_STATE_INVALID)
		return 1;

	return ret;
	return kgsl_check_timestamp(device, NULL, timestamp);
}

static int adreno_drawctxt_wait_global(struct adreno_device *adreno_dev,
@@ -176,7 +174,7 @@ static int adreno_drawctxt_wait_global(struct adreno_device *adreno_dev,
{
	struct kgsl_device *device = &adreno_dev->dev;
	struct adreno_context *drawctxt = ADRENO_CONTEXT(context);
	int ret;
	int ret = 0;

	/* Needs to hold the device mutex */
	BUG_ON(!mutex_is_locked(&device->mutex));
@@ -186,6 +184,15 @@ static int adreno_drawctxt_wait_global(struct adreno_device *adreno_dev,
		goto done;
	}

	/*
	 * If the context is invalid then return immediately - we may end up
	 * waiting for a timestamp that will never come
	 */
	if (drawctxt->state == ADRENO_CONTEXT_STATE_INVALID) {
		kgsl_context_put(context);
		goto done;
	}

	trace_adreno_drawctxt_wait_start(KGSL_MEMSTORE_GLOBAL, timestamp);

	ret = kgsl_add_event(device, KGSL_MEMSTORE_GLOBAL, timestamp,
@@ -199,7 +206,7 @@ static int adreno_drawctxt_wait_global(struct adreno_device *adreno_dev,

	if (timeout) {
		ret = (int) wait_event_timeout(drawctxt->waiting,
			_check_global_timestamp(device, timestamp),
			_check_global_timestamp(device, drawctxt, timestamp),
			msecs_to_jiffies(timeout));

		if (ret == 0)
@@ -208,7 +215,7 @@ static int adreno_drawctxt_wait_global(struct adreno_device *adreno_dev,
			ret = 0;
	} else {
		wait_event(drawctxt->waiting,
			_check_global_timestamp(device, timestamp));
			_check_global_timestamp(device, drawctxt, timestamp));
	}

	mutex_lock(&device->mutex);