Changeset 148262 in webkit
- Timestamp:
- Apr 11, 2013 11:04:40 PM (11 years ago)
- Location:
- trunk
- Files:
-
- 18 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/ChangeLog
r148248 r148262 1 2013-04-11 Commit Queue <rniwa@webkit.org> 2 3 Unreviewed, rolling out r148247. 4 http://trac.webkit.org/changeset/148247 5 https://bugs.webkit.org/show_bug.cgi?id=114490 6 7 Cairo dep fails to build on builders due to missing EGL 8 headers (Requested by zdobersek on #webkit). 9 10 * Source/autotools/FindDependencies.m4: 11 * Source/autotools/PrintBuildConfiguration.m4: 12 * Source/autotools/SetupWebKitFeatures.m4: 13 1 14 2013-04-11 Paweł Forysiuk <tuxator@o2.pl> 2 15 -
trunk/Source/WebCore/ChangeLog
r148261 r148262 1 2013-04-11 Commit Queue <rniwa@webkit.org> 2 3 Unreviewed, rolling out r148247. 4 http://trac.webkit.org/changeset/148247 5 https://bugs.webkit.org/show_bug.cgi?id=114490 6 7 Cairo dep fails to build on builders due to missing EGL 8 headers (Requested by zdobersek on #webkit). 9 10 * platform/graphics/GraphicsContext.cpp: 11 (WebCore): 12 * platform/graphics/ImageBuffer.cpp: 13 (WebCore): 14 * platform/graphics/cairo/GLContext.h: 15 (GLContext): 16 * platform/graphics/cairo/GraphicsContextCairo.cpp: 17 * platform/graphics/cairo/ImageBufferCairo.cpp: 18 (WebCore::ImageBufferData::ImageBufferData): 19 (WebCore::ImageBuffer::ImageBuffer): 20 (WebCore::ImageBuffer::platformTransformColorSpace): 21 (WebCore::getImageData): 22 (WebCore::ImageBuffer::putByteArray): 23 (WebCore): 24 * platform/graphics/cairo/ImageBufferDataCairo.h: 25 (ImageBufferData): 26 * platform/graphics/egl/GLContextEGL.cpp: 27 (WebCore::GLContextEGL::GLContextEGL): 28 (WebCore::GLContextEGL::~GLContextEGL): 29 * platform/graphics/egl/GLContextEGL.h: 30 * platform/graphics/glx/GLContextGLX.cpp: 31 (WebCore::GLContextGLX::GLContextGLX): 32 (WebCore::GLContextGLX::~GLContextGLX): 33 * platform/graphics/glx/GLContextGLX.h: 34 (GLContextGLX): 35 1 36 2013-04-11 Nico Weber <thakis@chromium.org> 2 37 -
trunk/Source/WebCore/platform/graphics/GraphicsContext.cpp
r148247 r148262 758 758 #endif 759 759 760 #if !USE(SKIA) && !USE(CG) && !USE(CAIRO)760 #if !USE(SKIA) && !USE(CG) 761 761 bool GraphicsContext::isAcceleratedContext() const 762 762 { -
trunk/Source/WebCore/platform/graphics/ImageBuffer.cpp
r148247 r148262 100 100 } 101 101 102 #if USE(ACCELERATED_COMPOSITING) && !USE(SKIA) && !USE(CAIRO)102 #if USE(ACCELERATED_COMPOSITING) && !USE(SKIA) 103 103 PlatformLayer* ImageBuffer::platformLayer() const 104 104 { -
trunk/Source/WebCore/platform/graphics/cairo/GLContext.h
r148247 r148262 26 26 #include <wtf/PassOwnPtr.h> 27 27 28 typedef struct _cairo_device cairo_device_t;29 30 28 #if PLATFORM(X11) 31 29 typedef struct _XDisplay Display; … … 49 47 virtual bool canRenderToDefaultFramebuffer() = 0; 50 48 virtual IntSize defaultFrameBufferSize() = 0; 51 virtual cairo_device_t* cairoDevice() = 0;52 49 53 50 #if PLATFORM(X11) -
trunk/Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp
r148247 r148262 1143 1143 } 1144 1144 1145 bool GraphicsContext::isAcceleratedContext() const1146 {1147 return cairo_surface_get_type(cairo_get_target(platformContext()->cr())) == CAIRO_SURFACE_TYPE_GL;1148 }1149 1150 1145 #if ENABLE(3D_RENDERING) && USE(TEXTURE_MAPPER) 1151 1146 TransformationMatrix GraphicsContext::get3DTransform() const -
trunk/Source/WebCore/platform/graphics/cairo/ImageBufferCairo.cpp
r148247 r148262 45 45 #include <wtf/text/WTFString.h> 46 46 47 #if ENABLE(ACCELERATED_2D_CANVAS)48 #include "GLContext.h"49 #include "OpenGLShims.h"50 #include "TextureMapperGL.h"51 #include <cairo-gl.h>52 #endif53 54 47 using namespace std; 55 48 56 49 namespace WebCore { 57 50 58 ImageBufferData::ImageBufferData(const IntSize& size)51 ImageBufferData::ImageBufferData(const IntSize&) 59 52 : m_platformContext(0) 60 , m_size(size) 61 #if ENABLE(ACCELERATED_2D_CANVAS) 62 , m_texture(0) 63 #endif 64 { 65 } 66 67 #if ENABLE(ACCELERATED_2D_CANVAS) 68 PassRefPtr<cairo_surface_t> createCairoGLSurface(const IntSize& size, uint32_t& texture) 69 { 70 GLContext::sharingContext()->makeContextCurrent(); 71 72 // We must generate the texture ourselves, because there is no Cairo API for extracting it 73 // from a pre-existing surface. 74 glGenTextures(1, &texture); 75 glBindTexture(GL_TEXTURE_2D, texture); 76 glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP); 77 glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP); 78 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); 79 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); 80 81 glPixelStorei(GL_UNPACK_ALIGNMENT, 1); 82 83 glTexImage2D(GL_TEXTURE_2D, 0 /* level */, GL_RGBA8, size.width(), size.height(), 0 /* border */, GL_RGBA, GL_UNSIGNED_BYTE, 0); 84 85 GLContext* context = GLContext::sharingContext(); 86 cairo_device_t* device = context->cairoDevice(); 87 88 // Thread-awareness is a huge performance hit on non-Intel drivers. 89 cairo_gl_device_set_thread_aware(device, FALSE); 90 91 return adoptRef(cairo_gl_surface_create_for_texture(device, CAIRO_CONTENT_COLOR_ALPHA, texture, size.width(), size.height())); 92 } 93 #endif 94 95 ImageBuffer::ImageBuffer(const IntSize& size, float /* resolutionScale */, ColorSpace, RenderingMode renderingMode, bool& success) 53 { 54 } 55 56 ImageBuffer::ImageBuffer(const IntSize& size, float /* resolutionScale */, ColorSpace, RenderingMode, bool& success) 96 57 : m_data(size) 97 58 , m_size(size) … … 99 60 { 100 61 success = false; // Make early return mean error. 101 102 #if ENABLE(ACCELERATED_2D_CANVAS) 103 if (renderingMode == Accelerated) 104 m_data.m_surface = createCairoGLSurface(size, m_data.m_texture); 105 else 106 #endif 107 m_data.m_surface = adoptRef(cairo_image_surface_create(CAIRO_FORMAT_ARGB32, size.width(), size.height())); 108 62 m_data.m_surface = adoptRef(cairo_image_surface_create(CAIRO_FORMAT_ARGB32, size.width(), size.height())); 109 63 if (cairo_surface_status(m_data.m_surface.get()) != CAIRO_STATUS_SUCCESS) 110 64 return; // create will notice we didn't set m_initialized and fail. … … 161 115 void ImageBuffer::platformTransformColorSpace(const Vector<int>& lookUpTable) 162 116 { 163 // FIXME: Enable color space conversions on accelerated canvases. 164 if (cairo_surface_get_type(m_data.m_surface.get()) != CAIRO_SURFACE_TYPE_IMAGE) 165 return; 117 ASSERT(cairo_surface_get_type(m_data.m_surface.get()) == CAIRO_SURFACE_TYPE_IMAGE); 166 118 167 119 unsigned char* dataSrc = cairo_image_surface_get_data(m_data.m_surface.get()); … … 182 134 } 183 135 184 static cairo_surface_t* mapSurfaceToImage(cairo_surface_t* surface, const IntSize& size)185 {186 if (cairo_surface_get_type(surface) == CAIRO_SURFACE_TYPE_IMAGE)187 return surface;188 189 cairo_surface_t* imageSurface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, size.width(), size.height());190 RefPtr<cairo_t> cr = adoptRef(cairo_create(imageSurface));191 cairo_set_source_surface(cr.get(), surface, 0, 0);192 cairo_paint(cr.get());193 return imageSurface;194 }195 196 static void unmapSurfaceFromImage(cairo_surface_t* surface, cairo_surface_t* imageSurface, const IntRect& dirtyRectangle = IntRect())197 {198 if (surface == imageSurface && dirtyRectangle.isEmpty())199 return;200 201 if (dirtyRectangle.isEmpty()) {202 cairo_surface_destroy(imageSurface);203 return;204 }205 206 if (surface == imageSurface) {207 cairo_surface_mark_dirty_rectangle(surface, dirtyRectangle.x(), dirtyRectangle.y(), dirtyRectangle.width(), dirtyRectangle.height());208 return;209 }210 211 RefPtr<cairo_t> cr = adoptRef(cairo_create(surface));212 cairo_set_source_surface(cr.get(), imageSurface, 0, 0);213 cairo_rectangle(cr.get(), dirtyRectangle.x(), dirtyRectangle.y(), dirtyRectangle.width(), dirtyRectangle.height());214 cairo_fill(cr.get());215 cairo_surface_destroy(imageSurface);216 }217 218 136 template <Multiply multiplied> 219 137 PassRefPtr<Uint8ClampedArray> getImageData(const IntRect& rect, const ImageBufferData& data, const IntSize& size) 220 138 { 139 ASSERT(cairo_surface_get_type(data.m_surface.get()) == CAIRO_SURFACE_TYPE_IMAGE); 140 221 141 RefPtr<Uint8ClampedArray> result = Uint8ClampedArray::createUninitialized(rect.width() * rect.height() * 4); 222 cairo_surface_t* imageSurface = mapSurfaceToImage(data.m_surface.get(), size); 223 unsigned char* dataSrc = cairo_image_surface_get_data(imageSurface); 142 unsigned char* dataSrc = cairo_image_surface_get_data(data.m_surface.get()); 224 143 unsigned char* dataDst = result->data(); 225 144 … … 249 168 int numRows = endy - originy; 250 169 251 int stride = cairo_image_surface_get_stride( imageSurface);170 int stride = cairo_image_surface_get_stride(data.m_surface.get()); 252 171 unsigned destBytesPerRow = 4 * rect.width(); 253 172 … … 282 201 } 283 202 284 unmapSurfaceFromImage(data.m_surface.get(), imageSurface);285 203 return result.release(); 286 204 } … … 298 216 void ImageBuffer::putByteArray(Multiply multiplied, Uint8ClampedArray* source, const IntSize& sourceSize, const IntRect& sourceRect, const IntPoint& destPoint, CoordinateSystem) 299 217 { 300 cairo_surface_t* imageSurface = mapSurfaceToImage(m_data.m_surface.get(), sourceSize); 301 unsigned char* dataDst = cairo_image_surface_get_data(imageSurface); 218 ASSERT(cairo_surface_get_type(m_data.m_surface.get()) == CAIRO_SURFACE_TYPE_IMAGE); 219 220 unsigned char* dataDst = cairo_image_surface_get_data(m_data.m_surface.get()); 302 221 303 222 ASSERT(sourceRect.width() > 0); … … 328 247 329 248 unsigned srcBytesPerRow = 4 * sourceSize.width(); 330 int stride = cairo_image_surface_get_stride( imageSurface);249 int stride = cairo_image_surface_get_stride(m_data.m_surface.get()); 331 250 332 251 unsigned char* srcRows = source->data() + originy * srcBytesPerRow + originx * 4; … … 356 275 srcRows += srcBytesPerRow; 357 276 } 358 359 unmapSurfaceFromImage(m_data.m_surface.get(), imageSurface, IntRect(destx, desty, numColumns, numRows)); 277 cairo_surface_mark_dirty_rectangle(m_data.m_surface.get(), destx, desty, numColumns, numRows); 360 278 } 361 279 … … 392 310 #endif 393 311 394 #if ENABLE(ACCELERATED_2D_CANVAS)395 void ImageBufferData::paintToTextureMapper(TextureMapper* textureMapper, const FloatRect& targetRect, const TransformationMatrix& matrix, float opacity)396 {397 if (textureMapper->accelerationMode() != TextureMapper::OpenGLMode) {398 notImplemented();399 return;400 }401 402 ASSERT(m_texture);403 404 // Cairo may change the active context, so we make sure to change it back after flushing.405 GLContext* previousActiveContext = GLContext::getCurrent();406 cairo_surface_flush(m_surface.get());407 previousActiveContext->makeContextCurrent();408 409 static_cast<TextureMapperGL*>(textureMapper)->drawTexture(m_texture, TextureMapperGL::ShouldBlend, m_size, targetRect, matrix, opacity);410 }411 #endif412 413 PlatformLayer* ImageBuffer::platformLayer() const414 {415 #if ENABLE(ACCELERATED_2D_CANVAS)416 if (m_data.m_texture)417 return const_cast<ImageBufferData*>(&m_data);418 #endif419 return 0;420 }421 422 312 } // namespace WebCore -
trunk/Source/WebCore/platform/graphics/cairo/ImageBufferDataCairo.h
r148247 r148262 27 27 #include "RefPtrCairo.h" 28 28 29 #if ENABLE(ACCELERATED_2D_CANVAS)30 #include "TextureMapper.h"31 #include "TextureMapperPlatformLayer.h"32 #endif33 34 29 namespace WebCore { 35 30 36 31 class IntSize; 37 32 38 class ImageBufferData 39 #if ENABLE(ACCELERATED_2D_CANVAS) 40 : public TextureMapperPlatformLayer 41 #endif 42 { 33 class ImageBufferData { 43 34 public: 44 35 ImageBufferData(const IntSize&); … … 46 37 RefPtr<cairo_surface_t> m_surface; 47 38 PlatformContextCairo m_platformContext; 48 IntSize m_size;49 50 #if ENABLE(ACCELERATED_2D_CANVAS)51 virtual void paintToTextureMapper(TextureMapper*, const FloatRect& target, const TransformationMatrix&, float opacity);52 uint32_t m_texture;53 #endif54 39 }; 55 40 -
trunk/Source/WebCore/platform/graphics/egl/GLContextEGL.cpp
r148247 r148262 23 23 24 24 #include "GraphicsContext3D.h" 25 #include <cairo.h>26 25 #include <wtf/OwnPtr.h> 27 26 … … 31 30 #else 32 31 #include "OpenGLShims.h" 33 #endif34 35 #if ENABLE(ACCELERATED_2D_CANVAS)36 #include <cairo-gl.h>37 32 #endif 38 33 … … 214 209 , m_surface(surface) 215 210 , m_type(type) 216 , m_cairoDevice(0)217 211 { 218 212 } … … 220 214 GLContextEGL::~GLContextEGL() 221 215 { 222 if (m_cairoDevice)223 cairo_device_destroy(m_cairoDevice);224 225 216 EGLDisplay display = sharedEGLDisplay(); 226 217 if (m_context) { … … 274 265 } 275 266 276 cairo_device_t* GLContextEGL::cairoDevice()277 {278 if (m_cairoDevice)279 return m_cairoDevice;280 281 #if ENABLE(ACCELERATED_2D_CANVAS)282 m_cairoDevice = cairo_egl_device_create(sharedEGLDisplay(), m_context);283 #endif284 285 return m_cairoDevice;286 }287 288 267 #if ENABLE(WEBGL) 289 268 PlatformGraphicsContext3D GLContextEGL::platformContext() -
trunk/Source/WebCore/platform/graphics/egl/GLContextEGL.h
r148247 r148262 42 42 virtual bool canRenderToDefaultFramebuffer(); 43 43 virtual IntSize defaultFrameBufferSize(); 44 virtual cairo_device_t* cairoDevice(); 44 45 45 46 46 #if ENABLE(WEBGL) … … 60 60 EGLSurface m_surface; 61 61 EGLSurfaceType m_type; 62 cairo_device_t* m_cairoDevice;63 62 }; 64 63 -
trunk/Source/WebCore/platform/graphics/glx/GLContextGLX.cpp
r148247 r148262 24 24 #include "OpenGLShims.h" 25 25 #include <GL/glx.h> 26 #include <cairo.h>27 26 #include <wtf/OwnPtr.h> 28 29 #if ENABLE(ACCELERATED_2D_CANVAS)30 #include <cairo-gl.h>31 #endif32 27 33 28 namespace WebCore { … … 174 169 , m_pixmap(0) 175 170 , m_glxPixmap(0) 176 , m_cairoDevice(0)177 171 { 178 172 } … … 184 178 , m_pixmap(pixmap) 185 179 , m_glxPixmap(glxPixmap) 186 , m_cairoDevice(0)187 180 { 188 181 } … … 190 183 GLContextGLX::~GLContextGLX() 191 184 { 192 if (m_cairoDevice)193 cairo_device_destroy(m_cairoDevice);194 195 185 if (m_context) { 196 186 // This may be necessary to prevent crashes with NVidia's closed source drivers. Originally … … 262 252 } 263 253 264 cairo_device_t* GLContextGLX::cairoDevice()265 {266 if (m_cairoDevice)267 return m_cairoDevice;268 269 #if ENABLE(ACCELERATED_2D_CANVAS)270 m_cairoDevice = cairo_glx_device_create(sharedX11Display(), m_context);271 #endif272 273 return m_cairoDevice;274 }275 276 254 #if USE(3D_GRAPHICS) 277 255 PlatformGraphicsContext3D GLContextGLX::platformContext() -
trunk/Source/WebCore/platform/graphics/glx/GLContextGLX.h
r148247 r148262 47 47 virtual bool canRenderToDefaultFramebuffer(); 48 48 virtual IntSize defaultFrameBufferSize(); 49 virtual cairo_device_t* cairoDevice();50 49 51 50 #if USE(3D_GRAPHICS) … … 65 64 Pixmap m_pixmap; 66 65 GLXPixmap m_glxPixmap; 67 cairo_device_t* m_cairoDevice;68 66 }; 69 67 -
trunk/Source/autotools/FindDependencies.m4
r148247 r148262 299 299 fi 300 300 fi 301 302 301 if test "$enable_gamepad" = "yes" && test "$os_linux" = no; then 303 302 AC_MSG_WARN([Gamepad support is only available on Linux. Disabling Gamepad support.]) … … 467 466 AC_SUBST([OPENGL_LIBS]) 468 467 469 enable_accelerated_canvas=no470 if test "$enable_accelerated_compositing" = "yes" && test "$with_acceleration_backend" = "opengl"; then471 CAIRO_GL_LIBS="cairo-gl"472 if test "$enable_glx" = "yes"; then473 CAIRO_GL_LIBS+=" cairo-glx"474 fi475 if test "$enable_egl" = "yes"; then476 CAIRO_GL_LIBS+=" cairo-egl"477 fi478 479 # At the moment CairoGL does not add any extra cflags and libraries, so we can480 # safely ignore CAIRO_GL_LIBS and CAIRO_GL_CFLAGS for the moment.481 PKG_CHECK_MODULES(CAIRO_GL, $CAIRO_GL_LIBS, [enable_accelerated_canvas=yes], [enable_accelerated_canvas=no])482 fi483 484 468 if test "$enable_gamepad" = "yes"; then 485 469 PKG_CHECK_MODULES([GAMEPAD], [gio-unix-2.0 gudev-1.0]) -
trunk/Source/autotools/PrintBuildConfiguration.m4
r148247 r148262 17 17 WebKit2 support : $enable_webkit2 18 18 Accelerated Compositing : $enable_accelerated_compositing 19 Accelerated 2D canvas : $enable_accelerated_canvas20 19 Gamepad support : $enable_gamepad 21 20 Geolocation support : $enable_geolocation -
trunk/Source/autotools/SetupWebKitFeatures.m4
r148247 r148262 72 72 fi 73 73 74 if test "$enable_accelerated_canvas" = "yes"; then75 CONFIGURABLE_FEATURE_DEFINES="$CONFIGURABLE_FEATURE_DEFINES ENABLE_ACCELERATED_2D_CANVAS=1"76 else77 CONFIGURABLE_FEATURE_DEFINES="$CONFIGURABLE_FEATURE_DEFINES ENABLE_ACCELERATED_2D_CANVAS=0"78 fi79 80 74 if test "$enable_web_audio" = "yes"; then 81 75 CONFIGURABLE_FEATURE_DEFINES="$CONFIGURABLE_FEATURE_DEFINES ENABLE_WEB_AUDIO=1" … … 89 83 # on the output file (WebKitFeatures.txt). 90 84 $srcdir/Tools/gtk/generate-feature-defines-files $CONFIGURABLE_FEATURE_DEFINES \ 85 ENABLE_ACCELERATED_2D_CANVAS=0 \ 91 86 ENABLE_BATTERY_STATUS=0 \ 92 87 ENABLE_BLOB=1 \ -
trunk/Tools/ChangeLog
r148247 r148262 1 2013-04-11 Commit Queue <rniwa@webkit.org> 2 3 Unreviewed, rolling out r148247. 4 http://trac.webkit.org/changeset/148247 5 https://bugs.webkit.org/show_bug.cgi?id=114490 6 7 Cairo dep fails to build on builders due to missing EGL 8 headers (Requested by zdobersek on #webkit). 9 10 * Scripts/webkitdirs.pm: 11 (buildAutotoolsProject): 12 * gtk/jhbuild.modules: 13 1 14 2013-04-11 Martin Robinson <mrobinson@igalia.com> 2 15 -
trunk/Tools/Scripts/webkitdirs.pm
r148247 r148262 2120 2120 "xslt" => 1, 2121 2121 ); 2122 2123 # These features are ones which build-webkit cannot control, typically because2124 # they can only be active when we have the proper dependencies.2125 my %unsetFeatures = (2126 "accelerated-2d-canvas" => 1,2127 );2128 2129 2122 my @overridableFeatures = (); 2130 2123 foreach (@features) { 2131 2124 if ($configurableFeatures{$_->{option}}) { 2132 2125 push @buildArgs, autotoolsFlag(${$_->{value}}, $_->{option});; 2133 } els if (!$unsetFeatures{$_->{option}}){2126 } else { 2134 2127 push @overridableFeatures, $_->{define} . "=" . (${$_->{value}} ? "1" : "0"); 2135 2128 } -
trunk/Tools/gtk/jhbuild.modules
r148247 r148262 62 62 </autotools> 63 63 64 <autotools id="cairo" autogen-sh="configure" 65 autogenargs="--enable-gl=yes --enable-egl=yes --enable-glx=yes"> 64 <autotools id="cairo" autogen-sh="configure"> 66 65 <dependencies> 67 66 <dep package="fontconfig"/>
Note: See TracChangeset
for help on using the changeset viewer.