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> |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 21 | #include <ui/PixelFormat.h> |
Mathias Agopian | 7e27f05 | 2010-05-28 14:22:23 -0700 | [diff] [blame] | 22 | |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 23 | namespace android { |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 24 | |
Dan Stoza | a615e47 | 2017-03-23 14:41:55 -0700 | [diff] [blame] | 25 | class FrameStats; |
Mathias Agopian | 4d9b822 | 2013-03-12 17:11:48 -0700 | [diff] [blame] | 26 | class IGraphicBufferProducer; |
| 27 | |
Dan Stoza | a615e47 | 2017-03-23 14:41:55 -0700 | [diff] [blame] | 28 | class ISurfaceComposerClient : public IInterface { |
Mathias Agopian | 7e27f05 | 2010-05-28 14:22:23 -0700 | [diff] [blame] | 29 | public: |
Colin Cross | 17576de | 2016-09-26 13:07:06 -0700 | [diff] [blame] | 30 | DECLARE_META_INTERFACE(SurfaceComposerClient) |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 31 | |
Dan Stoza | a615e47 | 2017-03-23 14:41:55 -0700 | [diff] [blame] | 32 | enum class Tag : uint32_t { |
| 33 | CreateSurface = IBinder::FIRST_CALL_TRANSACTION, |
| 34 | DestroySurface, |
| 35 | ClearLayerFrameStats, |
| 36 | GetLayerFrameStats, |
Dan Stoza | a615e47 | 2017-03-23 14:41:55 -0700 | [diff] [blame] | 37 | Last, |
| 38 | }; |
| 39 | |
Mathias Agopian | 3165cc2 | 2012-08-08 19:42:09 -0700 | [diff] [blame] | 40 | // flags for createSurface() |
| 41 | enum { // (keep in sync with Surface.java) |
Dan Stoza | a615e47 | 2017-03-23 14:41:55 -0700 | [diff] [blame] | 42 | eHidden = 0x00000004, |
| 43 | eDestroyBackbuffer = 0x00000020, |
| 44 | eSecure = 0x00000080, |
| 45 | eNonPremultiplied = 0x00000100, |
| 46 | eOpaque = 0x00000400, |
| 47 | eProtectedByApp = 0x00000800, |
| 48 | eProtectedByDRM = 0x00001000, |
| 49 | eCursorWindow = 0x00002000, |
Mathias Agopian | 3165cc2 | 2012-08-08 19:42:09 -0700 | [diff] [blame] | 50 | |
Dan Stoza | a615e47 | 2017-03-23 14:41:55 -0700 | [diff] [blame] | 51 | eFXSurfaceNormal = 0x00000000, |
| 52 | eFXSurfaceDim = 0x00020000, |
| 53 | eFXSurfaceMask = 0x000F0000, |
Mathias Agopian | 3165cc2 | 2012-08-08 19:42:09 -0700 | [diff] [blame] | 54 | }; |
| 55 | |
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, |
| 60 | uint32_t flags, const sp<IBinder>& parent, uint32_t windowType, |
| 61 | uint32_t ownerUid, sp<IBinder>* handle, |
| 62 | sp<IGraphicBufferProducer>* gbp) = 0; |
Mathias Agopian | 7e27f05 | 2010-05-28 14:22:23 -0700 | [diff] [blame] | 63 | |
Mathias Agopian | cc08e68 | 2010-04-15 18:48:26 -0700 | [diff] [blame] | 64 | /* |
| 65 | * Requires ACCESS_SURFACE_FLINGER permission |
| 66 | */ |
Mathias Agopian | ac9fa42 | 2013-02-11 16:40:36 -0800 | [diff] [blame] | 67 | virtual status_t destroySurface(const sp<IBinder>& handle) = 0; |
Svetoslav | d85084b | 2014-03-20 10:28:31 -0700 | [diff] [blame] | 68 | |
| 69 | /* |
| 70 | * Requires ACCESS_SURFACE_FLINGER permission |
| 71 | */ |
| 72 | virtual status_t clearLayerFrameStats(const sp<IBinder>& handle) const = 0; |
| 73 | |
| 74 | /* |
| 75 | * Requires ACCESS_SURFACE_FLINGER permission |
| 76 | */ |
| 77 | virtual status_t getLayerFrameStats(const sp<IBinder>& handle, FrameStats* outStats) const = 0; |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 78 | }; |
| 79 | |
Dan Stoza | a615e47 | 2017-03-23 14:41:55 -0700 | [diff] [blame] | 80 | class BnSurfaceComposerClient : public SafeBnInterface<ISurfaceComposerClient> { |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 81 | public: |
Dan Stoza | a615e47 | 2017-03-23 14:41:55 -0700 | [diff] [blame] | 82 | BnSurfaceComposerClient() |
| 83 | : SafeBnInterface<ISurfaceComposerClient>("BnSurfaceComposerClient") {} |
| 84 | |
| 85 | 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] | 86 | }; |
| 87 | |
Dan Stoza | a615e47 | 2017-03-23 14:41:55 -0700 | [diff] [blame] | 88 | } // namespace android |