| 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 | |
| Dan Stoza | a615e47 | 2017-03-23 14:41:55 -0700 | [diff] [blame] | 17 | #pragma once |
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 18 | |
| Mathias Agopian | 9cce325 | 2010-02-09 17:46:37 -0800 | [diff] [blame] | 19 | #include <binder/IInterface.h> |
| Dan Stoza | a615e47 | 2017-03-23 14:41:55 -0700 | [diff] [blame] | 20 | #include <binder/SafeInterface.h> |
| Evan Rosky | 1f6d6d5 | 2018-12-06 10:47:26 -0800 | [diff] [blame] | 21 | #include <gui/LayerMetadata.h> |
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 22 | #include <ui/PixelFormat.h> |
| Mathias Agopian | 7e27f05 | 2010-05-28 14:22:23 -0700 | [diff] [blame] | 23 | |
| Evan Rosky | 1f6d6d5 | 2018-12-06 10:47:26 -0800 | [diff] [blame] | 24 | #include <unordered_map> |
| 25 | |
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 26 | namespace android { |
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 27 | |
| Dan Stoza | a615e47 | 2017-03-23 14:41:55 -0700 | [diff] [blame] | 28 | class FrameStats; |
| Mathias Agopian | 4d9b822 | 2013-03-12 17:11:48 -0700 | [diff] [blame] | 29 | class IGraphicBufferProducer; |
| 30 | |
| Dan Stoza | a615e47 | 2017-03-23 14:41:55 -0700 | [diff] [blame] | 31 | class ISurfaceComposerClient : public IInterface { |
| Mathias Agopian | 7e27f05 | 2010-05-28 14:22:23 -0700 | [diff] [blame] | 32 | public: |
| Colin Cross | 17576de | 2016-09-26 13:07:06 -0700 | [diff] [blame] | 33 | DECLARE_META_INTERFACE(SurfaceComposerClient) |
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 34 | |
| Mathias Agopian | 3165cc2 | 2012-08-08 19:42:09 -0700 | [diff] [blame] | 35 | // flags for createSurface() |
| Vishnu Nair | c43a23c | 2020-05-29 14:32:27 -0700 | [diff] [blame] | 36 | enum { // (keep in sync with SurfaceControl.java) |
| Dan Stoza | a615e47 | 2017-03-23 14:41:55 -0700 | [diff] [blame] | 37 | eHidden = 0x00000004, |
| 38 | eDestroyBackbuffer = 0x00000020, |
| chaviw | c5676c6 | 2020-09-18 15:01:04 -0700 | [diff] [blame] | 39 | eSkipScreenshot = 0x00000040, |
| Dan Stoza | a615e47 | 2017-03-23 14:41:55 -0700 | [diff] [blame] | 40 | eSecure = 0x00000080, |
| 41 | eNonPremultiplied = 0x00000100, |
| 42 | eOpaque = 0x00000400, |
| 43 | eProtectedByApp = 0x00000800, |
| 44 | eProtectedByDRM = 0x00001000, |
| 45 | eCursorWindow = 0x00002000, |
| Vishnu Nair | c43a23c | 2020-05-29 14:32:27 -0700 | [diff] [blame] | 46 | eNoColorFill = 0x00004000, |
| Mathias Agopian | 3165cc2 | 2012-08-08 19:42:09 -0700 | [diff] [blame] | 47 | |
| Marissa Wall | 61c5862 | 2018-07-18 10:12:20 -0700 | [diff] [blame] | 48 | eFXSurfaceBufferQueue = 0x00000000, |
| Vishnu Nair | fa247b1 | 2020-02-11 08:58:26 -0800 | [diff] [blame] | 49 | eFXSurfaceEffect = 0x00020000, |
| Marissa Wall | 61c5862 | 2018-07-18 10:12:20 -0700 | [diff] [blame] | 50 | eFXSurfaceBufferState = 0x00040000, |
| Robert Carr | 6b3f6c5 | 2018-08-13 13:05:17 -0700 | [diff] [blame] | 51 | eFXSurfaceContainer = 0x00080000, |
| Dan Stoza | a615e47 | 2017-03-23 14:41:55 -0700 | [diff] [blame] | 52 | eFXSurfaceMask = 0x000F0000, |
| Mathias Agopian | 3165cc2 | 2012-08-08 19:42:09 -0700 | [diff] [blame] | 53 | }; |
| 54 | |
| Adithya Srinivasan | 9febda8 | 2020-10-19 10:49:41 -0700 | [diff] [blame] | 55 | // TODO(b/172002646): Clean up the Surface Creation Arguments |
| Mathias Agopian | cc08e68 | 2010-04-15 18:48:26 -0700 | [diff] [blame] | 56 | /* |
| 57 | * Requires ACCESS_SURFACE_FLINGER permission |
| 58 | */ |
| Dan Stoza | a615e47 | 2017-03-23 14:41:55 -0700 | [diff] [blame] | 59 | virtual status_t createSurface(const String8& name, uint32_t w, uint32_t h, PixelFormat format, |
| Evan Rosky | 1f6d6d5 | 2018-12-06 10:47:26 -0800 | [diff] [blame] | 60 | uint32_t flags, const sp<IBinder>& parent, |
| 61 | LayerMetadata metadata, sp<IBinder>* handle, |
| Ady Abraham | 9f0a400 | 2020-10-05 15:47:26 -0700 | [diff] [blame] | 62 | sp<IGraphicBufferProducer>* gbp, int32_t* outLayerId, |
| Pablo Gamito | 2ec1f7b | 2020-09-01 14:18:49 +0000 | [diff] [blame] | 63 | uint32_t* outTransformHint) = 0; |
| Mathias Agopian | 7e27f05 | 2010-05-28 14:22:23 -0700 | [diff] [blame] | 64 | |
| Mathias Agopian | cc08e68 | 2010-04-15 18:48:26 -0700 | [diff] [blame] | 65 | /* |
| 66 | * Requires ACCESS_SURFACE_FLINGER permission |
| 67 | */ |
| Marissa Wall | 35187b3 | 2019-01-08 10:08:52 -0800 | [diff] [blame] | 68 | virtual status_t createWithSurfaceParent(const String8& name, uint32_t w, uint32_t h, |
| 69 | PixelFormat format, uint32_t flags, |
| 70 | const sp<IGraphicBufferProducer>& parent, |
| Evan Rosky | 1f6d6d5 | 2018-12-06 10:47:26 -0800 | [diff] [blame] | 71 | LayerMetadata metadata, sp<IBinder>* handle, |
| Ady Abraham | 9f0a400 | 2020-10-05 15:47:26 -0700 | [diff] [blame] | 72 | sp<IGraphicBufferProducer>* gbp, int32_t* outLayerId, |
| Valerie Hau | 1acd696 | 2019-10-28 16:35:48 -0700 | [diff] [blame] | 73 | uint32_t* outTransformHint) = 0; |
| Marissa Wall | 35187b3 | 2019-01-08 10:08:52 -0800 | [diff] [blame] | 74 | |
| 75 | /* |
| 76 | * Requires ACCESS_SURFACE_FLINGER permission |
| 77 | */ |
| Svetoslav | d85084b | 2014-03-20 10:28:31 -0700 | [diff] [blame] | 78 | virtual status_t clearLayerFrameStats(const sp<IBinder>& handle) const = 0; |
| 79 | |
| 80 | /* |
| 81 | * Requires ACCESS_SURFACE_FLINGER permission |
| 82 | */ |
| 83 | virtual status_t getLayerFrameStats(const sp<IBinder>& handle, FrameStats* outStats) const = 0; |
| chaviw | fe94a22 | 2019-08-21 13:52:59 -0700 | [diff] [blame] | 84 | |
| Pablo Gamito | 2ec1f7b | 2020-09-01 14:18:49 +0000 | [diff] [blame] | 85 | virtual status_t mirrorSurface(const sp<IBinder>& mirrorFromHandle, sp<IBinder>* outHandle, |
| Ady Abraham | 9f0a400 | 2020-10-05 15:47:26 -0700 | [diff] [blame] | 86 | int32_t* outLayerId) = 0; |
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 87 | }; |
| 88 | |
| Dan Stoza | a615e47 | 2017-03-23 14:41:55 -0700 | [diff] [blame] | 89 | class BnSurfaceComposerClient : public SafeBnInterface<ISurfaceComposerClient> { |
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 90 | public: |
| Dan Stoza | a615e47 | 2017-03-23 14:41:55 -0700 | [diff] [blame] | 91 | BnSurfaceComposerClient() |
| 92 | : SafeBnInterface<ISurfaceComposerClient>("BnSurfaceComposerClient") {} |
| 93 | |
| 94 | status_t onTransact(uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags) override; |
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 95 | }; |
| 96 | |
| Dan Stoza | a615e47 | 2017-03-23 14:41:55 -0700 | [diff] [blame] | 97 | } // namespace android |