14a1efd0680d2e9b61739e1eaeffd89174d6d2605Alain Vongsouvanh/* 24a1efd0680d2e9b61739e1eaeffd89174d6d2605Alain Vongsouvanh * Copyright (c) 2014-2017, The Linux Foundation. All rights reserved. 34a1efd0680d2e9b61739e1eaeffd89174d6d2605Alain Vongsouvanh * 44a1efd0680d2e9b61739e1eaeffd89174d6d2605Alain Vongsouvanh * Redistribution and use in source and binary forms, with or without 54a1efd0680d2e9b61739e1eaeffd89174d6d2605Alain Vongsouvanh * modification, are permitted provided that the following conditions are 64a1efd0680d2e9b61739e1eaeffd89174d6d2605Alain Vongsouvanh * met: 74a1efd0680d2e9b61739e1eaeffd89174d6d2605Alain Vongsouvanh * Redistributions of source code must retain the above copyright 84a1efd0680d2e9b61739e1eaeffd89174d6d2605Alain Vongsouvanh notice, this list of conditions and the following disclaimer. 94a1efd0680d2e9b61739e1eaeffd89174d6d2605Alain Vongsouvanh * Redistributions in binary form must reproduce the above 104a1efd0680d2e9b61739e1eaeffd89174d6d2605Alain Vongsouvanh copyright notice, this list of conditions and the following 114a1efd0680d2e9b61739e1eaeffd89174d6d2605Alain Vongsouvanh disclaimer in the documentation and/or other materials provided 124a1efd0680d2e9b61739e1eaeffd89174d6d2605Alain Vongsouvanh with the distribution. 134a1efd0680d2e9b61739e1eaeffd89174d6d2605Alain Vongsouvanh * Neither the name of The Linux Foundation nor the names of its 144a1efd0680d2e9b61739e1eaeffd89174d6d2605Alain Vongsouvanh contributors may be used to endorse or promote products derived 154a1efd0680d2e9b61739e1eaeffd89174d6d2605Alain Vongsouvanh from this software without specific prior written permission. 164a1efd0680d2e9b61739e1eaeffd89174d6d2605Alain Vongsouvanh 174a1efd0680d2e9b61739e1eaeffd89174d6d2605Alain Vongsouvanh * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED 184a1efd0680d2e9b61739e1eaeffd89174d6d2605Alain Vongsouvanh * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 194a1efd0680d2e9b61739e1eaeffd89174d6d2605Alain Vongsouvanh * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT 204a1efd0680d2e9b61739e1eaeffd89174d6d2605Alain Vongsouvanh * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 214a1efd0680d2e9b61739e1eaeffd89174d6d2605Alain Vongsouvanh * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 224a1efd0680d2e9b61739e1eaeffd89174d6d2605Alain Vongsouvanh * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 234a1efd0680d2e9b61739e1eaeffd89174d6d2605Alain Vongsouvanh * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 244a1efd0680d2e9b61739e1eaeffd89174d6d2605Alain Vongsouvanh * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 254a1efd0680d2e9b61739e1eaeffd89174d6d2605Alain Vongsouvanh * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 264a1efd0680d2e9b61739e1eaeffd89174d6d2605Alain Vongsouvanh * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 274a1efd0680d2e9b61739e1eaeffd89174d6d2605Alain Vongsouvanh * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 284a1efd0680d2e9b61739e1eaeffd89174d6d2605Alain Vongsouvanh */ 294a1efd0680d2e9b61739e1eaeffd89174d6d2605Alain Vongsouvanh 304a1efd0680d2e9b61739e1eaeffd89174d6d2605Alain Vongsouvanh#ifndef __HWC_DISPLAY_EXTERNAL_H__ 314a1efd0680d2e9b61739e1eaeffd89174d6d2605Alain Vongsouvanh#define __HWC_DISPLAY_EXTERNAL_H__ 324a1efd0680d2e9b61739e1eaeffd89174d6d2605Alain Vongsouvanh 334a1efd0680d2e9b61739e1eaeffd89174d6d2605Alain Vongsouvanh#include "hwc_display.h" 344a1efd0680d2e9b61739e1eaeffd89174d6d2605Alain Vongsouvanh#include "display_null.h" 354a1efd0680d2e9b61739e1eaeffd89174d6d2605Alain Vongsouvanh 364a1efd0680d2e9b61739e1eaeffd89174d6d2605Alain Vongsouvanhnamespace sdm { 374a1efd0680d2e9b61739e1eaeffd89174d6d2605Alain Vongsouvanh 384a1efd0680d2e9b61739e1eaeffd89174d6d2605Alain Vongsouvanhclass HWCDisplayExternal : public HWCDisplay { 394a1efd0680d2e9b61739e1eaeffd89174d6d2605Alain Vongsouvanh public: 404a1efd0680d2e9b61739e1eaeffd89174d6d2605Alain Vongsouvanh static int Create(CoreInterface *core_intf, HWCBufferAllocator *buffer_allocator, 414a1efd0680d2e9b61739e1eaeffd89174d6d2605Alain Vongsouvanh HWCCallbacks *callbacks, uint32_t primary_width, 424a1efd0680d2e9b61739e1eaeffd89174d6d2605Alain Vongsouvanh uint32_t primary_height, qService::QService *qservice, bool use_primary_res, 434a1efd0680d2e9b61739e1eaeffd89174d6d2605Alain Vongsouvanh HWCDisplay **hwc_display); 444a1efd0680d2e9b61739e1eaeffd89174d6d2605Alain Vongsouvanh static int Create(CoreInterface *core_intf, HWCBufferAllocator *buffer_allocator, 454a1efd0680d2e9b61739e1eaeffd89174d6d2605Alain Vongsouvanh HWCCallbacks *callbacks, qService::QService *qservice, 464a1efd0680d2e9b61739e1eaeffd89174d6d2605Alain Vongsouvanh HWCDisplay **hwc_display); 474a1efd0680d2e9b61739e1eaeffd89174d6d2605Alain Vongsouvanh static void Destroy(HWCDisplay *hwc_display); 484a1efd0680d2e9b61739e1eaeffd89174d6d2605Alain Vongsouvanh virtual HWC2::Error Validate(uint32_t *out_num_types, uint32_t *out_num_requests); 494a1efd0680d2e9b61739e1eaeffd89174d6d2605Alain Vongsouvanh virtual HWC2::Error Present(int32_t *out_retire_fence); 504a1efd0680d2e9b61739e1eaeffd89174d6d2605Alain Vongsouvanh virtual void SetSecureDisplay(bool secure_display_active); 514a1efd0680d2e9b61739e1eaeffd89174d6d2605Alain Vongsouvanh virtual int SetState(bool connected); 524a1efd0680d2e9b61739e1eaeffd89174d6d2605Alain Vongsouvanh 534a1efd0680d2e9b61739e1eaeffd89174d6d2605Alain Vongsouvanh private: 544a1efd0680d2e9b61739e1eaeffd89174d6d2605Alain Vongsouvanh HWCDisplayExternal(CoreInterface *core_intf, HWCBufferAllocator *buffer_allocator, 554a1efd0680d2e9b61739e1eaeffd89174d6d2605Alain Vongsouvanh HWCCallbacks *callbacks, qService::QService *qservice); 564a1efd0680d2e9b61739e1eaeffd89174d6d2605Alain Vongsouvanh void ApplyScanAdjustment(hwc_rect_t *display_frame); 574a1efd0680d2e9b61739e1eaeffd89174d6d2605Alain Vongsouvanh void GetUnderScanConfig(); 584a1efd0680d2e9b61739e1eaeffd89174d6d2605Alain Vongsouvanh static void GetDownscaleResolution(uint32_t primary_width, uint32_t primary_height, 594a1efd0680d2e9b61739e1eaeffd89174d6d2605Alain Vongsouvanh uint32_t *virtual_width, uint32_t *virtual_height); 604a1efd0680d2e9b61739e1eaeffd89174d6d2605Alain Vongsouvanh 614a1efd0680d2e9b61739e1eaeffd89174d6d2605Alain Vongsouvanh DisplayNull display_null_; 624a1efd0680d2e9b61739e1eaeffd89174d6d2605Alain Vongsouvanh int underscan_width_ = 0; 634a1efd0680d2e9b61739e1eaeffd89174d6d2605Alain Vongsouvanh int underscan_height_ = 0; 644a1efd0680d2e9b61739e1eaeffd89174d6d2605Alain Vongsouvanh}; 654a1efd0680d2e9b61739e1eaeffd89174d6d2605Alain Vongsouvanh 664a1efd0680d2e9b61739e1eaeffd89174d6d2605Alain Vongsouvanh} // namespace sdm 674a1efd0680d2e9b61739e1eaeffd89174d6d2605Alain Vongsouvanh 684a1efd0680d2e9b61739e1eaeffd89174d6d2605Alain Vongsouvanh#endif // __HWC_DISPLAY_EXTERNAL_H__ 69