summaryrefslogtreecommitdiff
path: root/libs/surfaceflinger/LayerDim.cpp
diff options
context:
space:
mode:
author Mathias Agopian <mathias@google.com> 2009-08-11 22:34:02 -0700
committer Mathias Agopian <mathias@google.com> 2009-08-11 23:32:29 -0700
commit5cec4742b3a1d7448bd32ae57cb4cf70b484c64c (patch)
tree9a3d6adb933fd0947ffc643e3d11f432a4baec4b /libs/surfaceflinger/LayerDim.cpp
parent064dbd076d431a7508b864aa0993cd59ef743e4e (diff)
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 8e9df9cc9bcc..6ebb49f64ca2 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);