getDeferredTextureImageData is slow |
|||||
Issue descriptionWe use getDeferredTextureImageData in a couple of places in GPU image decode controller, mostly to get the data size. However, internally it does a refEncodedData, which sometimes goes to https://cs.chromium.org/chromium/src/third_party/WebKit/Source/platform/image-decoders/SegmentReader.cpp?sq=package:chromium&rcl=1473693493&l=174 which copies the image data into a buffer and then returns it as a ref counted blob. I've seen traces where this takes on the order of 1-2ms on the compositor thread (since we do this check at scheduling time). I think we should be able to do much better if we just want to get the size, as opposed to the data itself.
,
Sep 12 2016
I think it's this call https://cs.chromium.org/chromium/src/third_party/skia/src/image/SkImage_Gpu.cpp?q=getDeferredTextureImageData&sq=package:chromium&dr=CSs&l=491 According to the comment we're really just checking if the data exists.
,
Sep 12 2016
I think it'd be safe to replace the check for this->refEncoded() with as_IB(this)->peekCacherator()
,
Nov 8 2016
Any progress on this?
,
Nov 14 2016
Sorry for the slow response. This got pushed to the back burner. The CR is https://codereview.chromium.org/2337803002/ The current hang-up is we have it designed to ask whether or not it would be cheap to get a texture from this SkImage. In the case of encoded images it would not be cheap. However, pulling a texture from a different GL context is failing the tests. The design thinks it would indeed be cheap to get a texture -- it already is a texture. But it doesn't realize it is a texture on another context. As a side not, it is failing on something independent of being cheap or not as well. Pixels do not match between the two context's textures.
,
Apr 8 2017
If you see fit, you can add it under the umbrela of: https://bugs.chromium.org/p/chromium/issues/detail?id=709707
,
Apr 8 2017
,
May 8 2017
There seem to be a variety of other thoughts here not specifically related to the speed of calling getDeferredTextureImageData (esp. when just the size is needed). If that (above) is still the gist of this bug, I think we can just remove the call to refEncoded() entirely, and add an explicit check to return 0 if the image is already texture-backed. I will write up a CL to that effect.
,
May 8 2017
We want getDeferredTextureImageData to fail on picture-backed images and possibly on non-encoded raster images as well.
,
May 9 2017
The following revision refers to this bug: https://skia.googlesource.com/skia/+/7f1d020bbfde245281fac88ff09b55366155be16 commit 7f1d020bbfde245281fac88ff09b55366155be16 Author: Mike Reed <reed@google.com> Date: Tue May 09 03:52:03 2017 remove (possibly slow) call to refEncoded in getDeferredTextureImageData - explicitly reject already-texture-backed and picture-backed Needed to add a virtual to image_base and generator to distinguish generators that can (or cannot) natively "generate" on the gpu (e.g. pictures) Bug: 646089 Change-Id: I3aea22f89b31009ecbb3bd50d88512e6532f0a0f Change-Id: I3aea22f89b31009ecbb3bd50d88512e6532f0a0f Reviewed-on: https://skia-review.googlesource.com/15765 Commit-Queue: Mike Reed <reed@google.com> Reviewed-by: Leon Scroggins <scroggo@google.com> Reviewed-by: Brian Salomon <bsalomon@google.com> [modify] https://crrev.com/7f1d020bbfde245281fac88ff09b55366155be16/src/image/SkImage_Base.h [modify] https://crrev.com/7f1d020bbfde245281fac88ff09b55366155be16/src/core/SkPictureImageGenerator.h [modify] https://crrev.com/7f1d020bbfde245281fac88ff09b55366155be16/include/core/SkImageGenerator.h [modify] https://crrev.com/7f1d020bbfde245281fac88ff09b55366155be16/src/image/SkImage_Lazy.cpp [modify] https://crrev.com/7f1d020bbfde245281fac88ff09b55366155be16/src/image/SkImage_Gpu.cpp
,
Jun 1 2017
vmpstr@ Does this appear to be fixed now? I imagine bsalomon@'s concern was addressed since he gave a +1 on the code review.
,
Jun 2 2017
Yes, my concern was addressed.
,
Jun 2 2017
This looks fixed now. Thanks. |
|||||
►
Sign in to add a comment |
|||||
Comment 1 by cblume@chromium.org
, Sep 12 2016Status: Assigned (was: Available)