I am using the MIT-SHM extension on XFree86 to display the captured
images of my camera. However, when the captured image is moving, the
tearing effect on the display is really visible. I am using this code
to get the ShmCompletion event:

XShmPutImage( display, wnd, gc, xi, 0, 0, 0, 0, width, height, true
XSync( display, false );
XIfEvent( display, &ev, predicate, 0 );

where predicate() is:

static Bool predicate(Display *display, XEvent *ev, XPointer arg)
if(ev->type == iCompletionType) return True;
else return False;


int iCompletionType = XShmGetEventBase(display) + ShmCompletion;

However, my display still has the tearing effect. Can somebody help
me? Please?

Or is it really possible to eliminate the tearing effect?