Diff
Modified: trunk/LayoutTests/ChangeLog (143703 => 143704)
--- trunk/LayoutTests/ChangeLog 2013-02-22 09:20:07 UTC (rev 143703)
+++ trunk/LayoutTests/ChangeLog 2013-02-22 09:33:11 UTC (rev 143704)
@@ -1,3 +1,16 @@
+2013-02-22 Kondapally Kalyan <[email protected]>
+
+ [WebGL][EFL] Support for creating surface with alpha disabled.
+ https://bugs.webkit.org/show_bug.cgi?id=110067
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ Enabled compositing/webgl/webgl-no-alpha.html for Efl port.
+
+ * platform/efl/TestExpectations:
+ * platform/efl/compositing/webgl/webgl-no-alpha-expected.png: Added.
+ * platform/efl/compositing/webgl/webgl-no-alpha-expected.txt: Added.
+
2013-02-22 Vsevolod Vlasov <[email protected]>
Layout Test fast/multicol/newmulticol/positioned-split.html is failing on chromium mac 10.8 since it was added
Modified: trunk/LayoutTests/platform/efl/TestExpectations (143703 => 143704)
--- trunk/LayoutTests/platform/efl/TestExpectations 2013-02-22 09:20:07 UTC (rev 143703)
+++ trunk/LayoutTests/platform/efl/TestExpectations 2013-02-22 09:33:11 UTC (rev 143704)
@@ -1719,7 +1719,6 @@
# Rendering failure, also missing expected results:
webkit.org/b/105093 compositing/webgl/webgl-background-color.html [ Skip ]
-webkit.org/b/105093 compositing/webgl/webgl-no-alpha.html [ Skip ]
webkit.org/b/105093 compositing/webgl/webgl-nonpremultiplied-blend.html [ Skip ]
webkit.org/b/105093 compositing/webgl/webgl-reflection.html [ Skip ]
Added: trunk/LayoutTests/platform/efl/compositing/webgl/webgl-no-alpha-expected.png
(Binary files differ)
Property changes on: trunk/LayoutTests/platform/efl/compositing/webgl/webgl-no-alpha-expected.png
___________________________________________________________________
Added: svn:mime-type
Added: trunk/LayoutTests/platform/efl/compositing/webgl/webgl-no-alpha-expected.txt (0 => 143704)
--- trunk/LayoutTests/platform/efl/compositing/webgl/webgl-no-alpha-expected.txt (rev 0)
+++ trunk/LayoutTests/platform/efl/compositing/webgl/webgl-no-alpha-expected.txt 2013-02-22 09:33:11 UTC (rev 143704)
@@ -0,0 +1 @@
+
Modified: trunk/Source/WebCore/ChangeLog (143703 => 143704)
--- trunk/Source/WebCore/ChangeLog 2013-02-22 09:20:07 UTC (rev 143703)
+++ trunk/Source/WebCore/ChangeLog 2013-02-22 09:33:11 UTC (rev 143704)
@@ -1,3 +1,61 @@
+2013-02-22 Kondapally Kalyan <[email protected]>
+
+ [WebGL][EFL] Support for creating surface with alpha disabled.
+ https://bugs.webkit.org/show_bug.cgi?id=110067
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ Covered by compositing/webgl/webgl-no-alpha.html
+
+ We currently always create a surface supporting alpha channel.
+ With this patch we create the surface with alpha only if
+ required.
+
+ * platform/graphics/efl/GraphicsContext3DPrivate.cpp:
+ (WebCore::GraphicsContext3DPrivate::initialize):
+ * platform/graphics/efl/GraphicsContext3DPrivate.h:
+ (GraphicsContext3DPrivate):
+ * platform/graphics/opengl/GLPlatformSurface.cpp:
+ (WebCore::GLPlatformSurface::createOffScreenSurface):
+ (WebCore::GLPlatformSurface::createTransportSurface):
+ (WebCore::GLPlatformSurface::GLPlatformSurface):
+ (WebCore::GLPlatformSurface::attributes):
+ (WebCore):
+ * platform/graphics/opengl/GLPlatformSurface.h:
+ * platform/graphics/surfaces/egl/EGLConfigSelector.cpp:
+ (WebCore):
+ (WebCore::EGLConfigSelector::EGLConfigSelector):
+ (WebCore::EGLConfigSelector::pBufferContextConfig):
+ (WebCore::EGLConfigSelector::surfaceContextConfig):
+ * platform/graphics/surfaces/egl/EGLConfigSelector.h:
+ (EGLConfigSelector):
+ * platform/graphics/surfaces/egl/EGLSurface.cpp:
+ (WebCore::EGLWindowTransportSurface::EGLWindowTransportSurface):
+ * platform/graphics/surfaces/egl/EGLSurface.h:
+ (EGLWindowTransportSurface):
+ * platform/graphics/surfaces/glx/GLXConfigSelector.h:
+ (WebCore):
+ (WebCore::GLXConfigSelector::GLXConfigSelector):
+ (WebCore::GLXConfigSelector::pixmapContextConfig):
+ (WebCore::GLXConfigSelector::surfaceContextConfig):
+ (WebCore::GLXConfigSelector::surfaceClientConfig):
+ (WebCore::GLXConfigSelector::validateAttributes):
+ (WebCore::GLXConfigSelector::findMatchingConfig):
+ (WebCore::GLXConfigSelector::findMatchingConfigWithVisualId):
+ (GLXConfigSelector):
+ * platform/graphics/surfaces/glx/GLXContext.cpp:
+ (WebCore::GLXOffScreenContext::initialize):
+ * platform/graphics/surfaces/glx/GLXSurface.cpp:
+ (WebCore::GLXTransportSurface::GLXTransportSurface):
+ (WebCore::GLXOffScreenSurface::GLXOffScreenSurface):
+ (WebCore::GLXOffScreenSurface::initialize):
+ * platform/graphics/surfaces/glx/GLXSurface.h:
+ (GLXTransportSurface):
+ (GLXOffScreenSurface):
+ * platform/graphics/surfaces/glx/GraphicsSurfaceGLX.cpp:
+ (WebCore::GraphicsSurfacePrivate::GraphicsSurfacePrivate):
+ (WebCore::GraphicsSurfacePrivate::createPixmap):
+
2013-02-22 Pavel Feldman <[email protected]>
Web Inspector: allow opting out from vertical split in the dock-to-right mode
Modified: trunk/Source/WebCore/platform/graphics/efl/GraphicsContext3DPrivate.cpp (143703 => 143704)
--- trunk/Source/WebCore/platform/graphics/efl/GraphicsContext3DPrivate.cpp 2013-02-22 09:20:07 UTC (rev 143703)
+++ trunk/Source/WebCore/platform/graphics/efl/GraphicsContext3DPrivate.cpp 2013-02-22 09:33:11 UTC (rev 143704)
@@ -60,25 +60,32 @@
return false;
if (m_context->m_renderStyle == GraphicsContext3D::RenderOffscreen) {
-#if USE(GRAPHICS_SURFACE)
- m_sharedSurface = GLPlatformSurface::createTransportSurface();
- if (!m_sharedSurface)
+ m_offScreenSurface = GLPlatformSurface::createOffScreenSurface();
+
+ if (!m_offScreenSurface)
return false;
- m_sharedContext = GLPlatformContext::createContext(m_context->m_renderStyle);
- if (!m_sharedContext)
+ if (!m_offScreenContext->initialize(m_offScreenSurface.get()))
return false;
-#endif
- m_offScreenSurface = GLPlatformSurface::createOffScreenSurface();
+#if USE(GRAPHICS_SURFACE)
+ if (!makeContextCurrent())
+ return false;
- if (!m_offScreenSurface)
+ m_context->validateAttributes();
+ GLPlatformSurface::SurfaceAttributes sharedSurfaceAttributes = GLPlatformSurface::Default;
+ if (m_context->m_attrs.alpha)
+ sharedSurfaceAttributes = GLPlatformSurface::SupportAlpha;
+
+ m_offScreenContext->releaseCurrent();
+ m_sharedSurface = GLPlatformSurface::createTransportSurface(sharedSurfaceAttributes);
+ if (!m_sharedSurface)
return false;
- if (!m_offScreenContext->initialize(m_offScreenSurface.get()))
+ m_sharedContext = GLPlatformContext::createContext(m_context->m_renderStyle);
+ if (!m_sharedContext)
return false;
-#if USE(GRAPHICS_SURFACE)
if (!m_sharedContext->initialize(m_sharedSurface.get(), m_offScreenContext->handle()))
return false;
Modified: trunk/Source/WebCore/platform/graphics/opengl/GLPlatformSurface.cpp (143703 => 143704)
--- trunk/Source/WebCore/platform/graphics/opengl/GLPlatformSurface.cpp 2013-02-22 09:20:07 UTC (rev 143703)
+++ trunk/Source/WebCore/platform/graphics/opengl/GLPlatformSurface.cpp 2013-02-22 09:33:11 UTC (rev 143704)
@@ -40,24 +40,26 @@
namespace WebCore {
-PassOwnPtr<GLPlatformSurface> GLPlatformSurface::createOffScreenSurface()
+PassOwnPtr<GLPlatformSurface> GLPlatformSurface::createOffScreenSurface(SurfaceAttributes attributes)
{
#if USE(GLX)
- OwnPtr<GLPlatformSurface> surface = adoptPtr(new GLXOffScreenSurface());
+ OwnPtr<GLPlatformSurface> surface = adoptPtr(new GLXOffScreenSurface(attributes));
if (surface->drawable())
return surface.release();
+#else
+ UNUSED_PARAM(attributes);
#endif
return nullptr;
}
-PassOwnPtr<GLPlatformSurface> GLPlatformSurface::createTransportSurface()
+PassOwnPtr<GLPlatformSurface> GLPlatformSurface::createTransportSurface(SurfaceAttributes attributes)
{
#if USE(GLX)
- OwnPtr<GLPlatformSurface> surface = adoptPtr(new GLXTransportSurface());
+ OwnPtr<GLPlatformSurface> surface = adoptPtr(new GLXTransportSurface(attributes));
#elif USE(EGL)
- OwnPtr<GLPlatformSurface> surface = adoptPtr(new EGLWindowTransportSurface());
+ OwnPtr<GLPlatformSurface> surface = adoptPtr(new EGLWindowTransportSurface(attributes));
#endif
if (surface && surface->handle() && surface->drawable())
@@ -66,7 +68,7 @@
return nullptr;
}
-GLPlatformSurface::GLPlatformSurface()
+GLPlatformSurface::GLPlatformSurface(SurfaceAttributes)
: m_fboId(0)
, m_sharedDisplay(0)
, m_drawable(0)
@@ -144,6 +146,11 @@
}
}
+GLPlatformSurface::SurfaceAttributes GLPlatformSurface::attributes() const
+{
+ return GLPlatformSurface::Default;
}
+}
+
#endif
Modified: trunk/Source/WebCore/platform/graphics/opengl/GLPlatformSurface.h (143703 => 143704)
--- trunk/Source/WebCore/platform/graphics/opengl/GLPlatformSurface.h 2013-02-22 09:20:07 UTC (rev 143703)
+++ trunk/Source/WebCore/platform/graphics/opengl/GLPlatformSurface.h 2013-02-22 09:33:11 UTC (rev 143704)
@@ -41,12 +41,19 @@
WTF_MAKE_NONCOPYABLE(GLPlatformSurface);
public:
+ enum Attributes {
+ Default = 0x00, // No Alpha channel. Only R,G,B values set.
+ SupportAlpha = 0x01,
+ DoubleBuffered = 0x04
+ };
+
+ typedef int SurfaceAttributes;
// Creates a GL surface used for offscreen rendering.
- static PassOwnPtr<GLPlatformSurface> createOffScreenSurface();
+ static PassOwnPtr<GLPlatformSurface> createOffScreenSurface(SurfaceAttributes = GLPlatformSurface::Default);
// Creates a GL surface used for offscreen rendering. The results can be transported
// to the UI process for display.
- static PassOwnPtr<GLPlatformSurface> createTransportSurface();
+ static PassOwnPtr<GLPlatformSurface> createTransportSurface(SurfaceAttributes = GLPlatformSurface::Default);
virtual ~GLPlatformSurface();
@@ -61,6 +68,8 @@
PlatformDisplay sharedDisplay() const;
+ virtual SurfaceAttributes attributes() const;
+
virtual void swapBuffers();
// Convenience Function to update surface backbuffer with texture contents.
@@ -77,7 +86,7 @@
virtual void destroy();
protected:
- GLPlatformSurface();
+ GLPlatformSurface(SurfaceAttributes);
IntRect m_rect;
GLuint m_fboId;
PlatformDisplay m_sharedDisplay;
Modified: trunk/Source/WebCore/platform/graphics/surfaces/egl/EGLConfigSelector.cpp (143703 => 143704)
--- trunk/Source/WebCore/platform/graphics/surfaces/egl/EGLConfigSelector.cpp 2013-02-22 09:20:07 UTC (rev 143703)
+++ trunk/Source/WebCore/platform/graphics/surfaces/egl/EGLConfigSelector.cpp 2013-02-22 09:33:11 UTC (rev 143704)
@@ -42,7 +42,7 @@
EGL_GREEN_SIZE, 8,
EGL_BLUE_SIZE, 8,
EGL_STENCIL_SIZE, 8,
- EGL_ALPHA_SIZE, 8,
+ EGL_ALPHA_SIZE, 0,
EGL_SURFACE_TYPE, EGL_NONE,
EGL_NONE
};
@@ -104,9 +104,10 @@
cleanup();
}
-EGLConfigSelector::EGLConfigSelector(NativeSharedDisplay* display)
+EGLConfigSelector::EGLConfigSelector(GLPlatformSurface::SurfaceAttributes attributes, NativeSharedDisplay* display)
: m_pbufferFBConfig(0)
, m_surfaceContextFBConfig(0)
+ , m_attributes(attributes)
{
m_sharedDisplay = SharedEGLDisplay::create(display);
}
@@ -123,6 +124,7 @@
EGLConfig EGLConfigSelector::pBufferContextConfig()
{
if (!m_pbufferFBConfig) {
+ configAttributeList[11] = m_attributes & GLPlatformSurface::SupportAlpha ? 8 : 0;
configAttributeList[13] = EGL_PIXMAP_BIT;
m_pbufferFBConfig = createConfig(configAttributeList);
}
@@ -133,6 +135,7 @@
EGLConfig EGLConfigSelector::surfaceContextConfig()
{
if (!m_surfaceContextFBConfig) {
+ configAttributeList[11] = m_attributes & GLPlatformSurface::SupportAlpha ? 8 : 0;
configAttributeList[13] = EGL_WINDOW_BIT;
m_surfaceContextFBConfig = createConfig(configAttributeList);
}
@@ -151,6 +154,11 @@
return eglValue;
}
+GLPlatformSurface::SurfaceAttributes EGLConfigSelector::attributes() const
+{
+ return m_attributes;
+}
+
void EGLConfigSelector::reset()
{
m_surfaceContextFBConfig = 0;
Modified: trunk/Source/WebCore/platform/graphics/surfaces/egl/EGLConfigSelector.h (143703 => 143704)
--- trunk/Source/WebCore/platform/graphics/surfaces/egl/EGLConfigSelector.h 2013-02-22 09:20:07 UTC (rev 143703)
+++ trunk/Source/WebCore/platform/graphics/surfaces/egl/EGLConfigSelector.h 2013-02-22 09:33:11 UTC (rev 143704)
@@ -29,6 +29,7 @@
#if USE(EGL)
#include <opengl/GLDefs.h>
+#include <opengl/GLPlatformSurface.h>
#include <wtf/Noncopyable.h>
#include <wtf/PassRefPtr.h>
#include <wtf/RefCounted.h>
@@ -68,12 +69,13 @@
WTF_MAKE_NONCOPYABLE(EGLConfigSelector);
public:
- EGLConfigSelector(NativeSharedDisplay* = 0);
+ EGLConfigSelector(GLPlatformSurface::SurfaceAttributes, NativeSharedDisplay* = 0);
virtual ~EGLConfigSelector();
PlatformDisplay display() const;
virtual EGLConfig pBufferContextConfig();
virtual EGLConfig surfaceContextConfig();
EGLint nativeVisualId(const EGLConfig&) const;
+ GLPlatformSurface::SurfaceAttributes attributes() const;
void reset();
private:
@@ -83,6 +85,7 @@
EGLConfig m_pbufferFBConfig;
EGLConfig m_surfaceContextFBConfig;
RefPtr<SharedEGLDisplay> m_sharedDisplay;
+ unsigned m_attributes : 3;
};
}
Modified: trunk/Source/WebCore/platform/graphics/surfaces/egl/EGLSurface.cpp (143703 => 143704)
--- trunk/Source/WebCore/platform/graphics/surfaces/egl/EGLSurface.cpp 2013-02-22 09:20:07 UTC (rev 143703)
+++ trunk/Source/WebCore/platform/graphics/surfaces/egl/EGLSurface.cpp 2013-02-22 09:33:11 UTC (rev 143704)
@@ -30,10 +30,10 @@
namespace WebCore {
-EGLWindowTransportSurface::EGLWindowTransportSurface()
- : GLPlatformSurface()
+EGLWindowTransportSurface::EGLWindowTransportSurface(SurfaceAttributes attributes)
+ : GLPlatformSurface(attributes)
{
- m_configSelector = adoptPtr(new EGLConfigSelector(NativeWrapper::nativeDisplay()));
+ m_configSelector = adoptPtr(new EGLConfigSelector(attributes, NativeWrapper::nativeDisplay()));
m_sharedDisplay = m_configSelector->display();
if (m_sharedDisplay == EGL_NO_DISPLAY) {
@@ -55,7 +55,7 @@
return;
}
- NativeWrapper::createOffScreenWindow(&m_bufferHandle, visualId);
+ NativeWrapper::createOffScreenWindow(&m_bufferHandle, (attributes & GLPlatformSurface::SupportAlpha), visualId);
if (!m_bufferHandle) {
destroy();
@@ -70,6 +70,11 @@
}
}
+GLPlatformSurface::SurfaceAttributes EGLWindowTransportSurface::attributes() const
+{
+ return m_configSelector->attributes();
+}
+
EGLWindowTransportSurface::~EGLWindowTransportSurface()
{
}
Modified: trunk/Source/WebCore/platform/graphics/surfaces/egl/EGLSurface.h (143703 => 143704)
--- trunk/Source/WebCore/platform/graphics/surfaces/egl/EGLSurface.h 2013-02-22 09:20:07 UTC (rev 143703)
+++ trunk/Source/WebCore/platform/graphics/surfaces/egl/EGLSurface.h 2013-02-22 09:33:11 UTC (rev 143704)
@@ -43,12 +43,13 @@
class EGLWindowTransportSurface : public GLPlatformSurface {
public:
- EGLWindowTransportSurface();
+ EGLWindowTransportSurface(SurfaceAttributes);
virtual ~EGLWindowTransportSurface();
virtual PlatformSurfaceConfig configuration() OVERRIDE;
virtual void setGeometry(const IntRect& newRect) OVERRIDE;
virtual void swapBuffers() OVERRIDE;
virtual void destroy() OVERRIDE;
+ virtual GLPlatformSurface::SurfaceAttributes attributes() const OVERRIDE;
private:
void freeEGLResources();
Modified: trunk/Source/WebCore/platform/graphics/surfaces/glx/GLXConfigSelector.h (143703 => 143704)
--- trunk/Source/WebCore/platform/graphics/surfaces/glx/GLXConfigSelector.h 2013-02-22 09:20:07 UTC (rev 143703)
+++ trunk/Source/WebCore/platform/graphics/surfaces/glx/GLXConfigSelector.h 2013-02-22 09:33:11 UTC (rev 143704)
@@ -30,6 +30,7 @@
#include "X11Helper.h"
#include <opengl/GLDefs.h>
+#include <opengl/GLPlatformSurface.h>
namespace WebCore {
@@ -43,13 +44,26 @@
0
};
+static int glxSurfaceAttributes[] = {
+ GLX_LEVEL, 0,
+ GLX_DRAWABLE_TYPE, GLX_PIXMAP_BIT,
+ GLX_RENDER_TYPE, 0,
+ GLX_RED_SIZE, 1,
+ GLX_GREEN_SIZE, 1,
+ GLX_BLUE_SIZE, 1,
+ GLX_ALPHA_SIZE, 0,
+ GLX_DOUBLEBUFFER, GL_FALSE,
+ None
+};
+
class GLXConfigSelector {
WTF_MAKE_NONCOPYABLE(GLXConfigSelector);
public:
- GLXConfigSelector()
+ GLXConfigSelector(GLPlatformSurface::SurfaceAttributes attr = GLPlatformSurface::Default)
: m_surfaceContextFBConfig(0)
, m_pixmapContextFBConfig(0)
+ , m_attributes(attr)
{
}
@@ -65,19 +79,8 @@
GLXFBConfig pixmapContextConfig()
{
if (!m_pixmapContextFBConfig) {
- static const int attributes[] = {
- GLX_LEVEL, 0,
- GLX_DRAWABLE_TYPE, GLX_PIXMAP_BIT,
- GLX_RENDER_TYPE, GLX_RGBA_BIT,
- GLX_RED_SIZE, 1,
- GLX_GREEN_SIZE, 1,
- GLX_BLUE_SIZE, 1,
- GLX_ALPHA_SIZE, 1,
- GLX_DOUBLEBUFFER, GL_FALSE,
- None
- };
-
- m_pixmapContextFBConfig = findMatchingConfig(attributes);
+ validateAttributes();
+ m_pixmapContextFBConfig = findMatchingConfig(glxSurfaceAttributes, m_attributes & GLPlatformSurface::SupportAlpha ? 32 : 24);
}
return m_pixmapContextFBConfig;
@@ -86,8 +89,14 @@
GLXFBConfig surfaceContextConfig()
{
- if (!m_surfaceContextFBConfig)
- createSurfaceConfig();
+ if (!m_surfaceContextFBConfig) {
+ glxSurfaceAttributes[3] = GLX_WINDOW_BIT;
+ glxSurfaceAttributes[7] = 8;
+ glxSurfaceAttributes[9] = 8;
+ glxSurfaceAttributes[11] = 8;
+ validateAttributes();
+ m_surfaceContextFBConfig = findMatchingConfig(glxSurfaceAttributes, m_attributes & GLPlatformSurface::SupportAlpha ? 32 : 24);
+ }
return m_surfaceContextFBConfig;
}
@@ -96,8 +105,13 @@
{
clientAttributes[3] = static_cast<int>(id);
clientAttributes[8] = depth == 32 ? GLX_BIND_TO_TEXTURE_RGBA_EXT : GLX_BIND_TO_TEXTURE_RGB_EXT;
+ // Prefer to match with Visual Id.
+ GLXFBConfig config = findMatchingConfigWithVisualId(clientAttributes, depth, id);
- return findMatchingConfig(clientAttributes, depth, id);
+ if (!config)
+ config = findMatchingConfig(clientAttributes, depth);
+
+ return config;
}
void reset()
@@ -106,27 +120,24 @@
m_pixmapContextFBConfig = 0;
}
+ GLPlatformSurface::SurfaceAttributes attributes() const
+ {
+ return m_attributes;
+ }
+
private:
- void createSurfaceConfig()
+ void validateAttributes()
{
- static int attributes[] = {
- GLX_LEVEL, 0,
- GLX_DRAWABLE_TYPE, GLX_WINDOW_BIT,
- GLX_RENDER_TYPE, GLX_RGBA_BIT,
- GLX_RED_SIZE, 1,
- GLX_GREEN_SIZE, 1,
- GLX_BLUE_SIZE, 1,
- GLX_ALPHA_SIZE, 1,
- GLX_DEPTH_SIZE, 1,
- GLX_X_VISUAL_TYPE, GLX_TRUE_COLOR,
- GLX_DOUBLEBUFFER, True,
- None
- };
+ if (m_attributes & GLPlatformSurface::SupportAlpha) {
+ glxSurfaceAttributes[13] = 8;
+ glxSurfaceAttributes[5] = GLX_RGBA_BIT;
+ }
- m_surfaceContextFBConfig = findMatchingConfig(attributes);
+ if (m_attributes & GLPlatformSurface::DoubleBuffered)
+ glxSurfaceAttributes[15] = GL_TRUE;
}
- GLXFBConfig findMatchingConfig(const int attributes[], int depth = 32, VisualID id = 0)
+ GLXFBConfig findMatchingConfig(const int attributes[], int depth = 32)
{
int numAvailableConfigs;
OwnPtrX11<GLXFBConfig> temp(glXChooseFBConfig(X11Helper::nativeDisplay(), DefaultScreen(X11Helper::nativeDisplay()), attributes, &numAvailableConfigs));
@@ -140,14 +151,17 @@
if (!scopedVisualInfo.get())
continue;
- if (id && scopedVisualInfo->depth == depth && scopedVisualInfo->visualid == id)
- return temp[i];
-
#if USE(GRAPHICS_SURFACE)
if (X11Helper::isXRenderExtensionSupported()) {
XRenderPictFormat* format = XRenderFindVisualFormat(X11Helper::nativeDisplay(), scopedVisualInfo->visual);
- if (format && depth == 32 && format->direct.alphaMask > 0)
- return temp[i];
+
+ if (format) {
+ if (m_attributes & GLPlatformSurface::SupportAlpha) {
+ if (scopedVisualInfo->depth == depth && format->direct.alphaMask > 0)
+ return temp[i];
+ } else if (!format->direct.alphaMask)
+ return temp[i];
+ }
}
#endif
if (scopedVisualInfo->depth == depth)
@@ -155,11 +169,38 @@
}
// Did not find any visual supporting alpha, select the first available config.
+ scopedVisualInfo = glXGetVisualFromFBConfig(X11Helper::nativeDisplay(), temp[0]);
+
+ if ((m_attributes & GLPlatformSurface::SupportAlpha) && (scopedVisualInfo->depth != 32))
+ m_attributes &= ~GLPlatformSurface::SupportAlpha;
+
return temp[0];
}
+ GLXFBConfig findMatchingConfigWithVisualId(const int attributes[], int depth, VisualID id)
+ {
+ int numAvailableConfigs;
+ OwnPtrX11<GLXFBConfig> temp(glXChooseFBConfig(X11Helper::nativeDisplay(), DefaultScreen(X11Helper::nativeDisplay()), attributes, &numAvailableConfigs));
+
+ if (!numAvailableConfigs || !temp.get())
+ return 0;
+
+ OwnPtrX11<XVisualInfo> scopedVisualInfo;
+ for (int i = 0; i < numAvailableConfigs; ++i) {
+ scopedVisualInfo = glXGetVisualFromFBConfig(X11Helper::nativeDisplay(), temp[i]);
+ if (!scopedVisualInfo.get())
+ continue;
+
+ if (id && scopedVisualInfo->depth == depth && scopedVisualInfo->visualid == id)
+ return temp[i];
+ }
+
+ return 0;
+ }
+
GLXFBConfig m_surfaceContextFBConfig;
GLXFBConfig m_pixmapContextFBConfig;
+ GLPlatformSurface::SurfaceAttributes m_attributes : 3;
};
}
Modified: trunk/Source/WebCore/platform/graphics/surfaces/glx/GLXContext.cpp (143703 => 143704)
--- trunk/Source/WebCore/platform/graphics/surfaces/glx/GLXContext.cpp 2013-02-22 09:20:07 UTC (rev 143703)
+++ trunk/Source/WebCore/platform/graphics/surfaces/glx/GLXContext.cpp 2013-02-22 09:33:11 UTC (rev 143704)
@@ -84,8 +84,9 @@
glXDestroyContext(x11Display, m_contextHandle);
}
+ bool supportsAlpha = surface->attributes() & GLPlatformSurface::SupportAlpha;
if (!m_contextHandle)
- m_contextHandle = glXCreateNewContext(x11Display, config, GLX_RGBA_TYPE, sharedContext, true);
+ m_contextHandle = glXCreateNewContext(x11Display, config, supportsAlpha ? GLX_RGBA_TYPE : 0, sharedContext, true);
if (m_contextHandle)
return true;
Modified: trunk/Source/WebCore/platform/graphics/surfaces/glx/GLXSurface.cpp (143703 => 143704)
--- trunk/Source/WebCore/platform/graphics/surfaces/glx/GLXSurface.cpp 2013-02-22 09:20:07 UTC (rev 143703)
+++ trunk/Source/WebCore/platform/graphics/surfaces/glx/GLXSurface.cpp 2013-02-22 09:33:11 UTC (rev 143704)
@@ -32,11 +32,12 @@
static const int pbufferAttributes[] = { GLX_PBUFFER_WIDTH, 1, GLX_PBUFFER_HEIGHT, 1, 0 };
-GLXTransportSurface::GLXTransportSurface()
- : GLPlatformSurface()
+GLXTransportSurface::GLXTransportSurface(SurfaceAttributes attributes)
+ : GLPlatformSurface(attributes)
{
m_sharedDisplay = X11Helper::nativeDisplay();
- m_configSelector = adoptPtr(new GLXConfigSelector());
+ attributes |= GLPlatformSurface::DoubleBuffered;
+ m_configSelector = adoptPtr(new GLXConfigSelector(attributes));
OwnPtrX11<XVisualInfo> visInfo(m_configSelector->visualInfo(m_configSelector->surfaceContextConfig()));
if (!visInfo.get()) {
@@ -92,23 +93,28 @@
m_configSelector = nullptr;
}
-GLXOffScreenSurface::GLXOffScreenSurface()
- : GLPlatformSurface()
+GLPlatformSurface::SurfaceAttributes GLXTransportSurface::attributes() const
+{
+ return m_configSelector->attributes();
+}
+
+GLXOffScreenSurface::GLXOffScreenSurface(SurfaceAttributes surfaceAttributes)
+ : GLPlatformSurface(surfaceAttributes)
, m_pixmap(0)
, m_glxPixmap(0)
{
- initialize();
+ initialize(surfaceAttributes);
}
GLXOffScreenSurface::~GLXOffScreenSurface()
{
}
-void GLXOffScreenSurface::initialize()
+void GLXOffScreenSurface::initialize(SurfaceAttributes attributes)
{
m_sharedDisplay = X11Helper::nativeDisplay();
- m_configSelector = adoptPtr(new GLXConfigSelector());
+ m_configSelector = adoptPtr(new GLXConfigSelector(attributes));
OwnPtrX11<XVisualInfo> visualInfo(m_configSelector->visualInfo(m_configSelector->pixmapContextConfig()));
X11Helper::createPixmap(&m_pixmap, *visualInfo.get());
Modified: trunk/Source/WebCore/platform/graphics/surfaces/glx/GLXSurface.h (143703 => 143704)
--- trunk/Source/WebCore/platform/graphics/surfaces/glx/GLXSurface.h 2013-02-22 09:20:07 UTC (rev 143703)
+++ trunk/Source/WebCore/platform/graphics/surfaces/glx/GLXSurface.h 2013-02-22 09:33:11 UTC (rev 143704)
@@ -37,11 +37,12 @@
class GLXTransportSurface : public GLPlatformSurface {
public:
- GLXTransportSurface();
+ GLXTransportSurface(SurfaceAttributes);
virtual ~GLXTransportSurface();
virtual PlatformSurfaceConfig configuration() OVERRIDE;
virtual void swapBuffers() OVERRIDE;
virtual void setGeometry(const IntRect&) OVERRIDE;
+ virtual GLPlatformSurface::SurfaceAttributes attributes() const OVERRIDE;
virtual void destroy() OVERRIDE;
private:
@@ -52,13 +53,13 @@
class GLXOffScreenSurface : public GLPlatformSurface {
public:
- GLXOffScreenSurface();
+ GLXOffScreenSurface(SurfaceAttributes);
virtual ~GLXOffScreenSurface();
virtual PlatformSurfaceConfig configuration() OVERRIDE;
virtual void destroy() OVERRIDE;
private:
- void initialize();
+ void initialize(SurfaceAttributes);
void freeResources();
OwnPtr<GLXConfigSelector> m_configSelector;
Pixmap m_pixmap;
Modified: trunk/Source/WebCore/platform/graphics/surfaces/glx/GraphicsSurfaceGLX.cpp (143703 => 143704)
--- trunk/Source/WebCore/platform/graphics/surfaces/glx/GraphicsSurfaceGLX.cpp 2013-02-22 09:20:07 UTC (rev 143703)
+++ trunk/Source/WebCore/platform/graphics/surfaces/glx/GraphicsSurfaceGLX.cpp 2013-02-22 09:33:11 UTC (rev 143704)
@@ -88,7 +88,9 @@
UNUSED_PARAM(shareContext);
#endif
- m_configSelector = adoptPtr(new GLXConfigSelector());
+ GLPlatformSurface::SurfaceAttributes sharedSurfaceAttributes = GLPlatformSurface::DoubleBuffered |
+ GLPlatformSurface::SupportAlpha;
+ m_configSelector = adoptPtr(new GLXConfigSelector(sharedSurfaceAttributes));
if (!m_configSelector->surfaceContextConfig()) {
clear();
@@ -110,7 +112,6 @@
, m_isReceiver(true)
, m_texture(0)
{
- m_configSelector = adoptPtr(new GLXConfigSelector());
}
~GraphicsSurfacePrivate()
@@ -144,9 +145,6 @@
void createPixmap(uint32_t winId)
{
- if (!m_configSelector)
- return;
-
XWindowAttributes attr;
if (!XGetWindowAttributes(display(), winId, &attr))
return;
@@ -161,7 +159,15 @@
XRenderPictFormat* format = XRenderFindVisualFormat(display(), attr.visual);
bool hasAlpha = (format->type == PictTypeDirect && format->direct.alphaMask);
m_xPixmap = XCompositeNameWindowPixmap(display(), winId);
- glxAttributes[1] = (format->depth == 32 || hasAlpha) ? GLX_TEXTURE_FORMAT_RGBA_EXT : GLX_TEXTURE_FORMAT_RGB_EXT;
+ glxAttributes[1] = (format->depth == 32 && hasAlpha) ? GLX_TEXTURE_FORMAT_RGBA_EXT : GLX_TEXTURE_FORMAT_RGB_EXT;
+
+ GLPlatformSurface::SurfaceAttributes sharedSurfaceAttributes = GLPlatformSurface::Default;
+ if (hasAlpha)
+ sharedSurfaceAttributes = GLPlatformSurface::SupportAlpha;
+
+ if (!m_configSelector)
+ m_configSelector = adoptPtr(new GLXConfigSelector(sharedSurfaceAttributes));
+
m_glxPixmap = glXCreatePixmap(display(), m_configSelector->surfaceClientConfig(format->depth, XVisualIDFromVisual(attr.visual)), m_xPixmap, glxAttributes);
if (!handler.isValidOperation())
Modified: trunk/Source/WebCore/platform/graphics/surfaces/glx/X11Helper.cpp (143703 => 143704)
--- trunk/Source/WebCore/platform/graphics/surfaces/glx/X11Helper.cpp 2013-02-22 09:20:07 UTC (rev 143703)
+++ trunk/Source/WebCore/platform/graphics/surfaces/glx/X11Helper.cpp 2013-02-22 09:33:11 UTC (rev 143704)
@@ -222,8 +222,9 @@
}
#if USE(EGL)
-void X11Helper::createOffScreenWindow(uint32_t* handleId, const EGLint id, const IntSize& size)
+void X11Helper::createOffScreenWindow(uint32_t* handleId, const EGLint id, bool supportsAlpha, const IntSize& size)
{
+#if USE(GRAPHICS_SURFACE)
VisualID visualId = static_cast<VisualID>(id);
if (!visualId)
@@ -243,13 +244,22 @@
if (isXRenderExtensionSupported()) {
XRenderPictFormat* format = XRenderFindVisualFormat(nativeDisplay(), temp->visual);
- if (format && format->direct.alphaMask > 0) {
- foundVisual = temp;
+
+ if (format) {
+ if (supportsAlpha) {
+ if (temp->depth == 32 && format->direct.alphaMask > 0)
+ foundVisual = temp;
+ } else if (!format->direct.alphaMask)
+ foundVisual = temp;
+ }
+
+ if (foundVisual)
break;
- }
}
- if (temp->depth == 32) {
+ int matchingdepth = supportsAlpha ? 32 : 24;
+
+ if (temp->depth == matchingdepth) {
foundVisual = temp;
break;
}
@@ -258,6 +268,11 @@
if (foundVisual)
createOffScreenWindow(handleId, *foundVisual, size);
}
+#else
+ UNUSED_PARAM(handleId);
+ UNUSED_PARAM(id);
+ UNUSED_PARAM(size);
+#endif
}
#endif
Modified: trunk/Source/WebCore/platform/graphics/surfaces/glx/X11Helper.h (143703 => 143704)
--- trunk/Source/WebCore/platform/graphics/surfaces/glx/X11Helper.h 2013-02-22 09:20:07 UTC (rev 143703)
+++ trunk/Source/WebCore/platform/graphics/surfaces/glx/X11Helper.h 2013-02-22 09:33:11 UTC (rev 143704)
@@ -49,7 +49,7 @@
static void createPixmap(Pixmap*, const XVisualInfo&, const IntSize& = IntSize(1, 1));
static void createOffScreenWindow(uint32_t*, const XVisualInfo&, const IntSize& = IntSize(1, 1));
#if USE(EGL)
- static void createOffScreenWindow(uint32_t*, const EGLint, const IntSize& = IntSize(1, 1));
+ static void createOffScreenWindow(uint32_t*, const EGLint, bool, const IntSize& = IntSize(1, 1));
#endif
static void destroyWindow(const uint32_t);
static void destroyPixmap(const uint32_t);