DisplaySurface.h revision 99c7dbb24994df2f3e175f7b25dd2c9dd92a72f0
1/* 2 * Copyright 2013 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_DISPLAY_SURFACE_H 18#define ANDROID_SF_DISPLAY_SURFACE_H 19 20#include <utils/Errors.h> 21#include <utils/RefBase.h> 22#include <utils/StrongPointer.h> 23 24// --------------------------------------------------------------------------- 25namespace android { 26// --------------------------------------------------------------------------- 27 28class IGraphicBufferProducer; 29class String8; 30 31class DisplaySurface : public virtual RefBase { 32public: 33 virtual sp<IGraphicBufferProducer> getIGraphicBufferProducer() const = 0; 34 35 // Should be called when composition rendering is complete for a frame (but 36 // eglSwapBuffers hasn't necessarily been called). Required by certain 37 // older drivers for synchronization. 38 // TODO: Remove this when we drop support for HWC 1.0. 39 virtual status_t compositionComplete() = 0; 40 41 // Inform the surface that GLES composition is complete for this frame, and 42 // the surface should make sure that HWComposer has the correct buffer for 43 // this frame. Some implementations may only push a new buffer to 44 // HWComposer if GLES composition took place, others need to push a new 45 // buffer on every frame. 46 virtual status_t advanceFrame() = 0; 47 48 // setReleaseFenceFd stores a fence file descriptor that will signal when 49 // the current buffer is no longer being read. This fence will be returned 50 // to the producer when the current buffer is released by updateTexImage(). 51 // Multiple fences can be set for a given buffer; they will be merged into 52 // a single union fence. The GLConsumer will close the file descriptor 53 // when finished with it. 54 virtual status_t setReleaseFenceFd(int fenceFd) = 0; 55 56 virtual void dump(String8& result) const = 0; 57 58protected: 59 DisplaySurface() {} 60 virtual ~DisplaySurface() {} 61}; 62 63// --------------------------------------------------------------------------- 64} // namespace android 65// --------------------------------------------------------------------------- 66 67#endif // ANDROID_SF_DISPLAY_SURFACE_H 68 69