diff options
author | Mathias Agopian <mathias@google.com> | 2009-08-10 21:59:56 -0700 |
---|---|---|
committer | Mathias Agopian <mathias@google.com> | 2009-08-11 16:12:56 -0700 |
commit | 8b76a0ac6fbf07254629ed1ea86af014d5abe050 (patch) | |
tree | e492e09655269fff3ca14b6a62f9b07f2d484038 /libs/surfaceflinger/LayerDim.cpp | |
parent | c5ea43920919eeaec4ec0686de9fa3d034d82337 (diff) | |
download | frameworks_base-8b76a0ac6fbf07254629ed1ea86af014d5abe050.zip frameworks_base-8b76a0ac6fbf07254629ed1ea86af014d5abe050.tar.gz frameworks_base-8b76a0ac6fbf07254629ed1ea86af014d5abe050.tar.bz2 |
SurfaceFlinger will now allocate buffers based on the usage specified by the clients. This allows to allocate the right kind of buffer automatically, without having the user to specify anything.
This change makes SurfaceHolder.setType(GPU) obsolete (it's now ignored).
Added an API to android_native_window_t to allow extending the functionality without ever breaking binary compatibility. This is used to implement the new set_usage() API. This API needs to be called by software renderers because the default is to use usage flags suitable for h/w.
Diffstat (limited to 'libs/surfaceflinger/LayerDim.cpp')
-rw-r--r-- | libs/surfaceflinger/LayerDim.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/libs/surfaceflinger/LayerDim.cpp b/libs/surfaceflinger/LayerDim.cpp index 8e9df9c..6ebb49f 100644 --- a/libs/surfaceflinger/LayerDim.cpp +++ b/libs/surfaceflinger/LayerDim.cpp @@ -21,6 +21,7 @@ #include <utils/Errors.h> #include <utils/Log.h> +#include "BufferAllocator.h" #include "LayerDim.h" #include "SurfaceFlinger.h" #include "DisplayHardware/DisplayHardware.h" @@ -68,7 +69,11 @@ void LayerDim::initDimmer(SurfaceFlinger* flinger, uint32_t w, uint32_t h) if (LIKELY(flags & DisplayHardware::DIRECT_TEXTURE)) { // TODO: api to pass the usage flags - sp<Buffer> buffer = new Buffer(w, h, PIXEL_FORMAT_RGB_565); + sp<Buffer> buffer = new Buffer(w, h, PIXEL_FORMAT_RGB_565, + BufferAllocator::USAGE_SW_WRITE_OFTEN | + BufferAllocator::USAGE_HW_TEXTURE | + BufferAllocator::USAGE_HW_2D); + android_native_buffer_t* clientBuf = buffer->getNativeBuffer(); glGenTextures(1, &sTexId); |