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 | |
Mathias Agopian | 3e8b853 | 2012-05-13 20:42:01 -0700 | [diff] [blame] | 23 | #include <hardware/hwcomposer_defs.h> |
Mathias Agopian | a350ff9 | 2010-08-10 17:14:02 -0700 | [diff] [blame] | 24 | |
Mathias Agopian | 921e6ac | 2012-07-23 23:11:29 -0700 | [diff] [blame] | 25 | #include <utils/Condition.h> |
| 26 | #include <utils/Mutex.h> |
Mathias Agopian | c7d14e2 | 2011-08-01 16:32:21 -0700 | [diff] [blame] | 27 | #include <utils/StrongPointer.h> |
Mathias Agopian | 921e6ac | 2012-07-23 23:11:29 -0700 | [diff] [blame] | 28 | #include <utils/Thread.h> |
| 29 | #include <utils/Timers.h> |
Mathias Agopian | 22da60c | 2011-09-09 00:49:11 -0700 | [diff] [blame] | 30 | #include <utils/Vector.h> |
Mathias Agopian | e60b068 | 2012-08-21 23:34:09 -0700 | [diff] [blame] | 31 | #include <utils/BitSet.h> |
Mathias Agopian | c7d14e2 | 2011-08-01 16:32:21 -0700 | [diff] [blame] | 32 | |
Mathias Agopian | 3eb38cb | 2012-04-03 22:09:52 -0700 | [diff] [blame] | 33 | extern "C" int clock_nanosleep(clockid_t clock_id, int flags, |
| 34 | const struct timespec *request, |
| 35 | struct timespec *remain); |
| 36 | |
Jesse Hall | 5880cc5 | 2012-06-05 23:40:32 -0700 | [diff] [blame] | 37 | struct hwc_composer_device_1; |
Jesse Hall | b685c54 | 2012-07-31 14:32:56 -0700 | [diff] [blame] | 38 | struct hwc_display_contents_1; |
Mathias Agopian | da27af9 | 2012-09-13 18:17:13 -0700 | [diff] [blame] | 39 | struct hwc_layer_1; |
Mathias Agopian | 3e8b853 | 2012-05-13 20:42:01 -0700 | [diff] [blame] | 40 | struct hwc_procs; |
Mathias Agopian | 8b736f1 | 2012-08-13 17:54:26 -0700 | [diff] [blame] | 41 | struct framebuffer_device_t; |
Mathias Agopian | 3e8b853 | 2012-05-13 20:42:01 -0700 | [diff] [blame] | 42 | |
Mathias Agopian | a350ff9 | 2010-08-10 17:14:02 -0700 | [diff] [blame] | 43 | namespace android { |
| 44 | // --------------------------------------------------------------------------- |
| 45 | |
Mathias Agopian | 921e6ac | 2012-07-23 23:11:29 -0700 | [diff] [blame] | 46 | class GraphicBuffer; |
Mathias Agopian | da27af9 | 2012-09-13 18:17:13 -0700 | [diff] [blame] | 47 | class Fence; |
Mathias Agopian | 921e6ac | 2012-07-23 23:11:29 -0700 | [diff] [blame] | 48 | class LayerBase; |
Jamie Gennis | 1a4d883 | 2012-08-02 20:11:05 -0700 | [diff] [blame] | 49 | class Region; |
Mathias Agopian | 8372785 | 2010-09-23 18:13:21 -0700 | [diff] [blame] | 50 | class String8; |
Mathias Agopian | c7d14e2 | 2011-08-01 16:32:21 -0700 | [diff] [blame] | 51 | class SurfaceFlinger; |
Mathias Agopian | 8372785 | 2010-09-23 18:13:21 -0700 | [diff] [blame] | 52 | |
Mathias Agopian | a350ff9 | 2010-08-10 17:14:02 -0700 | [diff] [blame] | 53 | class HWComposer |
| 54 | { |
| 55 | public: |
Mathias Agopian | 3eb38cb | 2012-04-03 22:09:52 -0700 | [diff] [blame] | 56 | class EventHandler { |
| 57 | friend class HWComposer; |
Jesse Hall | 1bd20e0 | 2012-08-29 10:47:52 -0700 | [diff] [blame] | 58 | virtual void onVSyncReceived(int disp, nsecs_t timestamp) = 0; |
Mathias Agopian | 3eb38cb | 2012-04-03 22:09:52 -0700 | [diff] [blame] | 59 | protected: |
| 60 | virtual ~EventHandler() {} |
| 61 | }; |
Mathias Agopian | a350ff9 | 2010-08-10 17:14:02 -0700 | [diff] [blame] | 62 | |
Mathias Agopian | 1e26087 | 2012-08-08 18:35:12 -0700 | [diff] [blame] | 63 | enum { |
Jesse Hall | 8f971ff | 2012-08-22 11:50:00 -0700 | [diff] [blame] | 64 | MAX_DISPLAYS = HWC_NUM_DISPLAY_TYPES + 1 |
Mathias Agopian | 1e26087 | 2012-08-08 18:35:12 -0700 | [diff] [blame] | 65 | }; |
| 66 | |
Mathias Agopian | 8b736f1 | 2012-08-13 17:54:26 -0700 | [diff] [blame] | 67 | HWComposer( |
| 68 | const sp<SurfaceFlinger>& flinger, |
Andy McFadden | b0d1dd3 | 2012-09-10 14:08:09 -0700 | [diff] [blame] | 69 | EventHandler& handler); |
Mathias Agopian | 8b736f1 | 2012-08-13 17:54:26 -0700 | [diff] [blame] | 70 | |
Mathias Agopian | a350ff9 | 2010-08-10 17:14:02 -0700 | [diff] [blame] | 71 | ~HWComposer(); |
| 72 | |
| 73 | status_t initCheck() const; |
| 74 | |
Mathias Agopian | e60b068 | 2012-08-21 23:34:09 -0700 | [diff] [blame] | 75 | // returns a display ID starting at MAX_DISPLAYS, this ID |
| 76 | // is to be used with createWorkList (and all other |
| 77 | // methods requiring an ID below). |
| 78 | // IDs below MAX_DISPLAY are pre-defined and therefore are always valid. |
| 79 | // returns a negative error code if an ID cannot be allocated |
| 80 | int32_t allocateDisplayId(); |
| 81 | |
| 82 | // recycles the given ID and frees the associated worklist. |
| 83 | // IDs below MAX_DISPLAYS are not recycled |
| 84 | status_t freeDisplayId(int32_t id); |
| 85 | |
| 86 | |
Mathias Agopian | a350ff9 | 2010-08-10 17:14:02 -0700 | [diff] [blame] | 87 | // Asks the HAL what it can do |
Mathias Agopian | e60b068 | 2012-08-21 23:34:09 -0700 | [diff] [blame] | 88 | status_t prepare(); |
Mathias Agopian | a350ff9 | 2010-08-10 17:14:02 -0700 | [diff] [blame] | 89 | |
| 90 | // commits the list |
Mathias Agopian | 30bcc61 | 2012-08-22 15:39:48 -0700 | [diff] [blame] | 91 | status_t commit(); |
Mathias Agopian | a350ff9 | 2010-08-10 17:14:02 -0700 | [diff] [blame] | 92 | |
Colin Cross | 10fbdb6 | 2012-07-12 17:56:34 -0700 | [diff] [blame] | 93 | // release hardware resources and blank screen |
Antti Hatala | f5f2712 | 2010-09-09 02:33:05 -0700 | [diff] [blame] | 94 | status_t release() const; |
Mathias Agopian | a350ff9 | 2010-08-10 17:14:02 -0700 | [diff] [blame] | 95 | |
Colin Cross | 10fbdb6 | 2012-07-12 17:56:34 -0700 | [diff] [blame] | 96 | // acquire hardware resources and unblank screen |
| 97 | status_t acquire() const; |
| 98 | |
Mathias Agopian | 3e8b853 | 2012-05-13 20:42:01 -0700 | [diff] [blame] | 99 | // create a work list for numLayers layer. sets HWC_GEOMETRY_CHANGED. |
Mathias Agopian | 1e26087 | 2012-08-08 18:35:12 -0700 | [diff] [blame] | 100 | status_t createWorkList(int32_t id, size_t numLayers); |
Mathias Agopian | a350ff9 | 2010-08-10 17:14:02 -0700 | [diff] [blame] | 101 | |
Mathias Agopian | da27af9 | 2012-09-13 18:17:13 -0700 | [diff] [blame] | 102 | bool supportsFramebufferTarget() const; |
| 103 | |
Mathias Agopian | e60b068 | 2012-08-21 23:34:09 -0700 | [diff] [blame] | 104 | // does this display have layers handled by HWC |
| 105 | bool hasHwcComposition(int32_t id) const; |
| 106 | |
| 107 | // does this display have layers handled by GLES |
| 108 | bool hasGlesComposition(int32_t id) const; |
Mathias Agopian | 9c6e297 | 2011-09-20 17:21:56 -0700 | [diff] [blame] | 109 | |
Mathias Agopian | da27af9 | 2012-09-13 18:17:13 -0700 | [diff] [blame] | 110 | // get the releaseFence file descriptor for the given display |
| 111 | // the release fence is only valid after commit() |
| 112 | int getAndResetReleaseFenceFd(int32_t id); |
| 113 | |
Mathias Agopian | 3e8b853 | 2012-05-13 20:42:01 -0700 | [diff] [blame] | 114 | // needed forward declarations |
| 115 | class LayerListIterator; |
| 116 | |
Mathias Agopian | cde87a3 | 2012-09-13 14:09:01 -0700 | [diff] [blame] | 117 | // return the visual id to be used to find a suitable EGLConfig for |
| 118 | // *ALL* displays. |
| 119 | int getVisualID() const; |
| 120 | |
Andy McFadden | b0d1dd3 | 2012-09-10 14:08:09 -0700 | [diff] [blame] | 121 | // Forwarding to FB HAL for pre-HWC-1.1 code (see FramebufferSurface). |
Mathias Agopian | da27af9 | 2012-09-13 18:17:13 -0700 | [diff] [blame] | 122 | int fbPost(int32_t id, const sp<Fence>& acquireFence, const sp<GraphicBuffer>& buf); |
Andy McFadden | b0d1dd3 | 2012-09-10 14:08:09 -0700 | [diff] [blame] | 123 | int fbCompositionComplete(); |
| 124 | void fbDump(String8& result); |
| 125 | |
Mathias Agopian | 3e8b853 | 2012-05-13 20:42:01 -0700 | [diff] [blame] | 126 | /* |
| 127 | * Interface to hardware composer's layers functionality. |
| 128 | * This abstracts the HAL interface to layers which can evolve in |
| 129 | * incompatible ways from one release to another. |
| 130 | * The idea is that we could extend this interface as we add |
| 131 | * features to h/w composer. |
| 132 | */ |
| 133 | class HWCLayerInterface { |
| 134 | protected: |
| 135 | virtual ~HWCLayerInterface() { } |
| 136 | public: |
| 137 | virtual int32_t getCompositionType() const = 0; |
| 138 | virtual uint32_t getHints() const = 0; |
Jesse Hall | ef19414 | 2012-06-14 14:45:17 -0700 | [diff] [blame] | 139 | virtual int getAndResetReleaseFenceFd() = 0; |
Mathias Agopian | 3e8b853 | 2012-05-13 20:42:01 -0700 | [diff] [blame] | 140 | virtual void setDefaultState() = 0; |
| 141 | virtual void setSkip(bool skip) = 0; |
| 142 | virtual void setBlending(uint32_t blending) = 0; |
| 143 | virtual void setTransform(uint32_t transform) = 0; |
| 144 | virtual void setFrame(const Rect& frame) = 0; |
| 145 | virtual void setCrop(const Rect& crop) = 0; |
| 146 | virtual void setVisibleRegionScreen(const Region& reg) = 0; |
| 147 | virtual void setBuffer(const sp<GraphicBuffer>& buffer) = 0; |
Jesse Hall | dc5b485 | 2012-06-29 15:21:18 -0700 | [diff] [blame] | 148 | virtual void setAcquireFenceFd(int fenceFd) = 0; |
Mathias Agopian | c397360 | 2012-08-31 17:51:25 -0700 | [diff] [blame] | 149 | virtual void onDisplayed() = 0; |
Mathias Agopian | 3e8b853 | 2012-05-13 20:42:01 -0700 | [diff] [blame] | 150 | }; |
| 151 | |
| 152 | /* |
| 153 | * Interface used to implement an iterator to a list |
| 154 | * of HWCLayer. |
| 155 | */ |
| 156 | class HWCLayer : public HWCLayerInterface { |
| 157 | friend class LayerListIterator; |
| 158 | // select the layer at the given index |
| 159 | virtual status_t setLayer(size_t index) = 0; |
| 160 | virtual HWCLayer* dup() = 0; |
| 161 | static HWCLayer* copy(HWCLayer *rhs) { |
| 162 | return rhs ? rhs->dup() : NULL; |
| 163 | } |
| 164 | protected: |
| 165 | virtual ~HWCLayer() { } |
| 166 | }; |
| 167 | |
| 168 | /* |
| 169 | * Iterator through a HWCLayer list. |
| 170 | * This behaves more or less like a forward iterator. |
| 171 | */ |
| 172 | class LayerListIterator { |
| 173 | friend struct HWComposer; |
| 174 | HWCLayer* const mLayerList; |
| 175 | size_t mIndex; |
| 176 | |
| 177 | LayerListIterator() : mLayerList(NULL), mIndex(0) { } |
| 178 | |
| 179 | LayerListIterator(HWCLayer* layer, size_t index) |
| 180 | : mLayerList(layer), mIndex(index) { } |
| 181 | |
| 182 | // we don't allow assignment, because we don't need it for now |
| 183 | LayerListIterator& operator = (const LayerListIterator& rhs); |
| 184 | |
| 185 | public: |
| 186 | // copy operators |
| 187 | LayerListIterator(const LayerListIterator& rhs) |
| 188 | : mLayerList(HWCLayer::copy(rhs.mLayerList)), mIndex(rhs.mIndex) { |
| 189 | } |
| 190 | |
| 191 | ~LayerListIterator() { delete mLayerList; } |
| 192 | |
| 193 | // pre-increment |
| 194 | LayerListIterator& operator++() { |
| 195 | mLayerList->setLayer(++mIndex); |
| 196 | return *this; |
| 197 | } |
| 198 | |
| 199 | // dereference |
| 200 | HWCLayerInterface& operator * () { return *mLayerList; } |
| 201 | HWCLayerInterface* operator -> () { return mLayerList; } |
| 202 | |
| 203 | // comparison |
| 204 | bool operator == (const LayerListIterator& rhs) const { |
| 205 | return mIndex == rhs.mIndex; |
| 206 | } |
| 207 | bool operator != (const LayerListIterator& rhs) const { |
| 208 | return !operator==(rhs); |
| 209 | } |
| 210 | }; |
| 211 | |
| 212 | // Returns an iterator to the beginning of the layer list |
Mathias Agopian | 1e26087 | 2012-08-08 18:35:12 -0700 | [diff] [blame] | 213 | LayerListIterator begin(int32_t id); |
Mathias Agopian | 3e8b853 | 2012-05-13 20:42:01 -0700 | [diff] [blame] | 214 | |
| 215 | // Returns an iterator to the end of the layer list |
Mathias Agopian | 1e26087 | 2012-08-08 18:35:12 -0700 | [diff] [blame] | 216 | LayerListIterator end(int32_t id); |
Mathias Agopian | 3e8b853 | 2012-05-13 20:42:01 -0700 | [diff] [blame] | 217 | |
| 218 | |
Mathias Agopian | 3eb38cb | 2012-04-03 22:09:52 -0700 | [diff] [blame] | 219 | // Events handling --------------------------------------------------------- |
| 220 | |
| 221 | enum { |
| 222 | EVENT_VSYNC = HWC_EVENT_VSYNC |
| 223 | }; |
| 224 | |
Mathias Agopian | 03e4072 | 2012-04-26 16:11:59 -0700 | [diff] [blame] | 225 | void eventControl(int event, int enabled); |
Mathias Agopian | 3eb38cb | 2012-04-03 22:09:52 -0700 | [diff] [blame] | 226 | |
Andy McFadden | b0d1dd3 | 2012-09-10 14:08:09 -0700 | [diff] [blame] | 227 | // Query display parameters. Pass in a display index (e.g. |
| 228 | // HWC_DISPLAY_PRIMARY). |
| 229 | nsecs_t getRefreshPeriod(int disp) const; |
| 230 | nsecs_t getRefreshTimestamp(int disp) const; |
Jesse Hall | db27621 | 2012-09-07 11:20:56 -0700 | [diff] [blame] | 231 | uint32_t getWidth(int disp) const; |
| 232 | uint32_t getHeight(int disp) const; |
Andy McFadden | b0d1dd3 | 2012-09-10 14:08:09 -0700 | [diff] [blame] | 233 | uint32_t getFormat(int disp) const; |
| 234 | float getDpiX(int disp) const; |
| 235 | float getDpiY(int disp) const; |
Mathias Agopian | d3ee231 | 2012-08-02 14:01:42 -0700 | [diff] [blame] | 236 | |
Mathias Agopian | 3eb38cb | 2012-04-03 22:09:52 -0700 | [diff] [blame] | 237 | // this class is only used to fake the VSync event on systems that don't |
| 238 | // have it. |
| 239 | class VSyncThread : public Thread { |
| 240 | HWComposer& mHwc; |
| 241 | mutable Mutex mLock; |
| 242 | Condition mCondition; |
| 243 | bool mEnabled; |
| 244 | mutable nsecs_t mNextFakeVSync; |
| 245 | nsecs_t mRefreshPeriod; |
Mathias Agopian | 2965b26 | 2012-04-08 15:13:32 -0700 | [diff] [blame] | 246 | virtual void onFirstRef(); |
| 247 | virtual bool threadLoop(); |
Mathias Agopian | 3eb38cb | 2012-04-03 22:09:52 -0700 | [diff] [blame] | 248 | public: |
Mathias Agopian | 2965b26 | 2012-04-08 15:13:32 -0700 | [diff] [blame] | 249 | VSyncThread(HWComposer& hwc); |
| 250 | void setEnabled(bool enabled); |
Mathias Agopian | 3eb38cb | 2012-04-03 22:09:52 -0700 | [diff] [blame] | 251 | }; |
| 252 | |
| 253 | friend class VSyncThread; |
| 254 | |
| 255 | // for debugging ---------------------------------------------------------- |
Mathias Agopian | 22da60c | 2011-09-09 00:49:11 -0700 | [diff] [blame] | 256 | void dump(String8& out, char* scratch, size_t SIZE, |
| 257 | const Vector< sp<LayerBase> >& visibleLayersSortedByZ) const; |
Mathias Agopian | 8372785 | 2010-09-23 18:13:21 -0700 | [diff] [blame] | 258 | |
Mathias Agopian | a350ff9 | 2010-08-10 17:14:02 -0700 | [diff] [blame] | 259 | private: |
Andy McFadden | b0d1dd3 | 2012-09-10 14:08:09 -0700 | [diff] [blame] | 260 | void loadHwcModule(); |
| 261 | void loadFbHalModule(); |
Jesse Hall | b685c54 | 2012-07-31 14:32:56 -0700 | [diff] [blame] | 262 | |
Mathias Agopian | 1e26087 | 2012-08-08 18:35:12 -0700 | [diff] [blame] | 263 | LayerListIterator getLayerIterator(int32_t id, size_t index); |
Mathias Agopian | 31d2843 | 2012-04-03 16:31:39 -0700 | [diff] [blame] | 264 | |
Mathias Agopian | 3e8b853 | 2012-05-13 20:42:01 -0700 | [diff] [blame] | 265 | struct cb_context; |
Mathias Agopian | 31d2843 | 2012-04-03 16:31:39 -0700 | [diff] [blame] | 266 | |
Jesse Hall | bbd164a | 2012-08-21 12:05:09 -0700 | [diff] [blame] | 267 | static void hook_invalidate(const struct hwc_procs* procs); |
Jesse Hall | 1bd20e0 | 2012-08-29 10:47:52 -0700 | [diff] [blame] | 268 | static void hook_vsync(const struct hwc_procs* procs, int disp, |
Jesse Hall | bbd164a | 2012-08-21 12:05:09 -0700 | [diff] [blame] | 269 | int64_t timestamp); |
Jesse Hall | 1bd20e0 | 2012-08-29 10:47:52 -0700 | [diff] [blame] | 270 | static void hook_hotplug(const struct hwc_procs* procs, int disp, |
| 271 | int connected); |
Mathias Agopian | 31d2843 | 2012-04-03 16:31:39 -0700 | [diff] [blame] | 272 | |
Mathias Agopian | 3eb38cb | 2012-04-03 22:09:52 -0700 | [diff] [blame] | 273 | inline void invalidate(); |
Jesse Hall | 1bd20e0 | 2012-08-29 10:47:52 -0700 | [diff] [blame] | 274 | inline void vsync(int disp, int64_t timestamp); |
| 275 | inline void hotplug(int disp, int connected); |
Mathias Agopian | c7d14e2 | 2011-08-01 16:32:21 -0700 | [diff] [blame] | 276 | |
Mathias Agopian | 1604f77 | 2012-09-18 21:54:42 -0700 | [diff] [blame^] | 277 | status_t queryDisplayProperties(int disp); |
Mathias Agopian | 1e26087 | 2012-08-08 18:35:12 -0700 | [diff] [blame] | 278 | |
Mathias Agopian | da27af9 | 2012-09-13 18:17:13 -0700 | [diff] [blame] | 279 | status_t setFramebufferTarget(int32_t id, |
| 280 | const sp<Fence>& acquireFence, const sp<GraphicBuffer>& buf); |
| 281 | |
| 282 | |
Mathias Agopian | e60b068 | 2012-08-21 23:34:09 -0700 | [diff] [blame] | 283 | struct DisplayData { |
| 284 | DisplayData() : xdpi(0), ydpi(0), refresh(0), |
Mathias Agopian | f435863 | 2012-08-22 17:16:19 -0700 | [diff] [blame] | 285 | hasFbComp(false), hasOvComp(false), |
Mathias Agopian | da27af9 | 2012-09-13 18:17:13 -0700 | [diff] [blame] | 286 | capacity(0), list(NULL), |
| 287 | framebufferTarget(NULL), fbTargetHandle(NULL) { } |
Mathias Agopian | f435863 | 2012-08-22 17:16:19 -0700 | [diff] [blame] | 288 | ~DisplayData() { |
| 289 | free(list); |
| 290 | } |
Jesse Hall | db27621 | 2012-09-07 11:20:56 -0700 | [diff] [blame] | 291 | uint32_t width; |
| 292 | uint32_t height; |
Andy McFadden | b0d1dd3 | 2012-09-10 14:08:09 -0700 | [diff] [blame] | 293 | uint32_t format; // pixel format from FB hal, for pre-hwc-1.1 |
Mathias Agopian | e60b068 | 2012-08-21 23:34:09 -0700 | [diff] [blame] | 294 | float xdpi; |
| 295 | float ydpi; |
| 296 | nsecs_t refresh; |
| 297 | bool hasFbComp; |
| 298 | bool hasOvComp; |
Mathias Agopian | f435863 | 2012-08-22 17:16:19 -0700 | [diff] [blame] | 299 | size_t capacity; |
| 300 | hwc_display_contents_1* list; |
Mathias Agopian | da27af9 | 2012-09-13 18:17:13 -0700 | [diff] [blame] | 301 | hwc_layer_1* framebufferTarget; |
| 302 | buffer_handle_t fbTargetHandle; |
Mathias Agopian | e60b068 | 2012-08-21 23:34:09 -0700 | [diff] [blame] | 303 | }; |
| 304 | |
Jesse Hall | 5880cc5 | 2012-06-05 23:40:32 -0700 | [diff] [blame] | 305 | sp<SurfaceFlinger> mFlinger; |
Andy McFadden | b0d1dd3 | 2012-09-10 14:08:09 -0700 | [diff] [blame] | 306 | framebuffer_device_t* mFbDev; |
Jesse Hall | 5880cc5 | 2012-06-05 23:40:32 -0700 | [diff] [blame] | 307 | struct hwc_composer_device_1* mHwc; |
Jesse Hall | b685c54 | 2012-07-31 14:32:56 -0700 | [diff] [blame] | 308 | // invariant: mLists[0] != NULL iff mHwc != NULL |
Mathias Agopian | e60b068 | 2012-08-21 23:34:09 -0700 | [diff] [blame] | 309 | // mLists[i>0] can be NULL. that display is to be ignored |
Jesse Hall | b685c54 | 2012-07-31 14:32:56 -0700 | [diff] [blame] | 310 | struct hwc_display_contents_1* mLists[MAX_DISPLAYS]; |
Mathias Agopian | e60b068 | 2012-08-21 23:34:09 -0700 | [diff] [blame] | 311 | DisplayData mDisplayData[MAX_DISPLAYS]; |
Jesse Hall | 8f971ff | 2012-08-22 11:50:00 -0700 | [diff] [blame] | 312 | size_t mNumDisplays; |
Mathias Agopian | 1e26087 | 2012-08-08 18:35:12 -0700 | [diff] [blame] | 313 | |
Jesse Hall | 5880cc5 | 2012-06-05 23:40:32 -0700 | [diff] [blame] | 314 | cb_context* mCBContext; |
| 315 | EventHandler& mEventHandler; |
Jesse Hall | 5880cc5 | 2012-06-05 23:40:32 -0700 | [diff] [blame] | 316 | size_t mVSyncCount; |
| 317 | sp<VSyncThread> mVSyncThread; |
| 318 | bool mDebugForceFakeVSync; |
Mathias Agopian | f435863 | 2012-08-22 17:16:19 -0700 | [diff] [blame] | 319 | BitSet32 mAllocatedDisplayIDs; |
Mathias Agopian | d3ee231 | 2012-08-02 14:01:42 -0700 | [diff] [blame] | 320 | |
| 321 | // protected by mLock |
| 322 | mutable Mutex mLock; |
| 323 | mutable nsecs_t mLastHwVSync; |
Mathias Agopian | a350ff9 | 2010-08-10 17:14:02 -0700 | [diff] [blame] | 324 | }; |
| 325 | |
Mathias Agopian | a350ff9 | 2010-08-10 17:14:02 -0700 | [diff] [blame] | 326 | // --------------------------------------------------------------------------- |
| 327 | }; // namespace android |
| 328 | |
| 329 | #endif // ANDROID_SF_HWCOMPOSER_H |