The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2007 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
Mathias Agopian | 90ac799 | 2012-02-25 18:48:35 -0800 | [diff] [blame] | 17 | #ifndef ANDROID_GUI_SURFACE_COMPOSER_CLIENT_H |
| 18 | #define ANDROID_GUI_SURFACE_COMPOSER_CLIENT_H |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 19 | |
| 20 | #include <stdint.h> |
| 21 | #include <sys/types.h> |
| 22 | |
Mathias Agopian | dd3423c | 2009-09-23 15:44:05 -0700 | [diff] [blame] | 23 | #include <binder/IBinder.h> |
Mathias Agopian | 6d9b9df | 2013-02-13 15:26:48 -0800 | [diff] [blame] | 24 | #include <binder/IMemory.h> |
Mathias Agopian | dd3423c | 2009-09-23 15:44:05 -0700 | [diff] [blame] | 25 | |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 26 | #include <utils/RefBase.h> |
Mathias Agopian | b7e930d | 2010-06-01 15:12:58 -0700 | [diff] [blame] | 27 | #include <utils/Singleton.h> |
| 28 | #include <utils/SortedVector.h> |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 29 | #include <utils/threads.h> |
| 30 | |
Svetoslav | d85084b | 2014-03-20 10:28:31 -0700 | [diff] [blame] | 31 | #include <ui/FrameStats.h> |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 32 | #include <ui/PixelFormat.h> |
Mathias Agopian | 9cce325 | 2010-02-09 17:46:37 -0800 | [diff] [blame] | 33 | |
Mathias Agopian | abe815d | 2013-03-19 22:22:21 -0700 | [diff] [blame] | 34 | #include <gui/CpuConsumer.h> |
Mathias Agopian | e3c697f | 2013-02-14 17:11:02 -0800 | [diff] [blame] | 35 | #include <gui/SurfaceControl.h> |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 36 | |
| 37 | namespace android { |
| 38 | |
| 39 | // --------------------------------------------------------------------------- |
| 40 | |
Colin Cross | a2362b4 | 2016-09-26 13:48:25 -0700 | [diff] [blame] | 41 | struct DisplayInfo; |
Mathias Agopian | 698c087 | 2011-06-28 19:09:31 -0700 | [diff] [blame] | 42 | class Composer; |
Dan Stoza | c4f471e | 2016-03-24 09:31:08 -0700 | [diff] [blame] | 43 | class HdrCapabilities; |
Mathias Agopian | 41f673c | 2011-11-17 17:48:35 -0800 | [diff] [blame] | 44 | class ISurfaceComposerClient; |
Andy McFadden | 2adaf04 | 2012-12-18 09:49:45 -0800 | [diff] [blame] | 45 | class IGraphicBufferProducer; |
Mathias Agopian | a67932f | 2011-04-20 14:20:59 -0700 | [diff] [blame] | 46 | class Region; |
Mathias Agopian | b7e930d | 2010-06-01 15:12:58 -0700 | [diff] [blame] | 47 | |
| 48 | // --------------------------------------------------------------------------- |
| 49 | |
Mathias Agopian | d4784a3 | 2010-05-27 19:41:15 -0700 | [diff] [blame] | 50 | class SurfaceComposerClient : public RefBase |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 51 | { |
Mathias Agopian | 698c087 | 2011-06-28 19:09:31 -0700 | [diff] [blame] | 52 | friend class Composer; |
Jesse Hall | 6c913be | 2013-08-08 12:15:49 -0700 | [diff] [blame] | 53 | public: |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 54 | SurfaceComposerClient(); |
Robert Carr | 1db73f6 | 2016-12-21 12:58:51 -0800 | [diff] [blame] | 55 | SurfaceComposerClient(const sp<IGraphicBufferProducer>& parent); |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 56 | virtual ~SurfaceComposerClient(); |
| 57 | |
| 58 | // Always make sure we could initialize |
| 59 | status_t initCheck() const; |
| 60 | |
| 61 | // Return the connection of this client |
| 62 | sp<IBinder> connection() const; |
Jesse Hall | 6c913be | 2013-08-08 12:15:49 -0700 | [diff] [blame] | 63 | |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 64 | // Forcibly remove connection before all references have gone away. |
| 65 | void dispose(); |
| 66 | |
Mathias Agopian | e57f292 | 2012-08-09 16:29:12 -0700 | [diff] [blame] | 67 | // callback when the composer is dies |
| 68 | status_t linkToComposerDeath(const sp<IBinder::DeathRecipient>& recipient, |
| 69 | void* cookie = NULL, uint32_t flags = 0); |
| 70 | |
Dan Stoza | 7f7da32 | 2014-05-02 15:26:25 -0700 | [diff] [blame] | 71 | // Get a list of supported configurations for a given display |
| 72 | static status_t getDisplayConfigs(const sp<IBinder>& display, |
| 73 | Vector<DisplayInfo>* configs); |
| 74 | |
| 75 | // Get the DisplayInfo for the currently-active configuration |
| 76 | static status_t getDisplayInfo(const sp<IBinder>& display, |
| 77 | DisplayInfo* info); |
| 78 | |
| 79 | // Get the index of the current active configuration (relative to the list |
| 80 | // returned by getDisplayInfo) |
| 81 | static int getActiveConfig(const sp<IBinder>& display); |
| 82 | |
| 83 | // Set a new active configuration using an index relative to the list |
| 84 | // returned by getDisplayInfo |
| 85 | static status_t setActiveConfig(const sp<IBinder>& display, int id); |
Mathias Agopian | e57f292 | 2012-08-09 16:29:12 -0700 | [diff] [blame] | 86 | |
Michael Wright | 28f24d0 | 2016-07-12 13:30:53 -0700 | [diff] [blame] | 87 | // Gets the list of supported color modes for the given display |
| 88 | static status_t getDisplayColorModes(const sp<IBinder>& display, |
| 89 | Vector<android_color_mode_t>* outColorModes); |
| 90 | |
| 91 | // Gets the active color mode for the given display |
| 92 | static android_color_mode_t getActiveColorMode(const sp<IBinder>& display); |
| 93 | |
| 94 | // Sets the active color mode for the given display |
| 95 | static status_t setActiveColorMode(const sp<IBinder>& display, android_color_mode_t colorMode); |
| 96 | |
Prashant Malani | 2c9b11f | 2014-05-25 01:36:31 -0700 | [diff] [blame] | 97 | /* Triggers screen on/off or low power mode and waits for it to complete */ |
| 98 | static void setDisplayPowerMode(const sp<IBinder>& display, int mode); |
Jeff Brown | 2a09bb3 | 2012-10-08 19:13:57 -0700 | [diff] [blame] | 99 | |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 100 | // ------------------------------------------------------------------------ |
| 101 | // surface creation / destruction |
| 102 | |
| 103 | //! Create a surface |
Mathias Agopian | 01b7668 | 2009-04-16 20:04:08 -0700 | [diff] [blame] | 104 | sp<SurfaceControl> createSurface( |
Mathias Agopian | 285dbde | 2010-03-01 16:09:43 -0800 | [diff] [blame] | 105 | const String8& name,// name of the surface |
Mathias Agopian | cbb288b | 2009-09-07 16:32:45 -0700 | [diff] [blame] | 106 | uint32_t w, // width in pixel |
| 107 | uint32_t h, // height in pixel |
| 108 | PixelFormat format, // pixel-format desired |
Albert Chaulk | 479c60c | 2017-01-27 14:21:34 -0500 | [diff] [blame] | 109 | uint32_t flags = 0, // usage flags |
| 110 | SurfaceControl* parent = nullptr, // parent |
| 111 | uint32_t windowType = 0, // from WindowManager.java (STATUS_BAR, INPUT_METHOD, etc.) |
| 112 | uint32_t ownerUid = 0 // UID of the task |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 113 | ); |
| 114 | |
Jesse Hall | 6c913be | 2013-08-08 12:15:49 -0700 | [diff] [blame] | 115 | //! Create a virtual display |
Jamie Gennis | dd3cb84 | 2012-10-19 18:19:11 -0700 | [diff] [blame] | 116 | static sp<IBinder> createDisplay(const String8& displayName, bool secure); |
Mathias Agopian | 285dbde | 2010-03-01 16:09:43 -0800 | [diff] [blame] | 117 | |
Jesse Hall | 6c913be | 2013-08-08 12:15:49 -0700 | [diff] [blame] | 118 | //! Destroy a virtual display |
| 119 | static void destroyDisplay(const sp<IBinder>& display); |
| 120 | |
Jeff Brown | 9d4e3d2 | 2012-08-24 20:00:51 -0700 | [diff] [blame] | 121 | //! Get the token for the existing default displays. |
| 122 | //! Possible values for id are eDisplayIdMain and eDisplayIdHdmi. |
| 123 | static sp<IBinder> getBuiltInDisplay(int32_t id); |
| 124 | |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 125 | // ------------------------------------------------------------------------ |
| 126 | // Composer parameters |
| 127 | // All composer parameters must be changed within a transaction |
| 128 | // several surfaces can be updated in one transaction, all changes are |
| 129 | // committed at once when the transaction is closed. |
Mathias Agopian | e57f292 | 2012-08-09 16:29:12 -0700 | [diff] [blame] | 130 | // closeGlobalTransaction() requires an IPC with the server. |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 131 | |
| 132 | //! Open a composer transaction on all active SurfaceComposerClients. |
| 133 | static void openGlobalTransaction(); |
Jamie Gennis | 2d5e230 | 2012-10-15 18:24:43 -0700 | [diff] [blame] | 134 | |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 135 | //! Close a composer transaction on all active SurfaceComposerClients. |
Jamie Gennis | 2837839 | 2011-10-12 17:39:00 -0700 | [diff] [blame] | 136 | static void closeGlobalTransaction(bool synchronous = false); |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 137 | |
Sahil Dhanju | c1ba5c4 | 2016-06-07 20:09:20 -0700 | [diff] [blame] | 138 | static status_t enableVSyncInjections(bool enable); |
| 139 | |
| 140 | static status_t injectVSync(nsecs_t when); |
| 141 | |
Jamie Gennis | 2d5e230 | 2012-10-15 18:24:43 -0700 | [diff] [blame] | 142 | //! Flag the currently open transaction as an animation transaction. |
| 143 | static void setAnimationTransaction(); |
| 144 | |
Mathias Agopian | ac9fa42 | 2013-02-11 16:40:36 -0800 | [diff] [blame] | 145 | status_t hide(const sp<IBinder>& id); |
| 146 | status_t show(const sp<IBinder>& id); |
| 147 | status_t setFlags(const sp<IBinder>& id, uint32_t flags, uint32_t mask); |
| 148 | status_t setTransparentRegionHint(const sp<IBinder>& id, const Region& transparent); |
Robert Carr | ae06083 | 2016-11-28 10:51:00 -0800 | [diff] [blame] | 149 | status_t setLayer(const sp<IBinder>& id, int32_t layer); |
Mathias Agopian | ac9fa42 | 2013-02-11 16:40:36 -0800 | [diff] [blame] | 150 | status_t setAlpha(const sp<IBinder>& id, float alpha=1.0f); |
| 151 | status_t setMatrix(const sp<IBinder>& id, float dsdx, float dtdx, float dsdy, float dtdy); |
| 152 | status_t setPosition(const sp<IBinder>& id, float x, float y); |
| 153 | status_t setSize(const sp<IBinder>& id, uint32_t w, uint32_t h); |
| 154 | status_t setCrop(const sp<IBinder>& id, const Rect& crop); |
Pablo Ceballos | acbe678 | 2016-03-04 17:54:21 +0000 | [diff] [blame] | 155 | status_t setFinalCrop(const sp<IBinder>& id, const Rect& crop); |
Mathias Agopian | ac9fa42 | 2013-02-11 16:40:36 -0800 | [diff] [blame] | 156 | status_t setLayerStack(const sp<IBinder>& id, uint32_t layerStack); |
Dan Stoza | 7dde599 | 2015-05-22 09:51:44 -0700 | [diff] [blame] | 157 | status_t deferTransactionUntil(const sp<IBinder>& id, |
| 158 | const sp<IBinder>& handle, uint64_t frameNumber); |
Robert Carr | 1db73f6 | 2016-12-21 12:58:51 -0800 | [diff] [blame] | 159 | status_t reparentChildren(const sp<IBinder>& id, |
| 160 | const sp<IBinder>& newParentHandle); |
Robert Carr | c3574f7 | 2016-03-24 12:19:32 -0700 | [diff] [blame] | 161 | status_t setOverrideScalingMode(const sp<IBinder>& id, |
| 162 | int32_t overrideScalingMode); |
Robert Carr | 99e27f0 | 2016-06-16 15:18:02 -0700 | [diff] [blame] | 163 | status_t setGeometryAppliesWithResize(const sp<IBinder>& id); |
Robert Carr | 82364e3 | 2016-05-15 11:27:47 -0700 | [diff] [blame] | 164 | |
Mathias Agopian | ac9fa42 | 2013-02-11 16:40:36 -0800 | [diff] [blame] | 165 | status_t destroySurface(const sp<IBinder>& id); |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 166 | |
Svetoslav | d85084b | 2014-03-20 10:28:31 -0700 | [diff] [blame] | 167 | status_t clearLayerFrameStats(const sp<IBinder>& token) const; |
| 168 | status_t getLayerFrameStats(const sp<IBinder>& token, FrameStats* outStats) const; |
| 169 | |
Robert Carr | 367c568 | 2016-06-20 11:55:28 -0700 | [diff] [blame] | 170 | status_t getTransformToDisplayInverse(const sp<IBinder>& token, |
| 171 | bool* outTransformToDisplayInverse) const; |
| 172 | |
Svetoslav | d85084b | 2014-03-20 10:28:31 -0700 | [diff] [blame] | 173 | static status_t clearAnimationFrameStats(); |
| 174 | static status_t getAnimationFrameStats(FrameStats* outStats); |
| 175 | |
Dan Stoza | c4f471e | 2016-03-24 09:31:08 -0700 | [diff] [blame] | 176 | static status_t getHdrCapabilities(const sp<IBinder>& display, |
| 177 | HdrCapabilities* outCapabilities); |
| 178 | |
Pablo Ceballos | 1aad24c | 2016-08-04 10:24:22 -0700 | [diff] [blame] | 179 | static status_t setDisplaySurface(const sp<IBinder>& token, |
| 180 | sp<IGraphicBufferProducer> bufferProducer); |
Mathias Agopian | e57f292 | 2012-08-09 16:29:12 -0700 | [diff] [blame] | 181 | static void setDisplayLayerStack(const sp<IBinder>& token, |
| 182 | uint32_t layerStack); |
Michael Wright | 1f6078a | 2014-06-26 16:01:02 -0700 | [diff] [blame] | 183 | static void setDisplaySize(const sp<IBinder>& token, uint32_t width, uint32_t height); |
Mathias Agopian | 00e8c7a | 2012-09-04 19:30:46 -0700 | [diff] [blame] | 184 | |
| 185 | /* setDisplayProjection() defines the projection of layer stacks |
| 186 | * to a given display. |
| 187 | * |
| 188 | * - orientation defines the display's orientation. |
| 189 | * - layerStackRect defines which area of the window manager coordinate |
| 190 | * space will be used. |
| 191 | * - displayRect defines where on the display will layerStackRect be |
| 192 | * mapped to. displayRect is specified post-orientation, that is |
| 193 | * it uses the orientation seen by the end-user. |
| 194 | */ |
| 195 | static void setDisplayProjection(const sp<IBinder>& token, |
| 196 | uint32_t orientation, |
| 197 | const Rect& layerStackRect, |
| 198 | const Rect& displayRect); |
Mathias Agopian | e57f292 | 2012-08-09 16:29:12 -0700 | [diff] [blame] | 199 | |
Mathias Agopian | 631f358 | 2010-05-25 17:51:34 -0700 | [diff] [blame] | 200 | private: |
Mathias Agopian | d4784a3 | 2010-05-27 19:41:15 -0700 | [diff] [blame] | 201 | virtual void onFirstRef(); |
Mathias Agopian | 698c087 | 2011-06-28 19:09:31 -0700 | [diff] [blame] | 202 | Composer& getComposer(); |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 203 | |
Mathias Agopian | 698c087 | 2011-06-28 19:09:31 -0700 | [diff] [blame] | 204 | mutable Mutex mLock; |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 205 | status_t mStatus; |
Mathias Agopian | 7e27f05 | 2010-05-28 14:22:23 -0700 | [diff] [blame] | 206 | sp<ISurfaceComposerClient> mClient; |
Mathias Agopian | 698c087 | 2011-06-28 19:09:31 -0700 | [diff] [blame] | 207 | Composer& mComposer; |
Robert Carr | 1db73f6 | 2016-12-21 12:58:51 -0800 | [diff] [blame] | 208 | wp<IGraphicBufferProducer> mParent; |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 209 | }; |
| 210 | |
Mathias Agopian | d4784a3 | 2010-05-27 19:41:15 -0700 | [diff] [blame] | 211 | // --------------------------------------------------------------------------- |
Mathias Agopian | 74c40c0 | 2010-09-29 13:02:36 -0700 | [diff] [blame] | 212 | |
| 213 | class ScreenshotClient |
| 214 | { |
Mathias Agopian | 2a9fc49 | 2013-03-01 13:42:57 -0800 | [diff] [blame] | 215 | public: |
Dan Stoza | c187900 | 2014-05-22 15:59:05 -0700 | [diff] [blame] | 216 | // if cropping isn't required, callers may pass in a default Rect, e.g.: |
| 217 | // capture(display, producer, Rect(), reqWidth, ...); |
Mathias Agopian | 2a9fc49 | 2013-03-01 13:42:57 -0800 | [diff] [blame] | 218 | static status_t capture( |
| 219 | const sp<IBinder>& display, |
| 220 | const sp<IGraphicBufferProducer>& producer, |
Dan Stoza | c187900 | 2014-05-22 15:59:05 -0700 | [diff] [blame] | 221 | Rect sourceCrop, uint32_t reqWidth, uint32_t reqHeight, |
Robert Carr | ae06083 | 2016-11-28 10:51:00 -0800 | [diff] [blame] | 222 | int32_t minLayerZ, int32_t maxLayerZ, |
Dan Stoza | c701401 | 2014-02-14 15:03:43 -0800 | [diff] [blame] | 223 | bool useIdentityTransform); |
Robert Carr | 673134e | 2017-01-09 19:48:38 -0800 | [diff] [blame] | 224 | static status_t captureToBuffer( |
| 225 | const sp<IBinder>& display, |
| 226 | Rect sourceCrop, uint32_t reqWidth, uint32_t reqHeight, |
Robert Carr | ae06083 | 2016-11-28 10:51:00 -0800 | [diff] [blame] | 227 | int32_t minLayerZ, int32_t maxLayerZ, |
Robert Carr | 673134e | 2017-01-09 19:48:38 -0800 | [diff] [blame] | 228 | bool useIdentityTransform, |
| 229 | uint32_t rotation, |
| 230 | sp<GraphicBuffer>* outbuffer); |
Mathias Agopian | 2a9fc49 | 2013-03-01 13:42:57 -0800 | [diff] [blame] | 231 | private: |
Mathias Agopian | abe815d | 2013-03-19 22:22:21 -0700 | [diff] [blame] | 232 | mutable sp<CpuConsumer> mCpuConsumer; |
Dan Stoza | 6d5a7bb | 2014-03-13 11:39:09 -0700 | [diff] [blame] | 233 | mutable sp<IGraphicBufferProducer> mProducer; |
Mathias Agopian | abe815d | 2013-03-19 22:22:21 -0700 | [diff] [blame] | 234 | CpuConsumer::LockedBuffer mBuffer; |
| 235 | bool mHaveBuffer; |
Mathias Agopian | 2a9fc49 | 2013-03-01 13:42:57 -0800 | [diff] [blame] | 236 | |
Mathias Agopian | 74c40c0 | 2010-09-29 13:02:36 -0700 | [diff] [blame] | 237 | public: |
| 238 | ScreenshotClient(); |
Mathias Agopian | 8000d06 | 2013-03-26 18:15:35 -0700 | [diff] [blame] | 239 | ~ScreenshotClient(); |
Mathias Agopian | 74c40c0 | 2010-09-29 13:02:36 -0700 | [diff] [blame] | 240 | |
Dan Stoza | c187900 | 2014-05-22 15:59:05 -0700 | [diff] [blame] | 241 | // frees the previous screenshot and captures a new one |
| 242 | // if cropping isn't required, callers may pass in a default Rect, e.g.: |
| 243 | // update(display, Rect(), useIdentityTransform); |
Jeff Brown | 9d4e3d2 | 2012-08-24 20:00:51 -0700 | [diff] [blame] | 244 | status_t update(const sp<IBinder>& display, |
Dan Stoza | c187900 | 2014-05-22 15:59:05 -0700 | [diff] [blame] | 245 | Rect sourceCrop, bool useIdentityTransform); |
| 246 | status_t update(const sp<IBinder>& display, |
| 247 | Rect sourceCrop, uint32_t reqWidth, uint32_t reqHeight, |
Dan Stoza | c701401 | 2014-02-14 15:03:43 -0800 | [diff] [blame] | 248 | bool useIdentityTransform); |
| 249 | status_t update(const sp<IBinder>& display, |
Dan Stoza | c187900 | 2014-05-22 15:59:05 -0700 | [diff] [blame] | 250 | Rect sourceCrop, uint32_t reqWidth, uint32_t reqHeight, |
Robert Carr | ae06083 | 2016-11-28 10:51:00 -0800 | [diff] [blame] | 251 | int32_t minLayerZ, int32_t maxLayerZ, |
Dan Stoza | c701401 | 2014-02-14 15:03:43 -0800 | [diff] [blame] | 252 | bool useIdentityTransform); |
Riley Andrews | d15ef27 | 2014-09-04 16:19:44 -0700 | [diff] [blame] | 253 | status_t update(const sp<IBinder>& display, |
| 254 | Rect sourceCrop, uint32_t reqWidth, uint32_t reqHeight, |
Robert Carr | ae06083 | 2016-11-28 10:51:00 -0800 | [diff] [blame] | 255 | int32_t minLayerZ, int32_t maxLayerZ, |
Riley Andrews | d15ef27 | 2014-09-04 16:19:44 -0700 | [diff] [blame] | 256 | bool useIdentityTransform, uint32_t rotation); |
Mathias Agopian | 74c40c0 | 2010-09-29 13:02:36 -0700 | [diff] [blame] | 257 | |
Mathias Agopian | abe815d | 2013-03-19 22:22:21 -0700 | [diff] [blame] | 258 | sp<CpuConsumer> getCpuConsumer() const; |
| 259 | |
Mathias Agopian | 74c40c0 | 2010-09-29 13:02:36 -0700 | [diff] [blame] | 260 | // release memory occupied by the screenshot |
| 261 | void release(); |
| 262 | |
| 263 | // pixels are valid until this object is freed or |
| 264 | // release() or update() is called |
| 265 | void const* getPixels() const; |
| 266 | |
| 267 | uint32_t getWidth() const; |
| 268 | uint32_t getHeight() const; |
| 269 | PixelFormat getFormat() const; |
| 270 | uint32_t getStride() const; |
| 271 | // size of allocated memory in bytes |
| 272 | size_t getSize() const; |
| 273 | }; |
| 274 | |
| 275 | // --------------------------------------------------------------------------- |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 276 | }; // namespace android |
| 277 | |
Mathias Agopian | 90ac799 | 2012-02-25 18:48:35 -0800 | [diff] [blame] | 278 | #endif // ANDROID_GUI_SURFACE_COMPOSER_CLIENT_H |