Conversation
V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE is a v4l2_buf_type enum value (10), not a capability bit, so OR-ing it into the device_caps mask yielded 0x0000000a instead of 0x00002002. A device advertising only V4L2_CAP_VIDEO_OUTPUT_MPLANE therefore fell through to VFL_DIR_RX instead of VFL_DIR_TX, and the stray 0x8 bit is not part of the V4L2_CAP_* space at all. With the wrong direction, determine_valid_ioctls() in the V4L2 core rejects VIDIOC_ENUMOUTPUT, VIDIOC_G_OUTPUT, VIDIOC_S_OUTPUT and the VIDIOC_*AUDOUT ioctls with -ENOTTY even though the driver implements them, and instead enables capture-only ioctls such as VIDIOC_ENUMINPUT, VIDIOC_G_INPUT, VIDIOC_S_INPUT and VIDIOC_QUERYSTD. Format negotiation keeps working because the driver registers both the _vid_cap and _vid_out variants of ENUM_FMT/G_FMT/S_FMT/TRY_FMT, which is why the bug went unnoticed. Fixes: f364e65 ("Initial commit")
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANEis av4l2_buf_typeenum value (10), not acapability bit, so OR-ing it into the
device_capsmask yielded the wrong value:V4L2_CAP_VIDEO_OUTPUT (0x2) | 10=0x0000000aV4L2_CAP_VIDEO_OUTPUT (0x2) | V4L2_CAP_VIDEO_OUTPUT_MPLANE (0x2000)=0x00002002A device advertising only
V4L2_CAP_VIDEO_OUTPUT_MPLANEtherefore fell through toVFL_DIR_RXinstead ofVFL_DIR_TX. The stray0x8bit that the old mask picked upis not part of the
V4L2_CAP_*space at all.Impact
vfl_dirfeedsdetermine_valid_ioctls()in the V4L2 core, whereis_rx = vfl_dir != VFL_DIR_TXandis_tx = vfl_dir != VFL_DIR_RX. With the directionmisdetected, an mplane-only output device:
-ENOTTYforVIDIOC_ENUMOUTPUT,VIDIOC_G_OUTPUT,VIDIOC_S_OUTPUTand theVIDIOC_*AUDOUTioctls, even though the driver implements all of themVIDIOC_ENUMINPUT,VIDIOC_G_INPUT,VIDIOC_S_INPUT,VIDIOC_QUERYSTD,VIDIOC_G_TUNERand friendsFormat negotiation keeps working either way, because the driver registers both the
_vid_capand_vid_outvariants ofENUM_FMT/G_FMT/S_FMT/TRY_FMT. That islikely why this went unnoticed;
v4l2-compliancewould flag the direction-exclusiveioctls.
Notes
The line dates back to the initial commit. f365fc5 ("driver: properly set device
direction") touched these exact lines to change
vfl_dir |=to=, but the typo oneline below was missed.