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

Commit 95d66d63 authored by Vinay Kalia's avatar Vinay Kalia
Browse files

msm: vidc: No need to power on venus for memory allocation/free



Video driver is not writing into any of the venus registers in
__smem_free and __smem_alloc functions. In these calls, it is
not interacting with firmware either. When video driver calls
into SMMU APIs SMMU driver enables the required clocks and
power. So, remove __power_on for these functions.

Change-Id: I0aac163b485cd0d6fe45ac21b0de06d89862c3a1
Signed-off-by: default avatarVinay Kalia <vkalia@codeaurora.org>
parent 81e1da90
Loading
Loading
Loading
Loading
+0 −35
Original line number Diff line number Diff line
@@ -4619,22 +4619,6 @@ int msm_comm_kill_session(struct msm_vidc_inst *inst)
	return rc;
}

static inline int power_on_for_smem(struct msm_vidc_inst *inst)
{
	struct hfi_device *hdev = NULL;
	int rc = 0;

	if (!inst || !inst->core || !inst->core->device) {
		dprintk(VIDC_ERR, "%s: invalid inst handle\n", __func__);
		return -EINVAL;
	}
	hdev = inst->core->device;
	rc = call_hfi_op(hdev, resume, hdev->hfi_device_data);
	if (rc)
		dprintk(VIDC_ERR, "%s: failed to power on fw\n", __func__);
	return rc;
}

struct msm_smem *msm_comm_smem_alloc(struct msm_vidc_inst *inst,
			size_t size, u32 align, u32 flags,
			enum hal_buffer buffer_type, int map_kernel)
@@ -4645,14 +4629,8 @@ struct msm_smem *msm_comm_smem_alloc(struct msm_vidc_inst *inst,
		dprintk(VIDC_ERR, "%s: invalid inst: %p\n", __func__, inst);
		return NULL;
	}
	mutex_lock(&inst->core->lock);
	if (power_on_for_smem(inst))
		goto err_power_on;

	m = msm_smem_alloc(inst->mem_client, size, align,
				flags, buffer_type, map_kernel);
err_power_on:
	mutex_unlock(&inst->core->lock);
	return m;
}

@@ -4663,14 +4641,7 @@ void msm_comm_smem_free(struct msm_vidc_inst *inst, struct msm_smem *mem)
			"%s: invalid params: %p %p\n", __func__, inst, mem);
		return;
	}
	mutex_lock(&inst->core->lock);
	if (inst->state != MSM_VIDC_CORE_INVALID) {
		if (power_on_for_smem(inst))
			goto err_power_on;
	}
	msm_smem_free(inst->mem_client, mem);
err_power_on:
	mutex_unlock(&inst->core->lock);
}

int msm_comm_smem_cache_operations(struct msm_vidc_inst *inst,
@@ -4700,14 +4671,8 @@ struct msm_smem *msm_comm_smem_user_to_kernel(struct msm_vidc_inst *inst,
		return NULL;
	}

	mutex_lock(&inst->core->lock);
	if (power_on_for_smem(inst))
		goto err_power_on;

	m = msm_smem_user_to_kernel(inst->mem_client,
			fd, offset, buffer_type);
err_power_on:
	mutex_unlock(&inst->core->lock);
	return m;
}

+0 −26
Original line number Diff line number Diff line
@@ -577,8 +577,6 @@ static int __smem_alloc(struct venus_hfi_device *dev, void *mem,
		return -EINVAL;
	}

	__power_on(dev);

	vmem = (struct vidc_mem_addr *)mem;
	dprintk(VIDC_INFO, "start to alloc size: %d, flags: %d\n", size, flags);

@@ -614,9 +612,6 @@ static void __smem_free(struct venus_hfi_device *dev, struct msm_smem *mem)
		return;
	}

	if (__power_on(dev))
		dprintk(VIDC_ERR, "%s: Power on failed\n", __func__);

	msm_smem_free(dev->hal_client, mem);
}

@@ -1583,26 +1578,6 @@ err_vote_buses:
	return rc;
}

static int venus_hfi_resume(void *dev)
{
	int rc = 0;
	struct venus_hfi_device *device = dev;
	if (!device) {
		dprintk(VIDC_ERR, "Invalid params: %p\n", device);
		return -EINVAL;
	}

	mutex_lock(&device->lock);

	rc = __power_on(device);
	if (rc)
		dprintk(VIDC_ERR, "%s: Failed to enable power\n", __func__);

	mutex_unlock(&device->lock);

	return rc;
}

static int __scale_clocks(struct venus_hfi_device *device, int load,
		int codecs_enabled)
{
@@ -4664,7 +4639,6 @@ static void venus_init_hfi_callbacks(struct hfi_device *hdev)
	hdev->resurrect_fw = venus_hfi_resurrect_fw;
	hdev->get_fw_info = venus_hfi_get_fw_info;
	hdev->get_core_capabilities = venus_hfi_get_core_capabilities;
	hdev->resume = venus_hfi_resume;
	hdev->suspend = venus_hfi_suspend;
	hdev->get_core_clock_rate = venus_hfi_get_core_clock_rate;
	hdev->get_default_properties = venus_hfi_get_default_properties;
+0 −1
Original line number Diff line number Diff line
@@ -1420,7 +1420,6 @@ struct hfi_device {
	int (*get_fw_info)(void *dev, enum fw_info info);
	int (*session_clean)(void *sess);
	int (*get_core_capabilities)(void *dev);
	int (*resume)(void *dev);
	int (*suspend)(void *dev);
	unsigned long (*get_core_clock_rate)(void *dev);
	enum hal_default_properties (*get_default_properties)(void *dev);