egl_display.cpp revision 54466bc4412acf33a59af59d9eadde54c22b2ebe
121558daf691dbcdff4a41e659fd013273db4d0b7Jesse Hall/* 2518ec112f468eb67bf681b3eec896d7bfb4ff98dMathias Agopian ** Copyright 2007, The Android Open Source Project 3518ec112f468eb67bf681b3eec896d7bfb4ff98dMathias Agopian ** 421558daf691dbcdff4a41e659fd013273db4d0b7Jesse Hall ** Licensed under the Apache License, Version 2.0 (the "License"); 521558daf691dbcdff4a41e659fd013273db4d0b7Jesse Hall ** you may not use this file except in compliance with the License. 621558daf691dbcdff4a41e659fd013273db4d0b7Jesse Hall ** You may obtain a copy of the License at 7518ec112f468eb67bf681b3eec896d7bfb4ff98dMathias Agopian ** 821558daf691dbcdff4a41e659fd013273db4d0b7Jesse Hall ** http://www.apache.org/licenses/LICENSE-2.0 9518ec112f468eb67bf681b3eec896d7bfb4ff98dMathias Agopian ** 1021558daf691dbcdff4a41e659fd013273db4d0b7Jesse Hall ** Unless required by applicable law or agreed to in writing, software 1121558daf691dbcdff4a41e659fd013273db4d0b7Jesse Hall ** distributed under the License is distributed on an "AS IS" BASIS, 1221558daf691dbcdff4a41e659fd013273db4d0b7Jesse Hall ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1321558daf691dbcdff4a41e659fd013273db4d0b7Jesse Hall ** See the License for the specific language governing permissions and 14518ec112f468eb67bf681b3eec896d7bfb4ff98dMathias Agopian ** limitations under the License. 15518ec112f468eb67bf681b3eec896d7bfb4ff98dMathias Agopian */ 16518ec112f468eb67bf681b3eec896d7bfb4ff98dMathias Agopian 17b29e5e8c2682ae145e8c56d9afb061f8da7f854cJesse Hall#define __STDC_LIMIT_MACROS 1 18b29e5e8c2682ae145e8c56d9afb061f8da7f854cJesse Hall 194b9511c16195a646242eff833b0af212933b6ecaMathias Agopian#include <string.h> 204b9511c16195a646242eff833b0af212933b6ecaMathias Agopian 2139c24a20bbc697630d2b92c251b70c04d6f9d00cMathias Agopian#include "../egl_impl.h" 2239c24a20bbc697630d2b92c251b70c04d6f9d00cMathias Agopian 23aca51c06f38155f1435fbc6944d7fc0a9bf1e4e9Jamie Gennis#include "egl_cache.h" 24518ec112f468eb67bf681b3eec896d7bfb4ff98dMathias Agopian#include "egl_display.h" 25518ec112f468eb67bf681b3eec896d7bfb4ff98dMathias Agopian#include "egl_object.h" 26518ec112f468eb67bf681b3eec896d7bfb4ff98dMathias Agopian#include "egl_tls.h" 27518ec112f468eb67bf681b3eec896d7bfb4ff98dMathias Agopian#include "Loader.h" 287db993a98b9239bd4e384cc4aa128262fe3cf52cMathias Agopian#include <cutils/properties.h> 29518ec112f468eb67bf681b3eec896d7bfb4ff98dMathias Agopian 30518ec112f468eb67bf681b3eec896d7bfb4ff98dMathias Agopian// ---------------------------------------------------------------------------- 31518ec112f468eb67bf681b3eec896d7bfb4ff98dMathias Agopiannamespace android { 32518ec112f468eb67bf681b3eec896d7bfb4ff98dMathias Agopian// ---------------------------------------------------------------------------- 33518ec112f468eb67bf681b3eec896d7bfb4ff98dMathias Agopian 344b9511c16195a646242eff833b0af212933b6ecaMathias Agopianstatic char const * const sVendorString = "Android"; 354b9511c16195a646242eff833b0af212933b6ecaMathias Agopianstatic char const * const sVersionString = "1.4 Android META-EGL"; 36cc2b1560e87369676a2d13f17bd1ff4021a91819Mathias Agopianstatic char const * const sClientApiString = "OpenGL_ES"; 374b9511c16195a646242eff833b0af212933b6ecaMathias Agopian 3821558daf691dbcdff4a41e659fd013273db4d0b7Jesse Hallextern char const * const gBuiltinExtensionString; 39e9b3dfb7d5cc233747407381a51a081c335dc076Mathias Agopianextern char const * const gExtensionString; 404b9511c16195a646242eff833b0af212933b6ecaMathias Agopian 41518ec112f468eb67bf681b3eec896d7bfb4ff98dMathias Agopianextern void initEglTraceLevel(); 42b13c78f8520ef5a96effdee977bbacb881236c66Siva Velusamyextern void initEglDebugLevel(); 43518ec112f468eb67bf681b3eec896d7bfb4ff98dMathias Agopianextern void setGLHooksThreadSpecific(gl_hooks_t const *value); 44518ec112f468eb67bf681b3eec896d7bfb4ff98dMathias Agopian 45518ec112f468eb67bf681b3eec896d7bfb4ff98dMathias Agopian// ---------------------------------------------------------------------------- 46518ec112f468eb67bf681b3eec896d7bfb4ff98dMathias Agopian 47c2e41222bf02a6579763974f82d65875cfa43481Jesse Hallstatic bool findExtension(const char* exts, const char* name, size_t nameLen) { 48c2e41222bf02a6579763974f82d65875cfa43481Jesse Hall if (exts) { 49c2e41222bf02a6579763974f82d65875cfa43481Jesse Hall const char* match = strstr(exts, name); 50c2e41222bf02a6579763974f82d65875cfa43481Jesse Hall if (match && (match[nameLen] == '\0' || match[nameLen] == ' ')) { 51c2e41222bf02a6579763974f82d65875cfa43481Jesse Hall return true; 52c2e41222bf02a6579763974f82d65875cfa43481Jesse Hall } 53c2e41222bf02a6579763974f82d65875cfa43481Jesse Hall } 54c2e41222bf02a6579763974f82d65875cfa43481Jesse Hall return false; 55c2e41222bf02a6579763974f82d65875cfa43481Jesse Hall} 56c2e41222bf02a6579763974f82d65875cfa43481Jesse Hall 57518ec112f468eb67bf681b3eec896d7bfb4ff98dMathias Agopianegl_display_t egl_display_t::sDisplay[NUM_DISPLAYS]; 58518ec112f468eb67bf681b3eec896d7bfb4ff98dMathias Agopian 59518ec112f468eb67bf681b3eec896d7bfb4ff98dMathias Agopianegl_display_t::egl_display_t() : 6054466bc4412acf33a59af59d9eadde54c22b2ebeMichael Lentine magic('_dpy'), finishOnSwap(false), traceGpuCompletion(false), refs(0), eglIsInitialized(false) { 61518ec112f468eb67bf681b3eec896d7bfb4ff98dMathias Agopian} 62518ec112f468eb67bf681b3eec896d7bfb4ff98dMathias Agopian 63518ec112f468eb67bf681b3eec896d7bfb4ff98dMathias Agopianegl_display_t::~egl_display_t() { 64518ec112f468eb67bf681b3eec896d7bfb4ff98dMathias Agopian magic = 0; 65766010858ea7696d64f1b559413670bdd8627595Jamie Gennis egl_cache_t::get()->terminate(); 66518ec112f468eb67bf681b3eec896d7bfb4ff98dMathias Agopian} 67518ec112f468eb67bf681b3eec896d7bfb4ff98dMathias Agopian 68518ec112f468eb67bf681b3eec896d7bfb4ff98dMathias Agopianegl_display_t* egl_display_t::get(EGLDisplay dpy) { 69518ec112f468eb67bf681b3eec896d7bfb4ff98dMathias Agopian uintptr_t index = uintptr_t(dpy)-1U; 70518ec112f468eb67bf681b3eec896d7bfb4ff98dMathias Agopian return (index >= NUM_DISPLAYS) ? NULL : &sDisplay[index]; 71518ec112f468eb67bf681b3eec896d7bfb4ff98dMathias Agopian} 72518ec112f468eb67bf681b3eec896d7bfb4ff98dMathias Agopian 73518ec112f468eb67bf681b3eec896d7bfb4ff98dMathias Agopianvoid egl_display_t::addObject(egl_object_t* object) { 74518ec112f468eb67bf681b3eec896d7bfb4ff98dMathias Agopian Mutex::Autolock _l(lock); 75518ec112f468eb67bf681b3eec896d7bfb4ff98dMathias Agopian objects.add(object); 76518ec112f468eb67bf681b3eec896d7bfb4ff98dMathias Agopian} 77518ec112f468eb67bf681b3eec896d7bfb4ff98dMathias Agopian 785b287a6ea8dfac7ab3e03ae1e98f9e2214cbae09Mathias Agopianvoid egl_display_t::removeObject(egl_object_t* object) { 79518ec112f468eb67bf681b3eec896d7bfb4ff98dMathias Agopian Mutex::Autolock _l(lock); 805b287a6ea8dfac7ab3e03ae1e98f9e2214cbae09Mathias Agopian objects.remove(object); 81518ec112f468eb67bf681b3eec896d7bfb4ff98dMathias Agopian} 82518ec112f468eb67bf681b3eec896d7bfb4ff98dMathias Agopian 83f0480de37492597a5c5cf1e6f8346f1467e3a552Mathias Agopianbool egl_display_t::getObject(egl_object_t* object) const { 84518ec112f468eb67bf681b3eec896d7bfb4ff98dMathias Agopian Mutex::Autolock _l(lock); 855b287a6ea8dfac7ab3e03ae1e98f9e2214cbae09Mathias Agopian if (objects.indexOf(object) >= 0) { 86f0480de37492597a5c5cf1e6f8346f1467e3a552Mathias Agopian if (object->getDisplay() == this) { 87f0480de37492597a5c5cf1e6f8346f1467e3a552Mathias Agopian object->incRef(); 88f0480de37492597a5c5cf1e6f8346f1467e3a552Mathias Agopian return true; 89f0480de37492597a5c5cf1e6f8346f1467e3a552Mathias Agopian } 90518ec112f468eb67bf681b3eec896d7bfb4ff98dMathias Agopian } 91518ec112f468eb67bf681b3eec896d7bfb4ff98dMathias Agopian return false; 92518ec112f468eb67bf681b3eec896d7bfb4ff98dMathias Agopian} 93518ec112f468eb67bf681b3eec896d7bfb4ff98dMathias Agopian 94518ec112f468eb67bf681b3eec896d7bfb4ff98dMathias AgopianEGLDisplay egl_display_t::getFromNativeDisplay(EGLNativeDisplayType disp) { 95518ec112f468eb67bf681b3eec896d7bfb4ff98dMathias Agopian if (uintptr_t(disp) >= NUM_DISPLAYS) 96518ec112f468eb67bf681b3eec896d7bfb4ff98dMathias Agopian return NULL; 97518ec112f468eb67bf681b3eec896d7bfb4ff98dMathias Agopian 98518ec112f468eb67bf681b3eec896d7bfb4ff98dMathias Agopian return sDisplay[uintptr_t(disp)].getDisplay(disp); 99518ec112f468eb67bf681b3eec896d7bfb4ff98dMathias Agopian} 100518ec112f468eb67bf681b3eec896d7bfb4ff98dMathias Agopian 101518ec112f468eb67bf681b3eec896d7bfb4ff98dMathias AgopianEGLDisplay egl_display_t::getDisplay(EGLNativeDisplayType display) { 102518ec112f468eb67bf681b3eec896d7bfb4ff98dMathias Agopian 103518ec112f468eb67bf681b3eec896d7bfb4ff98dMathias Agopian Mutex::Autolock _l(lock); 104518ec112f468eb67bf681b3eec896d7bfb4ff98dMathias Agopian 105518ec112f468eb67bf681b3eec896d7bfb4ff98dMathias Agopian // get our driver loader 106518ec112f468eb67bf681b3eec896d7bfb4ff98dMathias Agopian Loader& loader(Loader::getInstance()); 107518ec112f468eb67bf681b3eec896d7bfb4ff98dMathias Agopian 108ada798b7ca7cabc255aa159964b64975e7fdb2dfMathias Agopian egl_connection_t* const cnx = &gEGLImpl; 109ada798b7ca7cabc255aa159964b64975e7fdb2dfMathias Agopian if (cnx->dso && disp.dpy == EGL_NO_DISPLAY) { 110ada798b7ca7cabc255aa159964b64975e7fdb2dfMathias Agopian EGLDisplay dpy = cnx->egl.eglGetDisplay(display); 111ada798b7ca7cabc255aa159964b64975e7fdb2dfMathias Agopian disp.dpy = dpy; 112ada798b7ca7cabc255aa159964b64975e7fdb2dfMathias Agopian if (dpy == EGL_NO_DISPLAY) { 113ada798b7ca7cabc255aa159964b64975e7fdb2dfMathias Agopian loader.close(cnx->dso); 114ada798b7ca7cabc255aa159964b64975e7fdb2dfMathias Agopian cnx->dso = NULL; 115518ec112f468eb67bf681b3eec896d7bfb4ff98dMathias Agopian } 116518ec112f468eb67bf681b3eec896d7bfb4ff98dMathias Agopian } 117518ec112f468eb67bf681b3eec896d7bfb4ff98dMathias Agopian 118518ec112f468eb67bf681b3eec896d7bfb4ff98dMathias Agopian return EGLDisplay(uintptr_t(display) + 1U); 119518ec112f468eb67bf681b3eec896d7bfb4ff98dMathias Agopian} 120518ec112f468eb67bf681b3eec896d7bfb4ff98dMathias Agopian 121518ec112f468eb67bf681b3eec896d7bfb4ff98dMathias AgopianEGLBoolean egl_display_t::initialize(EGLint *major, EGLint *minor) { 122518ec112f468eb67bf681b3eec896d7bfb4ff98dMathias Agopian 12354466bc4412acf33a59af59d9eadde54c22b2ebeMichael Lentine { 12454466bc4412acf33a59af59d9eadde54c22b2ebeMichael Lentine Mutex::Autolock _rf(refLock); 125518ec112f468eb67bf681b3eec896d7bfb4ff98dMathias Agopian 126518ec112f468eb67bf681b3eec896d7bfb4ff98dMathias Agopian refs++; 12754466bc4412acf33a59af59d9eadde54c22b2ebeMichael Lentine if (refs > 1) { 12854466bc4412acf33a59af59d9eadde54c22b2ebeMichael Lentine if (major != NULL) 12954466bc4412acf33a59af59d9eadde54c22b2ebeMichael Lentine *major = VERSION_MAJOR; 13054466bc4412acf33a59af59d9eadde54c22b2ebeMichael Lentine if (minor != NULL) 13154466bc4412acf33a59af59d9eadde54c22b2ebeMichael Lentine *minor = VERSION_MINOR; 13254466bc4412acf33a59af59d9eadde54c22b2ebeMichael Lentine while(!eglIsInitialized) refCond.wait(refLock); 13354466bc4412acf33a59af59d9eadde54c22b2ebeMichael Lentine return EGL_TRUE; 13454466bc4412acf33a59af59d9eadde54c22b2ebeMichael Lentine } 13554466bc4412acf33a59af59d9eadde54c22b2ebeMichael Lentine 13654466bc4412acf33a59af59d9eadde54c22b2ebeMichael Lentine while(eglIsInitialized) refCond.wait(refLock); 137518ec112f468eb67bf681b3eec896d7bfb4ff98dMathias Agopian } 138518ec112f468eb67bf681b3eec896d7bfb4ff98dMathias Agopian 13954466bc4412acf33a59af59d9eadde54c22b2ebeMichael Lentine { 14054466bc4412acf33a59af59d9eadde54c22b2ebeMichael Lentine Mutex::Autolock _l(lock); 14154466bc4412acf33a59af59d9eadde54c22b2ebeMichael Lentine 142518ec112f468eb67bf681b3eec896d7bfb4ff98dMathias Agopian#if EGL_TRACE 143518ec112f468eb67bf681b3eec896d7bfb4ff98dMathias Agopian 14454466bc4412acf33a59af59d9eadde54c22b2ebeMichael Lentine // Called both at early_init time and at this time. (Early_init is pre-zygote, so 14554466bc4412acf33a59af59d9eadde54c22b2ebeMichael Lentine // the information from that call may be stale.) 14654466bc4412acf33a59af59d9eadde54c22b2ebeMichael Lentine initEglTraceLevel(); 14754466bc4412acf33a59af59d9eadde54c22b2ebeMichael Lentine initEglDebugLevel(); 148518ec112f468eb67bf681b3eec896d7bfb4ff98dMathias Agopian 149518ec112f468eb67bf681b3eec896d7bfb4ff98dMathias Agopian#endif 150518ec112f468eb67bf681b3eec896d7bfb4ff98dMathias Agopian 15154466bc4412acf33a59af59d9eadde54c22b2ebeMichael Lentine setGLHooksThreadSpecific(&gHooksNoContext); 15254466bc4412acf33a59af59d9eadde54c22b2ebeMichael Lentine 15354466bc4412acf33a59af59d9eadde54c22b2ebeMichael Lentine // initialize each EGL and 15454466bc4412acf33a59af59d9eadde54c22b2ebeMichael Lentine // build our own extension string first, based on the extension we know 15554466bc4412acf33a59af59d9eadde54c22b2ebeMichael Lentine // and the extension supported by our client implementation 15654466bc4412acf33a59af59d9eadde54c22b2ebeMichael Lentine 15754466bc4412acf33a59af59d9eadde54c22b2ebeMichael Lentine egl_connection_t* const cnx = &gEGLImpl; 15854466bc4412acf33a59af59d9eadde54c22b2ebeMichael Lentine cnx->major = -1; 15954466bc4412acf33a59af59d9eadde54c22b2ebeMichael Lentine cnx->minor = -1; 16054466bc4412acf33a59af59d9eadde54c22b2ebeMichael Lentine if (cnx->dso) { 16154466bc4412acf33a59af59d9eadde54c22b2ebeMichael Lentine EGLDisplay idpy = disp.dpy; 16254466bc4412acf33a59af59d9eadde54c22b2ebeMichael Lentine if (cnx->egl.eglInitialize(idpy, &cnx->major, &cnx->minor)) { 16354466bc4412acf33a59af59d9eadde54c22b2ebeMichael Lentine //ALOGD("initialized dpy=%p, ver=%d.%d, cnx=%p", 16454466bc4412acf33a59af59d9eadde54c22b2ebeMichael Lentine // idpy, cnx->major, cnx->minor, cnx); 16554466bc4412acf33a59af59d9eadde54c22b2ebeMichael Lentine 16654466bc4412acf33a59af59d9eadde54c22b2ebeMichael Lentine // display is now initialized 16754466bc4412acf33a59af59d9eadde54c22b2ebeMichael Lentine disp.state = egl_display_t::INITIALIZED; 16854466bc4412acf33a59af59d9eadde54c22b2ebeMichael Lentine 16954466bc4412acf33a59af59d9eadde54c22b2ebeMichael Lentine // get the query-strings for this display for each implementation 17054466bc4412acf33a59af59d9eadde54c22b2ebeMichael Lentine disp.queryString.vendor = cnx->egl.eglQueryString(idpy, 17154466bc4412acf33a59af59d9eadde54c22b2ebeMichael Lentine EGL_VENDOR); 17254466bc4412acf33a59af59d9eadde54c22b2ebeMichael Lentine disp.queryString.version = cnx->egl.eglQueryString(idpy, 17354466bc4412acf33a59af59d9eadde54c22b2ebeMichael Lentine EGL_VERSION); 17454466bc4412acf33a59af59d9eadde54c22b2ebeMichael Lentine disp.queryString.extensions = cnx->egl.eglQueryString(idpy, 17554466bc4412acf33a59af59d9eadde54c22b2ebeMichael Lentine EGL_EXTENSIONS); 17654466bc4412acf33a59af59d9eadde54c22b2ebeMichael Lentine disp.queryString.clientApi = cnx->egl.eglQueryString(idpy, 17754466bc4412acf33a59af59d9eadde54c22b2ebeMichael Lentine EGL_CLIENT_APIS); 17854466bc4412acf33a59af59d9eadde54c22b2ebeMichael Lentine 17954466bc4412acf33a59af59d9eadde54c22b2ebeMichael Lentine } else { 18054466bc4412acf33a59af59d9eadde54c22b2ebeMichael Lentine ALOGW("eglInitialize(%p) failed (%s)", idpy, 18154466bc4412acf33a59af59d9eadde54c22b2ebeMichael Lentine egl_tls_t::egl_strerror(cnx->egl.eglGetError())); 18254466bc4412acf33a59af59d9eadde54c22b2ebeMichael Lentine } 183518ec112f468eb67bf681b3eec896d7bfb4ff98dMathias Agopian } 184518ec112f468eb67bf681b3eec896d7bfb4ff98dMathias Agopian 18554466bc4412acf33a59af59d9eadde54c22b2ebeMichael Lentine // the query strings are per-display 18654466bc4412acf33a59af59d9eadde54c22b2ebeMichael Lentine mVendorString.setTo(sVendorString); 18754466bc4412acf33a59af59d9eadde54c22b2ebeMichael Lentine mVersionString.setTo(sVersionString); 18854466bc4412acf33a59af59d9eadde54c22b2ebeMichael Lentine mClientApiString.setTo(sClientApiString); 18954466bc4412acf33a59af59d9eadde54c22b2ebeMichael Lentine 19054466bc4412acf33a59af59d9eadde54c22b2ebeMichael Lentine mExtensionString.setTo(gBuiltinExtensionString); 19154466bc4412acf33a59af59d9eadde54c22b2ebeMichael Lentine char const* start = gExtensionString; 19254466bc4412acf33a59af59d9eadde54c22b2ebeMichael Lentine char const* end; 19354466bc4412acf33a59af59d9eadde54c22b2ebeMichael Lentine do { 19454466bc4412acf33a59af59d9eadde54c22b2ebeMichael Lentine // find the space separating this extension for the next one 19554466bc4412acf33a59af59d9eadde54c22b2ebeMichael Lentine end = strchr(start, ' '); 19654466bc4412acf33a59af59d9eadde54c22b2ebeMichael Lentine if (end) { 19754466bc4412acf33a59af59d9eadde54c22b2ebeMichael Lentine // length of the extension string 19854466bc4412acf33a59af59d9eadde54c22b2ebeMichael Lentine const size_t len = end - start; 19954466bc4412acf33a59af59d9eadde54c22b2ebeMichael Lentine if (len) { 20054466bc4412acf33a59af59d9eadde54c22b2ebeMichael Lentine // NOTE: we could avoid the copy if we had strnstr. 20154466bc4412acf33a59af59d9eadde54c22b2ebeMichael Lentine const String8 ext(start, len); 20254466bc4412acf33a59af59d9eadde54c22b2ebeMichael Lentine if (findExtension(disp.queryString.extensions, ext.string(), 20354466bc4412acf33a59af59d9eadde54c22b2ebeMichael Lentine len)) { 20454466bc4412acf33a59af59d9eadde54c22b2ebeMichael Lentine mExtensionString.append(start, len+1); 20554466bc4412acf33a59af59d9eadde54c22b2ebeMichael Lentine } 2064b9511c16195a646242eff833b0af212933b6ecaMathias Agopian } 20754466bc4412acf33a59af59d9eadde54c22b2ebeMichael Lentine // process the next extension string, and skip the space. 20854466bc4412acf33a59af59d9eadde54c22b2ebeMichael Lentine start = end + 1; 2094b9511c16195a646242eff833b0af212933b6ecaMathias Agopian } 21054466bc4412acf33a59af59d9eadde54c22b2ebeMichael Lentine } while (end); 21154466bc4412acf33a59af59d9eadde54c22b2ebeMichael Lentine 21254466bc4412acf33a59af59d9eadde54c22b2ebeMichael Lentine egl_cache_t::get()->initialize(this); 21354466bc4412acf33a59af59d9eadde54c22b2ebeMichael Lentine 21454466bc4412acf33a59af59d9eadde54c22b2ebeMichael Lentine char value[PROPERTY_VALUE_MAX]; 21554466bc4412acf33a59af59d9eadde54c22b2ebeMichael Lentine property_get("debug.egl.finish", value, "0"); 21654466bc4412acf33a59af59d9eadde54c22b2ebeMichael Lentine if (atoi(value)) { 21754466bc4412acf33a59af59d9eadde54c22b2ebeMichael Lentine finishOnSwap = true; 2184b9511c16195a646242eff833b0af212933b6ecaMathias Agopian } 2194b9511c16195a646242eff833b0af212933b6ecaMathias Agopian 22054466bc4412acf33a59af59d9eadde54c22b2ebeMichael Lentine property_get("debug.egl.traceGpuCompletion", value, "0"); 22154466bc4412acf33a59af59d9eadde54c22b2ebeMichael Lentine if (atoi(value)) { 22254466bc4412acf33a59af59d9eadde54c22b2ebeMichael Lentine traceGpuCompletion = true; 22354466bc4412acf33a59af59d9eadde54c22b2ebeMichael Lentine } 224aca51c06f38155f1435fbc6944d7fc0a9bf1e4e9Jamie Gennis 22554466bc4412acf33a59af59d9eadde54c22b2ebeMichael Lentine if (major != NULL) 22654466bc4412acf33a59af59d9eadde54c22b2ebeMichael Lentine *major = VERSION_MAJOR; 22754466bc4412acf33a59af59d9eadde54c22b2ebeMichael Lentine if (minor != NULL) 22854466bc4412acf33a59af59d9eadde54c22b2ebeMichael Lentine *minor = VERSION_MINOR; 2297db993a98b9239bd4e384cc4aa128262fe3cf52cMathias Agopian 23054466bc4412acf33a59af59d9eadde54c22b2ebeMichael Lentine mHibernation.setDisplayValid(true); 23128ef8d7911dbfd1bf8256fb43acba894d87fc07aJamie Gennis } 23228ef8d7911dbfd1bf8256fb43acba894d87fc07aJamie Gennis 23354466bc4412acf33a59af59d9eadde54c22b2ebeMichael Lentine { 23454466bc4412acf33a59af59d9eadde54c22b2ebeMichael Lentine Mutex::Autolock _rf(refLock); 23554466bc4412acf33a59af59d9eadde54c22b2ebeMichael Lentine eglIsInitialized = true; 23654466bc4412acf33a59af59d9eadde54c22b2ebeMichael Lentine refCond.broadcast(); 23754466bc4412acf33a59af59d9eadde54c22b2ebeMichael Lentine } 238a0fef1c8bb22443402fb3aeda7ce70f7d5775b0aJesse Hall 2397773c435bc5da8217433e1b242d3a6712a17b5f7Mathias Agopian return EGL_TRUE; 240518ec112f468eb67bf681b3eec896d7bfb4ff98dMathias Agopian} 241518ec112f468eb67bf681b3eec896d7bfb4ff98dMathias Agopian 242518ec112f468eb67bf681b3eec896d7bfb4ff98dMathias AgopianEGLBoolean egl_display_t::terminate() { 243518ec112f468eb67bf681b3eec896d7bfb4ff98dMathias Agopian 24454466bc4412acf33a59af59d9eadde54c22b2ebeMichael Lentine { 24554466bc4412acf33a59af59d9eadde54c22b2ebeMichael Lentine Mutex::Autolock _rl(refLock); 24654466bc4412acf33a59af59d9eadde54c22b2ebeMichael Lentine if (refs == 0) { 24754466bc4412acf33a59af59d9eadde54c22b2ebeMichael Lentine /* 24854466bc4412acf33a59af59d9eadde54c22b2ebeMichael Lentine * From the EGL spec (3.2): 24954466bc4412acf33a59af59d9eadde54c22b2ebeMichael Lentine * "Termination of a display that has already been terminated, 25054466bc4412acf33a59af59d9eadde54c22b2ebeMichael Lentine * (...), is allowed, but the only effect of such a call is 25154466bc4412acf33a59af59d9eadde54c22b2ebeMichael Lentine * to return EGL_TRUE (...) 25254466bc4412acf33a59af59d9eadde54c22b2ebeMichael Lentine */ 25354466bc4412acf33a59af59d9eadde54c22b2ebeMichael Lentine return EGL_TRUE; 25454466bc4412acf33a59af59d9eadde54c22b2ebeMichael Lentine } 255518ec112f468eb67bf681b3eec896d7bfb4ff98dMathias Agopian 25654466bc4412acf33a59af59d9eadde54c22b2ebeMichael Lentine // this is specific to Android, display termination is ref-counted. 257518ec112f468eb67bf681b3eec896d7bfb4ff98dMathias Agopian refs--; 25854466bc4412acf33a59af59d9eadde54c22b2ebeMichael Lentine if (refs > 0) { 25954466bc4412acf33a59af59d9eadde54c22b2ebeMichael Lentine return EGL_TRUE; 26054466bc4412acf33a59af59d9eadde54c22b2ebeMichael Lentine } 261518ec112f468eb67bf681b3eec896d7bfb4ff98dMathias Agopian } 262518ec112f468eb67bf681b3eec896d7bfb4ff98dMathias Agopian 263518ec112f468eb67bf681b3eec896d7bfb4ff98dMathias Agopian EGLBoolean res = EGL_FALSE; 26454466bc4412acf33a59af59d9eadde54c22b2ebeMichael Lentine 26554466bc4412acf33a59af59d9eadde54c22b2ebeMichael Lentine { 26654466bc4412acf33a59af59d9eadde54c22b2ebeMichael Lentine Mutex::Autolock _l(lock); 26754466bc4412acf33a59af59d9eadde54c22b2ebeMichael Lentine 26854466bc4412acf33a59af59d9eadde54c22b2ebeMichael Lentine egl_connection_t* const cnx = &gEGLImpl; 26954466bc4412acf33a59af59d9eadde54c22b2ebeMichael Lentine if (cnx->dso && disp.state == egl_display_t::INITIALIZED) { 27054466bc4412acf33a59af59d9eadde54c22b2ebeMichael Lentine if (cnx->egl.eglTerminate(disp.dpy) == EGL_FALSE) { 27154466bc4412acf33a59af59d9eadde54c22b2ebeMichael Lentine ALOGW("eglTerminate(%p) failed (%s)", disp.dpy, 27254466bc4412acf33a59af59d9eadde54c22b2ebeMichael Lentine egl_tls_t::egl_strerror(cnx->egl.eglGetError())); 27354466bc4412acf33a59af59d9eadde54c22b2ebeMichael Lentine } 27454466bc4412acf33a59af59d9eadde54c22b2ebeMichael Lentine // REVISIT: it's unclear what to do if eglTerminate() fails 27554466bc4412acf33a59af59d9eadde54c22b2ebeMichael Lentine disp.state = egl_display_t::TERMINATED; 27654466bc4412acf33a59af59d9eadde54c22b2ebeMichael Lentine res = EGL_TRUE; 277ada798b7ca7cabc255aa159964b64975e7fdb2dfMathias Agopian } 278518ec112f468eb67bf681b3eec896d7bfb4ff98dMathias Agopian 27954466bc4412acf33a59af59d9eadde54c22b2ebeMichael Lentine mHibernation.setDisplayValid(false); 28054466bc4412acf33a59af59d9eadde54c22b2ebeMichael Lentine 28154466bc4412acf33a59af59d9eadde54c22b2ebeMichael Lentine // Reset the extension string since it will be regenerated if we get 28254466bc4412acf33a59af59d9eadde54c22b2ebeMichael Lentine // reinitialized. 28354466bc4412acf33a59af59d9eadde54c22b2ebeMichael Lentine mExtensionString.setTo(""); 284a0fef1c8bb22443402fb3aeda7ce70f7d5775b0aJesse Hall 28554466bc4412acf33a59af59d9eadde54c22b2ebeMichael Lentine // Mark all objects remaining in the list as terminated, unless 28654466bc4412acf33a59af59d9eadde54c22b2ebeMichael Lentine // there are no reference to them, it which case, we're free to 28754466bc4412acf33a59af59d9eadde54c22b2ebeMichael Lentine // delete them. 28854466bc4412acf33a59af59d9eadde54c22b2ebeMichael Lentine size_t count = objects.size(); 28954466bc4412acf33a59af59d9eadde54c22b2ebeMichael Lentine ALOGW_IF(count, "eglTerminate() called w/ %d objects remaining", count); 29054466bc4412acf33a59af59d9eadde54c22b2ebeMichael Lentine for (size_t i=0 ; i<count ; i++) { 29154466bc4412acf33a59af59d9eadde54c22b2ebeMichael Lentine egl_object_t* o = objects.itemAt(i); 29254466bc4412acf33a59af59d9eadde54c22b2ebeMichael Lentine o->destroy(); 29354466bc4412acf33a59af59d9eadde54c22b2ebeMichael Lentine } 294a08cf6e3a4ee045608bc8991a779dedb4f281a3fJamie Gennis 29554466bc4412acf33a59af59d9eadde54c22b2ebeMichael Lentine // this marks all object handles are "terminated" 29654466bc4412acf33a59af59d9eadde54c22b2ebeMichael Lentine objects.clear(); 2975b287a6ea8dfac7ab3e03ae1e98f9e2214cbae09Mathias Agopian } 2985b287a6ea8dfac7ab3e03ae1e98f9e2214cbae09Mathias Agopian 29954466bc4412acf33a59af59d9eadde54c22b2ebeMichael Lentine { 30054466bc4412acf33a59af59d9eadde54c22b2ebeMichael Lentine Mutex::Autolock _rl(refLock); 30154466bc4412acf33a59af59d9eadde54c22b2ebeMichael Lentine eglIsInitialized = false; 30254466bc4412acf33a59af59d9eadde54c22b2ebeMichael Lentine refCond.broadcast(); 30354466bc4412acf33a59af59d9eadde54c22b2ebeMichael Lentine } 304518ec112f468eb67bf681b3eec896d7bfb4ff98dMathias Agopian 305518ec112f468eb67bf681b3eec896d7bfb4ff98dMathias Agopian return res; 306518ec112f468eb67bf681b3eec896d7bfb4ff98dMathias Agopian} 307518ec112f468eb67bf681b3eec896d7bfb4ff98dMathias Agopian 308fb87e54a9af8bc5063ca4deebe81d90126992480Mathias Agopianvoid egl_display_t::loseCurrent(egl_context_t * cur_c) 309fb87e54a9af8bc5063ca4deebe81d90126992480Mathias Agopian{ 310fb87e54a9af8bc5063ca4deebe81d90126992480Mathias Agopian if (cur_c) { 311a4b2c041828d1074dca3b999407e7dd85568c5aaMathias Agopian egl_display_t* display = cur_c->getDisplay(); 312a4b2c041828d1074dca3b999407e7dd85568c5aaMathias Agopian if (display) { 313a4b2c041828d1074dca3b999407e7dd85568c5aaMathias Agopian display->loseCurrentImpl(cur_c); 314a4b2c041828d1074dca3b999407e7dd85568c5aaMathias Agopian } 315a4b2c041828d1074dca3b999407e7dd85568c5aaMathias Agopian } 316a4b2c041828d1074dca3b999407e7dd85568c5aaMathias Agopian} 317fb87e54a9af8bc5063ca4deebe81d90126992480Mathias Agopian 318a4b2c041828d1074dca3b999407e7dd85568c5aaMathias Agopianvoid egl_display_t::loseCurrentImpl(egl_context_t * cur_c) 319a4b2c041828d1074dca3b999407e7dd85568c5aaMathias Agopian{ 320a4b2c041828d1074dca3b999407e7dd85568c5aaMathias Agopian // by construction, these are either 0 or valid (possibly terminated) 321a4b2c041828d1074dca3b999407e7dd85568c5aaMathias Agopian // it should be impossible for these to be invalid 322a4b2c041828d1074dca3b999407e7dd85568c5aaMathias Agopian ContextRef _cur_c(cur_c); 323a4b2c041828d1074dca3b999407e7dd85568c5aaMathias Agopian SurfaceRef _cur_r(cur_c ? get_surface(cur_c->read) : NULL); 324a4b2c041828d1074dca3b999407e7dd85568c5aaMathias Agopian SurfaceRef _cur_d(cur_c ? get_surface(cur_c->draw) : NULL); 325a4b2c041828d1074dca3b999407e7dd85568c5aaMathias Agopian 326a4b2c041828d1074dca3b999407e7dd85568c5aaMathias Agopian { // scope for the lock 327a4b2c041828d1074dca3b999407e7dd85568c5aaMathias Agopian Mutex::Autolock _l(lock); 328fb87e54a9af8bc5063ca4deebe81d90126992480Mathias Agopian cur_c->onLooseCurrent(); 329fb87e54a9af8bc5063ca4deebe81d90126992480Mathias Agopian 330fb87e54a9af8bc5063ca4deebe81d90126992480Mathias Agopian } 331a4b2c041828d1074dca3b999407e7dd85568c5aaMathias Agopian 332a4b2c041828d1074dca3b999407e7dd85568c5aaMathias Agopian // This cannot be called with the lock held because it might end-up 333a4b2c041828d1074dca3b999407e7dd85568c5aaMathias Agopian // calling back into EGL (in particular when a surface is destroyed 334a4b2c041828d1074dca3b999407e7dd85568c5aaMathias Agopian // it calls ANativeWindow::disconnect 335a4b2c041828d1074dca3b999407e7dd85568c5aaMathias Agopian _cur_c.release(); 336a4b2c041828d1074dca3b999407e7dd85568c5aaMathias Agopian _cur_r.release(); 337a4b2c041828d1074dca3b999407e7dd85568c5aaMathias Agopian _cur_d.release(); 338fb87e54a9af8bc5063ca4deebe81d90126992480Mathias Agopian} 339fb87e54a9af8bc5063ca4deebe81d90126992480Mathias Agopian 340fb87e54a9af8bc5063ca4deebe81d90126992480Mathias AgopianEGLBoolean egl_display_t::makeCurrent(egl_context_t* c, egl_context_t* cur_c, 34192dc3fc52cf097bd105460cf377779bdcf146d62Mark Salyzyn EGLSurface draw, EGLSurface read, EGLContext /*ctx*/, 342fb87e54a9af8bc5063ca4deebe81d90126992480Mathias Agopian EGLSurface impl_draw, EGLSurface impl_read, EGLContext impl_ctx) 343fb87e54a9af8bc5063ca4deebe81d90126992480Mathias Agopian{ 344fb87e54a9af8bc5063ca4deebe81d90126992480Mathias Agopian EGLBoolean result; 345a4b2c041828d1074dca3b999407e7dd85568c5aaMathias Agopian 346a4b2c041828d1074dca3b999407e7dd85568c5aaMathias Agopian // by construction, these are either 0 or valid (possibly terminated) 347a4b2c041828d1074dca3b999407e7dd85568c5aaMathias Agopian // it should be impossible for these to be invalid 348a4b2c041828d1074dca3b999407e7dd85568c5aaMathias Agopian ContextRef _cur_c(cur_c); 349a4b2c041828d1074dca3b999407e7dd85568c5aaMathias Agopian SurfaceRef _cur_r(cur_c ? get_surface(cur_c->read) : NULL); 350a4b2c041828d1074dca3b999407e7dd85568c5aaMathias Agopian SurfaceRef _cur_d(cur_c ? get_surface(cur_c->draw) : NULL); 351a4b2c041828d1074dca3b999407e7dd85568c5aaMathias Agopian 352a4b2c041828d1074dca3b999407e7dd85568c5aaMathias Agopian { // scope for the lock 353a4b2c041828d1074dca3b999407e7dd85568c5aaMathias Agopian Mutex::Autolock _l(lock); 354fb87e54a9af8bc5063ca4deebe81d90126992480Mathias Agopian if (c) { 355a4b2c041828d1074dca3b999407e7dd85568c5aaMathias Agopian result = c->cnx->egl.eglMakeCurrent( 356ada798b7ca7cabc255aa159964b64975e7fdb2dfMathias Agopian disp.dpy, impl_draw, impl_read, impl_ctx); 357a4b2c041828d1074dca3b999407e7dd85568c5aaMathias Agopian if (result == EGL_TRUE) { 358a4b2c041828d1074dca3b999407e7dd85568c5aaMathias Agopian c->onMakeCurrent(draw, read); 359258385978c517a47626161b1e644c48bcee28de1Jesse Hall if (!cur_c) { 360a0fef1c8bb22443402fb3aeda7ce70f7d5775b0aJesse Hall mHibernation.incWakeCount(HibernationMachine::STRONG); 361258385978c517a47626161b1e644c48bcee28de1Jesse Hall } 362a4b2c041828d1074dca3b999407e7dd85568c5aaMathias Agopian } 363a4b2c041828d1074dca3b999407e7dd85568c5aaMathias Agopian } else { 364a4b2c041828d1074dca3b999407e7dd85568c5aaMathias Agopian result = cur_c->cnx->egl.eglMakeCurrent( 365ada798b7ca7cabc255aa159964b64975e7fdb2dfMathias Agopian disp.dpy, impl_draw, impl_read, impl_ctx); 366a4b2c041828d1074dca3b999407e7dd85568c5aaMathias Agopian if (result == EGL_TRUE) { 367a4b2c041828d1074dca3b999407e7dd85568c5aaMathias Agopian cur_c->onLooseCurrent(); 368a0fef1c8bb22443402fb3aeda7ce70f7d5775b0aJesse Hall mHibernation.decWakeCount(HibernationMachine::STRONG); 369a4b2c041828d1074dca3b999407e7dd85568c5aaMathias Agopian } 370fb87e54a9af8bc5063ca4deebe81d90126992480Mathias Agopian } 371fb87e54a9af8bc5063ca4deebe81d90126992480Mathias Agopian } 372a4b2c041828d1074dca3b999407e7dd85568c5aaMathias Agopian 373a4b2c041828d1074dca3b999407e7dd85568c5aaMathias Agopian if (result == EGL_TRUE) { 374a4b2c041828d1074dca3b999407e7dd85568c5aaMathias Agopian // This cannot be called with the lock held because it might end-up 375a4b2c041828d1074dca3b999407e7dd85568c5aaMathias Agopian // calling back into EGL (in particular when a surface is destroyed 376a4b2c041828d1074dca3b999407e7dd85568c5aaMathias Agopian // it calls ANativeWindow::disconnect 377a4b2c041828d1074dca3b999407e7dd85568c5aaMathias Agopian _cur_c.release(); 378a4b2c041828d1074dca3b999407e7dd85568c5aaMathias Agopian _cur_r.release(); 379a4b2c041828d1074dca3b999407e7dd85568c5aaMathias Agopian _cur_d.release(); 380a4b2c041828d1074dca3b999407e7dd85568c5aaMathias Agopian } 381a4b2c041828d1074dca3b999407e7dd85568c5aaMathias Agopian 382fb87e54a9af8bc5063ca4deebe81d90126992480Mathias Agopian return result; 383fb87e54a9af8bc5063ca4deebe81d90126992480Mathias Agopian} 384518ec112f468eb67bf681b3eec896d7bfb4ff98dMathias Agopian 385c2e41222bf02a6579763974f82d65875cfa43481Jesse Hallbool egl_display_t::haveExtension(const char* name, size_t nameLen) const { 386c2e41222bf02a6579763974f82d65875cfa43481Jesse Hall if (!nameLen) { 387c2e41222bf02a6579763974f82d65875cfa43481Jesse Hall nameLen = strlen(name); 388c2e41222bf02a6579763974f82d65875cfa43481Jesse Hall } 389c2e41222bf02a6579763974f82d65875cfa43481Jesse Hall return findExtension(mExtensionString.string(), name, nameLen); 390c2e41222bf02a6579763974f82d65875cfa43481Jesse Hall} 391c2e41222bf02a6579763974f82d65875cfa43481Jesse Hall 392a0fef1c8bb22443402fb3aeda7ce70f7d5775b0aJesse Hall// ---------------------------------------------------------------------------- 393a0fef1c8bb22443402fb3aeda7ce70f7d5775b0aJesse Hall 394a0fef1c8bb22443402fb3aeda7ce70f7d5775b0aJesse Hallbool egl_display_t::HibernationMachine::incWakeCount(WakeRefStrength strength) { 395a0fef1c8bb22443402fb3aeda7ce70f7d5775b0aJesse Hall Mutex::Autolock _l(mLock); 396b29e5e8c2682ae145e8c56d9afb061f8da7f854cJesse Hall ALOGE_IF(mWakeCount < 0 || mWakeCount == INT32_MAX, 397b29e5e8c2682ae145e8c56d9afb061f8da7f854cJesse Hall "Invalid WakeCount (%d) on enter\n", mWakeCount); 398a0fef1c8bb22443402fb3aeda7ce70f7d5775b0aJesse Hall 399b29e5e8c2682ae145e8c56d9afb061f8da7f854cJesse Hall mWakeCount++; 400a0fef1c8bb22443402fb3aeda7ce70f7d5775b0aJesse Hall if (strength == STRONG) 401a0fef1c8bb22443402fb3aeda7ce70f7d5775b0aJesse Hall mAttemptHibernation = false; 402a0fef1c8bb22443402fb3aeda7ce70f7d5775b0aJesse Hall 403258385978c517a47626161b1e644c48bcee28de1Jesse Hall if (CC_UNLIKELY(mHibernating)) { 404258385978c517a47626161b1e644c48bcee28de1Jesse Hall ALOGV("Awakening\n"); 405258385978c517a47626161b1e644c48bcee28de1Jesse Hall egl_connection_t* const cnx = &gEGLImpl; 406a0fef1c8bb22443402fb3aeda7ce70f7d5775b0aJesse Hall 407a0fef1c8bb22443402fb3aeda7ce70f7d5775b0aJesse Hall // These conditions should be guaranteed before entering hibernation; 408a0fef1c8bb22443402fb3aeda7ce70f7d5775b0aJesse Hall // we don't want to get into a state where we can't wake up. 409a0fef1c8bb22443402fb3aeda7ce70f7d5775b0aJesse Hall ALOGD_IF(!mDpyValid || !cnx->egl.eglAwakenProcessIMG, 410a0fef1c8bb22443402fb3aeda7ce70f7d5775b0aJesse Hall "Invalid hibernation state, unable to awaken\n"); 411a0fef1c8bb22443402fb3aeda7ce70f7d5775b0aJesse Hall 412258385978c517a47626161b1e644c48bcee28de1Jesse Hall if (!cnx->egl.eglAwakenProcessIMG()) { 413258385978c517a47626161b1e644c48bcee28de1Jesse Hall ALOGE("Failed to awaken EGL implementation\n"); 414258385978c517a47626161b1e644c48bcee28de1Jesse Hall return false; 415258385978c517a47626161b1e644c48bcee28de1Jesse Hall } 416258385978c517a47626161b1e644c48bcee28de1Jesse Hall mHibernating = false; 417258385978c517a47626161b1e644c48bcee28de1Jesse Hall } 418b29e5e8c2682ae145e8c56d9afb061f8da7f854cJesse Hall return true; 419b29e5e8c2682ae145e8c56d9afb061f8da7f854cJesse Hall} 420b29e5e8c2682ae145e8c56d9afb061f8da7f854cJesse Hall 421a0fef1c8bb22443402fb3aeda7ce70f7d5775b0aJesse Hallvoid egl_display_t::HibernationMachine::decWakeCount(WakeRefStrength strength) { 422a0fef1c8bb22443402fb3aeda7ce70f7d5775b0aJesse Hall Mutex::Autolock _l(mLock); 423b29e5e8c2682ae145e8c56d9afb061f8da7f854cJesse Hall ALOGE_IF(mWakeCount <= 0, "Invalid WakeCount (%d) on leave\n", mWakeCount); 424a0fef1c8bb22443402fb3aeda7ce70f7d5775b0aJesse Hall 425a0fef1c8bb22443402fb3aeda7ce70f7d5775b0aJesse Hall mWakeCount--; 426a0fef1c8bb22443402fb3aeda7ce70f7d5775b0aJesse Hall if (strength == STRONG) 427a0fef1c8bb22443402fb3aeda7ce70f7d5775b0aJesse Hall mAttemptHibernation = true; 428a0fef1c8bb22443402fb3aeda7ce70f7d5775b0aJesse Hall 429a0fef1c8bb22443402fb3aeda7ce70f7d5775b0aJesse Hall if (mWakeCount == 0 && CC_UNLIKELY(mAttemptHibernation)) { 430258385978c517a47626161b1e644c48bcee28de1Jesse Hall egl_connection_t* const cnx = &gEGLImpl; 431258385978c517a47626161b1e644c48bcee28de1Jesse Hall mAttemptHibernation = false; 432201f3b2da572eb27b9d4b3131e6d8c3c92a13de8Jesse Hall if (mAllowHibernation && mDpyValid && 433a0fef1c8bb22443402fb3aeda7ce70f7d5775b0aJesse Hall cnx->egl.eglHibernateProcessIMG && 434a0fef1c8bb22443402fb3aeda7ce70f7d5775b0aJesse Hall cnx->egl.eglAwakenProcessIMG) { 435258385978c517a47626161b1e644c48bcee28de1Jesse Hall ALOGV("Hibernating\n"); 436258385978c517a47626161b1e644c48bcee28de1Jesse Hall if (!cnx->egl.eglHibernateProcessIMG()) { 437258385978c517a47626161b1e644c48bcee28de1Jesse Hall ALOGE("Failed to hibernate EGL implementation\n"); 438258385978c517a47626161b1e644c48bcee28de1Jesse Hall return; 439258385978c517a47626161b1e644c48bcee28de1Jesse Hall } 440258385978c517a47626161b1e644c48bcee28de1Jesse Hall mHibernating = true; 441258385978c517a47626161b1e644c48bcee28de1Jesse Hall } 442258385978c517a47626161b1e644c48bcee28de1Jesse Hall } 443258385978c517a47626161b1e644c48bcee28de1Jesse Hall} 444258385978c517a47626161b1e644c48bcee28de1Jesse Hall 445a0fef1c8bb22443402fb3aeda7ce70f7d5775b0aJesse Hallvoid egl_display_t::HibernationMachine::setDisplayValid(bool valid) { 446a0fef1c8bb22443402fb3aeda7ce70f7d5775b0aJesse Hall Mutex::Autolock _l(mLock); 447a0fef1c8bb22443402fb3aeda7ce70f7d5775b0aJesse Hall mDpyValid = valid; 448b29e5e8c2682ae145e8c56d9afb061f8da7f854cJesse Hall} 449b29e5e8c2682ae145e8c56d9afb061f8da7f854cJesse Hall 450518ec112f468eb67bf681b3eec896d7bfb4ff98dMathias Agopian// ---------------------------------------------------------------------------- 451518ec112f468eb67bf681b3eec896d7bfb4ff98dMathias Agopian}; // namespace android 452518ec112f468eb67bf681b3eec896d7bfb4ff98dMathias Agopian// ---------------------------------------------------------------------------- 453