summaryrefslogtreecommitdiff
path: root/gralloc/alloc_device.cpp
diff options
context:
space:
mode:
authorChia-I Wu <olv@google.com>2017-05-08 12:50:36 -0700
committerChia-I Wu <olv@google.com>2017-05-08 13:35:44 -0700
commit57b9e8ac152ba8b95dbbb4ce2cbfc0fec292532f (patch)
tree58ad5d9aa04788161b142b9a10f23f5b359c33af /gralloc/alloc_device.cpp
parent9e18cca0b575ad8ca3e6a158cab4795b345c0960 (diff)
downloadhikey-57b9e8ac152ba8b95dbbb4ce2cbfc0fec292532f.tar.gz
gralloc: make fbdev fd a shallow copy
We never free private_module_t::framebuffer once it is initialized. We can use a shallow copy of the fbdev dev. Bug: 37550237 Test: boots Change-Id: I552b40c0a59d9f4ec5442e3a284f115a88061c3e
Diffstat (limited to 'gralloc/alloc_device.cpp')
-rw-r--r--gralloc/alloc_device.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/gralloc/alloc_device.cpp b/gralloc/alloc_device.cpp
index 3ef099f2..3c4531bf 100644
--- a/gralloc/alloc_device.cpp
+++ b/gralloc/alloc_device.cpp
@@ -306,9 +306,10 @@ static int gralloc_alloc_framebuffer_locked(alloc_device_t *dev, size_t size, in
vaddr = (void *)((uintptr_t)vaddr + bufferSize);
}
+ int fbdev_fd = m->framebuffer->shallow_fbdev_fd;
// The entire framebuffer memory is already mapped, now create a buffer object for parts of this memory
private_handle_t *hnd = new private_handle_t(private_handle_t::PRIV_FLAGS_FRAMEBUFFER, usage, size, vaddr,
- 0, dup(m->framebuffer->fd), (uintptr_t)vaddr - (uintptr_t) m->framebuffer->base);
+ 0, fbdev_fd, (uintptr_t)vaddr - (uintptr_t) m->framebuffer->base);
#if GRALLOC_ARM_UMP_MODULE
hnd->ump_id = m->framebuffer->ump_id;
@@ -330,7 +331,7 @@ static int gralloc_alloc_framebuffer_locked(alloc_device_t *dev, size_t size, in
#ifdef FBIOGET_DMABUF
struct fb_dmabuf_export fb_dma_buf;
- if (ioctl(m->framebuffer->fd, FBIOGET_DMABUF, &fb_dma_buf) == 0)
+ if (ioctl(fbdev_fd, FBIOGET_DMABUF, &fb_dma_buf) == 0)
{
AINF("framebuffer accessed with dma buf (fd 0x%x)\n", (int)fb_dma_buf.fd);
hnd->share_fd = fb_dma_buf.fd;
@@ -518,7 +519,6 @@ static int alloc_device_free(alloc_device_t *dev, buffer_handle_t handle)
const size_t bufferSize = m->finfo.line_length * m->info.yres;
int index = ((uintptr_t)hnd->base - (uintptr_t)m->framebuffer->base) / bufferSize;
m->bufferMask &= ~(1 << index);
- close(hnd->fd);
#if GRALLOC_ARM_UMP_MODULE