-
Notifications
You must be signed in to change notification settings - Fork 7.6k
video: Drop video endpoint id in video APIs #87070
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
video: Drop video endpoint id in video APIs #87070
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would simplify the application development. I wait CI and answers but am in favor of it!
Something I notice now that I read #82158 again... |
Hi, I am currently writing the driver for the DCMIPP camera block of the STM32N6 which has actually 3 outputs. In a sense there is a single device but can have up to 3 streams of data going out. Proposed video_buf_type is great thing in order to distinguish between capture and output buffers in case of M2M devices, however this remove the way to select between multiple output (or inputs) of the same type. In the Linux world, such device is exposed using a multiple video devices (as well as multiple subdevices as well), however in Zephyr I am not aware of a way to have multiple devices which would thus be adressed via the usual set of function (fmt/stream etc etc). What would you propose to handle such case ? |
b76d869
to
f305207
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Within commit log of
drivers: video: Add video_buf_type
incomming -> incoming
outcomming -> outcoming
zexpect_not_null(vbuf); | ||
zexpect_equal(vbuf->bytesused, vbuf->size); | ||
|
||
/* Nothing left in the queue, possible to stop */ | ||
zexpect_ok(video_stream_stop(rx_dev)); | ||
zexpect_ok(video_stream_stop(rx_dev, VIDEO_BUF_TYPE_OUTPUT)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
VIDEO_BUF_TYPE_OUTPUT is introduced in the following commit hence this commit won't probably build (?). This line should probably be added within the next commit introducing the buf type enum.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I mistook the commit id when rebasing to fix CI.
@@ -162,7 +163,7 @@ static int nxp_video_sdma_enqueue(const struct device *dev, struct video_buffer | |||
k_fifo_put(&data->fifo_in, vbuf); | |||
if (data->stream_starved) { | |||
/* Kick SmartDMA off */ | |||
nxp_video_sdma_set_stream(dev, true); | |||
nxp_video_sdma_set_stream(dev, true, vbuf->type); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is vbuf->type correct here ? Considering that there is a type field (buf_type) within the video buffer structure this can work however I do not see any place where the video buffer type is being set.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it's pointed out in the commit message, for those APIs, the application needs to set the type field but I forgot to do it. Thanks !
f477409
to
c722650
Compare
@ngphibang it is because you modified the line. The project may have turned on some checking here. I'll note that I see inconsistent naming where we sometimes use "sig" and other times use "signal". My recommendation is to change the "signal" to "sig" to be compliant. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
very minor comment regarding function parameter description, apart from that LGTM.
c722650
to
9169626
Compare
I added a commit to rename the signal variables to avoid code compliance violation for this PR (though this is not related to the PR changes). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
When stopping, the framework calls driver's stop callback then driver's flush callback. Hence, driver's flush callback does not need to call stop callback again. Signed-off-by: Phi Bang Nguyen <phibang.nguyen@nxp.com>
The video endpoints are already described in the devicetree. The video_endpoint_id parameter in each video API is not necessary and has no usage. Drop it. Signed-off-by: Phi Bang Nguyen <phibang.nguyen@nxp.com>
M2M devices like ISPs or PxP have two separate buffer queues, i.e. incoming and outcoming queues. For each API, the driver needs to distinguish on which queue it needs to take action. Add video buffer type to support this kind of devices. - get_caps(), set/get_format(), enqueue()/dequeue(): the buffer type is embeded in the video_caps, video_format and video_buffer structs - video_stream_start/stop() : buffer type needs is sent as a parameter Signed-off-by: Phi Bang Nguyen <phibang.nguyen@nxp.com>
Rename signal variables to sig to be compliant with code rule 21.2 Signed-off-by: Phi Bang Nguyen <phibang.nguyen@nxp.com>
9169626
to
1cbc868
Compare
Rebased as #89627 has been merged. |
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will happily rebase my PRs as soon as I am back. :]
if (ep != VIDEO_EP_OUT) { | ||
return -EINVAL; | ||
} | ||
|
||
/* ESP32 produces full frames */ | ||
caps->min_line_count = caps->max_line_count = LINE_COUNT_HEIGHT; | ||
|
||
/* Forward the message to the source device */ | ||
return video_get_caps(config->source_dev, ep, caps); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missed updating this line here. #90090
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I missed it. Thank you ! Searching all "ep" pattern was difficult ... Having esp32 svp driver built-only test would help ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am checking PR Twister tests.. sounds there is no video test case at all. Is it? I mean, there is some sample code but none is being triggered in CI.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, test case for esp32 dvp was missing in build_all/video tests. I can add it at the end of the day (unless you do it faster)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I updated the PR. Thanks!
In the video framework, the
video_endpoint_id
parameter put in each API function has nothing to do with its meaning and has no usage. They should be removed.Currently, video drivers in Zephyr upstream are all "typical" video devices e.g., camera sensor, receiver, encoders, etc. which have only one buffer queue and does not need to distinguish which buffer queue it operates on. However, devices like ISP, PxP fall into another catergory which (Linux) calls m2m devices. For this kind of devices, the driver needs two separate buffer queues and hence needs to distinguish between input (which Linux calls "output") and output (which Linux calls "capture") side.
To support this kind of devices, such as this PR and the NXP PxP, add a video_buf_type to distinguish the buffer queue: