Skip to content
This repository has been archived by the owner on Apr 3, 2020. It is now read-only.

Commit

Permalink
Merge to M46 for BUG=510252
Browse files Browse the repository at this point in the history
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}
(cherry picked from commit a93c581)

Review URL: https://codereview.chromium.org/1319783009 .

Cr-Commit-Position: refs/branch-heads/2490@{#200}
Cr-Branched-From: 7790a35-refs/heads/master@{#344925}
  • Loading branch information
ccameron-chromium committed Sep 9, 2015

Verified

This commit was signed with the committer’s verified signature.
torkelrogstad Torkel Rogstad
1 parent 3ffaac7 commit 320e32b
Showing 13 changed files with 81 additions and 5 deletions.
48 changes: 48 additions & 0 deletions gpu/GLES2/extensions/CHROMIUM/CHROMIUM_ycbcr_422_image.txt
Original file line number Diff line number Diff line change
@@ -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
4 changes: 4 additions & 0 deletions gpu/GLES2/gl2extchromium.h
Original file line number Diff line number Diff line change
@@ -140,6 +140,10 @@ typedef void (
#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,
1 change: 1 addition & 0 deletions gpu/command_buffer/build_gles2_cmd_buffer.py
Original file line number Diff line number Diff line change
@@ -1862,6 +1862,7 @@
'valid': [
'GL_RGB',
'GL_RGB_YUV_420_CHROMIUM',
'GL_RGB_YCBCR_422_CHROMIUM',
'GL_RGBA',
],
},
4 changes: 2 additions & 2 deletions gpu/command_buffer/common/capabilities.cc
Original file line number Diff line number Diff line change
@@ -73,11 +73,11 @@ Capabilities::Capabilities()
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
1 change: 1 addition & 0 deletions gpu/command_buffer/common/capabilities.h
Original file line number Diff line number Diff line change
@@ -132,6 +132,7 @@ struct GPU_EXPORT Capabilities {
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;
Original file line number Diff line number Diff line change
@@ -252,6 +252,9 @@ static const GLES2Util::EnumToString enum_to_string_table[] = {
{
0x8A53, "GL_SYNC_OBJECT_APPLE",
},
{
0x78FB, "GL_RGB_YCBCR_422_CHROMIUM",
},
{
0x8DF8, "GL_SHADER_BINARY_FORMATS",
},
@@ -3919,6 +3922,7 @@ std::string GLES2Util::GetStringImageInternalFormat(uint32_t value) {
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,
9 changes: 7 additions & 2 deletions gpu/command_buffer/service/feature_info.cc
Original file line number Diff line number Diff line change
@@ -167,10 +167,10 @@ FeatureInfo::FeatureFlags::FeatureFlags()
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 @@ void FeatureInfo::InitializeFeatures() {
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

1 change: 1 addition & 0 deletions gpu/command_buffer/service/feature_info.h
Original file line number Diff line number Diff line change
@@ -79,6 +79,7 @@ class GPU_EXPORT FeatureInfo : public base::RefCounted<FeatureInfo> {
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;
6 changes: 6 additions & 0 deletions gpu/command_buffer/service/feature_info_unittest.cc
Original file line number Diff line number Diff line change
@@ -293,6 +293,7 @@ TEST_P(FeatureInfoTest, InitializeNoExtensions) {
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 @@ TEST_P(FeatureInfoTest, InitializeARB_texture_rgNoFloat) {
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
2 changes: 2 additions & 0 deletions gpu/command_buffer/service/gles2_cmd_decoder.cc
Original file line number Diff line number Diff line change
@@ -3198,6 +3198,8 @@ Capabilities GLES2DecoderImpl::GetCapabilities() {
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 =
Original file line number Diff line number Diff line change
@@ -363,7 +363,7 @@ static const GLenum valid_hint_target_table_es3[] = {
};

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[] = {
1 change: 1 addition & 0 deletions gpu/command_buffer/tests/gl_unittest.cc
Original file line number Diff line number Diff line change
@@ -106,6 +106,7 @@ TEST_F(GLTest, FeatureFlagsMatchCapabilities) {
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);
3 changes: 3 additions & 0 deletions ui/gl/gl_bindings.h
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 320e32b

Please sign in to comment.