Yes! That fixes the problem just as nicely (perhaps better; even with the
nanosleep it would happen very rarely) and seems a lot less like a kludge.
Here is (a version of the) patch:
i8k# diff -u xv.c.old xv.c
--- xv.c.old Mon Aug 12 00:01:50 2002
+++ xv.c Wed Aug 14 22:53:14 2002
@@ -2784,7 +2784,12 @@
to generate the correct exposes (particularly with 'BitGravity' turned
on */
- if (mainW && !useroot) GenExpose(mainW, 0, 0, (u_int) eWIDE, (u_int)
eHIGH);
+ /*Brian T. Schellenberger: fix for X 4.2 refresh problem*/
+ if (mainW && !useroot) {
+ XSync(theDisp, False);
+ GenExpose(mainW, 0, 0, (u_int) eWIDE, (u_int) eHIGH);
+ }
+#endif
return 1;
With modern versions of X, some of the "of course the timing will work this
way" assumptions of xv apparently fail. This patch should eliminate or at
least greatly mitigate problems from people who are having trouble with xv
refreshing.
--Brian. (Licensed xv user since 1995 . . . speaking of which doesn't the
silly patent *expire* pretty soon so that you can release 3.20 finally after
a mere 10-year delay or something of the sort?)
On Tuesday 13 August 2002 09:01 am, you wrote:
| Brian,
|
| I used to work on X servers, so this sounds like a familure problem.
| There are not many "well written" X11 applications and older
| applications are worse than newer applications. Xv falls into the older
| application catagory - I've been using xv since 1989. There were many
| assumptions programmers made to make programs faster that aren't true
| anymore.
|
| I have seen this problem on my desktop system, but not every time I use
| xv. But I'm using XFree86 3.3, FreeBSD 4.6, a Pentium II 450 and a
| Matrox G200, not the latest and greatest. So I don't suspect the
| problem is with the Xserver.
|
| The cause of the refresh problem is probably a race condition. I think
| the xserver is finishing its setup tasks later than xv expects. When
| the xserver isn't ready, xv drops the expose event. Waiting for the
| system clock to advance will work or doing a XSync(theDisp, false)
| before the GenExpose() call.
|
| Just to let you know, the if statement guarding the GenExpose() call is
| there because of problems that can occur if xv is drawing on the root
| window.
|
| henry
|
| Brian T. Schellenberger wrote:
| >[Please do NOT group-reply to this!
| >I'm broadcasting this far & wide. I will summarize any suggestions &
| > results to anybody who expresses an interest, but please let's never
| > followup to such a broad group.]
| >
| >[For those of you coming in the middle, I've been having trouble with X
| > not refreshing properly since I upgraded to FreeBSD 4.6, XFree86 4.2, and
| > KDE3. This is most noticable with xv, where I will page through "xv *.*"
| > output and the previous pictures won't properly get redrawn; thus, there
| > will frequently be portions of multiple different pictures showing up at
| > once. To see the effect I'm complaining about, see
| > http://www.babbleon.org/problem.png, where you can see fractions of the
| > first four images that I tried to display.]
| >
| >
| >
| >Ok, I've been playing around some more, and I *do* now have a workaround
| > for this problem in xv. I don't really suspect that it's a bug in xv,
| > but it's a pretty cheap patch for anybody else having refresh problems
| > with xv so it might be worthwhile making it generally available, anyway,
| > for anybody running into similar symptoms.
| >
| >But more importantly, this patch is interesting because for somebody with
| > the right backgroup is must surely hold a clue about what the underlying
| > problem is. The actual patch is pasted in below, but what it does is
| > very simple: It adds a 1-nonsecond delay to the the xv routine (openPic)
| > that actually draws a picture.
| >
| >Now here is the really odd part (to me): This fixes the problem whether
| > the sleep is requested before *or* after the GenExpose() call in xv!
| > That seems quite odd to me, granted that my ignorance about both xv and X
| > programming is vast.
| >
| >Anyway, if anybody is interested in unraveling this mystery, I would be
| > happy to try any experiments that you can suggest. In the meantime, my
| > workaround takes care of the main thing that was plaguing my life, so I
| > will be personally satisfied even if this matter is dropped here.
| >
| >But I'd rather work with somebody with more expertise than myself to
| > unravel this mystery. If anybody getting this message can shed any
| > insight, I'm all ears.
| >
| >
| >
| >i8k# diff -c xv.c.old xv.c
| >*** xv.c.old Mon Aug 12 00:01:50 2002
| >--- xv.c Mon Aug 12 00:02:09 2002
| >***************
| >*** 2784,2790 ****
| >--- 2784,2804 ----
| > to generate the correct exposes (particularly with 'BitGravity'
| > turned on */
| >
| >+ #if 0
| > if (mainW && !useroot) GenExpose(mainW, 0, 0, (u_int) eWIDE, (u_int)
| >eHIGH);
| >+ #else
| >+ /*Brian T. Schellenberger: workaround for X 4.2 refresh problem*/
| >+ if (mainW && !useroot) {
| >+ #include <time.h>
| >+
| >+ struct timespec period;
| >+ period.tv_sec = 0;
| >+ period.tv_nsec = 1;
| >+
| >+ nanosleep(&period, NULL);
| >+ GenExpose(mainW, 0, 0, (u_int) eWIDE, (u_int) eHIGH);
| >+ }
| >+ #endif
| >
| > return 1;
--
Brian, the man from Babble-On . . . . [EMAIL PROTECTED] (personal)
http://www.babbleon.org
http://www.eff.org http://www.programming-freedom.org
_______________________________________________
Xpert mailing list
[EMAIL PROTECTED]
http://XFree86.Org/mailman/listinfo/xpert