Commit 7340778f authored by Sam Hocevar's avatar Sam Hocevar

  * FreeBSD (and probably QNX) shared memory handling fix.
parent e7345b80
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
HEAD HEAD
* First libdvdcss version (0.0.1).
* Unrolled two loops in dvd_netlist.c to prevent message flooding. * Unrolled two loops in dvd_netlist.c to prevent message flooding.
* DVD input stuttering fix by Jon Lech Johansen. * DVD input stuttering fix by Jon Lech Johansen.
* Removed a lock that caused late frames in DVDRead. * Removed a lock that caused late frames in DVDRead.
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* vout_x11.c: X11 video output display method * vout_x11.c: X11 video output display method
***************************************************************************** *****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN * Copyright (C) 1998, 1999, 2000 VideoLAN
* $Id: vout_x11.c,v 1.26 2001/05/30 17:03:12 sam Exp $ * $Id: vout_x11.c,v 1.27 2001/06/19 05:51:57 sam Exp $
* *
* Authors: Vincent Seguin <seguin@via.ecp.fr> * Authors: Vincent Seguin <seguin@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org> * Samuel Hocevar <sam@zoy.org>
...@@ -1096,9 +1096,11 @@ static int X11CreateShmImage( vout_thread_t *p_vout, XImage **pp_ximage, ...@@ -1096,9 +1096,11 @@ static int X11CreateShmImage( vout_thread_t *p_vout, XImage **pp_ximage,
return( 1 ); return( 1 );
} }
#if 0
/* Mark the shm segment to be removed when there will be no more /* Mark the shm segment to be removed when there will be no more
* attachements, so it is automatic on process exit or after shmdt */ * attachements, so it is automatic on process exit or after shmdt */
shmctl( p_shm_info->shmid, IPC_RMID, 0 ); shmctl( p_shm_info->shmid, IPC_RMID, 0 );
#endif
/* Attach shared memory segment to X server (read only) */ /* Attach shared memory segment to X server (read only) */
p_shm_info->readOnly = True; p_shm_info->readOnly = True;
...@@ -1106,6 +1108,7 @@ static int X11CreateShmImage( vout_thread_t *p_vout, XImage **pp_ximage, ...@@ -1106,6 +1108,7 @@ static int X11CreateShmImage( vout_thread_t *p_vout, XImage **pp_ximage,
== False ) /* error */ == False ) /* error */
{ {
intf_ErrMsg( "vout error: cannot attach shared memory to X11 server" ); intf_ErrMsg( "vout error: cannot attach shared memory to X11 server" );
shmctl( p_shm_info->shmid, IPC_RMID, 0 ); /* free shared memory */
shmdt( p_shm_info->shmaddr ); /* detach shared memory from process shmdt( p_shm_info->shmaddr ); /* detach shared memory from process
* and automatic free */ * and automatic free */
XDestroyImage( *pp_ximage ); XDestroyImage( *pp_ximage );
...@@ -1151,8 +1154,10 @@ static void X11DestroyShmImage( vout_thread_t *p_vout, XImage *p_ximage, ...@@ -1151,8 +1154,10 @@ static void X11DestroyShmImage( vout_thread_t *p_vout, XImage *p_ximage,
XShmDetach( p_vout->p_sys->p_display, p_shm_info );/* detach from server */ XShmDetach( p_vout->p_sys->p_display, p_shm_info );/* detach from server */
XDestroyImage( p_ximage ); XDestroyImage( p_ximage );
shmctl( p_shm_info->shmid, IPC_RMID, 0 ); /* free shared memory */
if( shmdt( p_shm_info->shmaddr ) ) /* detach shared memory from process */ if( shmdt( p_shm_info->shmaddr ) ) /* detach shared memory from process */
{ /* also automatic freeing... */ {
intf_ErrMsg( "vout error: cannot detach shared memory (%s)", intf_ErrMsg( "vout error: cannot detach shared memory (%s)",
strerror(errno) ); strerror(errno) );
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* vout_xvideo.c: Xvideo video output display method * vout_xvideo.c: Xvideo video output display method
***************************************************************************** *****************************************************************************
* Copyright (C) 1998, 1999, 2000, 2001 VideoLAN * Copyright (C) 1998, 1999, 2000, 2001 VideoLAN
* $Id: vout_xvideo.c,v 1.18 2001/05/30 17:03:12 sam Exp $ * $Id: vout_xvideo.c,v 1.19 2001/06/19 05:51:57 sam Exp $
* *
* Authors: Shane Harper <shanegh@optusnet.com.au> * Authors: Shane Harper <shanegh@optusnet.com.au>
* Vincent Seguin <seguin@via.ecp.fr> * Vincent Seguin <seguin@via.ecp.fr>
...@@ -588,7 +588,9 @@ static void vout_Display( vout_thread_t *p_vout ) ...@@ -588,7 +588,9 @@ static void vout_Display( vout_thread_t *p_vout )
p_vout->p_rendered_pic->i_height; p_vout->p_rendered_pic->i_height;
if( XVideoUpdateImgSizeIfRequired( p_vout ) ) if( XVideoUpdateImgSizeIfRequired( p_vout ) )
{
return; return;
}
switch( p_vout->p_rendered_pic->i_type ) switch( p_vout->p_rendered_pic->i_type )
{ {
...@@ -613,7 +615,9 @@ static void vout_Display( vout_thread_t *p_vout ) ...@@ -613,7 +615,9 @@ static void vout_Display( vout_thread_t *p_vout )
} }
if( b_draw ) if( b_draw )
{
XVideoDisplay( p_vout ); XVideoDisplay( p_vout );
}
} }
static void vout_SetPalette( p_vout_thread_t p_vout, static void vout_SetPalette( p_vout_thread_t p_vout,
...@@ -641,13 +645,16 @@ static int XVideoUpdateImgSizeIfRequired( vout_thread_t *p_vout ) ...@@ -641,13 +645,16 @@ static int XVideoUpdateImgSizeIfRequired( vout_thread_t *p_vout )
if( p_vout->p_sys->i_image_width != i_img_width if( p_vout->p_sys->i_image_width != i_img_width
|| p_vout->p_sys->i_image_height != i_img_height ) || p_vout->p_sys->i_image_height != i_img_height )
{ {
if( p_vout->p_sys->i_image_width != 0
&& p_vout->p_sys->i_image_height != 0 )
{
/* Destroy XvImage to change its size */
vout_End( p_vout );
}
p_vout->p_sys->i_image_width = i_img_width; p_vout->p_sys->i_image_width = i_img_width;
p_vout->p_sys->i_image_height = i_img_height; p_vout->p_sys->i_image_height = i_img_height;
/* Destroy XvImage to change its size */
vout_End( p_vout );
/* Note: vout_End does nothing if no XvImage to destroy. */
/* Create XvImage using XShm extension */ /* Create XvImage using XShm extension */
if( XVideoCreateShmImage( p_vout->p_sys->p_display, if( XVideoCreateShmImage( p_vout->p_sys->p_display,
p_vout->p_sys->xv_port, p_vout->p_sys->xv_port,
...@@ -914,13 +921,16 @@ static int XVideoCreateShmImage( Display* dpy, int xv_port, ...@@ -914,13 +921,16 @@ static int XVideoCreateShmImage( Display* dpy, int xv_port,
0, 0 ); 0, 0 );
p_shm_info->readOnly = False; p_shm_info->readOnly = False;
#if 0
/* Mark the shm segment to be removed when there will be no more /* Mark the shm segment to be removed when there will be no more
* attachements, so it is automatic on process exit or after shmdt */ * attachements, so it is automatic on process exit or after shmdt */
shmctl( p_shm_info->shmid, IPC_RMID, 0 ); shmctl( p_shm_info->shmid, IPC_RMID, 0 );
#endif
if( !XShmAttach( dpy, p_shm_info ) ) if( !XShmAttach( dpy, p_shm_info ) )
{ {
intf_ErrMsg( "vout error: XShmAttach failed" ); intf_ErrMsg( "vout error: XShmAttach failed" );
shmctl( p_shm_info->shmid, IPC_RMID, 0 );
shmdt( p_shm_info->shmaddr ); shmdt( p_shm_info->shmaddr );
return( -1 ); return( -1 );
} }
...@@ -953,8 +963,10 @@ static void XVideoDestroyShmImage( vout_thread_t *p_vout, XvImage *p_xvimage, ...@@ -953,8 +963,10 @@ static void XVideoDestroyShmImage( vout_thread_t *p_vout, XvImage *p_xvimage,
XDestroyImage( p_ximage ); /* XXX */ XDestroyImage( p_ximage ); /* XXX */
#endif #endif
shmctl( p_shm_info->shmid, IPC_RMID, 0 );
if( shmdt( p_shm_info->shmaddr ) ) /* detach shared memory from process */ if( shmdt( p_shm_info->shmaddr ) ) /* detach shared memory from process */
{ /* also automatic freeing... */ {
intf_ErrMsg( "vout error: cannot detach shared memory (%s)", intf_ErrMsg( "vout error: cannot detach shared memory (%s)",
strerror(errno) ); strerror(errno) );
} }
......
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