Changeset 86640 in webkit


Ignore:
Timestamp:
May 16, 2011 5:21:05 PM (13 years ago)
Author:
atwilson@chromium.org
Message:

2011-05-16 Andrew Wilson <atwilson@chromium.org>

Unreviewed, rolling out r86625.
http://trac.webkit.org/changeset/86625
https://bugs.webkit.org/show_bug.cgi?id=60719

Caused failed assertion on Chromium gpu canary bots

  • WebCore.gypi:
  • platform/chromium/TraceEvent.h:
  • platform/graphics/chromium/ContentLayerChromium.cpp: (WebCore::ContentLayerChromium::create): (WebCore::ContentLayerChromium::ContentLayerChromium): (WebCore::ContentLayerChromium::~ContentLayerChromium): (WebCore::ContentLayerChromium::paintContentsIfDirty): (WebCore::ContentLayerChromium::setLayerRenderer): (WebCore::ContentLayerChromium::createTilerIfNeeded): (WebCore::ContentLayerChromium::updateCompositorResources):
  • platform/graphics/chromium/ContentLayerChromium.h: (WebCore::ContentLayerChromium::drawsContent):
  • platform/graphics/chromium/ImageLayerChromium.cpp: (WebCore::ImageLayerChromium::paintContentsIfDirty): (WebCore::ImageLayerChromium::updateCompositorResources):
  • platform/graphics/chromium/ImageLayerChromium.h:
  • platform/graphics/chromium/LayerPainterChromium.h: Removed.
  • platform/graphics/chromium/LayerRendererChromium.cpp: (WebCore::LayerRendererChromium::create): (WebCore::LayerRendererChromium::LayerRendererChromium): (WebCore::LayerRendererChromium::updateRootLayerContents): (WebCore::LayerRendererChromium::drawRootLayer): (WebCore::LayerRendererChromium::updateAndDrawLayers): (WebCore::LayerRendererChromium::updateLayers):
  • platform/graphics/chromium/LayerRendererChromium.h:
  • platform/graphics/chromium/LayerTextureSubImage.cpp: Removed.
  • platform/graphics/chromium/LayerTextureSubImage.h: Removed.
  • platform/graphics/chromium/LayerTextureUpdater.h: Removed.
  • platform/graphics/chromium/LayerTextureUpdaterCanvas.cpp: Removed.
  • platform/graphics/chromium/LayerTextureUpdaterCanvas.h: Removed.
  • platform/graphics/chromium/LayerTilerChromium.cpp: (WebCore::LayerTilerChromium::create): (WebCore::LayerTilerChromium::LayerTilerChromium): (WebCore::LayerTilerChromium::setLayerRenderer): (WebCore::LayerTilerChromium::setTileSize): (WebCore::LayerTilerChromium::update): (WebCore::LayerTilerChromium::uploadCanvas): (WebCore::LayerTilerChromium::updateFromPixels): (WebCore::LayerTilerChromium::draw):
  • platform/graphics/chromium/LayerTilerChromium.h: (WebCore::LayerTilerChromium::Tile::Tile):
  • platform/graphics/chromium/cc/CCHeadsUpDisplay.cpp: (WebCore::CCHeadsUpDisplay::draw):

2011-05-16 Andrew Wilson <atwilson@chromium.org>

Unreviewed, rolling out r86625.
http://trac.webkit.org/changeset/86625
https://bugs.webkit.org/show_bug.cgi?id=60719

Caused failed assertion on Chromium gpu canary bots

  • src/WebViewImpl.cpp:
Location:
trunk/Source
Files:
6 deleted
14 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r86635 r86640  
     12011-05-16  Andrew Wilson  <atwilson@chromium.org>
     2
     3        Unreviewed, rolling out r86625.
     4        http://trac.webkit.org/changeset/86625
     5        https://bugs.webkit.org/show_bug.cgi?id=60719
     6
     7        Caused failed assertion on Chromium gpu canary bots
     8
     9        * WebCore.gypi:
     10        * platform/chromium/TraceEvent.h:
     11        * platform/graphics/chromium/ContentLayerChromium.cpp:
     12        (WebCore::ContentLayerChromium::create):
     13        (WebCore::ContentLayerChromium::ContentLayerChromium):
     14        (WebCore::ContentLayerChromium::~ContentLayerChromium):
     15        (WebCore::ContentLayerChromium::paintContentsIfDirty):
     16        (WebCore::ContentLayerChromium::setLayerRenderer):
     17        (WebCore::ContentLayerChromium::createTilerIfNeeded):
     18        (WebCore::ContentLayerChromium::updateCompositorResources):
     19        * platform/graphics/chromium/ContentLayerChromium.h:
     20        (WebCore::ContentLayerChromium::drawsContent):
     21        * platform/graphics/chromium/ImageLayerChromium.cpp:
     22        (WebCore::ImageLayerChromium::paintContentsIfDirty):
     23        (WebCore::ImageLayerChromium::updateCompositorResources):
     24        * platform/graphics/chromium/ImageLayerChromium.h:
     25        * platform/graphics/chromium/LayerPainterChromium.h: Removed.
     26        * platform/graphics/chromium/LayerRendererChromium.cpp:
     27        (WebCore::LayerRendererChromium::create):
     28        (WebCore::LayerRendererChromium::LayerRendererChromium):
     29        (WebCore::LayerRendererChromium::updateRootLayerContents):
     30        (WebCore::LayerRendererChromium::drawRootLayer):
     31        (WebCore::LayerRendererChromium::updateAndDrawLayers):
     32        (WebCore::LayerRendererChromium::updateLayers):
     33        * platform/graphics/chromium/LayerRendererChromium.h:
     34        * platform/graphics/chromium/LayerTextureSubImage.cpp: Removed.
     35        * platform/graphics/chromium/LayerTextureSubImage.h: Removed.
     36        * platform/graphics/chromium/LayerTextureUpdater.h: Removed.
     37        * platform/graphics/chromium/LayerTextureUpdaterCanvas.cpp: Removed.
     38        * platform/graphics/chromium/LayerTextureUpdaterCanvas.h: Removed.
     39        * platform/graphics/chromium/LayerTilerChromium.cpp:
     40        (WebCore::LayerTilerChromium::create):
     41        (WebCore::LayerTilerChromium::LayerTilerChromium):
     42        (WebCore::LayerTilerChromium::setLayerRenderer):
     43        (WebCore::LayerTilerChromium::setTileSize):
     44        (WebCore::LayerTilerChromium::update):
     45        (WebCore::LayerTilerChromium::uploadCanvas):
     46        (WebCore::LayerTilerChromium::updateFromPixels):
     47        (WebCore::LayerTilerChromium::draw):
     48        * platform/graphics/chromium/LayerTilerChromium.h:
     49        (WebCore::LayerTilerChromium::Tile::Tile):
     50        * platform/graphics/chromium/cc/CCHeadsUpDisplay.cpp:
     51        (WebCore::CCHeadsUpDisplay::draw):
     52
    1532011-05-16  Antti Koivisto  <antti@apple.com>
    254
  • trunk/Source/WebCore/WebCore.gypi

    r86625 r86640  
    40354035            'platform/graphics/chromium/LayerChromium.cpp',
    40364036            'platform/graphics/chromium/LayerChromium.h',
    4037             'platform/graphics/chromium/LayerPainterChromium.h',
    40384037            'platform/graphics/chromium/LayerRendererChromium.cpp',
    40394038            'platform/graphics/chromium/LayerRendererChromium.h',
    40404039            'platform/graphics/chromium/LayerTexture.cpp',
    40414040            'platform/graphics/chromium/LayerTexture.h',
    4042             'platform/graphics/chromium/LayerTextureSubImage.cpp',
    4043             'platform/graphics/chromium/LayerTextureSubImage.h',
    4044             'platform/graphics/chromium/LayerTextureUpdater.h',
    4045             'platform/graphics/chromium/LayerTextureUpdaterCanvas.cpp',
    4046             'platform/graphics/chromium/LayerTextureUpdaterCanvas.h',
    40474041            'platform/graphics/chromium/LayerTilerChromium.cpp',
    40484042            'platform/graphics/chromium/LayerTilerChromium.h',
  • trunk/Source/WebCore/platform/chromium/TraceEvent.h

    r86625 r86640  
    2727
    2828#include "PlatformBridge.h"
    29 #include <wtf/OwnArrayPtr.h>
    3029
    3130// Implementation detail: trace event macros create temporary variables
  • trunk/Source/WebCore/platform/graphics/chromium/ContentLayerChromium.cpp

    r86625 r86640  
    3737#include "cc/CCLayerImpl.h"
    3838#include "GraphicsContext3D.h"
    39 #include "LayerPainterChromium.h"
    4039#include "LayerRendererChromium.h"
    4140#include "LayerTexture.h"
    42 #include "LayerTextureUpdaterCanvas.h"
    43 #include "LayerTilerChromium.h"
    4441#include "RenderLayerBacking.h"
    4542#include "TextStream.h"
     
    5552namespace WebCore {
    5653
    57 class ContentLayerPainter : public LayerPainterChromium {
     54PassRefPtr<ContentLayerChromium> ContentLayerChromium::create(GraphicsLayerChromium* owner)
     55{
     56    return adoptRef(new ContentLayerChromium(owner));
     57}
     58
     59ContentLayerChromium::ContentLayerChromium(GraphicsLayerChromium* owner)
     60    : LayerChromium(owner)
     61    , m_tilingOption(ContentLayerChromium::AutoTile)
     62{
     63}
     64
     65ContentLayerChromium::~ContentLayerChromium()
     66{
     67    m_tiler.clear();
     68    LayerChromium::cleanupResources();
     69}
     70
     71class ContentLayerPainter : public TilePaintInterface {
    5872public:
    5973    explicit ContentLayerPainter(GraphicsLayerChromium* owner)
     
    7286};
    7387
    74 PassRefPtr<ContentLayerChromium> ContentLayerChromium::create(GraphicsLayerChromium* owner)
    75 {
    76     return adoptRef(new ContentLayerChromium(owner));
    77 }
    78 
    79 ContentLayerChromium::ContentLayerChromium(GraphicsLayerChromium* owner)
    80     : LayerChromium(owner)
    81     , m_tilingOption(ContentLayerChromium::AutoTile)
    82 {
    83 }
    84 
    85 ContentLayerChromium::~ContentLayerChromium()
    86 {
    87     cleanupResources();
    88 }
    89 
    9088void ContentLayerChromium::paintContentsIfDirty(const IntRect& targetSurfaceRect)
    9189{
     
    9391    ASSERT(layerRenderer());
    9492
     93    createTilerIfNeeded();
     94
     95    ContentLayerPainter painter(m_owner);
    9596    updateLayerSize(layerBounds().size());
    9697
     
    103104    m_tiler->invalidateRect(dirty);
    104105
    105     m_tiler->prepareToUpdate(layerRect);
     106    m_tiler->update(painter, layerRect);
    106107    m_dirtyRect = FloatRect();
    107 }
    108 
    109 void ContentLayerChromium::cleanupResources()
    110 {
    111     m_tiler.clear();
    112     LayerChromium::cleanupResources();
    113108}
    114109
     
    117112    LayerChromium::setLayerRenderer(layerRenderer);
    118113    createTilerIfNeeded();
    119 }
    120 
    121 PassOwnPtr<LayerTextureUpdater> ContentLayerChromium::createTextureUpdater()
    122 {
    123     OwnPtr<LayerPainterChromium> painter = adoptPtr(new ContentLayerPainter(m_owner));
    124     return adoptPtr(new LayerTextureUpdaterBitmap(layerRendererContext(), painter.release(), layerRenderer()->contextSupportsMapSub()));
     114    m_tiler->setLayerRenderer(layerRenderer);
    125115}
    126116
     
    197187}
    198188
    199 bool ContentLayerChromium::drawsContent() const
    200 {
    201     return m_owner && m_owner->drawsContent() && (!m_tiler || !m_tiler->skipsDraw());
    202 }
    203 
    204189void ContentLayerChromium::createTilerIfNeeded()
    205190{
    206191    if (m_tiler)
    207192        return;
    208 
    209     m_tiler = LayerTilerChromium::create(
    210         layerRenderer(),
    211         createTextureUpdater(),
    212         IntSize(defaultTileSize, defaultTileSize),
    213         LayerTilerChromium::HasBorderTexels);
     193    m_tiler = LayerTilerChromium::create(layerRenderer(), IntSize(defaultTileSize, defaultTileSize), LayerTilerChromium::HasBorderTexels);
    214194}
    215195
    216196void ContentLayerChromium::updateCompositorResources()
    217197{
    218     m_tiler->updateRect();
     198    m_tiler->uploadCanvas();
    219199}
    220200
  • trunk/Source/WebCore/platform/graphics/chromium/ContentLayerChromium.h

    r86625 r86640  
    3636
    3737#include "LayerChromium.h"
     38#include "LayerTilerChromium.h"
     39#include "TextureManager.h"
    3840
    3941namespace WebCore {
    4042
    4143class LayerTexture;
    42 class LayerTilerChromium;
    43 class LayerTextureUpdater;
    4444
    4545// A Layer that requires a GraphicsContext to render its contents.
     
    5959
    6060    virtual void draw(const IntRect& targetSurfaceRect);
    61     virtual bool drawsContent() const;
     61    virtual bool drawsContent() const { return m_owner && m_owner->drawsContent() && (!m_tiler || !m_tiler->skipsDraw()); }
    6262
    6363protected:
     
    6767    virtual void dumpLayerProperties(TextStream&, int indent) const;
    6868
    69     virtual void cleanupResources();
    7069    virtual void setLayerRenderer(LayerRendererChromium*);
    71 
    72     virtual PassOwnPtr<LayerTextureUpdater> createTextureUpdater();
    7370
    7471    virtual IntRect layerBounds() const;
  • trunk/Source/WebCore/platform/graphics/chromium/ImageLayerChromium.cpp

    r86625 r86640  
    3939#include "LayerRendererChromium.h"
    4040#include "LayerTexture.h"
    41 #include "LayerTextureSubImage.h"
    42 #include "LayerTextureUpdater.h"
    4341
    4442namespace WebCore {
    45 
    46 class ImageLayerTextureUpdater : public LayerTextureUpdater {
    47 public:
    48     ImageLayerTextureUpdater(GraphicsContext3D* context, const PlatformImage& image, bool useMapTexSubImage)
    49         : LayerTextureUpdater(context)
    50         , m_image(image)
    51         , m_texSubImage(useMapTexSubImage)
    52     {
    53     }
    54     virtual ~ImageLayerTextureUpdater() { }
    55 
    56     virtual Orientation orientation() { return LayerTextureUpdater::BottomUpOrientation; }
    57 
    58     virtual void prepareToUpdate(const IntRect& contentRect, const IntSize& tileSize, int borderTexels)
    59     {
    60         ASSERT(imageRect().contains(contentRect));
    61         m_texSubImage.setSubImageSize(tileSize);
    62     }
    63 
    64     virtual void updateTextureRect(LayerTexture* texture, const IntRect& sourceRect, const IntRect& destRect)
    65     {
    66         texture->bindTexture();
    67         m_texSubImage.upload(m_image.pixels(), imageRect(), sourceRect, destRect, context());
    68     }
    69 
    70 private:
    71     IntRect imageRect() const
    72     {
    73         return IntRect(IntPoint::zero(), m_image.size());
    74     }
    75 
    76     // FIXME: ImageLayerTextureUpdater should rather own a PlatformImage rather than keeping a reference.
    77     const PlatformImage& m_image;
    78     LayerTextureSubImage m_texSubImage;
    79 };
    8043
    8144PassRefPtr<ImageLayerChromium> ImageLayerChromium::create(GraphicsLayerChromium* owner)
     
    11881            m_dirtyRect = IntRect();
    11982        }
    120         m_tiler->prepareToUpdate(paintRect);
    12183    }
    12284}
     
    12486void ImageLayerChromium::updateCompositorResources()
    12587{
    126     m_tiler->updateRect();
    127 }
    128 
    129 PassOwnPtr<LayerTextureUpdater> ImageLayerChromium::createTextureUpdater()
    130 {
    131     return adoptPtr(new ImageLayerTextureUpdater(layerRendererContext(), m_decodedImage, layerRenderer()->contextSupportsMapSub()));
     88    IntRect paintRect(IntPoint(0, 0), m_decodedImage.size());
     89    m_tiler->updateFromPixels(paintRect, paintRect, m_decodedImage.pixels());
    13290}
    13391
  • trunk/Source/WebCore/platform/graphics/chromium/ImageLayerChromium.h

    r86625 r86640  
    6060    virtual const char* layerTypeAsString() const { return "ImageLayer"; }
    6161
    62     virtual PassOwnPtr<LayerTextureUpdater> createTextureUpdater();
    6362    virtual TransformationMatrix tilingTransform();
    6463    virtual IntRect layerBounds() const;
  • trunk/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp

    r86625 r86640  
    4141#include "GraphicsContext3D.h"
    4242#include "LayerChromium.h"
    43 #include "LayerPainterChromium.h"
    4443#include "LayerTexture.h"
    45 #include "LayerTextureUpdaterCanvas.h"
    4644#include "NotImplemented.h"
    4745#include "TextStream.h"
     
    9694}
    9795
    98 PassRefPtr<LayerRendererChromium> LayerRendererChromium::create(PassRefPtr<GraphicsContext3D> context, PassOwnPtr<LayerPainterChromium> contentPaint)
     96PassRefPtr<LayerRendererChromium> LayerRendererChromium::create(PassRefPtr<GraphicsContext3D> context, PassOwnPtr<TilePaintInterface> contentPaint)
    9997{
    10098    if (!context)
     
    109107
    110108LayerRendererChromium::LayerRendererChromium(PassRefPtr<GraphicsContext3D> context,
    111                                              PassOwnPtr<LayerPainterChromium> contentPaint)
     109                                             PassOwnPtr<TilePaintInterface> contentPaint)
    112110    : m_viewportScrollPosition(IntPoint(-1, -1))
    113111    , m_rootLayer(0)
     112    , m_rootLayerContentPaint(contentPaint)
    114113    , m_currentShader(0)
    115114    , m_currentRenderSurface(0)
     
    127126        m_context->getExtensions()->ensureEnabled("GL_CHROMIUM_map_sub");
    128127    m_hardwareCompositing = initializeSharedObjects();
    129 
    130     OwnPtr<LayerTextureUpdater> textureUpdater = adoptPtr(new LayerTextureUpdaterBitmap(m_context.get(), contentPaint, m_contextSupportsMapSub));
    131     m_rootLayerContentTiler = LayerTilerChromium::create(this, textureUpdater.release(), IntSize(256, 256), LayerTilerChromium::NoBorderTexels);
     128    m_rootLayerContentTiler = LayerTilerChromium::create(this, IntSize(256, 256), LayerTilerChromium::NoBorderTexels);
    132129    ASSERT(m_rootLayerContentTiler);
    133130
     
    169166{
    170167    TRACE_EVENT("LayerRendererChromium::updateRootLayerContents", this, 0);
    171     m_rootLayerContentTiler->prepareToUpdate(m_viewportVisibleRect);
     168    m_rootLayerContentTiler->update(*m_rootLayerContentPaint, m_viewportVisibleRect);
    172169}
    173170
     
    177174    scroll.translate(-m_viewportVisibleRect.x(), -m_viewportVisibleRect.y());
    178175
     176    m_rootLayerContentTiler->uploadCanvas();
    179177    m_rootLayerContentTiler->draw(m_viewportVisibleRect, scroll, 1.0f);
    180178}
     
    215213
    216214    LayerList renderSurfaceLayerList;
     215
    217216    updateLayers(renderSurfaceLayerList);
    218217
     
    319318
    320319    updateCompositorResourcesRecursive(m_rootLayer.get());
    321     // Update compositor resources for root layer.
    322     m_rootLayerContentTiler->updateRect();
    323320
    324321    // After updateCompositorResourcesRecursive, set/wait latches for all child
  • trunk/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.h

    r86625 r86640  
    6565class GeometryBinding;
    6666class GraphicsContext3D;
    67 class LayerPainterChromium;
    6867
    6968// Class that handles drawing of composited render layers using GL.
    7069class LayerRendererChromium : public RefCounted<LayerRendererChromium> {
    7170public:
    72     static PassRefPtr<LayerRendererChromium> create(PassRefPtr<GraphicsContext3D>, PassOwnPtr<LayerPainterChromium> contentPaint);
     71    static PassRefPtr<LayerRendererChromium> create(PassRefPtr<GraphicsContext3D>, PassOwnPtr<TilePaintInterface> contentPaint);
    7372
    7473    ~LayerRendererChromium();
     
    150149    typedef HashMap<GraphicsContext3D*, int> ChildContextMap;
    151150
    152     LayerRendererChromium(PassRefPtr<GraphicsContext3D>, PassOwnPtr<LayerPainterChromium> contentPaint);
     151    explicit LayerRendererChromium(PassRefPtr<GraphicsContext3D>, PassOwnPtr<TilePaintInterface> contentPaint);
    153152
    154153    void updateLayers(LayerList& renderSurfaceLayerList);
     
    190189
    191190    RefPtr<LayerChromium> m_rootLayer;
     191    OwnPtr<TilePaintInterface> m_rootLayerContentPaint;
    192192    OwnPtr<LayerTilerChromium> m_rootLayerContentTiler;
    193193
  • trunk/Source/WebCore/platform/graphics/chromium/LayerTilerChromium.cpp

    r86625 r86640  
    3636#include "LayerRendererChromium.h"
    3737#include "LayerTexture.h"
    38 #include "LayerTextureUpdater.h"
    3938#include "TraceEvent.h"
    4039
     40#include <wtf/PassOwnArrayPtr.h>
     41
    4142using namespace std;
    4243
    4344namespace WebCore {
    4445
    45 PassOwnPtr<LayerTilerChromium> LayerTilerChromium::create(LayerRendererChromium* layerRenderer, PassOwnPtr<LayerTextureUpdater> textureUpdater, const IntSize& tileSize, BorderTexelOption border)
     46PassOwnPtr<LayerTilerChromium> LayerTilerChromium::create(LayerRendererChromium* layerRenderer, const IntSize& tileSize, BorderTexelOption border)
    4647{
    4748    if (!layerRenderer || tileSize.isEmpty())
    4849        return nullptr;
    4950
    50     return adoptPtr(new LayerTilerChromium(layerRenderer, textureUpdater, tileSize, border));
    51 }
    52 
    53 LayerTilerChromium::LayerTilerChromium(LayerRendererChromium* layerRenderer, PassOwnPtr<LayerTextureUpdater> textureUpdater, const IntSize& tileSize, BorderTexelOption border)
     51    return adoptPtr(new LayerTilerChromium(layerRenderer, tileSize, border));
     52}
     53
     54LayerTilerChromium::LayerTilerChromium(LayerRendererChromium* layerRenderer, const IntSize& tileSize, BorderTexelOption border)
    5455    : m_skipsDraw(false)
    5556    , m_tilingData(max(tileSize.width(), tileSize.height()), 0, 0, border == HasBorderTexels)
    56     , m_textureUpdater(textureUpdater)
     57    , m_useMapSubForUploads(layerRenderer->contextSupportsMapSub())
    5758    , m_layerRenderer(layerRenderer)
    5859{
    5960    setTileSize(tileSize);
     61}
     62
     63void LayerTilerChromium::setLayerRenderer(LayerRendererChromium* layerRenderer)
     64{
     65    if (m_layerRenderer != layerRenderer)
     66        reset();
     67    m_layerRenderer = layerRenderer;
    6068}
    6169
     
    7987
    8088    m_tileSize = size;
     89    if (!m_useMapSubForUploads)
     90        m_tilePixels = adoptArrayPtr(new uint8_t[m_tileSize.width() * m_tileSize.height() * 4]);
    8191    m_tilingData.setMaxTextureSize(max(size.width(), size.height()));
    8292}
     
    221231}
    222232
    223 void LayerTilerChromium::prepareToUpdate(const IntRect& contentRect)
     233void LayerTilerChromium::update(TilePaintInterface& painter, const IntRect& contentRect)
    224234{
    225235    if (m_skipsDraw)
     
    258268        return;
    259269
    260     m_textureUpdater->prepareToUpdate(m_paintRect, m_tileSize, m_tilingData.borderTexels());
    261 }
    262 
    263 void LayerTilerChromium::updateRect()
     270    m_canvas.resize(m_paintRect.size());
     271
     272    // Assumption: if a tiler is using border texels, then it is because the
     273    // layer is likely to be filtered or transformed. Because of it might be
     274    // transformed, draw the text in grayscale instead of subpixel antialiasing.
     275    PlatformCanvas::Painter::TextOption textOption = m_tilingData.borderTexels() ? PlatformCanvas::Painter::GrayscaleText : PlatformCanvas::Painter::SubpixelText;
     276    PlatformCanvas::Painter canvasPainter(&m_canvas, textOption);
     277    canvasPainter.context()->translate(-m_paintRect.x(), -m_paintRect.y());
     278    {
     279        TRACE_EVENT("LayerTilerChromium::update::paint", this, 0);
     280        painter.paint(*canvasPainter.context(), m_paintRect);
     281    }
     282}
     283
     284void LayerTilerChromium::uploadCanvas()
     285{
     286    PlatformCanvas::AutoLocker locker(&m_canvas);
     287    {
     288        TRACE_EVENT("LayerTilerChromium::updateFromPixels", this, 0);
     289        updateFromPixels(m_updateRect, m_paintRect, locker.pixels());
     290    }
     291}
     292
     293void LayerTilerChromium::updateFromPixels(const IntRect& contentRect, const IntRect& paintRect, const uint8_t* paintPixels)
    264294{
    265295    // Painting could cause compositing to get turned off, which may cause the tiler to become invalidated mid-update.
     
    270300
    271301    int left, top, right, bottom;
    272     contentRectToTileIndices(m_updateRect, left, top, right, bottom);
     302    contentRectToTileIndices(contentRect, left, top, right, bottom);
    273303    for (int j = top; j <= bottom; ++j) {
    274304        for (int i = left; i <= right; ++i) {
     
    285315            // Paint rect not guaranteed to line up on tile boundaries, so
    286316            // make sure that sourceRect doesn't extend outside of it.
    287             sourceRect.intersect(m_paintRect);
     317            sourceRect.intersect(paintRect);
    288318            if (sourceRect.isEmpty())
    289319                continue;
     
    305335
    306336            // Offset from paint rectangle to this tile's dirty rectangle.
    307             IntPoint paintOffset(sourceRect.x() - m_paintRect.x(), sourceRect.y() - m_paintRect.y());
     337            IntPoint paintOffset(sourceRect.x() - paintRect.x(), sourceRect.y() - paintRect.y());
    308338            if (paintOffset.x() < 0)
    309339                CRASH();
    310340            if (paintOffset.y() < 0)
    311341                CRASH();
    312             if (paintOffset.x() + destRect.width() > m_paintRect.width())
    313                 CRASH();
    314             if (paintOffset.y() + destRect.height() > m_paintRect.height())
     342            if (paintOffset.x() + destRect.width() > paintRect.width())
     343                CRASH();
     344            if (paintOffset.y() + destRect.height() > paintRect.height())
    315345                CRASH();
    316346
    317347            tile->texture()->bindTexture();
     348
    318349            const GC3Dint filter = m_tilingData.borderTexels() ? GraphicsContext3D::LINEAR : GraphicsContext3D::NEAREST;
    319350            GLC(context, context->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_MIN_FILTER, filter));
    320351            GLC(context, context->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_MAG_FILTER, filter));
    321352
    322             m_textureUpdater->updateTextureRect(tile->texture(), sourceRect, destRect);
     353            if (m_useMapSubForUploads) {
     354                // Upload tile data via a mapped transfer buffer
     355                Extensions3DChromium* extensions = static_cast<Extensions3DChromium*>(context->getExtensions());
     356                uint8_t* pixelDest = static_cast<uint8_t*>(extensions->mapTexSubImage2DCHROMIUM(GraphicsContext3D::TEXTURE_2D, 0, destRect.x(), destRect.y(), destRect.width(), destRect.height(), GraphicsContext3D::RGBA, GraphicsContext3D::UNSIGNED_BYTE, Extensions3DChromium::WRITE_ONLY));
     357                ASSERT(pixelDest);
     358                if (paintRect.width() == sourceRect.width() && !paintOffset.x())
     359                    memcpy(pixelDest, &paintPixels[4 * paintOffset.y() * paintRect.width()], paintRect.width() * destRect.height() * 4);
     360                else {
     361                    // Strides not equal, so do a row-by-row memcpy from the
     362                    // paint results into the pixelDest
     363                    for (int row = 0; row < destRect.height(); ++row)
     364                        memcpy(&pixelDest[destRect.width() * 4 * row],
     365                               &paintPixels[4 * (paintOffset.x() + (paintOffset.y() + row) * paintRect.width())],
     366                               destRect.width() * 4);
     367                }
     368                extensions->unmapTexSubImage2DCHROMIUM(pixelDest);
     369            } else {
     370                const uint8_t* pixelSource;
     371                if (paintRect.width() == sourceRect.width() && !paintOffset.x())
     372                    pixelSource = &paintPixels[4 * paintOffset.y() * paintRect.width()];
     373                else {
     374                    // Strides not equal, so do a row-by-row memcpy from the
     375                    // paint results into a temp buffer for uploading.
     376                    for (int row = 0; row < destRect.height(); ++row)
     377                        memcpy(&m_tilePixels[destRect.width() * 4 * row],
     378                               &paintPixels[4 * (paintOffset.x() + (paintOffset.y() + row) * paintRect.width())],
     379                               destRect.width() * 4);
     380
     381                    pixelSource = &m_tilePixels[0];
     382                }
     383
     384
     385                GLC(context, context->texSubImage2D(GraphicsContext3D::TEXTURE_2D, 0, destRect.x(), destRect.y(), destRect.width(), destRect.height(), GraphicsContext3D::RGBA, GraphicsContext3D::UNSIGNED_BYTE, pixelSource));
     386            }
     387
    323388            tile->clearDirty();
    324389        }
     
    366431            float texScaleX = tileRect.width() / tileWidth;
    367432            float texScaleY = tileRect.height() / tileHeight;
    368             // OpenGL coordinate system is bottom-up.
    369             // If tile texture is top-down, we need to flip the texture coordinates.
    370             if (m_textureUpdater->orientation() == LayerTextureUpdater::TopDownOrientation) {
    371                 texTranslateY += 1.0;
    372                 texScaleY *= -1.0;
    373             }
     433
    374434            drawTexturedQuad(context, layerRenderer()->projectionMatrix(), tileMatrix, tileRect.width(), tileRect.height(), opacity, texTranslateX, texTranslateY, texScaleX, texScaleY, program);
    375435        }
  • trunk/Source/WebCore/platform/graphics/chromium/LayerTilerChromium.h

    r86625 r86640  
    3232#include "LayerChromium.h"
    3333#include "LayerTexture.h"
     34#include "PlatformCanvas.h"
    3435#include "TilingData.h"
    3536#include <wtf/HashTraits.h>
     37#include <wtf/OwnArrayPtr.h>
    3638#include <wtf/RefCounted.h>
    3739
     
    4042class GraphicsContext3D;
    4143class LayerRendererChromium;
    42 class LayerTextureUpdater;
     44
     45class TilePaintInterface {
     46public:
     47    virtual void paint(GraphicsContext& context, const IntRect& contentRect) = 0;
     48};
    4349
    4450class LayerTilerChromium {
     
    4753    enum BorderTexelOption { HasBorderTexels, NoBorderTexels };
    4854
    49     static PassOwnPtr<LayerTilerChromium> create(LayerRendererChromium*, PassOwnPtr<LayerTextureUpdater>, const IntSize& tileSize, BorderTexelOption);
     55    static PassOwnPtr<LayerTilerChromium> create(LayerRendererChromium*, const IntSize& tileSize, BorderTexelOption);
    5056
    5157    ~LayerTilerChromium();
     
    5561    void invalidateEntireLayer();
    5662
    57     // Prepare data needed to update textures that instersect with contentRect.
    58     void prepareToUpdate(const IntRect& contentRect);
    59     // Update invalid textures that intersect with contentRect provided in prepareToUpdate().
    60     void updateRect();
     63    // Paint all invalidations and missing tiles needed to draw the contentRect
     64    // into the internal canvas.
     65    void update(TilePaintInterface& painter, const IntRect& contentRect);
     66
     67    // Reserve and upload tile textures from the internal canvas.
     68    void uploadCanvas();
     69
     70    // Reserve and upload tile textures from an externally painted buffer.
     71    void updateFromPixels(const IntRect& contentRect, const IntRect& paintRect, const uint8_t* pixels);
     72
    6173    // Draw all tiles that intersect with the content rect.
    6274    void draw(const IntRect& contentRect, const TransformationMatrix&, float opacity);
     
    6678    // Change the tile size.  This may invalidate all the existing tiles.
    6779    void setTileSize(const IntSize& size);
     80    void setLayerRenderer(LayerRendererChromium*);
    6881
    6982    bool skipsDraw() const { return m_skipsDraw; }
     
    7588
    7689private:
    77     LayerTilerChromium(LayerRendererChromium*, PassOwnPtr<LayerTextureUpdater>, const IntSize& tileSize, BorderTexelOption);
     90    LayerTilerChromium(LayerRendererChromium*, const IntSize& tileSize, BorderTexelOption);
    7891
    7992    class Tile : public RefCounted<Tile> {
    8093        WTF_MAKE_NONCOPYABLE(Tile);
    8194    public:
    82         explicit Tile(PassOwnPtr<LayerTexture> tex) : m_tex(tex), m_i(-1), m_j(-1) { }
     95        explicit Tile(PassOwnPtr<LayerTexture> tex) : m_tex(tex), m_i(-1), m_j(-1) {}
    8396
    8497        LayerTexture* texture() { return m_tex.get(); }
     
    145158    Vector<RefPtr<Tile> > m_unusedTiles;
    146159
    147     // State held between update and upload.
     160    // State held between update and uploadCanvas.
    148161    IntRect m_paintRect;
    149162    IntRect m_updateRect;
     163    PlatformCanvas m_canvas;
     164
     165    // Cache a tile-sized pixel buffer to draw into.
     166    OwnArrayPtr<uint8_t> m_tilePixels;
    150167
    151168    TilingData m_tilingData;
    152169
    153     OwnPtr<LayerTextureUpdater> m_textureUpdater;
     170    // Whether the tiler will use GL_CHROMIUM_map_sub for texture uploads.
     171    bool m_useMapSubForUploads;
     172
    154173    LayerRendererChromium* m_layerRenderer;
    155174};
  • trunk/Source/WebCore/platform/graphics/chromium/cc/CCHeadsUpDisplay.cpp

    r86625 r86640  
    3535#include "LayerRendererChromium.h"
    3636#include "LayerTexture.h"
    37 #include "PlatformCanvas.h"
    3837#include "TextRun.h"
    3938#include "TextStream.h"
     
    116115            extensions->unmapTexSubImage2DCHROMIUM(pixelDest);
    117116        } else
    118             GLC(context, context->texImage2D(GraphicsContext3D::TEXTURE_2D, 0, GraphicsContext3D::RGBA, canvas.size().width(), canvas.size().height(), 0, GraphicsContext3D::RGBA, GraphicsContext3D::UNSIGNED_BYTE, locker.pixels()));
     117            GLC(context.get(), context->texImage2D(GraphicsContext3D::TEXTURE_2D, 0, GraphicsContext3D::RGBA, canvas.size().width(), canvas.size().height(), 0, GraphicsContext3D::RGBA, GraphicsContext3D::UNSIGNED_BYTE, locker.pixels()));
    119118    }
    120119
  • trunk/Source/WebKit/chromium/ChangeLog

    r86625 r86640  
     12011-05-16  Andrew Wilson  <atwilson@chromium.org>
     2
     3        Unreviewed, rolling out r86625.
     4        http://trac.webkit.org/changeset/86625
     5        https://bugs.webkit.org/show_bug.cgi?id=60719
     6
     7        Caused failed assertion on Chromium gpu canary bots
     8
     9        * src/WebViewImpl.cpp:
     10
    1112011-05-16  Alok Priyadarshi  <alokp@chromium.org>
    212
  • trunk/Source/WebKit/chromium/src/WebViewImpl.cpp

    r86625 r86640  
    7373#include "KeyboardCodes.h"
    7474#include "KeyboardEvent.h"
    75 #include "LayerPainterChromium.h"
    7675#include "MIMETypeRegistry.h"
    7776#include "NodeRenderStyle.h"
     
    24112410}
    24122411
    2413 class WebViewImplContentPainter : public LayerPainterChromium {
     2412class WebViewImplContentPainter : public TilePaintInterface {
    24142413    WTF_MAKE_NONCOPYABLE(WebViewImplContentPainter);
    24152414public:
Note: See TracChangeset for help on using the changeset viewer.