Bug 200093

Summary: [FTW] Use IWICBitmap (rather than ID2D1Bitmap) for NativeImagePtr
Product: WebKit Reporter: Brent Fulgham <bfulgham>
Component: WebCore Misc.Assignee: Brent Fulgham <bfulgham>
Status: RESOLVED FIXED    
Severity: Normal CC: achristensen, annulen, bfulgham, commit-queue, dino, don.olmstead, Hironori.Fujii, pvollan, sabouhallawa, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: Safari 10   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 161817    
Attachments:
Description Flags
WIP Patch
none
WIP Patch
none
Patch
none
Patch none

Description Brent Fulgham 2019-07-24 12:11:59 PDT
When I wrote the original Direct2D code, I did not realize that the backing memory for the ID2D1Bitmap was inaccessible since it is effectively a representation of GPU memory. There is no API to access or modify the pixels.

Instead, MSDN documentation indicates that we should be using IWICBitmap objects, which are converted to ID2D1Bitmap objects when things are ready to be rendered.

This makes it possible to use the TextureMapper backend to do efficient compositing and tile drawing, since the data backing the bitmap can now be accessed and manipulated, allowing us to support filters and other effects.

This initial naive patch makes the transition, which allows these features to work. There is a lot of room for performance improvements.

It's likely that WebKit bitmaps should be handled more efficiently than this initial patch, and I look forward to DirectX experts to help me do so! (Help, Sony People!)
Comment 1 Brent Fulgham 2019-07-24 14:22:18 PDT
Created attachment 374809 [details]
WIP Patch
Comment 2 Brent Fulgham 2019-07-24 14:23:12 PDT
This initial WIP patch is just to see if I broke WinCairo or AppleWin ports.

I would appreciate input from DirectX experts, though.
Comment 3 Brent Fulgham 2019-07-24 16:08:56 PDT
Created attachment 374824 [details]
WIP Patch
Comment 4 Brent Fulgham 2019-07-24 19:53:02 PDT
Created attachment 374851 [details]
Patch
Comment 5 Brent Fulgham 2019-07-24 20:02:43 PDT
Created attachment 374855 [details]
Patch
Comment 6 WebKit Commit Bot 2019-07-25 15:02:06 PDT
Comment on attachment 374855 [details]
Patch

Clearing flags on attachment: 374855

Committed r247841: <https://trac.webkit.org/changeset/247841>
Comment 7 WebKit Commit Bot 2019-07-25 15:02:08 PDT
All reviewed patches have been landed.  Closing bug.
Comment 8 Radar WebKit Bug Importer 2019-07-25 15:03:19 PDT
<rdar://problem/53561473>
Comment 9 Brent Fulgham 2019-08-21 16:30:23 PDT
It turns out that this change is horrible for performance (MotionMark dropped from ~200 down to 4).

I'll be backing a large portion of these changes out in a follow-up.