Add CHROMIUM_ycbcr_422_image extension.
Add an extension that provides a method for GL to process images that
are defined in '2vuy' video format.
GL_YCRCR_422_CHROMIUM <internalformat> as been added and it is an accepted
value when creating an image if the extension is supported.
This extension maps to GL_APPLE_ycbcr_422 and will allow us to determine if
we can use IOSurfaces with that format.
BUG=524582
Review URL: https://codereview.chromium.org/1305153005
Cr-Commit-Position: refs/heads/master@{#345693}
diff --git a/gpu/GLES2/extensions/CHROMIUM/CHROMIUM_ycbcr_422_image.txt b/gpu/GLES2/extensions/CHROMIUM/CHROMIUM_ycbcr_422_image.txt
new file mode 100644
index 0000000..546d783
--- /dev/null
+++ b/gpu/GLES2/extensions/CHROMIUM/CHROMIUM_ycbcr_422_image.txt
@@ -0,0 +1,48 @@
+Name
+
+ CHROMIUM_ycbcr_422_image
+
+Name Strings
+
+ GL_CHROMIUM_ycbcr_422_image
+
+Version
+
+ Last Modifed Date: August 26, 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 '2vuy' buffers.
+
+ 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_YCBCR_422_CHROMIUM 0x78FB
+
+New State
+
+ None.
+
+Revision History
+
+ 8/26/2015 Documented the extension
diff --git a/gpu/GLES2/gl2extchromium.h b/gpu/GLES2/gl2extchromium.h
index 584d29a..77f0d9f 100644
--- a/gpu/GLES2/gl2extchromium.h
+++ b/gpu/GLES2/gl2extchromium.h
@@ -140,6 +140,10 @@
#define GL_RGB_YUV_420_CHROMIUM 0x78FA
#endif
+#ifndef GL_RGB_YCBCR_422_CHROMIUM
+#define GL_RGB_YCBCR_422_CHROMIUM 0x78FB
+#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 79629552..f23f79b 100755
--- a/gpu/command_buffer/build_gles2_cmd_buffer.py
+++ b/gpu/command_buffer/build_gles2_cmd_buffer.py
@@ -1862,6 +1862,7 @@
'valid': [
'GL_RGB',
'GL_RGB_YUV_420_CHROMIUM',
+ 'GL_RGB_YCBCR_422_CHROMIUM',
'GL_RGBA',
],
},
diff --git a/gpu/command_buffer/common/capabilities.cc b/gpu/command_buffer/common/capabilities.cc
index d0ac492..e677b143 100644
--- a/gpu/command_buffer/common/capabilities.cc
+++ b/gpu/command_buffer/common/capabilities.cc
@@ -73,11 +73,11 @@
blend_equation_advanced(false),
blend_equation_advanced_coherent(false),
texture_rg(false),
+ image_ycbcr_422(false),
render_buffer_format_bgra8888(false),
occlusion_query_boolean(false),
surfaceless(false),
major_version(2),
- minor_version(0) {
-}
+ minor_version(0) {}
} // namespace gpu
diff --git a/gpu/command_buffer/common/capabilities.h b/gpu/command_buffer/common/capabilities.h
index dd08875..17b6cfe 100644
--- a/gpu/command_buffer/common/capabilities.h
+++ b/gpu/command_buffer/common/capabilities.h
@@ -132,6 +132,7 @@
bool blend_equation_advanced;
bool blend_equation_advanced_coherent;
bool texture_rg;
+ bool image_ycbcr_422;
bool render_buffer_format_bgra8888;
bool occlusion_query_boolean;
bool timer_queries;
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 0196461..138a8896 100644
--- a/gpu/command_buffer/common/gles2_cmd_utils_implementation_autogen.h
+++ b/gpu/command_buffer/common/gles2_cmd_utils_implementation_autogen.h
@@ -253,6 +253,9 @@
0x8A53, "GL_SYNC_OBJECT_APPLE",
},
{
+ 0x78FB, "GL_RGB_YCBCR_422_CHROMIUM",
+ },
+ {
0x8DF8, "GL_SHADER_BINARY_FORMATS",
},
{
@@ -3919,6 +3922,7 @@
static const EnumToString string_table[] = {
{GL_RGB, "GL_RGB"},
{GL_RGB_YUV_420_CHROMIUM, "GL_RGB_YUV_420_CHROMIUM"},
+ {GL_RGB_YCBCR_422_CHROMIUM, "GL_RGB_YCBCR_422_CHROMIUM"},
{GL_RGBA, "GL_RGBA"},
};
return GLES2Util::GetQualifiedEnumString(string_table,
diff --git a/gpu/command_buffer/service/feature_info.cc b/gpu/command_buffer/service/feature_info.cc
index b1e92e6..02b5835 100644
--- a/gpu/command_buffer/service/feature_info.cc
+++ b/gpu/command_buffer/service/feature_info.cc
@@ -167,10 +167,10 @@
blend_equation_advanced(false),
blend_equation_advanced_coherent(false),
ext_texture_rg(false),
+ chromium_image_ycbcr_422(false),
enable_subscribe_uniform(false),
emulate_primitive_restart_fixed_index(false),
- ext_render_buffer_format_bgra8888(false) {
-}
+ ext_render_buffer_format_bgra8888(false) {}
FeatureInfo::Workarounds::Workarounds() :
#define GPU_OP(type, name) name(false),
@@ -790,6 +790,11 @@
AddExtensionString("GL_CHROMIUM_iosurface");
#endif
+ if (extensions.Contains("GL_APPLE_ycbcr_422")) {
+ AddExtensionString("GL_CHROMIUM_ycbcr_422_image");
+ feature_flags_.chromium_image_ycbcr_422 = true;
+ }
+
// TODO(gman): Add support for these extensions.
// GL_OES_depth32
diff --git a/gpu/command_buffer/service/feature_info.h b/gpu/command_buffer/service/feature_info.h
index 4a55c95..3970b2f6 100644
--- a/gpu/command_buffer/service/feature_info.h
+++ b/gpu/command_buffer/service/feature_info.h
@@ -79,6 +79,7 @@
bool blend_equation_advanced;
bool blend_equation_advanced_coherent;
bool ext_texture_rg;
+ bool chromium_image_ycbcr_422;
bool enable_subscribe_uniform;
bool emulate_primitive_restart_fixed_index;
bool ext_render_buffer_format_bgra8888;
diff --git a/gpu/command_buffer/service/feature_info_unittest.cc b/gpu/command_buffer/service/feature_info_unittest.cc
index be78a044..47a19998 100644
--- a/gpu/command_buffer/service/feature_info_unittest.cc
+++ b/gpu/command_buffer/service/feature_info_unittest.cc
@@ -293,6 +293,7 @@
GL_SRGB8_ALPHA8_EXT));
EXPECT_FALSE(info_->validators()->frame_buffer_parameter.IsValid(
GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT));
+ EXPECT_FALSE(info_->feature_flags().chromium_image_ycbcr_422);
}
TEST_P(FeatureInfoTest, InitializeWithANGLE) {
@@ -1363,5 +1364,10 @@
EXPECT_TRUE(info_->validators()->render_buffer_format.IsValid(GL_RG8_EXT));
}
+TEST_P(FeatureInfoTest, InitializeCHROMIUM_ycbcr_422_imageTrue) {
+ SetupInitExpectations("GL_APPLE_ycbcr_422");
+ EXPECT_TRUE(info_->feature_flags().chromium_image_ycbcr_422);
+}
+
} // namespace gles2
} // namespace gpu
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.cc b/gpu/command_buffer/service/gles2_cmd_decoder.cc
index 3132b4d..74f3401 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder.cc
+++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc
@@ -3198,6 +3198,8 @@
caps.blend_equation_advanced_coherent =
feature_info_->feature_flags().blend_equation_advanced_coherent;
caps.texture_rg = feature_info_->feature_flags().ext_texture_rg;
+ caps.image_ycbcr_422 =
+ feature_info_->feature_flags().chromium_image_ycbcr_422;
caps.max_copy_texture_chromium_size =
feature_info_->workarounds().max_copy_texture_chromium_size;
caps.render_buffer_format_bgra8888 =
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 958e67a0..bd1605d 100644
--- a/gpu/command_buffer/service/gles2_cmd_validation_implementation_autogen.h
+++ b/gpu/command_buffer/service/gles2_cmd_validation_implementation_autogen.h
@@ -363,7 +363,7 @@
};
static const GLenum valid_image_internal_format_table[] = {
- GL_RGB, GL_RGB_YUV_420_CHROMIUM, GL_RGBA,
+ GL_RGB, GL_RGB_YUV_420_CHROMIUM, GL_RGB_YCBCR_422_CHROMIUM, GL_RGBA,
};
static const GLenum valid_image_usage_table[] = {
diff --git a/gpu/command_buffer/tests/gl_unittest.cc b/gpu/command_buffer/tests/gl_unittest.cc
index 1df56c0..165d3b1 100644
--- a/gpu/command_buffer/tests/gl_unittest.cc
+++ b/gpu/command_buffer/tests/gl_unittest.cc
@@ -106,6 +106,7 @@
EXPECT_EQ(caps.blend_equation_advanced_coherent,
flags.blend_equation_advanced_coherent);
EXPECT_EQ(caps.texture_rg, flags.ext_texture_rg);
+ EXPECT_EQ(caps.image_ycbcr_422, flags.chromium_image_ycbcr_422);
EXPECT_EQ(caps.render_buffer_format_bgra8888,
flags.ext_render_buffer_format_bgra8888);
EXPECT_EQ(caps.occlusion_query_boolean, flags.occlusion_query_boolean);
diff --git a/ui/gl/gl_bindings.h b/ui/gl/gl_bindings.h
index 983ba7f..cbd224ae 100644
--- a/ui/gl/gl_bindings.h
+++ b/ui/gl/gl_bindings.h
@@ -139,6 +139,9 @@
// GL_CHROMIUM_yuv_420_image
#define GL_RGB_YUV_420_CHROMIUM 0x78FA
+// GL_CHROMIUM_ycbcr_422_image
+#define GL_RGB_YCBCR_422_CHROMIUM 0x78FB
+
// GL_CHROMIUM_schedule_overlay_plane
#define GL_OVERLAY_TRANSFORM_NONE_CHROMIUM 0x9245
#define GL_OVERLAY_TRANSFORM_FLIP_HORIZONTAL_CHROMIUM 0x9246