''Review supported by Claude Code'' Control flow logic was scrutinised, and a race identified in the solution to pass on the display action to the GUI thread. Reconsidering the design, cross-thread synchronisation is now hinged rather on a single atomic buffer pointer, where the GUI thread notifies back completion of display work by setting that pointer to NULL. Overall this simplifies the control logic ---- As an aside, I setup an outline of topics for documentation in `DemoSpec.txt` and then instructed Claude to fill in the paragraphs, based on insight gained as part of the code validation / review. Furthermore, I requested to generate some diagrams that could be useful later when preparting the presentation
123 lines
8.4 KiB
XML
123 lines
8.4 KiB
XML
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
|
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
|
|
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
|
<!-- Generated by graphviz version 2.42.4 (0)
|
|
-->
|
|
<!-- Title: handoff Pages: 1 -->
|
|
<svg width="728pt" height="352pt"
|
|
viewBox="0.00 0.00 728.00 352.00" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 348)">
|
|
<title>handoff</title>
|
|
<g id="clust1" class="cluster">
|
|
<title>cluster_proactor</title>
|
|
<path fill="#eef4ff" stroke="#7092c0" d="M241.5,-143C241.5,-143 688,-143 688,-143 694,-143 700,-149 700,-155 700,-155 700,-324 700,-324 700,-330 694,-336 688,-336 688,-336 241.5,-336 241.5,-336 235.5,-336 229.5,-330 229.5,-324 229.5,-324 229.5,-155 229.5,-155 229.5,-149 235.5,-143 241.5,-143"/>
|
|
<text text-anchor="middle" x="361" y="-322.4" font-family="sans-serif" font-size="12.00">  »Proactor« thread  —  playVideo() loop  </text>
|
|
</g>
|
|
<g id="clust2" class="cluster">
|
|
<title>cluster_gui</title>
|
|
<path fill="#eefaee" stroke="#6bab6b" d="M205,-8C205,-8 700,-8 700,-8 706,-8 712,-14 712,-20 712,-20 712,-69 712,-69 712,-75 706,-81 700,-81 700,-81 205,-81 205,-81 199,-81 193,-75 193,-69 193,-69 193,-20 193,-20 193,-14 199,-8 205,-8"/>
|
|
<text text-anchor="middle" x="258.5" y="-67.4" font-family="sans-serif" font-size="12.00">  GTK / GUI thread  </text>
|
|
</g>
|
|
<!-- file -->
|
|
<g id="node1" class="node">
|
|
<title>file</title>
|
|
<path fill="#eeeeee" stroke="black" d="M101,-216.73C101,-218.53 78.37,-220 50.5,-220 22.63,-220 0,-218.53 0,-216.73 0,-216.73 0,-187.27 0,-187.27 0,-185.47 22.63,-184 50.5,-184 78.37,-184 101,-185.47 101,-187.27 101,-187.27 101,-216.73 101,-216.73"/>
|
|
<path fill="none" stroke="black" d="M101,-216.73C101,-214.92 78.37,-213.45 50.5,-213.45 22.63,-213.45 0,-214.92 0,-216.73"/>
|
|
<text text-anchor="middle" x="50.5" y="-199.2" font-family="sans-serif" font-size="11.00">demovideo.raw</text>
|
|
</g>
|
|
<!-- ring -->
|
|
<g id="node4" class="node">
|
|
<title>ring</title>
|
|
<polygon fill="#ffffff" stroke="black" points="237.5,-152 237.5,-252 379.5,-252 379.5,-152 237.5,-152"/>
|
|
<text text-anchor="middle" x="308.5" y="-239.2" font-family="sans-serif" font-size="11.00">ring buffers (RING_SIZ)</text>
|
|
<polyline fill="none" stroke="black" points="237.5,-232 379.5,-232 "/>
|
|
<text text-anchor="middle" x="308.5" y="-219.2" font-family="sans-serif" font-size="11.00">slot</text>
|
|
<polyline fill="none" stroke="black" points="237.5,-212 379.5,-212 "/>
|
|
<text text-anchor="middle" x="308.5" y="-199.2" font-family="sans-serif" font-size="11.00">slot</text>
|
|
<polyline fill="none" stroke="black" points="237.5,-192 379.5,-192 "/>
|
|
<text text-anchor="middle" x="308.5" y="-179.2" font-family="sans-serif" font-size="11.00">slot</text>
|
|
<polyline fill="none" stroke="black" points="237.5,-172 379.5,-172 "/>
|
|
<text text-anchor="middle" x="308.5" y="-159.2" font-family="sans-serif" font-size="11.00">…</text>
|
|
</g>
|
|
<!-- file->ring -->
|
|
<g id="edge1" class="edge">
|
|
<title>file->ring</title>
|
|
<path fill="none" stroke="black" d="M101.16,-202C136.89,-202 185.86,-202 227.12,-202"/>
|
|
<polygon fill="black" stroke="black" points="219.5,-205.5 229.5,-202 219.5,-198.5 219.5,-205.5"/>
|
|
<text text-anchor="middle" x="151" y="-205" font-family="sans-serif" font-size="10.00">io_uring read</text>
|
|
</g>
|
|
<!-- wait -->
|
|
<g id="node2" class="node">
|
|
<title>wait</title>
|
|
<path fill="#ffffff" stroke="black" d="M680,-307C680,-307 582,-307 582,-307 576,-307 570,-301 570,-295 570,-295 570,-283 570,-283 570,-277 576,-271 582,-271 582,-271 680,-271 680,-271 686,-271 692,-277 692,-283 692,-283 692,-295 692,-295 692,-301 686,-307 680,-307"/>
|
|
<text text-anchor="middle" x="631" y="-292.2" font-family="sans-serif" font-size="11.00">io_uring_wait_cqe()</text>
|
|
<text text-anchor="middle" x="631" y="-280.2" font-family="sans-serif" font-size="11.00">(blocking)</text>
|
|
</g>
|
|
<!-- timer -->
|
|
<g id="node3" class="node">
|
|
<title>timer</title>
|
|
<path fill="#ffedcc" stroke="black" d="M353,-307C353,-307 264,-307 264,-307 258,-307 252,-301 252,-295 252,-295 252,-283 252,-283 252,-277 258,-271 264,-271 264,-271 353,-271 353,-271 359,-271 365,-277 365,-283 365,-283 365,-295 365,-295 365,-301 359,-307 353,-307"/>
|
|
<text text-anchor="middle" x="308.5" y="-292.2" font-family="sans-serif" font-size="11.00">frame-beat timer</text>
|
|
<text text-anchor="middle" x="308.5" y="-280.2" font-family="sans-serif" font-size="11.00">20 ms · multishot</text>
|
|
</g>
|
|
<!-- timer->wait -->
|
|
<g id="edge2" class="edge">
|
|
<title>timer->wait</title>
|
|
<path fill="none" stroke="black" stroke-dasharray="1,5" d="M365.33,-289C419.3,-289 501.26,-289 559.66,-289"/>
|
|
<polygon fill="black" stroke="black" points="559.92,-292.5 569.92,-289 559.92,-285.5 559.92,-292.5"/>
|
|
<text text-anchor="middle" x="487" y="-292" font-family="sans-serif" font-size="10.00">CQE (TICK_TAG)</text>
|
|
</g>
|
|
<!-- baton -->
|
|
<g id="node7" class="node">
|
|
<title>baton</title>
|
|
<polygon fill="#e7d8ff" stroke="black" stroke-width="1.6" points="698.5,-131 563.5,-131 563.5,-95 698.5,-95 698.5,-131"/>
|
|
<text text-anchor="middle" x="631" y="-116.2" font-family="sans-serif" font-size="11.00">toDisplay_</text>
|
|
<text text-anchor="middle" x="631" y="-104.2" font-family="sans-serif" font-size="11.00">std::atomic<Buffer*></text>
|
|
</g>
|
|
<!-- ring->baton -->
|
|
<g id="edge3" class="edge">
|
|
<title>ring->baton</title>
|
|
<path fill="none" stroke="#5a2ca0" d="M379.84,-182.47C431.79,-168.04 502.39,-148.44 555.34,-133.73"/>
|
|
<polygon fill="#5a2ca0" stroke="#5a2ca0" points="556.31,-137.09 565.01,-131.05 554.44,-130.35 556.31,-137.09"/>
|
|
<text text-anchor="middle" x="487" y="-179" font-family="sans-serif" font-size="10.00" fill="#5a2ca0">publish</text>
|
|
<text text-anchor="middle" x="487" y="-168" font-family="sans-serif" font-size="10.00" fill="#5a2ca0">store(release)</text>
|
|
</g>
|
|
<!-- disp -->
|
|
<g id="node5" class="node">
|
|
<title>disp</title>
|
|
<path fill="#ffffff" stroke="black" d="M404,-52C404,-52 213,-52 213,-52 207,-52 201,-46 201,-40 201,-40 201,-28 201,-28 201,-22 207,-16 213,-16 213,-16 404,-16 404,-16 410,-16 416,-22 416,-28 416,-28 416,-40 416,-40 416,-46 410,-52 404,-52"/>
|
|
<text text-anchor="middle" x="308.5" y="-37.2" font-family="sans-serif" font-size="11.00">EglDisplay::displayFrame()</text>
|
|
<text text-anchor="middle" x="308.5" y="-25.2" font-family="sans-serif" font-size="11.00">retrieveFrame() / completedFrame()</text>
|
|
</g>
|
|
<!-- gpu -->
|
|
<g id="node6" class="node">
|
|
<title>gpu</title>
|
|
<path fill="#ffffff" stroke="black" d="M692,-52C692,-52 570,-52 570,-52 564,-52 558,-46 558,-40 558,-40 558,-28 558,-28 558,-22 564,-16 570,-16 570,-16 692,-16 692,-16 698,-16 704,-22 704,-28 704,-28 704,-40 704,-40 704,-46 698,-52 692,-52"/>
|
|
<text text-anchor="middle" x="631" y="-37.2" font-family="sans-serif" font-size="11.00">GPU texture</text>
|
|
<text text-anchor="middle" x="631" y="-25.2" font-family="sans-serif" font-size="11.00">(glTexImage2D → draw)</text>
|
|
</g>
|
|
<!-- disp->gpu -->
|
|
<g id="edge5" class="edge">
|
|
<title>disp->gpu</title>
|
|
<path fill="none" stroke="black" d="M416.22,-34C458.94,-34 507.39,-34 547.35,-34"/>
|
|
<polygon fill="black" stroke="black" points="547.58,-37.5 557.58,-34 547.58,-30.5 547.58,-37.5"/>
|
|
<text text-anchor="middle" x="487" y="-37" font-family="sans-serif" font-size="10.00">upload + draw</text>
|
|
</g>
|
|
<!-- disp->baton -->
|
|
<g id="edge6" class="edge">
|
|
<title>disp->baton</title>
|
|
<path fill="none" stroke="#3a7a3a" stroke-dasharray="5,2" d="M341.45,-52.07C365.99,-65.08 401.13,-81.88 434,-91 472.45,-101.67 516.52,-107.18 553.11,-110.02"/>
|
|
<polygon fill="#3a7a3a" stroke="#3a7a3a" points="553,-113.52 563.22,-110.76 553.5,-106.54 553,-113.52"/>
|
|
<text text-anchor="middle" x="487" y="-122" font-family="sans-serif" font-size="10.00" fill="#3a7a3a">completedFrame</text>
|
|
<text text-anchor="middle" x="487" y="-111" font-family="sans-serif" font-size="10.00" fill="#3a7a3a">store(nullptr, release)</text>
|
|
</g>
|
|
<!-- baton->disp -->
|
|
<g id="edge4" class="edge">
|
|
<title>baton->disp</title>
|
|
<path fill="none" stroke="#5a2ca0" d="M577.04,-94.93C570.45,-91.95 563.95,-88.64 558,-85 548.87,-79.42 549.69,-73.55 540,-69 519.39,-59.33 472.38,-51.4 426.16,-45.55"/>
|
|
<polygon fill="#5a2ca0" stroke="#5a2ca0" points="426.36,-42.05 416.01,-44.29 425.5,-48.99 426.36,-42.05"/>
|
|
<text text-anchor="middle" x="487" y="-83" font-family="sans-serif" font-size="10.00" fill="#5a2ca0">retrieveFrame</text>
|
|
<text text-anchor="middle" x="487" y="-72" font-family="sans-serif" font-size="10.00" fill="#5a2ca0">load(acquire)</text>
|
|
</g>
|
|
</g>
|
|
</svg>
|