- a/Source/WebCore/ChangeLog +46 lines
Lines 1-3 a/Source/WebCore/ChangeLog_sec1
1
2013-04-12  Commit Queue  <rniwa@webkit.org>
2
3
        Unreviewed, rolling out r148262.
4
        http://trac.webkit.org/changeset/148262
5
        https://bugs.webkit.org/show_bug.cgi?id=114493
6
7
        Cairo dep should now build, rolling r148247 back in (Requested
8
        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
        (WebCore::GraphicsContext::isAcceleratedContext):
18
        (WebCore):
19
        * platform/graphics/cairo/ImageBufferCairo.cpp:
20
        (WebCore::ImageBufferData::ImageBufferData):
21
        (WebCore):
22
        (WebCore::createCairoGLSurface):
23
        (WebCore::ImageBuffer::ImageBuffer):
24
        (WebCore::ImageBuffer::platformTransformColorSpace):
25
        (WebCore::mapSurfaceToImage):
26
        (WebCore::unmapSurfaceFromImage):
27
        (WebCore::getImageData):
28
        (WebCore::ImageBuffer::putByteArray):
29
        (WebCore::ImageBufferData::paintToTextureMapper):
30
        (WebCore::ImageBuffer::platformLayer):
31
        * platform/graphics/cairo/ImageBufferDataCairo.h:
32
        (ImageBufferData):
33
        * platform/graphics/egl/GLContextEGL.cpp:
34
        (WebCore::GLContextEGL::GLContextEGL):
35
        (WebCore::GLContextEGL::~GLContextEGL):
36
        (WebCore::GLContextEGL::cairoDevice):
37
        (WebCore):
38
        * platform/graphics/egl/GLContextEGL.h:
39
        * platform/graphics/glx/GLContextGLX.cpp:
40
        (WebCore::GLContextGLX::GLContextGLX):
41
        (WebCore::GLContextGLX::~GLContextGLX):
42
        (WebCore::GLContextGLX::cairoDevice):
43
        (WebCore):
44
        * platform/graphics/glx/GLContextGLX.h:
45
        (GLContextGLX):
46
1
2013-04-11  Alexey Proskuryakov  <ap@apple.com>
47
2013-04-11  Alexey Proskuryakov  <ap@apple.com>
2
48
3
        Reduce includes of CachedSVGDocument.h
49
        Reduce includes of CachedSVGDocument.h
- a/Source/WebCore/platform/graphics/GraphicsContext.cpp -1 / +1 lines
Lines 757-763 void GraphicsContext::setPlatformShouldSmoothFonts(bool) a/Source/WebCore/platform/graphics/GraphicsContext.cpp_sec1
757
}
757
}
758
#endif
758
#endif
759
759
760
#if !USE(SKIA) && !USE(CG)
760
#if !USE(SKIA) && !USE(CG) && !USE(CAIRO)
761
bool GraphicsContext::isAcceleratedContext() const
761
bool GraphicsContext::isAcceleratedContext() const
762
{
762
{
763
    return false;
763
    return false;
- a/Source/WebCore/platform/graphics/ImageBuffer.cpp -1 / +1 lines
Lines 99-105 void ImageBuffer::convertToLuminanceMask() a/Source/WebCore/platform/graphics/ImageBuffer.cpp_sec1
99
    genericConvertToLuminanceMask();
99
    genericConvertToLuminanceMask();
100
}
100
}
101
101
102
#if USE(ACCELERATED_COMPOSITING) && !USE(SKIA)
102
#if USE(ACCELERATED_COMPOSITING) && !USE(SKIA) && !USE(CAIRO)
103
PlatformLayer* ImageBuffer::platformLayer() const
103
PlatformLayer* ImageBuffer::platformLayer() const
104
{
104
{
105
    return 0;
105
    return 0;
- a/Source/WebCore/platform/graphics/cairo/GLContext.h +3 lines
Lines 25-30 a/Source/WebCore/platform/graphics/cairo/GLContext.h_sec1
25
#include <wtf/Noncopyable.h>
25
#include <wtf/Noncopyable.h>
26
#include <wtf/PassOwnPtr.h>
26
#include <wtf/PassOwnPtr.h>
27
27
28
typedef struct _cairo_device cairo_device_t;
29
28
#if PLATFORM(X11)
30
#if PLATFORM(X11)
29
typedef struct _XDisplay Display;
31
typedef struct _XDisplay Display;
30
#endif
32
#endif
Lines 46-51 public: a/Source/WebCore/platform/graphics/cairo/GLContext.h_sec2
46
    virtual void waitNative() = 0;
48
    virtual void waitNative() = 0;
47
    virtual bool canRenderToDefaultFramebuffer() = 0;
49
    virtual bool canRenderToDefaultFramebuffer() = 0;
48
    virtual IntSize defaultFrameBufferSize() = 0;
50
    virtual IntSize defaultFrameBufferSize() = 0;
51
    virtual cairo_device_t* cairoDevice() = 0;
49
52
50
#if PLATFORM(X11)
53
#if PLATFORM(X11)
51
    static Display* sharedX11Display();
54
    static Display* sharedX11Display();
- a/Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp +5 lines
Lines 1142-1147 InterpolationQuality GraphicsContext::imageInterpolationQuality() const a/Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp_sec1
1142
    return platformContext()->imageInterpolationQuality();
1142
    return platformContext()->imageInterpolationQuality();
1143
}
1143
}
1144
1144
1145
bool GraphicsContext::isAcceleratedContext() const
1146
{
1147
    return cairo_surface_get_type(cairo_get_target(platformContext()->cr())) == CAIRO_SURFACE_TYPE_GL;
1148
}
1149
1145
#if ENABLE(3D_RENDERING) && USE(TEXTURE_MAPPER)
1150
#if ENABLE(3D_RENDERING) && USE(TEXTURE_MAPPER)
1146
TransformationMatrix GraphicsContext::get3DTransform() const
1151
TransformationMatrix GraphicsContext::get3DTransform() const
1147
{
1152
{
- a/Source/WebCore/platform/graphics/cairo/ImageBufferCairo.cpp -13 / +123 lines
Lines 44-65 a/Source/WebCore/platform/graphics/cairo/ImageBufferCairo.cpp_sec1
44
#include <wtf/text/Base64.h>
44
#include <wtf/text/Base64.h>
45
#include <wtf/text/WTFString.h>
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
#endif
53
47
using namespace std;
54
using namespace std;
48
55
49
namespace WebCore {
56
namespace WebCore {
50
57
51
ImageBufferData::ImageBufferData(const IntSize&)
58
ImageBufferData::ImageBufferData(const IntSize& size)
52
    : m_platformContext(0)
59
    : m_platformContext(0)
60
    , m_size(size)
61
#if ENABLE(ACCELERATED_2D_CANVAS)
62
    , m_texture(0)
63
#endif
53
{
64
{
54
}
65
}
55
66
56
ImageBuffer::ImageBuffer(const IntSize& size, float /* resolutionScale */, ColorSpace, RenderingMode, bool& success)
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)
57
    : m_data(size)
96
    : m_data(size)
58
    , m_size(size)
97
    , m_size(size)
59
    , m_logicalSize(size)
98
    , m_logicalSize(size)
60
{
99
{
61
    success = false;  // Make early return mean error.
100
    success = false;  // Make early return mean error.
62
    m_data.m_surface = adoptRef(cairo_image_surface_create(CAIRO_FORMAT_ARGB32, size.width(), size.height()));
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
63
    if (cairo_surface_status(m_data.m_surface.get()) != CAIRO_STATUS_SUCCESS)
109
    if (cairo_surface_status(m_data.m_surface.get()) != CAIRO_STATUS_SUCCESS)
64
        return;  // create will notice we didn't set m_initialized and fail.
110
        return;  // create will notice we didn't set m_initialized and fail.
65
111
Lines 114-120 void ImageBuffer::drawPattern(GraphicsContext* context, const FloatRect& srcRect a/Source/WebCore/platform/graphics/cairo/ImageBufferCairo.cpp_sec2
114
160
115
void ImageBuffer::platformTransformColorSpace(const Vector<int>& lookUpTable)
161
void ImageBuffer::platformTransformColorSpace(const Vector<int>& lookUpTable)
116
{
162
{
117
    ASSERT(cairo_surface_get_type(m_data.m_surface.get()) == CAIRO_SURFACE_TYPE_IMAGE);
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;
118
166
119
    unsigned char* dataSrc = cairo_image_surface_get_data(m_data.m_surface.get());
167
    unsigned char* dataSrc = cairo_image_surface_get_data(m_data.m_surface.get());
120
    int stride = cairo_image_surface_get_stride(m_data.m_surface.get());
168
    int stride = cairo_image_surface_get_stride(m_data.m_surface.get());
Lines 133-145 void ImageBuffer::platformTransformColorSpace(const Vector<int>& lookUpTable) a/Source/WebCore/platform/graphics/cairo/ImageBufferCairo.cpp_sec3
133
    cairo_surface_mark_dirty_rectangle(m_data.m_surface.get(), 0, 0, m_size.width(), m_size.height());
181
    cairo_surface_mark_dirty_rectangle(m_data.m_surface.get(), 0, 0, m_size.width(), m_size.height());
134
}
182
}
135
183
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
136
template <Multiply multiplied>
218
template <Multiply multiplied>
137
PassRefPtr<Uint8ClampedArray> getImageData(const IntRect& rect, const ImageBufferData& data, const IntSize& size)
219
PassRefPtr<Uint8ClampedArray> getImageData(const IntRect& rect, const ImageBufferData& data, const IntSize& size)
138
{
220
{
139
    ASSERT(cairo_surface_get_type(data.m_surface.get()) == CAIRO_SURFACE_TYPE_IMAGE);
140
141
    RefPtr<Uint8ClampedArray> result = Uint8ClampedArray::createUninitialized(rect.width() * rect.height() * 4);
221
    RefPtr<Uint8ClampedArray> result = Uint8ClampedArray::createUninitialized(rect.width() * rect.height() * 4);
142
    unsigned char* dataSrc = cairo_image_surface_get_data(data.m_surface.get());
222
    cairo_surface_t* imageSurface = mapSurfaceToImage(data.m_surface.get(), size);
223
    unsigned char* dataSrc = cairo_image_surface_get_data(imageSurface);
143
    unsigned char* dataDst = result->data();
224
    unsigned char* dataDst = result->data();
144
225
145
    if (rect.x() < 0 || rect.y() < 0 || (rect.x() + rect.width()) > size.width() || (rect.y() + rect.height()) > size.height())
226
    if (rect.x() < 0 || rect.y() < 0 || (rect.x() + rect.width()) > size.width() || (rect.y() + rect.height()) > size.height())
Lines 167-173 PassRefPtr<Uint8ClampedArray> getImageData(const IntRect& rect, const ImageBuffe a/Source/WebCore/platform/graphics/cairo/ImageBufferCairo.cpp_sec4
167
        endy = size.height();
248
        endy = size.height();
168
    int numRows = endy - originy;
249
    int numRows = endy - originy;
169
250
170
    int stride = cairo_image_surface_get_stride(data.m_surface.get());
251
    int stride = cairo_image_surface_get_stride(imageSurface);
171
    unsigned destBytesPerRow = 4 * rect.width();
252
    unsigned destBytesPerRow = 4 * rect.width();
172
253
173
    unsigned char* destRows = dataDst + desty * destBytesPerRow + destx * 4;
254
    unsigned char* destRows = dataDst + desty * destBytesPerRow + destx * 4;
Lines 200-205 PassRefPtr<Uint8ClampedArray> getImageData(const IntRect& rect, const ImageBuffe a/Source/WebCore/platform/graphics/cairo/ImageBufferCairo.cpp_sec5
200
        destRows += destBytesPerRow;
281
        destRows += destBytesPerRow;
201
    }
282
    }
202
283
284
    unmapSurfaceFromImage(data.m_surface.get(), imageSurface);
203
    return result.release();
285
    return result.release();
204
}
286
}
205
287
Lines 215-223 PassRefPtr<Uint8ClampedArray> ImageBuffer::getPremultipliedImageData(const IntRe a/Source/WebCore/platform/graphics/cairo/ImageBufferCairo.cpp_sec6
215
297
216
void ImageBuffer::putByteArray(Multiply multiplied, Uint8ClampedArray* source, const IntSize& sourceSize, const IntRect& sourceRect, const IntPoint& destPoint, CoordinateSystem)
298
void ImageBuffer::putByteArray(Multiply multiplied, Uint8ClampedArray* source, const IntSize& sourceSize, const IntRect& sourceRect, const IntPoint& destPoint, CoordinateSystem)
217
{
299
{
218
    ASSERT(cairo_surface_get_type(m_data.m_surface.get()) == CAIRO_SURFACE_TYPE_IMAGE);
300
    cairo_surface_t* imageSurface = mapSurfaceToImage(m_data.m_surface.get(), sourceSize);
219
301
    unsigned char* dataDst = cairo_image_surface_get_data(imageSurface);
220
    unsigned char* dataDst = cairo_image_surface_get_data(m_data.m_surface.get());
221
302
222
    ASSERT(sourceRect.width() > 0);
303
    ASSERT(sourceRect.width() > 0);
223
    ASSERT(sourceRect.height() > 0);
304
    ASSERT(sourceRect.height() > 0);
Lines 246-252 void ImageBuffer::putByteArray(Multiply multiplied, Uint8ClampedArray* source, c a/Source/WebCore/platform/graphics/cairo/ImageBufferCairo.cpp_sec7
246
    int numRows = endy - desty;
327
    int numRows = endy - desty;
247
328
248
    unsigned srcBytesPerRow = 4 * sourceSize.width();
329
    unsigned srcBytesPerRow = 4 * sourceSize.width();
249
    int stride = cairo_image_surface_get_stride(m_data.m_surface.get());
330
    int stride = cairo_image_surface_get_stride(imageSurface);
250
331
251
    unsigned char* srcRows = source->data() + originy * srcBytesPerRow + originx * 4;
332
    unsigned char* srcRows = source->data() + originy * srcBytesPerRow + originx * 4;
252
    for (int y = 0; y < numRows; ++y) {
333
    for (int y = 0; y < numRows; ++y) {
Lines 274-280 void ImageBuffer::putByteArray(Multiply multiplied, Uint8ClampedArray* source, c a/Source/WebCore/platform/graphics/cairo/ImageBufferCairo.cpp_sec8
274
        }
355
        }
275
        srcRows += srcBytesPerRow;
356
        srcRows += srcBytesPerRow;
276
    }
357
    }
277
    cairo_surface_mark_dirty_rectangle(m_data.m_surface.get(), destx, desty, numColumns, numRows);
358
359
    unmapSurfaceFromImage(m_data.m_surface.get(), imageSurface, IntRect(destx, desty, numColumns, numRows));
278
}
360
}
279
361
280
#if !PLATFORM(GTK)
362
#if !PLATFORM(GTK)
Lines 309-312 String ImageBuffer::toDataURL(const String& mimeType, const double*, CoordinateS a/Source/WebCore/platform/graphics/cairo/ImageBufferCairo.cpp_sec9
309
}
391
}
310
#endif
392
#endif
311
393
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
#endif
412
413
PlatformLayer* ImageBuffer::platformLayer() const
414
{
415
#if ENABLE(ACCELERATED_2D_CANVAS)
416
    if (m_data.m_texture)
417
        return const_cast<ImageBufferData*>(&m_data);
418
#endif
419
    return 0;
420
}
421
312
} // namespace WebCore
422
} // namespace WebCore
- a/Source/WebCore/platform/graphics/cairo/ImageBufferDataCairo.h -1 / +16 lines
Lines 26-41 a/Source/WebCore/platform/graphics/cairo/ImageBufferDataCairo.h_sec1
26
#include "PlatformContextCairo.h"
26
#include "PlatformContextCairo.h"
27
#include "RefPtrCairo.h"
27
#include "RefPtrCairo.h"
28
28
29
#if ENABLE(ACCELERATED_2D_CANVAS)
30
#include "TextureMapper.h"
31
#include "TextureMapperPlatformLayer.h"
32
#endif
33
29
namespace WebCore {
34
namespace WebCore {
30
35
31
class IntSize;
36
class IntSize;
32
37
33
class ImageBufferData {
38
class ImageBufferData
39
#if ENABLE(ACCELERATED_2D_CANVAS)
40
    : public TextureMapperPlatformLayer
41
#endif
42
{
34
public:
43
public:
35
    ImageBufferData(const IntSize&);
44
    ImageBufferData(const IntSize&);
36
45
37
    RefPtr<cairo_surface_t> m_surface;
46
    RefPtr<cairo_surface_t> m_surface;
38
    PlatformContextCairo m_platformContext;
47
    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
#endif
39
};
54
};
40
55
41
} // namespace WebCore
56
} // namespace WebCore
- a/Source/WebCore/platform/graphics/egl/GLContextEGL.cpp +21 lines
Lines 22-27 a/Source/WebCore/platform/graphics/egl/GLContextEGL.cpp_sec1
22
#if USE(EGL)
22
#if USE(EGL)
23
23
24
#include "GraphicsContext3D.h"
24
#include "GraphicsContext3D.h"
25
#include <cairo.h>
25
#include <wtf/OwnPtr.h>
26
#include <wtf/OwnPtr.h>
26
27
27
#if USE(OPENGL_ES_2)
28
#if USE(OPENGL_ES_2)
Lines 31-36 a/Source/WebCore/platform/graphics/egl/GLContextEGL.cpp_sec2
31
#include "OpenGLShims.h"
32
#include "OpenGLShims.h"
32
#endif
33
#endif
33
34
35
#if ENABLE(ACCELERATED_2D_CANVAS)
36
#include <cairo-gl.h>
37
#endif
38
34
namespace WebCore {
39
namespace WebCore {
35
40
36
static EGLDisplay gSharedEGLDisplay = EGL_NO_DISPLAY;
41
static EGLDisplay gSharedEGLDisplay = EGL_NO_DISPLAY;
Lines 208-218 GLContextEGL::GLContextEGL(EGLContext context, EGLSurface surface, EGLSurfaceTyp a/Source/WebCore/platform/graphics/egl/GLContextEGL.cpp_sec3
208
    : m_context(context)
213
    : m_context(context)
209
    , m_surface(surface)
214
    , m_surface(surface)
210
    , m_type(type)
215
    , m_type(type)
216
    , m_cairoDevice(0)
211
{
217
{
212
}
218
}
213
219
214
GLContextEGL::~GLContextEGL()
220
GLContextEGL::~GLContextEGL()
215
{
221
{
222
    if (m_cairoDevice)
223
        cairo_device_destroy(m_cairoDevice);
224
216
    EGLDisplay display = sharedEGLDisplay();
225
    EGLDisplay display = sharedEGLDisplay();
217
    if (m_context) {
226
    if (m_context) {
218
        glBindFramebuffer(GL_FRAMEBUFFER, 0);
227
        glBindFramebuffer(GL_FRAMEBUFFER, 0);
Lines 264-269 void GLContextEGL::waitNative() a/Source/WebCore/platform/graphics/egl/GLContextEGL.cpp_sec4
264
    eglWaitNative(EGL_CORE_NATIVE_ENGINE);
273
    eglWaitNative(EGL_CORE_NATIVE_ENGINE);
265
}
274
}
266
275
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
#endif
284
285
    return m_cairoDevice;
286
}
287
267
#if ENABLE(WEBGL)
288
#if ENABLE(WEBGL)
268
PlatformGraphicsContext3D GLContextEGL::platformContext()
289
PlatformGraphicsContext3D GLContextEGL::platformContext()
269
{
290
{
- a/Source/WebCore/platform/graphics/egl/GLContextEGL.h -1 / +2 lines
Lines 41-47 public: a/Source/WebCore/platform/graphics/egl/GLContextEGL.h_sec1
41
    virtual void waitNative();
41
    virtual void waitNative();
42
    virtual bool canRenderToDefaultFramebuffer();
42
    virtual bool canRenderToDefaultFramebuffer();
43
    virtual IntSize defaultFrameBufferSize();
43
    virtual IntSize defaultFrameBufferSize();
44
44
    virtual cairo_device_t* cairoDevice();
45
45
46
#if ENABLE(WEBGL)
46
#if ENABLE(WEBGL)
47
    virtual PlatformGraphicsContext3D platformContext();
47
    virtual PlatformGraphicsContext3D platformContext();
Lines 59-64 private: a/Source/WebCore/platform/graphics/egl/GLContextEGL.h_sec2
59
    EGLContext m_context;
59
    EGLContext m_context;
60
    EGLSurface m_surface;
60
    EGLSurface m_surface;
61
    EGLSurfaceType m_type;
61
    EGLSurfaceType m_type;
62
    cairo_device_t* m_cairoDevice;
62
};
63
};
63
64
64
} // namespace WebCore
65
} // namespace WebCore
- a/Source/WebCore/platform/graphics/glx/GLContextGLX.cpp +22 lines
Lines 23-30 a/Source/WebCore/platform/graphics/glx/GLContextGLX.cpp_sec1
23
#include "GraphicsContext3D.h"
23
#include "GraphicsContext3D.h"
24
#include "OpenGLShims.h"
24
#include "OpenGLShims.h"
25
#include <GL/glx.h>
25
#include <GL/glx.h>
26
#include <cairo.h>
26
#include <wtf/OwnPtr.h>
27
#include <wtf/OwnPtr.h>
27
28
29
#if ENABLE(ACCELERATED_2D_CANVAS)
30
#include <cairo-gl.h>
31
#endif
32
28
namespace WebCore {
33
namespace WebCore {
29
34
30
PassOwnPtr<GLContextGLX> GLContextGLX::createWindowContext(XID window, GLContext* sharingContext)
35
PassOwnPtr<GLContextGLX> GLContextGLX::createWindowContext(XID window, GLContext* sharingContext)
Lines 168-173 GLContextGLX::GLContextGLX(GLXContext context) a/Source/WebCore/platform/graphics/glx/GLContextGLX.cpp_sec2
168
    , m_pbuffer(0)
173
    , m_pbuffer(0)
169
    , m_pixmap(0)
174
    , m_pixmap(0)
170
    , m_glxPixmap(0)
175
    , m_glxPixmap(0)
176
    , m_cairoDevice(0)
171
{
177
{
172
}
178
}
173
179
Lines 177-187 GLContextGLX::GLContextGLX(GLXContext context, Pixmap pixmap, GLXPixmap glxPixma a/Source/WebCore/platform/graphics/glx/GLContextGLX.cpp_sec3
177
    , m_pbuffer(0)
183
    , m_pbuffer(0)
178
    , m_pixmap(pixmap)
184
    , m_pixmap(pixmap)
179
    , m_glxPixmap(glxPixmap)
185
    , m_glxPixmap(glxPixmap)
186
    , m_cairoDevice(0)
180
{
187
{
181
}
188
}
182
189
183
GLContextGLX::~GLContextGLX()
190
GLContextGLX::~GLContextGLX()
184
{
191
{
192
    if (m_cairoDevice)
193
        cairo_device_destroy(m_cairoDevice);
194
185
    if (m_context) {
195
    if (m_context) {
186
        // This may be necessary to prevent crashes with NVidia's closed source drivers. Originally
196
        // This may be necessary to prevent crashes with NVidia's closed source drivers. Originally
187
        // from Mozilla's 3D canvas implementation at: http://bitbucket.org/ilmari/canvas3d/
197
        // from Mozilla's 3D canvas implementation at: http://bitbucket.org/ilmari/canvas3d/
Lines 251-256 void GLContextGLX::waitNative() a/Source/WebCore/platform/graphics/glx/GLContextGLX.cpp_sec4
251
    glXWaitX();
261
    glXWaitX();
252
}
262
}
253
263
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
#endif
272
273
    return m_cairoDevice;
274
}
275
254
#if USE(3D_GRAPHICS)
276
#if USE(3D_GRAPHICS)
255
PlatformGraphicsContext3D GLContextGLX::platformContext()
277
PlatformGraphicsContext3D GLContextGLX::platformContext()
256
{
278
{
- a/Source/WebCore/platform/graphics/glx/GLContextGLX.h +2 lines
Lines 46-51 public: a/Source/WebCore/platform/graphics/glx/GLContextGLX.h_sec1
46
    virtual void waitNative();
46
    virtual void waitNative();
47
    virtual bool canRenderToDefaultFramebuffer();
47
    virtual bool canRenderToDefaultFramebuffer();
48
    virtual IntSize defaultFrameBufferSize();
48
    virtual IntSize defaultFrameBufferSize();
49
    virtual cairo_device_t* cairoDevice();
49
50
50
#if USE(3D_GRAPHICS)
51
#if USE(3D_GRAPHICS)
51
    virtual PlatformGraphicsContext3D platformContext();
52
    virtual PlatformGraphicsContext3D platformContext();
Lines 63-68 private: a/Source/WebCore/platform/graphics/glx/GLContextGLX.h_sec2
63
    GLXPbuffer m_pbuffer;
64
    GLXPbuffer m_pbuffer;
64
    Pixmap m_pixmap;
65
    Pixmap m_pixmap;
65
    GLXPixmap m_glxPixmap;
66
    GLXPixmap m_glxPixmap;
67
    cairo_device_t* m_cairoDevice;
66
};
68
};
67
69
68
} // namespace WebCore
70
} // namespace WebCore
- a/Source/autotools/FindDependencies.m4 +16 lines
Lines 298-303 if test "$enable_accelerated_compositing" = "auto"; then a/Source/autotools/FindDependencies.m4_sec1
298
        enable_accelerated_compositing="no";
298
        enable_accelerated_compositing="no";
299
    fi
299
    fi
300
fi
300
fi
301
301
if test "$enable_gamepad" = "yes" && test "$os_linux" = no; then
302
if test "$enable_gamepad" = "yes" && test "$os_linux" = no; then
302
    AC_MSG_WARN([Gamepad support is only available on Linux. Disabling Gamepad support.])
303
    AC_MSG_WARN([Gamepad support is only available on Linux. Disabling Gamepad support.])
303
    enable_gamepad=no;
304
    enable_gamepad=no;
Lines 465-470 if test "$with_acceleration_backend" = "opengl"; then a/Source/autotools/FindDependencies.m4_sec2
465
fi
466
fi
466
AC_SUBST([OPENGL_LIBS])
467
AC_SUBST([OPENGL_LIBS])
467
468
469
enable_accelerated_canvas=no
470
if test "$enable_accelerated_compositing" = "yes" && test "$with_acceleration_backend" = "opengl"; then
471
    CAIRO_GL_LIBS="cairo-gl"
472
    if test "$enable_glx" = "yes"; then
473
        CAIRO_GL_LIBS+=" cairo-glx"
474
    fi
475
    if test "$enable_egl" = "yes"; then
476
        CAIRO_GL_LIBS+=" cairo-egl"
477
    fi
478
479
    # At the moment CairoGL does not add any extra cflags and libraries, so we can
480
    # 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
fi
483
468
if test "$enable_gamepad" = "yes"; then
484
if test "$enable_gamepad" = "yes"; then
469
    PKG_CHECK_MODULES([GAMEPAD], [gio-unix-2.0 gudev-1.0])
485
    PKG_CHECK_MODULES([GAMEPAD], [gio-unix-2.0 gudev-1.0])
470
486
- a/Source/autotools/PrintBuildConfiguration.m4 +1 lines
Lines 16-21 Features: a/Source/autotools/PrintBuildConfiguration.m4_sec1
16
 WebKit1 support                                          : $enable_webkit1
16
 WebKit1 support                                          : $enable_webkit1
17
 WebKit2 support                                          : $enable_webkit2
17
 WebKit2 support                                          : $enable_webkit2
18
 Accelerated Compositing                                  : $enable_accelerated_compositing
18
 Accelerated Compositing                                  : $enable_accelerated_compositing
19
 Accelerated 2D canvas                                    : $enable_accelerated_canvas
19
 Gamepad support                                          : $enable_gamepad
20
 Gamepad support                                          : $enable_gamepad
20
 Geolocation support                                      : $enable_geolocation
21
 Geolocation support                                      : $enable_geolocation
21
 HTML5 video element support                              : $enable_video
22
 HTML5 video element support                              : $enable_video
- a/Source/autotools/SetupWebKitFeatures.m4 -1 / +6 lines
Lines 71-76 else a/Source/autotools/SetupWebKitFeatures.m4_sec1
71
    CONFIGURABLE_FEATURE_DEFINES="$CONFIGURABLE_FEATURE_DEFINES ENABLE_3D_RENDERING=0"
71
    CONFIGURABLE_FEATURE_DEFINES="$CONFIGURABLE_FEATURE_DEFINES ENABLE_3D_RENDERING=0"
72
fi
72
fi
73
73
74
if test "$enable_accelerated_canvas" = "yes"; then
75
    CONFIGURABLE_FEATURE_DEFINES="$CONFIGURABLE_FEATURE_DEFINES ENABLE_ACCELERATED_2D_CANVAS=1"
76
else
77
    CONFIGURABLE_FEATURE_DEFINES="$CONFIGURABLE_FEATURE_DEFINES ENABLE_ACCELERATED_2D_CANVAS=0"
78
fi
79
74
if test "$enable_web_audio" = "yes"; then
80
if test "$enable_web_audio" = "yes"; then
75
    CONFIGURABLE_FEATURE_DEFINES="$CONFIGURABLE_FEATURE_DEFINES ENABLE_WEB_AUDIO=1"
81
    CONFIGURABLE_FEATURE_DEFINES="$CONFIGURABLE_FEATURE_DEFINES ENABLE_WEB_AUDIO=1"
76
else
82
else
Lines 82-88 fi a/Source/autotools/SetupWebKitFeatures.m4_sec2
82
# this command now rather than use AC_CONFIG_COMMANDS because automake rules depend
88
# this command now rather than use AC_CONFIG_COMMANDS because automake rules depend
83
# on the output file (WebKitFeatures.txt).
89
# on the output file (WebKitFeatures.txt).
84
$srcdir/Tools/gtk/generate-feature-defines-files $CONFIGURABLE_FEATURE_DEFINES \
90
$srcdir/Tools/gtk/generate-feature-defines-files $CONFIGURABLE_FEATURE_DEFINES \
85
    ENABLE_ACCELERATED_2D_CANVAS=0 \
86
    ENABLE_BATTERY_STATUS=0 \
91
    ENABLE_BATTERY_STATUS=0 \
87
    ENABLE_BLOB=1 \
92
    ENABLE_BLOB=1 \
88
    ENABLE_CANVAS_PATH=0 \
93
    ENABLE_CANVAS_PATH=0 \
- a/Tools/ChangeLog +13 lines
Lines 1-3 a/Tools/ChangeLog_sec1
1
2013-04-12  Commit Queue  <rniwa@webkit.org>
2
3
        Unreviewed, rolling out r148262.
4
        http://trac.webkit.org/changeset/148262
5
        https://bugs.webkit.org/show_bug.cgi?id=114493
6
7
        Cairo dep should now build, rolling r148247 back in (Requested
8
        by zdobersek on #webkit).
9
10
        * Scripts/webkitdirs.pm:
11
        (buildAutotoolsProject):
12
        * gtk/jhbuild.modules:
13
1
2013-04-11  Commit Queue  <rniwa@webkit.org>
14
2013-04-11  Commit Queue  <rniwa@webkit.org>
2
15
3
        Unreviewed, rolling out r148247.
16
        Unreviewed, rolling out r148247.
- a/Tools/Scripts/webkitdirs.pm -1 / +8 lines
Lines 2119-2129 sub buildAutotoolsProject($@) a/Tools/Scripts/webkitdirs.pm_sec1
2119
        "web-audio" => 1,
2119
        "web-audio" => 1,
2120
        "xslt" => 1,
2120
        "xslt" => 1,
2121
    );
2121
    );
2122
2123
    # These features are ones which build-webkit cannot control, typically because
2124
    # they can only be active when we have the proper dependencies.
2125
    my %unsetFeatures = (
2126
        "accelerated-2d-canvas" => 1,
2127
    );
2128
2122
    my @overridableFeatures = ();
2129
    my @overridableFeatures = ();
2123
    foreach (@features) {
2130
    foreach (@features) {
2124
        if ($configurableFeatures{$_->{option}}) {
2131
        if ($configurableFeatures{$_->{option}}) {
2125
            push @buildArgs, autotoolsFlag(${$_->{value}}, $_->{option});;
2132
            push @buildArgs, autotoolsFlag(${$_->{value}}, $_->{option});;
2126
        } else {
2133
        } elsif (!$unsetFeatures{$_->{option}}) {
2127
            push @overridableFeatures, $_->{define} . "=" . (${$_->{value}} ? "1" : "0");
2134
            push @overridableFeatures, $_->{define} . "=" . (${$_->{value}} ? "1" : "0");
2128
        }
2135
        }
2129
    }
2136
    }
- a/Tools/gtk/jhbuild.modules -1 / +2 lines
Lines 61-67 a/Tools/gtk/jhbuild.modules_sec1
61
    </branch>
61
    </branch>
62
  </autotools>
62
  </autotools>
63
63
64
  <autotools id="cairo" autogen-sh="configure">
64
  <autotools id="cairo" autogen-sh="configure"
65
             autogenargs="--enable-gl=yes --enable-egl=yes --enable-glx=yes">
65
    <dependencies>
66
    <dependencies>
66
      <dep package="fontconfig"/>
67
      <dep package="fontconfig"/>
67
      <dep package="pixman"/>
68
      <dep package="pixman"/>
- a/ChangeLog +13 lines
Lines 1-3 a/ChangeLog_sec1
1
2013-04-12  Commit Queue  <rniwa@webkit.org>
2
3
        Unreviewed, rolling out r148262.
4
        http://trac.webkit.org/changeset/148262
5
        https://bugs.webkit.org/show_bug.cgi?id=114493
6
7
        Cairo dep should now build, rolling r148247 back in (Requested
8
        by zdobersek on #webkit).
9
10
        * Source/autotools/FindDependencies.m4:
11
        * Source/autotools/PrintBuildConfiguration.m4:
12
        * Source/autotools/SetupWebKitFeatures.m4:
13
1
2013-04-11  Commit Queue  <rniwa@webkit.org>
14
2013-04-11  Commit Queue  <rniwa@webkit.org>
2
15
3
        Unreviewed, rolling out r148247.
16
        Unreviewed, rolling out r148247.

Return to Bug 114493