#ifdef HAVE_SYS_SHM_H
static IMAGE_TYPE *CreateShmImage ( vout_thread_t *,
Display *, EXTRA_ARGS_SHM, int, int );
+static vlc_bool_t b_shm = VLC_TRUE;
#endif
static void ToggleFullScreen ( vout_thread_t * );
&p_pic->p_sys->shminfo,
p_vout->output.i_width, p_vout->output.i_height );
}
- else
+
+ if( !p_vout->p_sys->b_shm || !p_pic->p_sys->p_image )
#endif /* HAVE_SYS_SHM_H */
{
/* Create image without XShm extension */
p_vout->p_sys->i_bytes_per_pixel,
#endif
p_vout->output.i_width, p_vout->output.i_height );
+
+#ifdef HAVE_SYS_SHM_H
+ if( p_pic->p_sys->p_image && p_vout->p_sys->b_shm )
+ {
+ msg_Warn( p_vout, "couldn't create SHM image, disabling SHM." );
+ p_vout->p_sys->b_shm = VLC_FALSE;
+ }
+#endif /* HAVE_SYS_SHM_H */
}
if( p_pic->p_sys->p_image == NULL )
int i_width, int i_height )
{
IMAGE_TYPE *p_image;
+ Status result;
/* Create XImage / XvImage */
#ifdef MODULE_NAME_IS_xvideo
p_shm->readOnly = True;
/* Attach shared memory segment to X server */
- if( XShmAttach( p_display, p_shm ) == False )
+ XSynchronize( p_display, True );
+ b_shm = VLC_TRUE;
+ result = XShmAttach( p_display, p_shm );
+ if( result == False || !b_shm )
{
msg_Err( p_vout, "cannot attach shared memory to X server" );
IMAGE_FREE( p_image );
shmdt( p_shm->shmaddr );
return NULL;
}
+ XSynchronize( p_display, False );
/* Send image to X server. This instruction is required, since having
* built a Shm XImage and not using it causes an error on XCloseDisplay,
return 0;
}
+ if( event->request_code == 150 /* MIT-SHM */ &&
+ event->minor_code == X_ShmAttach )
+ {
+ fprintf(stderr, "XShmAttach failed\n");
+ b_shm = VLC_FALSE;
+ return 0;
+ }
+
XSetErrorHandler(NULL);
return (XSetErrorHandler(X11ErrorHandler))( display, event );
}