diff options
-rw-r--r-- | gralloc960/alloc_device.cpp | 3 | ||||
-rw-r--r-- | gralloc960/alloc_ion.cpp | 2 | ||||
-rw-r--r-- | gralloc960/framebuffer_device.cpp | 13 | ||||
-rw-r--r-- | gralloc960/gralloc_priv.h | 4 | ||||
-rw-r--r-- | gralloc960/gralloc_vsync_default.cpp | 2 |
5 files changed, 12 insertions, 12 deletions
diff --git a/gralloc960/alloc_device.cpp b/gralloc960/alloc_device.cpp index 8614ae54..9a3ff8ca 100644 --- a/gralloc960/alloc_device.cpp +++ b/gralloc960/alloc_device.cpp @@ -117,7 +117,7 @@ static int gralloc_alloc_framebuffer_locked(alloc_device_t* dev, size_t size, in // 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 @@ 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); } gralloc_buffer_attr_free( (private_handle_t *) hnd ); diff --git a/gralloc960/alloc_ion.cpp b/gralloc960/alloc_ion.cpp index 2f9efc05..954c5382 100644 --- a/gralloc960/alloc_ion.cpp +++ b/gralloc960/alloc_ion.cpp @@ -307,7 +307,7 @@ int alloc_backend_alloc_framebuffer(private_module_t* m, private_handle_t* hnd) { struct fb_dmabuf_export fb_dma_buf; int res; - res = ioctl( m->framebuffer->fd, FBIOGET_DMABUF, &fb_dma_buf ); + res = ioctl( m->framebuffer->shallow_fbdev_fd, FBIOGET_DMABUF, &fb_dma_buf ); if(res == 0) { hnd->share_fd = fb_dma_buf.fd; diff --git a/gralloc960/framebuffer_device.cpp b/gralloc960/framebuffer_device.cpp index 873b5f4c..fa60eb5b 100644 --- a/gralloc960/framebuffer_device.cpp +++ b/gralloc960/framebuffer_device.cpp @@ -92,24 +92,25 @@ static int fb_post(struct framebuffer_device_t* dev, buffer_handle_t buffer) m->info.activate = FB_ACTIVATE_VBL; m->info.yoffset = offset / m->finfo.line_length; + int fbdev_fd = m->framebuffer->shallow_fbdev_fd; #ifdef STANDARD_LINUX_SCREEN - if (ioctl(m->framebuffer->fd, FBIOPAN_DISPLAY, &m->info) == -1) + if (ioctl(fbdev_fd, FBIOPAN_DISPLAY, &m->info) == -1) { - AERR( "FBIOPAN_DISPLAY failed for fd: %d", m->framebuffer->fd ); + AERR( "FBIOPAN_DISPLAY failed for fd: %d", fbdev_fd ); m->base.unlock(&m->base, buffer); return -errno; } #else /*Standard Android way*/ - if (ioctl(m->framebuffer->fd, FBIOPUT_VSCREENINFO, &m->info) == -1) + if (ioctl(fbdev_fd, FBIOPUT_VSCREENINFO, &m->info) == -1) { - AERR( "FBIOPUT_VSCREENINFO failed for fd: %d", m->framebuffer->fd ); + AERR( "FBIOPUT_VSCREENINFO failed for fd: %d", fbdev_fd ); m->base.unlock(&m->base, buffer); return -errno; } #endif if ( 0 != gralloc_wait_for_vsync(dev) ) { - AERR( "Gralloc wait for vsync failed for fd: %d", m->framebuffer->fd ); + AERR( "Gralloc wait for vsync failed for fd: %d", fbdev_fd ); m->base.unlock(&m->base, buffer); return -errno; } @@ -365,7 +366,7 @@ int init_frame_buffer_locked(struct private_module_t* module) // Create a "fake" buffer object for the entire frame buffer memory, and store it in the module module->framebuffer = new private_handle_t(private_handle_t::PRIV_FLAGS_FRAMEBUFFER, GRALLOC_USAGE_HW_FB, fbSize, vaddr, - 0, dup(fd), 0); + 0, fd, 0); module->numBuffers = info.yres_virtual / info.yres; module->bufferMask = 0; diff --git a/gralloc960/gralloc_priv.h b/gralloc960/gralloc_priv.h index a9453549..51089ddc 100644 --- a/gralloc960/gralloc_priv.h +++ b/gralloc960/gralloc_priv.h @@ -194,7 +194,7 @@ struct private_handle_t mali_gralloc_yuv_info yuv_info; // Following members is for framebuffer only - int fd; + int shallow_fbdev_fd; // shallow copy, not dup'ed union { off_t offset; uint64_t padding4; @@ -235,7 +235,7 @@ struct private_handle_t pid(getpid()), attr_base(MAP_FAILED), yuv_info(MALI_YUV_NO_INFO), - fd(fb_file), + shallow_fbdev_fd(fb_file), offset(fb_offset) { version = sizeof(native_handle); diff --git a/gralloc960/gralloc_vsync_default.cpp b/gralloc960/gralloc_vsync_default.cpp index 40f66999..3ce7f0e8 100644 --- a/gralloc960/gralloc_vsync_default.cpp +++ b/gralloc960/gralloc_vsync_default.cpp @@ -49,7 +49,7 @@ int gralloc_wait_for_vsync(framebuffer_device_t *dev) { int crtc = 0; gralloc_mali_vsync_report(MALI_VSYNC_EVENT_BEGIN_WAIT); - if(ioctl(m->framebuffer->fd, FBIO_WAITFORVSYNC, &crtc) < 0) + if(ioctl(m->framebuffer->shallow_fbdev_fd, FBIO_WAITFORVSYNC, &crtc) < 0) { gralloc_mali_vsync_report(MALI_VSYNC_EVENT_END_WAIT); return -errno; |