diff options
author | Mathias Agopian <mathias@google.com> | 2009-05-04 14:26:56 -0700 |
---|---|---|
committer | Mathias Agopian <mathias@google.com> | 2009-05-04 14:26:56 -0700 |
commit | 988b8bd553180e8d71b4028ecb721f46312efe62 (patch) | |
tree | 079f311a2958d953447da28e2039948996f1f58f /modules/gralloc/framebuffer.cpp | |
parent | ccc13876d84f9316b5764aba8080c6e1a96ee214 (diff) | |
download | hardware_libhardware-988b8bd553180e8d71b4028ecb721f46312efe62.zip hardware_libhardware-988b8bd553180e8d71b4028ecb721f46312efe62.tar.gz hardware_libhardware-988b8bd553180e8d71b4028ecb721f46312efe62.tar.bz2 |
lock will now return the vaddr of the buffer. map/umap are gone.
- make sure to return an error if a buffer is locked twice or unlocked while not locked.
- added registerBuffer() and unregisterBuffer() to the gralloc module so that we can do some cleanup when a buffer is no longer needed. this became necessary after we removed map/unmap so we have a place to unmap buffers without the need of a kernel module.
- change the constants for GRALLOC_USAGE_SW_{READ|WRITE}_NEVER to 0, so that NOT specifying them means "NEVER".
Diffstat (limited to 'modules/gralloc/framebuffer.cpp')
-rw-r--r-- | modules/gralloc/framebuffer.cpp | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/modules/gralloc/framebuffer.cpp b/modules/gralloc/framebuffer.cpp index 05b9418..31adfca 100644 --- a/modules/gralloc/framebuffer.cpp +++ b/modules/gralloc/framebuffer.cpp @@ -97,7 +97,7 @@ static int fb_post(struct framebuffer_device_t* dev, buffer_handle_t buffer) m->base.lock(&m->base, buffer, private_module_t::PRIV_USAGE_LOCKED_FOR_POST, - 0, 0, m->info.xres, m->info.yres); + 0, 0, m->info.xres, m->info.yres, NULL); const size_t offset = hnd->base - m->framebuffer->base; m->info.activate = FB_ACTIVATE_VBL; @@ -113,14 +113,23 @@ static int fb_post(struct framebuffer_device_t* dev, buffer_handle_t buffer) // If we can't do the page_flip, just copy the buffer to the front // FIXME: use copybit HAL instead of memcpy - m->base.lock(&m->base, buffer, - private_module_t::PRIV_USAGE_LOCKED_FOR_POST, - 0, 0, m->info.xres, m->info.yres); + void* fb_vaddr; + void* buffer_vaddr; - memcpy((void*)m->framebuffer->base, (void*)hnd->base, - m->finfo.line_length * m->info.yres); + m->base.lock(&m->base, m->framebuffer, + GRALLOC_USAGE_SW_WRITE_RARELY, + 0, 0, m->info.xres, m->info.yres, + &fb_vaddr); + + m->base.lock(&m->base, buffer, + GRALLOC_USAGE_SW_READ_RARELY, + 0, 0, m->info.xres, m->info.yres, + &buffer_vaddr); + + memcpy(fb_vaddr, buffer_vaddr, m->finfo.line_length * m->info.yres); m->base.unlock(&m->base, buffer); + m->base.unlock(&m->base, m->framebuffer); } return 0; @@ -283,9 +292,9 @@ int mapFrameBufferLocked(struct private_module_t* module) module->numBuffers = info.yres_virtual / info.yres; module->bufferMask = 0; - + void* vaddr; - module->base.map(&module->base, module->framebuffer, &vaddr); + gralloc_map(&module->base, module->framebuffer, &vaddr); memset(vaddr, 0, fbSize); return 0; |