[RSDEV-13202][D585][gmsl] Render RGB calibration in RealSense Viewer - #15566
[RSDEV-13202][D585][gmsl] Render RGB calibration in RealSense Viewer#15566polejoe wants to merge 2 commits into
Conversation
Problem: D500 GMSL exposes native NV12 profiles, but the D500 color processing graph registered only YUYV, so NV12 was filtered from the SDK profile set. Semi-planar frames were also assigned a 12-bpp-derived row stride that did not match their byte-per-pixel plane layout. Fix: Register NV12 conversion and identity paths first for D500 MIPI while retaining YUYV fallback. Assign byte-row stride for NV12/M420 and expose their complete contiguous buffers through the Python buffer protocol. Validation: The Jetson ARM64 RelWithDebInfo full build passed, including pyrealsense2. D585 GMSL NV12 profile enumeration, 1280x960@60 capture, and Python buffer layout validation passed. Signed-off-by: zhou <shengyong.zhou@realsenseai.com>
Problem: The viewer treated every RAW16 stream as unsupported, and its generic texture fallback cleared the frame, so D500 GMSL RGB calibration profiles enumerated but rendered as a black unsupported stream. Fix: Identify D500 MIPI Color RAW16 as the RW16 GRBG10 calibration surface, label it accordingly, and render its little-endian 10-bit Bayer samples through a 2x2 GRBG-to-RGB preview. Other RAW16 devices keep the existing unsupported behavior. Validation: The Jetson ARM64 viewer target and full RelWithDebInfo build passed. Build-tree and system-installed viewers rendered RW16 at 1600x1300@25 without the unsupported overlay; the frame counter advanced continuously from 207 to 686 and the rendered region measured Y=16..235. Signed-off-by: zhou <shengyong.zhou@realsenseai.com>
sysrsbuild-gh-agentic
left a comment
There was a problem hiding this comment.
Automated review by rs-agentic bot — potential BUGs flagged inline below.
| { | ||
| if( ! raw16_grbg10 ) | ||
| { | ||
| memset( (void *)data, 0, height * width ); |
There was a problem hiding this comment.
🤖 [rs-agentic bot — auto generated] BUG: data is const void*; casting it away and writing via memset is undefined behaviour and can silently corrupt the frame buffer for any other consumer sharing the same data pointer. Use a separate local zero-filled buffer instead of mutating the input.
Also the size height * width is half the actual RAW16 frame size (height * width * 2 bytes); even ignoring the const issue, only half the buffer is being zeroed.
| auto bytes = static_cast< const uint8_t * >( data ); | ||
| for( int y = 0; y < height - 1; y += 2 ) | ||
| { | ||
| auto row0 = reinterpret_cast< const uint16_t * >( bytes + y * stride ); |
There was a problem hiding this comment.
🤖 [rs-agentic bot — auto generated] BUG: stride is used here but is not introduced in this diff. Please confirm it is already in scope inside the enclosing upload function — if not, this will not compile.
|
|
||
| std::string format = rs2_format_to_string(profile.format()); | ||
|
|
||
| // D500 MIPI exposes the RAW16 SDK format through the RW16 V4L2 fourcc. |
There was a problem hiding this comment.
🤖 [rs-agentic bot — auto generated] BUG: use_rw16_label relabels all RS2_FORMAT_RAW16 profiles on D500 MIPI (not just the color stream) to "RW16". This is inconsistent with the narrower guard in stream-model.cpp which also requires p.stream_type() == RS2_STREAM_COLOR. Add the same stream-type check here to avoid mislabeling unrelated RAW16 profiles.
Overview: Adds a color preview for D500 GMSL RW16 calibration streams in RealSense Viewer while preserving the existing unsupported behavior for unrelated RAW16 streams.
Tracked on [RSDEV-13202]
Depends on #15565
Why
D500 GMSL exposes the RGB calibration surface as RAW16 through the RW16 V4L2 format. RealSense Viewer treated every RAW16 stream as unsupported and cleared its preview, so the calibration profile appeared as a black stream.
Summary
Test plan
🤖 Generated by AI