Enable GPU-GPU texture copy in texImage2D() for HTMLVideoElement if hardware accelera...
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 13 Mar 2013 01:47:39 +0000 (01:47 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 13 Mar 2013 01:47:39 +0000 (01:47 +0000)
commit158b376bcf1fd6aa31b000a4a364dd7bb09d5717
tree7032a2cfe341013ef0b6a5e09327df982f17ac8f
parent682a827bdfb7a8cd04c995fd78ca3f7d2c0d6ce4
Enable GPU-GPU texture copy in texImage2D() for HTMLVideoElement if hardware accelerated video decode is in use
https://bugs.webkit.org/show_bug.cgi?id=111126

Patch by Jun Jiang <jun.a.jiang@intel.com> on 2013-03-12
Reviewed by Kenneth Russell.

Source/WebCore:

In texImage2D() for HTMLVideoElement in WebGL, it is possible to do a GPU-GPU texture copy instead of CPU readback
and upload when videoFrame is in the form of textures. Each platform port needs to implement the interface
copyVideoTextureToPlatformTexture() defined in MediaPlayer.h to make it work.

Already covered by current tests.

* html/HTMLVideoElement.cpp:
(WebCore::HTMLVideoElement::copyVideoTextureToPlatformTexture):
* html/HTMLVideoElement.h:
(HTMLVideoElement):
* html/canvas/WebGLRenderingContext.cpp:
(WebCore::WebGLRenderingContext::videoFrameToImage): Move some security check to upper level.
(WebCore::WebGLRenderingContext::texImage2D): Add the fast GPU-GPU textures copy path for HTMLVideoElement and some security check.
(WebCore::WebGLRenderingContext::texSubImage2D): Add some security check.
* html/canvas/WebGLTexture.cpp:
(WebCore::WebGLTexture::isValid): Added to check if the texture is defined at the given level.
* html/canvas/WebGLTexture.h:
(WebGLTexture):
* platform/graphics/MediaPlayer.cpp:
(WebCore::MediaPlayer::copyVideoTextureToPlatformTexture): Added to do the GPU-GPU textures copy.
* platform/graphics/MediaPlayer.h:
(MediaPlayer):
* platform/graphics/MediaPlayerPrivate.h:
(WebCore::MediaPlayerPrivateInterface::copyVideoTextureToPlatformTexture):

Source/WebKit/chromium:

* public/WebMediaPlayer.h:
(WebKit::WebMediaPlayer::copyVideoTextureToPlatformTexture):
* src/WebMediaPlayerClientImpl.cpp:
(WebKit::WebMediaPlayerClientImpl::copyVideoTextureToPlatformTexture): do a GPU-GPU textures copy if possible.
* src/WebMediaPlayerClientImpl.h:
(WebMediaPlayerClientImpl):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@145669 268f45cc-cd09-0410-ab3c-d52691b4dbfc
13 files changed:
Source/WebCore/ChangeLog
Source/WebCore/html/HTMLVideoElement.cpp
Source/WebCore/html/HTMLVideoElement.h
Source/WebCore/html/canvas/WebGLRenderingContext.cpp
Source/WebCore/html/canvas/WebGLTexture.cpp
Source/WebCore/html/canvas/WebGLTexture.h
Source/WebCore/platform/graphics/MediaPlayer.cpp
Source/WebCore/platform/graphics/MediaPlayer.h
Source/WebCore/platform/graphics/MediaPlayerPrivate.h
Source/WebKit/chromium/ChangeLog
Source/WebKit/chromium/public/WebMediaPlayer.h
Source/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp
Source/WebKit/chromium/src/WebMediaPlayerClientImpl.h