Skip to content

viewer: fix post-processing filter controls reverting to default value - #15330

Merged
Nir-Az merged 4 commits into
realsenseai:developmentfrom
Nir-Az:fix-postproc-sync-revert
Jul 2, 2026
Merged

Nir-Az merged 4 commits into
realsenseai:developmentfrom
Nir-Az:fix-postproc-sync-revert

Conversation

@Nir-Az

@Nir-Az Nir-Az commented Jun 30, 2026

Copy link
Copy Markdown
Collaborator

Overview: In the viewer, setting a post-processing filter control (e.g. decimation magnitude, rotation) applied the effect but the control snapped back to its previous value; it now stays at the value the user set.

Tracked on [RSDEV-12488], [RSDEV-12502]

Why

Regression from PR #15029 (viewer-ui-exp-change-avoid-stream-pause), which routed all viewer option writes through the async dispatcher. That async path exists to avoid blocking the UI thread on the FW round-trip — but it never refreshes the control's cached value, relying on the sensor's on_options_changed echo to do so. Software post-processing filters run in-process and emit no such echo, so after the ~2 s user-request mask expired the control reverted to its stale cached value (decimation magnitude → 2, rotation → 0) even though the effect was applied.

Summary

  • Software post-processing filter options (processing_block_model) now write synchronously via set_option, which reads the value back so the control reflects what was applied. FW/sensor options keep the async path.
  • These filters have no FW round-trip, so a synchronous write can't freeze the UI; an integer-stepped slider only fires a handful of writes per drag. No throttle/timer needed (the pre-async throttle was an FW-round-trip mitigation).
  • Added a write_value() helper in option_model that routes by a write_synchronously flag; the flag is set for processing-block options.

Test plan

  • New viewer UI test controls/post_processing_value_persists: streams depth, enables post-processing + decimation, sets magnitude to a non-default value, and asserts the cached control value tracks the applied value. Verified on D455 — passes with the fix, fails when the option is forced back onto the async path.
  • Added post-processing panel navigation helpers to the viewer test harness.
  • LibCI run.

🤖 Generated by AI

@Nir-Az
Nir-Az requested a review from remibettan June 30, 2026 16:17
Comment thread common/option-model.cpp Resolved
Comment thread common/option-model.cpp Resolved
Comment thread common/option-model.h Resolved
Comment thread common/processing-block-model.cpp Resolved

@remibettan remibettan 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.

Few comments

Comment thread common/option-model.cpp Resolved
Comment thread common/option-model.cpp Resolved
…te invalidate on success, harden viewer test helper

@sysrsbuild-gh-agentic sysrsbuild-gh-agentic left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Reviewed the synchronize commit (). The three previously unresolved review threads (stopwatch reset, gated invalidate, hardened helper) are all addressed by this push — good. Two new observations below.\n\n🤖 Auto-generated comment by rs-agentic bot

Comment thread common/option-model.cpp Resolved
@Nir-Az
Nir-Az requested a review from remibettan July 1, 2026 16:25
@sysrsbuild-gh-agentic

Copy link
Copy Markdown
Collaborator

rs-agentic bot — synchronize review (commit a42a490)

change approved — previous bot comment threads

The commit a42a490 ("viewer: scope invalidate gate to a local error buffer, fix stale test comment") fully addresses both outstanding bot comment threads:

1. Stale error_message can suppress invalidation on a successful write

The write_value implementation now uses a local write_error buffer — a stale error from a prior option's draw in the same frame can no longer suppress the invalidate on a successful write.
change approved ✅

2. Misleading test comment — "async wait"

The wait_until comment in test-post-processing-revert.cpp now correctly reads:
"Software-filter writes are synchronous, so the value is already applied by the time set_post_processing_value returns; this poll is just a defensive safety net."
No misleading suggestion of an async wait. change approved ✅


New-commit review — no new issues found

The four commits in this PR are clean:

  • option-model.cpp — write_value properly resets dev->last_user_set_stopwatch, uses the local error buffer, and gates *invalidate_flag on write success only. Logic is consistent with the set_option_async contract.
  • processing-block-model.cpp — get_option_model uses find+iterator correctly (single lookup). write_synchronously = true is set before map insertion.
  • viewer-test-helpers.cpp/h — Refactoring of set/get_value_by_seed is clean. enable_post_processing_filter correctly calls enable_post_processing first so is_enabled() reflects the master+per-filter combined state.
  • test-post-processing-revert.cpp — Test picks a target that differs from the persisted value, uses wait_until defensively, and handles no-device case gracefully.

🤖 Auto-generated comment by rs-agentic bot

@remibettan remibettan 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.

LGTM

@Nir-Az
Nir-Az merged commit cf8648a into realsenseai:development Jul 2, 2026
28 of 29 checks passed
Nir-Az added a commit that referenced this pull request Jul 2, 2026
@Nir-Az
Nir-Az deleted the fix-postproc-sync-revert branch July 2, 2026 10:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants