Bug 223096

Summary: [GPU Process] Encoding buffer for DisplayList items should be aligned to 8 bytes
Product: WebKit Reporter: Said Abou-Hallawa <sabouhallawa>
Component: CanvasAssignee: Said Abou-Hallawa <sabouhallawa>
Status: RESOLVED FIXED    
Severity: Normal CC: dino, ggaren, simon.fraser, thorton, webkit-bug-importer, wenson_hsieh
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 222835    
Attachments:
Description Flags
Patch
none
Patch
simon.fraser: review+, ews-feeder: commit-queue-
Patch
ews-feeder: commit-queue-
Patch
none
Patch
ews-feeder: commit-queue-
Patch none

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>