blob: 9e9e191480b18a79e08134f877ced9ed50a74059 [file] [log] [blame]
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -08001/*
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 Stozaa615e472017-03-23 14:41:55 -070017#pragma once
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -080018
Mathias Agopian9cce3252010-02-09 17:46:37 -080019#include <binder/IInterface.h>
Dan Stozaa615e472017-03-23 14:41:55 -070020#include <binder/SafeInterface.h>
Evan Rosky1f6d6d52018-12-06 10:47:26 -080021#include <gui/LayerMetadata.h>
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -080022#include <ui/PixelFormat.h>
Mathias Agopian7e27f052010-05-28 14:22:23 -070023
Evan Rosky1f6d6d52018-12-06 10:47:26 -080024#include <unordered_map>
25
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -080026namespace android {
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -080027
Dan Stozaa615e472017-03-23 14:41:55 -070028class FrameStats;
Mathias Agopian4d9b8222013-03-12 17:11:48 -070029class IGraphicBufferProducer;
30
Dan Stozaa615e472017-03-23 14:41:55 -070031class ISurfaceComposerClient : public IInterface {
Mathias Agopian7e27f052010-05-28 14:22:23 -070032public:
Colin Cross17576de2016-09-26 13:07:06 -070033 DECLARE_META_INTERFACE(SurfaceComposerClient)
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -080034
Mathias Agopian3165cc22012-08-08 19:42:09 -070035 // flags for createSurface()
Vishnu Nairc43a23c2020-05-29 14:32:27 -070036 enum { // (keep in sync with SurfaceControl.java)
Dan Stozaa615e472017-03-23 14:41:55 -070037 eHidden = 0x00000004,
38 eDestroyBackbuffer = 0x00000020,
chaviwc5676c62020-09-18 15:01:04 -070039 eSkipScreenshot = 0x00000040,
Dan Stozaa615e472017-03-23 14:41:55 -070040 eSecure = 0x00000080,
41 eNonPremultiplied = 0x00000100,
42 eOpaque = 0x00000400,
43 eProtectedByApp = 0x00000800,
44 eProtectedByDRM = 0x00001000,
45 eCursorWindow = 0x00002000,
Vishnu Nairc43a23c2020-05-29 14:32:27 -070046 eNoColorFill = 0x00004000,
Mathias Agopian3165cc22012-08-08 19:42:09 -070047
Marissa Wall61c58622018-07-18 10:12:20 -070048 eFXSurfaceBufferQueue = 0x00000000,
Vishnu Nairfa247b12020-02-11 08:58:26 -080049 eFXSurfaceEffect = 0x00020000,
Marissa Wall61c58622018-07-18 10:12:20 -070050 eFXSurfaceBufferState = 0x00040000,
Robert Carr6b3f6c52018-08-13 13:05:17 -070051 eFXSurfaceContainer = 0x00080000,
Dan Stozaa615e472017-03-23 14:41:55 -070052 eFXSurfaceMask = 0x000F0000,
Mathias Agopian3165cc22012-08-08 19:42:09 -070053 };
54
Adithya Srinivasan9febda82020-10-19 10:49:41 -070055 // TODO(b/172002646): Clean up the Surface Creation Arguments
Mathias Agopiancc08e682010-04-15 18:48:26 -070056 /*
57 * Requires ACCESS_SURFACE_FLINGER permission
58 */
Dan Stozaa615e472017-03-23 14:41:55 -070059 virtual status_t createSurface(const String8& name, uint32_t w, uint32_t h, PixelFormat format,
Evan Rosky1f6d6d52018-12-06 10:47:26 -080060 uint32_t flags, const sp<IBinder>& parent,
61 LayerMetadata metadata, sp<IBinder>* handle,
Ady Abraham9f0a4002020-10-05 15:47:26 -070062 sp<IGraphicBufferProducer>* gbp, int32_t* outLayerId,
Pablo Gamito2ec1f7b2020-09-01 14:18:49 +000063 uint32_t* outTransformHint) = 0;
Mathias Agopian7e27f052010-05-28 14:22:23 -070064
Mathias Agopiancc08e682010-04-15 18:48:26 -070065 /*
66 * Requires ACCESS_SURFACE_FLINGER permission
67 */
Marissa Wall35187b32019-01-08 10:08:52 -080068 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 Rosky1f6d6d52018-12-06 10:47:26 -080071 LayerMetadata metadata, sp<IBinder>* handle,
Ady Abraham9f0a4002020-10-05 15:47:26 -070072 sp<IGraphicBufferProducer>* gbp, int32_t* outLayerId,
Valerie Hau1acd6962019-10-28 16:35:48 -070073 uint32_t* outTransformHint) = 0;
Marissa Wall35187b32019-01-08 10:08:52 -080074
75 /*
76 * Requires ACCESS_SURFACE_FLINGER permission
77 */
Svetoslavd85084b2014-03-20 10:28:31 -070078 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;
chaviwfe94a222019-08-21 13:52:59 -070084
Pablo Gamito2ec1f7b2020-09-01 14:18:49 +000085 virtual status_t mirrorSurface(const sp<IBinder>& mirrorFromHandle, sp<IBinder>* outHandle,
Ady Abraham9f0a4002020-10-05 15:47:26 -070086 int32_t* outLayerId) = 0;
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -080087};
88
Dan Stozaa615e472017-03-23 14:41:55 -070089class BnSurfaceComposerClient : public SafeBnInterface<ISurfaceComposerClient> {
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -080090public:
Dan Stozaa615e472017-03-23 14:41:55 -070091 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 Projectedbf3b62009-03-03 19:31:44 -080095};
96
Dan Stozaa615e472017-03-23 14:41:55 -070097} // namespace android