diff options
author | emircan <emircan@chromium.org> | 2015-04-10 21:58:11 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-04-11 04:58:29 +0000 |
commit | f21bee9ba5dd7bc3b7eec2e7495164ab4e70c206 (patch) | |
tree | a02bb81ca24707e5ff47e612dcc84701138cd972 /gpu | |
parent | 16c0518fcc0d6cb8206fbc397ae3399172b0085f (diff) | |
download | chromium_src-f21bee9ba5dd7bc3b7eec2e7495164ab4e70c206.zip chromium_src-f21bee9ba5dd7bc3b7eec2e7495164ab4e70c206.tar.gz chromium_src-f21bee9ba5dd7bc3b7eec2e7495164ab4e70c206.tar.bz2 |
We started redesigning GpuMemoryBuffer interface to handle multiple buffers [0][1].
[0] https://codereview.chromium.org/1024113003
[1] https://codereview.chromium.org/1062853002
In this CL:
- I added new format GL_RGB_YUV_420_CHROMIUM
- I edited gpu/GLES2/extensions/CHROMIUM/CHROMIUM_*.txt files to include these new tokens.
The future steps are:
- Implement support for YUV_420 in GpuMemoryBufferFactoryOzoneNativeBuffer, GLImageLinuxDMABuffer and
SurfaceFactoryOzone
https://codereview.chromium.org/1072953002/
- Expose file descriptors for gfx::GpuMemoryBuffer::YUV_420 via Map() or GpuMemoryBufferHandle struct
- Add support in GLImageSharedMemory and GLImageMemory through Bind functions
- Look for possible use cases of multiple buffers on Android, Mac, and Win platforms
BUG=439520
TEST=content_unittests --gtest_filter=GpuMemoryBufferImplTests.*
Review URL: https://codereview.chromium.org/1062423002
Cr-Commit-Position: refs/heads/master@{#324773}
Diffstat (limited to 'gpu')
6 files changed, 70 insertions, 2 deletions
diff --git a/gpu/GLES2/extensions/CHROMIUM/CHROMIUM_yuv_420_image.txt b/gpu/GLES2/extensions/CHROMIUM/CHROMIUM_yuv_420_image.txt new file mode 100644 index 0000000..5a26516 --- /dev/null +++ b/gpu/GLES2/extensions/CHROMIUM/CHROMIUM_yuv_420_image.txt @@ -0,0 +1,48 @@ +Name + + CHROMIUM_yuv_420_image + +Name Strings + + GL_CHROMIUM_yuv_420_image + +Version + + Last Modifed Date: April 10, 2015 + +Dependencies + + OpenGL ES 2.0 is required. + + GL_CHROMIUM_image is required. + +Overview + + This extension provides a new internal image format to use when creating an + image from underlying I420 buffers with YUV components. + + This extension is useful in conjunction with CreateImageCHROMIUM and + CreateGpuMemoryBufferImageCHROMIUM to define the format of GpuMemoryBuffer + backing the image. + +New Procedures and Functions + + None. + +Errors + + None. + +New Tokens + + Accepted by the <internalformat> parameter of CreateImageCHROMIUM, and + <internalformat> parameter of CreateGpuMemoryBufferImageCHROMIUM: + GL_RGB_YUV_420_CHROMIUM 0x78FA + +New State + + None. + +Revision History + + 4/10/2015 Documented the extension diff --git a/gpu/GLES2/gl2extchromium.h b/gpu/GLES2/gl2extchromium.h index ec85bf2..415aa63b 100644 --- a/gpu/GLES2/gl2extchromium.h +++ b/gpu/GLES2/gl2extchromium.h @@ -136,6 +136,10 @@ typedef void ( #define GL_SCANOUT_CHROMIUM 0x78F2 #endif +#ifndef GL_RGB_YUV_420_CHROMIUM +#define GL_RGB_YUV_420_CHROMIUM 0x78FA +#endif + #ifdef GL_GLEXT_PROTOTYPES GL_APICALL GLuint GL_APIENTRY glCreateGpuMemoryBufferImageCHROMIUM( GLsizei width, diff --git a/gpu/command_buffer/build_gles2_cmd_buffer.py b/gpu/command_buffer/build_gles2_cmd_buffer.py index 0407033..1bac988 100755 --- a/gpu/command_buffer/build_gles2_cmd_buffer.py +++ b/gpu/command_buffer/build_gles2_cmd_buffer.py @@ -1478,6 +1478,7 @@ _NAMED_TYPE_INFO = { 'type': 'GLenum', 'valid': [ 'GL_RGB', + 'GL_RGB_YUV_420_CHROMIUM', 'GL_RGBA', ], }, diff --git a/gpu/command_buffer/common/gles2_cmd_utils_implementation_autogen.h b/gpu/command_buffer/common/gles2_cmd_utils_implementation_autogen.h index 42da99f..c2c6e8d 100644 --- a/gpu/command_buffer/common/gles2_cmd_utils_implementation_autogen.h +++ b/gpu/command_buffer/common/gles2_cmd_utils_implementation_autogen.h @@ -329,6 +329,10 @@ static const GLES2Util::EnumToString enum_to_string_table[] = { "GL_SYNC_OBJECT_APPLE", }, { + 0x78FB, + "GL_RGBA_YUV_420_CHROMIUM", + }, + { 0x8DF8, "GL_SHADER_BINARY_FORMATS", }, @@ -3765,6 +3769,10 @@ static const GLES2Util::EnumToString enum_to_string_table[] = { "GL_PIXEL_UNPACK_TRANSFER_BUFFER_CHROMIUM", }, { + 0x78FA, + "GL_RGB_YUV_420_CHROMIUM", + }, + { 0x00008000, "GL_COVERAGE_BUFFER_BIT_NV", }, @@ -4814,7 +4822,9 @@ std::string GLES2Util::GetStringHintTarget(uint32_t value) { std::string GLES2Util::GetStringImageInternalFormat(uint32_t value) { static const EnumToString string_table[] = { - {GL_RGB, "GL_RGB"}, {GL_RGBA, "GL_RGBA"}, + {GL_RGB, "GL_RGB"}, + {GL_RGB_YUV_420_CHROMIUM, "GL_RGB_YUV_420_CHROMIUM"}, + {GL_RGBA, "GL_RGBA"}, }; return GLES2Util::GetQualifiedEnumString(string_table, arraysize(string_table), value); diff --git a/gpu/command_buffer/service/gles2_cmd_validation_implementation_autogen.h b/gpu/command_buffer/service/gles2_cmd_validation_implementation_autogen.h index 22c5be7..dfa7a59 100644 --- a/gpu/command_buffer/service/gles2_cmd_validation_implementation_autogen.h +++ b/gpu/command_buffer/service/gles2_cmd_validation_implementation_autogen.h @@ -276,6 +276,7 @@ static const GLenum valid_hint_target_table[] = { static const GLenum valid_image_internal_format_table[] = { GL_RGB, + GL_RGB_YUV_420_CHROMIUM, GL_RGBA, }; diff --git a/gpu/command_buffer/service/image_factory.cc b/gpu/command_buffer/service/image_factory.cc index 74994ff..ce88f29 100644 --- a/gpu/command_buffer/service/image_factory.cc +++ b/gpu/command_buffer/service/image_factory.cc @@ -37,6 +37,8 @@ gfx::GpuMemoryBuffer::Format ImageFactory::ImageFormatToGpuMemoryBufferFormat( return gfx::GpuMemoryBuffer::DXT5; case GL_ETC1_RGB8_OES: return gfx::GpuMemoryBuffer::ETC1; + case GL_RGB_YUV_420_CHROMIUM: + return gfx::GpuMemoryBuffer::YUV_420; default: NOTREACHED(); return gfx::GpuMemoryBuffer::RGBA_8888; @@ -109,8 +111,10 @@ bool ImageFactory::IsImageSizeValidForGpuMemoryBufferFormat( case gfx::GpuMemoryBuffer::RGBA_8888: case gfx::GpuMemoryBuffer::BGRA_8888: case gfx::GpuMemoryBuffer::RGBX_8888: - case gfx::GpuMemoryBuffer::YUV_420: return true; + case gfx::GpuMemoryBuffer::YUV_420: + // U and V planes are subsampled by a factor of 2. + return size.width() % 2 == 0 && size.height() % 2 == 0; } NOTREACHED(); |