1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/widget/gonk/libdisplay/FramebufferSurface.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,88 @@ 1.4 +/* 1.5 + * Copyright (C) 2007 The Android Open Source Project 1.6 + * 1.7 + * Licensed under the Apache License, Version 2.0 (the "License"); 1.8 + * you may not use this file except in compliance with the License. 1.9 + * You may obtain a copy of the License at 1.10 + * 1.11 + * http://www.apache.org/licenses/LICENSE-2.0 1.12 + * 1.13 + * Unless required by applicable law or agreed to in writing, software 1.14 + * distributed under the License is distributed on an "AS IS" BASIS, 1.15 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1.16 + * See the License for the specific language governing permissions and 1.17 + * limitations under the License. 1.18 + */ 1.19 + 1.20 +#ifndef ANDROID_SF_FRAMEBUFFER_SURFACE_H 1.21 +#define ANDROID_SF_FRAMEBUFFER_SURFACE_H 1.22 + 1.23 +#include <stdint.h> 1.24 +#include <sys/types.h> 1.25 + 1.26 +#include <gui/ConsumerBase.h> 1.27 + 1.28 +// --------------------------------------------------------------------------- 1.29 +namespace android { 1.30 +// --------------------------------------------------------------------------- 1.31 + 1.32 +class Rect; 1.33 +class String8; 1.34 +class HWComposer; 1.35 + 1.36 +// --------------------------------------------------------------------------- 1.37 + 1.38 +class FramebufferSurface : public ConsumerBase { 1.39 +public: 1.40 + FramebufferSurface(int disp, uint32_t width, uint32_t height, uint32_t format, sp<BufferQueue>& bq); 1.41 + 1.42 + bool isUpdateOnDemand() const { return false; } 1.43 + status_t setUpdateRectangle(const Rect& updateRect); 1.44 + status_t compositionComplete(); 1.45 + 1.46 + virtual void dump(String8& result); 1.47 + virtual void dump(String8& result, const char* prefix); 1.48 + 1.49 + // setReleaseFenceFd stores a fence file descriptor that will signal when the 1.50 + // current buffer is no longer being read. This fence will be returned to 1.51 + // the producer when the current buffer is released by updateTexImage(). 1.52 + // Multiple fences can be set for a given buffer; they will be merged into 1.53 + // a single union fence. The SurfaceTexture will close the file descriptor 1.54 + // when finished with it. 1.55 + status_t setReleaseFenceFd(int fenceFd); 1.56 + 1.57 + virtual int GetPrevFBAcquireFd(); 1.58 + 1.59 + buffer_handle_t lastHandle; 1.60 +private: 1.61 + virtual ~FramebufferSurface() { }; // this class cannot be overloaded 1.62 + 1.63 + virtual void onFrameAvailable(); 1.64 + virtual void freeBufferLocked(int slotIndex); 1.65 + 1.66 + // nextBuffer waits for and then latches the next buffer from the 1.67 + // BufferQueue and releases the previously latched buffer to the 1.68 + // BufferQueue. The new buffer is returned in the 'buffer' argument. 1.69 + status_t nextBuffer(sp<GraphicBuffer>& outBuffer, sp<Fence>& outFence); 1.70 + 1.71 + // mDisplayType must match one of the HWC display types 1.72 + int mDisplayType; 1.73 + 1.74 + // mCurrentBufferIndex is the slot index of the current buffer or 1.75 + // INVALID_BUFFER_SLOT to indicate that either there is no current buffer 1.76 + // or the buffer is not associated with a slot. 1.77 + int mCurrentBufferSlot; 1.78 + 1.79 + // mCurrentBuffer is the current buffer or NULL to indicate that there is 1.80 + // no current buffer. 1.81 + sp<GraphicBuffer> mCurrentBuffer; 1.82 + 1.83 + android::sp<android::Fence> mPrevFBAcquireFence; 1.84 +}; 1.85 + 1.86 +// --------------------------------------------------------------------------- 1.87 +}; // namespace android 1.88 +// --------------------------------------------------------------------------- 1.89 + 1.90 +#endif // ANDROID_SF_FRAMEBUFFER_SURFACE_H 1.91 +