Changeset 199130 in webkit


Ignore:
Timestamp:
Apr 6, 2016, 6:20:52 PM (10 years ago)
Author:
Simon Fraser
Message:

Page tiles are missing when graphics acceleration is unavailable
https://bugs.webkit.org/show_bug.cgi?id=156325
Source/WebCore:

rdar://problem/25587476

Reviewed by Tim Horton.

When graphics acceleration is unavailable on Mac (e.g. in a VM or when running from
the recovery partition), page contents were missing. This is because
IOSurfaceGetPropertyMaximum(kIOSurfaceWidth) and IOSurfaceGetPropertyMaximum(kIOSurfaceHeight)
returned INT_MAX, causing us to compute a tile size of 0x0.

Fix by changing IOSurface::maximumSize() to report a value between 1K x 1K and 32K x 32K.

Rename kGiantTileSize to better describe its purpose.

Add correct clamping in IOSurface::maximumSize().

  • platform/graphics/ca/TileController.cpp:

(WebCore::TileController::tileSize):

  • platform/graphics/ca/TileController.h:
  • platform/graphics/cocoa/IOSurface.mm:

(IOSurface::maximumSize):

Source/WTF:

Reviewed by Tim Horton.

Add clampToInteger(size_t).

  • wtf/MathExtras.h:

(clampToInteger):

Location:
trunk/Source
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WTF/ChangeLog

    r199107 r199130  
     12016-04-06  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Page tiles are missing when graphics acceleration is unavailable
     4        https://bugs.webkit.org/show_bug.cgi?id=156325
     5
     6        Reviewed by Tim Horton.
     7
     8        Add clampToInteger(size_t).
     9
     10        * wtf/MathExtras.h:
     11        (clampToInteger):
     12
    1132016-04-05  Simon Fraser  <simon.fraser@apple.com>
    214
  • trunk/Source/WTF/wtf/MathExtras.h

    r195417 r199130  
    191191}
    192192
     193inline int clampToInteger(size_t x)
     194{
     195    const size_t intMax = static_cast<size_t>(std::numeric_limits<int>::max());
     196
     197    if (x >= intMax)
     198        return std::numeric_limits<int>::max();
     199    return static_cast<int>(x);
     200}
     201
    193202inline bool isWithinIntRange(float x)
    194203{
  • trunk/Source/WebCore/ChangeLog

    r199128 r199130  
     12016-04-06  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Page tiles are missing when graphics acceleration is unavailable
     4        https://bugs.webkit.org/show_bug.cgi?id=156325
     5        rdar://problem/25587476
     6
     7        Reviewed by Tim Horton.
     8
     9        When graphics acceleration is unavailable on Mac (e.g. in a VM or when running from
     10        the recovery partition), page contents were missing. This is because
     11        IOSurfaceGetPropertyMaximum(kIOSurfaceWidth) and IOSurfaceGetPropertyMaximum(kIOSurfaceHeight)
     12        returned INT_MAX, causing us to compute a tile size of 0x0.
     13
     14        Fix by changing IOSurface::maximumSize() to report a value between 1K x 1K and 32K x 32K.
     15
     16        Rename kGiantTileSize to better describe its purpose.
     17
     18        Add correct clamping in IOSurface::maximumSize().
     19
     20        * platform/graphics/ca/TileController.cpp:
     21        (WebCore::TileController::tileSize):
     22        * platform/graphics/ca/TileController.h:
     23        * platform/graphics/cocoa/IOSurface.mm:
     24        (IOSurface::maximumSize):
     25
    1262016-03-29  Keith Miller  <keith_miller@apple.com>
    227
  • trunk/Source/WebCore/platform/graphics/ca/TileController.cpp

    r198875 r199130  
    494494        return tileGrid().tileSize();
    495495
    496     IntSize maxTileSize(kGiantTileSize, kGiantTileSize);
     496    const int kLowestCommonDenominatorMaxTileSize = 4 * 1024;
     497    IntSize maxTileSize(kLowestCommonDenominatorMaxTileSize, kLowestCommonDenominatorMaxTileSize);
     498
    497499#if USE(IOSURFACE)
    498500    IntSize surfaceSizeLimit = IOSurface::maximumSize();
  • trunk/Source/WebCore/platform/graphics/ca/TileController.h

    r198189 r199130  
    5050
    5151const int kDefaultTileSize = 512;
    52 // This is an experimental value for debugging and evaluating the overhead which may be
    53 // incurred due to a large tile size.
    54 const int kGiantTileSize = 4096;
    5552
    5653class TileController final : public TiledBacking {
  • trunk/Source/WebCore/platform/graphics/cocoa/IOSurface.mm

    r198875 r199130  
    3737#import "MachSendRight.h"
    3838#import <wtf/Assertions.h>
     39#import <wtf/MathExtras.h>
    3940
    4041#if PLATFORM(IOS)
     
    240241IntSize IOSurface::maximumSize()
    241242{
    242     IntSize maxSize(IOSurfaceGetPropertyMaximum(kIOSurfaceWidth), IOSurfaceGetPropertyMaximum(kIOSurfaceHeight));
     243    IntSize maxSize(clampToInteger(IOSurfaceGetPropertyMaximum(kIOSurfaceWidth)), clampToInteger(IOSurfaceGetPropertyMaximum(kIOSurfaceHeight)));
     244
     245    // Protect against maxSize being { 0, 0 }.
     246    const int iOSMaxSurfaceDimensionLowerBound = 1024;
     247
    243248#if PLATFORM(IOS)
    244     // Match limits imposed by CA. FIXME: should have API for this <rdar://problem/25454148>
     249    // Match limits imposed by Core Animation. FIXME: should have API for this <rdar://problem/25454148>
    245250    const int iOSMaxSurfaceDimension = 8 * 1024;
    246     maxSize = maxSize.shrunkTo({ iOSMaxSurfaceDimension, iOSMaxSurfaceDimension });
     251#else
     252    // IOSurface::maximumSize() can return { INT_MAX, INT_MAX } when hardware acceleration is unavailable.
     253    const int iOSMaxSurfaceDimension = 32 * 1024;
    247254#endif
    248     return maxSize;
     255
     256    return maxSize.constrainedBetween({ iOSMaxSurfaceDimensionLowerBound, iOSMaxSurfaceDimensionLowerBound }, { iOSMaxSurfaceDimension, iOSMaxSurfaceDimension });
    249257}
    250258
Note: See TracChangeset for help on using the changeset viewer.