浏览代码

video: driver: remove skip delayed unmap functionality

Change-Id: Ibc3e8d565010aa5ac608aa648c533057c51f4bf4
Signed-off-by: Darshana Patil <[email protected]>
Darshana Patil 2 年之前
父节点
当前提交
3362c70642

+ 0 - 8
driver/vidc/inc/msm_vidc_driver.h

@@ -472,14 +472,6 @@ int msm_vidc_allocate_buffers(struct msm_vidc_inst *inst,
 	enum msm_vidc_buffer_type buf_type, u32 num_buffers);
 int msm_vidc_free_buffers(struct msm_vidc_inst *inst,
 	enum msm_vidc_buffer_type buf_type);
-int msm_vidc_unmap_driver_buf(struct msm_vidc_inst *inst,
-	struct msm_vidc_buffer *buf);
-int msm_vidc_map_driver_buf(struct msm_vidc_inst *inst,
-	struct msm_vidc_buffer *buf);
-int msm_vidc_get_delayed_unmap(struct msm_vidc_inst *inst,
-	struct msm_vidc_map *map);
-int msm_vidc_put_delayed_unmap(struct msm_vidc_inst *inst,
-	struct msm_vidc_map *map);
 void msm_vidc_update_stats(struct msm_vidc_inst *inst,
 	struct msm_vidc_buffer *buf, enum msm_vidc_debugfs_event etype);
 void msm_vidc_stats_handler(struct work_struct *work);

+ 0 - 1
driver/vidc/inc/msm_vidc_internal.h

@@ -853,7 +853,6 @@ struct msm_vidc_map {
 	u64                         device_addr;
 	struct sg_table            *table;
 	struct dma_buf_attachment  *attach;
-	u32                         skip_delayed_unmap:1;
 };
 
 struct msm_vidc_mappings {

+ 0 - 180
driver/vidc/src/msm_vidc_driver.c

@@ -2547,33 +2547,6 @@ int msm_vidc_process_readonly_buffers(struct msm_vidc_inst *inst,
 	return rc;
 }
 
-int msm_vidc_memory_unmap_completely(struct msm_vidc_inst *inst,
-	struct msm_vidc_map *map)
-{
-	int rc = 0;
-
-	if (!inst || !map) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
-	if (!map->refcount)
-		return 0;
-
-	while (map->refcount) {
-		rc = msm_vidc_memory_unmap(inst->core, map);
-		if (rc)
-			break;
-		if (!map->refcount) {
-			msm_vidc_memory_put_dmabuf(inst, map->dmabuf);
-			list_del(&map->list);
-			msm_memory_pool_free(inst, map);
-			break;
-		}
-	}
-	return rc;
-}
-
 int msm_vidc_set_auto_framerate(struct msm_vidc_inst *inst, u64 timestamp)
 {
 	struct msm_vidc_core *core;
@@ -2978,159 +2951,6 @@ int msm_vidc_ts_reorder_flush(struct msm_vidc_inst *inst)
 	return 0;
 }
 
-int msm_vidc_get_delayed_unmap(struct msm_vidc_inst *inst, struct msm_vidc_map *map)
-{
-	int rc = 0;
-
-	if (!inst || !map) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
-	rc = msm_vidc_memory_map(inst->core, map);
-	if (rc)
-		return rc;
-	map->skip_delayed_unmap = 1;
-
-	return 0;
-}
-
-int msm_vidc_put_delayed_unmap(struct msm_vidc_inst *inst, struct msm_vidc_map *map)
-{
-	int rc = 0;
-
-	if (!inst || !map) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
-	if (!map->skip_delayed_unmap) {
-		i_vpr_e(inst, "%s: no delayed unmap, addr %#llx\n",
-			__func__, map->device_addr);
-		return -EINVAL;
-	}
-
-	map->skip_delayed_unmap = 0;
-	rc = msm_vidc_memory_unmap(inst->core, map);
-	if (rc)
-		i_vpr_e(inst, "%s: unmap failed\n", __func__);
-
-	return rc;
-}
-
-int msm_vidc_unmap_driver_buf(struct msm_vidc_inst *inst,
-	struct msm_vidc_buffer *buf)
-{
-	int rc = 0;
-	struct msm_vidc_mappings *mappings;
-	struct msm_vidc_map *map = NULL;
-	bool found = false;
-
-	if (!inst || !buf) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
-	mappings = msm_vidc_get_mappings(inst, buf->type, __func__);
-	if (!mappings)
-		return -EINVAL;
-
-	/* sanity check to see if it was not removed */
-	list_for_each_entry(map, &mappings->list, list) {
-		if (map->dmabuf == buf->dmabuf) {
-			found = true;
-			break;
-		}
-	}
-	if (!found) {
-		print_vidc_buffer(VIDC_ERR, "err ", "no buf in mappings", inst, buf);
-		return -EINVAL;
-	}
-
-	rc = msm_vidc_memory_unmap(inst->core, map);
-	if (rc) {
-		print_vidc_buffer(VIDC_ERR, "err ", "unmap failed", inst, buf);
-		return -EINVAL;
-	}
-
-	/* finally delete if refcount is zero */
-	if (!map->refcount) {
-		msm_vidc_memory_put_dmabuf(inst, map->dmabuf);
-		list_del(&map->list);
-		msm_memory_pool_free(inst, map);
-	}
-
-	return rc;
-}
-
-int msm_vidc_map_driver_buf(struct msm_vidc_inst *inst,
-	struct msm_vidc_buffer *buf)
-{
-	int rc = 0;
-	struct msm_vidc_mappings *mappings;
-	struct msm_vidc_map *map;
-	bool found = false;
-
-	if (!inst || !buf) {
-		d_vpr_e("%s: invalid params\n", __func__);
-		return -EINVAL;
-	}
-
-	mappings = msm_vidc_get_mappings(inst, buf->type, __func__);
-	if (!mappings)
-		return -EINVAL;
-
-	/*
-	 * new buffer: map twice for delayed unmap feature sake
-	 * existing buffer: map once
-	 */
-	list_for_each_entry(map, &mappings->list, list) {
-		if (map->dmabuf == buf->dmabuf) {
-			found = true;
-			break;
-		}
-	}
-	if (!found) {
-		/* new buffer case */
-		map = msm_memory_pool_alloc(inst, MSM_MEM_POOL_MAP);
-		if (!map) {
-			i_vpr_e(inst, "%s: alloc failed\n", __func__);
-			return -ENOMEM;
-		}
-		INIT_LIST_HEAD(&map->list);
-		list_add_tail(&map->list, &mappings->list);
-		map->type = buf->type;
-		map->dmabuf = msm_vidc_memory_get_dmabuf(inst, buf->fd);
-		if (!map->dmabuf) {
-			rc = -EINVAL;
-			goto error;
-		}
-		map->region = msm_vidc_get_buffer_region(inst, buf->type, __func__);
-		/* delayed unmap feature needed for decoder output buffers */
-		if (is_decode_session(inst) && is_output_buffer(buf->type)) {
-			rc = msm_vidc_get_delayed_unmap(inst, map);
-			if (rc)
-				goto error;
-		}
-	}
-	rc = msm_vidc_memory_map(inst->core, map);
-	if (rc)
-		goto error;
-
-	buf->device_addr = map->device_addr;
-
-	return 0;
-error:
-	if (!found) {
-		if (is_decode_session(inst) && is_output_buffer(buf->type))
-			msm_vidc_put_delayed_unmap(inst, map);
-		msm_vidc_memory_put_dmabuf(inst, map->dmabuf);
-		list_del_init(&map->list);
-		msm_memory_pool_free(inst, map);
-	}
-	return rc;
-}
-
 struct msm_vidc_buffer *msm_vidc_get_driver_buf(struct msm_vidc_inst *inst,
 	struct vb2_buffer *vb2)
 {

+ 5 - 7
driver/vidc/src/msm_vidc_memory.c

@@ -215,13 +215,11 @@ int msm_vidc_memory_map(struct msm_vidc_core *core, struct msm_vidc_map *map)
 		goto error_attach;
 	}
 
-	if (!map->skip_delayed_unmap) {
-		/*
-		 * Get the scatterlist for the given attachment
-		 * Mapping of sg is taken care by map attachment
-		 */
-		attach->dma_map_attrs |= DMA_ATTR_DELAYED_UNMAP;
-	}
+	/*
+	 * Get the scatterlist for the given attachment
+	 * Mapping of sg is taken care by map attachment
+	 */
+	attach->dma_map_attrs |= DMA_ATTR_DELAYED_UNMAP;
 
 	/*
 	 * We do not need dma_map function to perform cache operations