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 17 #ifndef ANDROID_SF_ISURFACE_FLINGER_CLIENT_H 18 #define ANDROID_SF_ISURFACE_FLINGER_CLIENT_H 19 20 #include <stdint.h> 21 #include <sys/types.h> 22 23 #include <utils/Errors.h> 24 #include <utils/RefBase.h> 25 26 #include <binder/IInterface.h> 27 28 #include <ui/PixelFormat.h> 29 30 #include <surfaceflinger/ISurface.h> 31 32 namespace android { 33 34 // ---------------------------------------------------------------------------- 35 36 class IMemoryHeap; 37 38 typedef int32_t ClientID; 39 typedef int32_t DisplayID; 40 41 // ---------------------------------------------------------------------------- 42 43 class layer_state_t; 44 45 class ISurfaceFlingerClient : public IInterface 46 { 47 public: 48 DECLARE_META_INTERFACE(SurfaceFlingerClient); 49 50 struct surface_data_t { 51 int32_t token; 52 int32_t identity; 53 uint32_t width; 54 uint32_t height; 55 uint32_t format; 56 status_t readFromParcel(const Parcel& parcel); 57 status_t writeToParcel(Parcel* parcel) const; 58 }; 59 60 virtual sp<IMemoryHeap> getControlBlock() const = 0; 61 62 virtual sp<ISurface> createSurface( surface_data_t* data, 63 int pid, 64 const String8& name, 65 DisplayID display, 66 uint32_t w, 67 uint32_t h, 68 PixelFormat format, 69 uint32_t flags) = 0; 70 71 virtual status_t destroySurface(SurfaceID sid) = 0; 72 73 virtual status_t setState(int32_t count, const layer_state_t* states) = 0; 74 }; 75 76 // ---------------------------------------------------------------------------- 77 78 class BnSurfaceFlingerClient : public BnInterface<ISurfaceFlingerClient> 79 { 80 public: 81 virtual status_t onTransact( uint32_t code, 82 const Parcel& data, 83 Parcel* reply, 84 uint32_t flags = 0); 85 }; 86 87 // ---------------------------------------------------------------------------- 88 89 }; // namespace android 90 91 #endif // ANDROID_SF_ISURFACE_FLINGER_CLIENT_H 92