|
@@ -2008,7 +2008,7 @@ int msm_vidc_memory_unmap_completely(struct msm_vidc_inst *inst,
|
|
if (rc)
|
|
if (rc)
|
|
break;
|
|
break;
|
|
if (!map->refcount) {
|
|
if (!map->refcount) {
|
|
- msm_vidc_memory_put_dmabuf(map->dmabuf);
|
|
|
|
|
|
+ msm_vidc_memory_put_dmabuf(inst, map->dmabuf);
|
|
list_del(&map->list);
|
|
list_del(&map->list);
|
|
msm_memory_free(inst, MSM_MEM_POOL_MAP, map);
|
|
msm_memory_free(inst, MSM_MEM_POOL_MAP, map);
|
|
break;
|
|
break;
|
|
@@ -2266,7 +2266,7 @@ int msm_vidc_put_delayed_unmap(struct msm_vidc_inst *inst, struct msm_vidc_map *
|
|
i_vpr_e(inst, "%s: unmap failed\n", __func__);
|
|
i_vpr_e(inst, "%s: unmap failed\n", __func__);
|
|
|
|
|
|
if (!map->refcount) {
|
|
if (!map->refcount) {
|
|
- msm_vidc_memory_put_dmabuf(map->dmabuf);
|
|
|
|
|
|
+ msm_vidc_memory_put_dmabuf(inst, map->dmabuf);
|
|
list_del(&map->list);
|
|
list_del(&map->list);
|
|
msm_memory_free(inst, MSM_MEM_POOL_MAP, map);
|
|
msm_memory_free(inst, MSM_MEM_POOL_MAP, map);
|
|
}
|
|
}
|
|
@@ -2334,7 +2334,7 @@ int msm_vidc_unmap_driver_buf(struct msm_vidc_inst *inst,
|
|
|
|
|
|
/* finally delete if refcount is zero */
|
|
/* finally delete if refcount is zero */
|
|
if (!map->refcount) {
|
|
if (!map->refcount) {
|
|
- msm_vidc_memory_put_dmabuf(map->dmabuf);
|
|
|
|
|
|
+ msm_vidc_memory_put_dmabuf(inst, map->dmabuf);
|
|
list_del(&map->list);
|
|
list_del(&map->list);
|
|
msm_memory_free(inst, MSM_MEM_POOL_MAP, map);
|
|
msm_memory_free(inst, MSM_MEM_POOL_MAP, map);
|
|
}
|
|
}
|
|
@@ -2378,7 +2378,7 @@ int msm_vidc_map_driver_buf(struct msm_vidc_inst *inst,
|
|
}
|
|
}
|
|
INIT_LIST_HEAD(&map->list);
|
|
INIT_LIST_HEAD(&map->list);
|
|
map->type = buf->type;
|
|
map->type = buf->type;
|
|
- map->dmabuf = msm_vidc_memory_get_dmabuf(buf->fd);
|
|
|
|
|
|
+ map->dmabuf = msm_vidc_memory_get_dmabuf(inst, buf->fd);
|
|
if (!map->dmabuf)
|
|
if (!map->dmabuf)
|
|
return -EINVAL;
|
|
return -EINVAL;
|
|
map->region = msm_vidc_get_buffer_region(inst, buf->type, __func__);
|
|
map->region = msm_vidc_get_buffer_region(inst, buf->type, __func__);
|
|
@@ -2386,7 +2386,7 @@ int msm_vidc_map_driver_buf(struct msm_vidc_inst *inst,
|
|
if (is_decode_session(inst) && is_output_buffer(buf->type)) {
|
|
if (is_decode_session(inst) && is_output_buffer(buf->type)) {
|
|
rc = msm_vidc_get_delayed_unmap(inst, map);
|
|
rc = msm_vidc_get_delayed_unmap(inst, map);
|
|
if (rc) {
|
|
if (rc) {
|
|
- msm_vidc_memory_put_dmabuf(map->dmabuf);
|
|
|
|
|
|
+ msm_vidc_memory_put_dmabuf(inst, map->dmabuf);
|
|
msm_memory_free(inst, MSM_MEM_POOL_MAP, map);
|
|
msm_memory_free(inst, MSM_MEM_POOL_MAP, map);
|
|
return rc;
|
|
return rc;
|
|
}
|
|
}
|
|
@@ -2414,7 +2414,7 @@ int msm_vidc_put_driver_buf(struct msm_vidc_inst *inst,
|
|
|
|
|
|
msm_vidc_unmap_driver_buf(inst, buf);
|
|
msm_vidc_unmap_driver_buf(inst, buf);
|
|
|
|
|
|
- msm_vidc_memory_put_dmabuf(buf->dmabuf);
|
|
|
|
|
|
+ msm_vidc_memory_put_dmabuf(inst, buf->dmabuf);
|
|
|
|
|
|
/* delete the buffer from buffers->list */
|
|
/* delete the buffer from buffers->list */
|
|
list_del(&buf->list);
|
|
list_del(&buf->list);
|
|
@@ -2456,7 +2456,7 @@ struct msm_vidc_buffer *msm_vidc_get_driver_buf(struct msm_vidc_inst *inst,
|
|
if (rc)
|
|
if (rc)
|
|
goto error;
|
|
goto error;
|
|
|
|
|
|
- buf->dmabuf = msm_vidc_memory_get_dmabuf(buf->fd);
|
|
|
|
|
|
+ buf->dmabuf = msm_vidc_memory_get_dmabuf(inst, buf->fd);
|
|
if (!buf->dmabuf)
|
|
if (!buf->dmabuf)
|
|
goto error;
|
|
goto error;
|
|
|
|
|
|
@@ -2470,7 +2470,7 @@ struct msm_vidc_buffer *msm_vidc_get_driver_buf(struct msm_vidc_inst *inst,
|
|
return buf;
|
|
return buf;
|
|
|
|
|
|
error:
|
|
error:
|
|
- msm_vidc_memory_put_dmabuf(buf->dmabuf);
|
|
|
|
|
|
+ msm_vidc_memory_put_dmabuf(inst, buf->dmabuf);
|
|
list_del(&buf->list);
|
|
list_del(&buf->list);
|
|
msm_memory_free(inst, MSM_MEM_POOL_BUFFER, buf);
|
|
msm_memory_free(inst, MSM_MEM_POOL_BUFFER, buf);
|
|
return NULL;
|
|
return NULL;
|
|
@@ -4545,6 +4545,7 @@ void msm_vidc_destroy_buffers(struct msm_vidc_inst *inst)
|
|
struct msm_vidc_buffers *buffers;
|
|
struct msm_vidc_buffers *buffers;
|
|
struct msm_vidc_buffer *buf, *dummy;
|
|
struct msm_vidc_buffer *buf, *dummy;
|
|
struct msm_vidc_timestamp *ts, *dummy_ts;
|
|
struct msm_vidc_timestamp *ts, *dummy_ts;
|
|
|
|
+ struct msm_memory_dmabuf *dbuf, *dummy_dbuf;
|
|
struct response_work *work, *dummy_work = NULL;
|
|
struct response_work *work, *dummy_work = NULL;
|
|
static const enum msm_vidc_buffer_type ext_buf_types[] = {
|
|
static const enum msm_vidc_buffer_type ext_buf_types[] = {
|
|
MSM_VIDC_BUF_INPUT,
|
|
MSM_VIDC_BUF_INPUT,
|
|
@@ -4614,6 +4615,12 @@ void msm_vidc_destroy_buffers(struct msm_vidc_inst *inst)
|
|
msm_memory_free(inst, MSM_MEM_POOL_TIMESTAMP, ts);
|
|
msm_memory_free(inst, MSM_MEM_POOL_TIMESTAMP, ts);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ list_for_each_entry_safe(dbuf, dummy_dbuf, &inst->dmabuf_tracker, list) {
|
|
|
|
+ i_vpr_e(inst, "%s: removing dma_buf %#x, refcount %u\n",
|
|
|
|
+ __func__, dbuf->dmabuf, dbuf->refcount);
|
|
|
|
+ msm_vidc_memory_put_dmabuf_completely(inst, dbuf);
|
|
|
|
+ }
|
|
|
|
+
|
|
list_for_each_entry_safe(work, dummy_work, &inst->response_works, list) {
|
|
list_for_each_entry_safe(work, dummy_work, &inst->response_works, list) {
|
|
list_del(&work->list);
|
|
list_del(&work->list);
|
|
kfree(work->data);
|
|
kfree(work->data);
|