New issue
Advanced search Search tips

Issue 912231 link

Starred by 1 user

Issue metadata

Status: Assigned
Owner:
Components:
EstimatedDays: ----
NextAction: ----
OS: Android
Pri: 2
Type: Bug-Regression



Sign in to add a comment

GrCacheControllerTest.ResetPurgeGrCacheOnReuse fails on Android devices with scratch texture re-use disabled

Reported by agd...@amazon.com, Dec 5

Issue description

Steps to reproduce the problem:
1. Build gpu_unittests_apk target
2. Run GrCacheControllerTest.ResetPurgeGrCacheOnReuse test: out/Debug/bin/run_gpu_unittests --num_retries=0 -f GrCacheControllerTest.ResetPurgeGrCacheOnReuse

What is the expected behavior?
Test passes

What went wrong?
Test fails:

C  223.948s Main  ********************************************************************************
C  223.948s Main  Detailed Logs
C  223.948s Main  ********************************************************************************
C  223.958s Main  [FAILURE] GrCacheControllerTest.ResetPurgeGrCacheOnReuse:
C  223.958s Main  [ RUN      ] GrCacheControllerTest.ResetPurgeGrCacheOnReuse
C  223.958s Main  [ERROR:gl_surface_egl.cc(336)] eglChooseConfig failed with error EGL_BAD_ATTRIBUTE
C  223.958s Main  ../../gpu/command_buffer/service/gr_cache_controller_unittest.cc:106: Failure
C  223.958s Main  Expected: (gr_context()->getResourceCachePurgeableBytes()) > (0u), actual: 0 vs 0
C  223.958s Main  Stack trace:
C  223.958s Main  
C  223.958s Main  [  FAILED  ] GrCacheControllerTest.ResetPurgeGrCacheOnReuse (52 ms)
C  223.958s Main  [----------] 1 test from GrCacheControllerTest (53 ms total)
C  223.958s Main  
C  223.958s Main  [----------] Global test environment tear-down
C  223.958s Main  [==========] 1 test from 1 test case ran. (56 ms total)
C  223.958s Main  [  PASSED  ] 0 tests.
C  223.958s Main  [  FAILED  ] 1 test, listed below:
C  223.959s Main  [  FAILED  ] GrCacheControllerTest.ResetPurgeGrCacheOnReuse
C  223.959s Main  Reading Android symbols from: /home/ironbot/build_internal/slave/android/build/src
C  223.959s Main  Searching for Chrome symbols from within: /home/ironbot/build_internal/slave/android/build/src/out/Release/lib.unstripped:/home/ironbot/build_internal/slave/android/build/src/out/Release
C  223.959s Main  Searching for native crashes in: /tmp/tmpVS16o3
C  223.959s Main  Unknown Android release, consider passing --packed-lib.
C  223.959s Main  Searching for Chrome symbols from within: /home/ironbot/build_internal/slave/android/build/src/out/Release/lib.unstripped:/home/ironbot/build_internal/slave/android/build/src/out/Release
C  223.959s Main  
C  223.959s Main  Stack Trace:
C  223.959s Main    RELADDR   FUNCTION                                                                      FILE:LINE
C  223.959s Main    023725db  testing::internal::AssertHelper::operator=(testing::Message const&) const     ??:0:0
C  223.959s Main    020e0cdb  gpu::raster::GrCacheControllerTest_ResetPurgeGrCacheOnReuse_Test::TestBody()  ??:0:0
C  223.959s Main    02376077  testing::Test::Run()                                                          ??:0:0

Did this work before? Yes Pre 30012f550140

Chrome version: master  Channel: n/a
OS Version: N/A
Flash Version: 

This is a regression that was introduced in https://chromium.googlesource.com/chromium/src/+/30012f55014078976cfc728e40569cdd8ef2e51f

I'm not super familiar with src/gpu/ code, but from what I can tell...

The determining factor for whether this test will pass or fail is if scratch textures can be re-used.

https://cs.chromium.org/chromium/src/third_party/skia/src/gpu/gl/GrGLCaps.cpp?l=501&rcl=d5cf51da905fe0411a143b968e121304269e4b1e

Scratch textures are re-used on any device that doesn't have kARM_GrGLVendor as the GL vendor.

When scratch texture re-use is enabled, the test passes. When scratch texture re-use is disabled, the test fails.

This is because when scratch texture re-use is disabled, the GrResourceKey used as a scratch key for the GrTexture that is created in the test ends up getting reset in GrGpu::CreateTexture() [1].

This means that that key is invalid, which is important later on when hasKey in GrResourceCache::notifyCntReachedZero() is set to false because resource->resourcePriv().getScratchKey().isValid() returns false [2]. This results in the resource getting released during the first call to ScheduleGrContextCleanup() in the test [3], reducing the resource cache purgeable bytes to 0 prematurely (from the test's perspective).

This didn't occur prior to 30012f550140 because ScheduleGrContextCleanup() didn't previously call GrContext::performDeferredCleanup(), which now results in the unexpected early release of the resource in this situation.

[1] https://cs.chromium.org/chromium/src/third_party/skia/src/gpu/GrGpu.cpp?l=130&rcl=e0dc346d9e45f3753c4960207596e67122381bff
[2] https://cs.chromium.org/chromium/src/third_party/skia/src/gpu/GrResourceCache.cpp?l=433&rcl=017ac1c6d516e7a5b5c0de4001673942f54fd942
[3] https://cs.chromium.org/chromium/src/gpu/command_buffer/service/gr_cache_controller_unittest.cc?l=97&rcl=32fd6188bc344a693d19370069e919e96607e38d
 
May or may not be related to https://bugs.chromium.org/p/chromium/issues/detail?id=899985 but that failure seemed a bit different so I filed this separately.
Components: Internals>GPU
Owner: khushals...@chromium.org
Status: Assigned (was: Unconfirmed)
This can probably be duped to 899985 (which you have).
Owner: ericrk@chromium.org
ericrk: Could you take a quick look and see if this looks important to fix for M72?
Components: -Internals>GPU Internals>Compositing>OOP-Raster

Sign in to add a comment