Mathias Agopian | a350ff9 | 2010-08-10 17:14:02 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2010 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_HWCOMPOSER_H |
| 18 | #define ANDROID_SF_HWCOMPOSER_H |
| 19 | |
| 20 | #include <stdint.h> |
| 21 | #include <sys/types.h> |
| 22 | |
| 23 | #include <EGL/egl.h> |
| 24 | |
| 25 | #include <hardware/hwcomposer.h> |
| 26 | |
| 27 | namespace android { |
| 28 | // --------------------------------------------------------------------------- |
| 29 | |
Mathias Agopian | 8372785 | 2010-09-23 18:13:21 -0700 | [diff] [blame^] | 30 | class String8; |
| 31 | |
Mathias Agopian | a350ff9 | 2010-08-10 17:14:02 -0700 | [diff] [blame] | 32 | class HWComposer |
| 33 | { |
| 34 | public: |
| 35 | |
| 36 | HWComposer(); |
| 37 | ~HWComposer(); |
| 38 | |
| 39 | status_t initCheck() const; |
| 40 | |
| 41 | // tells the HAL what the framebuffer is |
| 42 | void setFrameBuffer(EGLDisplay dpy, EGLSurface sur); |
| 43 | |
| 44 | // create a work list for numLayers layer |
| 45 | status_t createWorkList(size_t numLayers); |
| 46 | |
| 47 | // Asks the HAL what it can do |
| 48 | status_t prepare() const; |
| 49 | |
| 50 | // commits the list |
| 51 | status_t commit() const; |
| 52 | |
Antti Hatala | f5f2712 | 2010-09-09 02:33:05 -0700 | [diff] [blame] | 53 | // release hardware resources |
| 54 | status_t release() const; |
Mathias Agopian | a350ff9 | 2010-08-10 17:14:02 -0700 | [diff] [blame] | 55 | |
Mathias Agopian | 4572177 | 2010-08-12 15:03:26 -0700 | [diff] [blame] | 56 | size_t getNumLayers() const; |
| 57 | hwc_layer_t* getLayers() const; |
Mathias Agopian | a350ff9 | 2010-08-10 17:14:02 -0700 | [diff] [blame] | 58 | |
Mathias Agopian | 8372785 | 2010-09-23 18:13:21 -0700 | [diff] [blame^] | 59 | // for debugging |
| 60 | void dump(String8& out, char* scratch, size_t SIZE) const; |
| 61 | |
Mathias Agopian | a350ff9 | 2010-08-10 17:14:02 -0700 | [diff] [blame] | 62 | private: |
| 63 | hw_module_t const* mModule; |
| 64 | hwc_composer_device_t* mHwc; |
| 65 | hwc_layer_list_t* mList; |
Mathias Agopian | 4572177 | 2010-08-12 15:03:26 -0700 | [diff] [blame] | 66 | size_t mCapacity; |
Mathias Agopian | a350ff9 | 2010-08-10 17:14:02 -0700 | [diff] [blame] | 67 | hwc_display_t mDpy; |
| 68 | hwc_surface_t mSur; |
| 69 | }; |
| 70 | |
| 71 | |
| 72 | // --------------------------------------------------------------------------- |
| 73 | }; // namespace android |
| 74 | |
| 75 | #endif // ANDROID_SF_HWCOMPOSER_H |