The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 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 | |
Mathias Agopian | 000479f | 2010-02-09 17:46:37 -0800 | [diff] [blame] | 17 | #ifndef ANDROID_SF_ISURFACE_H |
| 18 | #define ANDROID_SF_ISURFACE_H |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 19 | |
| 20 | #include <stdint.h> |
| 21 | #include <sys/types.h> |
| 22 | |
| 23 | #include <utils/Errors.h> |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 24 | #include <utils/RefBase.h> |
Mathias Agopian | 000479f | 2010-02-09 17:46:37 -0800 | [diff] [blame] | 25 | |
| 26 | #include <binder/IInterface.h> |
| 27 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 28 | #include <ui/PixelFormat.h> |
| 29 | |
| 30 | #include <hardware/hardware.h> |
Mathias Agopian | 1473f46 | 2009-04-10 14:24:30 -0700 | [diff] [blame] | 31 | #include <hardware/gralloc.h> |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 32 | |
| 33 | namespace android { |
| 34 | |
| 35 | typedef int32_t SurfaceID; |
| 36 | |
Mathias Agopian | 6950e42 | 2009-10-05 17:07:12 -0700 | [diff] [blame] | 37 | class GraphicBuffer; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 38 | |
| 39 | class ISurface : public IInterface |
| 40 | { |
| 41 | protected: |
| 42 | enum { |
Mathias Agopian | d211230 | 2010-12-07 19:38:17 -0800 | [diff] [blame] | 43 | RESERVED0 = IBinder::FIRST_CALL_TRANSACTION, |
| 44 | RESERVED1, |
| 45 | RESERVED2, |
Mathias Agopian | 9779b22 | 2009-09-07 16:32:45 -0700 | [diff] [blame] | 46 | REQUEST_BUFFER, |
Mathias Agopian | 59751db | 2010-05-07 15:58:44 -0700 | [diff] [blame] | 47 | SET_BUFFER_COUNT, |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 48 | }; |
| 49 | |
| 50 | public: |
| 51 | DECLARE_META_INTERFACE(Surface); |
| 52 | |
Mathias Agopian | 770492c | 2010-05-28 14:22:23 -0700 | [diff] [blame] | 53 | /* |
| 54 | * requests a new buffer for the given index. If w, h, or format are |
| 55 | * null the buffer is created with the parameters assigned to the |
| 56 | * surface it is bound to. Otherwise the buffer's parameters are |
| 57 | * set to those specified. |
| 58 | */ |
Mathias Agopian | 2be352a | 2010-05-21 17:24:35 -0700 | [diff] [blame] | 59 | virtual sp<GraphicBuffer> requestBuffer(int bufferIdx, |
| 60 | uint32_t w, uint32_t h, uint32_t format, uint32_t usage) = 0; |
Mathias Agopian | 770492c | 2010-05-28 14:22:23 -0700 | [diff] [blame] | 61 | |
| 62 | /* |
| 63 | * sets the number of buffers dequeuable for this surface. |
| 64 | */ |
Mathias Agopian | 59751db | 2010-05-07 15:58:44 -0700 | [diff] [blame] | 65 | virtual status_t setBufferCount(int bufferCount) = 0; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 66 | }; |
| 67 | |
| 68 | // ---------------------------------------------------------------------------- |
| 69 | |
| 70 | class BnSurface : public BnInterface<ISurface> |
| 71 | { |
| 72 | public: |
| 73 | virtual status_t onTransact( uint32_t code, |
| 74 | const Parcel& data, |
| 75 | Parcel* reply, |
| 76 | uint32_t flags = 0); |
| 77 | }; |
| 78 | |
| 79 | // ---------------------------------------------------------------------------- |
| 80 | |
| 81 | }; // namespace android |
| 82 | |
Mathias Agopian | 000479f | 2010-02-09 17:46:37 -0800 | [diff] [blame] | 83 | #endif // ANDROID_SF_ISURFACE_H |