Commit 59c7989e authored by aleksandar.stojiljkovic's avatar aleksandar.stojiljkovic Committed by Commit bot

Avoid doing and then abandoning semi-accelerated texImageHelperHTMLVideoElement path.

This resolves performance issue when uploading video to e.g. FLOAT or
UNSIGNED_SHORT textures.  If canUseCopyTextureCHROMIUM returns false, we
shouldn't create AcceleratedImageBufferSurface, call paintCurrentFrame and
texImage2DBase since they would not be used.  This is because imageBuffer->
copyToPlatformTexture is not supported when canUseCopyTextureCHROMIUM is false
and it would early return false.

BUG=624436
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_optional_gpu_tests_rel;master.tryserver.chromium.mac:mac_optional_gpu_tests_rel;master.tryserver.chromium.win:win_optional_gpu_tests_rel

Review-Url: https://codereview.chromium.org/2527343002
Cr-Commit-Position: refs/heads/master@{#434926}
parent c6214813
...@@ -5139,17 +5139,16 @@ void WebGLRenderingContextBase::texImageHelperHTMLVideoElement( ...@@ -5139,17 +5139,16 @@ void WebGLRenderingContextBase::texImageHelperHTMLVideoElement(
sourceImageRect == sentinelEmptyRect() || sourceImageRect == sentinelEmptyRect() ||
sourceImageRect == sourceImageRect ==
IntRect(0, 0, video->videoWidth(), video->videoHeight()); IntRect(0, 0, video->videoWidth(), video->videoHeight());
if (functionID == TexImage2D && sourceImageRectIsDefault && depth == 1) { if (functionID == TexImage2D && sourceImageRectIsDefault && depth == 1 &&
GL_TEXTURE_2D == target && Extensions3DUtil::canUseCopyTextureCHROMIUM(
target, internalformat, type, level)) {
DCHECK_EQ(xoffset, 0); DCHECK_EQ(xoffset, 0);
DCHECK_EQ(yoffset, 0); DCHECK_EQ(yoffset, 0);
DCHECK_EQ(zoffset, 0); DCHECK_EQ(zoffset, 0);
// Go through the fast path doing a GPU-GPU textures copy without a readback // Go through the fast path doing a GPU-GPU textures copy without a readback
// to system memory if possible. Otherwise, it will fall back to the normal // to system memory if possible. Otherwise, it will fall back to the normal
// SW path. // SW path.
if (GL_TEXTURE_2D == target) { if (video->copyVideoTextureToPlatformTexture(
if (Extensions3DUtil::canUseCopyTextureCHROMIUM(target, internalformat,
type, level) &&
video->copyVideoTextureToPlatformTexture(
contextGL(), texture->object(), internalformat, type, contextGL(), texture->object(), internalformat, type,
m_unpackPremultiplyAlpha, m_unpackFlipY)) { m_unpackPremultiplyAlpha, m_unpackFlipY)) {
return; return;
...@@ -5171,8 +5170,7 @@ void WebGLRenderingContextBase::texImageHelperHTMLVideoElement( ...@@ -5171,8 +5170,7 @@ void WebGLRenderingContextBase::texImageHelperHTMLVideoElement(
// may still do a CPU conversion and upload the results). // may still do a CPU conversion and upload the results).
video->paintCurrentFrame( video->paintCurrentFrame(
imageBuffer->canvas(), imageBuffer->canvas(),
IntRect(0, 0, video->videoWidth(), video->videoHeight()), IntRect(0, 0, video->videoWidth(), video->videoHeight()), nullptr);
nullptr);
// This is a straight GPU-GPU copy, any necessary color space // This is a straight GPU-GPU copy, any necessary color space
// conversion was handled in the paintCurrentFrameInContext() call. // conversion was handled in the paintCurrentFrameInContext() call.
...@@ -5191,7 +5189,6 @@ void WebGLRenderingContextBase::texImageHelperHTMLVideoElement( ...@@ -5191,7 +5189,6 @@ void WebGLRenderingContextBase::texImageHelperHTMLVideoElement(
} }
} }
} }
}
RefPtr<Image> image = videoFrameToImage(video); RefPtr<Image> image = videoFrameToImage(video);
if (!image) if (!image)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment