Wed, 31 Dec 2014 07:22:50 +0100
Correct previous dual key logic pending first delivery installment.
michael@0 | 1 | /* |
michael@0 | 2 | * Copyright (C) 2007 The Android Open Source Project |
michael@0 | 3 | * |
michael@0 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
michael@0 | 5 | * you may not use this file except in compliance with the License. |
michael@0 | 6 | * You may obtain a copy of the License at |
michael@0 | 7 | * |
michael@0 | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
michael@0 | 9 | * |
michael@0 | 10 | * Unless required by applicable law or agreed to in writing, software |
michael@0 | 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
michael@0 | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
michael@0 | 13 | * See the License for the specific language governing permissions and |
michael@0 | 14 | * limitations under the License. |
michael@0 | 15 | */ |
michael@0 | 16 | |
michael@0 | 17 | #ifndef ANDROID_SF_FRAMEBUFFER_SURFACE_H |
michael@0 | 18 | #define ANDROID_SF_FRAMEBUFFER_SURFACE_H |
michael@0 | 19 | |
michael@0 | 20 | #include <stdint.h> |
michael@0 | 21 | #include <sys/types.h> |
michael@0 | 22 | |
michael@0 | 23 | #include <gui/ConsumerBase.h> |
michael@0 | 24 | |
michael@0 | 25 | // --------------------------------------------------------------------------- |
michael@0 | 26 | namespace android { |
michael@0 | 27 | // --------------------------------------------------------------------------- |
michael@0 | 28 | |
michael@0 | 29 | class Rect; |
michael@0 | 30 | class String8; |
michael@0 | 31 | class HWComposer; |
michael@0 | 32 | |
michael@0 | 33 | // --------------------------------------------------------------------------- |
michael@0 | 34 | |
michael@0 | 35 | class FramebufferSurface : public ConsumerBase { |
michael@0 | 36 | public: |
michael@0 | 37 | FramebufferSurface(int disp, uint32_t width, uint32_t height, uint32_t format, sp<BufferQueue>& bq); |
michael@0 | 38 | |
michael@0 | 39 | bool isUpdateOnDemand() const { return false; } |
michael@0 | 40 | status_t setUpdateRectangle(const Rect& updateRect); |
michael@0 | 41 | status_t compositionComplete(); |
michael@0 | 42 | |
michael@0 | 43 | virtual void dump(String8& result); |
michael@0 | 44 | virtual void dump(String8& result, const char* prefix); |
michael@0 | 45 | |
michael@0 | 46 | // setReleaseFenceFd stores a fence file descriptor that will signal when the |
michael@0 | 47 | // current buffer is no longer being read. This fence will be returned to |
michael@0 | 48 | // the producer when the current buffer is released by updateTexImage(). |
michael@0 | 49 | // Multiple fences can be set for a given buffer; they will be merged into |
michael@0 | 50 | // a single union fence. The SurfaceTexture will close the file descriptor |
michael@0 | 51 | // when finished with it. |
michael@0 | 52 | status_t setReleaseFenceFd(int fenceFd); |
michael@0 | 53 | |
michael@0 | 54 | virtual int GetPrevFBAcquireFd(); |
michael@0 | 55 | |
michael@0 | 56 | buffer_handle_t lastHandle; |
michael@0 | 57 | private: |
michael@0 | 58 | virtual ~FramebufferSurface() { }; // this class cannot be overloaded |
michael@0 | 59 | |
michael@0 | 60 | virtual void onFrameAvailable(); |
michael@0 | 61 | virtual void freeBufferLocked(int slotIndex); |
michael@0 | 62 | |
michael@0 | 63 | // nextBuffer waits for and then latches the next buffer from the |
michael@0 | 64 | // BufferQueue and releases the previously latched buffer to the |
michael@0 | 65 | // BufferQueue. The new buffer is returned in the 'buffer' argument. |
michael@0 | 66 | status_t nextBuffer(sp<GraphicBuffer>& outBuffer, sp<Fence>& outFence); |
michael@0 | 67 | |
michael@0 | 68 | // mDisplayType must match one of the HWC display types |
michael@0 | 69 | int mDisplayType; |
michael@0 | 70 | |
michael@0 | 71 | // mCurrentBufferIndex is the slot index of the current buffer or |
michael@0 | 72 | // INVALID_BUFFER_SLOT to indicate that either there is no current buffer |
michael@0 | 73 | // or the buffer is not associated with a slot. |
michael@0 | 74 | int mCurrentBufferSlot; |
michael@0 | 75 | |
michael@0 | 76 | // mCurrentBuffer is the current buffer or NULL to indicate that there is |
michael@0 | 77 | // no current buffer. |
michael@0 | 78 | sp<GraphicBuffer> mCurrentBuffer; |
michael@0 | 79 | |
michael@0 | 80 | android::sp<android::Fence> mPrevFBAcquireFence; |
michael@0 | 81 | }; |
michael@0 | 82 | |
michael@0 | 83 | // --------------------------------------------------------------------------- |
michael@0 | 84 | }; // namespace android |
michael@0 | 85 | // --------------------------------------------------------------------------- |
michael@0 | 86 | |
michael@0 | 87 | #endif // ANDROID_SF_FRAMEBUFFER_SURFACE_H |
michael@0 | 88 |