Commit 09976bb9 authored by Jean-Paul Saman's avatar Jean-Paul Saman

modules/video_output/fb.c: Clear display by making it black.

The framebuffer video output cleared the display in multiple places and it only
worked properly for RGB displays. This patch removes several memset() on the entire
framebuffer.
Clearing of the framebuffer is done in p_vout->pf_init() and p_vout->pf_end() taking
the chroma of the video output into account. Only RGB2, RV15, RV16, RV24, RV32, UYVY,
YUNV and Y422 chromas are currently supported.
parent 612836aa
/***************************************************************************** /*****************************************************************************
* fb.c : framebuffer plugin for vlc * fb.c : framebuffer plugin for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2000-2009 the VideoLAN team * Copyright (C) 2000-2010 the VideoLAN team
* $Id$ * $Id$
* *
* Authors: Samuel Hocevar <sam@zoy.org> * Authors: Samuel Hocevar <sam@zoy.org>
* Jean-Paul Saman * Jean-Paul Saman <jpsaman@videolan.org>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
...@@ -472,6 +472,38 @@ static void FreePicture( vout_thread_t *p_vout, picture_t *p_pic ) ...@@ -472,6 +472,38 @@ static void FreePicture( vout_thread_t *p_vout, picture_t *p_pic )
p_pic->p_sys = NULL; p_pic->p_sys = NULL;
} }
static void ClearDisplay( vout_thread_t *p_vout )
{
vout_sys_t *p_sys = p_vout->p_sys;
if (p_sys->p_video != MAP_FAILED)
{
switch( p_sys->i_chroma )
{
case VLC_FOURCC('U','Y','V','Y'):
case VLC_FOURCC('U','Y','N','V'):
case VLC_FOURCC('Y','4','2','2'):
{
size_t loops = (p_sys->i_page_size >> p_sys->i_bytes_per_pixel);
int *out = (int *)p_sys->p_video;
do {
*out++ = 0x00800080;
} while(--loops);
}
break;
case VLC_FOURCC('R','G','B','2'):
case VLC_FOURCC('R','V','1','5'):
case VLC_FOURCC('R','V','1','6'):
case VLC_FOURCC('R','V','2','4'):
case VLC_FOURCC('R','V','3','2'):
default: /* Assume RGB (RV16, RV32) */
memset( p_sys->p_video, 0x00, p_sys->i_page_size );
break;
}
}
}
/***************************************************************************** /*****************************************************************************
* Init: initialize framebuffer video thread output method * Init: initialize framebuffer video thread output method
*****************************************************************************/ *****************************************************************************/
...@@ -545,8 +577,7 @@ static int Init( vout_thread_t *p_vout ) ...@@ -545,8 +577,7 @@ static int Init( vout_thread_t *p_vout )
p_vout->fmt_out.i_aspect = p_vout->render.i_aspect = p_vout->output.i_aspect; p_vout->fmt_out.i_aspect = p_vout->render.i_aspect = p_vout->output.i_aspect;
p_vout->fmt_out.i_x_offset= p_vout->fmt_out.i_y_offset = 0; p_vout->fmt_out.i_x_offset= p_vout->fmt_out.i_y_offset = 0;
/* Clear the screen */ ClearDisplay( p_vout );
memset( p_sys->p_video, 0, p_sys->i_page_size );
if( !p_sys->b_hw_accel ) if( !p_sys->b_hw_accel )
{ {
...@@ -637,6 +668,7 @@ static int Init( vout_thread_t *p_vout ) ...@@ -637,6 +668,7 @@ static int Init( vout_thread_t *p_vout )
*****************************************************************************/ *****************************************************************************/
static void End( vout_thread_t *p_vout ) static void End( vout_thread_t *p_vout )
{ {
ClearDisplay( p_vout );
if( !p_vout->p_sys->b_hw_accel ) if( !p_vout->p_sys->b_hw_accel )
{ {
int i_index; int i_index;
...@@ -649,8 +681,6 @@ static void End( vout_thread_t *p_vout ) ...@@ -649,8 +681,6 @@ static void End( vout_thread_t *p_vout )
} }
} }
/* Clear the screen */
memset( p_vout->p_sys->p_video, 0, p_vout->p_sys->i_page_size );
} }
/***************************************************************************** /*****************************************************************************
...@@ -705,9 +735,6 @@ static int Manage( vout_thread_t *p_vout ) ...@@ -705,9 +735,6 @@ static int Manage( vout_thread_t *p_vout )
return VLC_EGENERIC; return VLC_EGENERIC;
} }
/* Clear screen */
memset( p_vout->p_sys->p_video, 0, p_vout->p_sys->i_page_size );
#if 0 #if 0
/* Tell the video output thread that it will need to rebuild YUV /* Tell the video output thread that it will need to rebuild YUV
* tables. This is needed since conversion buffer size may have changed */ * tables. This is needed since conversion buffer size may have changed */
...@@ -996,8 +1023,6 @@ static void CloseDisplay( vout_thread_t *p_vout ) ...@@ -996,8 +1023,6 @@ static void CloseDisplay( vout_thread_t *p_vout )
{ {
if( p_vout->p_sys->p_video != MAP_FAILED ) if( p_vout->p_sys->p_video != MAP_FAILED )
{ {
/* 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 ); munmap( p_vout->p_sys->p_video, p_vout->p_sys->i_page_size );
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment