video: driver: handle release during batching
Before output buffer is queued to FW, checking if it is pending release and refcount accordingly. The check needs to be added just before queueing to FW to handle batch usecase as well. Change-Id: I2d394b5642ed8fa916e86ebc59ea414300415fab Signed-off-by: Darshana Patil <darshana@codeaurora.org>
This commit is contained in:
@@ -2159,7 +2159,6 @@ 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) {
|
||||
@@ -2212,16 +2211,6 @@ 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;
|
||||
}
|
||||
|
||||
@@ -2492,8 +2481,10 @@ exit:
|
||||
|
||||
static int msm_vidc_queue_buffer(struct msm_vidc_inst *inst, struct msm_vidc_buffer *buf)
|
||||
{
|
||||
struct msm_vidc_buffer *meta;
|
||||
struct msm_vidc_buffer *meta, *rel_buf;
|
||||
struct msm_vidc_map *map;
|
||||
int rc = 0;
|
||||
bool found = false;
|
||||
|
||||
if (!inst || !buf || !inst->capabilities) {
|
||||
d_vpr_e("%s: invalid params\n", __func__);
|
||||
@@ -2510,6 +2501,28 @@ 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);
|
||||
|
Reference in New Issue
Block a user