| Mathias Agopian | 3e87601 | 2012-06-07 17:52:54 -0700 | [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 |  | 
|  | 17 | #ifndef ANDROID_SF_FRAMEBUFFER_SURFACE_H | 
|  | 18 | #define ANDROID_SF_FRAMEBUFFER_SURFACE_H | 
|  | 19 |  | 
|  | 20 | #include <stdint.h> | 
|  | 21 | #include <sys/types.h> | 
|  | 22 |  | 
|  | 23 | #include <EGL/egl.h> | 
|  | 24 |  | 
|  | 25 | #include <gui/SurfaceTextureClient.h> | 
|  | 26 |  | 
|  | 27 | #define NUM_FRAME_BUFFERS  2 | 
|  | 28 |  | 
|  | 29 | // --------------------------------------------------------------------------- | 
|  | 30 | namespace android { | 
|  | 31 | // --------------------------------------------------------------------------- | 
|  | 32 |  | 
|  | 33 | class Rect; | 
|  | 34 | class String8; | 
|  | 35 |  | 
|  | 36 | // --------------------------------------------------------------------------- | 
|  | 37 |  | 
|  | 38 | class FramebufferSurface : public SurfaceTextureClient { | 
|  | 39 | public: | 
|  | 40 | FramebufferSurface(); | 
|  | 41 |  | 
|  | 42 | virtual void onFirstRef(); | 
|  | 43 |  | 
|  | 44 | framebuffer_device_t const * getDevice() const { return fbDev; } | 
|  | 45 |  | 
|  | 46 | bool isUpdateOnDemand() const { return mUpdateOnDemand; } | 
|  | 47 | status_t setUpdateRectangle(const Rect& updateRect); | 
|  | 48 | status_t compositionComplete(); | 
|  | 49 |  | 
|  | 50 | void dump(String8& result); | 
|  | 51 |  | 
|  | 52 | private: | 
|  | 53 | virtual ~FramebufferSurface(); // this class cannot be overloaded | 
|  | 54 | virtual int query(int what, int* value) const; | 
|  | 55 |  | 
|  | 56 | framebuffer_device_t* fbDev; | 
|  | 57 |  | 
|  | 58 | sp<BufferQueue> mBufferQueue; | 
|  | 59 | int mCurrentBufferIndex; | 
|  | 60 | sp<GraphicBuffer> mBuffers[NUM_FRAME_BUFFERS]; | 
|  | 61 |  | 
|  | 62 | mutable Mutex mLock; | 
|  | 63 | bool mUpdateOnDemand; | 
|  | 64 | }; | 
|  | 65 |  | 
|  | 66 | // --------------------------------------------------------------------------- | 
|  | 67 | }; // namespace android | 
|  | 68 | // --------------------------------------------------------------------------- | 
|  | 69 |  | 
|  | 70 | #endif // ANDROID_SF_FRAMEBUFFER_SURFACE_H | 
|  | 71 |  |