Title: [121249] trunk/Source/WebCore
Revision
121249
Author
[email protected]
Date
2012-06-26 03:17:44 -0700 (Tue, 26 Jun 2012)

Log Message

GraphicsSurface: Fix IOSurfaceLock failures on Intel video cards.
https://bugs.webkit.org/show_bug.cgi?id=89883

Reviewed by Noam Rosenthal.

Follow the documentation which says: "If locking the buffer requires a readback,
the lock will fail with an error return of kIOReturnCannotLock."
Also make sure that we use the same set of flags when locking and unlocking
for simplicity and to follow this requirement on the kIOSurfaceLockReadOnly flag.

* platform/graphics/surfaces/mac/GraphicsSurfaceMac.cpp:
(WebCore::GraphicsSurface::platformLock):
(WebCore::GraphicsSurface::platformUnlock):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (121248 => 121249)


--- trunk/Source/WebCore/ChangeLog	2012-06-26 10:16:05 UTC (rev 121248)
+++ trunk/Source/WebCore/ChangeLog	2012-06-26 10:17:44 UTC (rev 121249)
@@ -1,3 +1,19 @@
+2012-06-25  Jocelyn Turcotte  <[email protected]>
+
+        GraphicsSurface: Fix IOSurfaceLock failures on Intel video cards.
+        https://bugs.webkit.org/show_bug.cgi?id=89883
+
+        Reviewed by Noam Rosenthal.
+
+        Follow the documentation which says: "If locking the buffer requires a readback,
+        the lock will fail with an error return of kIOReturnCannotLock."
+        Also make sure that we use the same set of flags when locking and unlocking
+        for simplicity and to follow this requirement on the kIOSurfaceLockReadOnly flag.
+
+        * platform/graphics/surfaces/mac/GraphicsSurfaceMac.cpp:
+        (WebCore::GraphicsSurface::platformLock):
+        (WebCore::GraphicsSurface::platformUnlock):
+
 2012-06-26  Philip Rogers  <[email protected]>
 
         Fix setCurrentTime for paused animations

Modified: trunk/Source/WebCore/platform/graphics/surfaces/mac/GraphicsSurfaceMac.cpp (121248 => 121249)


--- trunk/Source/WebCore/platform/graphics/surfaces/mac/GraphicsSurfaceMac.cpp	2012-06-26 10:16:05 UTC (rev 121248)
+++ trunk/Source/WebCore/platform/graphics/surfaces/mac/GraphicsSurfaceMac.cpp	2012-06-26 10:17:44 UTC (rev 121249)
@@ -168,18 +168,14 @@
     return options;
 }
 
-static int ioSurfaceUnlockOptions(int lockOptions)
-{
-    int options = 0;
-    if (lockOptions & GraphicsSurface::ReadOnly)
-        options |= (kIOSurfaceLockAvoidSync | kIOSurfaceLockReadOnly);
-    return options;
-}
-
 char* GraphicsSurface::platformLock(const IntRect& rect, int* outputStride, LockOptions lockOptions)
 {
     m_lockOptions = lockOptions;
-    IOSurfaceLock(m_platformSurface, ioSurfaceLockOptions(m_lockOptions), 0);
+    IOReturn status = IOSurfaceLock(m_platformSurface, ioSurfaceLockOptions(m_lockOptions), 0);
+    if (status == kIOReturnCannotLock) {
+        m_lockOptions |= RetainPixels;
+        IOSurfaceLock(m_platformSurface, ioSurfaceLockOptions(m_lockOptions), 0);
+    }
 
     int stride = IOSurfaceGetBytesPerRow(m_platformSurface);
     if (outputStride)
@@ -191,7 +187,7 @@
 
 void GraphicsSurface::platformUnlock()
 {
-    IOSurfaceUnlock(m_platformSurface, ioSurfaceUnlockOptions(m_lockOptions) & (~kIOSurfaceLockAvoidSync), 0);
+    IOSurfaceUnlock(m_platformSurface, ioSurfaceLockOptions(m_lockOptions), 0);
 }
 
 void GraphicsSurface::platformDestroy()
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to