Merge "video: driver: misc changes to be inline with upstream"

This commit is contained in:
qctecmdr
2022-11-09 21:54:22 -08:00
committed by Gerrit - the friendly Code Review server
4 changed files with 11 additions and 17 deletions

View File

@@ -4277,8 +4277,7 @@ int msm_vidc_remove_session(struct msm_vidc_inst *inst)
core_lock(core, __func__); core_lock(core, __func__);
list_for_each_entry_safe(i, temp, &core->instances, list) { list_for_each_entry_safe(i, temp, &core->instances, list) {
if (i->session_id == inst->session_id) { if (i->session_id == inst->session_id) {
list_del_init(&i->list); list_move_tail(&i->list, &core->dangling_instances);
list_add_tail(&i->list, &core->dangling_instances);
i_vpr_h(inst, "%s: removed session %#x\n", i_vpr_h(inst, "%s: removed session %#x\n",
__func__, i->session_id); __func__, i->session_id);
} }
@@ -4844,8 +4843,7 @@ int msm_vidc_core_deinit_locked(struct msm_vidc_core *core, bool force)
/* unlink all sessions from core, if any */ /* unlink all sessions from core, if any */
list_for_each_entry_safe(inst, dummy, &core->instances, list) { list_for_each_entry_safe(inst, dummy, &core->instances, list) {
msm_vidc_change_state(inst, MSM_VIDC_ERROR, __func__); msm_vidc_change_state(inst, MSM_VIDC_ERROR, __func__);
list_del_init(&inst->list); list_move_tail(&inst->list, &core->dangling_instances);
list_add_tail(&inst->list, &core->dangling_instances);
} }
msm_vidc_change_core_state(core, MSM_VIDC_CORE_DEINIT, __func__); msm_vidc_change_core_state(core, MSM_VIDC_CORE_DEINIT, __func__);

View File

@@ -79,14 +79,13 @@ void *msm_vidc_pool_alloc(struct msm_vidc_inst *inst, enum msm_memory_pool_type
/* get 1st node from free pool */ /* get 1st node from free pool */
hdr = list_first_entry(&pool->free_pool, hdr = list_first_entry(&pool->free_pool,
struct msm_memory_alloc_header, list); struct msm_memory_alloc_header, list);
list_del_init(&hdr->list);
/* move node from free pool to busy pool */
list_move_tail(&hdr->list, &pool->busy_pool);
/* reset existing data */ /* reset existing data */
memset((char *)hdr->buf, 0, pool->size); memset((char *)hdr->buf, 0, pool->size);
/* add to busy pool */
list_add_tail(&hdr->list, &pool->busy_pool);
/* set busy flag to true. This is to catch double free request */ /* set busy flag to true. This is to catch double free request */
hdr->busy = true; hdr->busy = true;
@@ -138,11 +137,8 @@ void msm_vidc_pool_free(struct msm_vidc_inst *inst, void *vidc_buf)
} }
hdr->busy = false; hdr->busy = false;
/* remove from busy pool */ /* move node from busy pool to free pool */
list_del_init(&hdr->list); list_move_tail(&hdr->list, &pool->free_pool);
/* add to free pool */
list_add_tail(&hdr->list, &pool->free_pool);
} }
static void msm_vidc_destroy_pool_buffers(struct msm_vidc_inst *inst, static void msm_vidc_destroy_pool_buffers(struct msm_vidc_inst *inst,
@@ -454,7 +450,7 @@ static int msm_vidc_memory_map(struct msm_vidc_core *core, struct msm_vidc_map *
goto error_table; goto error_table;
} }
map->device_addr = table->sgl->dma_address; map->device_addr = sg_dma_address(table->sgl);
map->table = table; map->table = table;
map->attach = attach; map->attach = attach;
map->refcount++; map->refcount++;
@@ -544,4 +540,4 @@ static struct msm_vidc_memory_ops msm_mem_ops = {
struct msm_vidc_memory_ops *get_mem_ops(void) struct msm_vidc_memory_ops *get_mem_ops(void)
{ {
return &msm_mem_ops; return &msm_mem_ops;
} }

View File

@@ -279,7 +279,7 @@ static int msm_vidc_memory_map_ext(struct msm_vidc_core *core, struct msm_vidc_m
goto error_table; goto error_table;
} }
map->device_addr = table->sgl->dma_address; map->device_addr = sg_dma_address(table->sgl);
map->table = table; map->table = table;
map->attach = attach; map->attach = attach;
map->refcount++; map->refcount++;

View File

@@ -185,7 +185,7 @@ int msm_vb2_map_dmabuf(void *buf_priv)
rc = -ENOMEM; rc = -ENOMEM;
goto exit; goto exit;
} }
buf->device_addr = buf->sg_table->sgl->dma_address; buf->device_addr = sg_dma_address(buf->sg_table->sgl);
print_vidc_buffer(VIDC_HIGH, "high", "map", inst, buf); print_vidc_buffer(VIDC_HIGH, "high", "map", inst, buf);
exit: exit: