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