Skip to content

drm/apple, isp: add a best-effort camera indicator (unbooted) - #2561

Merged
DjDeveloperr merged 20 commits into
aurora-silicon:integration/aurorafrom
joshuaswarren:w7y/camera-indicator-signed
Nov 20, 2026
Merged

DjDeveloperr merged 20 commits into
aurora-silicon:integration/aurorafrom
joshuaswarren:w7y/camera-indicator-signed

Conversation

@joshuaswarren

Copy link
Copy Markdown
Contributor

[Joshua's agent]

On boards that opt in, the camera driver asks the internal display to show a green square while the camera streams. The camera keeps streaming if the display cannot show the square. This is a best-effort software indicator, not a privacy guarantee.

Replaces #1744. This branch carries the 16 indicator commits with author sign-offs on integration/aurora, without #2102. The two conflict resolutions preserve the upstream display helpers and ISP tests. The busy-flip path still uses one blocking work item and does not poll.

Validated on, and reach

Validated on: 11 indicator state tests and five ISP host suites passed on the rebased tree. No board has booted this head. No screenshot was taken because this head has not run on hardware.

Applies beyond the M4: The API is board opt-in. Display confirmation is implemented on the H17P path. The J700 hardware check remains open: stream cycles, blend CRC after stop, no backlight or swap errors, and s2idle during capture.

m tester run (omarchy-m-testing.org): Camera image signal processor (ISP). No tester run for this head.

Boards without a hardware camera light have no way to show that the
camera is in use. Let a DCP carry a small kernel-owned square on a free
swap slot, named per board by apple,camera-indicator-surface.

The camera driver calls apple_dcp_camera_indicator_set(dcp, on). The call
commits the square non-blocking and waits up to one second for a present
that carried it. It returns 0 once one did and an error otherwise. It is a
software indicator, not a privacy guarantee: the camera never depends on
the answer. The call holds the DCP's device lock, so the DCP cannot unbind
under it.

The reserved overlay plane belongs to the kernel. Any userspace commit
that changes it (FB_ID=0, CRTC_ID=0, a client framebuffer, a move) is put
back to the plane's current state instead of failing, so a blind clear of
every plane, as the console restore does, still succeeds. Carried
unchanged, or disabled with the CRTC it sits on, the plane is left alone.
The state policy is a pure header (dcp-indicator.h) with a KUnit suite,
apple-dcp-indicator.

Proof: the policy suite builds as a userspace program, 5 cases, 0 failed.
drivers/gpu/drm/apple builds with LLVM, KUnit enabled; no kernel ran it
and no hardware has shown the square yet.

Signed-off-by: Joshua Warren <816217+joshuaswarren@users.noreply.github.com>
The camera now requests a software indicator from the DCP named by the
optional apple,camera-indicator property, before the firmware starts the
channel, and removes it after the stream stops, on every stop path. The
indicator never gates streaming: if the DCP is absent, unbound or cannot
show the square, the driver warns once and the camera streams anyway.
It is not a privacy guarantee.

The DCP lookup never defers probe, and holds a device reference only when
a device exists. VIDEO_APPLE_ISP depends on DRM_APPLE || !DRM_APPLE so a
built-in driver cannot link a modular DCP. KUnit tests pin the contract:
a failed request still streams, no DCP means no call, the request comes
before the channel start and the removal after the stop, and a failed
channel start or failed firmware still removes the square.

Proof: built with LLVM with KUnit enabled (compile only; no kernel ran
the tests and no hardware showed the square).

Signed-off-by: Joshua Warren <816217+joshuaswarren@users.noreply.github.com>
…d mutex

A review of the camera indicator found these faults, all in the DCP half.

set(true) waited up to 1 s for the present, so a DCP that never composites
the slot delayed every stream start by a second and then showed no dot. It
now returns once the request is committed, and a delayed work confirms the
present or withdraws the square after 1 s with a warning.

Releasing the plane cleared has_surf, a device-tree constant, so after a
rebind of the DRM master apple_probe_per_dcp built no plane and the
indicator was gone until reboot. It also left a LIT state across the unbind
because set(false) returned before it ended the state. The release now runs
from the DCP's component unbind, while the DCP and the drm_device are both
alive (a drmm action ran after the DCP's memory was freed), clears the plane,
the framebuffer and the state, and keeps has_surf and surf.

A DCP that took the ext failsafe path never ran dcp_indicator_probe, so a
camera phandle pointing at it locked an uninitialised mutex. set() now tests
has_surf, which is zero there, before it locks.

The J700 surface-0 fix-up ran after dcp_indicator_probe, so surface 0 passed
the free-surface test and then collided. The probe now runs after it.

Also removes the unread indicator_fb field and two comments that said the
camera stays off on failure.

Tested: drivers/gpu/drm/apple builds with LLVM and no warnings. Not booted,
KUnit not run.

Signed-off-by: Joshua Warren <816217+joshuaswarren@users.noreply.github.com>
The ISP looked the DCP up once at probe and, if the DCP platform device did
not exist yet, silently had no indicator for the life of the driver. It now
keeps the phandle's node and looks the device up when a stream starts, and
says so when the DCP is still missing. Without CONFIG_DRM_APPLE the property
is not looked up, so the probe notice no longer claims an indicator the stub
cannot show. The failure warning is rate-limited instead of once per boot,
so a later failure (panel off, timeout) is visible.

The KUnit case isp_test_stream_failure_lights_off expected the indicator-off
call at step 2, but the stubbed firmware start takes step 2, so off is step 3
(on=1, firmware start=2, off=3). The expectation is fixed and now also checks
the firmware start.

Tested: the ISP builds with LLVM and no warnings. KUnit compiled, not run.
Signed-off-by: Joshua Warren <816217+joshuaswarren@users.noreply.github.com>
The session, buffers and returns suites compile apple_isp_stop_capture and
isp_cmd_send straight from the driver. The indicator change added the
indicator hooks to the first and a KUNIT_STATIC_STUB_REDIRECT call to the
second, and the host fixtures defined neither, so the three suites stopped
compiling. The fixtures now define the redirect as a no-op and the two
indicator helpers as 'no DCP, no call', with the dcp field.

Tested: session, buffers, returns, queue and receive all PASS, and every
negative control (send, overwrite, stop, reset; address, pool, duplicate,
snapshot) still fails.

Signed-off-by: Joshua Warren <816217+joshuaswarren@users.noreply.github.com>
…nors

w7X found that the DCP lookup at stream start had no test: mutations
that skipped apple_isp_indicator_bind() still passed every KUnit case,
because the tests set isp->dcp by hand. Claude's review left two minors:
a stale watch can withdraw a newer request, and a stream that runs
across a DRM master rebind shows no dot afterwards.

- isp: the platform device lookup goes through a stubbable wrapper.
  New case isp_test_dcp_bound_at_stream_start: no DCP means no dot for
  that stream, the next stream binds it and asks for the dot before the
  firmware start, and a bound DCP is not looked up again.
- drm/apple: set(true) records a deadline. A watch armed for an earlier
  request that was stopped and asked for again returns when the deadline
  has not passed, so it cannot withdraw the newer request.
- drm/apple: a request that is still wanted survives dcp_comp_unbind
  (dcp_ind_suspend). The first present after the next bind queues a
  resume that asks for the square again. A stop, a failed commit or a
  withdrawal ends the request, so a failing commit cannot loop. Release
  now drops the fb and the plane under the lock before the works are
  cancelled, so no present queues them again.
- Pure-state case indicator_resumes_only_a_kept_request.

Proof: DRM and ISP dirs build with no warnings (arm64, LLVM). ISP KUnit
on arm64 QEMU, all suites pass including the new case; the pure-state
suite built as a userspace program passes, and fails when dcp_ind_end()
keeps the request. Not run: the resume path on a panel, and DRM_APPLE
as n.

Signed-off-by: Joshua Warren <816217+joshuaswarren@users.noreply.github.com>
The off commit is nonblocking. A flip still pending on the CRTC, plane or
connector makes drm_atomic_helper_setup_commit() refuse it with -EBUSY, which
a live compositor causes often. The stop path and the watch withdrawal logged
that refusal and reported success, so the plane stayed enabled with no retry,
and plane.c then restored the square after later userspace clears. The dot
stayed on after STREAMOFF.

Route the stop path and the watch withdrawal through dcp_indicator_off(). A
-EBUSY keeps an off_pending request and queues off_retry (50 ms) until the
commit lands; any other error is warned about as final. A new request, the
plane going away, or release cancels the retry. The failed-on cleanup no
longer commits off: a refused on commit changed nothing on the plane.

Also queue the resume work inside the ci->lock section in swap_done, so
release, which drops the fb under that lock, cannot cancel before it is queued.

Proof: new case indicator_off_retries_a_pending_flip in the pure-state suite.
It failed on a version that treats -EBUSY as done (6 expectations), and passes
with the change (7/7). The DRM and ISP objects build with no warnings. The
retry itself, and a real -EBUSY from a compositor, were not run on hardware.

Signed-off-by: Joshua Warren <816217+joshuaswarren@users.noreply.github.com>
plane.c put back any userspace change to the reserved overlay, so a
compositor that assigned a framebuffer to it saw the commit succeed while the
kernel dropped its buffer, and could not fall back.

A commit that clears the plane (FB_ID=0 and CRTC_ID=0), as the console
restore does for every plane, still succeeds and is put back. Any other
userspace change now returns -EINVAL from atomic_check, so the refusal shows
in a TEST_ONLY commit. The kernel's own commit, a plane carried unchanged and
a plane disabled with its CRTC pass as before.

The decision moves from dcp_ind_plane_must_restore() to
dcp_ind_plane_policy(), which returns PASS, RESTORE or REJECT. The old bool
function is gone.

Proof: indicator_plane_reservation now expects REJECT for an own fb and
RESTORE for a clear. It failed to build against the old API, and fails
(one expectation) on a version that restores instead of rejecting. The suite
passes 7/7 in userspace, and the DRM objects build with no warnings. A real
TEST_ONLY commit from a compositor was not run.

Signed-off-by: Joshua Warren <816217+joshuaswarren@users.noreply.github.com>
When the on commit got -EBUSY from a pending flip, the request ended and the
camera streamed with no square showing: the off hole in reverse.

Both directions now go through dcp_ind_apply(). A -EBUSY keeps the request,
records which commit was refused in dcp_indicator.retry, and queues the retry
work; the work asks again through dcp_ind_retry() until the commit lands. A
request that ends (stop, watch withdrawal), a new request, losing the plane and
release all drop or cancel the retry. The on request still arms its 1 s watch
once the commit is committed or queued, so a square that never lands is
withdrawn. Any other error is final: set(true) returns it, and the work warns
and ends the request.

The retry decision and the queueing now live in the header behind a two-call
seam (commit, queue_retry), so the pure-state suite drives the same code the
work item runs. The earlier off_pending flag and dcp_ind_off_result() are gone.

Proof: indicator_refused_commit_is_retried and
indicator_retry_ends_with_the_request drive both directions with a fake commit
and queue. A mutant with queue_retry removed fails 4 expectations, and one that
does not retry an on commit fails 4. The suite passes 8/8 in userspace, and the
DRM objects build with no warnings. The real work item and a real -EBUSY from
a compositor were not run on hardware.

Signed-off-by: Joshua Warren <816217+joshuaswarren@users.noreply.github.com>
…sume

Refusing a userspace assignment to the reserved plane (ed1887f) also
refused the kernel's own framebuffer when resume committed it back.
drm_atomic_helper_suspend() saves the lit square in the duplicated state, and
drm_atomic_helper_resume() resets the plane and commits that state, so
atomic_check saw an own fb on the reserved plane that was neither unchanged nor
the indicator's commit, returned -EINVAL, and the panel did not come back.

Userspace cannot name the framebuffer (it is unregistered, kernel-private), so a
new state whose fb is that framebuffer is the kernel's. apple_plane now holds a
pointer to it, set at attach and cleared at release, compared by pointer only.
dcp_ind_plane_policy() takes an own_fb argument and puts such a state back like
a clear: the plane resumes disabled, and the indicator's resume path asks for
the square again if the camera still streams.

Proof: indicator_plane_reservation pins own_fb to RESTORE, and fails on a
version that ignores own_fb. The suite passes 8/8 in userspace, and the DRM
objects build with no warnings. The own_fb pointer comparison in plane.c and a
real suspend and resume were not run.

Signed-off-by: Joshua Warren <816217+joshuaswarren@users.noreply.github.com>
A square lit when the system suspended stayed dark after resume. Resume commits
the saved state with the kernel framebuffer, which the reserved-plane policy
puts back disabled, while the state machine still said LIT, so nothing asked
for the square again. A request made before the display was ready (the ISP
resuming first) got -ENODEV, which ended the request and dropped it.

- Resume: apple_drm_resume_outputs() calls dcp_indicator_display_resumed() for
  every CRTC after drm_mode_config_helper_resume(). The plane came back
  disabled, so the state goes OFF and a request that still stands queues the
  resume work.
- Not ready: -ENODEV from the commit (CRTC inactive, DRM unbound) keeps the
  request with the square OFF and returns 0. The display resuming asks again.
  No watch is armed for a commit that did not happen.
- Own framebuffer: it is now identified by its funcs, which are the indicator's
  alone, instead of a pointer kept on the plane. That removes the attach and
  release bookkeeping and the stale pointer after a rebind. A state carrying it
  is restored, not refused, as before.
- dcp_ind_plane_policy() takes has_fb, has_crtc and own_fb, so the clear test
  is part of what the suite pins.
- tests/kunit-shim.h is added so dcp-indicator-test.c builds as a plain program.

Proof: indicator_survives_a_display_that_is_not_ready,
indicator_lit_across_suspend_asks_again and the widened
indicator_plane_reservation were written first and failed to build. Mutants
that drop the -ENODEV keep, the resume reset, or the own-fb/clear rule each
fail one case. The suite passes 10/10 in userspace, and the DRM and ISP objects
build with no warnings. Not run: the glue in plane.c and apple_drv.c (the own
fb argument and the resume call), a real suspend and resume, a panel.

Signed-off-by: Joshua Warren <816217+joshuaswarren@users.noreply.github.com>
… the plane check

Review of e8e20e8 found three defects and an untested wiring.

apple_drm_resume_outputs() read to_apple_crtc(crtc)->dcp for every CRTC,
but a T8132 external CRTC is not a struct apple_crtc. Skip it, as the
other CRTC loops do.

dcp_indicator_display_resumed() reset the state to OFF under ci->lock
alone. A set(true) that landed between the resume commit and the call
had its state forced to OFF; the re-request then found the plane
unchanged, no swap followed, and the 1 s watch withdrew the square while
the camera streams. The same happened to a plane that resume had
restored lit. The hook now takes ci->ctl and the plane lock, in the order
dcp_indicator_commit() does, and resets the state only if the plane came
back dark (dcp_ind_display_resumed(ind, plane_dark)).

plane.c gathered the policy arguments inline, out of reach of any test.
dcp_ind_plane_check() now computes unchanged, going_off and own_fb from
the old and new plane state, and dcp_indicator_owns_fb() is gone in favour
of the exported dcp_indicator_fb_funcs it compared against.

A kept request (-ENODEV) logs at dev_dbg. A DCP on the H17G profile has
no swap_done hook to confirm the square, so the probe leaves the
indicator off there with a warning instead of arming it.

Proof: the userspace test (11 cases) passes; new cases cover a lit plane
surviving the resume hook and every field of the plane check, and each
mutant of the helpers (own_fb, going_off, each compared field, the dark
test, the kernel_commit argument) fails one case. The DRM and ISP objects
build with no warnings. The apple_drv.c call, the extern, and the plane.c
call site are still not run on hardware.

Signed-off-by: Joshua Warren <816217+joshuaswarren@users.noreply.github.com>
On the H17P firmware path a swap with no surface other than the indicator
is dropped: iomfb_apply_backlight_h17p() -> dcp_bl_prepare() returns
-ENODATA for !have_surface, and only firmware 27 takes surface-less swaps.
The off commit holds only the indicator plane, so on a J700 it was dropped
("present dropped: backlight prepare -61", "swap failed!", once per stop,
27 times on one boot). The DRM state said the plane was off, but the
firmware never saw the removal: slot 2 stayed on the panel and the DCP
blend CRC stayed on the "with indicator" value after the stream stopped.

Add the CRTC's other planes to the commit with drm_atomic_add_affected_planes(),
so each indicator swap re-presents the primary. The on commit worked only
because it carries the indicator surface itself; it takes the same path now.

Found by RyanTheTide's J700 run on 648dd4c (Aurora seq 807); the fix is
his proposal. No userspace test can cover it: the rule lives in a DRM
atomic call and in the firmware's reaction to it. The repro is his CRC row
and the paired dmesg lines, to be rerun at the new head. Not run by me: any
hardware, and T6050 may or may not need it. The DRM objects build.

Signed-off-by: Joshua Warren <816217+joshuaswarren@users.noreply.github.com>
…looks like

The indicator square was orange. RyanTheTide asked for green; the fill is
0xff34c759 now.

Two comments said a plane can come back from a system resume lit. The
resume commit names the kernel's framebuffer and gets DCP_IND_PLANE_RESTORE,
which puts the plane back to the disabled state suspend left, so the dark
branch is the normal path. The lit branch covers only a set(true) that
lands between the resume commit and dcp_indicator_display_resumed(). The
code was right; the comments are rewritten.

Proof: the userspace suite still passes 11/11. No behaviour changed except
the colour value, which no test reads.

Signed-off-by: Joshua Warren <816217+joshuaswarren@users.noreply.github.com>
…se adaptation)

The base grew a parameter on the camera-indicator plane creation;
pass dcp_is_ext26(dcp_data) so the probe keeps its meaning on the
firmware 27 external DCP after the rebase onto f21ee13.

Signed-off-by: Joshua Warren <816217+joshuaswarren@users.noreply.github.com>
Keep the initial submission nonblocking. If a previous flip refuses it,
submit the change once from a work item with the blocking DRM commit.
Remove the retry timer. Error or cancellation leaves no work to requeue.

The host indicator suite passes all 11 cases, including a busy retry.

Signed-off-by: Joshua Warren <816217+joshuaswarren@users.noreply.github.com>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-20T13:56:14.955994Z 5f9922b PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

The camera indicator adds a conditional declaration to display.h.
Slicing to the first #endif copies that declaration without its closing
directive. Extract the firmware UUID and three admission helpers only.

The T6041 admission test passes on integration and with this change.

Signed-off-by: Joshua Warren <816217+joshuaswarren@users.noreply.github.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5f9922b5f7

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +227 to +230
ret = drm_atomic_set_crtc_for_plane(ps, NULL);
if (ret)
goto out;
drm_atomic_set_fb_for_plane(ps, NULL);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve pending removal while the CRTC is inactive

On an opted-in H17P panel, stopping capture while DPMS has made the CRTC inactive can complete this off commit without removing the indicator: apple_atomic_commit_tail() uses DRM_PLANE_COMMIT_ACTIVE_ONLY, so no dcp_flush() occurs. H17P retains iomfb.scanout, including the indicator framebuffer, for brightness and wake presents. After unblank, iomfb_scanout_prepare_h17p() skips the now-detached indicator plane because both its old and new CRTC are NULL, preserving that stale slot. Consequently, the square can remain green after capture has stopped. Keep removal pending until an active present can clear the slot, or reconcile the retained scanout during reactivation.

Useful? React with 👍 / 👎.

Comment thread drivers/gpu/drm/apple/dcp-indicator.c Outdated
Comment on lines +61 to +63
if (surf >= SWAP_SURFACES || test_bit(surf, dcp->iomfb_surfaces))
return dev_err_probe(dcp->dev, -EINVAL,
"camera indicator surface %u is not free\n", surf);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Reserve an indicator slot above every userspace layer

A configuration such as apple,iomfb-surfaces = <1 1 0 1> with indicator slot 2 passes this check, although userspace slot 3 is above it. Giving the indicator the highest immutable DRM zpos in apple_probe_per_dcp() does not change this: iomfb_flush_*() selects firmware layers directly through iomfb_surf, without remapping by zpos. An overlapping opaque userspace overlay on slot 3 can therefore hide the indicator, while dcp_indicator_swap_done() still confirms it as lit. Require the reserved slot to be above all exposed userspace slots, or implement a corresponding hardware-layer remapping.

Useful? React with 👍 / 👎.

@RyanTheTide

Copy link
Copy Markdown
Contributor

Thanks for splitting this out. Reviewed ed1c522: the busy-flip fix is intact (one blocking drm_atomic_commit() from the work item, no requeue, dcp-indicator.h dcp_ind_retry), selection is by DT (apple,camera-indicator-surface / apple,camera-indicator), no module params or machine lists, all 17 commits signed off. Three things before it's ready:

  1. Bindings: apple,camera-indicator is only in apple,t6050-isp.yaml. apple,t8140-isp.yaml and apple,isp.yaml use additionalProperties: false, so an A18 Pro (J700) or M-series node fails dtbs_check. Please add it to those schemas too.
  2. Codex slot finding is real: dcp-indicator.c:61 only checks the slot is free. Please require it above every enabled apple,iomfb-surfaces slot.
  3. Codex DPMS finding (:227) looks real: an off commit on an inactive CRTC never flushes. Keep removal pending until the next active present.

Our A18 Pro (J700) stream + blend CRC + s2idle row is queued with our lab.

@DjDeveloperr DjDeveloperr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for the split. ed1c522 carries #1744's indicator commits with only rebase changes, plus the T6041 selftest fix for the new #if block in display.h. Every commit is signed off and all eight checks are green, so the two points from my #1744 review (DCO and #2102) are closed.

Ryan's 14:17 review holds the merge. I checked the two Codex findings he backed against this head, and both are real:

  1. Slot order. dcp_indicator_probe() (dcp-indicator.c:61) only refuses a slot that userspace already owns. The flush picks the firmware layer by iomfb_surf (iomfb_template.c:4490), not by DRM zpos. So with apple,iomfb-surfaces = <1 1 0 1> and the indicator on slot 2, a userspace plane on slot 3 can cover the square while swap_done reports it lit. Please refuse an indicator slot that isn't above every enabled userspace slot.
  2. Removal while DPMS is off. Commit tail uses DRM_PLANE_COMMIT_ACTIVE_ONLY (apple_drv.c:813), so an off commit on an inactive CRTC never reaches dcp_flush(). The retained H17P scanout keeps the indicator's framebuffer, and iomfb_scanout_prepare_h17p() skips a plane whose old and new CRTC are both NULL (iomfb.c:3784). The square then comes back on unblank after the camera has stopped. Please keep the removal pending until an active present clears the slot.

Ryan's binding point also stands: the J700 opt-in needs apple,camera-indicator in apple,t8140-isp.yaml and apple,isp.yaml, which use additionalProperties: false.

With those fixed and CI green, it merges. Ryan's J700 row (stream cycles, the blend CRC back after stop, no backlight prepare -61 / swap failed!, s2idle with the camera running) is queued on his side. #1744 stays open until that row is in.

An inactive CRTC can detach the indicator plane without submitting its
removal. The next present can otherwise reuse the old firmware layer.

Carry an explicit null layer in the next H17P present, including a wake
or brightness replay. Keep the old framebuffer pinned until completion.

Signed-off-by: Joshua Warren <816217+joshuaswarren@users.noreply.github.com>
The probe only checked that the slot was free, so a hole below an
enabled userspace slot passed: with apple,iomfb-surfaces = <1 1 0 1>
and indicator slot 2, userspace slot 3 sits above the indicator and
can hide it, because iomfb_flush_* picks firmware layers directly
without zpos remapping.

Require the DT slot to be strictly above every enabled slot in
iomfb_surfaces, using the apple_drv.c top_surf convention
(find_last_bit returns the size when the bitmap is empty). A set
slot itself is still rejected, since surf <= top_surf covers it.

Behavior table (9 cases: empty bitmap, above, holes below enabled
slots, enabled slot, out of range): the old rule accepted all three
hole cases, the new rule matches all 9. Ryan aurora-silicon/linux
aurora-silicon#2561 comment 7041814887, inline 4643285611.

Signed-off-by: Joshua Warren <816217+joshuaswarren@users.noreply.github.com>
Accept the optional display coprocessor phandle on generic and T8140
ISP nodes, matching the existing T6050 binding.

Signed-off-by: Joshua Warren <816217+joshuaswarren@users.noreply.github.com>
@joshuaswarren

Copy link
Copy Markdown
Contributor Author

Note

🤖 omp responding on behalf of Joshua Warren

All three requests are addressed in ffba3cbd7510:

  1. Both ISP bindings now accept apple,camera-indicator (ffba3cbd75). Both passed dt-doc-validate. The patched schemas admit the phandle and still reject unknown properties.
  2. dcp_indicator_probe() rejects any slot at or below the highest enabled apple,iomfb-surfaces slot (44b7d56837). The slot check passed all nine cases.
  3. After DPMS off, the next H17P present clears the retained indicator layer, including wake and brightness replays (3611b2c1b3). The driver keeps the framebuffer until that present completes. The camera-indicator-dpms host test failed before the fix and passed after it.

host-tests passed on this exact head: https://github.com/aurora-silicon/linux/actions/runs/44760242908

@RyanTheTide

Copy link
Copy Markdown
Contributor

Thanks, reviewed ffba3cb. All three are fixed:

  1. ffba3cb adds apple,camera-indicator (phandle) to apple,isp.yaml and apple,t8140-isp.yaml.
  2. 44b7d56: dcp_indicator_probe() now rejects any slot at or below find_last_bit(iomfb_surfaces), so a hole under an enabled userspace slot no longer passes. The empty bitmap case is handled.
  3. 3611b2c: dcp_swap_started() puts a null layer in the indicator slot on the next H17P present, including wake and brightness replays. The framebuffer is released only after that null update completes, and the host test covers it.

None of the three adds a gate, module param or loop. From our side this is READY, pending dt-checks (still running) and our A18 Pro (J700) stream + blend CRC + s2idle row, which is queued.

@DjDeveloperr DjDeveloperr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks. ffba3cb closes all three points from my review, and I read each fix:

  • dcp_indicator_probe() now refuses any slot at or below find_last_bit() of the userspace slots, and an empty bitmap passes;
  • dcp_swap_started() nulls the indicator slot on the next H17P present, wake and brightness replays included, when no request wants it. The retained framebuffer is dropped only after that null update completes. Both paths return at once when the DCP has no indicator surface, so boards without the DT opt-in see no change;
  • apple,camera-indicator is in apple,isp.yaml and apple,t8140-isp.yaml.

All 20 commits are signed off, all eight checks are green on this head, and the base hasn't touched these files. Merging.

After the merge, with a revert ready: Ryan's A18 Pro (J700) row (stream cycles, the blend CRC back after stop, no backlight prepare -61 / swap failed!, s2idle with the camera running). #1744 stays open until that row is in.

@DjDeveloperr
DjDeveloperr merged commit abc6191 into aurora-silicon:integration/aurora Nov 20, 2026
8 checks passed
@DjDeveloperr

Copy link
Copy Markdown
Contributor

Merged as abc6191. Ryan's J700 row is the post-merge check, and a revert is ready if it fails. #1744 stays open until that row is in.

@RyanTheTide

Copy link
Copy Markdown
Contributor

J700 (MacBook Neo) post-merge row for this PR.

Short version: nothing breaks on J700 and the off path from #1744 is fixed. But with GNOME on the panel, the indicator does not reach the screen. The DCP blends slot 2 only where the primary surface is transparent. GNOME's primary is opaque AR30, so the square stays hidden under the desktop. The J700 opt-in (#1758) should wait for a fix. Nothing here needs a revert: without the DT opt-in this code stays inactive on J700 (dcp_indicator_probe() returns early and the ISP phandle lookup finds nothing).

Setup: fleet kernel base (integration/aurora e00fb9a) plus only this PR's 20 commits, cherry-picked (diff line-identical to the merge). The J700 opt-in properties from #1758 were added at boot through the DTB, and the live DT differed from production by exactly those two properties: apple,camera-indicator-surface = <2> on dcp@412e00000 and apple,camera-indicator = <&dcp> on isp@320000000. apple,iomfb-surfaces = <0>. GNOME 51 (Wayland) on the internal panel. One-shot boot, the rest of the stack production.

Passes

  • Probe: best-effort software camera indicator via the DCP logged. The reserved plane is plane 41 on the eDP CRTC.
  • Stream: /dev/video0, 150 frames, rc=0.
  • On/off cycles: 15/15. The 48x48 framebuffer is on plane 41 (2348,12, zpos 1) during each stream and gone within 0.5 s of the stream stopping. The stream never depends on the indicator.
  • s2idle x2, stream running across the sleep (rtc0 apple-pmu-rtc, 15 s): both wakes OK and the stream survives each one. The indicator plane is back 1 s after resume and gone after stop. A fresh stream after each wake gives rc=0.
  • Off path: 0 swap failed / present dropped / backlight prepare lines on the whole boot ([Joshua's agent] drm/apple, isp: best-effort software camera indicator (draft, unbooted) #1744 dropped every off swap on this panel). The blend CRC returns to the exact pre-stream values after stop (see below).
  • 0 AVC, 0 oops/WARN, 0 failed units.

Fails

  1. The square is not visible over GNOME. The DCP blend CRC (DRM CRC source auto) under GNOME is identical with and without the indicator in 3 of 3 rounds (S0 = Son, 2/2 CRCs overlap). The indicator's own swap also gives the same CRC as the frame before it. With gdm stopped and modetest page-flipping the primary, the result depends only on the primary's format:

    primary (modetest -v, two flip buffers) CRCs changed while the indicator is up after stop
    XR24 (X byte written as 0) 2/2 back to the exact pre-stream values
    AR24 (smpte buffer alpha 0xff, plain buffer alpha 0x77) 1/2: only the semi-transparent buffer back to exact
    AR30 (GNOME's format) 0/2 unchanged
    GNOME 51, AR30 0/2 (3 rounds) unchanged

    So slot 2 is composited below the primary (or only through its alpha), not over it. Either way it is invisible over an opaque desktop. On fleet76 without this PR, a stream does not change the CRC at all (control row), so the changes above come from the indicator.

  2. DPMS: turn the panel off during a stream and back on (Mutter PowerSaveMode 3, then 0) and the indicator does not come back for the rest of that stream (shown on=1, off=0, back on=0 after 4 s). The stream continues (rc=0). Resume from s2idle does restore it, so the DPMS-on path seems to miss the re-show that the resume path has.

Still to check: what decides layer order on this firmware before #1758 lands, and whether the indicator could take a slot that stacks above slot 0. That conflicts with the "above every userspace slot" rule in 44b7d56. Happy to rerun the same rows on a new head: the kit takes about 25 minutes.

Raw rows
PRE dt: dcp surface=00000002 isp->dcp=0000005f dcp phandle=0000005f
BASE stream 150 frames rc=0 ms=6102
CYCLES 5 indicator_ok=5 other=0 ; CYCLES 10 indicator_ok=10 other=0
CRC R1 S0 0xea9b646a 0x0e90f423 | Son(shown=1) 0xea9b646a 0x0e90f423 | Soff(shown=0) 0xea9b646a 0x0e90f423
CRC R2 S0 0x9c71d018 0x787a4051 | Son(shown=1) 0x787a4051 0x9c71d018 | Soff(shown=0) 0x9c71d018 0x787a4051
CRC R3 S0 0xa75de5e2 0x435675ab | Son(shown=1) 0xa75de5e2 0x435675ab | Soff(shown=0) 0xa75de5e2 0x435675ab
DPMS stream rc=0 shown on=1 dpms-off=0 back-on=0 after-stop=0
SLEEP freeze 1 rtc=rtc0 rc=0 success+=1 fail+=0 shown_before=1 shown_after_resume=1 back_in=1s stream_alive=y/y
  after stop shown=0 | fresh stream 60 after the wake rc=0
SLEEP freeze 2 rtc=rtc0 rc=0 success+=1 fail+=0 shown_before=1 shown_after_resume=1 back_in=1s stream_alive=y/y
  after stop shown=0 | fresh stream 60 after the wake rc=0
POST avc=0 failed=0 oops=0; indicator/swap warning lines: 0 (only the probe notice)

modetest -s 49@47:2408x1506[@fmt] -v, gdm stopped, 2 s of CRCs per phase (~120 swaps):
XR24 primary: 0x84e216b4 0x3941a5b7 | stream(shown=1): 0x342e51fb 0x74e60243 | after stop: 0x84e216b4 0x3941a5b7
AR30 primary: 0xcd3a8e1b 0x23d2f1f9 | stream(shown=1): 0xcd3a8e1b 0x23d2f1f9 | after stop: 0xcd3a8e1b 0x23d2f1f9
AR24 primary: 0xe1627f70 0x9c79c8de | stream(shown=1): 0xe9e5a6d6 0xe1627f70 | after stop: 0xe1627f70 0x9c79c8de

control, fleet76 without this PR, GNOME: S0 0x63f12519 0x87fab550 | stream 0x87fab550 0x63f12519 (no change)

Plane state with the indicator up: plane 41 on crtc 47, fb 48x48 AR24, crtc-pos 48x48+2348+12, normalized-zpos 1; primary plane 35 is GNOME's 2408x1506 AR30 at zpos 0. Each ISP stream went to /dev/null; no frames were kept.

@RyanTheTide

Copy link
Copy Markdown
Contributor

J700 (MacBook Neo) rows for the surface probe Joshua's agent asked for: apple,camera-indicator-surface moved from 2 to 1, nothing else changed.

Short version: with slot 1 the indicator reaches the panel over an opaque primary. Both rows pass. After DPMS on, the dot comes back on screen, but the kernel's plane state no longer has it.

Setup: the same kit as the slot-2 row above. Same kernel source (integration/aurora e00fb9a plus this PR's 20 commits), rebuilt with the same config, no module or kernel change. The boot DTB differs from production only by apple,camera-indicator-surface = <1> on dcp@412e00000 and apple,camera-indicator = <&dcp> on isp@320000000. The image differs from the slot-2 run by exactly one byte. apple,iomfb-surfaces = <0>, so the compositor primary stays on slot 0. One-shot boot, the rest of the stack production.

Row 1, opaque AR30 primary, blend CRC with the indicator off / on / off: PASS 3/3. gdm was stopped and modetest page-flipped an AR30 primary. Each phase took 2 s of CRCs (~120 swaps). The CRC changes while the indicator is up and comes back exactly after stop, the same in all three runs. With slot 2 the same primary gave the same CRCs and no change at all. Under GNOME (AR30 desktop) the CRC also changes while the indicator is up and comes back exactly after stop, 2/2.

Row 2, DPMS off/on (Mutter PowerSaveMode 3 then 0) during a camera stream: PASS on the panel, 3/3. The display comes back: CRC frames flow, the backlight is back, the stream stays alive. The CRC after DPMS on matches the CRC of a fresh stream with the indicator up. It does not match the no-indicator CRC taken right after the stream stops. In run 1 that stop CRC was also exactly the pre-stream CRC. The cursor was parked for every sample.

One thing to look at: after DPMS on, the 48x48 framebuffer is gone from plane 41 in the DRM atomic state, so the kernel thinks the indicator is off (0 of 10 one-second polls, in all six DPMS rounds). This matches the code comment that a plane disabled together with its CRTC is left alone. So the dot on screen after DPMS on looks like the DCP's retained slot-1 layer, not a new commit from the kernel. The off swap at stream stop still clears it. Untested so far: a stream that stops while the display is off, then DPMS on. If the retained layer comes back in that case, the dot would show with the camera off. We can run that next.

Also on this boot: probe notice logged, 150-frame stream rc=0, 3/3 on/off cycles, 0 swap failed / present dropped lines, 0 AVC, 0 oops, 0 failed units.

Our earlier slot-2 DPMS row used only the plane state, so it would have reported "not re-shown" in this case too.

Raw rows
PRE dt: dcp surface=00000001 isp->dcp=0000005f dcp phandle=0000005f
PRE trial boot, Enforcing, avc=0 failed=0
BASE stream 150 frames rc=0 ms=6099
CYCLES 3 indicator_ok=3 other=0

Row 1, modetest -s 49@47:2408x1506@AR30 -v, gdm stopped (3 runs, identical):
AR30 primary: 0xcd3a8e1b 0x23d2f1f9 | stream(shown=1): 0x2b49a756 0x08da7266 | after stop(shown=0): 0xcd3a8e1b 0x23d2f1f9
slot 2, same primary (earlier row): 0xcd3a8e1b 0x23d2f1f9 | stream(shown=1): 0xcd3a8e1b 0x23d2f1f9 | after stop: same
XR24 control: 0x84e216b4 0x3941a5b7 | stream(shown=1): 0xa57c44da 0x1fcce491 | after stop: 0x84e216b4 0x3941a5b7

GNOME (AR30 desktop), cursor parked:
CRC R1 S0 0xe92f1285 0x0d2482cc | Son(shown=1) 0x571cea40 0xb3177a09 | Soff(shown=0) 0xe92f1285 0x0d2482cc
CRC R2 S0 0x0c7c41f7 0xe877d1be | Son(shown=1) 0xb24fb932 0x5644297b | Soff(shown=0) 0xe877d1be 0x0c7c41f7

Row 2, GNOME, stream running, cursor parked; shown = 48x48 fb on plane 41 in the DRM state:
run  pre(no stream)          on(shown=1)             DPMS on, 10 s (shown=0x10)  stop(shown=0)           fresh stream(shown=1)
1    0x26477045 0xc24ce00c   0x98748880 0x7c7f18c9   0x98748880 0x7c7f18c9       0xc24ce00c 0x26477045   0x98748880 0x7c7f18c9
2    0xddbd7ce4 0x39b6ecad   0x87851468 0x638e8421   0xfedfb94e 0x1ad42907       0x40ec418b 0xa4e7d1c2   0xfedfb94e 0x1ad42907
3    0x56570a26 0xb25c9a6f   0xe864f2e3 0x0c6f62aa   0xff877a75 0x1b8cea3c       0xa5bf12f9 0x41b482b0   0xff877a75 0x1b8cea3c
(runs 2 and 3: the desktop changed during the DPMS cycle, so pre != stop and on != DPMS-on; in all three, DPMS-on == fresh stream with the indicator and != stop)
psm get 3 while off, 0 after; bl 20/525 after DPMS on; DCP power off -> on logged each round; stream alive after DPMS on: y (6/6)

POST avc=0 failed=0 oops=0; indicator/swap warning lines: 0 (only the probe notice)

Each ISP stream went to /dev/null; no frames were kept.

@RyanTheTide

Copy link
Copy Markdown
Contributor

J700 (MacBook Neo) rows for the case left open in the surface-1 probe: the camera changes state while the display is off.

Short version: the kernel side is right in both directions. When the camera stops while the display is off, the indicator is gone after DPMS on. When it starts while the display is off, the indicator is there after DPMS on. I could not get a clean CRC proof of "no stale dot on the glass", because GNOME's screen doesn't settle after a DPMS cycle.

Setup: the same kernel as the surface-1 probe (fleet76 + this PR's commits, same config), the same DTB-only trial (apple,camera-indicator-surface = <1>, ISP apple,camera-indicator = <&dcp>), GNOME session. DPMS through Mutter PowerSaveMode 3/0. "In plane state" means /sys/kernel/debug/dri/1/state holds the 48x48 indicator fb, polled every second for 8 s after DPMS on.

row result
A: stream on, DPMS off, camera stops while dark, DPMS on indicator out of plane state at the stop and still out for 8 s after DPMS on: 8/8
B: DPMS off, camera starts while dark, DPMS on, then stop out while dark, in plane state every second for 8 s after DPMS on: 8/8; stream alive 8/8
  • One IOMFB: power on -> off and one off -> on per cycle; 0 swap failed, 0 present dropped, 0 oops/WARN, 0 AVC.
  • B is the opposite of the earlier DPMS row, where the stream ran across the DPMS cycle. There, plane state lost the indicator fb after DPMS on while the dot stayed on the glass.
CRC detail (inconclusive), and what would settle it
  • After a DPMS cycle, two no-camera blend CRCs taken a few seconds apart differed in 5/5 rounds, with screen lock off and the cursor parked. So a full-frame CRC can't separate a stale dot from GNOME redrawing.
  • First run, comparing within each round: the CRC after A (camera stopped while dark) equalled the CRC after B's stop in 3/3 rounds, and B with the camera on differed from both. That is consistent with no stale dot, but it isn't proof.
  • A static fbcon screen (gdm stopped) gives no CRC on this kernel: there is no fbdev, so nothing presents. modetest can't toggle DPMS while it holds master. A settled CRC proof would need a small KMS client that owns master, page-flips a static AR30 primary and toggles DPMS itself.
  • Rows script: dark3.sh (A/B per round, post-DPMS references). Evidence and logs are on our side; they are our own measurements.

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.

3 participants