blob: 1c890005b6e9b2052e4e66319156fd80436c0042 [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>
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -080021#include <ui/PixelFormat.h>
Mathias Agopian7e27f052010-05-28 14:22:23 -070022
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -080023namespace android {
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -080024
Dan Stozaa615e472017-03-23 14:41:55 -070025class FrameStats;
Mathias Agopian4d9b8222013-03-12 17:11:48 -070026class IGraphicBufferProducer;
27
Dan Stozaa615e472017-03-23 14:41:55 -070028class ISurfaceComposerClient : public IInterface {
Mathias Agopian7e27f052010-05-28 14:22:23 -070029public:
Colin Cross17576de2016-09-26 13:07:06 -070030 DECLARE_META_INTERFACE(SurfaceComposerClient)
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -080031
Dan Stozaa615e472017-03-23 14:41:55 -070032 enum class Tag : uint32_t {
33 CreateSurface = IBinder::FIRST_CALL_TRANSACTION,
34 DestroySurface,
35 ClearLayerFrameStats,
36 GetLayerFrameStats,
37 GetTransformToDisplayInverse,
38 Last,
39 };
40
Mathias Agopian3165cc22012-08-08 19:42:09 -070041 // flags for createSurface()
42 enum { // (keep in sync with Surface.java)
Dan Stozaa615e472017-03-23 14:41:55 -070043 eHidden = 0x00000004,
44 eDestroyBackbuffer = 0x00000020,
45 eSecure = 0x00000080,
46 eNonPremultiplied = 0x00000100,
47 eOpaque = 0x00000400,
48 eProtectedByApp = 0x00000800,
49 eProtectedByDRM = 0x00001000,
50 eCursorWindow = 0x00002000,
Mathias Agopian3165cc22012-08-08 19:42:09 -070051
Dan Stozaa615e472017-03-23 14:41:55 -070052 eFXSurfaceNormal = 0x00000000,
53 eFXSurfaceDim = 0x00020000,
54 eFXSurfaceMask = 0x000F0000,
Mathias Agopian3165cc22012-08-08 19:42:09 -070055 };
56
Mathias Agopiancc08e682010-04-15 18:48:26 -070057 /*
58 * Requires ACCESS_SURFACE_FLINGER permission
59 */
Dan Stozaa615e472017-03-23 14:41:55 -070060 virtual status_t createSurface(const String8& name, uint32_t w, uint32_t h, PixelFormat format,
61 uint32_t flags, const sp<IBinder>& parent, uint32_t windowType,
62 uint32_t ownerUid, sp<IBinder>* handle,
63 sp<IGraphicBufferProducer>* gbp) = 0;
Mathias Agopian7e27f052010-05-28 14:22:23 -070064
Mathias Agopiancc08e682010-04-15 18:48:26 -070065 /*
66 * Requires ACCESS_SURFACE_FLINGER permission
67 */
Mathias Agopianac9fa422013-02-11 16:40:36 -080068 virtual status_t destroySurface(const sp<IBinder>& handle) = 0;
Svetoslavd85084b2014-03-20 10:28:31 -070069
70 /*
71 * Requires ACCESS_SURFACE_FLINGER permission
72 */
73 virtual status_t clearLayerFrameStats(const sp<IBinder>& handle) const = 0;
74
75 /*
76 * Requires ACCESS_SURFACE_FLINGER permission
77 */
78 virtual status_t getLayerFrameStats(const sp<IBinder>& handle, FrameStats* outStats) const = 0;
Robert Carr367c5682016-06-20 11:55:28 -070079
80 virtual status_t getTransformToDisplayInverse(const sp<IBinder>& handle,
Dan Stozaa615e472017-03-23 14:41:55 -070081 bool* outTransformToDisplayInverse) const = 0;
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -080082};
83
Dan Stozaa615e472017-03-23 14:41:55 -070084class BnSurfaceComposerClient : public SafeBnInterface<ISurfaceComposerClient> {
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -080085public:
Dan Stozaa615e472017-03-23 14:41:55 -070086 BnSurfaceComposerClient()
87 : SafeBnInterface<ISurfaceComposerClient>("BnSurfaceComposerClient") {}
88
89 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 -080090};
91
Dan Stozaa615e472017-03-23 14:41:55 -070092} // namespace android