static u32 vid_dec_free_buffer(struct video_client_ctx *client_ctx, struct vdec_setbuffer_cmd *buffer_info) { enum vcd_buffer_type buffer_type = VCD_BUFFER_INPUT; enum buffer_dir dir_buffer = BUFFER_TYPE_INPUT; u32 vcd_status = VCD_ERR_FAIL; unsigned long kernel_vaddr; if (!client_ctx || !buffer_info) return FALSE; if (buffer_info->buffer_type == VDEC_BUFFER_TYPE_OUTPUT) { dir_buffer = BUFFER_TYPE_OUTPUT; buffer_type = VCD_BUFFER_OUTPUT; } if (!vidc_delete_addr_table(client_ctx, dir_buffer, (unsigned long)buffer_info->buffer.bufferaddr, &kernel_vaddr)) { DBG("%s() : user_virt_addr = %p has not been set.", __func__, buffer_info->buffer.bufferaddr); return TRUE; } vcd_status = vcd_free_buffer(client_ctx->vcd_handle, buffer_type, (u8 *)kernel_vaddr); if (!vcd_status) return TRUE; else return FALSE; }
u32 vid_enc_free_buffer(struct video_client_ctx *client_ctx, struct venc_bufferpayload *buffer_info, enum venc_buffer_dir buffer_type) { enum vcd_buffer_type buffer_vcd_type = VCD_BUFFER_INPUT; enum buffer_dir dir_buffer = BUFFER_TYPE_INPUT; u32 vcd_status = VCD_ERR_FAIL; unsigned long kernel_vaddr; if (!client_ctx || !buffer_info) return FALSE; if (buffer_type == VEN_BUFFER_TYPE_OUTPUT) { dir_buffer = BUFFER_TYPE_OUTPUT; buffer_vcd_type = VCD_BUFFER_OUTPUT; } /*If buffer NOT set, ignore */ if (!vid_c_delete_addr_table(client_ctx, dir_buffer, (unsigned long)buffer_info->pbuffer, &kernel_vaddr)) { DBG("%s() : user_virt_addr = %p has not been set.", __func__, buffer_info->pbuffer); return TRUE; } vcd_status = vcd_free_buffer(client_ctx->vcd_handle, buffer_vcd_type, (u8 *)kernel_vaddr); if (!vcd_status) return TRUE; else return FALSE; }
static u32 vid_dec_free_buffer(struct video_client_ctx *client_ctx, struct vdec_setbuffer_cmd *buffer_info) { enum vcd_buffer_type buffer_type; enum buffer_dir dir_buffer = BUFFER_TYPE_INPUT; u32 vcd_status = VCD_ERR_FAIL; unsigned long user_vaddr, kernel_vaddr, phy_addr; int pmem_fd; struct file *file; s32 buffer_index = -1; if (!client_ctx || !buffer_info) return FALSE; user_vaddr = (unsigned long)buffer_info->buffer.bufferaddr; if (buffer_info->buffer_type == VDEC_BUFFER_TYPE_OUTPUT) dir_buffer = BUFFER_TYPE_OUTPUT; /*If buffer already set, ignore */ if (!vid_c_lookup_addr_table(client_ctx, dir_buffer, TRUE, &user_vaddr, &kernel_vaddr, &phy_addr, &pmem_fd, &file, &buffer_index)) { DBG("%s() : user_virt_addr = 0x%08lx is alreday set.", __func__, user_vaddr); return TRUE; } if (buffer_info->buffer_type == VDEC_BUFFER_TYPE_INPUT) buffer_type = VCD_BUFFER_INPUT; else buffer_type = VCD_BUFFER_OUTPUT; vcd_status = vcd_free_buffer(client_ctx->vcd_handle, buffer_type, (u8 *)kernel_vaddr); if (!vcd_status) return TRUE; else return FALSE; }