blob: 259c1dff846ff315e41d2a70976c23cdf17dba3c [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
Mathias Agopian90ac7992012-02-25 18:48:35 -080017#ifndef ANDROID_GUI_ISURFACE_COMPOSER_CLIENT_H
18#define ANDROID_GUI_ISURFACE_COMPOSER_CLIENT_H
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -080019
20#include <stdint.h>
21#include <sys/types.h>
22
23#include <utils/Errors.h>
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -080024#include <utils/RefBase.h>
25
Mathias Agopian9cce3252010-02-09 17:46:37 -080026#include <binder/IInterface.h>
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -080027
28#include <ui/PixelFormat.h>
Mathias Agopian7e27f052010-05-28 14:22:23 -070029
Mathias Agopian90ac7992012-02-25 18:48:35 -080030#include <gui/ISurface.h>
Mathias Agopian9cce3252010-02-09 17:46:37 -080031
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -080032namespace android {
33
34// ----------------------------------------------------------------------------
35
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -080036typedef int32_t DisplayID;
37
38// ----------------------------------------------------------------------------
39
Mathias Agopian7e27f052010-05-28 14:22:23 -070040class ISurfaceComposerClient : public IInterface
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -080041{
Mathias Agopian7e27f052010-05-28 14:22:23 -070042public:
43 DECLARE_META_INTERFACE(SurfaceComposerClient);
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -080044
Mathias Agopian3165cc22012-08-08 19:42:09 -070045 // flags for createSurface()
46 enum { // (keep in sync with Surface.java)
47 eHidden = 0x00000004,
48 eDestroyBackbuffer = 0x00000020,
49 eSecure = 0x00000080,
50 eNonPremultiplied = 0x00000100,
51 eOpaque = 0x00000400,
52 eProtectedByApp = 0x00000800,
53 eProtectedByDRM = 0x00001000,
54
55 eFXSurfaceNormal = 0x00000000,
56 eFXSurfaceBlur = 0x00010000, // deprecated, same as Dim
57 eFXSurfaceDim = 0x00020000,
58 eFXSurfaceScreenshot= 0x00030000,
59 eFXSurfaceMask = 0x000F0000,
60 };
61
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -080062 struct surface_data_t {
Mathias Agopian3165cc22012-08-08 19:42:09 -070063 int32_t token;
64 int32_t identity;
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -080065 status_t readFromParcel(const Parcel& parcel);
66 status_t writeToParcel(Parcel* parcel) const;
67 };
Mathias Agopian7e27f052010-05-28 14:22:23 -070068
Mathias Agopiancc08e682010-04-15 18:48:26 -070069 /*
70 * Requires ACCESS_SURFACE_FLINGER permission
71 */
Mathias Agopian3165cc22012-08-08 19:42:09 -070072 virtual sp<ISurface> createSurface(surface_data_t* data,
73 const String8& name, DisplayID display, uint32_t w, uint32_t h,
74 PixelFormat format, uint32_t flags) = 0;
Mathias Agopian7e27f052010-05-28 14:22:23 -070075
Mathias Agopiancc08e682010-04-15 18:48:26 -070076 /*
77 * Requires ACCESS_SURFACE_FLINGER permission
78 */
Mathias Agopian3165cc22012-08-08 19:42:09 -070079 virtual status_t destroySurface(SurfaceID sid) = 0;
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -080080};
81
82// ----------------------------------------------------------------------------
83
Mathias Agopian3165cc22012-08-08 19:42:09 -070084class BnSurfaceComposerClient: public BnInterface<ISurfaceComposerClient> {
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -080085public:
Mathias Agopian3165cc22012-08-08 19:42:09 -070086 virtual status_t onTransact(uint32_t code, const Parcel& data,
87 Parcel* reply, uint32_t flags = 0);
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -080088};
89
90// ----------------------------------------------------------------------------
91
92}; // namespace android
93
Mathias Agopian90ac7992012-02-25 18:48:35 -080094#endif // ANDROID_GUI_ISURFACE_COMPOSER_CLIENT_H