1ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson/* 2ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson* Copyright (c) 2013 The Linux Foundation. All rights reserved. 3ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson* 4ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson* Redistribution and use in source and binary forms, with or without 5ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson* modification, are permitted provided that the following conditions are 6ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson* met: 7ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson* * Redistributions of source code must retain the above copyright 8ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson* notice, this list of conditions and the following disclaimer. 9ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson* * Redistributions in binary form must reproduce the above 10ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson* copyright notice, this list of conditions and the following 11ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson* disclaimer in the documentation and/or other materials provided 12ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson* with the distribution. 13ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson* * Neither the name of The Linux Foundation. nor the names of its 14ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson* contributors may be used to endorse or promote products derived 15ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson* from this software without specific prior written permission. 16ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson* 17ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED 18ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 19ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT 20ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 21ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 22ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 23ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 24ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 25ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 26ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 27ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson*/ 29ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson 30ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson#ifndef HWC_AD_H 31ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson#define HWC_AD_H 32ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson 33ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson#include <overlayUtils.h> 34ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson#include <hwc_utils.h> 35ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson 36ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilsonstruct hwc_context_t; 37ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson 38ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilsonnamespace qhwc { 39ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson 40ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilsonclass AssertiveDisplay { 41ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilsonpublic: 42a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson AssertiveDisplay(hwc_context_t *ctx); 43ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson void markDoable(hwc_context_t *ctx, const hwc_display_contents_1_t* list); 44ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson bool prepare(hwc_context_t *ctx, const hwc_rect_t& crop, 45ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson const overlay::utils::Whf& whf, 46ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson const private_handle_t *hnd); 47ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson bool draw(hwc_context_t *ctx, int fd, uint32_t offset); 48ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson //Resets a few members on each draw round 49ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson void reset() { mDoable = false; 50ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson mDest = overlay::utils::OV_INVALID; 51ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson } 52ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson bool isDoable() const { return mDoable; } 53a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson int getDstFd() const; 54a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson uint32_t getDstOffset() const; 55ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson 56ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilsonprivate: 57ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson bool mDoable; 58b82663bac1ecc18d185c8c15a6108b25b4b847f4Tatenda Chipeperekwa bool mTurnedOff; 59ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson //State of feature existence on certain devices and configs. 60ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson bool mFeatureEnabled; 61ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson overlay::utils::eDest mDest; 62b82663bac1ecc18d185c8c15a6108b25b4b847f4Tatenda Chipeperekwa void turnOffAD(); 63ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson}; 64ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson 65ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson} 66ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson#endif 67