static int32_t __init msm_buf_mngr_init(void) { } 一:v4l2_subdev_notify(&msm_buf_mngr_dev->subdev.sd, MSM_SD_NOTIFY_REQ_CB, &msm_buf_mngr_dev->vb2_ops); 函数实现在v4l2-device.h中 static inline void v4l2_subdev_notify(struct v4l2_subdev *sd, unsigned int notification, void *arg) { if (sd && sd->v4l2_dev && sd->v4l2_dev->notify) sd->v4l2_dev->notify(sd, notification, arg); } 其中sd->v4l2_dev是在msm_sd_register(&msm_buf_mngr_dev->subdev);中赋值的: 在msm.c中static inline int __msm_sd_register_subdev(struct v4l2_subdev *sd) { vdev->v4l2_dev = msm_v4l2_dev; } 所以sd->v4l2_dev是msm_v4l2_dev。这个notify是在 static int msm_probe(struct platform_device *pdev) { msm_v4l2_dev->notify = msm_sd_notify; } 而 static void msm_sd_notify(struct v4l2_subdev *sd, unsigned int notification, void *arg) { case MSM_SD_NOTIFY_REQ_CB: { struct msm_sd_req_vb2_q *req_sd = arg; rc = msm_vb2_request_cb(req_sd); }在msm_vb2.c中 int msm_vb2_request_cb(struct msm_sd_req_vb2_q *req) { if (!req) { pr_err("%s: suddev is null\n", __func__); return -EINVAL; } req->get_buf = msm_vb2_get_buf; req->get_buf_by_idx = msm_vb2_get_buf_by_idx; req->get_vb2_queue = msm_vb2_get_queue; req->put_buf = msm_vb2_put_buf; req->buf_done = msm_vb2_buf_done; req->flush_buf = msm_vb2_flush_buf; return 0; } 所以最终msm_buf_mngr_dev->vb2_ops其实是被msm_vb2.c赋值的。 二: static int32_t msm_buf_mngr_get_buf_by_idx(struct msm_buf_mngr_device *dev, void *argp) { new_entry->vb2_buf = dev->vb2_ops.get_buf_by_idx(buf_info->session_id, buf_info->stream_id, buf_info->index); } |
|
来自: 新用户8389DdzY > 《高通》