summaryrefslogtreecommitdiffstats
path: root/libs/surfaceflinger/LayerDim.cpp
diff options
context:
space:
mode:
authorMathias Agopian <mathias@google.com>2009-08-11 22:34:02 -0700
committerMathias Agopian <mathias@google.com>2009-08-11 23:32:29 -0700
commit5221271375f361b84a6eeec3d7086f223997fbb3 (patch)
treef65cab160cf38b9ed577f1cb5bc2f9882fc8631c /libs/surfaceflinger/LayerDim.cpp
parent40ef81c7fce7cd1b028aec7b8b27b77ce6bf7b90 (diff)
downloadframeworks_native-5221271375f361b84a6eeec3d7086f223997fbb3.zip
frameworks_native-5221271375f361b84a6eeec3d7086f223997fbb3.tar.gz
frameworks_native-5221271375f361b84a6eeec3d7086f223997fbb3.tar.bz2
second take, hopefully this time it doesn't break one of the builds: "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."
Diffstat (limited to 'libs/surfaceflinger/LayerDim.cpp')
-rw-r--r--libs/surfaceflinger/LayerDim.cpp7
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);