Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email email@example.com
From: Theo de Raadt (deraadtcvs.openbsd.org)
Date: Sun Aug 01 2010 - 22:47:51 CDT
> I have a small X application I use on my laptop that behaves buggy
> after some suspend+resumes. Detailed description below, but first...
> HOLY HELL thank you to all the devs who made suspend+resume work! I
> had almost forgotten what it was like to suspend+walk-to-work+resume
> and be on my way. Thank you again.
> The application is a small, horizontal stats display-er. After most
> suspend+resume's it continues to work fine. It always works fine
> after the first resume. After 3-5 resume's, there's a ~50% chance the
> display goes "buggy" (details below). In trying to resolve the
> problem, I am curious about the following:
> 1. Initially, I tried to catch a resume thinking a SIGCONT would be
> issued, and manually clear the display and re-draw. This doesn't
> appear to happen. Out of curiosity, on a resume is any signal issued
> to each process?
Suspend and resumes are completely invisible, except that time makes
an uncomfortable jump forward. Processes are not made aware in any
way. There is no API to sense the transition (at this time).
BTW, sending any signal would be violate the rules. We cannot
re-purpose standardized signals for our own uses.
> 2. Should my application have to do anything specific on a resume?
> My app is using rudimentary double-buffering: backbuffer is a Pixmap
> that's painted black on each call (XFillRectangle), the graphics are
> drawn, and then XCopyArea'd to the window. When it goes "buggy", it
> appears some of the backbuffer isn't being cleared, or it's being
> copied at an offset into the window.
> The normal display looks like this:
> The buggy display looks like this:
This sounds like a bug in either X or the graphics card driver; X
thinks the graphics card memory is still intact, but it isn't, and is
reusing it. I don't know the actual architecture but drivers which
suspect their memory will be gone after suspend should let X know
before suspend occurs (and then X should either save it in real memory
or force redraws). You should talk to oga and matthieu.