New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 911918 link

Starred by 5 users

Issue metadata

Status: Fixed
Owner:
OOO until 2019-01-24
Closed: Dec 11
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Mac
Pri: 1
Type: Bug

Blocking:
issue 913751
issue 913033
issue 905008



Sign in to add a comment

ColorMask is destroyed during implicit clears

Project Member Reported by kbr@chromium.org, Dec 5

Issue description

Chrome Version: (approximately ToT)
Chromium	72.0.3625.0 (Developer Build) (64-bit)
Revision	1bcdee9ce968577c851bd4459fff3cad94b7097a-refs/heads/master@{#611959}

OS: macOS 10.14.1
MacBook Pro (15-inch, 2017)

What steps will reproduce the problem?
(1) Run customer app from Issue 905008, which does a lot of framebuffer and state switching, on AMD (and, I believe, Intel) GPUs on macOS.

What is the expected result?

Expect the app to render correctly.


What happens instead?

Frequent black screens and/or flickering, worked around via preserveDrawingBuffer:true.

After extensive diagnosis (see the other bug - apologies for restricted view, but it discusses a not-yet-shipped product), it looks like the ColorMask, and probably other state related to clearing, is incorrectly being treated by the OpenGL driver as per-framebuffer state rather than global state.

about:gpu follows from a Chromium build which includes a new driver bug workaround (treat_clear_state_as_framebuffer_dependent) working around the problem.


Graphics Feature Status
Canvas: Hardware accelerated
Flash: Hardware accelerated
Flash Stage3D: Hardware accelerated
Flash Stage3D Baseline profile: Hardware accelerated
Compositing: Hardware accelerated
Multiple Raster Threads: Enabled
Native GpuMemoryBuffers: Hardware accelerated
Out-of-process Rasterization: Hardware accelerated
Hardware Protected Video Decode: Unavailable
Rasterization: Hardware accelerated
Skia Deferred Display List: Disabled
Skia Renderer: Disabled
Surface Control: Disabled
Surface Synchronization: Enabled
Video Decode: Hardware accelerated
Viz Service Display Compositor: Enabled
WebGL: Hardware accelerated
WebGL2: Hardware accelerated
Driver Bug Workarounds
add_and_true_to_loop_condition
adjust_src_dst_region_for_blitframebuffer
decode_encode_srgb_for_generatemipmap
disable_2d_canvas_auto_flush
disable_framebuffer_cmaa
disable_webgl_rgb_multisampling_usage
dont_use_loops_to_initialize_variables
emulate_abs_int_function
flush_on_framebuffer_change
get_frag_data_info_bug
init_two_cube_map_levels_before_copyteximage
msaa_is_slow
pack_parameters_workaround_with_pack_buffer
rebind_transform_feedback_before_resume
regenerate_struct_names
remove_invariant_and_centroid_for_essl3
reset_teximage2d_base_level
rewrite_texelfetchoffset_to_texelfetch
scalarize_vec_and_mat_constructor_args
set_zero_level_before_generating_mipmap
treat_clear_state_as_framebuffer_dependent
unfold_short_circuit_as_ternary_operation
unpack_alignment_workaround_with_unpack_buffer
unpack_image_height_workaround_with_unpack_buffer
use_intermediary_for_copy_texture_image
use_unused_standard_shared_blocks
disabled_extension_GL_KHR_blend_equation_advanced
disabled_extension_GL_KHR_blend_equation_advanced_coherent
Problems Detected
Protected video decoding with swap chain is for Windows and Intel only
Disabled Features: protected_video_decode
Unfold short circuit on Mac OS X: 307751
Applied Workarounds: unfold_short_circuit_as_ternary_operation
Always rewrite vec/mat constructors to be consistent: 398694
Applied Workarounds: scalarize_vec_and_mat_constructor_args
Mac drivers handle struct scopes incorrectly: 403957
Applied Workarounds: regenerate_struct_names
On Intel GPUs MSAA performance is not acceptable for GPU rasterization: 527565
Applied Workarounds: msaa_is_slow
glGenerateMipmap fails if the zero texture level is not set on some Mac drivers: 560499
Applied Workarounds: set_zero_level_before_generating_mipmap
Pack parameters work incorrectly with pack buffer bound: 563714
Applied Workarounds: pack_parameters_workaround_with_pack_buffer
Alignment works incorrectly with unpack buffer bound: 563714
Applied Workarounds: unpack_alignment_workaround_with_unpack_buffer
copyTexImage2D fails when reading from IOSurface on multiple GPU types.: 581777
Applied Workarounds: use_intermediary_for_copy_texture_image
Multisample renderbuffers with format GL_RGB8 have performance issues on Intel GPUs.: 607130
Applied Workarounds: disable_webgl_rgb_multisampling_usage
Use GL_INTEL_framebuffer_CMAA on ChromeOS: 535198
Applied Workarounds: disable_framebuffer_cmaa
glGetFragData{Location|Index} works incorrectly on Max: 638340
Applied Workarounds: get_frag_data_info_bug
glResumeTransformFeedback works incorrectly on Intel GPUs: 638514
Applied Workarounds: rebind_transform_feedback_before_resume
Result of abs(i) where i is an integer in vertex shader is wrong: 642227
Applied Workarounds: emulate_abs_int_function
Rewrite texelFetchOffset to texelFetch for Intel Mac: 642605
Applied Workarounds: rewrite_texelfetchoffset_to_texelfetch
Rewrite condition in for and while loops for Intel Mac: 644669
Applied Workarounds: add_and_true_to_loop_condition
Decode and encode before generateMipmap for srgb format textures on macosx: 634519
Applied Workarounds: decode_encode_srgb_for_generatemipmap
Init first two levels before CopyTexImage2D for cube map texture on Intel Mac 10.12: 648197
Applied Workarounds: init_two_cube_map_levels_before_copyteximage
Insert statements to reference all members in unused std140/shared blocks on Mac: 618464
Applied Workarounds: use_unused_standard_shared_blocks
Tex(Sub)Image3D performs incorrectly when uploading from unpack buffer with GL_UNPACK_IMAGE_HEIGHT greater than zero on Intel Macs: 654258
Applied Workarounds: unpack_image_height_workaround_with_unpack_buffer
adjust src/dst region if blitting pixels outside read framebuffer on Mac: 644740
Applied Workarounds: adjust_src_dst_region_for_blitframebuffer
Mac driver GL 4.1 requires invariant and centroid to match between shaders: 639760, 641129
Applied Workarounds: remove_invariant_and_centroid_for_essl3
Disable KHR_blend_equation_advanced until cc shaders are updated: 661715
Applied Workarounds: disable(GL_KHR_blend_equation_advanced), disable(GL_KHR_blend_equation_advanced_coherent)
Reset TexImage2D base level to 0 on Intel Mac 10.12.4: 705865
Applied Workarounds: reset_teximage2d_base_level
Switching framebuffers without a flush can lead to crashes on Intel 9th Generation GPU Macs.: 783979
Applied Workarounds: flush_on_framebuffer_change
Shader variable initialization in a loop caused perf regression on Mac Intel.: 809422
Applied Workarounds: dont_use_loops_to_initialize_variables
glFlush error on Mac: 841755
Applied Workarounds: disable_2d_canvas_auto_flush
ColorMask, etc. is framebuffer-dependent state on Intel GPUs on macOS: 905008
Applied Workarounds: treat_clear_state_as_framebuffer_dependent
Skia renderer is not used by default.
Disabled Features: skia_renderer
Skia deferred display list is not used by default.
Disabled Features: skia_deferred_display_list
Version Information
Data exported	2018-12-05T02:28:05.523Z
Chrome version	Chrome/72.0.3625.0
Operating system	Mac OS X 10.14.1
Software rendering list URL	https://chromium.googlesource.com/chromium/src/+/1bcdee9ce968577c851bd4459fff3cad94b7097a/gpu/config/software_rendering_list.json
Driver bug list URL	https://chromium.googlesource.com/chromium/src/+/1bcdee9ce968577c851bd4459fff3cad94b7097a/gpu/config/gpu_driver_bug_list.json
ANGLE commit id	5829c03d383e
2D graphics backend	Skia/72 1a2476d2945654e40861292f778090fa04b3c267-
Command Line	./out/Release/Chromium.app/Contents/MacOS/Chromium --user-data-dir=/tmp/t1 --flag-switches-begin --enable-features=WebAssemblyThreads --flag-switches-end
Driver Information
Initialization time	71
In-process GPU	false
Passthrough Command Decoder	false
Sandboxed	true
GPU0	VENDOR = 0x1002, DEVICE= 0x67ef
GPU1	VENDOR = 0x8086, DEVICE= 0x591b *ACTIVE*
Optimus	false
AMD switchable	true
Driver vendor	INTEL
Driver version	12.2.17
Driver date	
GPU CUDA compute capability major version	0
Pixel shader version	4.10
Vertex shader version	4.10
Max. MSAA samples	16
Machine model name	MacBookPro
Machine model version	14.3
GL_VENDOR	Intel Inc.
GL_RENDERER	Intel(R) HD Graphics 630
GL_VERSION	4.1 INTEL-12.2.17
GL_EXTENSIONS	GL_ARB_blend_func_extended GL_ARB_draw_buffers_blend GL_ARB_draw_indirect GL_ARB_ES2_compatibility GL_ARB_explicit_attrib_location GL_ARB_gpu_shader_fp64 GL_ARB_gpu_shader5 GL_ARB_instanced_arrays GL_ARB_internalformat_query GL_ARB_occlusion_query2 GL_ARB_sample_shading GL_ARB_sampler_objects GL_ARB_separate_shader_objects GL_ARB_shader_bit_encoding GL_ARB_shader_subroutine GL_ARB_shading_language_include GL_ARB_tessellation_shader GL_ARB_texture_buffer_object_rgb32 GL_ARB_texture_cube_map_array GL_ARB_texture_gather GL_ARB_texture_query_lod GL_ARB_texture_rgb10_a2ui GL_ARB_texture_storage GL_ARB_texture_swizzle GL_ARB_timer_query GL_ARB_transform_feedback2 GL_ARB_transform_feedback3 GL_ARB_vertex_attrib_64bit GL_ARB_vertex_type_2_10_10_10_rev GL_ARB_viewport_array GL_EXT_debug_label GL_EXT_debug_marker GL_EXT_framebuffer_multisample_blit_scaled GL_EXT_texture_compression_s3tc GL_EXT_texture_filter_anisotropic GL_EXT_texture_sRGB_decode GL_APPLE_client_storage GL_APPLE_container_object_shareable GL_APPLE_flush_render GL_APPLE_object_purgeable GL_APPLE_rgb_422 GL_APPLE_row_bytes GL_APPLE_texture_range GL_ATI_texture_mirror_once GL_NV_texture_barrier
Disabled Extensions	GL_KHR_blend_equation_advanced GL_KHR_blend_equation_advanced_coherent
Disabled WebGL Extensions	
Window system binding vendor	
Window system binding version	
Window system binding extensions	
Direct rendering	Yes
Reset notification strategy	0x0000
GPU process crash count	0
Compositor Information
Tile Update Mode	Zero-copy
Partial Raster	Enabled
GpuMemoryBuffers Status
R_8	GPU_READ, SCANOUT, SCANOUT_CPU_READ_WRITE, GPU_READ_CPU_READ_WRITE, GPU_READ_CPU_READ_WRITE_PERSISTENT
R_16	Software only
RG_88	Software only
BGR_565	Software only
RGBA_4444	Software only
RGBX_8888	Software only
RGBA_8888	GPU_READ, SCANOUT, SCANOUT_CPU_READ_WRITE, GPU_READ_CPU_READ_WRITE, GPU_READ_CPU_READ_WRITE_PERSISTENT
BGRX_8888	GPU_READ, SCANOUT, SCANOUT_CPU_READ_WRITE
BGRX_1010102	GPU_READ, SCANOUT, SCANOUT_CPU_READ_WRITE, GPU_READ_CPU_READ_WRITE, GPU_READ_CPU_READ_WRITE_PERSISTENT
RGBX_1010102	Software only
BGRA_8888	GPU_READ, SCANOUT, SCANOUT_CPU_READ_WRITE, GPU_READ_CPU_READ_WRITE, GPU_READ_CPU_READ_WRITE_PERSISTENT
RGBA_F16	GPU_READ, SCANOUT, SCANOUT_CPU_READ_WRITE, GPU_READ_CPU_READ_WRITE, GPU_READ_CPU_READ_WRITE_PERSISTENT
YVU_420	Software only
YUV_420_BIPLANAR	GPU_READ, SCANOUT, SCANOUT_CPU_READ_WRITE, GPU_READ_CPU_READ_WRITE, GPU_READ_CPU_READ_WRITE_PERSISTENT
UYVY_422	GPU_READ, SCANOUT, SCANOUT_CPU_READ_WRITE, GPU_READ_CPU_READ_WRITE, GPU_READ_CPU_READ_WRITE_PERSISTENT
Display(s) Information
Info	Display[2077750269] bounds=[0,0 1680x1050], workarea=[0,23 1680x971], scale=2, external.
Color space information	{primaries_d50_referred: [[0.6818, 0.3196], [0.2846, 0.6747], [0.1562, 0.0554]], transfer:0.0777*x + 0.0000 if x < 0.0450 else (0.9478*x + 0.0521)**2.4000 + -0.0000, matrix:RGB, range:FULL}
Bits per color component	8
Bits per pixel	24
Video Acceleration Information
Decode h264 baseline	up to 4096x2160 pixels
Decode h264 extended	up to 4096x2160 pixels
Decode h264 main	up to 4096x2160 pixels
Decode h264 high	up to 4096x2160 pixels
Encode h264 baseline	up to 4096x2160 pixels and/or 30.000 fps
Encode h264 main	up to 4096x2160 pixels and/or 30.000 fps
Encode h264 high	up to 4096x2160 pixels and/or 30.000 fps

 
Re-sending the ColorMask and other clear-related state:
https://cs.chromium.org/chromium/src/gpu/command_buffer/service/gles2_cmd_decoder.cc?q=applydirtystate&sq=package:chromium&g=0&l=6131

every time the bound framebuffer changes works around this problem.

Note that Chromium's validating command decoder does factor in certain framebuffer-related parameters when sending this state down to the driver (see allows_alpha_change, have_depth, etc. in that method), but removing those doesn't have any effect. However, forcibly calling ApplyDirtyState() in OnFboChanged() does, and works around the bug originally reported by the customer.

Haven't yet created a reduced WebGL conformance test for this, but will try.

Summary: ColorMask and other context state is destroyed during implicit clears and other operations (was: glColorMask is being treated as per-framebuffer state on macOS)
In trying to create a reduced WebGL conformance test for this issue - which was more difficult than anticipated - it became clear that this is not a bug in the graphics driver, but a bug in Chrome's command buffer. Its internal caches of OpenGL context state were being mis-managed during certain operations such as lazy clearing of textures.

https://github.com/KhronosGroup/WebGL/pull/2751 is up for review as a regression test for this issue.

Blocking: 913033
Project Member

Comment 4 by bugdroid1@chromium.org, Dec 11

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/5fe432ffc97808da0d270c97dc08756758a23e4d

commit 5fe432ffc97808da0d270c97dc08756758a23e4d
Author: Kenneth Russell <kbr@chromium.org>
Date: Tue Dec 11 00:35:35 2018

Fix ColorMask state management in validating command decoder.

GLES2DecoderImpl::ClearLevelUsingGL was bypassing ContextState's
management of the color mask, causing the wrong color mask to be
used, and the RGB-on-RGBA emulation for WebGL's back buffer on
macOS to break.

Tested by new WebGL conformance test in:
https://github.com/KhronosGroup/WebGL/pull/2751

Bug:  911918 
Change-Id: I255b11915af8ed3ddb7adfa64d7667b32c3be2df
Reviewed-on: https://chromium-review.googlesource.com/c/1366923
Reviewed-by: Victor Miura <vmiura@chromium.org>
Commit-Queue: Kenneth Russell <kbr@chromium.org>
Cr-Commit-Position: refs/heads/master@{#615348}
[modify] https://crrev.com/5fe432ffc97808da0d270c97dc08756758a23e4d/gpu/command_buffer/service/gles2_cmd_decoder.cc
[modify] https://crrev.com/5fe432ffc97808da0d270c97dc08756758a23e4d/gpu/command_buffer/service/gles2_cmd_decoder_unittest_drawing.cc

Labels: ReleaseBlock-Stable M-72 Merge-Request-72
Status: Fixed (was: Started)
Summary: ColorMask is destroyed during implicit clears (was: ColorMask and other context state is destroyed during implicit clears and other operations)
The ColorMask was the only piece of context state proven so far to be destroyed by the implicit clear operations. There remains one other rendering bug in the customer app which has to be investigated. Some other cleanups were found during the investigation which will be handled in follow-on bugs.

Requesting merge to M72 to get this fix out earlier.

Blocking: 913751
Project Member

Comment 7 by sheriffbot@chromium.org, Dec 12

Labels: -Merge-Request-72 Hotlist-Merge-Approved Merge-Approved-72
Your change meets the bar and is auto-approved for M72. Please go ahead and merge the CL to branch 3626 manually. Please contact milestone owner if you have questions.
Owners: govind@(Android), kariahda@(iOS), djmm@(ChromeOS), abdulsyed@(Desktop)

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
Project Member

Comment 8 by bugdroid1@chromium.org, Dec 12

Labels: -merge-approved-72 merge-merged-3626
The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/ec7ab4815ccc64378c31e662116ef8f1c2b0563d

commit ec7ab4815ccc64378c31e662116ef8f1c2b0563d
Author: Kenneth Russell <kbr@chromium.org>
Date: Wed Dec 12 01:45:27 2018

Fix ColorMask state management in validating command decoder.

GLES2DecoderImpl::ClearLevelUsingGL was bypassing ContextState's
management of the color mask, causing the wrong color mask to be
used, and the RGB-on-RGBA emulation for WebGL's back buffer on
macOS to break.

Tested by new WebGL conformance test in:
https://github.com/KhronosGroup/WebGL/pull/2751

TBR=kbr@chromium.org

(cherry picked from commit 5fe432ffc97808da0d270c97dc08756758a23e4d)

Bug:  911918 
Change-Id: I255b11915af8ed3ddb7adfa64d7667b32c3be2df
Reviewed-on: https://chromium-review.googlesource.com/c/1366923
Reviewed-by: Victor Miura <vmiura@chromium.org>
Commit-Queue: Kenneth Russell <kbr@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#615348}
Reviewed-on: https://chromium-review.googlesource.com/c/1372669
Reviewed-by: Kenneth Russell <kbr@chromium.org>
Cr-Commit-Position: refs/branch-heads/3626@{#273}
Cr-Branched-From: d897fb137fbaaa9355c0c93124cc048824eb1e65-refs/heads/master@{#612437}
[modify] https://crrev.com/ec7ab4815ccc64378c31e662116ef8f1c2b0563d/gpu/command_buffer/service/gles2_cmd_decoder.cc
[modify] https://crrev.com/ec7ab4815ccc64378c31e662116ef8f1c2b0563d/gpu/command_buffer/service/gles2_cmd_decoder_unittest_drawing.cc

Cc: kbr@chromium.org
 Issue 913033  has been merged into this issue.
Project Member

Comment 10 by bugdroid1@chromium.org, Dec 19

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/4d1557e84992428767937e98808d3bbad915e53f

commit 4d1557e84992428767937e98808d3bbad915e53f
Author: James Darpinian <jdarpinian@chromium.org>
Date: Wed Dec 19 07:17:47 2018

Roll WebGL 5b6cbd7..a2b3563

https://chromium.googlesource.com/external/khronosgroup/webgl.git/+log/5b6cbd7..a2b3563

Bug: 849576,  809237 ,  911918 ,  angleproject:3012 
Bug: 913301,  912842 ,  913033 ,  563816 , 788439
Bug: angleproject:3033
Change-Id: I9b257afd69d26e75d1635633f556249583fdaa52
Cq-Include-Trybots: luci.chromium.try:win_optional_gpu_tests_rel;luci.chromium.try:mac_optional_gpu_tests_rel;luci.chromium.try:linux_optional_gpu_tests_rel;luci.chromium.try:android_optional_gpu_tests_rel;luci.chromium.try:linux_angle_rel_ng;luci.chromium.try:win_angle_rel_ng
Reviewed-on: https://chromium-review.googlesource.com/c/1383329
Commit-Queue: James Darpinian <jdarpinian@chromium.org>
Reviewed-by: Kenneth Russell <kbr@chromium.org>
Cr-Commit-Position: refs/heads/master@{#617754}
[modify] https://crrev.com/4d1557e84992428767937e98808d3bbad915e53f/DEPS
[modify] https://crrev.com/4d1557e84992428767937e98808d3bbad915e53f/content/test/gpu/gpu_tests/webgl2_conformance_expectations.py
[modify] https://crrev.com/4d1557e84992428767937e98808d3bbad915e53f/content/test/gpu/gpu_tests/webgl_conformance_revision.txt

Labels: Merge-Merged-72-3626
The following revision refers to this bug: 
https://chromium.googlesource.com/chromium/src.git/+/ec7ab4815ccc64378c31e662116ef8f1c2b0563d

Commit: ec7ab4815ccc64378c31e662116ef8f1c2b0563d
Author: kbr@chromium.org
Commiter: kbr@chromium.org
Date: 2018-12-12 01:45:27 +0000 UTC

Fix ColorMask state management in validating command decoder.

GLES2DecoderImpl::ClearLevelUsingGL was bypassing ContextState's
management of the color mask, causing the wrong color mask to be
used, and the RGB-on-RGBA emulation for WebGL's back buffer on
macOS to break.

Tested by new WebGL conformance test in:
https://github.com/KhronosGroup/WebGL/pull/2751

TBR=kbr@chromium.org

(cherry picked from commit 5fe432ffc97808da0d270c97dc08756758a23e4d)

Bug:  911918 
Change-Id: I255b11915af8ed3ddb7adfa64d7667b32c3be2df
Reviewed-on: https://chromium-review.googlesource.com/c/1366923
Reviewed-by: Victor Miura <vmiura@chromium.org>
Commit-Queue: Kenneth Russell <kbr@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#615348}
Reviewed-on: https://chromium-review.googlesource.com/c/1372669
Reviewed-by: Kenneth Russell <kbr@chromium.org>
Cr-Commit-Position: refs/branch-heads/3626@{#273}
Cr-Branched-From: d897fb137fbaaa9355c0c93124cc048824eb1e65-refs/heads/master@{#612437}
Project Member

Comment 12 by bugdroid1@chromium.org, Dec 20

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/b9d575c522cb91343dd62fda527eb3f1f7899c99

commit b9d575c522cb91343dd62fda527eb3f1f7899c99
Author: Kenneth Russell <kbr@chromium.org>
Date: Thu Dec 20 00:09:26 2018

Mark color-mask-during-implicit-clears failing on Nexus 6.

This is failing only on this particular old bot. Mark failing.

Bug:  911918 
Tbr: jdarpinian@chromium.org
Change-Id: I740cf603b92232bfbf23c4ca2cedc013a965ca55
Reviewed-on: https://chromium-review.googlesource.com/c/1385124
Reviewed-by: James Darpinian <jdarpinian@chromium.org>
Reviewed-by: Kenneth Russell <kbr@chromium.org>
Commit-Queue: James Darpinian <jdarpinian@chromium.org>
Cr-Commit-Position: refs/heads/master@{#618017}
[modify] https://crrev.com/b9d575c522cb91343dd62fda527eb3f1f7899c99/content/test/gpu/gpu_tests/webgl_conformance_expectations.py

Sign in to add a comment