Crash at GrMtlGpu::uploadToTexture(GrMtlTexture*, SkIRect, GrColorType, GrMipLevel const*, int)

53 views
Skip to first unread message

Jona

unread,
Nov 23, 2022, 8:43:49 AM11/23/22
to skia-discuss
We are getting a crash once in a rare while that appears to be related to uploading a texture to GPU. I'm wondering why this could happen. Could it be that at times Skia is caching too many textures causing out-of-memory issues? Could we disable the caching of textures? If we can, how can we do it?

Our work flow is loading SkImages from file and quickly playing them on a GPU backed surface.

###### Crash Stack #######
Crashed: com.apple.main-thread
0  AGXMetalA12                    0x221d0 (Missing UUID ffc881206b083889beb28f51e9f3bc08)
1  AGXMetalA12                    0x25990 (Missing UUID ffc881206b083889beb28f51e9f3bc08)
2  FlipCore                       0x44045c GrMtlGpu::uploadToTexture(GrMtlTexture*, SkIRect, GrColorType, GrMipLevel const*, int) + 840
3  FlipCore                       0x36decc GrGpu::writePixels(GrSurface*, SkIRect, GrColorType, GrColorType, GrMipLevel const*, int, bool) + 540
4  FlipCore                       0x36dac4 GrGpu::createTexture(SkISize, GrBackendFormat const&, GrTextureType, GrRenderable, int, SkBudgeted, GrProtected, GrColorType, GrColorType, GrMipLevel const*, int, std::__1::basic_string_view<char, std::__1::char_traits<char>>) + 588
5  FlipCore                       0x3809c8 GrResourceProvider::createTexture(SkISize, GrBackendFormat const&, GrTextureType, GrColorType, GrRenderable, int, SkBudgeted, GrMipmapped, GrProtected, GrMipLevel const*, std::__1::basic_string_view<char, std::__1::char_traits<char>>) + 708
6  FlipCore                       0x3762a4 std::__1::__function::__func<GrProxyProvider::createNonMippedProxyFromBitmap(SkBitmap const&, SkBackingFit, SkBudgeted)::$_0, std::__1::allocator<GrProxyProvider::createNonMippedProxyFromBitmap(SkBitmap const&, SkBackingFit, SkBudgeted)::$_0>, GrSurfaceProxy::LazyCallbackResult (GrResourceProvider*, GrSurfaceProxy::LazySurfaceDesc const&)>::operator()(GrResourceProvider*&&, GrSurfaceProxy::LazySurfaceDesc const&) + 132
7  FlipCore                       0x384de4 GrSurfaceProxyPriv::doLazyInstantiation(GrResourceProvider*) + 380
8  FlipCore                       0x374f80 GrProxyProvider::createProxyFromBitmap(SkBitmap const&, GrMipmapped, SkBackingFit, SkBudgeted) + 596
9  FlipCore                       0x3d4ff8 make_bmp_proxy(GrProxyProvider*, SkBitmap const&, GrColorType, GrMipmapped, SkBackingFit, SkBudgeted) + 136
10 FlipCore                       0x3d4a10 GrMakeCachedBitmapProxyView(GrRecordingContext*, SkBitmap const&, GrMipmapped) + 484
11 FlipCore                       0x42d278 (anonymous namespace)::draw_image(GrRecordingContext*, skgpu::v1::SurfaceDrawContext*, GrClip const*, SkMatrixProvider const&, SkPaint const&, SkImage_Base const&, SkRect const&, SkRect const&, SkPoint const*, SkMatrix const&, GrQuadAAFlags, SkCanvas::SrcRectConstraint, SkSamplingOptions, SkTileMode) + 3160
12 FlipCore                       0x42e434 skgpu::v1::Device::drawImageQuad(SkImage const*, SkRect const*, SkRect const*, SkPoint const*, GrQuadAAFlags, SkMatrix const*, SkSamplingOptions const&, SkPaint const&, SkCanvas::SrcRectConstraint) + 3124
13 FlipCore                       0x42a488 skgpu::v1::Device::drawImageRect(SkImage const*, SkRect const*, SkRect const&, SkSamplingOptions const&, SkPaint const&, SkCanvas::SrcRectConstraint) + 72
14 FlipCore                       0x1a4828 SkCanvas::onDrawImage2(SkImage const*, float, float, SkSamplingOptions const&, SkPaint const*) + 560
15 FlipCore                       0x1a4f2c SkCanvas::drawImage(SkImage const*, float, float, SkSamplingOptions const&, SkPaint const*) + 200
16 FlipCore                       0x80a28 FcFramesManager::loadImages(std::__1::vector<FcImageInfo, std::__1::allocator<FcImageInfo>> const&, sk_sp<SkImage>, sk_sp<SkImage>, SkRect const*, bool, SkCanvas&, SkISize const&, FcScaleType const&, SkSamplingOptions const&) + 1992

Jim Van Verth

unread,
Nov 23, 2022, 9:43:22 AM11/23/22
to skia-d...@googlegroups.com
I'm not sure that's the issue, but you can set the cache limit by getting the GrDirectContext from the SkCanvas using canvas->recordingContext()->asDirectContext(), and then calling GrDirectContext::setResourceCacheLimit().

Is there any other information about the crash? And out of curiosity, is this an iOS app that might have gone into background? We've had issues with that in the past.

--
You received this message because you are subscribed to the Google Groups "skia-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to skia-discuss...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/skia-discuss/315c4282-8dda-4e60-90be-4d57cb676a8cn%40googlegroups.com.


--

Jim Van Verth | Software Engineer | jvan...@google.com | 919-210-7664

Jona

unread,
Nov 23, 2022, 10:20:06 AM11/23/22
to skia-discuss
Thanks for the hints. Yes, it is an iOS app. We did have issues with drawing while the app was in the background in the past. This one could very well be related to drawing while on the background for a split second.

In regards to the crash, that's all reported by Firebase crashlytics...

Jim Van Verth

unread,
Nov 25, 2022, 8:34:56 PM11/25/22
to skia-d...@googlegroups.com
We try to avoid drawing in the background if we can, but we can only detect that if Skia is running in the main thread. If that's what's happening, my guess is that it's trying to use a blitCommandEncoder to upload the texture data and then crashes.

Reply all
Reply to author
Forward
0 new messages