Bug 235526 - [iOS] Avoid calling IOSurfaceGetPropertyMaximum
Summary: [iOS] Avoid calling IOSurfaceGetPropertyMaximum
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit Misc. (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Per Arne Vollan
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2022-01-24 09:38 PST by Per Arne Vollan
Modified: 2022-01-26 14:02 PST (History)
5 users (show)

See Also:


Attachments
Patch (2.15 KB, patch)
2022-01-24 09:40 PST, Per Arne Vollan
no flags Details | Formatted Diff | Diff
Patch (2.55 KB, patch)
2022-01-24 10:44 PST, Per Arne Vollan
no flags Details | Formatted Diff | Diff
Patch (2.55 KB, patch)
2022-01-24 10:49 PST, Per Arne Vollan
simon.fraser: review+
Details | Formatted Diff | Diff
Patch (2.64 KB, patch)
2022-01-24 12:32 PST, Per Arne Vollan
no flags Details | Formatted Diff | Diff
Patch (2.76 KB, patch)
2022-01-24 15:12 PST, Per Arne Vollan
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Per Arne Vollan 2022-01-24 09:38:03 PST
There should be no need to call IOSurfaceGetPropertyMaximum on iOS, since the return value will exceed the hardcoded maximum.
Comment 1 Per Arne Vollan 2022-01-24 09:40:16 PST
Created attachment 449826 [details]
Patch
Comment 2 Per Arne Vollan 2022-01-24 10:44:17 PST
Created attachment 449828 [details]
Patch
Comment 3 Per Arne Vollan 2022-01-24 10:49:08 PST
Created attachment 449830 [details]
Patch
Comment 4 Per Arne Vollan 2022-01-24 11:10:10 PST
Thanks for reviewing!
Comment 5 Per Arne Vollan 2022-01-24 11:10:30 PST
<rdar://85128431>
Comment 6 Darin Adler 2022-01-24 12:23:48 PST
Comment on attachment 449826 [details]
Patch

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

> Source/WebCore/platform/graphics/cocoa/IOSurface.mm:235
> +    const int maxSurfaceDimension = 8 * 1024;

constexpr

> Source/WebCore/platform/graphics/cocoa/IOSurface.mm:242
>      const int maxSurfaceDimensionLowerBound = 1024;

constexpr

> Source/WebCore/platform/graphics/cocoa/IOSurface.mm:244
>      // IOSurface::maximumSize() can return { INT_MAX, INT_MAX } when hardware acceleration is unavailable.

I don’t understand how this comment relates to the code below, which does not return INT_MAX.

> Source/WebCore/platform/graphics/cocoa/IOSurface.mm:245
>      const int maxSurfaceDimension = 32 * 1024;

constexpr
Comment 7 Per Arne Vollan 2022-01-24 12:32:53 PST
Created attachment 449843 [details]
Patch
Comment 8 Per Arne Vollan 2022-01-24 12:33:54 PST
(In reply to Darin Adler from comment #6)
> Comment on attachment 449826 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=449826&action=review
> 
> > Source/WebCore/platform/graphics/cocoa/IOSurface.mm:235
> > +    const int maxSurfaceDimension = 8 * 1024;
> 
> constexpr
> 
> > Source/WebCore/platform/graphics/cocoa/IOSurface.mm:242
> >      const int maxSurfaceDimensionLowerBound = 1024;
> 
> constexpr
> 
> > Source/WebCore/platform/graphics/cocoa/IOSurface.mm:244
> >      // IOSurface::maximumSize() can return { INT_MAX, INT_MAX } when hardware acceleration is unavailable.
> 
> I don’t understand how this comment relates to the code below, which does
> not return INT_MAX.
> 

Removed what seems to be an obsolete comment.

> > Source/WebCore/platform/graphics/cocoa/IOSurface.mm:245
> >      const int maxSurfaceDimension = 32 * 1024;
> 
> constexpr

Fixed!

Thanks for reviewing!
Comment 9 Darin Adler 2022-01-24 13:50:11 PST
Comment on attachment 449843 [details]
Patch

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

> Source/WebCore/platform/graphics/cocoa/IOSurface.mm:231
> +static IntSize maxSurfaceDimensionCA()

Should be static constexpr IntSize. Unless the IntSize constructor is not constexpr, which it should be, but at that point it’s obviously too much for just this patch.

> Source/WebCore/platform/graphics/cocoa/IOSurface.mm:-242
> -    // IOSurface::maximumSize() can return { INT_MAX, INT_MAX } when hardware acceleration is unavailable.

Oh, wait, I figured out what this might have meant:

If hardware acceleration is unavailable, IOSurface::maximumSize() can return "infinity", but we still want to impose a maximum in that case.
Comment 10 Per Arne Vollan 2022-01-24 15:12:22 PST
Created attachment 449870 [details]
Patch
Comment 11 Per Arne Vollan 2022-01-24 15:14:19 PST
(In reply to Darin Adler from comment #9)
> Comment on attachment 449843 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=449843&action=review
> 
> > Source/WebCore/platform/graphics/cocoa/IOSurface.mm:231
> > +static IntSize maxSurfaceDimensionCA()
> 
> Should be static constexpr IntSize. Unless the IntSize constructor is not
> constexpr, which it should be, but at that point it’s obviously too much for
> just this patch.
> 

Fixed.

> > Source/WebCore/platform/graphics/cocoa/IOSurface.mm:-242
> > -    // IOSurface::maximumSize() can return { INT_MAX, INT_MAX } when hardware acceleration is unavailable.
> 
> Oh, wait, I figured out what this might have meant:
> 
> If hardware acceleration is unavailable, IOSurface::maximumSize() can return
> "infinity", but we still want to impose a maximum in that case.

I put the comment back in.

Thanks for reviewing!
Comment 12 EWS 2022-01-24 17:03:53 PST
Committed r288489 (246363@main): <https://commits.webkit.org/246363@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 449870 [details].
Comment 13 Simon Fraser (smfr) 2022-01-26 13:39:47 PST
Why did we need this after https://trac.webkit.org/changeset/270392/webkit? We should send this from the UI Process already.
Comment 14 Per Arne Vollan 2022-01-26 13:42:36 PST
(In reply to Simon Fraser (smfr) from comment #13)
> Why did we need this after https://trac.webkit.org/changeset/270392/webkit?
> We should send this from the UI Process already.

This will avoid the perf regression from https://trac.webkit.org/changeset/270392/webkit, I believe.
Comment 15 Simon Fraser (smfr) 2022-01-26 13:44:10 PST
Bug 219484 has no mention of a revert or perf regression.
Comment 16 Per Arne Vollan 2022-01-26 13:54:24 PST
(In reply to Simon Fraser (smfr) from comment #15)
> Bug 219484 has no mention of a revert or perf regression.

Yes, although I believe it was a launch time regression. Looking at WebProcessPoolCocoa.mm, I see:

// However, querying this is a launch time regression, so limit this to only the necessary case.
    if (m_defaultPageGroup->preferences().useGPUProcessForDOMRenderingEnabled())
        parameters.maximumIOSurfaceSize = WebCore::IOSurface::maximumSize();
Comment 17 Simon Fraser (smfr) 2022-01-26 14:02:47 PST
...which blames to bug 221346 so let's relate the bugs.