Skip to content

media: apple: scaler: keep CAPTURE at the OUTPUT size - #2971

Closed
RyanTheTide wants to merge 1 commit into
mainfrom
media/scaler-capture-exact-size
Closed

RyanTheTide wants to merge 1 commit into
mainfrom
media/scaler-capture-exact-size

Conversation

@RyanTheTide

@RyanTheTide RyanTheTide commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Problem

An odd RGB OUTPUT size can be paired with a 4:2:0 CAPTURE format that rounds one or both dimensions up. The format ioctls succeed, but the same-size hardware job builder rejects the pair.

Change

Keep the active OUTPUT dimensions. Use the existing RGB fallback when the requested CAPTURE format cannot represent those dimensions. TRY_FMT, CAPTURE S_FMT and CAPTURE revalidation after OUTPUT S_FMT use the same helper.

Testing

Stock J413 fleet85 reproduced four format failures on the 13.5 stub. All three compatible controls passed, with zero new kernel errors, SELinux AVCs or failed units. J413 stock row

Format and build results
Check Stock Candidate
Host format and bounds 7/10 10/10
Host CAPTURE-first and queue state 4/5 5/5
J413 format ioctls 3/7, including CAPTURE-first G_FMT at 642 × 482 NV12M for 641 × 481 OUTPUT Pending
ARM64 fleet85 module Reference source W=1 build, modpost, BTF and signature passed

The native and emulated ARM64 host harnesses execute the scaler format callbacks and the V4L2 multiplanar fill helper. They use simulated format metadata and queue state. The candidate's CAPTURE-first sequence returns 641 × 481 ARGB32, and the four compatible state controls agree. Strict checkpatch reported zero errors, warnings or checks.

Still to run

Run the signed-candidate ioctls and stream a CAPTURE-first frame on the default command line. Run the stock and candidate controls on J473 and other available Macs with the scaler. Check kernel errors, AVCs and failed units.

An odd RGB OUTPUT size and a 4:2:0 CAPTURE request round the CAPTURE
dimensions up. The format ioctls succeed, but the job builder rejects
the resulting unequal-size pair.

Keep the active OUTPUT dimensions for CAPTURE and use the existing RGB
fallback if the requested format cannot represent them. Preserve
compatible format requests and existing OUTPUT negotiation.

Signed-off-by: Ryan Murray <[email protected]>

@RyanTheTide RyanTheTide left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review at 395db97. The CAPTURE geometry now comes from the active OUTPUT format and remains unchanged when the requested CAPTURE subsampling cannot fit. Both CAPTURE ioctl paths use the RGB fallback, and setting OUTPUT revalidates CAPTURE under the existing queue-busy checks. The 7/10 to 10/10 host result covers both dimensions and the compatible controls. Please include a CAPTURE format set first, followed by an odd OUTPUT set, then G_FMT and one streamed buffer in the device row. This exercises the dependent-format update as well as direct CAPTURE negotiation.

@RyanTheTide

Copy link
Copy Markdown
Contributor Author

J413 MacBook Air stock row on 7.3.0-aurora-fleet85 (13.5 stub, 26.6.2 system firmware). The test used private V4L2 file handles and ran the format ioctls without starting a stream.

Case OUTPUT Actual CAPTURE on stock
NV12M after odd-width RGB 641 × 480 TRY_FMT and S_FMT returned 642 × 480 NV12M
NV12 after odd-height RGB 640 × 481 TRY_FMT and S_FMT returned 640 × 482 NV12
P010 after odd RGB 641 × 481 TRY_FMT and S_FMT returned 642 × 482 P010
CAPTURE-first NV12M, then odd RGB on OUTPUT 641 × 481 G_FMT returned 642 × 482 NV12M

The odd-sized RGB, even-sized NV12M and even-sized P010 controls passed (3/3). There were zero new kernel errors or SELinux AVCs. Fleet85 was still running and saved, with an empty next entry, SELinux Enforcing and zero failed units. The signed 395db97d043b candidate still needs the same ioctl row and a streamed frame from the CAPTURE-first sequence.

RyanTheTide added a commit that referenced this pull request Nov 25, 2026
…PUT size

Folds #2971 into this PR unchanged.

Signed-off-by: Ryan Murray <[email protected]>
@RyanTheTide

Copy link
Copy Markdown
Contributor Author

Folded into #2804, which now carries this PR's commits unchanged (merge commit); review continues there.

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