Changeset 239371 in webkit


Ignore:
Timestamp:
Dec 18, 2018 11:41:19 PM (5 years ago)
Author:
zandobersek@gmail.com
Message:

REGRESSION(r235165): [GTK][WPE] Garbled rendering on GitLab
https://bugs.webkit.org/show_bug.cgi?id=192230

Reviewed by Carlos Garcia Campos.

Single tile can after r235165 be assigned multiple content updates
without a commit occurring between each update, whereas before these
commits were done for each update.

To avoid repeating updates for a single tile purging information about
the previous update, these updates are now accumulated inside a Vector
and then iterated over during the commit phase.

  • platform/graphics/texmap/coordinated/CoordinatedBackingStore.cpp:

(WebCore::CoordinatedBackingStoreTile::addUpdate):
(WebCore::CoordinatedBackingStoreTile::swapBuffers):
(WebCore::CoordinatedBackingStore::updateTile):
(WebCore::CoordinatedBackingStoreTile::setBackBuffer): Deleted.

  • platform/graphics/texmap/coordinated/CoordinatedBackingStore.h:

(WebCore::CoordinatedBackingStoreTile::scale const):

Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r239369 r239371  
     12018-12-18  Zan Dobersek  <zdobersek@igalia.com>
     2
     3        REGRESSION(r235165): [GTK][WPE] Garbled rendering on GitLab
     4        https://bugs.webkit.org/show_bug.cgi?id=192230
     5
     6        Reviewed by Carlos Garcia Campos.
     7
     8        Single tile can after r235165 be assigned multiple content updates
     9        without a commit occurring between each update, whereas before these
     10        commits were done for each update.
     11
     12        To avoid repeating updates for a single tile purging information about
     13        the previous update, these updates are now accumulated inside a Vector
     14        and then iterated over during the commit phase.
     15
     16        * platform/graphics/texmap/coordinated/CoordinatedBackingStore.cpp:
     17        (WebCore::CoordinatedBackingStoreTile::addUpdate):
     18        (WebCore::CoordinatedBackingStoreTile::swapBuffers):
     19        (WebCore::CoordinatedBackingStore::updateTile):
     20        (WebCore::CoordinatedBackingStoreTile::setBackBuffer): Deleted.
     21        * platform/graphics/texmap/coordinated/CoordinatedBackingStore.h:
     22        (WebCore::CoordinatedBackingStoreTile::scale const):
     23
    1242018-12-18  Wenson Hsieh  <wenson_hsieh@apple.com>
    225
  • trunk/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedBackingStore.cpp

    r234455 r239371  
    3030namespace WebCore {
    3131
     32void CoordinatedBackingStoreTile::addUpdate(Update&& update)
     33{
     34    m_updates.append(WTFMove(update));
     35}
     36
    3237void CoordinatedBackingStoreTile::swapBuffers(TextureMapper& textureMapper)
    3338{
    34     if (!m_buffer)
    35         return;
     39    auto updates = WTFMove(m_updates);
     40    for (auto& update : updates) {
     41        if (!update.buffer)
     42            continue;
    3643
    37     ASSERT(textureMapper.maxTextureSize().width() >= m_tileRect.size().width());
    38     ASSERT(textureMapper.maxTextureSize().height() >= m_tileRect.size().height());
     44        ASSERT(textureMapper.maxTextureSize().width() >= update.tileRect.size().width());
     45        ASSERT(textureMapper.maxTextureSize().height() >= update.tileRect.size().height());
    3946
    40     FloatRect unscaledTileRect(m_tileRect);
    41     unscaledTileRect.scale(1. / m_scale);
     47        FloatRect unscaledTileRect(update.tileRect);
     48        unscaledTileRect.scale(1. / m_scale);
    4249
    43     if (!m_texture || unscaledTileRect != rect()) {
    44         setRect(unscaledTileRect);
    45         m_texture = textureMapper.acquireTextureFromPool(m_tileRect.size(), m_buffer->supportsAlpha() ? BitmapTexture::SupportsAlpha : BitmapTexture::NoFlag);
    46     } else if (m_buffer->supportsAlpha() == m_texture->isOpaque())
    47         m_texture->reset(m_tileRect.size(), m_buffer->supportsAlpha());
     50        if (!m_texture || unscaledTileRect != rect()) {
     51            setRect(unscaledTileRect);
     52            m_texture = textureMapper.acquireTextureFromPool(update.tileRect.size(), update.buffer->supportsAlpha() ? BitmapTexture::SupportsAlpha : BitmapTexture::NoFlag);
     53        } else if (update.buffer->supportsAlpha() == m_texture->isOpaque())
     54            m_texture->reset(update.tileRect.size(), update.buffer->supportsAlpha());
    4855
    49     m_buffer->waitUntilPaintingComplete();
    50     m_texture->updateContents(m_buffer->data(), m_sourceRect, m_bufferOffset, m_buffer->stride());
    51     m_buffer = nullptr;
    52 }
    53 
    54 void CoordinatedBackingStoreTile::setBackBuffer(const IntRect& tileRect, const IntRect& sourceRect, RefPtr<Nicosia::Buffer>&& buffer, const IntPoint& offset)
    55 {
    56     m_sourceRect = sourceRect;
    57     m_tileRect = tileRect;
    58     m_bufferOffset = offset;
    59     m_buffer = WTFMove(buffer);
     56        update.buffer->waitUntilPaintingComplete();
     57        m_texture->updateContents(update.buffer->data(), update.sourceRect, update.bufferOffset, update.buffer->stride());
     58        update.buffer = nullptr;
     59    }
    6060}
    6161
     
    8282    CoordinatedBackingStoreTileMap::iterator it = m_tiles.find(id);
    8383    ASSERT(it != m_tiles.end());
    84     it->value.setBackBuffer(tileRect, sourceRect, WTFMove(buffer), offset);
     84    it->value.addUpdate({ WTFMove(buffer), sourceRect, tileRect, offset });
    8585}
    8686
  • trunk/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedBackingStore.h

    r234455 r239371  
    2828#include <wtf/HashSet.h>
    2929#include <wtf/RefCounted.h>
     30#include <wtf/Vector.h>
    3031
    3132namespace Nicosia {
     
    4344    }
    4445
    45     inline float scale() const { return m_scale; }
     46    float scale() const { return m_scale; }
     47
     48    struct Update {
     49        RefPtr<Nicosia::Buffer> buffer;
     50        IntRect sourceRect;
     51        IntRect tileRect;
     52        IntPoint bufferOffset;
     53    };
     54    void addUpdate(Update&&);
     55
    4656    void swapBuffers(TextureMapper&);
    47     void setBackBuffer(const IntRect&, const IntRect&, RefPtr<Nicosia::Buffer>&&, const IntPoint&);
    4857
    4958private:
    50     RefPtr<Nicosia::Buffer> m_buffer;
    51     IntRect m_sourceRect;
    52     IntRect m_tileRect;
    53     IntPoint m_bufferOffset;
     59    Vector<Update> m_updates;
    5460    float m_scale;
    5561};
Note: See TracChangeset for help on using the changeset viewer.