Bug 203026

Summary: Turn on IOSurface support in the iOS Simulator
Product: WebKit Reporter: Tim Horton <thorton>
Component: New BugsAssignee: Tim Horton <thorton>
Status: RESOLVED FIXED    
Severity: Normal CC: ap, bdakin, benjamin, cdumez, cmarcelo, commit-queue, dbates, dino, esprehn+autocc, ews-watchlist, ggaren, glenn, kondapallykalyan, pdr, sabouhallawa, simon.fraser, webkit-bug-importer, wenson_hsieh
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch
none
Patch
none
Patch
none
Patch
none
Patch
none
Patch none

Description Tim Horton 2019-10-15 23:02:32 PDT
Turn on IOSurface support in the iOS Simulator
Comment 1 Tim Horton 2019-10-15 23:04:43 PDT
Created attachment 381055 [details]
Patch
Comment 2 Tim Horton 2019-10-15 23:04:46 PDT
<rdar://problem/46098948>
Comment 3 Tim Horton 2019-10-15 23:05:24 PDT
Comment on attachment 381055 [details]
Patch

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

> LayoutTests/platform/ios/TestExpectations:3389
> +# https://bugs.webkit.org/show_bug.cgi?id=175736

See also rdar://problem/31177990 and related
Comment 4 Tim Horton 2019-10-15 23:06:43 PDT
Actually we'll use <rdar://problem/56320993> for this.
Comment 5 Tim Horton 2019-10-15 23:07:46 PDT
Created attachment 381056 [details]
Patch
Comment 6 Tim Horton 2019-10-16 00:16:26 PDT
API test failures look real
Comment 7 Alexey Proskuryakov 2019-10-16 10:03:28 PDT
We need to move iOS testers to macOS Catalina and re-test.
Comment 8 Tim Horton 2019-10-16 16:21:09 PDT
Actually I can repro the API test failures locally... so I have more digging to do.
Comment 9 Tim Horton 2019-10-22 21:30:36 PDT
Created attachment 381651 [details]
Patch
Comment 10 Alexey Proskuryakov 2019-10-23 09:19:51 PDT
Comment on attachment 381651 [details]
Patch

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

Exciting!

Still need to update host OS in the infrastructure to properly test (even in EWS)...

> Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm:6391
> +    // FIXME: We should be able to use hardware snapshotting in the simulator.

Bug link?
Comment 11 Tim Horton 2019-10-28 18:02:59 PDT
Created attachment 382143 [details]
Patch
Comment 12 EWS Watchlist 2019-10-28 21:09:20 PDT
Comment on attachment 382143 [details]
Patch

Attachment 382143 [details] did not pass jsc-ews (mac):
Output: https://webkit-queues.webkit.org/results/13187034

New failing tests:
mozilla-tests.yaml/js1_5/Array/regress-101964.js.mozilla-dfg-eager-no-cjit-validate-phases
Comment 13 Tim Horton 2019-10-30 16:03:12 PDT
Created attachment 382382 [details]
Patch
Comment 14 Said Abou-Hallawa 2019-10-30 16:36:08 PDT
Comment on attachment 382382 [details]
Patch

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

> LayoutTests/fast/images/exif-orientation-canvas-expected.html:115
> +            var names = [
> +                { resource: "resources/exif-orientation-1-ul.jpg",  id : "canvas1" },
> +                { resource: "resources/exif-orientation-1-ul.jpg",  id : "canvas2" },
> +                { resource: "resources/exif-orientation-1-ul.jpg",  id : "canvas3" },
> +                { resource: "resources/exif-orientation-1-ul.jpg",  id : "canvas4" },
> +                { resource: "resources/exif-orientation-1-ul.jpg",  id : "canvas5" },
> +                { resource: "resources/exif-orientation-1-ul.jpg",  id : "canvas6" },
> +                { resource: "resources/exif-orientation-1-ul.jpg",  id : "canvas7" },
> +                { resource: "resources/exif-orientation-1-ul.jpg",  id : "canvas8" },
> +                { resource: "resources/exif-orientation-1-ul.jpg",  id : "canvas9" }
> +            ];
> +
> +            var drawCount = 0;
> +
> +            names.forEach(function(name) {
> +                var image = new Image;
> +                image.src = name.resource;
> +                image.decode().then(() => {
> +                    let canvas = document.getElementById(name.id);
> +                    canvas.width = image.width;
> +                    canvas.height = image.height;
> +                    let context = canvas.getContext("2d");
> +                    context.drawImage(image, 0, 0, canvas.width, canvas.height);
> +                    if (++drawCount == names.length) {
> +                        if (window.testRunner)
> +                            window.testRunner.notifyDone();
> +                    }
> +                });
> +            });

Since the canvases are drawing the same image, this code can be simplified like this:

    var image = new Image;
    image.src = "resources/exif-orientation-1-ul.jpg";
    image.decode().then(() => {
        const canvases = document.getElementsByTagName('canvas');
        for (let canvas of canvases) {
            canvas.width = image.width;
            canvas.height = image.height;
            let context = canvas.getContext("2d");
            context.drawImage(image, 0, 0, canvas.width, canvas.height);
        }
        if (window.testRunner)
            window.testRunner.notifyDone();
    });
Comment 15 Tim Horton 2019-10-30 16:40:42 PDT
Created attachment 382390 [details]
Patch
Comment 16 Dean Jackson 2019-10-30 17:08:13 PDT
Comment on attachment 382390 [details]
Patch

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

> Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebViewSnapshot.mm:342
> +        unsigned char *rgba = (unsigned char *)calloc(viewWidthInPixels * viewHeightInPixels * 4, sizeof(unsigned char));

uint8_t?

or Uint8ClampedArray::tryCreateUninitialized?
Comment 17 Dean Jackson 2019-10-30 17:11:11 PDT
Comment on attachment 382390 [details]
Patch

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

> LayoutTests/fast/images/exif-orientation-canvas-expected.html:91
> +                const canvases = document.getElementsByTagName('canvas');
> +                for (let canvas of canvases) {

document.querySelectorAll("canvas").forEach(canvas => {
  // draw
});
Comment 18 Tim Horton 2019-10-31 13:17:11 PDT
Created attachment 382492 [details]
Patch
Comment 19 EWS Watchlist 2019-10-31 16:09:46 PDT
Comment on attachment 382492 [details]
Patch

Attachment 382492 [details] did not pass jsc-ews (mac):
Output: https://webkit-queues.webkit.org/results/13196833

New failing tests:
mozilla-tests.yaml/js1_5/Array/regress-101964.js.mozilla-dfg-eager-no-cjit-validate-phases
Comment 20 WebKit Commit Bot 2019-10-31 17:08:32 PDT
Comment on attachment 382492 [details]
Patch

Clearing flags on attachment: 382492

Committed r251896: <https://trac.webkit.org/changeset/251896>
Comment 21 WebKit Commit Bot 2019-10-31 17:08:34 PDT
All reviewed patches have been landed.  Closing bug.