[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc
commit-queue at webkit.org
commit-queue at webkit.org
Wed Dec 22 11:44:07 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit 2eac2e4b41206e69f6533b22fc451fd6fc581947
Author: commit-queue at webkit.org <commit-queue at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Thu Aug 5 11:15:10 2010 +0000
2010-08-05 Victoria Kirst <vrk at google.com>
Reviewed by David Levin.
Added logic to use glMapTexSubImage2D to write video layer to GPU
texture. Also fixes CPU usage problem from previous patch.
https://bugs.webkit.org/show_bug.cgi?id=43101
No change in user-visible functionality (since it isn't turned on),
so no new tests.
* platform/graphics/chromium/VideoLayerChromium.cpp:
(WebCore::VideoLayerChromium::VideoLayerChromium):
(WebCore::VideoLayerChromium::updateTextureContents):
(WebCore::VideoLayerChromium::createTextureRect):
(WebCore::VideoLayerChromium::updateTextureRect):
(WebCore::VideoLayerChromium::updateCompleted):
* platform/graphics/chromium/VideoLayerChromium.h:
2010-08-05 Victoria Kirst <vrk at google.com>
Reviewed by David Levin.
Added a repaint request so that VideoLayerChromium does not have
a flickering problem when playing video.
https://bugs.webkit.org/show_bug.cgi?id=43101
* src/WebMediaPlayerClientImpl.cpp:
(WebKit::WebMediaPlayerClientImpl::repaint):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@64731 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index ad9d516..e2627e7 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,22 @@
+2010-08-05 Victoria Kirst <vrk at google.com>
+
+ Reviewed by David Levin.
+
+ Added logic to use glMapTexSubImage2D to write video layer to GPU
+ texture. Also fixes CPU usage problem from previous patch.
+ https://bugs.webkit.org/show_bug.cgi?id=43101
+
+ No change in user-visible functionality (since it isn't turned on),
+ so no new tests.
+
+ * platform/graphics/chromium/VideoLayerChromium.cpp:
+ (WebCore::VideoLayerChromium::VideoLayerChromium):
+ (WebCore::VideoLayerChromium::updateTextureContents):
+ (WebCore::VideoLayerChromium::createTextureRect):
+ (WebCore::VideoLayerChromium::updateTextureRect):
+ (WebCore::VideoLayerChromium::updateCompleted):
+ * platform/graphics/chromium/VideoLayerChromium.h:
+
2010-08-05 Zoltan Horvath <zoltan at webkit.org>
Reviewed by Simon Hausmann.
diff --git a/WebCore/platform/graphics/chromium/VideoLayerChromium.cpp b/WebCore/platform/graphics/chromium/VideoLayerChromium.cpp
index 5ac0e57..440b502 100644
--- a/WebCore/platform/graphics/chromium/VideoLayerChromium.cpp
+++ b/WebCore/platform/graphics/chromium/VideoLayerChromium.cpp
@@ -31,9 +31,21 @@
#include "config.h"
#if USE(ACCELERATED_COMPOSITING)
-
#include "VideoLayerChromium.h"
+#include "LayerRendererChromium.h"
+#include "RenderLayerBacking.h"
+#include "skia/ext/platform_canvas.h"
+
+#include <GLES2/gl2.h>
+#define GL_GLEXT_PROTOTYPES
+#include <GLES2/gl2ext.h>
+
+#if PLATFORM(SKIA)
+#include "NativeImageSkia.h"
+#include "PlatformContextSkia.h"
+#endif
+
namespace WebCore {
PassRefPtr<VideoLayerChromium> VideoLayerChromium::create(GraphicsLayerChromium* owner)
@@ -43,7 +55,124 @@ PassRefPtr<VideoLayerChromium> VideoLayerChromium::create(GraphicsLayerChromium*
VideoLayerChromium::VideoLayerChromium(GraphicsLayerChromium* owner)
: LayerChromium(owner)
+ , m_allocatedTextureId(0)
+ , m_canvas(0)
+ , m_skiaContext(0)
+ , m_graphicsContext(0)
+{
+}
+
+void VideoLayerChromium::updateTextureContents(unsigned textureId)
+{
+ RenderLayerBacking* backing = static_cast<RenderLayerBacking*>(m_owner->client());
+ if (!backing || backing->paintingGoesToWindow())
+ return;
+
+ ASSERT(drawsContent());
+
+ IntRect dirtyRect(m_dirtyRect);
+ IntSize requiredTextureSize;
+
+#if PLATFORM(SKIA)
+ requiredTextureSize = m_bounds;
+ IntRect boundsRect(IntPoint(0, 0), m_bounds);
+
+ // If the texture needs to be reallocated, then we must redraw the entire
+ // contents of the layer.
+ if (requiredTextureSize != m_allocatedTextureSize)
+ dirtyRect = boundsRect;
+ else {
+ // Clip the dirtyRect to the size of the layer to avoid drawing outside
+ // the bounds of the backing texture.
+ dirtyRect.intersect(boundsRect);
+ }
+
+ if (!m_canvas.get()
+ || dirtyRect.width() != m_canvas->getDevice()->width()
+ || dirtyRect.height() != m_canvas->getDevice()->height()) {
+ m_canvas = new skia::PlatformCanvas(dirtyRect.width(), dirtyRect.height(), true);
+ m_skiaContext = new PlatformContextSkia(m_canvas.get());
+
+#if OS(WINDOWS)
+ // This is needed to get text to show up correctly. Without it,
+ // GDI renders with zero alpha and the text becomes invisible.
+ // Unfortunately, setting this to true disables cleartype.
+ // FIXME: Does this take us down a very slow text rendering path?
+ // FIXME: Why is this is a windows-only call?
+ m_skiaContext->setDrawingToImageBuffer(true);
+#endif
+ m_graphicsContext = new GraphicsContext(reinterpret_cast<PlatformGraphicsContext*>(m_skiaContext.get()));
+ }
+
+ // Bring the canvas into the coordinate system of the paint rect.
+ m_canvas->translate(static_cast<SkScalar>(-dirtyRect.x()), static_cast<SkScalar>(-dirtyRect.y()));
+
+ // If the texture id or size changed since last time, then we need to tell GL
+ // to re-allocate a texture.
+ if (m_allocatedTextureId != textureId || requiredTextureSize != m_allocatedTextureSize)
+ createTextureRect(requiredTextureSize, dirtyRect, textureId);
+ else
+ updateTextureRect(dirtyRect, textureId);
+#else
+#error "Need to implement for your platform."
+#endif
+}
+
+void VideoLayerChromium::createTextureRect(const IntSize& requiredTextureSize, const IntRect& updateRect, unsigned textureId)
+{
+ // Paint into graphics context and get bitmap.
+ m_owner->paintGraphicsLayerContents(*m_graphicsContext, updateRect);
+ const SkBitmap& bitmap = m_canvas->getDevice()->accessBitmap(false);
+ const SkBitmap* skiaBitmap = &bitmap;
+ ASSERT(skiaBitmap);
+
+ void* pixels = 0;
+ IntSize bitmapSize;
+ SkAutoLockPixels lock(*skiaBitmap);
+ SkBitmap::Config skiaConfig = skiaBitmap->config();
+ // FIXME: Do we need to support more image configurations?
+ if (skiaConfig == SkBitmap::kARGB_8888_Config) {
+ pixels = skiaBitmap->getPixels();
+ bitmapSize = IntSize(skiaBitmap->width(), skiaBitmap->height());
+ }
+
+ if (!pixels)
+ return;
+
+ glBindTexture(GL_TEXTURE_2D, textureId);
+ ASSERT(bitmapSize == requiredTextureSize);
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, requiredTextureSize.width(), requiredTextureSize.height(), 0, GL_RGBA, GL_UNSIGNED_BYTE, pixels);
+
+ m_allocatedTextureId = textureId;
+ m_allocatedTextureSize = requiredTextureSize;
+
+ updateCompleted();
+}
+
+void VideoLayerChromium::updateTextureRect(const IntRect& updateRect, unsigned textureId)
+{
+ const SkBitmap& bitmap = m_canvas->getDevice()->accessBitmap(true);
+ SkBitmap* skiaBitmap = const_cast<SkBitmap*>(&bitmap);
+ ASSERT(skiaBitmap);
+
+ SkAutoLockPixels lock(*skiaBitmap);
+ SkBitmap::Config skiaConfig = skiaBitmap->config();
+
+ if (skiaConfig == SkBitmap::kARGB_8888_Config) {
+ glBindTexture(GL_TEXTURE_2D, textureId);
+ void* mem = glMapTexSubImage2D(GL_TEXTURE_2D, 0, updateRect.x(), updateRect.y(), updateRect.width(), updateRect.height(), GL_RGBA, GL_UNSIGNED_BYTE, GL_WRITE_ONLY);
+ skiaBitmap->setPixels(mem);
+ m_owner->paintGraphicsLayerContents(*m_graphicsContext, updateRect);
+ glUnmapTexSubImage2D(mem);
+ }
+
+ updateCompleted();
+}
+
+void VideoLayerChromium::updateCompleted()
{
+ m_dirtyRect.setSize(FloatSize());
+ m_contentsDirty = false;
}
}
diff --git a/WebCore/platform/graphics/chromium/VideoLayerChromium.h b/WebCore/platform/graphics/chromium/VideoLayerChromium.h
index 1fa8009..80248eb 100644
--- a/WebCore/platform/graphics/chromium/VideoLayerChromium.h
+++ b/WebCore/platform/graphics/chromium/VideoLayerChromium.h
@@ -43,9 +43,19 @@ class VideoLayerChromium : public LayerChromium {
public:
static PassRefPtr<VideoLayerChromium> create(GraphicsLayerChromium* owner = 0);
virtual bool drawsContent() { return true; }
+ virtual void updateTextureContents(unsigned textureId);
private:
VideoLayerChromium(GraphicsLayerChromium* owner);
+ void createTextureRect(const IntSize& requiredTextureSize, const IntRect& updateRect, unsigned textureId);
+ void updateTextureRect(const IntRect& updateRect, unsigned textureId);
+ void updateCompleted();
+
+ unsigned m_allocatedTextureId;
+ IntSize m_allocatedTextureSize;
+ OwnPtr<skia::PlatformCanvas> m_canvas;
+ OwnPtr<PlatformContextSkia> m_skiaContext;
+ OwnPtr<GraphicsContext> m_graphicsContext;
};
}
diff --git a/WebKit/chromium/ChangeLog b/WebKit/chromium/ChangeLog
index ca39537..48d86f1 100644
--- a/WebKit/chromium/ChangeLog
+++ b/WebKit/chromium/ChangeLog
@@ -1,3 +1,14 @@
+2010-08-05 Victoria Kirst <vrk at google.com>
+
+ Reviewed by David Levin.
+
+ Added a repaint request so that VideoLayerChromium does not have
+ a flickering problem when playing video.
+ https://bugs.webkit.org/show_bug.cgi?id=43101
+
+ * src/WebMediaPlayerClientImpl.cpp:
+ (WebKit::WebMediaPlayerClientImpl::repaint):
+
2010-08-05 Pavel Feldman <pfeldman at chromium.org>
Reviewed by Yury Semikhatsky.
diff --git a/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp b/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp
index 2b0c9a7..8f210a0 100644
--- a/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp
+++ b/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp
@@ -126,6 +126,10 @@ void WebMediaPlayerClientImpl::timeChanged()
void WebMediaPlayerClientImpl::repaint()
{
ASSERT(m_mediaPlayer);
+#if USE(ACCELERATED_COMPOSITING)
+ if (m_videoLayer.get() && supportsAcceleratedRendering())
+ m_videoLayer->setNeedsDisplay(FloatRect(0, 0, m_videoLayer->bounds().width(), m_videoLayer->bounds().height()));
+#endif
m_mediaPlayer->repaint();
}
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list