]> git.sesse.net Git - vlc/commitdiff
fb: unmap mmap'ed area when closing framebuffer display.
authorJean-Paul Saman <jean-paul.saman@m2x.nl>
Wed, 11 Feb 2009 15:03:05 +0000 (16:03 +0100)
committerJean-Paul Saman <jean-paul.saman@m2x.nl>
Wed, 11 Feb 2009 15:14:39 +0000 (16:14 +0100)
Closing of filedescriptor to /dev/fbx does not remove the mmap'ed areas. A call to munmap() is needed for this.

modules/video_output/fb.c

index 4accdb23b89b2d076d894e36d1f471ad0d71171b..092b621a3c277fbb53c9793f4af77cfec88d4c16 100644 (file)
@@ -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 )