2010-05-23 Jer Noble <jer.noble@apple.com>
authorjer.noble@apple.com <jer.noble@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 24 May 2010 22:59:44 +0000 (22:59 +0000)
committerjer.noble@apple.com <jer.noble@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 24 May 2010 22:59:44 +0000 (22:59 +0000)
        Reviewed by Eric Carlson.

        HTML5 <video> tag performance worse than Flash
        https://bugs.webkit.org/show_bug.cgi?id=39577
        rdar://problem/7982458

        Added WebKitSystemInterface calls for new CAImageQueue APIs.

        * win/include/WebKitSystemInterface/WebKitSystemInterface.h:
        * win/lib/WebKitSystemInterface.lib:
        * win/lib/WebKitSystemInterface_debug.lib:
2010-05-23  Jer Noble  <jer.noble@apple.com>

        Reviewed by Eric Carlson.

        HTML5 <video> tag performance worse than Flash
        https://bugs.webkit.org/show_bug.cgi?id=39577
        rdar://problem/7982458

        Added attachments() back to QTPixelBuffer, as they are necessary for CAImageQueue.

        WKCACFLayer contents()/setContents() now return/take a CFTypeRef instead of a CGImageRef, which allows
        a CAImageQueueRef to be set as a layer's contents.

        WKCAImageQueue is a simple C++ wrapper around the WebKitSystemInterface CAImageQueue functions.

        MediaPlayerPrivateQuickTimeVisualContext will now use a CAImageQueue to display movie frames if
        certain prerequisites are met (QuartzCore.dll and CoreVideo.dll version numbers must meet a certain
        threshold defined in MediaPlayerPrivateQuickTimeVisualContext.cpp).

        * WebCore.vcproj/WebCore.vcproj:
        * platform/graphics/win/MediaPlayerPrivateQuickTimeVisualContext.cpp:
        * platform/graphics/win/MediaPlayerPrivateQuickTimeVisualContext.h:
        * platform/graphics/win/QTPixelBuffer.cpp:
        * platform/graphics/win/QTPixelBuffer.h:
        * platform/graphics/win/WKCACFLayer.cpp:
        * platform/graphics/win/WKCACFLayer.h:
        * platform/graphics/win/WKCAImageQueue.cpp: Added.
        * platform/graphics/win/WKCAImageQueue.h: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@60094 268f45cc-cd09-0410-ab3c-d52691b4dbfc

14 files changed:
WebCore/ChangeLog
WebCore/WebCore.vcproj/WebCore.vcproj
WebCore/platform/graphics/win/MediaPlayerPrivateQuickTimeVisualContext.cpp
WebCore/platform/graphics/win/MediaPlayerPrivateQuickTimeVisualContext.h
WebCore/platform/graphics/win/QTPixelBuffer.cpp
WebCore/platform/graphics/win/QTPixelBuffer.h
WebCore/platform/graphics/win/WKCACFLayer.cpp
WebCore/platform/graphics/win/WKCACFLayer.h
WebCore/platform/graphics/win/WKCAImageQueue.cpp [new file with mode: 0644]
WebCore/platform/graphics/win/WKCAImageQueue.h [new file with mode: 0644]
WebKitLibraries/ChangeLog
WebKitLibraries/win/include/WebKitSystemInterface/WebKitSystemInterface.h
WebKitLibraries/win/lib/WebKitSystemInterface.lib
WebKitLibraries/win/lib/WebKitSystemInterface_debug.lib

index b55fb23..f41a960 100644 (file)
@@ -1,3 +1,32 @@
+2010-05-23  Jer Noble  <jer.noble@apple.com>
+
+        Reviewed by Eric Carlson.
+
+        HTML5 <video> tag performance worse than Flash
+        https://bugs.webkit.org/show_bug.cgi?id=39577
+        rdar://problem/7982458
+        
+        Added attachments() back to QTPixelBuffer, as they are necessary for CAImageQueue.
+        
+        WKCACFLayer contents()/setContents() now return/take a CFTypeRef instead of a CGImageRef, which allows
+        a CAImageQueueRef to be set as a layer's contents.
+        
+        WKCAImageQueue is a simple C++ wrapper around the WebKitSystemInterface CAImageQueue functions.
+        
+        MediaPlayerPrivateQuickTimeVisualContext will now use a CAImageQueue to display movie frames if 
+        certain prerequisites are met (QuartzCore.dll and CoreVideo.dll version numbers must meet a certain
+        threshold defined in MediaPlayerPrivateQuickTimeVisualContext.cpp).
+        
+        * WebCore.vcproj/WebCore.vcproj:
+        * platform/graphics/win/MediaPlayerPrivateQuickTimeVisualContext.cpp:
+        * platform/graphics/win/MediaPlayerPrivateQuickTimeVisualContext.h:
+        * platform/graphics/win/QTPixelBuffer.cpp:
+        * platform/graphics/win/QTPixelBuffer.h:
+        * platform/graphics/win/WKCACFLayer.cpp:
+        * platform/graphics/win/WKCACFLayer.h:
+        * platform/graphics/win/WKCAImageQueue.cpp: Added.
+        * platform/graphics/win/WKCAImageQueue.h: Added.
+
 2010-05-24  Brady Eidson  <beidson@apple.com>
 
         Reviewed by Darin Adler.
index 6020250..54112a2 100644 (file)
                                                RelativePath="..\platform\graphics\win\WKCACFLayerRenderer.h"\r
                                                >\r
                                        </File>\r
+                                       <File\r
+                                               RelativePath="..\platform\graphics\win\WKCAImageQueue.cpp"\r
+                                               >\r
+                                       </File>\r
+                                       <File\r
+                                               RelativePath="..\platform\graphics\win\WKCAImageQueue.h"\r
+                                               >\r
+                                       </File>\r
                                </Filter>\r
                                <Filter\r
                                        Name="cg"\r
index e1d457f..3feed40 100644 (file)
 #if USE(ACCELERATED_COMPOSITING)
 #include "GraphicsLayerCACF.h"
 #include "WKCACFLayer.h"
+#include "WKCAImageQueue.h"
 #endif
 
 using namespace std;
 
-const CFStringRef kMinQuartzCoreVersion = CFSTR("1.0.43.0");
-const CFStringRef kMinCoreVideoVersion = CFSTR("1.0.0.2");
-
 namespace WebCore {
 
 static CGImageRef CreateCGImageFromPixelBuffer(QTPixelBuffer buffer);
+static bool requiredDllsAvailable();
 
 SOFT_LINK_LIBRARY(Wininet)
 SOFT_LINK(Wininet, InternetSetCookieExW, DWORD, WINAPI, (LPCWSTR lpszUrl, LPCWSTR lpszCookieName, LPCWSTR lpszCookieData, DWORD dwFlags, DWORD_PTR dwReserved), (lpszUrl, lpszCookieName, lpszCookieData, dwFlags, dwReserved))
@@ -286,7 +285,12 @@ void MediaPlayerPrivateQuickTimeVisualContext::load(const String& url)
     m_movie->load(url.characters(), url.length(), m_player->preservesPitch());
     m_movie->setVolume(m_player->volume());
 
-    CFDictionaryRef options = QTMovieVisualContext::getCGImageOptions();
+    CFDictionaryRef options = 0;
+    // If CAImageQueue prerequisites are not satisfied, pass in visual context pixelbuffer
+    // options which will instruct the visual context to generate CGImage compatible 
+    // pixel buffers (i.e. RGBA).
+    if (!requiredDllsAvailable())
+        options = QTMovieVisualContext::getCGImageOptions();
     m_visualContext = adoptRef(new QTMovieVisualContext(m_visualContextClient.get(), options));
     m_visualContext->setMovie(m_movie.get());
 }
@@ -756,16 +760,41 @@ void MediaPlayerPrivateQuickTimeVisualContext::retrieveCurrentImage()
 
         WKCACFLayer* layer = static_cast<WKCACFLayer*>(m_qtVideoLayer->platformLayer());
 
-            if (!buffer.lockBaseAddress()) {
-               CFTimeInterval imageTime = QTMovieVisualContext::currentHostTime();
+        if (!buffer.lockBaseAddress()) {
+
+            if (requiredDllsAvailable()) {
+                if (!m_imageQueue) {
+                    m_imageQueue = new WKCAImageQueue(buffer.width(), buffer.height(), 30);
+                    m_imageQueue->setFlags(WKCAImageQueue::Fill, WKCAImageQueue::Fill);
+                    layer->setContents(m_imageQueue->get());
+                }
+
+                // Debug QuickTime links against a non-Debug version of CoreFoundation, so the
+                // CFDictionary attached to the CVPixelBuffer cannot be directly passed on into the
+                // CAImageQueue without being converted to a non-Debug CFDictionary.  Additionally,
+                // old versions of QuickTime used a non-AAS CoreFoundation, so the types are not 
+                // interchangable even in the release case.
+                RetainPtr<CFDictionaryRef> attachments(AdoptCF, QTCFDictionaryCreateCopyWithDataCallback(kCFAllocatorDefault, buffer.attachments(), &QTCFDictionaryCreateWithDataCallback));
+                CFTimeInterval imageTime = QTMovieVisualContext::currentHostTime();
+
+                m_imageQueue->collect();
+
+                uint64_t imageId = m_imageQueue->registerPixelBuffer(buffer.baseAddress(), buffer.dataSize(), buffer.bytesPerRow(), buffer.width(), buffer.height(), buffer.pixelFormatType(), attachments.get(), 0);
 
+                if (m_imageQueue->insertImage(imageTime, WKCAImageQueue::Buffer, imageId, WKCAImageQueue::Opaque | WKCAImageQueue::Flush, &QTPixelBuffer::imageQueueReleaseCallback, buffer.pixelBufferRef())) {
+                    // Retain the buffer one extra time so it doesn't dissappear before CAImageQueue decides to release it:
+                    QTPixelBuffer::retainCallback(buffer.pixelBufferRef());
+                }
+
+            } else {
                 CGImageRef image = CreateCGImageFromPixelBuffer(buffer);
                 layer->setContents(image);
                 CGImageRelease(image);
-
-                buffer.unlockBaseAddress();
-                layer->rootLayer()->setNeedsRender();
             }
+
+            buffer.unlockBaseAddress();
+            layer->rootLayer()->setNeedsRender();
+        }
     } else
 #endif
         m_player->repaint();
@@ -794,6 +823,69 @@ static HashSet<String> mimeTypeCache()
     return typeCache;
 }
 
+static CFStringRef createVersionStringFromModuleName(LPCWSTR moduleName)
+{
+    HMODULE module = GetModuleHandleW(moduleName);
+    if (!module) 
+        return 0;
+
+    wchar_t filePath[MAX_PATH] = {0};
+    if (!GetModuleFileNameW(module, filePath, MAX_PATH)) 
+        return 0;
+
+    DWORD versionInfoSize = GetFileVersionInfoSizeW(filePath, 0);
+    if (!versionInfoSize)
+        return 0;
+
+    CFStringRef versionString = 0;
+    void* versionInfo = calloc(versionInfoSize, sizeof(char));
+    if (GetFileVersionInfo(filePath, 0, versionInfoSize, versionInfo)) {
+        VS_FIXEDFILEINFO* fileInfo = 0;
+        UINT fileInfoLength = 0;
+
+        if (VerQueryValueW(versionInfo, L"\\", reinterpret_cast<LPVOID*>(&fileInfo), &fileInfoLength)) {
+            versionString = CFStringCreateWithFormat(kCFAllocatorDefault, 0, CFSTR("%d.%d.%d.%d"), 
+                HIWORD(fileInfo->dwFileVersionMS), LOWORD(fileInfo->dwFileVersionMS), 
+                HIWORD(fileInfo->dwFileVersionLS), LOWORD(fileInfo->dwFileVersionLS));
+        }
+    }
+    free(versionInfo);
+
+    return versionString;
+}
+
+static bool requiredDllsAvailable() 
+{
+    static bool s_prerequisitesChecked = false;
+    static bool s_prerequisitesSatisfied;
+    static const CFStringRef kMinQuartzCoreVersion = CFSTR("1.0.42.0");
+    static const CFStringRef kMinCoreVideoVersion = CFSTR("1.0.1.0");
+
+    if (s_prerequisitesChecked)
+        return s_prerequisitesSatisfied;
+    s_prerequisitesChecked = true;
+    s_prerequisitesSatisfied = false;
+
+    CFStringRef quartzCoreString = createVersionStringFromModuleName(L"QuartzCore");
+    if (!quartzCoreString)
+        quartzCoreString = createVersionStringFromModuleName(L"QuartzCore_debug");
+
+    CFStringRef coreVideoString = createVersionStringFromModuleName(L"CoreVideo");
+    if (!coreVideoString)
+        coreVideoString = createVersionStringFromModuleName(L"CoreVideo_debug");
+
+    s_prerequisitesSatisfied = (quartzCoreString && coreVideoString
+        && CFStringCompare(quartzCoreString, kMinQuartzCoreVersion, kCFCompareNumerically) != kCFCompareLessThan 
+        && CFStringCompare(coreVideoString, kMinCoreVideoVersion, kCFCompareNumerically) != kCFCompareLessThan);
+
+    if (quartzCoreString)
+        CFRelease(quartzCoreString);
+    if (coreVideoString)
+        CFRelease(coreVideoString);
+
+    return s_prerequisitesSatisfied;
+}
+
 void MediaPlayerPrivateQuickTimeVisualContext::getSupportedTypes(HashSet<String>& types)
 {
     types = mimeTypeCache();
@@ -944,9 +1036,11 @@ void MediaPlayerPrivateQuickTimeVisualContext::createLayerForMovie()
 void MediaPlayerPrivateQuickTimeVisualContext::destroyLayerForMovie()
 {
 #if USE(ACCELERATED_COMPOSITING)
-    if (!m_qtVideoLayer)
-        return;
-    m_qtVideoLayer = 0;
+    if (m_qtVideoLayer)
+        m_qtVideoLayer = 0;
+
+    if (m_imageQueue)
+        m_imageQueue = 0;
 #endif
 }
 
index 12166a3..eb8e060 100644 (file)
@@ -41,7 +41,6 @@
 typedef struct CGImage *CGImageRef;
 class QTMovie;
 class QTMovieVisualContext;
-class WKCAImageQueue;
 
 namespace WebCore {
 
@@ -49,6 +48,7 @@ class GraphicsContext;
 class IntSize;
 class IntRect;
 class String;
+class WKCAImageQueue;
 
 class MediaPlayerPrivateQuickTimeVisualContext : public MediaPlayerPrivateInterface {
 public:
@@ -163,6 +163,7 @@ private:
     OwnPtr<GraphicsLayer> m_qtVideoLayer;
 #endif
     RefPtr<QTMovieVisualContext> m_visualContext;
+    OwnPtr<WKCAImageQueue> m_imageQueue;
     float m_seekTo;
     Timer<MediaPlayerPrivateQuickTimeVisualContext> m_seekTimer;
     Timer<MediaPlayerPrivateQuickTimeVisualContext> m_visualContextTimer;
index f874287..657b68e 100644 (file)
@@ -172,6 +172,11 @@ void QTPixelBuffer::getExtendedPixels(size_t* left, size_t* right, size_t* top,
     return CVPixelBufferGetExtendedPixels(m_pixelBuffer, left, right, top, bottom);
 }
 
+CFDictionaryRef QTPixelBuffer::attachments() const
+{
+    return CVBufferGetAttachments(m_pixelBuffer, kCVAttachmentMode_ShouldPropagate);
+}
+
 void QTPixelBuffer::retainCallback(void* refcon)
 {
     CVPixelBufferRetain(static_cast<CVPixelBufferRef>(refcon));
index 3af2197..22f8ba4 100644 (file)
@@ -38,6 +38,7 @@ typedef struct __CVBuffer *CVBufferRef;
 typedef CVBufferRef CVPixelBufferRef;
 typedef struct CGImage* CGImageRef;
 typedef int32_t CVReturn;
+typedef const struct __CFDictionary * CFDictionaryRef;
 
 // QTPixelBuffer wraps QuickTime's implementation of CVPixelBuffer, so its functions are
 // safe to call within WebKit.
@@ -74,6 +75,7 @@ public:
     size_t bytesPerRowOfPlane(size_t) const;
 
     void getExtendedPixels(size_t* left, size_t* right, size_t* top, size_t* bottom) const;
+    CFDictionaryRef attachments() const;
 
     // Generic CFRetain/CFRelease callbacks
     static void releaseCallback(void* refcon);
index 3f332d8..06146d7 100644 (file)
@@ -497,11 +497,14 @@ void WKCACFLayer::printLayer(int indent) const
     }
 
     // Print contents if needed
-    CGImageRef layerContents = contents();
+    CFTypeRef layerContents = contents();
     if (layerContents) {
-        printIndent(indent + 1);
-        fprintf(stderr, "(contents (image [%d %d]))\n",
-            CGImageGetWidth(layerContents), CGImageGetHeight(layerContents));
+        if (CFGetTypeID(layerContents) == CGImageGetTypeID()) {
+            CGImageRef imageContents = static_cast<CGImageRef>(const_cast<void*>(layerContents));
+            printIndent(indent + 1);
+            fprintf(stderr, "(contents (image [%d %d]))\n",
+                CGImageGetWidth(imageContents), CGImageGetHeight(imageContents));
+        }
     }
 
     // Print sublayers if needed
index bdc427e..9824f64 100644 (file)
@@ -155,8 +155,8 @@ public:
     void setClearsContext(bool clears) { CACFLayerSetClearsContext(layer(), clears); setNeedsCommit(); }
     bool clearsContext() const { return CACFLayerGetClearsContext(layer()); }
 
-    void setContents(CGImageRef contents) { CACFLayerSetContents(layer(), contents); setNeedsCommit(); }
-    CGImageRef contents() const { return static_cast<CGImageRef>(const_cast<void*>(CACFLayerGetContents(layer()))); }
+    void setContents(CFTypeRef contents) { CACFLayerSetContents(layer(), contents); setNeedsCommit(); }
+    CFTypeRef contents() const { return CACFLayerGetContents(layer()); }
 
     void setContentsRect(const CGRect& contentsRect) { CACFLayerSetContentsRect(layer(), contentsRect); setNeedsCommit(); }
     CGRect contentsRect() const { return CACFLayerGetContentsRect(layer()); }
@@ -206,10 +206,10 @@ public:
     CGFloat zPosition() const { return CACFLayerGetZPosition(layer()); }
 
     void setSpeed(float speed) { CACFLayerSetSpeed(layer(), speed); }
-    CFTimeInterval speed() const { CACFLayerGetSpeed(layer()); }
+    CFTimeInterval speed() const { return CACFLayerGetSpeed(layer()); }
 
     void setTimeOffset(CFTimeInterval t) { CACFLayerSetTimeOffset(layer(), t); }
-    CFTimeInterval timeOffset() const { CACFLayerGetTimeOffset(layer()); }
+    CFTimeInterval timeOffset() const { return CACFLayerGetTimeOffset(layer()); }
 
     WKCACFLayer* rootLayer() const;
 
diff --git a/WebCore/platform/graphics/win/WKCAImageQueue.cpp b/WebCore/platform/graphics/win/WKCAImageQueue.cpp
new file mode 100644 (file)
index 0000000..97677f4
--- /dev/null
@@ -0,0 +1,100 @@
+/*
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without 
+ * modification, are permitted provided that the following conditions 
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright 
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the 
+ *    documentation and/or other materials provided with the distribution.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS \93AS IS\94 
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+
+#include "WKCAImageQueue.h"
+
+#include <WebKitSystemInterface/WebKitSystemInterface.h>
+#include <wtf/RetainPtr.h>
+
+namespace WebCore {
+
+class WKCAImageQueuePrivate {
+public:
+    RetainPtr<CAImageQueueRef> m_imageQueue;
+};
+
+static CAImageQueueRef WKCAImageQueueRetain(CAImageQueueRef iq) 
+{
+    if (iq)
+        return (CAImageQueueRef)CFRetain(iq);
+    return 0;
+}
+
+static void WKCAImageQueueRelease(CAImageQueueRef iq)
+{
+    if (iq)
+        CFRelease(iq);
+}
+
+WKCAImageQueue::WKCAImageQueue(uint32_t width, uint32_t height, uint32_t capacity)
+    : m_private(new WKCAImageQueuePrivate())
+{
+    m_private->m_imageQueue.adoptCF(wkCAImageQueueCreate(width, height, capacity));
+}
+
+WKCAImageQueue::WKCAImageQueue(const WKCAImageQueue& o)
+    : m_private(new WKCAImageQueuePrivate())
+{
+    m_private->m_imageQueue = o.m_private->m_imageQueue;
+}
+
+WKCAImageQueue::~WKCAImageQueue(void)
+{
+}
+
+WKCAImageQueue& WKCAImageQueue::operator=(const WKCAImageQueue& o)
+{
+    m_private->m_imageQueue = o.m_private->m_imageQueue;
+    return *this;
+}
+
+size_t WKCAImageQueue::collect()
+{
+    return wkCAImageQueueCollect(m_private->m_imageQueue.get());
+}
+
+bool WKCAImageQueue::insertImage(double t, unsigned int type, uint64_t id, uint32_t flags, ReleaseCallback release, void* info)
+{
+    return wkCAImageQueueInsertImage(m_private->m_imageQueue.get(), t, type, id, flags, release, info);
+}
+
+uint64_t WKCAImageQueue::registerPixelBuffer(void *data, size_t data_size, size_t rowbytes, size_t width, size_t height, uint32_t pixel_format, CFDictionaryRef attachments, uint32_t flags)
+{
+    return wkCAImageQueueRegisterPixelBuffer(m_private->m_imageQueue.get(), data, data_size, rowbytes, width, height, pixel_format, attachments, flags);
+}
+
+void WKCAImageQueue::setFlags(uint32_t mask, uint32_t flags)
+{
+    wkCAImageQueueSetFlags(m_private->m_imageQueue.get(), mask, flags);
+}
+
+CFTypeRef WKCAImageQueue::get()
+{
+    return m_private->m_imageQueue.get();
+}
+
+}
diff --git a/WebCore/platform/graphics/win/WKCAImageQueue.h b/WebCore/platform/graphics/win/WKCAImageQueue.h
new file mode 100644 (file)
index 0000000..ddd9bbf
--- /dev/null
@@ -0,0 +1,88 @@
+/*
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without 
+ * modification, are permitted provided that the following conditions 
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright 
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the 
+ *    documentation and/or other materials provided with the distribution.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS \93AS IS\94 
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WKCAImageQueue_h
+#define WKCAImageQueue_h
+
+typedef const void * CFTypeRef;
+typedef const struct __CFDictionary * CFDictionaryRef;
+
+#include <stdint.h>
+#include <wtf/OwnPtr.h>
+
+namespace WebCore {
+
+class WKCAImageQueuePrivate;
+
+class WKCAImageQueue {
+public:
+    enum Flags {
+        Async = 1U << 0,
+        Fill  = 1U << 1,
+        Protected = 1U << 2,
+        UseCleanAperture = 1U << 3,
+        UseAspectRatio = 1U << 4,
+        LowQualityColor = 1U << 5,
+    };
+
+    enum ImageType {
+        Nil = 1,
+        Surface,
+        Buffer,
+        IOSurface,
+    };
+
+    enum ImageFlags {
+        Opaque = 1U << 0,
+        Flush = 1U << 1,
+        WillFlush = 1U << 2,
+        Flipped = 1U << 3,
+        WaitGPU = 1U << 4,
+    };
+
+    typedef void (*ReleaseCallback)(unsigned int type, uint64_t id, void* info);
+
+    WKCAImageQueue(uint32_t width, uint32_t height, uint32_t capacity);
+    ~WKCAImageQueue(void);
+
+    size_t collect();
+
+    bool insertImage(double t, unsigned int type, uint64_t id, uint32_t flags, ReleaseCallback release, void* info);
+    uint64_t registerPixelBuffer(void *data, size_t data_size, size_t rowbytes, size_t width, size_t height, uint32_t pixel_format, CFDictionaryRef attachments, uint32_t flags);
+
+    uint32_t flags() const;
+    void setFlags(uint32_t mask, uint32_t flags);
+
+    CFTypeRef get();
+
+private:
+    WKCAImageQueue(const WKCAImageQueue&);
+    WKCAImageQueue& operator=(const WKCAImageQueue&);
+    OwnPtr<WKCAImageQueuePrivate> m_private;
+};
+
+}
+
+#endif
index 83297ec..336d780 100644 (file)
@@ -1,3 +1,17 @@
+2010-05-23  Jer Noble  <jer.noble@apple.com>
+
+        Reviewed by Eric Carlson.
+
+        HTML5 <video> tag performance worse than Flash
+        https://bugs.webkit.org/show_bug.cgi?id=39577
+        rdar://problem/7982458
+
+        Added WebKitSystemInterface calls for new CAImageQueue APIs.
+        
+        * win/include/WebKitSystemInterface/WebKitSystemInterface.h:
+        * win/lib/WebKitSystemInterface.lib:
+        * win/lib/WebKitSystemInterface_debug.lib:
+
 2010-05-20  Steve Block  <steveblock@google.com>
 
         Reviewed by Jeremy Orlow.
index 445b292..13dc966 100644 (file)
@@ -50,6 +50,14 @@ typedef const struct __CFURL* CFURLRef;
 typedef struct _CFURLProtectionSpace* CFURLProtectionSpaceRef;
 typedef struct tagLOGFONTW LOGFONTW;
 typedef LOGFONTW LOGFONT;
+typedef struct _CACFLayer *CACFLayerRef;
+typedef struct __CVBuffer *CVBufferRef;
+typedef CVBufferRef CVImageBufferRef;
+typedef CVImageBufferRef CVPixelBufferRef;
+typedef struct _CAImageQueue *CAImageQueueRef;
+typedef unsigned long CFTypeID;
+
+class WKCAImageQueue;
 
 void wkSetFontSmoothingLevel(int type);
 int wkGetFontSmoothingLevel();
@@ -89,4 +97,39 @@ CFURLCredentialRef wkCopyCredentialFromCFPersistentStorage(CFURLProtectionSpaceR
 
 CFStringRef wkCFNetworkErrorGetLocalizedDescription(CFIndex errorCode);
 
+
+enum wkCAImageQueueFlags {
+    kWKCAImageQueueAsync = 1U << 0,
+    kWKCAImageQueueFill = 1U << 1,
+    kWKCAImageQueueProtected = 1U << 2,
+    kWKCAImageQueueUseCleanAperture = 1U << 3,
+    kWKCAImageQueueUseAspectRatio = 1U << 4,
+    kWKCAImageQueueLowQualityColor = 1U << 5,
+};
+
+enum wkWKCAImageQueueImageType {
+    kWKCAImageQueueNil = 1,
+    kWKCAImageQueueSurface,
+    kWKCAImageQueueBuffer,
+    kWKCAImageQueueIOSurface,
+};
+
+enum wkWKCAImageQueueImageFlags {
+    kWKCAImageQueueOpaque = 1U << 0,
+    kWKCAImageQueueFlush = 1U << 1,
+    kWKCAImageQueueWillFlush = 1U << 2,
+    kWKCAImageQueueFlipped = 1U << 3,
+    kWKCAImageQueueWaitGPU = 1U << 4,
+};
+
+typedef void (*wkCAImageQueueReleaseCallback)(unsigned int type, uint64_t id, void *info);
+CAImageQueueRef wkCAImageQueueCreate(uint32_t width, uint32_t height, uint32_t capacity);
+void wkCAImageQueueInvalidate(CAImageQueueRef iq);
+size_t wkCAImageQueueCollect(CAImageQueueRef iq);
+bool wkCAImageQueueInsertImage(CAImageQueueRef iq, CFTimeInterval t, unsigned int type, uint64_t id, uint32_t flags, wkCAImageQueueReleaseCallback release, void *info);
+uint64_t wkCAImageQueueRegisterPixelBuffer(CAImageQueueRef iq, void *data, size_t data_size, size_t rowbytes, size_t width, size_t height, OSType pixel_format, CFDictionaryRef attachments, uint32_t flags);
+void wkCAImageQueueSetFlags(CAImageQueueRef iq, uint32_t mask, uint32_t flags);
+uint32_t wkCAImageQueueGetFlags(CAImageQueueRef iq);
+CFTypeID wkCAImageQueueGetTypeID(void);
+
 #endif // WebKitSystemInterface_h
index 4fcc36b..94a1d2d 100644 (file)
Binary files a/WebKitLibraries/win/lib/WebKitSystemInterface.lib and b/WebKitLibraries/win/lib/WebKitSystemInterface.lib differ
index 6d836db..3523d3f 100644 (file)
Binary files a/WebKitLibraries/win/lib/WebKitSystemInterface_debug.lib and b/WebKitLibraries/win/lib/WebKitSystemInterface_debug.lib differ