Diff
Modified: trunk/Source/WebCore/ChangeLog (126239 => 126240)
--- trunk/Source/WebCore/ChangeLog 2012-08-22 01:08:45 UTC (rev 126239)
+++ trunk/Source/WebCore/ChangeLog 2012-08-22 01:11:05 UTC (rev 126240)
@@ -1,3 +1,50 @@
+2012-08-21 Sheriff Bot <[email protected]>
+
+ Unreviewed, rolling out r126202.
+ http://trac.webkit.org/changeset/126202
+ https://bugs.webkit.org/show_bug.cgi?id=94657
+
+ Causes assertion failures on Chromium Linux dbg compositing
+ layout tests (Requested by dominicc on #webkit).
+
+ * platform/graphics/chromium/FrameBufferSkPictureCanvasLayerTextureUpdater.cpp:
+ (WebCore::FrameBufferSkPictureCanvasLayerTextureUpdater::updateTextureRect):
+ * platform/graphics/chromium/LayerRendererChromium.cpp:
+ (WebCore::applyFilters):
+ (WebCore::LayerRendererChromium::drawRenderPassQuad):
+ (WebCore::LayerRendererChromium::drawTileQuad):
+ (WebCore::LayerRendererChromium::drawYUVVideoQuad):
+ (WebCore::LayerRendererChromium::drawTextureQuad):
+ (WebCore::LayerRendererChromium::getFramebufferTexture):
+ (WebCore::LayerRendererChromium::bindFramebufferToTexture):
+ * platform/graphics/chromium/LayerRendererChromium.h:
+ (LayerRendererChromium):
+ * platform/graphics/chromium/cc/CCResourceProvider.cpp:
+ (WebCore::CCResourceProvider::createResource):
+ (WebCore::CCResourceProvider::createResourceFromExternalTexture):
+ (WebCore::CCResourceProvider::deleteResource):
+ (WebCore::CCResourceProvider::upload):
+ (WebCore::CCResourceProvider::lockForWrite):
+ (WebCore::CCResourceProvider::unlockForWrite):
+ (WebCore::CCResourceProvider::flush):
+ (WebCore::CCResourceProvider::shallowFlushIfSupported):
+ (WebCore::CCResourceProvider::lockForRead):
+ (WebCore::CCResourceProvider::unlockForRead):
+ (WebCore::CCResourceProvider::CCResourceProvider):
+ * platform/graphics/chromium/cc/CCResourceProvider.h:
+ (WebCore):
+ (CCResourceProvider):
+ (WebCore::CCResourceProvider::Resource::Resource):
+ (Resource):
+ (CCScopedLockResourceForRead):
+ (WebCore::CCScopedLockResourceForRead::CCScopedLockResourceForRead):
+ (WebCore::CCScopedLockResourceForRead::~CCScopedLockResourceForRead):
+ (WebCore::CCScopedLockResourceForRead::textureId):
+ (CCScopedLockResourceForWrite):
+ (WebCore::CCScopedLockResourceForWrite::CCScopedLockResourceForWrite):
+ (WebCore::CCScopedLockResourceForWrite::~CCScopedLockResourceForWrite):
+ (WebCore::CCScopedLockResourceForWrite::textureId):
+
2012-08-21 David Grogan <[email protected]>
IndexedDB: Fire error at request when abort is called in upgradeneeded
Modified: trunk/Source/WebCore/platform/graphics/chromium/FrameBufferSkPictureCanvasLayerTextureUpdater.cpp (126239 => 126240)
--- trunk/Source/WebCore/platform/graphics/chromium/FrameBufferSkPictureCanvasLayerTextureUpdater.cpp 2012-08-22 01:08:45 UTC (rev 126239)
+++ trunk/Source/WebCore/platform/graphics/chromium/FrameBufferSkPictureCanvasLayerTextureUpdater.cpp 2012-08-22 01:11:05 UTC (rev 126240)
@@ -107,7 +107,7 @@
context->makeContextCurrent();
texture->acquireBackingTexture(resourceProvider);
- CCResourceProvider::ScopedWriteLockGL lock(resourceProvider, texture->resourceId());
+ CCScopedLockResourceForWrite lock(resourceProvider, texture->resourceId());
// Create an accelerated canvas to draw on.
OwnPtr<SkCanvas> canvas = createAcceleratedCanvas(grContext, texture->size(), lock.textureId());
Modified: trunk/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp (126239 => 126240)
--- trunk/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp 2012-08-22 01:08:45 UTC (rev 126239)
+++ trunk/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp 2012-08-22 01:11:05 UTC (rev 126240)
@@ -363,7 +363,7 @@
layerRenderer->context()->flush();
- CCResourceProvider::ScopedWriteLockGL lock(layerRenderer->resourceProvider(), sourceTexture->id());
+ CCScopedLockResourceForWrite lock(layerRenderer->resourceProvider(), sourceTexture->id());
SkBitmap source = CCRenderSurfaceFilters::apply(filters, lock.textureId(), sourceTexture->size(), filterContext, filterGrContext);
return source;
}
@@ -465,20 +465,20 @@
// FIXME: Cache this value so that we don't have to do it for both the surface and its replica.
// Apply filters to the contents texture.
SkBitmap filterBitmap = applyFilters(this, renderPass->filters(), contentsTexture);
- OwnPtr<CCResourceProvider::ScopedReadLockGL> contentsResourceLock;
+ OwnPtr<CCScopedLockResourceForRead> contentsResourceLock;
unsigned contentsTextureId = 0;
if (filterBitmap.getTexture()) {
GrTexture* texture = reinterpret_cast<GrTexture*>(filterBitmap.getTexture());
contentsTextureId = texture->getTextureHandle();
} else {
- contentsResourceLock = adoptPtr(new CCResourceProvider::ScopedReadLockGL(m_resourceProvider, contentsTexture->id()));
+ contentsResourceLock = adoptPtr(new CCScopedLockResourceForRead(m_resourceProvider, contentsTexture->id()));
contentsTextureId = contentsResourceLock->textureId();
}
// Draw the background texture if there is one.
if (backgroundTexture) {
ASSERT(backgroundTexture->size() == quad->quadRect().size());
- CCResourceProvider::ScopedReadLockGL lock(m_resourceProvider, backgroundTexture->id());
+ CCScopedLockResourceForRead lock(m_resourceProvider, backgroundTexture->id());
copyTextureToFramebuffer(frame, lock.textureId(), quad->quadRect(), quad->quadTransform());
}
@@ -495,10 +495,10 @@
deviceLayerEdges.inflateAntiAliasingDistance();
}
- OwnPtr<CCResourceProvider::ScopedReadLockGL> maskResourceLock;
+ OwnPtr<CCScopedLockResourceForRead> maskResourceLock;
unsigned maskTextureId = 0;
if (quad->maskResourceId()) {
- maskResourceLock = adoptPtr(new CCResourceProvider::ScopedReadLockGL(m_resourceProvider, quad->maskResourceId()));
+ maskResourceLock = adoptPtr(new CCScopedLockResourceForRead(m_resourceProvider, quad->maskResourceId()));
maskTextureId = maskResourceLock->textureId();
}
@@ -689,7 +689,7 @@
GLC(context(), context()->useProgram(uniforms.program));
GLC(context(), context()->uniform1i(uniforms.samplerLocation, 0));
GLC(context(), context()->activeTexture(GraphicsContext3D::TEXTURE0));
- CCResourceProvider::ScopedReadLockGL quadResourceLock(m_resourceProvider, quad->resourceId());
+ CCScopedLockResourceForRead quadResourceLock(m_resourceProvider, quad->resourceId());
GLC(context(), context()->bindTexture(GraphicsContext3D::TEXTURE_2D, quadResourceLock.textureId()));
GLC(context(), context()->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_MIN_FILTER, quad->textureFilter()));
GLC(context(), context()->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_MAG_FILTER, quad->textureFilter()));
@@ -796,9 +796,9 @@
const CCVideoLayerImpl::FramePlane& uPlane = quad->uPlane();
const CCVideoLayerImpl::FramePlane& vPlane = quad->vPlane();
- CCResourceProvider::ScopedReadLockGL yPlaneLock(m_resourceProvider, yPlane.resourceId);
- CCResourceProvider::ScopedReadLockGL uPlaneLock(m_resourceProvider, uPlane.resourceId);
- CCResourceProvider::ScopedReadLockGL vPlaneLock(m_resourceProvider, vPlane.resourceId);
+ CCScopedLockResourceForRead yPlaneLock(m_resourceProvider, yPlane.resourceId);
+ CCScopedLockResourceForRead uPlaneLock(m_resourceProvider, uPlane.resourceId);
+ CCScopedLockResourceForRead vPlaneLock(m_resourceProvider, vPlane.resourceId);
GLC(context(), context()->activeTexture(GraphicsContext3D::TEXTURE1));
GLC(context(), context()->bindTexture(GraphicsContext3D::TEXTURE_2D, yPlaneLock.textureId()));
GLC(context(), context()->activeTexture(GraphicsContext3D::TEXTURE2));
@@ -907,7 +907,7 @@
GLC(context(), context()->uniform4f(binding.texTransformLocation, uvRect.x(), uvRect.y(), uvRect.width(), uvRect.height()));
GLC(context(), context()->activeTexture(GraphicsContext3D::TEXTURE0));
- CCResourceProvider::ScopedReadLockGL quadResourceLock(m_resourceProvider, quad->resourceId());
+ CCScopedLockResourceForRead quadResourceLock(m_resourceProvider, quad->resourceId());
GLC(context(), context()->bindTexture(GraphicsContext3D::TEXTURE_2D, quadResourceLock.textureId()));
// FIXME: setting the texture parameters every time is redundant. Move this code somewhere
@@ -1199,7 +1199,7 @@
if (!texture->id() && !texture->allocate(CCRenderer::ImplPool, deviceRect.size(), GraphicsContext3D::RGB, CCResourceProvider::TextureUsageAny))
return false;
- CCResourceProvider::ScopedWriteLockGL lock(m_resourceProvider, texture->id());
+ CCScopedLockResourceForWrite lock(m_resourceProvider, texture->id());
GLC(m_context, m_context->bindTexture(GraphicsContext3D::TEXTURE_2D, lock.textureId()));
GLC(m_context, m_context->copyTexImage2D(GraphicsContext3D::TEXTURE_2D, 0, texture->format(),
deviceRect.x(), deviceRect.y(), deviceRect.width(), deviceRect.height(), 0));
@@ -1226,7 +1226,7 @@
ASSERT(texture->id());
GLC(m_context, m_context->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, m_offscreenFramebufferId));
- m_currentFramebufferLock = adoptPtr(new CCResourceProvider::ScopedWriteLockGL(m_resourceProvider, texture->id()));
+ m_currentFramebufferLock = adoptPtr(new CCScopedLockResourceForWrite(m_resourceProvider, texture->id()));
unsigned textureId = m_currentFramebufferLock->textureId();
GLC(m_context, m_context->framebufferTexture2D(GraphicsContext3D::FRAMEBUFFER, GraphicsContext3D::COLOR_ATTACHMENT0, GraphicsContext3D::TEXTURE_2D, textureId, 0));
Modified: trunk/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.h (126239 => 126240)
--- trunk/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.h 2012-08-22 01:08:45 UTC (rev 126239)
+++ trunk/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.h 2012-08-22 01:11:05 UTC (rev 126240)
@@ -248,7 +248,7 @@
bool m_visible;
TextureUploaderOption m_textureUploaderSetting;
- OwnPtr<CCResourceProvider::ScopedWriteLockGL> m_currentFramebufferLock;
+ OwnPtr<CCScopedLockResourceForWrite> m_currentFramebufferLock;
};
Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCResourceProvider.cpp (126239 => 126240)
--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCResourceProvider.cpp 2012-08-22 01:08:45 UTC (rev 126239)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCResourceProvider.cpp 2012-08-22 01:11:05 UTC (rev 126240)
@@ -31,7 +31,6 @@
#include "IntRect.h"
#include "LayerRendererChromium.h" // For the GLC() macro
#include "LayerTextureSubImage.h"
-#include <limits.h>
#include <public/WebGraphicsContext3D.h>
#include <wtf/HashSet.h>
@@ -89,24 +88,13 @@
CCResourceProvider::ResourceId CCResourceProvider::createResource(int pool, const IntSize& size, GC3Denum format, TextureUsageHint hint)
{
- switch (m_defaultResourceType) {
- case GLTexture:
- return createGLTexture(pool, size, format, hint);
- case Bitmap:
- ASSERT(format == GraphicsContext3D::RGBA);
- return createBitmap(pool, size);
- }
-
- CRASH();
- return 0;
-}
-
-CCResourceProvider::ResourceId CCResourceProvider::createGLTexture(int pool, const IntSize& size, GC3Denum format, TextureUsageHint hint)
-{
ASSERT(CCProxy::isImplThread());
unsigned textureId = 0;
WebGraphicsContext3D* context3d = m_context->context3D();
- ASSERT(context3d);
+ if (!context3d) {
+ // FIXME: Implement this path for software compositing.
+ return 0;
+ }
GLC(context3d, textureId = context3d->createTexture());
GLC(context3d, context3d->bindTexture(GraphicsContext3D::TEXTURE_2D, textureId));
GLC(context3d, context3d->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_MIN_FILTER, GraphicsContext3D::LINEAR));
@@ -127,23 +115,12 @@
return id;
}
-CCResourceProvider::ResourceId CCResourceProvider::createBitmap(int pool, const IntSize& size)
-{
- ASSERT(CCProxy::isImplThread());
-
- uint8_t* pixels = new uint8_t[size.width() * size.height() * 4];
-
- ResourceId id = m_nextId++;
- Resource resource(pixels, pool, size, GraphicsContext3D::RGBA);
- m_resources.add(id, resource);
- return id;
-}
-
CCResourceProvider::ResourceId CCResourceProvider::createResourceFromExternalTexture(unsigned textureId)
{
ASSERT(CCProxy::isImplThread());
ResourceId id = m_nextId++;
- Resource resource(textureId, 0, IntSize(), 0);
+ Resource resource;
+ resource.glId = textureId;
resource.external = true;
m_resources.add(id, resource);
return id;
@@ -152,17 +129,15 @@
void CCResourceProvider::deleteResource(ResourceId id)
{
ASSERT(CCProxy::isImplThread());
+ WebGraphicsContext3D* context3d = m_context->context3D();
+ if (!context3d) {
+ // FIXME: Implement this path for software compositing.
+ return;
+ }
ResourceMap::iterator it = m_resources.find(id);
ASSERT(it != m_resources.end() && !it->second.lockedForWrite && !it->second.lockForReadCount);
-
- if (it->second.glId && !it->second.external) {
- WebGraphicsContext3D* context3d = m_context->context3D();
- ASSERT(context3d);
+ if (!it->second.external)
GLC(context3d, context3d->deleteTexture(it->second.glId));
- }
- if (it->second.pixels)
- delete it->second.pixels;
-
m_resources.remove(it);
}
@@ -178,68 +153,71 @@
deleteResource(*it);
}
-CCResourceProvider::ResourceType CCResourceProvider::resourceType(ResourceId id)
+void CCResourceProvider::upload(ResourceId id, const uint8_t* image, const IntRect& imageRect, const IntRect& sourceRect, const IntSize& destOffset)
{
+ ASSERT(CCProxy::isImplThread());
+ ASSERT(m_texSubImage.get());
+ WebGraphicsContext3D* context3d = m_context->context3D();
+ if (!context3d) {
+ // FIXME: Implement this path for software compositing.
+ return;
+ }
ResourceMap::iterator it = m_resources.find(id);
- ASSERT(it != m_resources.end());
- return it->second.type;
+ ASSERT(it != m_resources.end() && !it->second.lockedForWrite && !it->second.lockForReadCount && !it->second.external);
+
+ context3d->bindTexture(GraphicsContext3D::TEXTURE_2D, it->second.glId);
+ m_texSubImage->upload(image, imageRect, sourceRect, destOffset, it->second.format, context3d);
}
-void CCResourceProvider::upload(ResourceId id, const uint8_t* image, const IntRect& imageRect, const IntRect& sourceRect, const IntSize& destOffset)
+unsigned CCResourceProvider::lockForWrite(ResourceId id)
{
ASSERT(CCProxy::isImplThread());
ResourceMap::iterator it = m_resources.find(id);
ASSERT(it != m_resources.end() && !it->second.lockedForWrite && !it->second.lockForReadCount && !it->second.external);
+ it->second.lockedForWrite = true;
+ return it->second.glId;
+}
- if (it->second.glId) {
- WebGraphicsContext3D* context3d = m_context->context3D();
- ASSERT(context3d);
- ASSERT(m_texSubImage.get());
- context3d->bindTexture(GraphicsContext3D::TEXTURE_2D, it->second.glId);
- m_texSubImage->upload(image, imageRect, sourceRect, destOffset, it->second.format, context3d);
- }
-
- if (it->second.pixels) {
- SkBitmap srcFull;
- srcFull.setConfig(SkBitmap::kARGB_8888_Config, imageRect.width(), imageRect.height());
- srcFull.setPixels(const_cast<uint8_t*>(image));
- SkBitmap srcSubset;
- SkIRect skSourceRect = SkIRect::MakeXYWH(sourceRect.x(), sourceRect.y(), sourceRect.width(), sourceRect.height());
- skSourceRect.offset(-imageRect.x(), -imageRect.y());
- srcFull.extractSubset(&srcSubset, skSourceRect);
-
- ScopedWriteLockSoftware lock(this, id);
- SkCanvas* dest = lock.skCanvas();
- dest->writePixels(srcSubset, destOffset.width(), destOffset.height());
- }
+void CCResourceProvider::unlockForWrite(ResourceId id)
+{
+ ASSERT(CCProxy::isImplThread());
+ ResourceMap::iterator it = m_resources.find(id);
+ ASSERT(it != m_resources.end() && it->second.lockedForWrite && !it->second.external);
+ it->second.lockedForWrite = false;
}
void CCResourceProvider::flush()
{
ASSERT(CCProxy::isImplThread());
WebGraphicsContext3D* context3d = m_context->context3D();
- if (context3d)
- context3d->flush();
+ if (!context3d) {
+ // FIXME: Implement this path for software compositing.
+ return;
+ }
+ context3d->flush();
}
bool CCResourceProvider::shallowFlushIfSupported()
{
ASSERT(CCProxy::isImplThread());
WebGraphicsContext3D* context3d = m_context->context3D();
- if (!context3d || !m_useShallowFlush)
+ if (!context3d) {
+ // FIXME: Implement this path for software compositing.
return false;
+ }
- context3d->shallowFlushCHROMIUM();
- return true;
+ if (m_useShallowFlush)
+ context3d->shallowFlushCHROMIUM();
+ return m_useShallowFlush;
}
-const CCResourceProvider::Resource* CCResourceProvider::lockForRead(ResourceId id)
+unsigned CCResourceProvider::lockForRead(ResourceId id)
{
ASSERT(CCProxy::isImplThread());
ResourceMap::iterator it = m_resources.find(id);
ASSERT(it != m_resources.end() && !it->second.lockedForWrite);
- it->second.lockForReadCount++;
- return &it->second;
+ ++(it->second.lockForReadCount);
+ return it->second.glId;
}
void CCResourceProvider::unlockForRead(ResourceId id)
@@ -247,94 +225,17 @@
ASSERT(CCProxy::isImplThread());
ResourceMap::iterator it = m_resources.find(id);
ASSERT(it != m_resources.end() && it->second.lockForReadCount > 0);
- it->second.lockForReadCount--;
+ --(it->second.lockForReadCount);
}
-const CCResourceProvider::Resource* CCResourceProvider::lockForWrite(ResourceId id)
-{
- ASSERT(CCProxy::isImplThread());
- ResourceMap::iterator it = m_resources.find(id);
- ASSERT(it != m_resources.end() && !it->second.lockedForWrite && !it->second.lockForReadCount && !it->second.external);
- it->second.lockedForWrite = true;
- return &it->second;
-}
-
-void CCResourceProvider::unlockForWrite(ResourceId id)
-{
- ASSERT(CCProxy::isImplThread());
- ResourceMap::iterator it = m_resources.find(id);
- ASSERT(it != m_resources.end() && it->second.lockedForWrite && !it->second.external);
- it->second.lockedForWrite = false;
-}
-
-CCResourceProvider::ScopedReadLockGL::ScopedReadLockGL(CCResourceProvider* resourceProvider, CCResourceProvider::ResourceId resourceId)
- : m_resourceProvider(resourceProvider)
- , m_resourceId(resourceId)
- , m_textureId(resourceProvider->lockForRead(resourceId)->glId)
-{
- ASSERT(m_textureId);
-}
-
-CCResourceProvider::ScopedReadLockGL::~ScopedReadLockGL()
-{
- m_resourceProvider->unlockForRead(m_resourceId);
-}
-
-CCResourceProvider::ScopedWriteLockGL::ScopedWriteLockGL(CCResourceProvider* resourceProvider, CCResourceProvider::ResourceId resourceId)
- : m_resourceProvider(resourceProvider)
- , m_resourceId(resourceId)
- , m_textureId(resourceProvider->lockForWrite(resourceId)->glId)
-{
- ASSERT(m_textureId);
-}
-
-CCResourceProvider::ScopedWriteLockGL::~ScopedWriteLockGL()
-{
- m_resourceProvider->unlockForWrite(m_resourceId);
-}
-
-void CCResourceProvider::populateSkBitmapWithResource(SkBitmap* skBitmap, const Resource* resource)
-{
- ASSERT(resource->pixels);
- ASSERT(resource->format == GraphicsContext3D::RGBA);
- skBitmap->setConfig(SkBitmap::kARGB_8888_Config, resource->size.width(), resource->size.height());
- skBitmap->setPixels(resource->pixels);
-}
-
-CCResourceProvider::ScopedReadLockSoftware::ScopedReadLockSoftware(CCResourceProvider* resourceProvider, CCResourceProvider::ResourceId resourceId)
- : m_resourceProvider(resourceProvider)
- , m_resourceId(resourceId)
-{
- CCResourceProvider::populateSkBitmapWithResource(&m_skBitmap, resourceProvider->lockForRead(resourceId));
-}
-
-CCResourceProvider::ScopedReadLockSoftware::~ScopedReadLockSoftware()
-{
- m_resourceProvider->unlockForRead(m_resourceId);
-}
-
-CCResourceProvider::ScopedWriteLockSoftware::ScopedWriteLockSoftware(CCResourceProvider* resourceProvider, CCResourceProvider::ResourceId resourceId)
- : m_resourceProvider(resourceProvider)
- , m_resourceId(resourceId)
-{
- CCResourceProvider::populateSkBitmapWithResource(&m_skBitmap, resourceProvider->lockForWrite(resourceId));
- m_skCanvas.setBitmapDevice(m_skBitmap);
-}
-
-CCResourceProvider::ScopedWriteLockSoftware::~ScopedWriteLockSoftware()
-{
- m_resourceProvider->unlockForWrite(m_resourceId);
-}
-
CCResourceProvider::CCResourceProvider(CCGraphicsContext* context)
: m_context(context)
, m_nextId(1)
, m_nextChild(1)
- , m_defaultResourceType(GLTexture)
, m_useTextureStorageExt(false)
, m_useTextureUsageHint(false)
, m_useShallowFlush(false)
- , m_maxTextureSize(INT_MAX)
+ , m_maxTextureSize(0)
{
}
Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCResourceProvider.h (126239 => 126240)
--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCResourceProvider.h 2012-08-22 01:08:45 UTC (rev 126239)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCResourceProvider.h 2012-08-22 01:11:05 UTC (rev 126240)
@@ -30,8 +30,6 @@
#include "CCGraphicsContext.h"
#include "GraphicsContext3D.h"
#include "IntSize.h"
-#include "SkBitmap.h"
-#include "SkCanvas.h"
#include <wtf/Deque.h>
#include <wtf/HashMap.h>
#include <wtf/OwnPtr.h>
@@ -46,6 +44,8 @@
namespace WebCore {
+class CCScopedLockResourceForRead;
+class CCScopedLockResourceForWrite;
class IntRect;
class LayerTextureSubImage;
@@ -58,10 +58,6 @@
typedef Vector<ResourceId> ResourceIdArray;
typedef HashMap<ResourceId, ResourceId> ResourceIdMap;
enum TextureUsageHint { TextureUsageAny, TextureUsageFramebuffer };
- enum ResourceType {
- GLTexture = 1,
- Bitmap,
- };
struct Mailbox {
GC3Dbyte name[64];
};
@@ -91,19 +87,11 @@
// Producer interface.
- void setDefaultResourceType(ResourceType type) { m_defaultResourceType = type; }
- ResourceType defaultResourceType() const { return m_defaultResourceType; }
- ResourceType resourceType(ResourceId);
-
- // Creates a resource of the default resource type.
+ // Creates a resource of the given size/format, into the given pool.
ResourceId createResource(int pool, const IntSize&, GC3Denum format, TextureUsageHint);
- // You can also explicitly create a specific resource type.
- ResourceId createGLTexture(int pool, const IntSize&, GC3Denum format, TextureUsageHint);
- ResourceId createBitmap(int pool, const IntSize&);
- // Wraps an external texture into a GL resource.
+ // Wraps an external texture into a resource.
ResourceId createResourceFromExternalTexture(unsigned textureId);
-
void deleteResource(ResourceId);
// Deletes all resources owned by a given pool.
@@ -159,72 +147,13 @@
// Only for testing
size_t mailboxCount() const { return m_mailboxes.size(); }
- // The following lock classes are part of the CCResourceProvider API and are
- // needed to read and write the resource contents. The user must ensure
- // that they only use GL locks on GL resources, etc, and this is enforced
- // by assertions.
- class ScopedReadLockGL {
- WTF_MAKE_NONCOPYABLE(ScopedReadLockGL);
- public:
- ScopedReadLockGL(CCResourceProvider*, CCResourceProvider::ResourceId);
- ~ScopedReadLockGL();
-
- unsigned textureId() const { return m_textureId; }
-
- private:
- CCResourceProvider* m_resourceProvider;
- CCResourceProvider::ResourceId m_resourceId;
- unsigned m_textureId;
- };
-
- class ScopedWriteLockGL {
- WTF_MAKE_NONCOPYABLE(ScopedWriteLockGL);
- public:
- ScopedWriteLockGL(CCResourceProvider*, CCResourceProvider::ResourceId);
- ~ScopedWriteLockGL();
-
- unsigned textureId() const { return m_textureId; }
-
- private:
- CCResourceProvider* m_resourceProvider;
- CCResourceProvider::ResourceId m_resourceId;
- unsigned m_textureId;
- };
-
- class ScopedReadLockSoftware {
- WTF_MAKE_NONCOPYABLE(ScopedReadLockSoftware);
- public:
- ScopedReadLockSoftware(CCResourceProvider*, CCResourceProvider::ResourceId);
- ~ScopedReadLockSoftware();
-
- const SkBitmap* skBitmap() const { return &m_skBitmap; }
-
- private:
- CCResourceProvider* m_resourceProvider;
- CCResourceProvider::ResourceId m_resourceId;
- SkBitmap m_skBitmap;
- };
-
- class ScopedWriteLockSoftware {
- WTF_MAKE_NONCOPYABLE(ScopedWriteLockSoftware);
- public:
- ScopedWriteLockSoftware(CCResourceProvider*, CCResourceProvider::ResourceId);
- ~ScopedWriteLockSoftware();
-
- SkCanvas* skCanvas() { return &m_skCanvas; }
-
- private:
- CCResourceProvider* m_resourceProvider;
- CCResourceProvider::ResourceId m_resourceId;
- SkBitmap m_skBitmap;
- SkCanvas m_skCanvas;
- };
-
private:
+ friend class CCScopedLockResourceForRead;
+ friend class CCScopedLockResourceForWrite;
+
struct Resource {
Resource()
: glId(0)
- , pixels(0)
, pool(0)
, lockForReadCount(0)
, lockedForWrite(false)
@@ -232,11 +161,9 @@
, exported(false)
, size()
, format(0)
- , type(static_cast<ResourceType>(0))
{ }
Resource(unsigned textureId, int pool, const IntSize& size, GC3Denum format)
: glId(textureId)
- , pixels(0)
, pool(pool)
, lockForReadCount(0)
, lockedForWrite(false)
@@ -244,22 +171,8 @@
, exported(false)
, size(size)
, format(format)
- , type(GLTexture)
{ }
- Resource(uint8_t* pixels, int pool, const IntSize& size, GC3Denum format)
- : glId(0)
- , pixels(pixels)
- , pool(pool)
- , lockForReadCount(0)
- , lockedForWrite(false)
- , external(false)
- , exported(false)
- , size(size)
- , format(format)
- , type(Bitmap)
- { }
unsigned glId;
- uint8_t* pixels;
int pool;
int lockForReadCount;
bool lockedForWrite;
@@ -267,7 +180,6 @@
bool exported;
IntSize size;
GC3Denum format;
- ResourceType type;
};
typedef HashMap<ResourceId, Resource> ResourceMap;
struct Child {
@@ -280,12 +192,14 @@
explicit CCResourceProvider(CCGraphicsContext*);
bool initialize();
- const Resource* lockForRead(ResourceId);
- void unlockForRead(ResourceId);
- const Resource* lockForWrite(ResourceId);
+ // Gets a GL texture id representing the resource, that can be rendered into.
+ unsigned lockForWrite(ResourceId);
void unlockForWrite(ResourceId);
- static void populateSkBitmapWithResource(SkBitmap*, const Resource*);
+ // Gets a GL texture id representing the resource, that can be rendered with.
+ unsigned lockForRead(ResourceId);
+ void unlockForRead(ResourceId);
+
bool transferResource(WebKit::WebGraphicsContext3D*, ResourceId, TransferableResource*);
void trimMailboxDeque();
@@ -297,7 +211,6 @@
Deque<Mailbox> m_mailboxes;
- ResourceType m_defaultResourceType;
bool m_useTextureStorageExt;
bool m_useTextureUsageHint;
bool m_useShallowFlush;
@@ -305,6 +218,51 @@
int m_maxTextureSize;
};
+class CCScopedLockResourceForRead {
+ WTF_MAKE_NONCOPYABLE(CCScopedLockResourceForRead);
+public:
+ CCScopedLockResourceForRead(CCResourceProvider* resourceProvider, CCResourceProvider::ResourceId resourceId)
+ : m_resourceProvider(resourceProvider)
+ , m_resourceId(resourceId)
+ , m_textureId(resourceProvider->lockForRead(resourceId))
+ {
+ ASSERT(m_textureId);
+ }
+
+ ~CCScopedLockResourceForRead()
+ {
+ m_resourceProvider->unlockForRead(m_resourceId);
+ }
+
+ unsigned textureId() const { return m_textureId; }
+
+private:
+ CCResourceProvider* m_resourceProvider;
+ CCResourceProvider::ResourceId m_resourceId;
+ unsigned m_textureId;
+};
+
+class CCScopedLockResourceForWrite {
+ WTF_MAKE_NONCOPYABLE(CCScopedLockResourceForWrite);
+public:
+ CCScopedLockResourceForWrite(CCResourceProvider* resourceProvider, CCResourceProvider::ResourceId resourceId)
+ : m_resourceProvider(resourceProvider)
+ , m_resourceId(resourceId)
+ , m_textureId(resourceProvider->lockForWrite(resourceId)) { }
+
+ ~CCScopedLockResourceForWrite()
+ {
+ m_resourceProvider->unlockForWrite(m_resourceId);
+ }
+
+ unsigned textureId() const { return m_textureId; }
+
+private:
+ CCResourceProvider* m_resourceProvider;
+ CCResourceProvider::ResourceId m_resourceId;
+ unsigned m_textureId;
+};
+
}
#endif
Modified: trunk/Source/WebKit/chromium/ChangeLog (126239 => 126240)
--- trunk/Source/WebKit/chromium/ChangeLog 2012-08-22 01:08:45 UTC (rev 126239)
+++ trunk/Source/WebKit/chromium/ChangeLog 2012-08-22 01:11:05 UTC (rev 126240)
@@ -1,3 +1,17 @@
+2012-08-21 Sheriff Bot <[email protected]>
+
+ Unreviewed, rolling out r126202.
+ http://trac.webkit.org/changeset/126202
+ https://bugs.webkit.org/show_bug.cgi?id=94657
+
+ Causes assertion failures on Chromium Linux dbg compositing
+ layout tests (Requested by dominicc on #webkit).
+
+ * tests/CCResourceProviderTest.cpp:
+ (WebKit::CCResourceProviderTest::CCResourceProviderTest):
+ (WebKit::CCResourceProviderTest::getResourcePixels):
+ (WebKit::TEST_F):
+
2012-08-21 Leandro Gracia Gil <[email protected]>
[Chromium] Find-in-page coordinates should use containingBlock
Modified: trunk/Source/WebKit/chromium/tests/CCResourceProviderTest.cpp (126239 => 126240)
--- trunk/Source/WebKit/chromium/tests/CCResourceProviderTest.cpp 2012-08-22 01:08:45 UTC (rev 126239)
+++ trunk/Source/WebKit/chromium/tests/CCResourceProviderTest.cpp 2012-08-22 01:11:05 UTC (rev 126240)
@@ -287,38 +287,25 @@
PendingProduceTextureList m_pendingProduceTextures;
};
-class CCResourceProviderTest : public testing::TestWithParam<CCResourceProvider::ResourceType> {
+class CCResourceProviderTest : public testing::Test {
public:
CCResourceProviderTest()
: m_sharedData(ContextSharedData::create())
, m_context(FakeWebCompositorOutputSurface::create(ResourceProviderContext::create(m_sharedData.get())))
, m_resourceProvider(CCResourceProvider::create(m_context.get()))
{
- m_resourceProvider->setDefaultResourceType(GetParam());
}
ResourceProviderContext* context() { return static_cast<ResourceProviderContext*>(m_context->context3D()); }
void getResourcePixels(CCResourceProvider::ResourceId id, const IntSize& size, WGC3Denum format, uint8_t* pixels)
{
- if (GetParam() == CCResourceProvider::GLTexture) {
- CCResourceProvider::ScopedReadLockGL lockGL(m_resourceProvider.get(), id);
- ASSERT_NE(0U, lockGL.textureId());
- context()->bindTexture(GraphicsContext3D::TEXTURE_2D, lockGL.textureId());
- context()->getPixels(size, format, pixels);
- } else if (GetParam() == CCResourceProvider::Bitmap) {
- CCResourceProvider::ScopedReadLockSoftware lockSoftware(m_resourceProvider.get(), id);
- memcpy(pixels, lockSoftware.skBitmap()->getPixels(), lockSoftware.skBitmap()->getSize());
- }
+ CCScopedLockResourceForRead lock(m_resourceProvider.get(), id);
+ ASSERT_NE(0U, lock.textureId());
+ context()->bindTexture(GraphicsContext3D::TEXTURE_2D, lock.textureId());
+ context()->getPixels(size, format, pixels);
}
- void expectNumResources(int count)
- {
- EXPECT_EQ(count, static_cast<int>(m_resourceProvider->numResources()));
- if (GetParam() == CCResourceProvider::GLTexture)
- EXPECT_EQ(count, context()->textureCount());
- }
-
protected:
DebugScopedSetImplThread implThread;
OwnPtr<ContextSharedData> m_sharedData;
@@ -326,7 +313,7 @@
OwnPtr<CCResourceProvider> m_resourceProvider;
};
-TEST_P(CCResourceProviderTest, Basic)
+TEST_F(CCResourceProviderTest, Basic)
{
IntSize size(1, 1);
WGC3Denum format = GraphicsContext3D::RGBA;
@@ -335,7 +322,7 @@
ASSERT_EQ(4U, pixelSize);
CCResourceProvider::ResourceId id = m_resourceProvider->createResource(pool, size, format, CCResourceProvider::TextureUsageAny);
- expectNumResources(1);
+ EXPECT_EQ(1, context()->textureCount());
uint8_t data[4] = {1, 2, 3, 4};
IntRect rect(IntPoint(), size);
@@ -346,10 +333,10 @@
EXPECT_EQ(0, memcmp(data, result, pixelSize));
m_resourceProvider->deleteResource(id);
- expectNumResources(0);
+ EXPECT_EQ(0, context()->textureCount());
}
-TEST_P(CCResourceProviderTest, DeleteOwnedResources)
+TEST_F(CCResourceProviderTest, DeleteOwnedResources)
{
IntSize size(1, 1);
WGC3Denum format = GraphicsContext3D::RGBA;
@@ -358,16 +345,16 @@
const int count = 3;
for (int i = 0; i < count; ++i)
m_resourceProvider->createResource(pool, size, format, CCResourceProvider::TextureUsageAny);
- expectNumResources(3);
+ EXPECT_EQ(3, context()->textureCount());
m_resourceProvider->deleteOwnedResources(pool+1);
- expectNumResources(3);
+ EXPECT_EQ(3, context()->textureCount());
m_resourceProvider->deleteOwnedResources(pool);
- expectNumResources(0);
+ EXPECT_EQ(0, context()->textureCount());
}
-TEST_P(CCResourceProviderTest, Upload)
+TEST_F(CCResourceProviderTest, Upload)
{
IntSize size(2, 2);
WGC3Denum format = GraphicsContext3D::RGBA;
@@ -415,28 +402,12 @@
getResourcePixels(id, size, format, result);
EXPECT_EQ(0, memcmp(expected, result, pixelSize));
}
- {
- IntRect offsetImageRect(IntPoint(100, 100), size);
- IntRect sourceRect(100, 100, 1, 1);
- IntSize destOffset(1, 0);
- m_resourceProvider->upload(id, image, offsetImageRect, sourceRect, destOffset);
- uint8_t expected[16] = {0, 1, 2, 3, 0, 1, 2, 3,
- 4, 5, 6, 7, 0, 1, 2, 3};
- getResourcePixels(id, size, format, result);
- EXPECT_EQ(0, memcmp(expected, result, pixelSize));
- }
-
-
m_resourceProvider->deleteResource(id);
}
-TEST_P(CCResourceProviderTest, TransferResources)
+TEST_F(CCResourceProviderTest, TransferResources)
{
- // Resource transfer is only supported with GL textures for now.
- if (GetParam() != CCResourceProvider::GLTexture)
- return;
-
OwnPtr<CCGraphicsContext> childContext(FakeWebCompositorOutputSurface::create(ResourceProviderContext::create(m_sharedData.get())));
OwnPtr<CCResourceProvider> childResourceProvider(CCResourceProvider::create(childContext.get()));
@@ -515,14 +486,14 @@
ResourceProviderContext* childContext3D = static_cast<ResourceProviderContext*>(childContext->context3D());
{
- CCResourceProvider::ScopedReadLockGL lock(childResourceProvider.get(), id1);
+ CCScopedLockResourceForRead lock(childResourceProvider.get(), id1);
ASSERT_NE(0U, lock.textureId());
childContext3D->bindTexture(GraphicsContext3D::TEXTURE_2D, lock.textureId());
childContext3D->getPixels(size, format, result);
EXPECT_EQ(0, memcmp(data1, result, pixelSize));
}
{
- CCResourceProvider::ScopedReadLockGL lock(childResourceProvider.get(), id2);
+ CCScopedLockResourceForRead lock(childResourceProvider.get(), id2);
ASSERT_NE(0U, lock.textureId());
childContext3D->bindTexture(GraphicsContext3D::TEXTURE_2D, lock.textureId());
childContext3D->getPixels(size, format, result);
@@ -548,9 +519,4 @@
EXPECT_EQ(0u, m_resourceProvider->mailboxCount());
}
-INSTANTIATE_TEST_CASE_P(CCResourceProviderTests,
- CCResourceProviderTest,
- ::testing::Values(CCResourceProvider::GLTexture,
- CCResourceProvider::Bitmap));
-
} // namespace