Closed Bug 1863914 Opened 7 months ago Closed 6 months ago

Use multiple shmems for remote canvas recording and translation.

Categories

(Core :: Graphics: Canvas2D, enhancement, P1)

enhancement

Tracking

()

RESOLVED FIXED
122 Branch
Tracking Status
firefox122 --- fixed

People

(Reporter: bobowen, Assigned: bobowen)

References

(Blocks 1 open bug, Regressed 2 open bugs)

Details

(Whiteboard: [sp3])

Attachments

(1 file)

This change has been broken out from bug 1850775, as we may not need to land the other parts.

It changes the recording and playback of remote canvas 2D drawing to use multiple shmems instead of a single ring buffer.
A default size of buffer is used and recycled. If a drawing event will not fit inside a default buffer a one off buffer is created.

A single buffer large enough for the largest canvas is created and reused for readback, this appears sufficient, because generally when the canvas code needs a DataSourceSurface it is used immediately then released.

This replaces the use of a single large ring buffer.
The buffers are still processed in parallel and are recycled to reduce
allocation. Events that do not fit in the default sized buffer have a separate
buffer created to fit them. These large buffers are not recycled.
Separate shared memory is used for readback, with a single shmem cached for this
purpose. Generally only one cached shmem should be required, because the
operations that usually readback the data do it straight away.

Assignee: nobody → bobowencode
Whiteboard: [sp3]
Pushed by bobowencode@gmail.com:
https://hg.mozilla.org/integration/autoland/rev/2b56c2b2837a
Use multiple shmem buffers for remote canvas recording. r=aosmond

Backed out for causing bustage on CanvasDrawEventRecorder.h

[task 2023-11-22T14:01:51.411Z] 14:01:51     INFO -  In file included from /builds/worker/workspace/obj-build/dist/include/mozilla/layers/CanvasTranslator.h:16,
[task 2023-11-22T14:01:51.412Z] 14:01:51     INFO -                   from /builds/worker/checkouts/gecko/gfx/ipc/CanvasManagerParent.cpp:14,
[task 2023-11-22T14:01:51.412Z] 14:01:51     INFO -                   from Unified_cpp_gfx_ipc0.cpp:11:
[task 2023-11-22T14:01:51.413Z] 14:01:51    ERROR -  /builds/worker/workspace/obj-build/dist/include/mozilla/layers/CanvasDrawEventRecorder.h:60:25: error: member 'mozilla::Atomic<long int> mozilla::layers::CanvasDrawEventRecorder::Header::<unnamed union>::<unnamed struct>::eventCount' with constructor not allowed in anonymous aggregate
[task 2023-11-22T14:01:51.413Z] 14:01:51     INFO -           Atomic<int64_t> eventCount;
[task 2023-11-22T14:01:51.413Z] 14:01:51     INFO -                           ^~~~~~~~~~
[task 2023-11-22T14:01:51.413Z] 14:01:51    ERROR -  /builds/worker/workspace/obj-build/dist/include/mozilla/layers/CanvasDrawEventRecorder.h:61:25: error: member 'mozilla::Atomic<long int> mozilla::layers::CanvasDrawEventRecorder::Header::<unnamed union>::<unnamed struct>::writerWaitCount' with constructor not allowed in anonymous aggregate
[task 2023-11-22T14:01:51.414Z] 14:01:51     INFO -           Atomic<int64_t> writerWaitCount;
[task 2023-11-22T14:01:51.414Z] 14:01:51     INFO -                           ^~~~~~~~~~~~~~~
[task 2023-11-22T14:01:51.414Z] 14:01:51    ERROR -  /builds/worker/workspace/obj-build/dist/include/mozilla/layers/CanvasDrawEventRecorder.h:62:23: error: member 'mozilla::Atomic<mozilla::layers::CanvasDrawEventRecorder::State> mozilla::layers::CanvasDrawEventRecorder::Header::<unnamed union>::<unnamed struct>::writerState' with constructor not allowed in anonymous aggregate
[task 2023-11-22T14:01:51.415Z] 14:01:51     INFO -           Atomic<State> writerState;
[task 2023-11-22T14:01:51.415Z] 14:01:51     INFO -                         ^~~~~~~~~~~
Flags: needinfo?(bobowencode)

We are seeing an issue in bug 1829026 where I believe (based on printf debugging) the reader is waiting to read because it has an incomplete recorded object, and the writer is waiting for the buffer to be drained. We see the recording bail with a bad stream as a result of the timeouts. I am not certain but I believe we are hitting this path to write a partial object:
https://searchfox.org/mozilla-central/rev/16526d690cccc9c60cacf09cc08e2c3041ef884e/gfx/2d/RecordedEvent.h#249

In theory the patch in this bug should resolve that because it no longer writes partial objects:
https://hg.mozilla.org/integration/autoland/rev/2b56c2b2837a#l4.82

Pushed by bobowencode@gmail.com:
https://hg.mozilla.org/integration/autoland/rev/71b6060b6015
Use multiple shmem buffers for remote canvas recording. r=aosmond
Status: ASSIGNED → RESOLVED
Closed: 6 months ago
Resolution: --- → FIXED
Target Milestone: --- → 122 Branch
Regressions: 1868934
Status: RESOLVED → REOPENED
Flags: needinfo?(bobowencode)
Resolution: FIXED → ---
Target Milestone: 122 Branch → ---
Backout by sstanca@mozilla.com:
https://hg.mozilla.org/mozilla-central/rev/31a6430ad25b
Backed out changeset 71b6060b6015 for causing Bug 1868934. a=backout
Flags: needinfo?(bobowencode)
Pushed by bobowencode@gmail.com:
https://hg.mozilla.org/integration/autoland/rev/8839a3ba6243
Use multiple shmem buffers for remote canvas recording. r=aosmond
Regressions: 1869085
Status: REOPENED → RESOLVED
Closed: 6 months ago6 months ago
Resolution: --- → FIXED
Target Milestone: --- → 122 Branch
Regressions: 1869658
Regressions: 1869659
Regressions: 1869661
Regressions: 1869822
Regressions: 1870281
No longer regressions: 1870281
Regressions: 1870681
Regressions: 1870683
Regressions: 1870869
Regressions: 1872705
Regressions: 1873588
Regressions: 1873790
Regressions: 1884493
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: