[vlc-devel] commit: fb: unmap mmap'ed area when closing framebuffer display. ( Jean-Paul Saman )

git version control git at videolan.org
Wed Feb 11 16:48:52 CET 2009


vlc | branch: master | Jean-Paul Saman <jean-paul.saman at m2x.nl> | Wed Feb 11 16:03:05 2009 +0100| [5d40c7d41dafc119c83aea43b5fbc7cf56aaa3d3] | committer: Jean-Paul Saman 

fb: unmap mmap'ed area when closing framebuffer display.

Closing of filedescriptor to /dev/fbx does not remove the mmap'ed areas. A call to munmap() is needed for this.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=5d40c7d41dafc119c83aea43b5fbc7cf56aaa3d3
---

 modules/video_output/fb.c |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/modules/video_output/fb.c b/modules/video_output/fb.c
index 4accdb2..092b621 100644
--- a/modules/video_output/fb.c
+++ b/modules/video_output/fb.c
@@ -920,7 +920,7 @@ static int OpenDisplay( vout_thread_t *p_vout )
                          p_sys->i_bytes_per_pixel;
 
     /* Map a framebuffer at the beginning */
-    p_sys->p_video = mmap( 0, p_sys->i_page_size,
+    p_sys->p_video = mmap( NULL, p_sys->i_page_size,
                               PROT_READ | PROT_WRITE, MAP_SHARED,
                               p_sys->i_fd, 0 );
 
@@ -952,8 +952,12 @@ static int OpenDisplay( vout_thread_t *p_vout )
  *****************************************************************************/
 static void CloseDisplay( vout_thread_t *p_vout )
 {
-    /* Clear display */
-    memset( p_vout->p_sys->p_video, 0, p_vout->p_sys->i_page_size );
+    if( p_vout->p_sys->p_video )
+    {
+        /* Clear display */
+        memset( p_vout->p_sys->p_video, 0, p_vout->p_sys->i_page_size );
+        munmap( p_vout->p_sys->p_video, p_vout->p_sys->i_page_size );
+    }
 
     /* Restore palette */
     if( p_vout->p_sys->var_info.bits_per_pixel == 8 )




More information about the vlc-devel mailing list