Skip to content

spu: clear the whole CD capture buffers on reset - #2474

Merged
rixnobis merged 1 commit into
grumpycoders:mainfrom
rixnobis:spu-capbuf-memset
Oct 23, 2026
Merged

rixnobis merged 1 commit into
grumpycoders:mainfrom
rixnobis:spu-capbuf-memset

Conversation

@rixnobis

Copy link
Copy Markdown
Contributor

resetCaptureBuffer passed CaptureBuffer::CB_SIZE to memset, but CDCapLeft/CDCapRight are uint16_t[CB_SIZE], so only the first half of each buffer was zeroed. GCC flags it with -Wmemset-elt-size. Use sizeof on the arrays instead.

The memset sizes were element counts on uint16_t arrays, so only the first half of each buffer was cleared.
@coderabbitai

coderabbitai Bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
📥 Commits

Reviewing files that changed from the base of the PR and between ac48a33 and 324edb0.

📒 Files selected for processing: 1
  • src/spu/dma.cc

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 2 remain after this review.

📝 Walkthrough

resetCaptureBuffer now uses each CD capture array’s own size when clearing it.

Changes: CD capture buffer reset

Layer / File(s) Summary
Array-sized capture buffer clears
src/spu/dma.cc
The left and right CD capture arrays are cleared using their respective sizes instead of CaptureBuffer::CB_SIZE.

Priority: ⬇️ Low

Estimated code review effort: 1 (Trivial) | ~5 minutes

Change: Bug fix

Suggested labels: size/M

Suggested reviewers: nicolasnoble

Merge Risk: ⚪ Minimal · up to 324ed

The capture-buffer reset change is ready to merge.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 1 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly states that the SPU reset now clears the complete CD capture buffers. It matches the main change.
Description check Passed The description accurately explains the partial clearing bug, the GCC warning, and the use of array-specific sizeof expressions.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@rixnobis
rixnobis merged commit 75f4fa3 into grumpycoders:main Oct 23, 2026
26 of 27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant