blob: c96432feb0473db667cc3cddff37015a68666480 [file] [log] [blame]
The Android Open Source Project9066cfe2009-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 Agopian000479f2010-02-09 17:46:37 -080017#ifndef ANDROID_SF_ISURFACE_FLINGER_CLIENT_H
18#define ANDROID_SF_ISURFACE_FLINGER_CLIENT_H
The Android Open Source Project9066cfe2009-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 Project9066cfe2009-03-03 19:31:44 -080024#include <utils/RefBase.h>
25
Mathias Agopian000479f2010-02-09 17:46:37 -080026#include <binder/IInterface.h>
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080027
28#include <ui/PixelFormat.h>
29
Mathias Agopian000479f2010-02-09 17:46:37 -080030#include <surfaceflinger/ISurface.h>
31
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080032namespace android {
33
34// ----------------------------------------------------------------------------
35
Mathias Agopian000479f2010-02-09 17:46:37 -080036class IMemoryHeap;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080037
38typedef int32_t ClientID;
39typedef int32_t DisplayID;
40
41// ----------------------------------------------------------------------------
42
43class layer_state_t;
44
45class ISurfaceFlingerClient : public IInterface
46{
47public:
48 DECLARE_META_INTERFACE(SurfaceFlingerClient);
49
50 struct surface_data_t {
51 int32_t token;
52 int32_t identity;
Mathias Agopian18b6b492009-08-19 17:46:26 -070053 uint32_t width;
54 uint32_t height;
55 uint32_t format;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080056 status_t readFromParcel(const Parcel& parcel);
57 status_t writeToParcel(Parcel* parcel) const;
58 };
59
Mathias Agopiand763b5d2009-07-02 18:11:53 -070060 virtual sp<IMemoryHeap> getControlBlock() const = 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080061
Mathias Agopian16a86ee2010-04-15 18:48:26 -070062 /*
63 * Requires ACCESS_SURFACE_FLINGER permission
64 */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080065 virtual sp<ISurface> createSurface( surface_data_t* data,
66 int pid,
Mathias Agopian5d26c1e2010-03-01 16:09:43 -080067 const String8& name,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080068 DisplayID display,
69 uint32_t w,
70 uint32_t h,
71 PixelFormat format,
72 uint32_t flags) = 0;
73
Mathias Agopian16a86ee2010-04-15 18:48:26 -070074 /*
75 * Requires ACCESS_SURFACE_FLINGER permission
76 */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080077 virtual status_t destroySurface(SurfaceID sid) = 0;
78
Mathias Agopian16a86ee2010-04-15 18:48:26 -070079 /*
80 * Requires ACCESS_SURFACE_FLINGER permission
81 */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080082 virtual status_t setState(int32_t count, const layer_state_t* states) = 0;
83};
84
85// ----------------------------------------------------------------------------
86
87class BnSurfaceFlingerClient : public BnInterface<ISurfaceFlingerClient>
88{
89public:
90 virtual status_t onTransact( uint32_t code,
91 const Parcel& data,
92 Parcel* reply,
93 uint32_t flags = 0);
94};
95
96// ----------------------------------------------------------------------------
97
98}; // namespace android
99
Mathias Agopian000479f2010-02-09 17:46:37 -0800100#endif // ANDROID_SF_ISURFACE_FLINGER_CLIENT_H