summaryrefslogtreecommitdiffstats
path: root/core/jni/android_view_GraphicBuffer.cpp
Commit message (Collapse)AuthorAgeFilesLines
* GraphicsJNI Canvas cleanupJohn Reck2015-04-221-17/+5
| | | | Change-Id: I72e142986a8bc9f464c1951b6b5187919de3462e
* Revert "A bunch more cleanups"John Reck2015-04-171-5/+17
| | | | | | This reverts commit c294d128d03bc9a9982b273a82516c04583438cc. Change-Id: Id1ebb236950f7c36c6d86e1dd95566d3a200748d
* A bunch more cleanupsJohn Reck2015-04-141-17/+5
| | | | | | | | Switch a few places to using android::canvas instead of SkCanvas as well which eliminated some JNI Change-Id: I8f98b56442a06362b82b984cd1bd3a92398d8dbc
* Frameworks/base: Consistency in core/jniAndreas Gampe2014-11-211-12/+7
| | | | | | | | Make consistent use of core_jni_helpers for registration. Translate some #ifdefs into const bools. Change-Id: I37639aa053dd50f003a552cbd8550dddecc811c5
* Frameworks/base: Replace LOG_FATAL_IF in core/jniAndreas Gampe2014-11-191-28/+17
| | | | | | | | | | Do not use LOG_FATAL_IF in JNI setup. This is one-time on startup and important enough to always check. Add a header with common helper definitions. Move to inlined functions instead of macros to clean up the code. Change-Id: Ib12d0eed61b110c45d748e80ec36c563e9dec7e5
* stop using (deprecated) SkBitmap::ConfigMike Reed2014-06-201-7/+9
| | | | Change-Id: Ic75b5fc6996578e9d95bd3a220439ec1541d7c3b
* Add a native Canvas wrapper.Florin Malita2014-05-301-7/+6
| | | | | | | | | | | | | | | | | Instead of storing a direct SkCanvas reference, Canvas now tracks an opaque native wrapper class. The native wrapper can be used to store additional info for emulating deprecated Skia features (at this point it only stores a canvas). Some notes: * all native handle -> SkCanvas conversions are routed through a handful of native utility methods. * safeCanvasSwap() refactored as a lower level setNativeBitmp() - which is what clients need. * removed unused get_thread_msec() (Canvas.cpp) Change-Id: I715a5a6f1e1621c1cfc1e510ae4f2ea15cf11114
* Encapsulate Canvas.mNativeCanvasFlorin Malita2014-05-061-23/+4
| | | | | | | | | | | | | | | | | Currently, the native canvas is accessed/manipulated from several unrelated classes. In order to facilitate SaveFlags emulation, this CL encapsulates the field and refactors its external users. Two main changes: * new getNativeCanvas() getter for use in Java-level clients. * JNI canvas swappers (GraphicsBuffers, Surface, TextureView & AssetAtlasService) are refactored based on the exising/equivalent safeCanvasSwap() Canvas method. Change-Id: I966bd4898f0838fb3699e226d3d3d51e0224ea97
* AArch64: Make graphics classes 64-bit compatibleAshok Bhat2014-01-281-27/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This a merger of two commits submitted to AOSP by the following authors: ashok.bhat@arm.com, david.butcher@arm.coma craig.barber@arm.com, kevin.petit@arm.com and marcus.oakland@arm.com Due to the very large number of internal conflicts, I have chosen to cherry-pick this change instead of letting it merge through AOSP because the merge conflict resolution would be very hard to review. Commit messages below: ================================================ AArch64: Make graphics classes 64-bit compatible Changes in this patch include [x] Long is used to store native pointers as they can be 64-bit. [x] Some minor changes have been done to conform with standard JNI practice (e.g. use of jint instead of int in JNI function prototypes) [x] AssetAtlasManager is not completely 64-bit compatible yet. Specifically mAtlasMap member has to be converted to hold native pointer using long. Added a TODO to AssetAtlasManager.java to indicate the change required. Signed-off-by: Ashok Bhat <ashok.bhat@arm.com> Signed-off-by: Craig Barber <craig.barber@arm.com> Signed-off-by: Kévin PETIT <kevin.petit@arm.com> Signed-off-by: Marcus Oakland <marcus.oakland@arm.com> ================================================================== AArch64: Use long for pointers in graphics/Camera For storing pointers, long is used in android/graphics/Camera class, as native pointers can be 64-bit. In addition, some minor changes have been done to conform with standard JNI practice (e.g. use of jint instead of int in JNI function prototypes) Signed-off-by: Ashok Bhat <ashok.bhat@arm.com> Signed-off-by: Marcus Oakland <marcus.oakland@arm.com> =================================================================== Change-Id: Id5793fa0ebc17ee8b1eecf4b3f327977fdccff71
* Revert "AArch64: Make graphics classes 64-bit compatible"Narayan Kamath2014-01-271-42/+27
| | | | | | This reverts commit 18b4cbeedef21c1fa666a110a157bab66edff976. Change-Id: I0c52983a3ab1ace3ff743de546a43eca28e5cb0e
* AArch64: Make graphics classes 64-bit compatibleAshok Bhat2014-01-271-27/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This a merger of two commits submitted to AOSP by the following authors: ashok.bhat@arm.com, david.butcher@arm.coma craig.barber@arm.com, kevin.petit@arm.com and marcus.oakland@arm.com Due to the very large number of internal conflicts, I have chosen to cherry-pick this change instead of letting it merge through AOSP because the merge conflict resolution would be very hard to review. Commit messages below: ================================================ AArch64: Make graphics classes 64-bit compatible Changes in this patch include [x] Long is used to store native pointers as they can be 64-bit. [x] Some minor changes have been done to conform with standard JNI practice (e.g. use of jint instead of int in JNI function prototypes) [x] AssetAtlasManager is not completely 64-bit compatible yet. Specifically mAtlasMap member has to be converted to hold native pointer using long. Added a TODO to AssetAtlasManager.java to indicate the change required. Signed-off-by: Ashok Bhat <ashok.bhat@arm.com> Signed-off-by: Craig Barber <craig.barber@arm.com> Signed-off-by: Kévin PETIT <kevin.petit@arm.com> Signed-off-by: Marcus Oakland <marcus.oakland@arm.com> ================================================================== AArch64: Use long for pointers in graphics/Camera For storing pointers, long is used in android/graphics/Camera class, as native pointers can be 64-bit. In addition, some minor changes have been done to conform with standard JNI practice (e.g. use of jint instead of int in JNI function prototypes) Signed-off-by: Ashok Bhat <ashok.bhat@arm.com> Signed-off-by: Marcus Oakland <marcus.oakland@arm.com> =================================================================== Change-Id: Ib3eab85ed97ea3e3c227617c20f8d213f17d4ba0
* Pack preloaded framework assets in a texture atlasRomain Guy2013-05-021-0/+331
When the Android runtime starts, the system preloads a series of assets in the Zygote process. These assets are shared across all processes. Unfortunately, each one of these assets is later uploaded in its own OpenGL texture, once per process. This wastes memory and generates unnecessary OpenGL state changes. This CL introduces an asset server that provides an atlas to all processes. Note: bitmaps used by skia shaders are *not* sampled from the atlas. It's an uncommon use case and would require extra texture transforms in the GL shaders. WHAT IS THE ASSETS ATLAS The "assets atlas" is a single, shareable graphic buffer that contains all the system's preloaded bitmap drawables (this includes 9-patches.) The atlas is made of two distinct objects: the graphic buffer that contains the actual pixels and the map which indicates where each preloaded bitmap can be found in the atlas (essentially a pair of x and y coordinates.) HOW IS THE ASSETS ATLAS GENERATED Because we need to support a wide variety of devices and because it is easy to change the list of preloaded drawables, the atlas is generated at runtime, during the startup phase of the system process. There are several steps that lead to the atlas generation: 1. If the device is booting for the first time, or if the device was updated, we need to find the best atlas configuration. To do so, the atlas service tries a number of width, height and algorithm variations that allows us to pack as many assets as possible while using as little memory as possible. Once a best configuration is found, it gets written to disk in /data/system/framework_atlas 2. Given a best configuration (algorithm variant, dimensions and number of bitmaps that can be packed in the atlas), the atlas service packs all the preloaded bitmaps into a single graphic buffer object. 3. The packing is done using Skia in a temporary native bitmap. The Skia bitmap is then copied into the graphic buffer using OpenGL ES to benefit from texture swizzling. HOW PROCESSES USE THE ATLAS Whenever a process' hardware renderer initializes its EGL context, it queries the atlas service for the graphic buffer and the map. It is important to remember that both the context and the map will be valid for the lifetime of the hardware renderer (if the system process goes down, all apps get killed as well.) Every time the hardware renderer needs to render a bitmap, it first checks whether the bitmap can be found in the assets atlas. When the bitmap is part of the atlas, texture coordinates are remapped appropriately before rendering. Change-Id: I8eaecf53e7f6a33d90da3d0047c5ceec89ea3af0