1a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson/* 2a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson * Copyright (c) 2013 The Linux Foundation. All rights reserved. 3a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson * 4a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson * Redistribution and use in source and binary forms, with or without 5a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson * modification, are permitted provided that the following conditions are 6a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson * met: 7a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson * * Redistributions of source code must retain the above copyright 8a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson * notice, this list of conditions and the following disclaimer. 9a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson * * Redistributions in binary form must reproduce the above 10a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson * copyright notice, this list of conditions and the following 11a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson * disclaimer in the documentation and/or other materials provided 12a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson * with the distribution. 13a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson * * Neither the name of The Linux Foundation. nor the names of its 14a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson * contributors may be used to endorse or promote products derived 15a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson * from this software without specific prior written permission. 16a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson * 17a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED 18a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 19a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT 20a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 21a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 22a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 23a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 24a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 25a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 26a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 27a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson */ 29a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson#include <gralloc_priv.h> 30a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson#include <qdMetaData.h> 31a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson#include <mdp_version.h> 32a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson#include <hardware/hwcomposer.h> 33a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson 34a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson// This header is for clients to use to set/get global display configuration 35a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson// The functions in this header run in the client process and wherever necessary 36a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson// do a binder call to HWC to get/set data. 37a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson// Only primary and external displays are supported here. 38a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson// WiFi/virtual displays are not supported. 39a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson 40a653efede03423aa840da24634f1ec6f20796f1eSimon Wilsonnamespace qdutils { 41a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson 42a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson// Use this enum to specify the dpy parameters where needed 43a653efede03423aa840da24634f1ec6f20796f1eSimon Wilsonenum { 44a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson DISPLAY_PRIMARY = 0, 45a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson DISPLAY_EXTERNAL, 46a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson}; 47a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson 48a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson// Display Attributes that are available to clients of this library 49a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson// Not to be confused with a similar struct in hwc_utils (in the hwc namespace) 50a653efede03423aa840da24634f1ec6f20796f1eSimon Wilsonstruct DisplayAttributes_t { 51a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson uint32_t vsync_period; //nanoseconds 52a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson uint32_t xres; 53a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson uint32_t yres; 54a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson float xdpi; 55a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson float ydpi; 56a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson char panel_type; 57a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson}; 58a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson 59a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson// Check if external display is connected. Useful to check before making 60a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson// calls for external displays 61a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson// Returns 1 if connected, 0 if disconnected, negative values on errors 62a653efede03423aa840da24634f1ec6f20796f1eSimon Wilsonint isExternalConnected(void); 63a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson 64a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson// Get display vsync period which is in nanoseconds 65a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson// i.e vsync_period = 1000000000l / fps 66a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson// Returns 0 on success, negative values on errors 67a653efede03423aa840da24634f1ec6f20796f1eSimon Wilsonint getDisplayAttributes(int dpy, DisplayAttributes_t& dpyattr); 68a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson 69a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson// Set HSIC data on a given display ID 70a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson// Returns 0 on success, negative values on errors 71a653efede03423aa840da24634f1ec6f20796f1eSimon Wilsonint setHSIC(int dpy, const HSICData_t& hsic_data); 72a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson 73a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson// get the active visible region for the display 74a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson// Returns 0 on success, negative values on errors 75a653efede03423aa840da24634f1ec6f20796f1eSimon Wilsonint getDisplayVisibleRegion(int dpy, hwc_rect_t &rect); 7633f1ae81779c5b897987245cde0f498fd6192579Ramkumar Radhakrishnan 7733f1ae81779c5b897987245cde0f498fd6192579Ramkumar Radhakrishnan// set the view frame information in hwc context from surfaceflinger 7833f1ae81779c5b897987245cde0f498fd6192579Ramkumar Radhakrishnanint setViewFrame(int dpy, int l, int t, int r, int b); 79a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson}; //namespace 80