Wed, 31 Dec 2014 07:22:50 +0100
Correct previous dual key logic pending first delivery installment.
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 */
17 #ifndef ANDROID_SF_FRAMEBUFFER_SURFACE_H
18 #define ANDROID_SF_FRAMEBUFFER_SURFACE_H
20 #include <stdint.h>
21 #include <sys/types.h>
23 #include <gui/ConsumerBase.h>
25 // ---------------------------------------------------------------------------
26 namespace android {
27 // ---------------------------------------------------------------------------
29 class Rect;
30 class String8;
31 class HWComposer;
33 // ---------------------------------------------------------------------------
35 class FramebufferSurface : public ConsumerBase {
36 public:
37 FramebufferSurface(int disp, uint32_t width, uint32_t height, uint32_t format, sp<BufferQueue>& bq);
39 bool isUpdateOnDemand() const { return false; }
40 status_t setUpdateRectangle(const Rect& updateRect);
41 status_t compositionComplete();
43 virtual void dump(String8& result);
44 virtual void dump(String8& result, const char* prefix);
46 // setReleaseFenceFd stores a fence file descriptor that will signal when the
47 // current buffer is no longer being read. This fence will be returned to
48 // the producer when the current buffer is released by updateTexImage().
49 // Multiple fences can be set for a given buffer; they will be merged into
50 // a single union fence. The SurfaceTexture will close the file descriptor
51 // when finished with it.
52 status_t setReleaseFenceFd(int fenceFd);
54 virtual int GetPrevFBAcquireFd();
56 buffer_handle_t lastHandle;
57 private:
58 virtual ~FramebufferSurface() { }; // this class cannot be overloaded
60 virtual void onFrameAvailable();
61 virtual void freeBufferLocked(int slotIndex);
63 // nextBuffer waits for and then latches the next buffer from the
64 // BufferQueue and releases the previously latched buffer to the
65 // BufferQueue. The new buffer is returned in the 'buffer' argument.
66 status_t nextBuffer(sp<GraphicBuffer>& outBuffer, sp<Fence>& outFence);
68 // mDisplayType must match one of the HWC display types
69 int mDisplayType;
71 // mCurrentBufferIndex is the slot index of the current buffer or
72 // INVALID_BUFFER_SLOT to indicate that either there is no current buffer
73 // or the buffer is not associated with a slot.
74 int mCurrentBufferSlot;
76 // mCurrentBuffer is the current buffer or NULL to indicate that there is
77 // no current buffer.
78 sp<GraphicBuffer> mCurrentBuffer;
80 android::sp<android::Fence> mPrevFBAcquireFence;
81 };
83 // ---------------------------------------------------------------------------
84 }; // namespace android
85 // ---------------------------------------------------------------------------
87 #endif // ANDROID_SF_FRAMEBUFFER_SURFACE_H