File no_xv_segfault.diff of Package i855crt
From: Seb Wills <sebwills@users.sourceforge.net>
Subject: Fix segfault in i855crt when no xv support in xserver
Date: 2006-02-02 08:36
If you run i855crt when the xserver is using the vesa
driver, rather than i810 driver, then i855crt segfaults
while trying to setup the xvideo overlay (which of
course it cannot do since vesa driver does not support xv).
This trivial patch prevents i855crt segfaulting in this
situation.
---
i855crt.c | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
--- a/i855crt.c
+++ b/i855crt.c
@@ -47,10 +47,16 @@ static void overlay_select_pipe(int p)
{ int succ=0;
AtomPipe=XInternAtom (d, "XV_PIPE", False);
int i;
- XvQueryAdaptors(d, DefaultRootWindow(d),&i, &info);
- if(Success!=XvSetPortAttribute(d,info[0].base_id, AtomPipe, p))
- fprintf(stderr,"Failed to set Xv attribute\n");
- else fprintf(stderr,"Xv overlay routed to pipe %c\n",p? 'B':'A');
+ if(Success!=XvQueryAdaptors(d, DefaultRootWindow(d),&i, &info))
+ fprintf(stderr, "XvQueryAdaptors() failed\n");
+ else
+ {
+ if(i==0 || Success!=XvSetPortAttribute(d,info[0].base_id, AtomPipe, p))
+ fprintf(stderr,"Failed to set Xv attribute\n");
+ else
+ fprintf(stderr,"Xv overlay routed to pipe %c\n",p? 'B':'A');
+ XvFreeAdaptorInfo(info);
+ }
XFlush(d);
}