diff options
author | Derek Sollenberger <djsollen@google.com> | 2012-03-05 16:51:49 -0500 |
---|---|---|
committer | Derek Sollenberger <derek@android.com> | 2012-03-06 10:29:28 -0500 |
commit | 7f85821c0d01e4208814685f4d86faccb27816b1 (patch) | |
tree | 73d2a410075c6fcc50e43ee8259042c5ef73a594 | |
parent | f2296bfba333e80ebd11a63883d391b38f1ddb84 (diff) | |
download | external_webkit-7f85821c0d01e4208814685f4d86faccb27816b1.zip external_webkit-7f85821c0d01e4208814685f4d86faccb27816b1.tar.gz external_webkit-7f85821c0d01e4208814685f4d86faccb27816b1.tar.bz2 |
Update WebKit with necessary changes for the Skia merge.
This CL address the modifications needed for r3312 of Skia
Change-Id: I0574657e7a84e53c6b92cefbe07668e9467880db
7 files changed, 19 insertions, 112 deletions
diff --git a/Source/WebCore/platform/graphics/android/BaseLayerAndroid.h b/Source/WebCore/platform/graphics/android/BaseLayerAndroid.h index c5ce52f..f0c2766 100644 --- a/Source/WebCore/platform/graphics/android/BaseLayerAndroid.h +++ b/Source/WebCore/platform/graphics/android/BaseLayerAndroid.h @@ -26,6 +26,8 @@ #ifndef BaseLayerAndroid_h #define BaseLayerAndroid_h +#include <utils/threads.h> + #include "Color.h" #include "GLWebViewState.h" #include "IntRect.h" diff --git a/Source/WebCore/platform/graphics/android/GaneshContext.cpp b/Source/WebCore/platform/graphics/android/GaneshContext.cpp index e67bcd4..80fe749 100644 --- a/Source/WebCore/platform/graphics/android/GaneshContext.cpp +++ b/Source/WebCore/platform/graphics/android/GaneshContext.cpp @@ -51,9 +51,6 @@ namespace WebCore { GaneshContext::GaneshContext() : m_grContext(0) - , m_baseTileDeviceFBO(0) - , m_baseTileFBO(0) - , m_baseTileStencil(0) , m_baseTileDeviceSurface(0) , m_surfaceConfig(0) , m_surfaceContext(EGL_NO_CONTEXT) @@ -95,22 +92,6 @@ SkDevice* GaneshContext::getDeviceForBaseTile(const TileRenderInfo& renderInfo) contextNeedsReset = true; } - SkDevice* device = 0; - if (renderInfo.textureInfo->getSharedTextureMode() == SurfaceTextureMode) - device = getDeviceForBaseTileSurface(renderInfo); - else if (renderInfo.textureInfo->getSharedTextureMode() == EglImageMode) - device = getDeviceForBaseTileFBO(renderInfo); - - // We must reset the Ganesh context only after we are sure we have - // re-established our EGLContext as the current context. - if (device && contextNeedsReset) - getGrContext()->resetContext(); - - return device; -} - -SkDevice* GaneshContext::getDeviceForBaseTileSurface(const TileRenderInfo& renderInfo) -{ EGLDisplay display; if (!m_surfaceContext) { @@ -154,7 +135,6 @@ SkDevice* GaneshContext::getDeviceForBaseTileSurface(const TileRenderInfo& rende } TransferQueue* tileQueue = TilesManager::instance()->transferQueue(); - if (tileQueue->m_eglSurface == EGL_NO_SURFACE) { const float tileWidth = renderInfo.tileSize.width(); @@ -179,17 +159,16 @@ SkDevice* GaneshContext::getDeviceForBaseTileSurface(const TileRenderInfo& rende if (!m_baseTileDeviceSurface) { - GrPlatformSurfaceDesc surfaceDesc; - surfaceDesc.fSurfaceType = kRenderTarget_GrPlatformSurfaceType; - surfaceDesc.fRenderTargetFlags = kNone_GrPlatformRenderTargetFlagBit; - surfaceDesc.fWidth = TilesManager::tileWidth(); - surfaceDesc.fHeight = TilesManager::tileHeight(); - surfaceDesc.fConfig = kRGBA_8888_GrPixelConfig; - surfaceDesc.fStencilBits = 8; - surfaceDesc.fPlatformRenderTarget = 0; + GrPlatformRenderTargetDesc renderTargetDesc; + renderTargetDesc.fWidth = TilesManager::tileWidth(); + renderTargetDesc.fHeight = TilesManager::tileHeight(); + renderTargetDesc.fConfig = kRGBA_8888_PM_GrPixelConfig; + renderTargetDesc.fSampleCnt = 0; + renderTargetDesc.fStencilBits = 8; + renderTargetDesc.fRenderTargetHandle = 0; GrContext* grContext = getGrContext(); - GrRenderTarget* renderTarget = (GrRenderTarget*) grContext->createPlatformSurface(surfaceDesc); + GrRenderTarget* renderTarget = grContext->createPlatformRenderTarget(renderTargetDesc); m_baseTileDeviceSurface = new SkGpuDevice(grContext, renderTarget); renderTarget->unref(); @@ -197,76 +176,17 @@ SkDevice* GaneshContext::getDeviceForBaseTileSurface(const TileRenderInfo& rende } GLUtils::checkGlError("getDeviceForBaseTile"); - return m_baseTileDeviceSurface; -} - -SkDevice* GaneshContext::getDeviceForBaseTileFBO(const TileRenderInfo& renderInfo) -{ - const GLuint textureId = renderInfo.textureInfo->m_textureId; - const float tileWidth = renderInfo.tileSize.width(); - const float tileHeight = renderInfo.tileSize.height(); - - // bind to the current texture - glBindTexture(GL_TEXTURE_2D, textureId); - - // setup the texture if needed - if (renderInfo.textureInfo->m_width != tileWidth - || renderInfo.textureInfo->m_height != tileHeight) { - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, tileWidth, tileHeight, - 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL); - renderInfo.textureInfo->m_width = tileWidth; - renderInfo.textureInfo->m_height = tileHeight; - - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - } - - if (!m_baseTileFBO) { - glGenFramebuffers(1, &m_baseTileFBO); - XLOG("generated FBO"); - } - - if (!m_baseTileStencil) { - glGenRenderbuffers(1, &m_baseTileStencil); - glBindRenderbuffer(GL_RENDERBUFFER, m_baseTileStencil); - glRenderbufferStorage(GL_RENDERBUFFER, GL_STENCIL_INDEX8, - TilesManager::tileWidth(), - TilesManager::tileHeight()); - glClearStencil(0); - glClear(GL_STENCIL_BUFFER_BIT); - XLOG("generated stencil"); - } - - // bind the FBO and attach the texture and stencil - glBindFramebuffer(GL_FRAMEBUFFER, m_baseTileFBO); - glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, textureId, 0); - glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER, m_baseTileStencil); - - if (!m_baseTileDeviceFBO) { - - GrPlatformSurfaceDesc surfaceDesc; - surfaceDesc.fSurfaceType = kRenderTarget_GrPlatformSurfaceType; - surfaceDesc.fRenderTargetFlags = kNone_GrPlatformRenderTargetFlagBit; - surfaceDesc.fWidth = TilesManager::tileWidth(); - surfaceDesc.fHeight = TilesManager::tileHeight(); - surfaceDesc.fConfig = kRGBA_8888_GrPixelConfig; - surfaceDesc.fStencilBits = 8; - surfaceDesc.fPlatformRenderTarget = m_baseTileFBO; - - GrContext* grContext = getGrContext(); - GrRenderTarget* renderTarget = (GrRenderTarget*) grContext->createPlatformSurface(surfaceDesc); - - m_baseTileDeviceFBO = new SkGpuDevice(grContext, renderTarget); - renderTarget->unref(); - XLOG("generated device %p", m_baseTileDeviceFBO); - } + // We must reset the Ganesh context only after we are sure we have + // re-established our EGLContext as the current context. + if (m_baseTileDeviceSurface && contextNeedsReset) + getGrContext()->resetContext(); - GLUtils::checkGlError("getDeviceForBaseTile"); - return m_baseTileDeviceFBO; + return m_baseTileDeviceSurface; } + } // namespace WebCore #endif // USE(ACCELERATED_COMPOSITING) diff --git a/Source/WebCore/platform/graphics/android/GaneshContext.h b/Source/WebCore/platform/graphics/android/GaneshContext.h index 12ea92d..def35e5 100644 --- a/Source/WebCore/platform/graphics/android/GaneshContext.h +++ b/Source/WebCore/platform/graphics/android/GaneshContext.h @@ -48,20 +48,8 @@ private: GaneshContext(); GrContext* getGrContext(); - - // Creates a device for rendering into a SurfaceTexture via an EGLSurface - SkDevice* getDeviceForBaseTileSurface(const TileRenderInfo& renderInfo); - // Creates a device for rendering into a EGLImage via an FBO - SkDevice* getDeviceForBaseTileFBO(const TileRenderInfo& renderInfo); - GrContext* m_grContext; - // FBO specific variables - SkGpuDevice* m_baseTileDeviceFBO; - GLuint m_baseTileFBO; - GLuint m_baseTileStencil; - - // Surface specific variables SkGpuDevice* m_baseTileDeviceSurface; EGLConfig m_surfaceConfig; EGLContext m_surfaceContext; diff --git a/Source/WebCore/platform/graphics/android/ImagesManager.h b/Source/WebCore/platform/graphics/android/ImagesManager.h index a3ea859..b915a46 100644 --- a/Source/WebCore/platform/graphics/android/ImagesManager.h +++ b/Source/WebCore/platform/graphics/android/ImagesManager.h @@ -32,6 +32,8 @@ #include "SkRefCnt.h" #include "Vector.h" +#include <utils/threads.h> + namespace WebCore { class ImageTexture; diff --git a/Source/WebCore/platform/graphics/android/TextureInfo.cpp b/Source/WebCore/platform/graphics/android/TextureInfo.cpp index 5356dcb..aff9a3d 100644 --- a/Source/WebCore/platform/graphics/android/TextureInfo.cpp +++ b/Source/WebCore/platform/graphics/android/TextureInfo.cpp @@ -42,7 +42,6 @@ TextureInfo::TextureInfo(SharedTextureMode mode) m_height = 0; m_internalFormat = 0; m_sharedTextureMode = mode; - m_eglSurface = EGL_NO_SURFACE; m_pictureCount = 0; } diff --git a/Source/WebCore/platform/graphics/android/TextureInfo.h b/Source/WebCore/platform/graphics/android/TextureInfo.h index 1c48937..aca74b7 100644 --- a/Source/WebCore/platform/graphics/android/TextureInfo.h +++ b/Source/WebCore/platform/graphics/android/TextureInfo.h @@ -72,11 +72,6 @@ public: #if DEPRECATED_SURFACE_TEXTURE_MODE sp<android::SurfaceTexture> m_surfaceTexture; #endif - // TODO: Delete this after the Ganesh code path get fixed. - sp<ANativeWindow> m_ANW; - // The EGLSurface wraps the m_ANW to enable direct OpenGL rendering (e.g. Ganesh) - EGLSurface m_eglSurface; - int m_pictureCount; private: SharedTextureMode m_sharedTextureMode; diff --git a/Source/WebKit/android/jni/WebViewCore.h b/Source/WebKit/android/jni/WebViewCore.h index a05c3ea..a19a5b2 100644 --- a/Source/WebKit/android/jni/WebViewCore.h +++ b/Source/WebKit/android/jni/WebViewCore.h @@ -45,6 +45,7 @@ #include <jni.h> #include <ui/KeycodeLabels.h> #include <ui/PixelFormat.h> +#include <utils/threads.h> namespace WebCore { class Color; |