Lower quality of snippet previews on 512 devices |
||||||
Issue descriptionOn 512 low-end devices we render pages to 16-bit textures to save memory (see condition in GetCompositorContextAttributes). I propose we do the same with snippets, and lower their quality accordingly to decrease their in-memory size (plus this will decrease amount of data that we need to transfer when decoding). 512 Go devices are under constant memory pressure, and I observed that when scrolling suggestions back and forth images are constantly reloaded (i.e. scroll to the bottom - see bottom images reload, scroll to the top - top images reload, scroll to the bottom - bottom images reload again).
,
Sep 18 2017
Yeah, we disable thumbnail caching on low-end devices on purpose. Image decoding currently uses blink::WebImage::FromData (see https://cs.chromium.org/chromium/src/services/data_decoder/image_decoder_impl.cc?l=38&gs=cpp%253Adata_decoder%253A%253Aclass-ImageDecoderImpl%253A%253ADecodeImage(const%2Bstd%253A%253A__1%253A%253Avector%253Cunsigned%2Bchar%252C%2Bstd%253A%253A__1%253A%253Aallocator%253Cunsigned%2Bchar%253E%2B%253E%2B%2526%252C%2Bdata_decoder%253A%253Amojom%253A%253AImageCodec%252C%2Bbool%252C%2Blong%252C%2Bconst%2Bgfx%253A%253ASize%2B%2526%252C%2Bbase%253A%253AOnceCallback%253Cvoid%2B(const%2BSkBitmap%2B%2526)%253E)%2540chromium%252F..%252F..%252Fservices%252Fdata_decoder%252Fimage_decoder_impl.cc%257Cdef&gsn=DecodeImage&ct=xref_usages) -- can you point me towards how the quality reduction would work there?
,
Sep 20 2017
,
Jan 12 2018
,
Feb 14 2018
I assume we would want to use something like SkConvertPixels to convert the image to 16-bit colors?
,
Feb 14 2018
Yes, something like that. Right now previews look nice and crisp on 512MiB devices compared to actual page which is rendered to 16-bit textures. If we render previews in 16-bit mode too, we can save half of the memory they are currently using. This looks like the place where we prefer 565 textures on 512MiB devices: https://cs.chromium.org/chromium/src/content/browser/renderer_host/compositor_impl_android.cc?l=195 +ericrk@ to confirm.
,
Feb 14 2018
That looks right. We should definitely be using 16-bit textures for everything. Assuming you're just dealing with software Skia types here, you should be able to allocate a new bitmap/pixmap in 16 bit kRGB_565_SkColorType format then provide that as the destination for SkBitmap::readPixels (https://cs.chromium.org/chromium/src/third_party/skia/include/core/SkBitmap.h?rcl=0be01ccecba9c330baf4ba3840e57f34f6cdf320&l=959) How does the snippet preview get eventually rendered to screen? Is it sent in software form to the browser? Passed to CC in the renderer?
,
Feb 15 2018
It's converted to a Java Bitmap and then put into an ImageView. |
||||||
►
Sign in to add a comment |
||||||
Comment 1 by dskiba@chromium.org
, Aug 30 2017