
提交者
Gerrit - the friendly Code Review server

父節點
6b20be1d9b
當前提交
abe44a0089
@@ -2161,6 +2161,7 @@ int msm_vidc_map_driver_buf(struct msm_vidc_inst *inst,
|
||||
int rc = 0;
|
||||
struct msm_vidc_mappings *mappings;
|
||||
struct msm_vidc_map *map;
|
||||
struct msm_vidc_buffer *rel_buf;
|
||||
bool found = false;
|
||||
|
||||
if (!inst || !buf) {
|
||||
@@ -2213,6 +2214,16 @@ int msm_vidc_map_driver_buf(struct msm_vidc_inst *inst,
|
||||
|
||||
buf->device_addr = map->device_addr;
|
||||
|
||||
/* increment map ref_count, if buf already present in release list */
|
||||
list_for_each_entry(rel_buf, &inst->buffers.release.list, list) {
|
||||
if (rel_buf->device_addr == buf->device_addr) {
|
||||
rc = msm_vidc_memory_map(inst->core, map);
|
||||
if (rc)
|
||||
return rc;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -2483,10 +2494,8 @@ exit:
|
||||
|
||||
static int msm_vidc_queue_buffer(struct msm_vidc_inst *inst, struct msm_vidc_buffer *buf)
|
||||
{
|
||||
struct msm_vidc_buffer *meta, *rel_buf;
|
||||
struct msm_vidc_map *map;
|
||||
struct msm_vidc_buffer *meta;
|
||||
int rc = 0;
|
||||
bool found = false;
|
||||
|
||||
if (!inst || !buf || !inst->capabilities) {
|
||||
d_vpr_e("%s: invalid params\n", __func__);
|
||||
@@ -2503,28 +2512,6 @@ static int msm_vidc_queue_buffer(struct msm_vidc_inst *inst, struct msm_vidc_buf
|
||||
rc = msm_vidc_process_readonly_buffers(inst, buf);
|
||||
if (rc)
|
||||
return rc;
|
||||
|
||||
list_for_each_entry(map, &inst->mappings.output.list, list) {
|
||||
if (map->dmabuf == buf->dmabuf) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!found) {
|
||||
print_vidc_buffer(VIDC_ERR, "err ", "missing map", inst, buf);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
/* increment map ref_count, if buf already present in release list */
|
||||
list_for_each_entry(rel_buf, &inst->buffers.release.list, list) {
|
||||
if (rel_buf->device_addr == buf->device_addr) {
|
||||
rc = msm_vidc_memory_map(inst->core, map);
|
||||
if (rc)
|
||||
return rc;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
print_vidc_buffer(VIDC_HIGH, "high", "qbuf", inst, buf);
|
||||
|
@@ -98,7 +98,7 @@ int msm_vidc_memory_map(struct msm_vidc_core *core, struct msm_vidc_map *map)
|
||||
|
||||
if (map->refcount) {
|
||||
map->refcount++;
|
||||
goto exit;
|
||||
return 0;
|
||||
}
|
||||
|
||||
cb = get_context_bank(core, map->region);
|
||||
@@ -153,11 +153,12 @@ int msm_vidc_memory_map(struct msm_vidc_core *core, struct msm_vidc_map *map)
|
||||
map->attach = attach;
|
||||
map->refcount++;
|
||||
|
||||
exit:
|
||||
d_vpr_l(
|
||||
"%s: type %11s, device_addr %#x, refcount %d, region %d\n",
|
||||
__func__, buf_name(map->type), map->device_addr, map->refcount, map->region);
|
||||
|
||||
return 0;
|
||||
|
||||
error_sg:
|
||||
dma_buf_unmap_attachment(attach, table, DMA_BIDIRECTIONAL);
|
||||
error_table:
|
||||
@@ -184,13 +185,13 @@ int msm_vidc_memory_unmap(struct msm_vidc_core *core,
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (map->refcount)
|
||||
goto exit;
|
||||
|
||||
d_vpr_l(
|
||||
"%s: type %11s, device_addr %#x, refcount %d, region %d\n",
|
||||
__func__, buf_name(map->type), map->device_addr, map->refcount, map->region);
|
||||
|
||||
if (map->refcount)
|
||||
goto exit;
|
||||
|
||||
dma_buf_unmap_attachment(map->attach, map->table, DMA_BIDIRECTIONAL);
|
||||
dma_buf_detach(map->dmabuf, map->attach);
|
||||
|
||||
|
新增問題並參考
封鎖使用者