video: driver: add support for query buf
Add handling for VIDIOC_QUERYBUF ioctl in driver. This can be used to query the status of a buffer at any time after buffers have been allocated with the VIDIOC_REQBUFS ioctl. Partially Fixes: v4l2-compliance: test VIDIOC_REQBUFS/CREATE_BUFS/QUERYBUF. Change-Id: Ifd014bd8a8b02ce9fa15c62d7583bc8bcfb6756a Signed-off-by: Dikshita Agarwal <quic_dikshita@quicinc.com>
This commit is contained in:
@@ -26,6 +26,7 @@ int msm_vidc_g_selection(void* instance, struct v4l2_selection* s);
|
|||||||
int msm_vidc_s_param(void *instance, struct v4l2_streamparm *sp);
|
int msm_vidc_s_param(void *instance, struct v4l2_streamparm *sp);
|
||||||
int msm_vidc_g_param(void *instance, struct v4l2_streamparm *sp);
|
int msm_vidc_g_param(void *instance, struct v4l2_streamparm *sp);
|
||||||
int msm_vidc_reqbufs(void *instance, struct v4l2_requestbuffers *b);
|
int msm_vidc_reqbufs(void *instance, struct v4l2_requestbuffers *b);
|
||||||
|
int msm_vidc_querybuf(void *instance, struct v4l2_buffer *b);
|
||||||
int msm_vidc_release_buffer(void *instance, int buffer_type,
|
int msm_vidc_release_buffer(void *instance, int buffer_type,
|
||||||
unsigned int buffer_index);
|
unsigned int buffer_index);
|
||||||
int msm_vidc_qbuf(void *instance, struct media_device *mdev,
|
int msm_vidc_qbuf(void *instance, struct media_device *mdev,
|
||||||
|
@@ -34,6 +34,8 @@ int msm_v4l2_g_parm(struct file *file, void *fh,
|
|||||||
struct v4l2_streamparm *a);
|
struct v4l2_streamparm *a);
|
||||||
int msm_v4l2_reqbufs(struct file *file, void *fh,
|
int msm_v4l2_reqbufs(struct file *file, void *fh,
|
||||||
struct v4l2_requestbuffers *b);
|
struct v4l2_requestbuffers *b);
|
||||||
|
int msm_v4l2_querybuf(struct file *file, void *fh,
|
||||||
|
struct v4l2_buffer *b);
|
||||||
int msm_v4l2_qbuf(struct file *file, void *fh,
|
int msm_v4l2_qbuf(struct file *file, void *fh,
|
||||||
struct v4l2_buffer *b);
|
struct v4l2_buffer *b);
|
||||||
int msm_v4l2_dqbuf(struct file *file, void *fh,
|
int msm_v4l2_dqbuf(struct file *file, void *fh,
|
||||||
|
@@ -412,6 +412,35 @@ exit:
|
|||||||
}
|
}
|
||||||
EXPORT_SYMBOL(msm_vidc_reqbufs);
|
EXPORT_SYMBOL(msm_vidc_reqbufs);
|
||||||
|
|
||||||
|
int msm_vidc_querybuf(void *instance, struct v4l2_buffer *b)
|
||||||
|
{
|
||||||
|
int rc = 0;
|
||||||
|
struct msm_vidc_inst *inst = instance;
|
||||||
|
int port;
|
||||||
|
|
||||||
|
if (!inst || !b) {
|
||||||
|
d_vpr_e("%s: invalid params\n", __func__);
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
port = v4l2_type_to_driver_port(inst, b->type, __func__);
|
||||||
|
if (port < 0) {
|
||||||
|
rc = -EINVAL;
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
rc = vb2_querybuf(inst->bufq[port].vb2q, b);
|
||||||
|
if (rc) {
|
||||||
|
i_vpr_e(inst, "%s: vb2_querybuf(%d) failed, %d\n",
|
||||||
|
__func__, b->type, rc);
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
exit:
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
EXPORT_SYMBOL(msm_vidc_querybuf);
|
||||||
|
|
||||||
int msm_vidc_qbuf(void *instance, struct media_device *mdev,
|
int msm_vidc_qbuf(void *instance, struct media_device *mdev,
|
||||||
struct v4l2_buffer *b)
|
struct v4l2_buffer *b)
|
||||||
{
|
{
|
||||||
|
@@ -60,6 +60,7 @@ static struct v4l2_ioctl_ops msm_v4l2_ioctl_ops_enc = {
|
|||||||
.vidioc_s_parm = msm_v4l2_s_parm,
|
.vidioc_s_parm = msm_v4l2_s_parm,
|
||||||
.vidioc_g_parm = msm_v4l2_g_parm,
|
.vidioc_g_parm = msm_v4l2_g_parm,
|
||||||
.vidioc_reqbufs = msm_v4l2_reqbufs,
|
.vidioc_reqbufs = msm_v4l2_reqbufs,
|
||||||
|
.vidioc_querybuf = msm_v4l2_querybuf,
|
||||||
.vidioc_qbuf = msm_v4l2_qbuf,
|
.vidioc_qbuf = msm_v4l2_qbuf,
|
||||||
.vidioc_dqbuf = msm_v4l2_dqbuf,
|
.vidioc_dqbuf = msm_v4l2_dqbuf,
|
||||||
.vidioc_streamon = msm_v4l2_streamon,
|
.vidioc_streamon = msm_v4l2_streamon,
|
||||||
@@ -97,6 +98,7 @@ static struct v4l2_ioctl_ops msm_v4l2_ioctl_ops_dec = {
|
|||||||
.vidioc_s_parm = msm_v4l2_s_parm,
|
.vidioc_s_parm = msm_v4l2_s_parm,
|
||||||
.vidioc_g_parm = msm_v4l2_g_parm,
|
.vidioc_g_parm = msm_v4l2_g_parm,
|
||||||
.vidioc_reqbufs = msm_v4l2_reqbufs,
|
.vidioc_reqbufs = msm_v4l2_reqbufs,
|
||||||
|
.vidioc_querybuf = msm_v4l2_querybuf,
|
||||||
.vidioc_qbuf = msm_v4l2_qbuf,
|
.vidioc_qbuf = msm_v4l2_qbuf,
|
||||||
.vidioc_dqbuf = msm_v4l2_dqbuf,
|
.vidioc_dqbuf = msm_v4l2_dqbuf,
|
||||||
.vidioc_streamon = msm_v4l2_streamon,
|
.vidioc_streamon = msm_v4l2_streamon,
|
||||||
|
@@ -323,6 +323,30 @@ unlock:
|
|||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int msm_v4l2_querybuf(struct file *filp, void *fh,
|
||||||
|
struct v4l2_buffer *b)
|
||||||
|
{
|
||||||
|
struct msm_vidc_inst *inst = get_vidc_inst(filp, fh);
|
||||||
|
int rc = 0;
|
||||||
|
|
||||||
|
inst = get_inst_ref(g_core, inst);
|
||||||
|
if (!inst) {
|
||||||
|
d_vpr_e("%s: invalid instance\n", __func__);
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
inst_lock(inst, __func__);
|
||||||
|
rc = msm_vidc_querybuf((void *)inst, b);
|
||||||
|
if (rc)
|
||||||
|
goto unlock;
|
||||||
|
|
||||||
|
unlock:
|
||||||
|
inst_unlock(inst, __func__);
|
||||||
|
put_inst(inst);
|
||||||
|
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
int msm_v4l2_qbuf(struct file *filp, void *fh,
|
int msm_v4l2_qbuf(struct file *filp, void *fh,
|
||||||
struct v4l2_buffer *b)
|
struct v4l2_buffer *b)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user