Skip to content

v4l2: report the sensor rectangle through VIDIOC_G_SELECTION - #347

Open
vrilutza wants to merge 1 commit into
patjak:masterfrom
vrilutza:g-selection
Open

vrilutza wants to merge 1 commit into
patjak:masterfrom
vrilutza:g-selection

Conversation

@vrilutza

@vrilutza vrilutza commented Sep 12, 2026

Copy link
Copy Markdown
Contributor

The scaler accepts multiple output sizes, but frame-size enumeration alone does not tell a client which rectangle represents the sensor. A client with no size preference can consequently choose the minimum of a stepwise range.

Expose the detected sensor rectangle through VIDIOC_G_SELECTION for CROP_BOUNDS and CROP_DEFAULT, with the existing maximum-size fallback when sensor detection is unavailable. Leave CROP unsupported: the active crop depends on the negotiated output, so a constant value would be misleading. Capture behavior is unchanged.

This pairs with #331. The tested PipeWire build uses the published bounds to choose the native size; publishing them does not establish compatibility with every older client. #347 can be reviewed independently, but #331 should not be merged on the assumption that stepwise enumeration alone preserves the default resolution.

This revision rebases the branch and rewrites the commit explanation. Its code change is identical to the previous revision. The ioctl reported 1296x736 on the tested MacBookPro14,1. In the previously tested combined series, Snapshot also negotiated that size; that is a combined-series observation, not a new isolated test of this PR.

Validation scope: this individual rebased branch builds against Linux 7.1.13+deb14-amd64 with W=1; the two existing compiler warnings remain. The complete nine-topic series previously passed 57/57 streaming-inclusive v4l2-compliance checks on MacBookPro14,1. Its final source tree is unchanged by the commit-message rewrite. The combined hardware tests are not nine separate hardware certifications, and no new module reload or hardware test was performed for this publication.

Revision: 373ad9a37cf395859bf17a71ee10e2a6d5eb9f93.

Frame-size enumeration describes the output sizes the scaler accepts,
but clients also need a native rectangle when choosing among those
sizes. Without it, a client with no size preference can select the
minimum of a stepwise range instead of the sensor resolution.

Report the detected sensor rectangle for CROP_BOUNDS and CROP_DEFAULT,
using the existing maximum-size fallback when detection is unavailable.
Keep CROP unsupported because the active window depends on the output
format; a constant rectangle would misrepresent it.

This publishes existing sensor information without changing capture.
Apply it before the stepwise enumeration change in PR patjak#331.

Based-on: patjak#347
vrilutza added a commit to vrilutza/facetimehd that referenced this pull request Sep 17, 2026
The driver accepts output sizes between its minimum and the sensor
dimensions, but ENUM_FRAMESIZES advertises only the native size. Clients
that rely on enumeration cannot discover the smaller supported sizes.

Describe the range with the same width alignment and height increment as
format adjustment, keeping one entry for each supported pixel format.
This makes enumeration reflect the sizes the driver accepts.

Pair this change with the sensor bounds query from PR patjak#347. Userspace
must also use those bounds when choosing a default; older clients can
still choose the minimum size or fail to handle stepwise enumeration.
This compatibility concern also motivated the earlier revert in 545cb18,
so compliance alone does not establish client compatibility.

Based-on: patjak#331
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant