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

Commit e75fb651 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: When switching pagetable use current context ID"

parents d0aa1f4c 59210237
Loading
Loading
Loading
Loading
+3 −4
Original line number Diff line number Diff line
@@ -1160,11 +1160,10 @@ static int adreno_iommu_setstate(struct kgsl_device *device,
	num_iommu_units = kgsl_mmu_get_num_iommu_units(&device->mmu);

	context = kgsl_context_get(device, context_id);
	if (context == NULL) {
		kgsl_mmu_device_setstate(&device->mmu, KGSL_CONTEXT_INVALID);
		return -EINVAL;
	if (!context) {
		kgsl_mmu_device_setstate(&device->mmu, flags);
		return 0;
	}

	adreno_ctx = ADRENO_CONTEXT(context);

	result = kgsl_mmu_enable_clk(&device->mmu, KGSL_IOMMU_CONTEXT_USER);
+12 −17
Original line number Diff line number Diff line
@@ -485,7 +485,6 @@ void adreno_drawctxt_destroy(struct kgsl_context *context)
static int adreno_context_restore(struct adreno_device *adreno_dev,
				  struct adreno_context *context)
{
	int ret;
	struct kgsl_device *device;
	unsigned int cmds[5];

@@ -493,6 +492,7 @@ static int adreno_context_restore(struct adreno_device *adreno_dev,
		return -EINVAL;

	device = &adreno_dev->dev;

	/* write the context identifier to the ringbuffer */
	cmds[0] = cp_nop_packet(1);
	cmds[1] = KGSL_CONTEXT_TO_MEM_IDENTIFIER;
@@ -500,14 +500,8 @@ static int adreno_context_restore(struct adreno_device *adreno_dev,
	cmds[3] = device->memstore.gpuaddr +
		KGSL_MEMSTORE_OFFSET(KGSL_MEMSTORE_GLOBAL, current_context);
	cmds[4] = context->base.id;
	ret = adreno_ringbuffer_issuecmds(device, context, KGSL_CMD_FLAGS_NONE,
					cmds, 5);
	if (ret)
		return ret;

	return kgsl_mmu_setstate(&device->mmu,
			context->base.proc_priv->pagetable,
			context->base.id);
	return adreno_ringbuffer_issuecmds(device, context,
				KGSL_CMD_FLAGS_NONE, cmds, 5);
}

/**
@@ -533,17 +527,16 @@ int adreno_drawctxt_switch(struct adreno_device *adreno_dev,
	trace_adreno_drawctxt_switch(adreno_dev->drawctxt_active,
		drawctxt, flags);

	if (adreno_dev->drawctxt_active) {
		/* Put the old instance of the active drawctxt */
		kgsl_context_put(&adreno_dev->drawctxt_active->base);
		adreno_dev->drawctxt_active = NULL;
	}

	/* Get a refcount to the new instance */
	if (drawctxt) {
		if (!_kgsl_context_get(&drawctxt->base))
			return -EINVAL;

		ret = kgsl_mmu_setstate(&device->mmu,
			drawctxt->base.proc_priv->pagetable,
			adreno_dev->drawctxt_active ?
			adreno_dev->drawctxt_active->base.id :
			KGSL_CONTEXT_INVALID);
		/* Set the new context */
		ret = adreno_context_restore(adreno_dev, drawctxt);
		if (ret) {
@@ -561,9 +554,11 @@ int adreno_drawctxt_switch(struct adreno_device *adreno_dev,
		 */
		ret = kgsl_mmu_setstate(&device->mmu,
					 device->mmu.defaultpagetable,
					 KGSL_CONTEXT_INVALID);
					adreno_dev->drawctxt_active->base.id);
	}

	/* Put the old instance of the active drawctxt */
	if (adreno_dev->drawctxt_active)
		kgsl_context_put(&adreno_dev->drawctxt_active->base);
	adreno_dev->drawctxt_active = drawctxt;
	return 0;
}