This reverts commit f7ddaa8a1b.
Bug: skia:
Change-Id: Idc0459e119cefbf580aea1f27dda9836d16bb293
Reviewed-on: https://skia-review.googlesource.com/c/162039
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
This reverts commit 087c917670.
Reason for revert: ASAN reporting memory leak.
Original change's description:
> Use SkImage to manage mip map cache purging, not Bitmap/PixelRef
>
> Lazy and GPU images manage the notification themselves, but raster
> images now forward the notification request to the pixelRef.
>
> Bug: skia:
> Change-Id: I93e0ebd3749e3f7dbd506466299fde8923982435
> Reviewed-on: https://skia-review.googlesource.com/c/161830
> Commit-Queue: Mike Klein <mtklein@google.com>
> Reviewed-by: Mike Klein <mtklein@google.com>
TBR=mtklein@google.com,brianosman@google.com,reed@google.com
Change-Id: I355b8caeaae3096e52f5fd2359f4ad39cddaa383
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:
Reviewed-on: https://skia-review.googlesource.com/c/162034
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Lazy and GPU images manage the notification themselves, but raster
images now forward the notification request to the pixelRef.
Bug: skia:
Change-Id: I93e0ebd3749e3f7dbd506466299fde8923982435
Reviewed-on: https://skia-review.googlesource.com/c/161830
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
This reverts commit 11422c63d3.
Reason for revert: Perf regression
Original change's description:
> Tie mip map cache purging to Images, not Bitmaps/PixelRefs
>
> We were potentially using different keys for lookup vs. add, because we
> were adding with a key based on the pixelRef, which may not have the
> same uniqueID as the originating image.
>
> Bug: skia:
> Change-Id: Ib4d3d5ead9f5a574cf6d1920080bc9c4ae66c1d0
> Reviewed-on: https://skia-review.googlesource.com/c/161625
> Reviewed-by: Mike Klein <mtklein@google.com>
> Commit-Queue: Brian Osman <brianosman@google.com>
TBR=mtklein@google.com,brianosman@google.com,reed@google.com
Change-Id: I9bdce1c6b1d9bf13cc477d2e7f20f7cc0f204b2f
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:
Reviewed-on: https://skia-review.googlesource.com/c/161828
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
We were potentially using different keys for lookup vs. add, because we
were adding with a key based on the pixelRef, which may not have the
same uniqueID as the originating image.
Bug: skia:
Change-Id: Ib4d3d5ead9f5a574cf6d1920080bc9c4ae66c1d0
Reviewed-on: https://skia-review.googlesource.com/c/161625
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
PS5: Removes SkDestinationSurfaceColorMode, tracking of mipmap
mode on GrTexture, sRGB decode state per-texture. Because we
were often choosing sRGB configs for RGB color types, legacy
rendering would then be incorrect (too dark). So...
PS7: Stops ever using sRGB pixel configs when translating
image info or color type. Also removes a bunch of GrCaps bits
and a GrContextOption that are no longer relevant.
PS9: Adjusts surface creation unit test expectations, and
changes the raster rules accordingly.
At this point, sRGB configs are (obviously) going to be broken.
Locally, I ran 8888, gl, and the gbr- versions of both. Across
all GMs x configs, there are 13 diffs. 12 are GMs that create
surfaces with a color-space attached (and thus, the offscreen
is no longer getting sRGB pixel config). The only remainder
constructs an SkPictureImageGenerator, (with an attached color
space) and renders it to the gbr-gl canvas, which triggers a
a tagged surface inside the generator.
Bug: skia:
Change-Id: Ie5edfa157dd799f3121e8173fc4f97f6c8ed6789
Reviewed-on: https://skia-review.googlesource.com/131282
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
This was created by looking at warnings produced by clang's
-Wzero-as-null-pointer-constant. This updates most issues in
Skia code. However, there are places where GL and Vulkan want
pointer values which are explicitly 0, external headers which
use NULL directly, and possibly more uses in un-compiled
sources (for other platforms).
Change-Id: Id22fbac04d5c53497a53d734f0896b4f06fe8345
Reviewed-on: https://skia-review.googlesource.com/39521
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
* Use unique_ptr, sk_sp, SkAutoFree, using.
* Rely on thread-safe static global initializion.
Change-Id: I7c14e0e57622163b1b81b97a218b816fe6d02926
Reviewed-on: https://skia-review.googlesource.com/13818
Commit-Queue: Hal Canary <halcanary@google.com>
Reviewed-by: Herb Derby <herb@google.com>
The Rec in the cache is the owner of the pixel memory
- discardable or
- malloc
Each external client has a pixelref that just points to those pixels,
and whose destructor will notify the rec.
This eliminates the dependency on lockPixels in pixelref, freeing us
to remove that entirely from pixelref.
Bug: skia:
Change-Id: If45ed0ae202a1211336626364235215253e8aa7c
Reviewed-on: https://skia-review.googlesource.com/10300
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: Matt Sarett <msarett@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
This reverts commit 9f4b0ae91e.
Reason for revert: Nanobench asserts.
../../../src/core/SkBitmapCache.cpp:81: fatal error: "assert(scaledWidth != image->width() || scaledHeight != image->height())"
Aborted
Command exited with code 134
step returned non-zero exit code: 134
https://chromium-swarm.appspot.com/task?id=351b1d10c7936310&refresh=10
Original change's description:
> simplify api to bitmapcache
>
> Force all Find callers to make a bitmpacachedesc, which now
> has more rigid validation.
>
> Goal is to ensure we never make two desc (which turn into keys)
> that look different but represent the same image/transformation.
>
> BUG=skia:
>
> Change-Id: I8571837ee4754a69acc99e949bee9a465fa25f2b
> Reviewed-on: https://skia-review.googlesource.com/10114
> Commit-Queue: Mike Reed <reed@google.com>
> Reviewed-by: Brian Osman <brianosman@google.com>
>
TBR=brianosman@google.com,fmalita@chromium.org,reed@google.com,reviews@skia.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=skia:
Change-Id: I21b3c8a5bae409ba740cfc28b352c3b970dcf5af
Reviewed-on: https://skia-review.googlesource.com/10171
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
Force all Find callers to make a bitmpacachedesc, which now
has more rigid validation.
Goal is to ensure we never make two desc (which turn into keys)
that look different but represent the same image/transformation.
BUG=skia:
Change-Id: I8571837ee4754a69acc99e949bee9a465fa25f2b
Reviewed-on: https://skia-review.googlesource.com/10114
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
BUG=skia:
Change-Id: I01c5e1874c9a034febc64e25b3aaafb5050393a6
Reviewed-on: https://skia-review.googlesource.com/8021
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Matt Sarett <msarett@google.com>
This gives a picture image a preferred "native" color space, which
facilitates caching and other things.
BUG=skia:
Change-Id: I95988c14d17f96d7d870b3d1c3b723c36e2c170d
Reviewed-on: https://skia-review.googlesource.com/6158
Reviewed-by: Mike Reed <reed@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Brian Osman <brianosman@google.com>
This is much more explicit about what that type represents (are we in
legacy mode or not), which also makes it suitable for other (upcoming)
usage.
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=4529
Change-Id: Iacb397c34e7765f1ca86c0195bc622b2be4d9acf
Reviewed-on: https://skia-review.googlesource.com/4529
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Replace with std::unique_ptr.
Change-Id: I5806cfbb30515fcb20e5e66ce13fb5f3b8728176
Reviewed-on: https://skia-review.googlesource.com/4381
Commit-Queue: Ben Wagner <bungeman@google.com>
Reviewed-by: Mike Klein <mtklein@chromium.org>
Unit tests added to check all color types in SkOneShotDiscardablePixelref
SkResourceCacheTest seems to have been allways using default Heap Allocator.
Fixed so that it uses private (not global that is) SkDiscardableMemory.
BUG=skia:4355
Review URL: https://codereview.chromium.org/1426753006
This adds SkResourceCache::Remove() which will remove a resource from
its cache. The resource is required to be unlocked at the time Remove()
is called.
Then SkBitmapCache::Find() makes use of this to Remove() bitmaps from
the cache whose pixels have been evicted. This allows the bitmap to be
re-added to the cache with pixels again.
After this change, background a tab (and discarding all the bitmaps'
contents) no longer disables image caching for those discarded images
once the tab is visible again.
BUG=skia:2926
NOTRY=true
R=reed@android.com, tomhudson@google.com, reed@google.com
Author: danakj@chromium.org
Review URL: https://codereview.chromium.org/561953002