Bug 223096 - [GPU Process] Encoding buffer for DisplayList items should be aligned to 8 bytes
Summary: [GPU Process] Encoding buffer for DisplayList items should be aligned to 8 bytes
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Canvas (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Said Abou-Hallawa
URL:
Keywords: InRadar
Depends on:
Blocks: 222835
  Show dependency treegraph
 
Reported: 2021-03-11 15:43 PST by Said Abou-Hallawa
Modified: 2021-03-11 21:57 PST (History)
6 users (show)

See Also:


Attachments
Patch (1.99 KB, patch)
2021-03-11 15:49 PST, Said Abou-Hallawa
no flags Details | Formatted Diff | Diff
Patch (1.88 KB, patch)
2021-03-11 16:14 PST, Said Abou-Hallawa
simon.fraser: review+
ews-feeder: commit-queue-
Details | Formatted Diff | Diff
Patch (2.06 KB, patch)
2021-03-11 17:14 PST, Said Abou-Hallawa
ews-feeder: commit-queue-
Details | Formatted Diff | Diff
Patch (2.06 KB, patch)
2021-03-11 17:55 PST, Said Abou-Hallawa
no flags Details | Formatted Diff | Diff
Patch (2.06 KB, patch)
2021-03-11 18:57 PST, Said Abou-Hallawa
ews-feeder: commit-queue-
Details | Formatted Diff | Diff
Patch (2.01 KB, patch)
2021-03-11 20:59 PST, Said Abou-Hallawa
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Said Abou-Hallawa 2021-03-11 15:43:33 PST
ItemBuffer::append() allocates a static buffer whose size = sizeof(DisplayList::Item) + uint64_t for the DisplayList::ItemType. But this static buffer is of type uint8_t. So this array should be aligned to the alignment of a single uint8_t which is 1.

The expectation is to have this buffer aligned to 8 bytes so all each member in the encoded DisplayList::Item can be aligned to its alignment requirement.

This was caught on Apple Silicon when trying to enable GPU rendering for 2D canvas for layout tests. See https://build.webkit.org/#/builders/103/builds/88. But the same assertion fires if the same page is just opened in mini browser while GPU rendering for 2D canvas is enabled.
Comment 1 Said Abou-Hallawa 2021-03-11 15:49:31 PST
Created attachment 422983 [details]
Patch
Comment 2 Geoffrey Garen 2021-03-11 16:01:41 PST
Comment on attachment 422983 [details]
Patch

I think modern C++ has a nicer explicit feature to just say the alignment you want. alignas, maybe?
Comment 3 Said Abou-Hallawa 2021-03-11 16:14:17 PST
Created attachment 422987 [details]
Patch
Comment 4 Said Abou-Hallawa 2021-03-11 17:14:19 PST
Created attachment 422998 [details]
Patch
Comment 5 Said Abou-Hallawa 2021-03-11 17:55:22 PST
Created attachment 423002 [details]
Patch
Comment 6 Said Abou-Hallawa 2021-03-11 18:57:35 PST
Created attachment 423004 [details]
Patch
Comment 7 EWS 2021-03-11 20:19:05 PST
commit-queue failed to commit attachment 423004 [details] to WebKit repository. To retry, please set cq+ flag again.
Comment 8 Said Abou-Hallawa 2021-03-11 20:59:22 PST
Created attachment 423012 [details]
Patch
Comment 9 EWS 2021-03-11 21:56:59 PST
Committed r274326: <https://commits.webkit.org/r274326>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 423012 [details].
Comment 10 Radar WebKit Bug Importer 2021-03-11 21:57:25 PST
<rdar://problem/75348461>