Loading drivers/media/platform/msm/camera_v2/isp/msm_buf_mgr.c +1 −0 Original line number Diff line number Diff line Loading @@ -26,6 +26,7 @@ #include <media/v4l2-ioctl.h> #include <media/v4l2-device.h> #include <media/videobuf2-core.h> #include <media/msmb_generic_buf_mgr.h> #include "msm.h" #include "msm_buf_mgr.h" Loading drivers/media/platform/msm/camera_v2/msm_buf_mgr/msm_generic_buf_mgr.c +35 −0 Original line number Diff line number Diff line Loading @@ -167,6 +167,33 @@ static int32_t msm_buf_mngr_buf_done(struct msm_buf_mngr_device *buf_mngr_dev, return ret; } static int32_t msm_buf_mngr_buf_error(struct msm_buf_mngr_device *buf_mngr_dev, struct msm_buf_mngr_info *buf_info) { unsigned long flags; struct msm_get_bufs *bufs, *save; int32_t ret = -EINVAL; spin_lock_irqsave(&buf_mngr_dev->buf_q_spinlock, flags); list_for_each_entry_safe(bufs, save, &buf_mngr_dev->buf_qhead, entry) { if ((bufs->session_id == buf_info->session_id) && (bufs->stream_id == buf_info->stream_id) && (bufs->index == buf_info->index)) { ret = buf_mngr_dev->vb2_ops.buf_error (bufs->vb2_v4l2_buf, buf_info->session_id, buf_info->stream_id, buf_info->frame_id, &buf_info->timestamp, buf_info->reserved); list_del_init(&bufs->entry); kfree(bufs); break; } } spin_unlock_irqrestore(&buf_mngr_dev->buf_q_spinlock, flags); return ret; } static int32_t msm_buf_mngr_put_buf(struct msm_buf_mngr_device *buf_mngr_dev, struct msm_buf_mngr_info *buf_info) Loading Loading @@ -478,6 +505,9 @@ static int msm_cam_buf_mgr_ops(unsigned int cmd, void *argp) case VIDIOC_MSM_BUF_MNGR_BUF_DONE: rc = msm_buf_mngr_buf_done(msm_buf_mngr_dev, argp); break; case VIDIOC_MSM_BUF_MNGR_BUF_ERROR: rc = msm_buf_mngr_buf_error(msm_buf_mngr_dev, argp); break; case VIDIOC_MSM_BUF_MNGR_PUT_BUF: rc = msm_buf_mngr_put_buf(msm_buf_mngr_dev, argp); break; Loading Loading @@ -576,6 +606,7 @@ static long msm_buf_mngr_subdev_ioctl(struct v4l2_subdev *sd, case VIDIOC_MSM_BUF_MNGR_GET_BUF: case VIDIOC_MSM_BUF_MNGR_BUF_DONE: case VIDIOC_MSM_BUF_MNGR_PUT_BUF: case VIDIOC_MSM_BUF_MNGR_BUF_ERROR: rc = msm_cam_buf_mgr_ops(cmd, argp); break; case VIDIOC_MSM_BUF_MNGR_INIT: Loading Loading @@ -724,6 +755,9 @@ static long msm_bmgr_subdev_fops_compat_ioctl(struct file *file, case VIDIOC_MSM_BUF_MNGR_BUF_DONE32: cmd = VIDIOC_MSM_BUF_MNGR_BUF_DONE; break; case VIDIOC_MSM_BUF_MNGR_BUF_ERROR32: cmd = VIDIOC_MSM_BUF_MNGR_BUF_ERROR; break; case VIDIOC_MSM_BUF_MNGR_PUT_BUF32: cmd = VIDIOC_MSM_BUF_MNGR_PUT_BUF; break; Loading @@ -742,6 +776,7 @@ static long msm_bmgr_subdev_fops_compat_ioctl(struct file *file, switch (cmd) { case VIDIOC_MSM_BUF_MNGR_GET_BUF: case VIDIOC_MSM_BUF_MNGR_BUF_DONE: case VIDIOC_MSM_BUF_MNGR_BUF_ERROR: case VIDIOC_MSM_BUF_MNGR_FLUSH: case VIDIOC_MSM_BUF_MNGR_PUT_BUF: { struct msm_buf_mngr_info32_t buf_info32; Loading drivers/media/platform/msm/camera_v2/msm_sd.h +3 −0 Original line number Diff line number Diff line Loading @@ -81,6 +81,9 @@ struct msm_sd_req_vb2_q { unsigned int stream_id, uint32_t sequence, struct timeval *ts, uint32_t reserved); int (*flush_buf)(int session_id, unsigned int stream_id); int (*buf_error)(struct vb2_v4l2_buffer *vb2_v4l2_buf, int session_id, unsigned int stream_id, uint32_t sequence, struct timeval *ts, uint32_t reserved); }; #define MSM_SD_NOTIFY_GET_SD 0x00000001 Loading drivers/media/platform/msm/camera_v2/msm_vb2/msm_vb2.c +64 −0 Original line number Diff line number Diff line Loading @@ -461,6 +461,69 @@ static int msm_vb2_buf_done(struct vb2_v4l2_buffer *vb, int session_id, return rc; } static int msm_vb2_buf_error(struct vb2_v4l2_buffer *vb, int session_id, unsigned int stream_id, uint32_t sequence, struct timeval *ts, uint32_t buf_type) { unsigned long flags, rl_flags; struct msm_vb2_buffer *msm_vb2; struct msm_stream *stream; struct msm_session *session; struct vb2_v4l2_buffer *vb2_v4l2_buf = NULL; int rc = 0; session = msm_get_session(session_id); if (IS_ERR_OR_NULL(session)) return -EINVAL; read_lock_irqsave(&session->stream_rwlock, rl_flags); stream = msm_get_stream(session, stream_id); if (IS_ERR_OR_NULL(stream)) { read_unlock_irqrestore(&session->stream_rwlock, rl_flags); return -EINVAL; } spin_lock_irqsave(&stream->stream_lock, flags); if (vb) { list_for_each_entry(msm_vb2, &(stream->queued_list), list) { vb2_v4l2_buf = &(msm_vb2->vb2_v4l2_buf); if (vb2_v4l2_buf == vb) break; } if (vb2_v4l2_buf != vb) { pr_err("VB buffer is INVALID ses_id=%d, str_id=%d, vb=%pK\n", session_id, stream_id, vb); spin_unlock_irqrestore(&stream->stream_lock, flags); read_unlock_irqrestore(&session->stream_rwlock, rl_flags); return -EINVAL; } msm_vb2 = container_of(vb2_v4l2_buf, struct msm_vb2_buffer, vb2_v4l2_buf); /* put buf before buf done */ if (msm_vb2->in_freeq) { vb2_v4l2_buf->sequence = sequence; vb2_v4l2_buf->timecode.type = buf_type; vb2_v4l2_buf->vb2_buf.timestamp = (ts->tv_sec * 1000000 + ts->tv_usec) * 1000; vb2_buffer_done(&vb2_v4l2_buf->vb2_buf, VB2_BUF_STATE_ERROR); msm_vb2->in_freeq = 0; rc = 0; } else rc = -EINVAL; } else { pr_err(" VB buffer is NULL for ses_id=%d, str_id=%d\n", session_id, stream_id); rc = -EINVAL; } spin_unlock_irqrestore(&stream->stream_lock, flags); read_unlock_irqrestore(&session->stream_rwlock, rl_flags); return rc; } long msm_vb2_return_buf_by_idx(int session_id, unsigned int stream_id, uint32_t index) { Loading Loading @@ -559,6 +622,7 @@ int msm_vb2_request_cb(struct msm_sd_req_vb2_q *req) req->put_buf = msm_vb2_put_buf; req->buf_done = msm_vb2_buf_done; req->flush_buf = msm_vb2_flush_buf; req->buf_error = msm_vb2_buf_error; return 0; } drivers/media/platform/msm/camera_v2/pproc/cpp/msm_cpp.c +2 −1 Original line number Diff line number Diff line Loading @@ -1617,6 +1617,7 @@ static int msm_cpp_buffer_ops(struct cpp_device *cpp_dev, case VIDIOC_MSM_BUF_MNGR_PUT_BUF: case VIDIOC_MSM_BUF_MNGR_BUF_DONE: case VIDIOC_MSM_BUF_MNGR_GET_BUF: case VIDIOC_MSM_BUF_MNGR_BUF_ERROR: default: { struct msm_buf_mngr_info *buff_mgr_info = (struct msm_buf_mngr_info *)arg; Loading Loading @@ -3604,7 +3605,7 @@ static long msm_cpp_subdev_ioctl(struct v4l2_subdev *sd, break; } buff_mgr_info.frame_id = frame_info.frame_id; rc = msm_cpp_buffer_ops(cpp_dev, VIDIOC_MSM_BUF_MNGR_BUF_DONE, rc = msm_cpp_buffer_ops(cpp_dev, VIDIOC_MSM_BUF_MNGR_BUF_ERROR, 0x0, &buff_mgr_info); if (rc < 0) { pr_err("error in buf done\n"); Loading Loading
drivers/media/platform/msm/camera_v2/isp/msm_buf_mgr.c +1 −0 Original line number Diff line number Diff line Loading @@ -26,6 +26,7 @@ #include <media/v4l2-ioctl.h> #include <media/v4l2-device.h> #include <media/videobuf2-core.h> #include <media/msmb_generic_buf_mgr.h> #include "msm.h" #include "msm_buf_mgr.h" Loading
drivers/media/platform/msm/camera_v2/msm_buf_mgr/msm_generic_buf_mgr.c +35 −0 Original line number Diff line number Diff line Loading @@ -167,6 +167,33 @@ static int32_t msm_buf_mngr_buf_done(struct msm_buf_mngr_device *buf_mngr_dev, return ret; } static int32_t msm_buf_mngr_buf_error(struct msm_buf_mngr_device *buf_mngr_dev, struct msm_buf_mngr_info *buf_info) { unsigned long flags; struct msm_get_bufs *bufs, *save; int32_t ret = -EINVAL; spin_lock_irqsave(&buf_mngr_dev->buf_q_spinlock, flags); list_for_each_entry_safe(bufs, save, &buf_mngr_dev->buf_qhead, entry) { if ((bufs->session_id == buf_info->session_id) && (bufs->stream_id == buf_info->stream_id) && (bufs->index == buf_info->index)) { ret = buf_mngr_dev->vb2_ops.buf_error (bufs->vb2_v4l2_buf, buf_info->session_id, buf_info->stream_id, buf_info->frame_id, &buf_info->timestamp, buf_info->reserved); list_del_init(&bufs->entry); kfree(bufs); break; } } spin_unlock_irqrestore(&buf_mngr_dev->buf_q_spinlock, flags); return ret; } static int32_t msm_buf_mngr_put_buf(struct msm_buf_mngr_device *buf_mngr_dev, struct msm_buf_mngr_info *buf_info) Loading Loading @@ -478,6 +505,9 @@ static int msm_cam_buf_mgr_ops(unsigned int cmd, void *argp) case VIDIOC_MSM_BUF_MNGR_BUF_DONE: rc = msm_buf_mngr_buf_done(msm_buf_mngr_dev, argp); break; case VIDIOC_MSM_BUF_MNGR_BUF_ERROR: rc = msm_buf_mngr_buf_error(msm_buf_mngr_dev, argp); break; case VIDIOC_MSM_BUF_MNGR_PUT_BUF: rc = msm_buf_mngr_put_buf(msm_buf_mngr_dev, argp); break; Loading Loading @@ -576,6 +606,7 @@ static long msm_buf_mngr_subdev_ioctl(struct v4l2_subdev *sd, case VIDIOC_MSM_BUF_MNGR_GET_BUF: case VIDIOC_MSM_BUF_MNGR_BUF_DONE: case VIDIOC_MSM_BUF_MNGR_PUT_BUF: case VIDIOC_MSM_BUF_MNGR_BUF_ERROR: rc = msm_cam_buf_mgr_ops(cmd, argp); break; case VIDIOC_MSM_BUF_MNGR_INIT: Loading Loading @@ -724,6 +755,9 @@ static long msm_bmgr_subdev_fops_compat_ioctl(struct file *file, case VIDIOC_MSM_BUF_MNGR_BUF_DONE32: cmd = VIDIOC_MSM_BUF_MNGR_BUF_DONE; break; case VIDIOC_MSM_BUF_MNGR_BUF_ERROR32: cmd = VIDIOC_MSM_BUF_MNGR_BUF_ERROR; break; case VIDIOC_MSM_BUF_MNGR_PUT_BUF32: cmd = VIDIOC_MSM_BUF_MNGR_PUT_BUF; break; Loading @@ -742,6 +776,7 @@ static long msm_bmgr_subdev_fops_compat_ioctl(struct file *file, switch (cmd) { case VIDIOC_MSM_BUF_MNGR_GET_BUF: case VIDIOC_MSM_BUF_MNGR_BUF_DONE: case VIDIOC_MSM_BUF_MNGR_BUF_ERROR: case VIDIOC_MSM_BUF_MNGR_FLUSH: case VIDIOC_MSM_BUF_MNGR_PUT_BUF: { struct msm_buf_mngr_info32_t buf_info32; Loading
drivers/media/platform/msm/camera_v2/msm_sd.h +3 −0 Original line number Diff line number Diff line Loading @@ -81,6 +81,9 @@ struct msm_sd_req_vb2_q { unsigned int stream_id, uint32_t sequence, struct timeval *ts, uint32_t reserved); int (*flush_buf)(int session_id, unsigned int stream_id); int (*buf_error)(struct vb2_v4l2_buffer *vb2_v4l2_buf, int session_id, unsigned int stream_id, uint32_t sequence, struct timeval *ts, uint32_t reserved); }; #define MSM_SD_NOTIFY_GET_SD 0x00000001 Loading
drivers/media/platform/msm/camera_v2/msm_vb2/msm_vb2.c +64 −0 Original line number Diff line number Diff line Loading @@ -461,6 +461,69 @@ static int msm_vb2_buf_done(struct vb2_v4l2_buffer *vb, int session_id, return rc; } static int msm_vb2_buf_error(struct vb2_v4l2_buffer *vb, int session_id, unsigned int stream_id, uint32_t sequence, struct timeval *ts, uint32_t buf_type) { unsigned long flags, rl_flags; struct msm_vb2_buffer *msm_vb2; struct msm_stream *stream; struct msm_session *session; struct vb2_v4l2_buffer *vb2_v4l2_buf = NULL; int rc = 0; session = msm_get_session(session_id); if (IS_ERR_OR_NULL(session)) return -EINVAL; read_lock_irqsave(&session->stream_rwlock, rl_flags); stream = msm_get_stream(session, stream_id); if (IS_ERR_OR_NULL(stream)) { read_unlock_irqrestore(&session->stream_rwlock, rl_flags); return -EINVAL; } spin_lock_irqsave(&stream->stream_lock, flags); if (vb) { list_for_each_entry(msm_vb2, &(stream->queued_list), list) { vb2_v4l2_buf = &(msm_vb2->vb2_v4l2_buf); if (vb2_v4l2_buf == vb) break; } if (vb2_v4l2_buf != vb) { pr_err("VB buffer is INVALID ses_id=%d, str_id=%d, vb=%pK\n", session_id, stream_id, vb); spin_unlock_irqrestore(&stream->stream_lock, flags); read_unlock_irqrestore(&session->stream_rwlock, rl_flags); return -EINVAL; } msm_vb2 = container_of(vb2_v4l2_buf, struct msm_vb2_buffer, vb2_v4l2_buf); /* put buf before buf done */ if (msm_vb2->in_freeq) { vb2_v4l2_buf->sequence = sequence; vb2_v4l2_buf->timecode.type = buf_type; vb2_v4l2_buf->vb2_buf.timestamp = (ts->tv_sec * 1000000 + ts->tv_usec) * 1000; vb2_buffer_done(&vb2_v4l2_buf->vb2_buf, VB2_BUF_STATE_ERROR); msm_vb2->in_freeq = 0; rc = 0; } else rc = -EINVAL; } else { pr_err(" VB buffer is NULL for ses_id=%d, str_id=%d\n", session_id, stream_id); rc = -EINVAL; } spin_unlock_irqrestore(&stream->stream_lock, flags); read_unlock_irqrestore(&session->stream_rwlock, rl_flags); return rc; } long msm_vb2_return_buf_by_idx(int session_id, unsigned int stream_id, uint32_t index) { Loading Loading @@ -559,6 +622,7 @@ int msm_vb2_request_cb(struct msm_sd_req_vb2_q *req) req->put_buf = msm_vb2_put_buf; req->buf_done = msm_vb2_buf_done; req->flush_buf = msm_vb2_flush_buf; req->buf_error = msm_vb2_buf_error; return 0; }
drivers/media/platform/msm/camera_v2/pproc/cpp/msm_cpp.c +2 −1 Original line number Diff line number Diff line Loading @@ -1617,6 +1617,7 @@ static int msm_cpp_buffer_ops(struct cpp_device *cpp_dev, case VIDIOC_MSM_BUF_MNGR_PUT_BUF: case VIDIOC_MSM_BUF_MNGR_BUF_DONE: case VIDIOC_MSM_BUF_MNGR_GET_BUF: case VIDIOC_MSM_BUF_MNGR_BUF_ERROR: default: { struct msm_buf_mngr_info *buff_mgr_info = (struct msm_buf_mngr_info *)arg; Loading Loading @@ -3604,7 +3605,7 @@ static long msm_cpp_subdev_ioctl(struct v4l2_subdev *sd, break; } buff_mgr_info.frame_id = frame_info.frame_id; rc = msm_cpp_buffer_ops(cpp_dev, VIDIOC_MSM_BUF_MNGR_BUF_DONE, rc = msm_cpp_buffer_ops(cpp_dev, VIDIOC_MSM_BUF_MNGR_BUF_ERROR, 0x0, &buff_mgr_info); if (rc < 0) { pr_err("error in buf done\n"); Loading