Loading drivers/media/platform/msm/vidc/msm_smem.c +12 −5 Original line number Diff line number Diff line Loading @@ -173,8 +173,10 @@ static int ion_user_to_kernel(struct smem_client *client, int fd, u32 offset, mem->smem_priv = hndl; mem->device_addr = iova; mem->size = buffer_size; dprintk(VIDC_DBG, "NOTE: Buffer device address: 0x%lx, size: %d\n", mem->device_addr, mem->size); dprintk(VIDC_DBG, "%s: ion_handle = 0x%p, fd = %d, device_addr = 0x%x, size = %d, kvaddr = 0x%p, buffer_type = %d\n", __func__, mem->smem_priv, fd, (u32)mem->device_addr, mem->size, mem->kvaddr, mem->buffer_type); return rc; fail_device_address: ion_free(client->clnt, hndl); Loading Loading @@ -243,10 +245,11 @@ static int alloc_ion_mem(struct smem_client *client, size_t size, u32 align, goto fail_device_address; } mem->device_addr = iova; dprintk(VIDC_DBG, "device_address = 0x%lx, kvaddr = 0x%p, size = %d\n", mem->device_addr, mem->kvaddr, size); mem->size = size; dprintk(VIDC_DBG, "%s: ion_handle = 0x%p, device_addr = 0x%x, size = %d, kvaddr = 0x%p, buffer_type = %d\n", __func__, mem->smem_priv, (u32)mem->device_addr, mem->size, mem->kvaddr, mem->buffer_type); return rc; fail_device_address: ion_unmap_kernel(client->clnt, hndl); Loading @@ -260,6 +263,10 @@ static void free_ion_mem(struct smem_client *client, struct msm_smem *mem) { int domain, partition, rc; dprintk(VIDC_DBG, "%s: ion_handle = 0x%p, device_addr = 0x%x, size = %d, kvaddr = 0x%p, buffer_type = %d\n", __func__, mem->smem_priv, (u32)mem->device_addr, mem->size, mem->kvaddr, mem->buffer_type); rc = msm_smem_get_domain_partition((void *)client, mem->flags, mem->buffer_type, &domain, &partition); if (rc) { Loading drivers/media/platform/msm/vidc/msm_vidc.c +21 −13 Original line number Diff line number Diff line Loading @@ -506,6 +506,7 @@ int map_and_register_buf(struct msm_vidc_inst *inst, struct v4l2_buffer *b) temp->handle[plane]->device_addr + binfo->buff_off[i]; b->m.planes[i].m.userptr = binfo->device_addr[i]; binfo->mapped[i] = false; binfo->handle[i] = temp->handle[i]; } else { if (inst->map_output_buffer) { binfo->handle[i] = Loading @@ -515,9 +516,6 @@ int map_and_register_buf(struct msm_vidc_inst *inst, struct v4l2_buffer *b) rc = -EINVAL; goto exit; } dprintk(VIDC_DBG, "[MAP] - mapped handle[%d] = %p fd[%d] = %d", i, binfo->handle[i], i, binfo->fd[i]); binfo->mapped[i] = true; binfo->device_addr[i] = binfo->handle[i]->device_addr + Loading @@ -528,10 +526,6 @@ int map_and_register_buf(struct msm_vidc_inst *inst, struct v4l2_buffer *b) binfo->device_addr[i] = b->m.planes[i].m.userptr; } dprintk(VIDC_DBG, "Registering buffer: %d, %d, %d\n", b->m.planes[i].reserved[0], b->m.planes[i].reserved[1], b->m.planes[i].length); } /* We maintain one ref count for all planes*/ if ((i == 0) && is_dynamic_output_buffer_mode(b, inst)) { Loading @@ -539,8 +533,12 @@ int map_and_register_buf(struct msm_vidc_inst *inst, struct v4l2_buffer *b) if (rc < 0) return rc; } dprintk(VIDC_DBG, "%s: [MAP] binfo = %p, handle[%d] = %p, device_addr = 0x%x, fd = %d, offset = %d, mapped = %d\n", __func__, binfo, i, binfo->handle[i], binfo->device_addr[i], binfo->fd[i], binfo->buff_off[i], binfo->mapped[i]); } dprintk(VIDC_DBG, "[MAP] Adding binfo = %p to list\n", binfo); mutex_lock(&inst->lock); list_add_tail(&binfo->list, &inst->registered_bufs); mutex_unlock(&inst->lock); Loading Loading @@ -587,6 +585,11 @@ int unmap_and_deregister_buf(struct msm_vidc_inst *inst, goto exit; for (i = 0; i < temp->num_planes; i++) { dprintk(VIDC_DBG, "%s: [UNMAP] binfo = %p, handle[%d] = %p, device_addr = 0x%x, fd = %d, offset = %d, mapped = %d\n", __func__, temp, i, temp->handle[i], temp->device_addr[i], temp->fd[i], temp->buff_off[i], temp->mapped[i]); /* * Unmap the handle only if the buffer has been mapped and no * other buffer has a reference to this buffer. Loading @@ -598,9 +601,6 @@ int unmap_and_deregister_buf(struct msm_vidc_inst *inst, */ if (temp->handle[i] && temp->mapped[i] && !temp->same_fd_ref[i]) { dprintk(VIDC_DBG, "[UNMAP] - handle[%d] = %p fd[%d] = %d", i, temp->handle[i], i, temp->fd[i]); msm_comm_smem_free(inst, temp->handle[i]); } Loading Loading @@ -685,7 +685,8 @@ int output_buffer_cache_invalidate(struct msm_vidc_inst *inst, __func__, rc); return -EINVAL; } } } else dprintk(VIDC_ERR, "%s: WARN: NULL handle", __func__); } return 0; } Loading Loading @@ -760,12 +761,19 @@ int msm_vidc_release_buffers(void *instance, int buffer_type) buffer_info.m.planes[0].reserved[0], buffer_info.m.planes[0].reserved[1], buffer_info.m.planes[0].length); list_del(&bi->list); for (i = 0; i < bi->num_planes; i++) { if (bi->handle[i]) if (bi->handle[i] && bi->mapped[i]) { dprintk(VIDC_DBG, "%s: [UNMAP] binfo = %p, handle[%d] = %p, device_addr = 0x%x, fd = %d, offset = %d, mapped = %d\n", __func__, bi, i, bi->handle[i], bi->device_addr[i], bi->fd[i], bi->buff_off[i], bi->mapped[i]); msm_comm_smem_free(inst, bi->handle[i]); } } kfree(bi); } } Loading drivers/media/platform/msm/vidc/msm_vidc_common.c +27 −18 Original line number Diff line number Diff line Loading @@ -953,6 +953,12 @@ static void handle_ebd(enum command_response cmd, void *data) "Failed: Start code not found\n"); } } dprintk(VIDC_DBG, "Got ebd from hal: device_addr: 0x%x, alloc: %d, status: 0x%x, pic_type: 0x%x, flags: 0x%x\n", (u32)empty_buf_done->packet_buffer, empty_buf_done->alloc_len, empty_buf_done->status, empty_buf_done->picture_type, empty_buf_done->flags); mutex_lock(&inst->bufq[OUTPUT_PORT].lock); vb2_buffer_done(vb, VB2_BUF_STATE_DONE); mutex_unlock(&inst->bufq[OUTPUT_PORT].lock); Loading Loading @@ -1112,6 +1118,7 @@ static void handle_fbd(enum command_response cmd, void *data) struct vidc_hal_fbd *fill_buf_done; enum hal_buffer buffer_type; int extra_idx = 0; int64_t time_usec = 0; if (!response) { dprintk(VIDC_ERR, "Invalid response from vidc_hal\n"); Loading Loading @@ -1151,7 +1158,7 @@ static void handle_fbd(enum command_response cmd, void *data) if (!(fill_buf_done->flags1 & HAL_BUFFERFLAG_TIMESTAMPINVALID) && fill_buf_done->filled_len1) { int64_t time_usec = fill_buf_done->timestamp_hi; time_usec = fill_buf_done->timestamp_hi; time_usec = (time_usec << 32) | fill_buf_done->timestamp_lo; vb->v4l2_buf.timestamp = Loading Loading @@ -1218,10 +1225,6 @@ static void handle_fbd(enum command_response cmd, void *data) msm_vidc_debugfs_update(inst, MSM_VIDC_DEBUGFS_EVENT_FBD); dprintk(VIDC_DBG, "Filled length = %d; offset = %d; flags %x\n", vb->v4l2_planes[0].bytesused, vb->v4l2_planes[0].data_offset, vb->v4l2_buf.flags); if (extra_idx && (extra_idx < VIDEO_MAX_PLANES)) { dprintk(VIDC_DBG, "extradata: userptr = %p;" Loading @@ -1230,6 +1233,14 @@ static void handle_fbd(enum command_response cmd, void *data) vb->v4l2_planes[extra_idx].bytesused, vb->v4l2_planes[extra_idx].length); } dprintk(VIDC_DBG, "Got fbd from hal: device_addr: 0x%x, alloc: %d, filled: %d, offset: %d, ts: %lld, flags: 0x%x, crop: %d %d %d %d, pic_type: 0x%x\n", (u32)fill_buf_done->packet_buffer1, fill_buf_done->alloc_len1, fill_buf_done->filled_len1, fill_buf_done->offset1, time_usec, fill_buf_done->flags1, fill_buf_done->start_x_coord, fill_buf_done->start_y_coord, fill_buf_done->frame_width, fill_buf_done->frame_height, fill_buf_done->picture_type); mutex_lock(&inst->bufq[CAPTURE_PORT].lock); vb2_buffer_done(vb, VB2_BUF_STATE_DONE); mutex_unlock(&inst->bufq[CAPTURE_PORT].lock); Loading Loading @@ -2465,11 +2476,10 @@ int msm_comm_qbuf(struct vb2_buffer *vb) "Received TS_ERROR on output cap\n"); } dprintk(VIDC_DBG, "Sending etb to hal: device_addr: 0x%x" "Alloc: %d, filled: %d, offset: %d\n", frame_data.device_addr, frame_data.alloc_len, frame_data.filled_len, frame_data.offset); "Sending etb to hal: device_addr: 0x%x, alloc: %d, filled: %d, offset: %d, ts: %lld, flags = 0x%x\n", frame_data.device_addr, frame_data.alloc_len, frame_data.filled_len, frame_data.offset, frame_data.timestamp, frame_data.flags); rc = call_hfi_op(hdev, session_etb, (void *) inst->session, &frame_data); if (!rc) Loading @@ -2494,11 +2504,10 @@ int msm_comm_qbuf(struct vb2_buffer *vb) vb->v4l2_planes[extra_idx].length; } dprintk(VIDC_DBG, "Sending ftb to hal: Alloc: %d :filled: %d", frame_data.alloc_len, frame_data.filled_len); dprintk(VIDC_DBG, " extradata_addr: %d\n", frame_data.extradata_addr); "Sending ftb to hal: device_addr: 0x%x, alloc: %d, buffer_type: %d, ts: %lld, flags = 0x%x\n", frame_data.device_addr, frame_data.alloc_len, frame_data.buffer_type, frame_data.timestamp, frame_data.flags); if (atomic_read(&inst->get_seq_hdr_cnt) && inst->session_type == MSM_VIDC_ENCODER) { seq_hdr.seq_hdr = (u8 *) vb->v4l2_planes[0]. Loading Loading
drivers/media/platform/msm/vidc/msm_smem.c +12 −5 Original line number Diff line number Diff line Loading @@ -173,8 +173,10 @@ static int ion_user_to_kernel(struct smem_client *client, int fd, u32 offset, mem->smem_priv = hndl; mem->device_addr = iova; mem->size = buffer_size; dprintk(VIDC_DBG, "NOTE: Buffer device address: 0x%lx, size: %d\n", mem->device_addr, mem->size); dprintk(VIDC_DBG, "%s: ion_handle = 0x%p, fd = %d, device_addr = 0x%x, size = %d, kvaddr = 0x%p, buffer_type = %d\n", __func__, mem->smem_priv, fd, (u32)mem->device_addr, mem->size, mem->kvaddr, mem->buffer_type); return rc; fail_device_address: ion_free(client->clnt, hndl); Loading Loading @@ -243,10 +245,11 @@ static int alloc_ion_mem(struct smem_client *client, size_t size, u32 align, goto fail_device_address; } mem->device_addr = iova; dprintk(VIDC_DBG, "device_address = 0x%lx, kvaddr = 0x%p, size = %d\n", mem->device_addr, mem->kvaddr, size); mem->size = size; dprintk(VIDC_DBG, "%s: ion_handle = 0x%p, device_addr = 0x%x, size = %d, kvaddr = 0x%p, buffer_type = %d\n", __func__, mem->smem_priv, (u32)mem->device_addr, mem->size, mem->kvaddr, mem->buffer_type); return rc; fail_device_address: ion_unmap_kernel(client->clnt, hndl); Loading @@ -260,6 +263,10 @@ static void free_ion_mem(struct smem_client *client, struct msm_smem *mem) { int domain, partition, rc; dprintk(VIDC_DBG, "%s: ion_handle = 0x%p, device_addr = 0x%x, size = %d, kvaddr = 0x%p, buffer_type = %d\n", __func__, mem->smem_priv, (u32)mem->device_addr, mem->size, mem->kvaddr, mem->buffer_type); rc = msm_smem_get_domain_partition((void *)client, mem->flags, mem->buffer_type, &domain, &partition); if (rc) { Loading
drivers/media/platform/msm/vidc/msm_vidc.c +21 −13 Original line number Diff line number Diff line Loading @@ -506,6 +506,7 @@ int map_and_register_buf(struct msm_vidc_inst *inst, struct v4l2_buffer *b) temp->handle[plane]->device_addr + binfo->buff_off[i]; b->m.planes[i].m.userptr = binfo->device_addr[i]; binfo->mapped[i] = false; binfo->handle[i] = temp->handle[i]; } else { if (inst->map_output_buffer) { binfo->handle[i] = Loading @@ -515,9 +516,6 @@ int map_and_register_buf(struct msm_vidc_inst *inst, struct v4l2_buffer *b) rc = -EINVAL; goto exit; } dprintk(VIDC_DBG, "[MAP] - mapped handle[%d] = %p fd[%d] = %d", i, binfo->handle[i], i, binfo->fd[i]); binfo->mapped[i] = true; binfo->device_addr[i] = binfo->handle[i]->device_addr + Loading @@ -528,10 +526,6 @@ int map_and_register_buf(struct msm_vidc_inst *inst, struct v4l2_buffer *b) binfo->device_addr[i] = b->m.planes[i].m.userptr; } dprintk(VIDC_DBG, "Registering buffer: %d, %d, %d\n", b->m.planes[i].reserved[0], b->m.planes[i].reserved[1], b->m.planes[i].length); } /* We maintain one ref count for all planes*/ if ((i == 0) && is_dynamic_output_buffer_mode(b, inst)) { Loading @@ -539,8 +533,12 @@ int map_and_register_buf(struct msm_vidc_inst *inst, struct v4l2_buffer *b) if (rc < 0) return rc; } dprintk(VIDC_DBG, "%s: [MAP] binfo = %p, handle[%d] = %p, device_addr = 0x%x, fd = %d, offset = %d, mapped = %d\n", __func__, binfo, i, binfo->handle[i], binfo->device_addr[i], binfo->fd[i], binfo->buff_off[i], binfo->mapped[i]); } dprintk(VIDC_DBG, "[MAP] Adding binfo = %p to list\n", binfo); mutex_lock(&inst->lock); list_add_tail(&binfo->list, &inst->registered_bufs); mutex_unlock(&inst->lock); Loading Loading @@ -587,6 +585,11 @@ int unmap_and_deregister_buf(struct msm_vidc_inst *inst, goto exit; for (i = 0; i < temp->num_planes; i++) { dprintk(VIDC_DBG, "%s: [UNMAP] binfo = %p, handle[%d] = %p, device_addr = 0x%x, fd = %d, offset = %d, mapped = %d\n", __func__, temp, i, temp->handle[i], temp->device_addr[i], temp->fd[i], temp->buff_off[i], temp->mapped[i]); /* * Unmap the handle only if the buffer has been mapped and no * other buffer has a reference to this buffer. Loading @@ -598,9 +601,6 @@ int unmap_and_deregister_buf(struct msm_vidc_inst *inst, */ if (temp->handle[i] && temp->mapped[i] && !temp->same_fd_ref[i]) { dprintk(VIDC_DBG, "[UNMAP] - handle[%d] = %p fd[%d] = %d", i, temp->handle[i], i, temp->fd[i]); msm_comm_smem_free(inst, temp->handle[i]); } Loading Loading @@ -685,7 +685,8 @@ int output_buffer_cache_invalidate(struct msm_vidc_inst *inst, __func__, rc); return -EINVAL; } } } else dprintk(VIDC_ERR, "%s: WARN: NULL handle", __func__); } return 0; } Loading Loading @@ -760,12 +761,19 @@ int msm_vidc_release_buffers(void *instance, int buffer_type) buffer_info.m.planes[0].reserved[0], buffer_info.m.planes[0].reserved[1], buffer_info.m.planes[0].length); list_del(&bi->list); for (i = 0; i < bi->num_planes; i++) { if (bi->handle[i]) if (bi->handle[i] && bi->mapped[i]) { dprintk(VIDC_DBG, "%s: [UNMAP] binfo = %p, handle[%d] = %p, device_addr = 0x%x, fd = %d, offset = %d, mapped = %d\n", __func__, bi, i, bi->handle[i], bi->device_addr[i], bi->fd[i], bi->buff_off[i], bi->mapped[i]); msm_comm_smem_free(inst, bi->handle[i]); } } kfree(bi); } } Loading
drivers/media/platform/msm/vidc/msm_vidc_common.c +27 −18 Original line number Diff line number Diff line Loading @@ -953,6 +953,12 @@ static void handle_ebd(enum command_response cmd, void *data) "Failed: Start code not found\n"); } } dprintk(VIDC_DBG, "Got ebd from hal: device_addr: 0x%x, alloc: %d, status: 0x%x, pic_type: 0x%x, flags: 0x%x\n", (u32)empty_buf_done->packet_buffer, empty_buf_done->alloc_len, empty_buf_done->status, empty_buf_done->picture_type, empty_buf_done->flags); mutex_lock(&inst->bufq[OUTPUT_PORT].lock); vb2_buffer_done(vb, VB2_BUF_STATE_DONE); mutex_unlock(&inst->bufq[OUTPUT_PORT].lock); Loading Loading @@ -1112,6 +1118,7 @@ static void handle_fbd(enum command_response cmd, void *data) struct vidc_hal_fbd *fill_buf_done; enum hal_buffer buffer_type; int extra_idx = 0; int64_t time_usec = 0; if (!response) { dprintk(VIDC_ERR, "Invalid response from vidc_hal\n"); Loading Loading @@ -1151,7 +1158,7 @@ static void handle_fbd(enum command_response cmd, void *data) if (!(fill_buf_done->flags1 & HAL_BUFFERFLAG_TIMESTAMPINVALID) && fill_buf_done->filled_len1) { int64_t time_usec = fill_buf_done->timestamp_hi; time_usec = fill_buf_done->timestamp_hi; time_usec = (time_usec << 32) | fill_buf_done->timestamp_lo; vb->v4l2_buf.timestamp = Loading Loading @@ -1218,10 +1225,6 @@ static void handle_fbd(enum command_response cmd, void *data) msm_vidc_debugfs_update(inst, MSM_VIDC_DEBUGFS_EVENT_FBD); dprintk(VIDC_DBG, "Filled length = %d; offset = %d; flags %x\n", vb->v4l2_planes[0].bytesused, vb->v4l2_planes[0].data_offset, vb->v4l2_buf.flags); if (extra_idx && (extra_idx < VIDEO_MAX_PLANES)) { dprintk(VIDC_DBG, "extradata: userptr = %p;" Loading @@ -1230,6 +1233,14 @@ static void handle_fbd(enum command_response cmd, void *data) vb->v4l2_planes[extra_idx].bytesused, vb->v4l2_planes[extra_idx].length); } dprintk(VIDC_DBG, "Got fbd from hal: device_addr: 0x%x, alloc: %d, filled: %d, offset: %d, ts: %lld, flags: 0x%x, crop: %d %d %d %d, pic_type: 0x%x\n", (u32)fill_buf_done->packet_buffer1, fill_buf_done->alloc_len1, fill_buf_done->filled_len1, fill_buf_done->offset1, time_usec, fill_buf_done->flags1, fill_buf_done->start_x_coord, fill_buf_done->start_y_coord, fill_buf_done->frame_width, fill_buf_done->frame_height, fill_buf_done->picture_type); mutex_lock(&inst->bufq[CAPTURE_PORT].lock); vb2_buffer_done(vb, VB2_BUF_STATE_DONE); mutex_unlock(&inst->bufq[CAPTURE_PORT].lock); Loading Loading @@ -2465,11 +2476,10 @@ int msm_comm_qbuf(struct vb2_buffer *vb) "Received TS_ERROR on output cap\n"); } dprintk(VIDC_DBG, "Sending etb to hal: device_addr: 0x%x" "Alloc: %d, filled: %d, offset: %d\n", frame_data.device_addr, frame_data.alloc_len, frame_data.filled_len, frame_data.offset); "Sending etb to hal: device_addr: 0x%x, alloc: %d, filled: %d, offset: %d, ts: %lld, flags = 0x%x\n", frame_data.device_addr, frame_data.alloc_len, frame_data.filled_len, frame_data.offset, frame_data.timestamp, frame_data.flags); rc = call_hfi_op(hdev, session_etb, (void *) inst->session, &frame_data); if (!rc) Loading @@ -2494,11 +2504,10 @@ int msm_comm_qbuf(struct vb2_buffer *vb) vb->v4l2_planes[extra_idx].length; } dprintk(VIDC_DBG, "Sending ftb to hal: Alloc: %d :filled: %d", frame_data.alloc_len, frame_data.filled_len); dprintk(VIDC_DBG, " extradata_addr: %d\n", frame_data.extradata_addr); "Sending ftb to hal: device_addr: 0x%x, alloc: %d, buffer_type: %d, ts: %lld, flags = 0x%x\n", frame_data.device_addr, frame_data.alloc_len, frame_data.buffer_type, frame_data.timestamp, frame_data.flags); if (atomic_read(&inst->get_seq_hdr_cnt) && inst->session_type == MSM_VIDC_ENCODER) { seq_hdr.seq_hdr = (u8 *) vb->v4l2_planes[0]. Loading