⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 288489 in webkit


Ignore:
Timestamp:
Jan 24, 2022, 5:02:41 PM (5 years ago)
Author:
pvollan@apple.com
Message:

[iOS] Avoid calling IOSurfaceGetPropertyMaximum
​https://bugs.webkit.org/show_bug.cgi?id=235526
<rdar://85128431>

Reviewed by Simon Fraser and Darin Adler.

There should be no need to call IOSurfaceGetPropertyMaximum on iOS, since the return value will exceed the hardcoded maximum.

  • platform/graphics/cocoa/IOSurface.mm:

(WebCore::maxSurfaceDimensionCA):
(WebCore::computeMaximumSurfaceSize):

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r288477 r288489  
     12022-01-24  Per Arne Vollan  <pvollan@apple.com>
     2
     3        [iOS] Avoid calling IOSurfaceGetPropertyMaximum
     4        https://bugs.webkit.org/show_bug.cgi?id=235526
     5        <rdar://85128431>
     6
     7        Reviewed by Simon Fraser and Darin Adler.
     8
     9        There should be no need to call IOSurfaceGetPropertyMaximum on iOS, since the return value will exceed the hardcoded maximum.
     10
     11        * platform/graphics/cocoa/IOSurface.mm:
     12        (WebCore::maxSurfaceDimensionCA):
     13        (WebCore::computeMaximumSurfaceSize):
     14
    1152022-01-24  Wenson Hsieh  <wenson_hsieh@apple.com>
    216
  • trunk/Source/WebCore/platform/graphics/cocoa/IOSurface.mm

    r287848 r288489  
    229229IOSurface::~IOSurface() = default;
    230230
    231 static IntSize computeMaximumSurfaceSize()
    232 {
    233     IntSize maxSize(clampToInteger(IOSurfaceGetPropertyMaximum(kIOSurfaceWidth)), clampToInteger(IOSurfaceGetPropertyMaximum(kIOSurfaceHeight)));
    234 
    235     // Protect against maxSize being { 0, 0 }.
    236     const int maxSurfaceDimensionLowerBound = 1024;
    237 
     231static constexpr IntSize maxSurfaceDimensionCA()
     232{
     233    // Match limits imposed by Core Animation. FIXME: should have API for this <rdar://problem/25454148>
    238234#if PLATFORM(IOS_FAMILY)
    239     // Match limits imposed by Core Animation. FIXME: should have API for this <rdar://problem/25454148>
    240     const int maxSurfaceDimension = 8 * 1024;
     235    constexpr int maxSurfaceDimension = 8 * 1024;
    241236#else
    242237    // IOSurface::maximumSize() can return { INT_MAX, INT_MAX } when hardware acceleration is unavailable.
    243     const int maxSurfaceDimension = 32 * 1024;
    244 #endif
    245 
    246     return maxSize.constrainedBetween({ maxSurfaceDimensionLowerBound, maxSurfaceDimensionLowerBound }, { maxSurfaceDimension, maxSurfaceDimension });
     238    constexpr int maxSurfaceDimension = 32 * 1024;
     239#endif
     240    return { maxSurfaceDimension, maxSurfaceDimension };
     241}
     242
     243static IntSize computeMaximumSurfaceSize()
     244{
     245#if PLATFORM(IOS)
     246    return maxSurfaceDimensionCA();
     247#else
     248    IntSize maxSize(clampToInteger(IOSurfaceGetPropertyMaximum(kIOSurfaceWidth)), clampToInteger(IOSurfaceGetPropertyMaximum(kIOSurfaceHeight)));
     249
     250    // Protect against maxSize being { 0, 0 }.
     251    constexpr int maxSurfaceDimensionLowerBound = 1024;
     252
     253    return maxSize.constrainedBetween({ maxSurfaceDimensionLowerBound, maxSurfaceDimensionLowerBound }, maxSurfaceDimensionCA() );
     254#endif
    247255}
    248256
Note: See TracChangeset for help on using the changeset viewer.