diff options
author | Jean-Baptiste Queru <jbq@google.com> | 2012-08-20 09:42:32 -0700 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2012-08-20 09:42:32 -0700 |
commit | 0adc8f260023ec25c31ff4ceadde047528cb64ab (patch) | |
tree | f9fc4e4f0a6575c4e99ab2c2c64636f9ab996eab /opengl | |
parent | 2c7eb92b6394427bfe81962668d46194959bc722 (diff) | |
parent | 6e820eec21917f8e25c40dbc8b972468535af0e8 (diff) | |
download | frameworks_native-0adc8f260023ec25c31ff4ceadde047528cb64ab.zip frameworks_native-0adc8f260023ec25c31ff4ceadde047528cb64ab.tar.gz frameworks_native-0adc8f260023ec25c31ff4ceadde047528cb64ab.tar.bz2 |
am 6e820eec: am 6f89ebde: Merge "EGL: do not use sparse files for shader"
* commit '6e820eec21917f8e25c40dbc8b972468535af0e8':
EGL: do not use sparse files for shader
Diffstat (limited to 'opengl')
-rw-r--r-- | opengl/libs/EGL/egl_cache.cpp | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/opengl/libs/EGL/egl_cache.cpp b/opengl/libs/EGL/egl_cache.cpp index c79fb5f..ed2bef3 100644 --- a/opengl/libs/EGL/egl_cache.cpp +++ b/opengl/libs/EGL/egl_cache.cpp @@ -241,19 +241,11 @@ void egl_cache_t::saveBlobCacheLocked() { } size_t fileSize = headerSize + cacheSize; - if (ftruncate(fd, fileSize) == -1) { - ALOGE("error setting cache file size: %s (%d)", strerror(errno), - errno); - close(fd); - unlink(fname); - return; - } - uint8_t* buf = reinterpret_cast<uint8_t*>(mmap(NULL, fileSize, - PROT_WRITE, MAP_SHARED, fd, 0)); - if (buf == MAP_FAILED) { - ALOGE("error mmaping cache file: %s (%d)", strerror(errno), - errno); + uint8_t* buf = new uint8_t [fileSize]; + if (!buf) { + ALOGE("error allocating buffer for cache contents: %s (%d)", + strerror(errno), errno); close(fd); unlink(fname); return; @@ -264,7 +256,7 @@ void egl_cache_t::saveBlobCacheLocked() { if (err != OK) { ALOGE("error writing cache contents: %s (%d)", strerror(-err), -err); - munmap(buf, fileSize); + delete [] buf; close(fd); unlink(fname); return; @@ -275,7 +267,16 @@ void egl_cache_t::saveBlobCacheLocked() { uint32_t* crc = reinterpret_cast<uint32_t*>(buf + 4); *crc = crc32c(buf + headerSize, cacheSize); - munmap(buf, fileSize); + if (write(fd, buf, fileSize) == -1) { + ALOGE("error writing cache file: %s (%d)", strerror(errno), + errno); + delete [] buf; + close(fd); + unlink(fname); + return; + } + + delete [] buf; fchmod(fd, S_IRUSR); close(fd); } |