gralloc960: 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 fd.
Bug: 62222821
Test: boots
Change-Id: Id35641fa183993ce36a3c0ec7b7f4121bfdf36c4
diff --git a/gralloc960/alloc_device.cpp b/gralloc960/alloc_device.cpp
index 8614ae5..9a3ff8c 100644
--- a/gralloc960/alloc_device.cpp
+++ b/gralloc960/alloc_device.cpp
@@ -117,7 +117,7 @@
// 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,
- (void*)framebufferVaddr, 0, dup(m->framebuffer->fd),
+ (void*)framebufferVaddr, 0, m->framebuffer->shallow_fbdev_fd,
(framebufferVaddr - (uintptr_t)m->framebuffer->base));
/*
@@ -1234,7 +1234,6 @@
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);
}
gralloc_buffer_attr_free( (private_handle_t *) hnd );