summaryrefslogtreecommitdiffstats
path: root/libs/surfaceflinger/LayerBuffer.cpp
diff options
context:
space:
mode:
authorMathias Agopian <mathias@google.com>2009-12-08 19:29:38 -0800
committerMathias Agopian <mathias@google.com>2009-12-08 19:29:38 -0800
commit69ff5de1b7bdc763a77093f829d2aa2c6da99545 (patch)
treefc65df9687a88093b1416557ebeeb25f83f80889 /libs/surfaceflinger/LayerBuffer.cpp
parentac16968db1d225d0c019bb4e782d18c1ea8936f0 (diff)
downloadframeworks_native-69ff5de1b7bdc763a77093f829d2aa2c6da99545.zip
frameworks_native-69ff5de1b7bdc763a77093f829d2aa2c6da99545.tar.gz
frameworks_native-69ff5de1b7bdc763a77093f829d2aa2c6da99545.tar.bz2
improve video performance to minimize the tearing effect seen in 720p movies
always rescale videos to their target size using copybit during yuv->rgb conversion. this improves performance of the GPU pass and doesn't require linear filtering to be enabled. Also always use 16-bits buffers. the average processing time for 720p dropped from ~50ms to ~30ms
Diffstat (limited to 'libs/surfaceflinger/LayerBuffer.cpp')
-rw-r--r--libs/surfaceflinger/LayerBuffer.cpp24
1 files changed, 15 insertions, 9 deletions
diff --git a/libs/surfaceflinger/LayerBuffer.cpp b/libs/surfaceflinger/LayerBuffer.cpp
index eb017bf..137c5c0 100644
--- a/libs/surfaceflinger/LayerBuffer.cpp
+++ b/libs/surfaceflinger/LayerBuffer.cpp
@@ -120,9 +120,7 @@ uint32_t LayerBuffer::doTransaction(uint32_t flags)
source->onTransaction(flags);
uint32_t res = LayerBase::doTransaction(flags);
// we always want filtering for these surfaces
- if (!(mFlags & DisplayHardware::SLOW_CONFIG)) {
- mUseLinearFiltering = true;
- }
+ mUseLinearFiltering = !(mFlags & DisplayHardware::SLOW_CONFIG);
return res;
}
@@ -371,25 +369,33 @@ LayerBuffer::BufferSource::BufferSource(LayerBuffer& layer,
// note that the size of this buffer doesn't really matter,
// the final image will always be drawn with proper aspect ratio.
- int w = buffers.w;
- int h = buffers.h;
+ int w = layer.mTransformedBounds.width();
+ int h = layer.mTransformedBounds.height();
+ if (buffers.w * h != buffers.h * w) {
+ int t = w; w = h; h = t;
+ }
+ if (buffers.w * h == buffers.h * w) {
+ // same pixel area, don't use filtering
+ layer.mUseLinearFiltering = false;
+ }
+
mTempGraphicBuffer.clear();
mTempGraphicBuffer = new GraphicBuffer(
- w, h, HAL_PIXEL_FORMAT_RGBX_8888,
+ w, h, HAL_PIXEL_FORMAT_RGB_565,
GraphicBuffer::USAGE_HW_TEXTURE |
GraphicBuffer::USAGE_HW_2D);
if (mTempGraphicBuffer->initCheck() == NO_ERROR) {
NativeBuffer& dst(mTempBuffer);
dst.img.w = mTempGraphicBuffer->getStride();
- dst.img.h = mTempGraphicBuffer->getHeight();
+ dst.img.h = h;
dst.img.format = mTempGraphicBuffer->getPixelFormat();
dst.img.handle = (native_handle_t *)mTempGraphicBuffer->handle;
dst.img.base = 0;
dst.crop.l = 0;
dst.crop.t = 0;
- dst.crop.r = mTempGraphicBuffer->getWidth();
- dst.crop.b = mTempGraphicBuffer->getHeight();
+ dst.crop.r = w;
+ dst.crop.b = h;
} else {
mTempGraphicBuffer.clear();
}