GraphicBufferMapper.cpp revision b26af23744fa73e8bc142b1eb98772fde5970c10
1076b1cc3a9b90aa5b381a1ed268ca0b548444c9bMathias Agopian/* 2076b1cc3a9b90aa5b381a1ed268ca0b548444c9bMathias Agopian * Copyright (C) 2007 The Android Open Source Project 3076b1cc3a9b90aa5b381a1ed268ca0b548444c9bMathias Agopian * 4076b1cc3a9b90aa5b381a1ed268ca0b548444c9bMathias Agopian * Licensed under the Apache License, Version 2.0 (the "License"); 5076b1cc3a9b90aa5b381a1ed268ca0b548444c9bMathias Agopian * you may not use this file except in compliance with the License. 6076b1cc3a9b90aa5b381a1ed268ca0b548444c9bMathias Agopian * You may obtain a copy of the License at 7076b1cc3a9b90aa5b381a1ed268ca0b548444c9bMathias Agopian * 8076b1cc3a9b90aa5b381a1ed268ca0b548444c9bMathias Agopian * http://www.apache.org/licenses/LICENSE-2.0 9076b1cc3a9b90aa5b381a1ed268ca0b548444c9bMathias Agopian * 10076b1cc3a9b90aa5b381a1ed268ca0b548444c9bMathias Agopian * Unless required by applicable law or agreed to in writing, software 11076b1cc3a9b90aa5b381a1ed268ca0b548444c9bMathias Agopian * distributed under the License is distributed on an "AS IS" BASIS, 12076b1cc3a9b90aa5b381a1ed268ca0b548444c9bMathias Agopian * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13076b1cc3a9b90aa5b381a1ed268ca0b548444c9bMathias Agopian * See the License for the specific language governing permissions and 14076b1cc3a9b90aa5b381a1ed268ca0b548444c9bMathias Agopian * limitations under the License. 15076b1cc3a9b90aa5b381a1ed268ca0b548444c9bMathias Agopian */ 16076b1cc3a9b90aa5b381a1ed268ca0b548444c9bMathias Agopian 173330b203039dea366d4981db1408a460134b2d2cMathias Agopian#define LOG_TAG "GraphicBufferMapper" 18076b1cc3a9b90aa5b381a1ed268ca0b548444c9bMathias Agopian 19076b1cc3a9b90aa5b381a1ed268ca0b548444c9bMathias Agopian#include <stdint.h> 20b26af23744fa73e8bc142b1eb98772fde5970c10Mathias Agopian#ifdef HAVE_ANDROID_OS // just want PAGE_SIZE define 21b26af23744fa73e8bc142b1eb98772fde5970c10Mathias Agopian# include <asm/page.h> 22b26af23744fa73e8bc142b1eb98772fde5970c10Mathias Agopian#else 23b26af23744fa73e8bc142b1eb98772fde5970c10Mathias Agopian# include <sys/user.h> 24b26af23744fa73e8bc142b1eb98772fde5970c10Mathias Agopian#endif 25076b1cc3a9b90aa5b381a1ed268ca0b548444c9bMathias Agopian#include <errno.h> 26b26af23744fa73e8bc142b1eb98772fde5970c10Mathias Agopian#include <sys/mman.h> 27b26af23744fa73e8bc142b1eb98772fde5970c10Mathias Agopian 28b26af23744fa73e8bc142b1eb98772fde5970c10Mathias Agopian#include <cutils/ashmem.h> 29076b1cc3a9b90aa5b381a1ed268ca0b548444c9bMathias Agopian 30076b1cc3a9b90aa5b381a1ed268ca0b548444c9bMathias Agopian#include <utils/Errors.h> 31076b1cc3a9b90aa5b381a1ed268ca0b548444c9bMathias Agopian#include <utils/Log.h> 32076b1cc3a9b90aa5b381a1ed268ca0b548444c9bMathias Agopian 333330b203039dea366d4981db1408a460134b2d2cMathias Agopian#include <ui/GraphicBufferMapper.h> 34076b1cc3a9b90aa5b381a1ed268ca0b548444c9bMathias Agopian#include <ui/Rect.h> 35076b1cc3a9b90aa5b381a1ed268ca0b548444c9bMathias Agopian 36076b1cc3a9b90aa5b381a1ed268ca0b548444c9bMathias Agopian#include <hardware/gralloc.h> 37076b1cc3a9b90aa5b381a1ed268ca0b548444c9bMathias Agopian 38b26af23744fa73e8bc142b1eb98772fde5970c10Mathias Agopian#include <private/ui/sw_gralloc_handle.h> 39b26af23744fa73e8bc142b1eb98772fde5970c10Mathias Agopian 408b765b7f5ea7f56963ea0e3141d043d20944dbccMathias Agopian 41076b1cc3a9b90aa5b381a1ed268ca0b548444c9bMathias Agopiannamespace android { 42076b1cc3a9b90aa5b381a1ed268ca0b548444c9bMathias Agopian// --------------------------------------------------------------------------- 43076b1cc3a9b90aa5b381a1ed268ca0b548444c9bMathias Agopian 443330b203039dea366d4981db1408a460134b2d2cMathias AgopianANDROID_SINGLETON_STATIC_INSTANCE( GraphicBufferMapper ) 454243e666213029a293935987c979831093fb0779Mathias Agopian 463330b203039dea366d4981db1408a460134b2d2cMathias AgopianGraphicBufferMapper::GraphicBufferMapper() 47076b1cc3a9b90aa5b381a1ed268ca0b548444c9bMathias Agopian : mAllocMod(0) 48076b1cc3a9b90aa5b381a1ed268ca0b548444c9bMathias Agopian{ 49076b1cc3a9b90aa5b381a1ed268ca0b548444c9bMathias Agopian hw_module_t const* module; 50076b1cc3a9b90aa5b381a1ed268ca0b548444c9bMathias Agopian int err = hw_get_module(GRALLOC_HARDWARE_MODULE_ID, &module); 51076b1cc3a9b90aa5b381a1ed268ca0b548444c9bMathias Agopian LOGE_IF(err, "FATAL: can't find the %s module", GRALLOC_HARDWARE_MODULE_ID); 52076b1cc3a9b90aa5b381a1ed268ca0b548444c9bMathias Agopian if (err == 0) { 53076b1cc3a9b90aa5b381a1ed268ca0b548444c9bMathias Agopian mAllocMod = (gralloc_module_t const *)module; 54076b1cc3a9b90aa5b381a1ed268ca0b548444c9bMathias Agopian } 55076b1cc3a9b90aa5b381a1ed268ca0b548444c9bMathias Agopian} 56076b1cc3a9b90aa5b381a1ed268ca0b548444c9bMathias Agopian 573330b203039dea366d4981db1408a460134b2d2cMathias Agopianstatus_t GraphicBufferMapper::registerBuffer(buffer_handle_t handle) 58076b1cc3a9b90aa5b381a1ed268ca0b548444c9bMathias Agopian{ 59b26af23744fa73e8bc142b1eb98772fde5970c10Mathias Agopian status_t err; 60b26af23744fa73e8bc142b1eb98772fde5970c10Mathias Agopian if (sw_gralloc_handle_t::validate(handle) < 0) { 61b26af23744fa73e8bc142b1eb98772fde5970c10Mathias Agopian err = mAllocMod->registerBuffer(mAllocMod, handle); 62b26af23744fa73e8bc142b1eb98772fde5970c10Mathias Agopian } else { 63b26af23744fa73e8bc142b1eb98772fde5970c10Mathias Agopian err = sw_gralloc_handle_t::registerBuffer((sw_gralloc_handle_t*)handle); 64b26af23744fa73e8bc142b1eb98772fde5970c10Mathias Agopian } 650926f50664c739eaee60341f8e8c694dc9a4f3ebMathias Agopian LOGW_IF(err, "registerBuffer(%p) failed %d (%s)", 660926f50664c739eaee60341f8e8c694dc9a4f3ebMathias Agopian handle, err, strerror(-err)); 67076b1cc3a9b90aa5b381a1ed268ca0b548444c9bMathias Agopian return err; 68076b1cc3a9b90aa5b381a1ed268ca0b548444c9bMathias Agopian} 69076b1cc3a9b90aa5b381a1ed268ca0b548444c9bMathias Agopian 703330b203039dea366d4981db1408a460134b2d2cMathias Agopianstatus_t GraphicBufferMapper::unregisterBuffer(buffer_handle_t handle) 71076b1cc3a9b90aa5b381a1ed268ca0b548444c9bMathias Agopian{ 72b26af23744fa73e8bc142b1eb98772fde5970c10Mathias Agopian status_t err; 73b26af23744fa73e8bc142b1eb98772fde5970c10Mathias Agopian if (sw_gralloc_handle_t::validate(handle) < 0) { 74b26af23744fa73e8bc142b1eb98772fde5970c10Mathias Agopian err = mAllocMod->unregisterBuffer(mAllocMod, handle); 75b26af23744fa73e8bc142b1eb98772fde5970c10Mathias Agopian } else { 76b26af23744fa73e8bc142b1eb98772fde5970c10Mathias Agopian err = sw_gralloc_handle_t::unregisterBuffer((sw_gralloc_handle_t*)handle); 77b26af23744fa73e8bc142b1eb98772fde5970c10Mathias Agopian } 780926f50664c739eaee60341f8e8c694dc9a4f3ebMathias Agopian LOGW_IF(err, "unregisterBuffer(%p) failed %d (%s)", 790926f50664c739eaee60341f8e8c694dc9a4f3ebMathias Agopian handle, err, strerror(-err)); 80076b1cc3a9b90aa5b381a1ed268ca0b548444c9bMathias Agopian return err; 81076b1cc3a9b90aa5b381a1ed268ca0b548444c9bMathias Agopian} 82076b1cc3a9b90aa5b381a1ed268ca0b548444c9bMathias Agopian 833330b203039dea366d4981db1408a460134b2d2cMathias Agopianstatus_t GraphicBufferMapper::lock(buffer_handle_t handle, 840926f50664c739eaee60341f8e8c694dc9a4f3ebMathias Agopian int usage, const Rect& bounds, void** vaddr) 85076b1cc3a9b90aa5b381a1ed268ca0b548444c9bMathias Agopian{ 86b26af23744fa73e8bc142b1eb98772fde5970c10Mathias Agopian status_t err; 87b26af23744fa73e8bc142b1eb98772fde5970c10Mathias Agopian if (sw_gralloc_handle_t::validate(handle) < 0) { 88b26af23744fa73e8bc142b1eb98772fde5970c10Mathias Agopian err = mAllocMod->lock(mAllocMod, handle, usage, 89b26af23744fa73e8bc142b1eb98772fde5970c10Mathias Agopian bounds.left, bounds.top, bounds.width(), bounds.height(), 90b26af23744fa73e8bc142b1eb98772fde5970c10Mathias Agopian vaddr); 91b26af23744fa73e8bc142b1eb98772fde5970c10Mathias Agopian } else { 92b26af23744fa73e8bc142b1eb98772fde5970c10Mathias Agopian err = sw_gralloc_handle_t::lock((sw_gralloc_handle_t*)handle, usage, 93b26af23744fa73e8bc142b1eb98772fde5970c10Mathias Agopian bounds.left, bounds.top, bounds.width(), bounds.height(), 94b26af23744fa73e8bc142b1eb98772fde5970c10Mathias Agopian vaddr); 95b26af23744fa73e8bc142b1eb98772fde5970c10Mathias Agopian } 9669bdcb9b7b5089984bf474f30029fa024f519e47Mathias Agopian LOGW_IF(err, "lock(...) failed %d (%s)", err, strerror(-err)); 97076b1cc3a9b90aa5b381a1ed268ca0b548444c9bMathias Agopian return err; 98076b1cc3a9b90aa5b381a1ed268ca0b548444c9bMathias Agopian} 99076b1cc3a9b90aa5b381a1ed268ca0b548444c9bMathias Agopian 1003330b203039dea366d4981db1408a460134b2d2cMathias Agopianstatus_t GraphicBufferMapper::unlock(buffer_handle_t handle) 101076b1cc3a9b90aa5b381a1ed268ca0b548444c9bMathias Agopian{ 102b26af23744fa73e8bc142b1eb98772fde5970c10Mathias Agopian status_t err; 103b26af23744fa73e8bc142b1eb98772fde5970c10Mathias Agopian if (sw_gralloc_handle_t::validate(handle) < 0) { 104b26af23744fa73e8bc142b1eb98772fde5970c10Mathias Agopian err = mAllocMod->unlock(mAllocMod, handle); 105b26af23744fa73e8bc142b1eb98772fde5970c10Mathias Agopian } else { 106b26af23744fa73e8bc142b1eb98772fde5970c10Mathias Agopian err = sw_gralloc_handle_t::unlock((sw_gralloc_handle_t*)handle); 107b26af23744fa73e8bc142b1eb98772fde5970c10Mathias Agopian } 108076b1cc3a9b90aa5b381a1ed268ca0b548444c9bMathias Agopian LOGW_IF(err, "unlock(...) failed %d (%s)", err, strerror(-err)); 109076b1cc3a9b90aa5b381a1ed268ca0b548444c9bMathias Agopian return err; 110076b1cc3a9b90aa5b381a1ed268ca0b548444c9bMathias Agopian} 111076b1cc3a9b90aa5b381a1ed268ca0b548444c9bMathias Agopian 112076b1cc3a9b90aa5b381a1ed268ca0b548444c9bMathias Agopian// --------------------------------------------------------------------------- 113b26af23744fa73e8bc142b1eb98772fde5970c10Mathias Agopian 114b26af23744fa73e8bc142b1eb98772fde5970c10Mathias Agopianstatus_t sw_gralloc_handle_t::alloc(uint32_t w, uint32_t h, int format, 115b26af23744fa73e8bc142b1eb98772fde5970c10Mathias Agopian int usage, buffer_handle_t* pHandle, int32_t* pStride) 116b26af23744fa73e8bc142b1eb98772fde5970c10Mathias Agopian{ 117b26af23744fa73e8bc142b1eb98772fde5970c10Mathias Agopian int align = 4; 118b26af23744fa73e8bc142b1eb98772fde5970c10Mathias Agopian int bpp = 0; 119b26af23744fa73e8bc142b1eb98772fde5970c10Mathias Agopian switch (format) { 120b26af23744fa73e8bc142b1eb98772fde5970c10Mathias Agopian case HAL_PIXEL_FORMAT_RGBA_8888: 121b26af23744fa73e8bc142b1eb98772fde5970c10Mathias Agopian case HAL_PIXEL_FORMAT_RGBX_8888: 122b26af23744fa73e8bc142b1eb98772fde5970c10Mathias Agopian case HAL_PIXEL_FORMAT_BGRA_8888: 123b26af23744fa73e8bc142b1eb98772fde5970c10Mathias Agopian bpp = 4; 124b26af23744fa73e8bc142b1eb98772fde5970c10Mathias Agopian break; 125b26af23744fa73e8bc142b1eb98772fde5970c10Mathias Agopian case HAL_PIXEL_FORMAT_RGB_888: 126b26af23744fa73e8bc142b1eb98772fde5970c10Mathias Agopian bpp = 3; 127b26af23744fa73e8bc142b1eb98772fde5970c10Mathias Agopian break; 128b26af23744fa73e8bc142b1eb98772fde5970c10Mathias Agopian case HAL_PIXEL_FORMAT_RGB_565: 129b26af23744fa73e8bc142b1eb98772fde5970c10Mathias Agopian case HAL_PIXEL_FORMAT_RGBA_5551: 130b26af23744fa73e8bc142b1eb98772fde5970c10Mathias Agopian case HAL_PIXEL_FORMAT_RGBA_4444: 131b26af23744fa73e8bc142b1eb98772fde5970c10Mathias Agopian bpp = 2; 132b26af23744fa73e8bc142b1eb98772fde5970c10Mathias Agopian break; 133b26af23744fa73e8bc142b1eb98772fde5970c10Mathias Agopian default: 134b26af23744fa73e8bc142b1eb98772fde5970c10Mathias Agopian return -EINVAL; 135b26af23744fa73e8bc142b1eb98772fde5970c10Mathias Agopian } 136b26af23744fa73e8bc142b1eb98772fde5970c10Mathias Agopian size_t bpr = (w*bpp + (align-1)) & ~(align-1); 137b26af23744fa73e8bc142b1eb98772fde5970c10Mathias Agopian size_t size = bpr * h; 138b26af23744fa73e8bc142b1eb98772fde5970c10Mathias Agopian size_t stride = bpr / bpp; 139b26af23744fa73e8bc142b1eb98772fde5970c10Mathias Agopian size = (size + (PAGE_SIZE-1)) & ~(PAGE_SIZE-1); 140b26af23744fa73e8bc142b1eb98772fde5970c10Mathias Agopian 141b26af23744fa73e8bc142b1eb98772fde5970c10Mathias Agopian int fd = ashmem_create_region("sw-gralloc-buffer", size); 142b26af23744fa73e8bc142b1eb98772fde5970c10Mathias Agopian if (fd < 0) { 143b26af23744fa73e8bc142b1eb98772fde5970c10Mathias Agopian LOGE("ashmem_create_region(size=%d) failed (%s)", 144b26af23744fa73e8bc142b1eb98772fde5970c10Mathias Agopian size, strerror(-errno)); 145b26af23744fa73e8bc142b1eb98772fde5970c10Mathias Agopian return -errno; 146b26af23744fa73e8bc142b1eb98772fde5970c10Mathias Agopian } 147b26af23744fa73e8bc142b1eb98772fde5970c10Mathias Agopian 148b26af23744fa73e8bc142b1eb98772fde5970c10Mathias Agopian int prot = PROT_READ; 149b26af23744fa73e8bc142b1eb98772fde5970c10Mathias Agopian if (usage & GRALLOC_USAGE_SW_WRITE_MASK) 150b26af23744fa73e8bc142b1eb98772fde5970c10Mathias Agopian prot |= PROT_WRITE; 151b26af23744fa73e8bc142b1eb98772fde5970c10Mathias Agopian 152b26af23744fa73e8bc142b1eb98772fde5970c10Mathias Agopian if (ashmem_set_prot_region(fd, prot) < 0) { 153b26af23744fa73e8bc142b1eb98772fde5970c10Mathias Agopian LOGE("ashmem_set_prot_region(fd=%d, prot=%x) failed (%s)", 154b26af23744fa73e8bc142b1eb98772fde5970c10Mathias Agopian fd, prot, strerror(-errno)); 155b26af23744fa73e8bc142b1eb98772fde5970c10Mathias Agopian close(fd); 156b26af23744fa73e8bc142b1eb98772fde5970c10Mathias Agopian return -errno; 157b26af23744fa73e8bc142b1eb98772fde5970c10Mathias Agopian } 158b26af23744fa73e8bc142b1eb98772fde5970c10Mathias Agopian 159b26af23744fa73e8bc142b1eb98772fde5970c10Mathias Agopian void* base = mmap(0, size, prot, MAP_SHARED, fd, 0); 160b26af23744fa73e8bc142b1eb98772fde5970c10Mathias Agopian if (base == MAP_FAILED) { 161b26af23744fa73e8bc142b1eb98772fde5970c10Mathias Agopian LOGE("alloc mmap(fd=%d, size=%d, prot=%x) failed (%s)", 162b26af23744fa73e8bc142b1eb98772fde5970c10Mathias Agopian fd, size, prot, strerror(-errno)); 163b26af23744fa73e8bc142b1eb98772fde5970c10Mathias Agopian close(fd); 164b26af23744fa73e8bc142b1eb98772fde5970c10Mathias Agopian return -errno; 165b26af23744fa73e8bc142b1eb98772fde5970c10Mathias Agopian } 166b26af23744fa73e8bc142b1eb98772fde5970c10Mathias Agopian 167b26af23744fa73e8bc142b1eb98772fde5970c10Mathias Agopian sw_gralloc_handle_t* hnd = new sw_gralloc_handle_t(); 168b26af23744fa73e8bc142b1eb98772fde5970c10Mathias Agopian hnd->fd = fd; 169b26af23744fa73e8bc142b1eb98772fde5970c10Mathias Agopian hnd->size = size; 170b26af23744fa73e8bc142b1eb98772fde5970c10Mathias Agopian hnd->base = intptr_t(base); 171b26af23744fa73e8bc142b1eb98772fde5970c10Mathias Agopian hnd->prot = prot; 172b26af23744fa73e8bc142b1eb98772fde5970c10Mathias Agopian *pStride = stride; 173b26af23744fa73e8bc142b1eb98772fde5970c10Mathias Agopian *pHandle = hnd; 174b26af23744fa73e8bc142b1eb98772fde5970c10Mathias Agopian 175b26af23744fa73e8bc142b1eb98772fde5970c10Mathias Agopian return NO_ERROR; 176b26af23744fa73e8bc142b1eb98772fde5970c10Mathias Agopian} 177b26af23744fa73e8bc142b1eb98772fde5970c10Mathias Agopian 178b26af23744fa73e8bc142b1eb98772fde5970c10Mathias Agopianstatus_t sw_gralloc_handle_t::free(sw_gralloc_handle_t* hnd) 179b26af23744fa73e8bc142b1eb98772fde5970c10Mathias Agopian{ 180b26af23744fa73e8bc142b1eb98772fde5970c10Mathias Agopian if (hnd->base) { 181b26af23744fa73e8bc142b1eb98772fde5970c10Mathias Agopian munmap((void*)hnd->base, hnd->size); 182b26af23744fa73e8bc142b1eb98772fde5970c10Mathias Agopian } 183b26af23744fa73e8bc142b1eb98772fde5970c10Mathias Agopian if (hnd->fd >= 0) { 184b26af23744fa73e8bc142b1eb98772fde5970c10Mathias Agopian close(hnd->fd); 185b26af23744fa73e8bc142b1eb98772fde5970c10Mathias Agopian } 186b26af23744fa73e8bc142b1eb98772fde5970c10Mathias Agopian delete hnd; 187b26af23744fa73e8bc142b1eb98772fde5970c10Mathias Agopian return NO_ERROR; 188b26af23744fa73e8bc142b1eb98772fde5970c10Mathias Agopian} 189b26af23744fa73e8bc142b1eb98772fde5970c10Mathias Agopian 190b26af23744fa73e8bc142b1eb98772fde5970c10Mathias Agopianstatus_t sw_gralloc_handle_t::registerBuffer(sw_gralloc_handle_t* hnd) 191b26af23744fa73e8bc142b1eb98772fde5970c10Mathias Agopian{ 192b26af23744fa73e8bc142b1eb98772fde5970c10Mathias Agopian if (hnd->pid != getpid()) { 193b26af23744fa73e8bc142b1eb98772fde5970c10Mathias Agopian void* base = mmap(0, hnd->size, hnd->prot, MAP_SHARED, hnd->fd, 0); 194b26af23744fa73e8bc142b1eb98772fde5970c10Mathias Agopian if (base == MAP_FAILED) { 195b26af23744fa73e8bc142b1eb98772fde5970c10Mathias Agopian LOGE("registerBuffer mmap(fd=%d, size=%d, prot=%x) failed (%s)", 196b26af23744fa73e8bc142b1eb98772fde5970c10Mathias Agopian hnd->fd, hnd->size, hnd->prot, strerror(-errno)); 197b26af23744fa73e8bc142b1eb98772fde5970c10Mathias Agopian return -errno; 198b26af23744fa73e8bc142b1eb98772fde5970c10Mathias Agopian } 199b26af23744fa73e8bc142b1eb98772fde5970c10Mathias Agopian hnd->base = intptr_t(base); 200b26af23744fa73e8bc142b1eb98772fde5970c10Mathias Agopian } 201b26af23744fa73e8bc142b1eb98772fde5970c10Mathias Agopian return NO_ERROR; 202b26af23744fa73e8bc142b1eb98772fde5970c10Mathias Agopian} 203b26af23744fa73e8bc142b1eb98772fde5970c10Mathias Agopian 204b26af23744fa73e8bc142b1eb98772fde5970c10Mathias Agopianstatus_t sw_gralloc_handle_t::unregisterBuffer(sw_gralloc_handle_t* hnd) 205b26af23744fa73e8bc142b1eb98772fde5970c10Mathias Agopian{ 206b26af23744fa73e8bc142b1eb98772fde5970c10Mathias Agopian if (hnd->pid != getpid()) { 207b26af23744fa73e8bc142b1eb98772fde5970c10Mathias Agopian if (hnd->base) { 208b26af23744fa73e8bc142b1eb98772fde5970c10Mathias Agopian munmap((void*)hnd->base, hnd->size); 209b26af23744fa73e8bc142b1eb98772fde5970c10Mathias Agopian } 210b26af23744fa73e8bc142b1eb98772fde5970c10Mathias Agopian hnd->base = 0; 211b26af23744fa73e8bc142b1eb98772fde5970c10Mathias Agopian } 212b26af23744fa73e8bc142b1eb98772fde5970c10Mathias Agopian return NO_ERROR; 213b26af23744fa73e8bc142b1eb98772fde5970c10Mathias Agopian} 214b26af23744fa73e8bc142b1eb98772fde5970c10Mathias Agopian 215b26af23744fa73e8bc142b1eb98772fde5970c10Mathias Agopianstatus_t sw_gralloc_handle_t::lock(sw_gralloc_handle_t* hnd, int usage, 216b26af23744fa73e8bc142b1eb98772fde5970c10Mathias Agopian int l, int t, int w, int h, void** vaddr) 217b26af23744fa73e8bc142b1eb98772fde5970c10Mathias Agopian{ 218b26af23744fa73e8bc142b1eb98772fde5970c10Mathias Agopian *vaddr = (void*)hnd->base; 219b26af23744fa73e8bc142b1eb98772fde5970c10Mathias Agopian return NO_ERROR; 220b26af23744fa73e8bc142b1eb98772fde5970c10Mathias Agopian} 221b26af23744fa73e8bc142b1eb98772fde5970c10Mathias Agopian 222b26af23744fa73e8bc142b1eb98772fde5970c10Mathias Agopianstatus_t sw_gralloc_handle_t::unlock(sw_gralloc_handle_t* hnd) 223b26af23744fa73e8bc142b1eb98772fde5970c10Mathias Agopian{ 224b26af23744fa73e8bc142b1eb98772fde5970c10Mathias Agopian return NO_ERROR; 225b26af23744fa73e8bc142b1eb98772fde5970c10Mathias Agopian} 226b26af23744fa73e8bc142b1eb98772fde5970c10Mathias Agopian 227b26af23744fa73e8bc142b1eb98772fde5970c10Mathias Agopian// --------------------------------------------------------------------------- 228076b1cc3a9b90aa5b381a1ed268ca0b548444c9bMathias Agopian}; // namespace android 229