Title: [295174] branches/safari-613-branch

Diff

Modified: branches/safari-613-branch/Source/WTF/ChangeLog (295173 => 295174)


--- branches/safari-613-branch/Source/WTF/ChangeLog	2022-06-03 06:44:58 UTC (rev 295173)
+++ branches/safari-613-branch/Source/WTF/ChangeLog	2022-06-03 06:45:01 UTC (rev 295174)
@@ -26,6 +26,34 @@
         (WTF::WorkQueue::assertIsCurrent):
         (WTF::currentSequenceID):
 
+2022-04-22  Kimmo Kinnunen  <[email protected]>
+
+        Thread safety analysis to assert "code is run sequentially" is not useful when code is mainly run with WorkQueues
+        https://bugs.webkit.org/show_bug.cgi?id=236832
+
+        Thread safety analysis is not useful when code is mainly run with WorkQueues.
+        WorkQueue runnables might run in arbitrary thread, but still serially in a specific
+        "work queue". Thus current ThreadAssertion produces false assertions.
+
+        Make Thread and WorkQueue hold "is current" capability. This means the
+        `assertIsCurrent(thread/workQueue)` can establish that the caller holds the capabity,
+        e.g. that the caller is running in the particular thread or work queue.
+
+        Tested by new API tests.
+
+        * wtf/Threading.h:
+        (WTF::WTF_ASSERTS_ACQUIRED_CAPABILITY):
+        * wtf/WorkQueue.h:
+        (WTF::WTF_ASSERTS_ACQUIRED_CAPABILITY):
+        * wtf/cocoa/WorkQueueCocoa.cpp:
+        (WTF::WorkQueueBase::platformInitialize):
+        (WTF::WorkQueue::assertIsCurrent const):
+        (WTF::currentSequenceID):
+        * wtf/generic/WorkQueueGeneric.cpp:
+        (WTF::WorkQueueBase::platformInitialize):
+        (WTF::WorkQueue::assertIsCurrent):
+        (WTF::currentSequenceID):
+
 2022-04-19  Alan Coon  <[email protected]>
 
         Cherry-pick r289531. rdar://problem/88023949

Modified: branches/safari-613-branch/Source/WebKit/ChangeLog (295173 => 295174)


--- branches/safari-613-branch/Source/WebKit/ChangeLog	2022-06-03 06:44:58 UTC (rev 295173)
+++ branches/safari-613-branch/Source/WebKit/ChangeLog	2022-06-03 06:45:01 UTC (rev 295174)
@@ -1,5 +1,301 @@
 2022-04-22  Kimmo Kinnunen  <[email protected]>
 
+        Thread safety analysis to assert "code is run sequentially" is not useful when code is mainly run with WorkQueues
+        https://bugs.webkit.org/show_bug.cgi?id=236832
+
+        Assert directly that the work queues are current instead of using ThreadAssertion.
+
+        * GPUProcess/graphics/RemoteGraphicsContextGL.cpp:
+        (WebKit::RemoteGraphicsContextGL::~RemoteGraphicsContextGL):
+        (WebKit::RemoteGraphicsContextGL::displayWasReconfigured):
+        (WebKit::RemoteGraphicsContextGL::workQueueInitialize):
+        (WebKit::RemoteGraphicsContextGL::workQueueUninitialize):
+        (WebKit::RemoteGraphicsContextGL::didComposite):
+        (WebKit::RemoteGraphicsContextGL::forceContextLost):
+        (WebKit::RemoteGraphicsContextGL::dispatchContextChangedNotification):
+        (WebKit::RemoteGraphicsContextGL::reshape):
+        (WebKit::RemoteGraphicsContextGL::prepareForDisplay):
+        (WebKit::RemoteGraphicsContextGL::synthesizeGLError):
+        (WebKit::RemoteGraphicsContextGL::getError):
+        (WebKit::RemoteGraphicsContextGL::ensureExtensionEnabled):
+        (WebKit::RemoteGraphicsContextGL::markContextChanged):
+        (WebKit::RemoteGraphicsContextGL::paintRenderingResultsToCanvasWithQualifiedIdentifier):
+        (WebKit::RemoteGraphicsContextGL::paintCompositedResultsToCanvasWithQualifiedIdentifier):
+        (WebKit::RemoteGraphicsContextGL::paintCompositedResultsToMediaSample):
+        (WebKit::RemoteGraphicsContextGL::paintPixelBufferToImageBuffer):
+        (WebKit::RemoteGraphicsContextGL::simulateEventForTesting):
+        * GPUProcess/graphics/RemoteGraphicsContextGL.h:
+        (WebKit::RemoteGraphicsContextGL::workQueue const):
+        * GPUProcess/graphics/RemoteGraphicsContextGL.messages.in:
+        * GPUProcess/graphics/RemoteGraphicsContextGLCocoa.cpp:
+        (WebKit::RemoteGraphicsContextGL::copyTextureFromVideoFrame):
+        (WebKit::RemoteGraphicsContextGLCocoa::platformWorkQueueInitialize):
+        (WebKit::RemoteGraphicsContextGLCocoa::prepareForDisplay):
+        * GPUProcess/graphics/RemoteGraphicsContextGLFunctionsGenerated.h:
+        (moveErrorsToSyntheticErrorList):
+        (activeTexture):
+        (attachShader):
+        (bindAttribLocation):
+        (bindBuffer):
+        (bindFramebuffer):
+        (bindRenderbuffer):
+        (bindTexture):
+        (blendColor):
+        (blendEquation):
+        (blendEquationSeparate):
+        (blendFunc):
+        (blendFuncSeparate):
+        (checkFramebufferStatus):
+        (clear):
+        (clearColor):
+        (clearDepth):
+        (clearStencil):
+        (colorMask):
+        (compileShader):
+        (copyTexImage2D):
+        (copyTexSubImage2D):
+        (createBuffer):
+        (createFramebuffer):
+        (createProgram):
+        (createRenderbuffer):
+        (createShader):
+        (createTexture):
+        (cullFace):
+        (deleteBuffer):
+        (deleteFramebuffer):
+        (deleteProgram):
+        (deleteRenderbuffer):
+        (deleteShader):
+        (deleteTexture):
+        (depthFunc):
+        (depthMask):
+        (depthRange):
+        (detachShader):
+        (disable):
+        (disableVertexAttribArray):
+        (drawArrays):
+        (drawElements):
+        (enable):
+        (enableVertexAttribArray):
+        (finish):
+        (flush):
+        (framebufferRenderbuffer):
+        (framebufferTexture2D):
+        (frontFace):
+        (generateMipmap):
+        (getActiveAttrib):
+        (getActiveUniform):
+        (getAttribLocation):
+        (getBufferParameteri):
+        (getString):
+        (getFloatv):
+        (getIntegerv):
+        (getInteger64):
+        (getInteger64i):
+        (getProgrami):
+        (getBooleanv):
+        (getFramebufferAttachmentParameteri):
+        (getProgramInfoLog):
+        (getRenderbufferParameteri):
+        (getShaderi):
+        (getShaderInfoLog):
+        (getShaderPrecisionFormat):
+        (getShaderSource):
+        (getTexParameterf):
+        (getTexParameteri):
+        (getUniformfv):
+        (getUniformiv):
+        (getUniformuiv):
+        (getUniformLocation):
+        (getVertexAttribOffset):
+        (hint):
+        (isBuffer):
+        (isEnabled):
+        (isFramebuffer):
+        (isProgram):
+        (isRenderbuffer):
+        (isShader):
+        (isTexture):
+        (lineWidth):
+        (linkProgram):
+        (pixelStorei):
+        (polygonOffset):
+        (renderbufferStorage):
+        (sampleCoverage):
+        (scissor):
+        (shaderSource):
+        (stencilFunc):
+        (stencilFuncSeparate):
+        (stencilMask):
+        (stencilMaskSeparate):
+        (stencilOp):
+        (stencilOpSeparate):
+        (texParameterf):
+        (texParameteri):
+        (uniform1f):
+        (uniform1fv):
+        (uniform1i):
+        (uniform1iv):
+        (uniform2f):
+        (uniform2fv):
+        (uniform2i):
+        (uniform2iv):
+        (uniform3f):
+        (uniform3fv):
+        (uniform3i):
+        (uniform3iv):
+        (uniform4f):
+        (uniform4fv):
+        (uniform4i):
+        (uniform4iv):
+        (uniformMatrix2fv):
+        (uniformMatrix3fv):
+        (uniformMatrix4fv):
+        (useProgram):
+        (validateProgram):
+        (vertexAttrib1f):
+        (vertexAttrib1fv):
+        (vertexAttrib2f):
+        (vertexAttrib2fv):
+        (vertexAttrib3f):
+        (vertexAttrib3fv):
+        (vertexAttrib4f):
+        (vertexAttrib4fv):
+        (vertexAttribPointer):
+        (viewport):
+        (bufferData0):
+        (bufferData1):
+        (bufferSubData):
+        (readnPixels0):
+        (readnPixels1):
+        (texImage2D0):
+        (texImage2D1):
+        (texSubImage2D0):
+        (texSubImage2D1):
+        (compressedTexImage2D0):
+        (compressedTexImage2D1):
+        (compressedTexSubImage2D0):
+        (compressedTexSubImage2D1):
+        (drawArraysInstanced):
+        (drawElementsInstanced):
+        (vertexAttribDivisor):
+        (createVertexArray):
+        (deleteVertexArray):
+        (isVertexArray):
+        (bindVertexArray):
+        (copyBufferSubData):
+        (getBufferSubData):
+        (blitFramebuffer):
+        (framebufferTextureLayer):
+        (invalidateFramebuffer):
+        (invalidateSubFramebuffer):
+        (readBuffer):
+        (renderbufferStorageMultisample):
+        (texStorage2D):
+        (texStorage3D):
+        (texImage3D0):
+        (texImage3D1):
+        (texSubImage3D0):
+        (texSubImage3D1):
+        (copyTexSubImage3D):
+        (compressedTexImage3D0):
+        (compressedTexImage3D1):
+        (compressedTexSubImage3D0):
+        (compressedTexSubImage3D1):
+        (getFragDataLocation):
+        (uniform1ui):
+        (uniform2ui):
+        (uniform3ui):
+        (uniform4ui):
+        (uniform1uiv):
+        (uniform2uiv):
+        (uniform3uiv):
+        (uniform4uiv):
+        (uniformMatrix2x3fv):
+        (uniformMatrix3x2fv):
+        (uniformMatrix2x4fv):
+        (uniformMatrix4x2fv):
+        (uniformMatrix3x4fv):
+        (uniformMatrix4x3fv):
+        (vertexAttribI4i):
+        (vertexAttribI4iv):
+        (vertexAttribI4ui):
+        (vertexAttribI4uiv):
+        (vertexAttribIPointer):
+        (drawRangeElements):
+        (drawBuffers):
+        (clearBufferiv):
+        (clearBufferuiv):
+        (clearBufferfv):
+        (clearBufferfi):
+        (createQuery):
+        (deleteQuery):
+        (isQuery):
+        (beginQuery):
+        (endQuery):
+        (getQuery):
+        (getQueryObjectui):
+        (createSampler):
+        (deleteSampler):
+        (isSampler):
+        (bindSampler):
+        (samplerParameteri):
+        (samplerParameterf):
+        (getSamplerParameterf):
+        (getSamplerParameteri):
+        (fenceSync):
+        (isSync):
+        (deleteSync):
+        (clientWaitSync):
+        (waitSync):
+        (getSynci):
+        (createTransformFeedback):
+        (deleteTransformFeedback):
+        (isTransformFeedback):
+        (bindTransformFeedback):
+        (beginTransformFeedback):
+        (endTransformFeedback):
+        (transformFeedbackVaryings):
+        (getTransformFeedbackVarying):
+        (pauseTransformFeedback):
+        (resumeTransformFeedback):
+        (bindBufferBase):
+        (bindBufferRange):
+        (getUniformIndices):
+        (getActiveUniforms):
+        (getUniformBlockIndex):
+        (getActiveUniformBlockName):
+        (uniformBlockBinding):
+        (getActiveUniformBlockiv):
+        (getGraphicsResetStatusARB):
+        (getTranslatedShaderSourceANGLE):
+        (drawBuffersEXT):
+        (getInternalformativ):
+        (multiDrawArraysANGLE):
+        (multiDrawArraysInstancedANGLE):
+        (multiDrawElementsANGLE):
+        (multiDrawElementsInstancedANGLE):
+        (paintRenderingResultsToPixelBuffer):
+        * GPUProcess/graphics/WebGPU/RemoteGPU.cpp:
+        (WebKit::RemoteGPU::RemoteGPU):
+        (WebKit::RemoteGPU::initialize):
+        (WebKit::RemoteGPU::stopListeningForIPC):
+        (WebKit::RemoteGPU::workQueueInitialize):
+        (WebKit::RemoteGPU::workQueueUninitialize):
+        (WebKit::RemoteGPU::requestAdapter):
+        * GPUProcess/graphics/WebGPU/RemoteGPU.h:
+        * GPUProcess/media/RemoteVideoFrameObjectHeap.cpp:
+        (WebKit::RemoteVideoFrameObjectHeap::~RemoteVideoFrameObjectHeap):
+        (WebKit::RemoteVideoFrameObjectHeap::stopListeningForIPC):
+        (WebKit::RemoteVideoFrameObjectHeap::releaseVideoFrame):
+        * GPUProcess/media/RemoteVideoFrameObjectHeap.h:
+        * Platform/IPC/StreamConnectionWorkQueue.cpp:
+        (IPC::StreamConnectionWorkQueue::assertIsCurrent const):
+        * Platform/IPC/StreamConnectionWorkQueue.h:
+        (IPC::WTF_ASSERTS_ACQUIRED_CAPABILITY):
+
+2022-04-22  Kimmo Kinnunen  <[email protected]>
+
         Multiple concurrency violations in LibWebRTCCodecsProxy
         https://bugs.webkit.org/show_bug.cgi?id=236767
         <rdar://88904160>

Modified: branches/safari-613-branch/Source/WebKit/GPUProcess/graphics/WebGPU/RemoteGPU.h (295173 => 295174)


--- branches/safari-613-branch/Source/WebKit/GPUProcess/graphics/WebGPU/RemoteGPU.h	2022-06-03 06:44:58 UTC (rev 295173)
+++ branches/safari-613-branch/Source/WebKit/GPUProcess/graphics/WebGPU/RemoteGPU.h	2022-06-03 06:45:01 UTC (rev 295174)
@@ -139,8 +139,8 @@
     WeakPtr<GPUConnectionToWebProcess> m_gpuConnectionToWebProcess;
     Ref<IPC::StreamConnectionWorkQueue> m_workQueue;
     RefPtr<IPC::StreamServerConnection> m_streamConnection;
-    RefPtr<PAL::WebGPU::GPU> m_backing WTF_GUARDED_BY_LOCK(workQueue());
-    Ref<WebGPU::ObjectHeap> m_objectHeap WTF_GUARDED_BY_LOCK(workQueue());
+    RefPtr<PAL::WebGPU::GPU> m_backing WTF_GUARDED_BY_CAPABILITY(workQueue());
+    Ref<WebGPU::ObjectHeap> m_objectHeap WTF_GUARDED_BY_CAPABILITY(workQueue());
     const WebGPUIdentifier m_identifier;
     Ref<RemoteRenderingBackend> m_renderingBackend;
     const WebCore::ProcessIdentifier m_webProcessIdentifier;

Modified: branches/safari-613-branch/Tools/ChangeLog (295173 => 295174)


--- branches/safari-613-branch/Tools/ChangeLog	2022-06-03 06:44:58 UTC (rev 295173)
+++ branches/safari-613-branch/Tools/ChangeLog	2022-06-03 06:45:01 UTC (rev 295174)
@@ -15,6 +15,23 @@
         * TestWebKitAPI/Tests/WTF/WorkQueue.cpp:
         (TestWebKitAPI::TEST):
 
+2022-04-22  Kimmo Kinnunen  <[email protected]>
+
+        Thread safety analysis to assert "code is run sequentially" is not useful when code is mainly run with WorkQueues
+        https://bugs.webkit.org/show_bug.cgi?id=236832
+
+        Test the added functionality to be able to use assertIsCurrent(thread/workQueue).
+
+        Fix WTF_WorkQueue.DestroyDispatchedOnDispatchQueue test, it is now able to make the assertion correctly.
+        - The object is created somewhere that is not the tested WorkQueue
+        - The object is destroyed in the tested WorkQueue
+
+        * Scripts/generate-gpup-webgl:
+        * TestWebKitAPI/Tests/WTF/Threading.cpp:
+        (TestWebKitAPI::TEST):
+        * TestWebKitAPI/Tests/WTF/WorkQueue.cpp:
+        (TestWebKitAPI::TEST):
+
 2022-04-22  Alan Coon  <[email protected]>
 
         Cherry-pick r292274. rdar://problem/80544133
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to