From abe815dd6978b718c04f6e22e1a893d2b51d11a1 Mon Sep 17 00:00:00 2001 From: Mathias Agopian Date: Tue, 19 Mar 2013 22:22:21 -0700 Subject: 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 | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) (limited to 'include/gui/ISurfaceComposer.h') diff --git a/include/gui/ISurfaceComposer.h b/include/gui/ISurfaceComposer.h index 47f955282c..9018b87a25 100644 --- a/include/gui/ISurfaceComposer.h +++ b/include/gui/ISurfaceComposer.h @@ -95,14 +95,6 @@ public: virtual bool authenticateSurfaceTexture( const sp& surface) const = 0; - /* Capture the specified screen. requires READ_FRAME_BUFFER permission - * This function will fail if there is a secure window on screen. - */ - virtual status_t captureScreen(const sp& display, sp* heap, - uint32_t* width, uint32_t* height, PixelFormat* format, - uint32_t reqWidth, uint32_t reqHeight, - uint32_t minLayerZ, uint32_t maxLayerZ) = 0; - /* triggers screen off and waits for it to complete * requires ACCESS_SURFACE_FLINGER permission. */ @@ -123,7 +115,8 @@ public: virtual status_t captureScreen(const sp& display, const sp& producer, uint32_t reqWidth, uint32_t reqHeight, - uint32_t minLayerZ, uint32_t maxLayerZ) = 0; + uint32_t minLayerZ, uint32_t maxLayerZ, + bool isCpuConsumer) = 0; }; // ---------------------------------------------------------------------------- @@ -141,7 +134,6 @@ public: GET_BUILT_IN_DISPLAY, SET_TRANSACTION_STATE, AUTHENTICATE_SURFACE, - CAPTURE_SCREEN_DEPRECATED, BLANK, UNBLANK, GET_DISPLAY_INFO, -- cgit v1.2.3-59-g8ed1b