12e11c4c4562da807b35fc0c127a7449edd8aac17Naseer Ahmed/* 22e11c4c4562da807b35fc0c127a7449edd8aac17Naseer Ahmed * Copyright (c) 2013 The Linux Foundation. All rights reserved. 32e11c4c4562da807b35fc0c127a7449edd8aac17Naseer Ahmed * 42e11c4c4562da807b35fc0c127a7449edd8aac17Naseer Ahmed * Redistribution and use in source and binary forms, with or without 52e11c4c4562da807b35fc0c127a7449edd8aac17Naseer Ahmed * modification, are permitted provided that the following conditions are 62e11c4c4562da807b35fc0c127a7449edd8aac17Naseer Ahmed * met: 72e11c4c4562da807b35fc0c127a7449edd8aac17Naseer Ahmed * * Redistributions of source code must retain the above copyright 82e11c4c4562da807b35fc0c127a7449edd8aac17Naseer Ahmed * notice, this list of conditions and the following disclaimer. 92e11c4c4562da807b35fc0c127a7449edd8aac17Naseer Ahmed * * Redistributions in binary form must reproduce the above 102e11c4c4562da807b35fc0c127a7449edd8aac17Naseer Ahmed * copyright notice, this list of conditions and the following 112e11c4c4562da807b35fc0c127a7449edd8aac17Naseer Ahmed * disclaimer in the documentation and/or other materials provided 122e11c4c4562da807b35fc0c127a7449edd8aac17Naseer Ahmed * with the distribution. 132e11c4c4562da807b35fc0c127a7449edd8aac17Naseer Ahmed * * Neither the name of The Linux Foundation. nor the names of its 142e11c4c4562da807b35fc0c127a7449edd8aac17Naseer Ahmed * contributors may be used to endorse or promote products derived 152e11c4c4562da807b35fc0c127a7449edd8aac17Naseer Ahmed * from this software without specific prior written permission. 162e11c4c4562da807b35fc0c127a7449edd8aac17Naseer Ahmed * 172e11c4c4562da807b35fc0c127a7449edd8aac17Naseer Ahmed * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED 182e11c4c4562da807b35fc0c127a7449edd8aac17Naseer Ahmed * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 192e11c4c4562da807b35fc0c127a7449edd8aac17Naseer Ahmed * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT 202e11c4c4562da807b35fc0c127a7449edd8aac17Naseer Ahmed * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 212e11c4c4562da807b35fc0c127a7449edd8aac17Naseer Ahmed * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 222e11c4c4562da807b35fc0c127a7449edd8aac17Naseer Ahmed * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 232e11c4c4562da807b35fc0c127a7449edd8aac17Naseer Ahmed * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 242e11c4c4562da807b35fc0c127a7449edd8aac17Naseer Ahmed * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 252e11c4c4562da807b35fc0c127a7449edd8aac17Naseer Ahmed * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 262e11c4c4562da807b35fc0c127a7449edd8aac17Naseer Ahmed * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 272e11c4c4562da807b35fc0c127a7449edd8aac17Naseer Ahmed * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 282e11c4c4562da807b35fc0c127a7449edd8aac17Naseer Ahmed */ 292e11c4c4562da807b35fc0c127a7449edd8aac17Naseer Ahmed#include <gralloc_priv.h> 302e11c4c4562da807b35fc0c127a7449edd8aac17Naseer Ahmed#include <qdMetaData.h> 312e11c4c4562da807b35fc0c127a7449edd8aac17Naseer Ahmed#include <mdp_version.h> 32ac5b9f4e6b7dc80e0f91c1581f0bcb4464a48ef4Arun Kumar K.R#include <hardware/hwcomposer.h> 332e11c4c4562da807b35fc0c127a7449edd8aac17Naseer Ahmed 342e11c4c4562da807b35fc0c127a7449edd8aac17Naseer Ahmed// This header is for clients to use to set/get global display configuration 352e11c4c4562da807b35fc0c127a7449edd8aac17Naseer Ahmed// The functions in this header run in the client process and wherever necessary 362e11c4c4562da807b35fc0c127a7449edd8aac17Naseer Ahmed// do a binder call to HWC to get/set data. 372e11c4c4562da807b35fc0c127a7449edd8aac17Naseer Ahmed// Only primary and external displays are supported here. 382e11c4c4562da807b35fc0c127a7449edd8aac17Naseer Ahmed// WiFi/virtual displays are not supported. 392e11c4c4562da807b35fc0c127a7449edd8aac17Naseer Ahmed 402e11c4c4562da807b35fc0c127a7449edd8aac17Naseer Ahmednamespace qdutils { 412e11c4c4562da807b35fc0c127a7449edd8aac17Naseer Ahmed 422e11c4c4562da807b35fc0c127a7449edd8aac17Naseer Ahmed// Use this enum to specify the dpy parameters where needed 432e11c4c4562da807b35fc0c127a7449edd8aac17Naseer Ahmedenum { 442e11c4c4562da807b35fc0c127a7449edd8aac17Naseer Ahmed DISPLAY_PRIMARY = 0, 452e11c4c4562da807b35fc0c127a7449edd8aac17Naseer Ahmed DISPLAY_EXTERNAL, 462e11c4c4562da807b35fc0c127a7449edd8aac17Naseer Ahmed}; 472e11c4c4562da807b35fc0c127a7449edd8aac17Naseer Ahmed 482e11c4c4562da807b35fc0c127a7449edd8aac17Naseer Ahmed// Display Attributes that are available to clients of this library 492e11c4c4562da807b35fc0c127a7449edd8aac17Naseer Ahmed// Not to be confused with a similar struct in hwc_utils (in the hwc namespace) 502e11c4c4562da807b35fc0c127a7449edd8aac17Naseer Ahmedstruct DisplayAttributes_t { 512e11c4c4562da807b35fc0c127a7449edd8aac17Naseer Ahmed uint32_t vsync_period; //nanoseconds 522e11c4c4562da807b35fc0c127a7449edd8aac17Naseer Ahmed uint32_t xres; 532e11c4c4562da807b35fc0c127a7449edd8aac17Naseer Ahmed uint32_t yres; 542e11c4c4562da807b35fc0c127a7449edd8aac17Naseer Ahmed float xdpi; 552e11c4c4562da807b35fc0c127a7449edd8aac17Naseer Ahmed float ydpi; 562e11c4c4562da807b35fc0c127a7449edd8aac17Naseer Ahmed char panel_type; 572e11c4c4562da807b35fc0c127a7449edd8aac17Naseer Ahmed}; 582e11c4c4562da807b35fc0c127a7449edd8aac17Naseer Ahmed 592e11c4c4562da807b35fc0c127a7449edd8aac17Naseer Ahmed// Check if external display is connected. Useful to check before making 602e11c4c4562da807b35fc0c127a7449edd8aac17Naseer Ahmed// calls for external displays 612e11c4c4562da807b35fc0c127a7449edd8aac17Naseer Ahmed// Returns 1 if connected, 0 if disconnected, negative values on errors 622e11c4c4562da807b35fc0c127a7449edd8aac17Naseer Ahmedint isExternalConnected(void); 632e11c4c4562da807b35fc0c127a7449edd8aac17Naseer Ahmed 642e11c4c4562da807b35fc0c127a7449edd8aac17Naseer Ahmed// Get display vsync period which is in nanoseconds 652e11c4c4562da807b35fc0c127a7449edd8aac17Naseer Ahmed// i.e vsync_period = 1000000000l / fps 662e11c4c4562da807b35fc0c127a7449edd8aac17Naseer Ahmed// Returns 0 on success, negative values on errors 672e11c4c4562da807b35fc0c127a7449edd8aac17Naseer Ahmedint getDisplayAttributes(int dpy, DisplayAttributes_t& dpyattr); 682e11c4c4562da807b35fc0c127a7449edd8aac17Naseer Ahmed 692e11c4c4562da807b35fc0c127a7449edd8aac17Naseer Ahmed// Set HSIC data on a given display ID 702e11c4c4562da807b35fc0c127a7449edd8aac17Naseer Ahmed// Returns 0 on success, negative values on errors 712e11c4c4562da807b35fc0c127a7449edd8aac17Naseer Ahmedint setHSIC(int dpy, const HSICData_t& hsic_data); 722e11c4c4562da807b35fc0c127a7449edd8aac17Naseer Ahmed 73ac5b9f4e6b7dc80e0f91c1581f0bcb4464a48ef4Arun Kumar K.R// get the active visible region for the display 74ac5b9f4e6b7dc80e0f91c1581f0bcb4464a48ef4Arun Kumar K.R// Returns 0 on success, negative values on errors 75ac5b9f4e6b7dc80e0f91c1581f0bcb4464a48ef4Arun Kumar K.Rint getDisplayVisibleRegion(int dpy, hwc_rect_t &rect); 762e11c4c4562da807b35fc0c127a7449edd8aac17Naseer Ahmed}; //namespace 77