OSDN Git Service

rework how we take screenshots for a CPU consumer
authorMathias Agopian <mathias@google.com>
Wed, 20 Mar 2013 05:22:21 +0000 (22:22 -0700)
committerMathias Agopian <mathias@google.com>
Wed, 20 Mar 2013 05:22:21 +0000 (22:22 -0700)
commitabe815dd6978b718c04f6e22e1a893d2b51d11a1
treeacef7520d6c36ec59192321ce8632b70a58724ab
parent9cd766a517caeb58669722fad7fdf623a8c1b83c
rework how we take screenshots for a CPU consumer

We're not using IMemoryHeap as a transport anymore,
instead we're providing a CpuConsumer and use the
IGraphicBufferProducer version of the screenshot API.

However, some GPU drivers don't support properly
a GPU to CPU path, to work around this, we use a
temporary BufferQueue on the server side for the
GL rendering, and we use glReadPixels into the
CpuConsumer (we're now using a CPU to CPU path
which is always supported).

Currently this "wrapping" is always performed,
but it can be bypassed on devices that support
the GPU to CPU path.

This also addresses a DoS attack vector on
SurfaceFlinger, where an application could
consume all of SF's filedescriptors by creating
a lot of screenshots in a row.

Bug: 8390553

Change-Id: I9e81514c2a7711b9bb393f74305be7d2abe08f1c
include/gui/ISurfaceComposer.h
include/gui/SurfaceComposerClient.h
libs/gui/ISurfaceComposer.cpp
libs/gui/SurfaceComposerClient.cpp
services/surfaceflinger/SurfaceFlinger.cpp
services/surfaceflinger/SurfaceFlinger.h