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_COMPOSER_CLIENT_H 18 #define ANDROID_SF_ISURFACE_COMPOSER_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 ISurfaceComposerClient : public IInterface 46 { 47 public: 48 DECLARE_META_INTERFACE(SurfaceComposerClient); 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 virtual ssize_t getTokenForSurface(const sp<ISurface>& sur) const = 0; 62 63 /* 64 * Requires ACCESS_SURFACE_FLINGER permission 65 */ 66 virtual sp<ISurface> createSurface( surface_data_t* data, 67 int pid, 68 const String8& name, 69 DisplayID display, 70 uint32_t w, 71 uint32_t h, 72 PixelFormat format, 73 uint32_t flags) = 0; 74 75 /* 76 * Requires ACCESS_SURFACE_FLINGER permission 77 */ 78 virtual status_t destroySurface(SurfaceID sid) = 0; 79 80 /* 81 * Requires ACCESS_SURFACE_FLINGER permission 82 */ 83 virtual status_t setState(int32_t count, const layer_state_t* states) = 0; 84 }; 85 86 // ---------------------------------------------------------------------------- 87 88 class BnSurfaceComposerClient : public BnInterface<ISurfaceComposerClient> 89 { 90 public: 91 virtual status_t onTransact( uint32_t code, 92 const Parcel& data, 93 Parcel* reply, 94 uint32_t flags = 0); 95 }; 96 97 // ---------------------------------------------------------------------------- 98 99 }; // namespace android 100 101 #endif // ANDROID_SF_ISURFACE_COMPOSER_CLIENT_H 102