Introduce AutoBackendTexture into Skia-RenderEngine

Conceptually this is the same class as AutoBackendTextureRelease in
libhwui. We require this because:
* As with the equivalent class in libhwui, buffers are reused and
therefore their content is mutable, but SkImages are defined to be
immutable, so the workaround is to cache the backing texture instead.
* Color spaces associated with a buffer are not guaranteed to be
constant. The HWC is allowed to request a different color space for the
client target depending on the set of input layers. This means that
SkSurfaces need to be recreated when the color space changes.
Furthermore, since LinearEffects performs tone-mapping and wants
to sidestep Skia's built-in tone mapping process, this means that when
tone-mapping is enabled we lie about the color space of the input
buffers so that we don't do multiple tone-mapping passes. But this means
that SkImages need to be recreated for those scenarios too so that the
input content can be reinterpreted with a different color space.

Also, append additional trace points onto this CL to get a better handle
on RenderEngine perf.

Bug: 164223050
Test: On a Pixel 3, play HDR content on Youtube with PQ and HLG transfer
functions, and toggle full-screen GL composition on and off.

Change-Id: Ic53a422545b4fb563c7e75c73d978350d38181d5
6 files changed