Bug 229021 - Support drawImage with a wide gamut image painting into a display-p3 canvas
Summary: Support drawImage with a wide gamut image painting into a display-p3 canvas
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Canvas (show other bugs)
Version: WebKit Local Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Cameron McCormack (:heycam)
URL:
Keywords: InRadar
Depends on: 229750 230139
Blocks: 225140
  Show dependency treegraph
 
Reported: 2021-08-11 21:35 PDT by Cameron McCormack (:heycam)
Modified: 2023-03-24 06:34 PDT (History)
21 users (show)

See Also:


Attachments
WIP including squashed dependencies for EWS (984.92 KB, patch)
2021-09-05 22:18 PDT, Cameron McCormack (:heycam)
no flags Details | Formatted Diff | Diff
WIP including squashed dependencies for EWS (977.25 KB, patch)
2021-09-07 22:14 PDT, Cameron McCormack (:heycam)
ews-feeder: commit-queue-
Details | Formatted Diff | Diff
WIP including squashed dependencies for EWS (979.20 KB, patch)
2021-09-07 22:56 PDT, Cameron McCormack (:heycam)
ews-feeder: commit-queue-
Details | Formatted Diff | Diff
WIP including squashed dependencies for EWS (979.42 KB, patch)
2021-09-07 23:27 PDT, Cameron McCormack (:heycam)
ews-feeder: commit-queue-
Details | Formatted Diff | Diff
WIP including squashed dependencies for EWS (979.53 KB, patch)
2021-09-08 00:08 PDT, Cameron McCormack (:heycam)
no flags Details | Formatted Diff | Diff
WIP including squashed dependencies for EWS (180.94 KB, patch)
2021-09-09 03:38 PDT, Cameron McCormack (:heycam)
ews-feeder: commit-queue-
Details | Formatted Diff | Diff
WIP including squashed dependencies for EWS (96.88 KB, patch)
2021-09-09 19:06 PDT, Cameron McCormack (:heycam)
no flags Details | Formatted Diff | Diff
WIP including squashed dependencies for EWS (203.58 KB, patch)
2021-09-09 20:38 PDT, Cameron McCormack (:heycam)
no flags Details | Formatted Diff | Diff
WIP including squashed dependencies for EWS (203.73 KB, patch)
2021-09-10 00:10 PDT, Cameron McCormack (:heycam)
no flags Details | Formatted Diff | Diff
Patch for review (without dependencies, so EWS will fail) (185.39 KB, patch)
2021-09-10 00:12 PDT, Cameron McCormack (:heycam)
no flags Details | Formatted Diff | Diff
Patch including squashed dependencies for EWS (211.59 KB, patch)
2021-09-10 17:01 PDT, Cameron McCormack (:heycam)
no flags Details | Formatted Diff | Diff
Patch for review (without dependencies and so will fail EWS) (192.71 KB, patch)
2021-09-10 17:02 PDT, Cameron McCormack (:heycam)
no flags Details | Formatted Diff | Diff
Patch including squashed dependencies for EWS (222.30 KB, patch)
2021-09-12 18:41 PDT, Cameron McCormack (:heycam)
no flags Details | Formatted Diff | Diff
Patch without dependencies (and so will fail EWS) (174.75 KB, patch)
2021-09-12 18:42 PDT, Cameron McCormack (:heycam)
no flags Details | Formatted Diff | Diff
Patch including squashed dependencies for EWS (223.70 KB, patch)
2021-09-12 19:23 PDT, Cameron McCormack (:heycam)
no flags Details | Formatted Diff | Diff
Patch without dependencies (and so will fail EWS) (180.15 KB, patch)
2021-09-12 19:23 PDT, Cameron McCormack (:heycam)
no flags Details | Formatted Diff | Diff
[fast-cq] Patch (180.24 KB, patch)
2021-09-16 15:55 PDT, Cameron McCormack (:heycam)
no flags Details | Formatted Diff | Diff
Patch (180.21 KB, patch)
2021-09-16 16:09 PDT, Cameron McCormack (:heycam)
no flags Details | Formatted Diff | Diff
Patch (180.21 KB, patch)
2021-09-16 16:25 PDT, Cameron McCormack (:heycam)
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Cameron McCormack (:heycam) 2021-08-11 21:35:21 PDT
.
Comment 1 Radar WebKit Bug Importer 2021-08-11 21:40:08 PDT
<rdar://problem/81828450>
Comment 2 Cameron McCormack (:heycam) 2021-09-05 22:18:08 PDT
Created attachment 437381 [details]
WIP including squashed dependencies for EWS
Comment 3 Cameron McCormack (:heycam) 2021-09-07 22:14:03 PDT
Created attachment 437593 [details]
WIP including squashed dependencies for EWS
Comment 4 Cameron McCormack (:heycam) 2021-09-07 22:56:46 PDT
Created attachment 437596 [details]
WIP including squashed dependencies for EWS
Comment 5 Cameron McCormack (:heycam) 2021-09-07 23:27:10 PDT
Created attachment 437597 [details]
WIP including squashed dependencies for EWS
Comment 6 Cameron McCormack (:heycam) 2021-09-08 00:08:44 PDT
Created attachment 437604 [details]
WIP including squashed dependencies for EWS
Comment 7 Cameron McCormack (:heycam) 2021-09-09 03:38:18 PDT
Created attachment 437727 [details]
WIP including squashed dependencies for EWS
Comment 8 EWS Watchlist 2021-09-09 03:39:16 PDT
This patch modifies the imported WPT tests. Please ensure that any changes on the tests (not coming from a WPT import) are exported to WPT. Please see https://trac.webkit.org/wiki/WPTExportProcess
Comment 9 Cameron McCormack (:heycam) 2021-09-09 19:06:32 PDT
Created attachment 437823 [details]
WIP including squashed dependencies for EWS
Comment 10 Cameron McCormack (:heycam) 2021-09-09 20:38:39 PDT
Created attachment 437830 [details]
WIP including squashed dependencies for EWS
Comment 11 Cameron McCormack (:heycam) 2021-09-10 00:10:12 PDT
Created attachment 437846 [details]
WIP including squashed dependencies for EWS
Comment 12 Cameron McCormack (:heycam) 2021-09-10 00:12:31 PDT
Created attachment 437847 [details]
Patch for review (without dependencies, so EWS will fail)
Comment 13 Cameron McCormack (:heycam) 2021-09-10 17:01:24 PDT
Created attachment 437926 [details]
Patch including squashed dependencies for EWS
Comment 14 Cameron McCormack (:heycam) 2021-09-10 17:02:17 PDT
Created attachment 437928 [details]
Patch for review (without dependencies and so will fail EWS)
Comment 15 Cameron McCormack (:heycam) 2021-09-12 18:41:53 PDT
Created attachment 438001 [details]
Patch including squashed dependencies for EWS
Comment 16 Cameron McCormack (:heycam) 2021-09-12 18:42:45 PDT
Created attachment 438002 [details]
Patch without dependencies (and so will fail EWS)
Comment 17 Cameron McCormack (:heycam) 2021-09-12 19:23:12 PDT
Created attachment 438005 [details]
Patch including squashed dependencies for EWS
Comment 18 Cameron McCormack (:heycam) 2021-09-12 19:23:55 PDT
Created attachment 438006 [details]
Patch without dependencies (and so will fail EWS)
Comment 19 Sam Weinig 2021-09-15 09:28:46 PDT
Comment on attachment 438006 [details]
Patch without dependencies (and so will fail EWS)

View in context: https://bugs.webkit.org/attachment.cgi?id=438006&action=review

> Source/WebKit/Shared/cg/ShareableBitmapCG.cpp:46
> +    CGColorSpaceRef colorSpace = configuration.colorSpace->platformColorSpace();

I was poking around after we discussed this, and it turns out there is some interesting SPI in CoreGraphics related to this that we might want to explore:

CGBitmapContextCreateForFlatteningImage()

I think we should ask the CoreGraphics folks if it would make sense for us to use it.
Comment 20 Cameron McCormack (:heycam) 2021-09-15 22:28:43 PDT
(In reply to Sam Weinig from comment #19)
> I was poking around after we discussed this, and it turns out there is some
> interesting SPI in CoreGraphics related to this that we might want to
> explore:
> 
> CGBitmapContextCreateForFlatteningImage()

Nice find.  It's doing similar work to find an appropriate color space that I'm doing in validateConfiguration, and avoids conversion in some more cases.

CGBitmapContextCreateForFlatteningImage() creates its own buffer for the bitmap, but ShareableBitmap needs to create the buffer in shared memory.  So I am not sure we could use it as it stands, unless we're happy to use it just to find an appropriate bitmap configuration and color space, or if we draw to it then copy the data out afterwards into the shared memory.

If there were an API that could tell us the appropriate color space and bitmap configuration to use, that would be ideal.  Although we would still need to teach ShareableBitmap about other bitmap configurations that it doesn't support right now (e.g. float components with non-extended range color spaces, CMYK, single channel grayscale) and store that in the ShareableBitmap::Configuration.
Comment 21 Cameron McCormack (:heycam) 2021-09-16 14:58:16 PDT
I'm going to land this patch as is, and I've filed bug 230375 to look into CGBitmapContextCreateForFlatteningImage.
Comment 22 Cameron McCormack (:heycam) 2021-09-16 15:55:44 PDT
Created attachment 438410 [details]
[fast-cq] Patch
Comment 23 Cameron McCormack (:heycam) 2021-09-16 16:09:09 PDT
Created attachment 438412 [details]
Patch
Comment 24 Cameron McCormack (:heycam) 2021-09-16 16:16:59 PDT
Submitted web-platform-tests pull request: https://github.com/web-platform-tests/wpt/pull/30833
Comment 25 Cameron McCormack (:heycam) 2021-09-16 16:25:35 PDT
Created attachment 438415 [details]
Patch
Comment 26 EWS 2021-09-16 18:54:37 PDT
Committed r282626 (241783@main): <https://commits.webkit.org/241783@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 438415 [details].