summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-03-01 02:10:47 +0000
committerananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-03-01 02:10:47 +0000
commit27cc600813dc8535a84359eec1a35aa5aa406b16 (patch)
tree19a0f33f627b8ffabf152e2c2643a61526583269
parenta0f6ca0319e1c7c0536ecff28369eae248159d8a (diff)
downloadchromium_src-27cc600813dc8535a84359eec1a35aa5aa406b16.zip
chromium_src-27cc600813dc8535a84359eec1a35aa5aa406b16.tar.gz
chromium_src-27cc600813dc8535a84359eec1a35aa5aa406b16.tar.bz2
Get DXVA working with Angle using Direct3D11.
This currently fails when we attempt to retrieve the shared decoding surface from ANGLE which is eventually used to copy textures from DXVA to ANGLE. Reason for failure is Direct3D11 does not support the EGL_TEXTURE_RGB attribute causing the eglCreatePbufferSurface function to fail. Fix based on a discussion with jbauman is to use the eglGetConfigAttrib function to check if the EGL_BIND_TO_TEXTURE_RGB attribute is supported. If not we use the EGL_TEXTURE_RGBA config attribute. BUG=330271 R=jbauman@chromium.org, jbauman Review URL: https://codereview.chromium.org/181843006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@254322 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--content/common/gpu/media/dxva_video_decode_accelerator.cc18
1 files changed, 14 insertions, 4 deletions
diff --git a/content/common/gpu/media/dxva_video_decode_accelerator.cc b/content/common/gpu/media/dxva_video_decode_accelerator.cc
index 4e3c673..32beb80 100644
--- a/content/common/gpu/media/dxva_video_decode_accelerator.cc
+++ b/content/common/gpu/media/dxva_video_decode_accelerator.cc
@@ -194,6 +194,9 @@ struct DXVAVideoDecodeAccelerator::DXVAPictureBuffer {
media::PictureBuffer picture_buffer_;
EGLSurface decoding_surface_;
base::win::ScopedComPtr<IDirect3DTexture9> decoding_texture_;
+ // Set to true if RGB is supported by the texture.
+ // Defaults to true.
+ bool use_rgb_;
DISALLOW_COPY_AND_ASSIGN(DXVAPictureBuffer);
};
@@ -208,10 +211,14 @@ DXVAVideoDecodeAccelerator::DXVAPictureBuffer::Create(
EGLDisplay egl_display = gfx::GLSurfaceEGL::GetHardwareDisplay();
+ EGLint use_rgb = 1;
+ eglGetConfigAttrib(egl_display, egl_config, EGL_BIND_TO_TEXTURE_RGB,
+ &use_rgb);
+
EGLint attrib_list[] = {
EGL_WIDTH, buffer.size().width(),
EGL_HEIGHT, buffer.size().height(),
- EGL_TEXTURE_FORMAT, EGL_TEXTURE_RGB,
+ EGL_TEXTURE_FORMAT, use_rgb ? EGL_TEXTURE_RGB : EGL_TEXTURE_RGBA,
EGL_TEXTURE_TARGET, EGL_TEXTURE_2D,
EGL_NONE
};
@@ -240,13 +247,14 @@ DXVAVideoDecodeAccelerator::DXVAPictureBuffer::Create(
buffer.size().height(),
1,
D3DUSAGE_RENDERTARGET,
- D3DFMT_X8R8G8B8,
+ use_rgb ? D3DFMT_X8R8G8B8 : D3DFMT_A8R8G8B8,
D3DPOOL_DEFAULT,
picture_buffer->decoding_texture_.Receive(),
&share_handle);
RETURN_ON_HR_FAILURE(hr, "Failed to create texture",
linked_ptr<DXVAPictureBuffer>(NULL));
+ picture_buffer->use_rgb_ = !!use_rgb;
return picture_buffer;
}
@@ -254,7 +262,8 @@ DXVAVideoDecodeAccelerator::DXVAPictureBuffer::DXVAPictureBuffer(
const media::PictureBuffer& buffer)
: available_(true),
picture_buffer_(buffer),
- decoding_surface_(NULL) {
+ decoding_surface_(NULL),
+ use_rgb_(true) {
}
DXVAVideoDecodeAccelerator::DXVAPictureBuffer::~DXVAPictureBuffer() {
@@ -303,7 +312,8 @@ bool DXVAVideoDecodeAccelerator::DXVAPictureBuffer::
}
hr = decoder.d3d9_->CheckDeviceFormatConversion(
- D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, surface_desc.Format, D3DFMT_X8R8G8B8);
+ D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, surface_desc.Format,
+ use_rgb_ ? D3DFMT_X8R8G8B8 : D3DFMT_A8R8G8B8);
RETURN_ON_HR_FAILURE(hr, "Device does not support format converision", false);
// This function currently executes in the context of IPC handlers in the