This is the mail archive of the cygwin-xfree@cygwin.com mailing list for the Cygwin XFree86 project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: XWin 4.3.0-50 crashes with -multiwindow (ping Earle)


Hi All,

It seems that this may have been resolved already, but FWIW...

Earle F. Philhower III wrote:
> To fix it we can reinstate the if()...
>  >   if (pixmap->drawable.bitsPerPixel == 15)
>  >     effXBPP = 16;
>  >   else
>  >     effXBPP = pixmap->drawable.bitsPerPixel;
>  >   if (pixmap->drawable.depth == 15)
>  >     effXDepth = 16;
>  >   else
>  >     effXDepth = pixmap->drawable.depth;
> Or get rid of the effX* variables completely, but modify (~line 218)
> < if (effxdepth==16) into
> into
>  > if (xdepth==16 || xdepth==15)
> 
> and modify all of the X image ptr walking
> <             ptr += posX * (effXBPP / 8);
> into
>  >             ptr += (xbpp==15)?(posX * (16/8):(posX * (xbpp/ 8));

Why not just replace (bpp/8) with ((bpp+1)/8) ?

More generally you could use ((bpp+7)/8) which will round up any bit
depth to a whole number of bytes (always assuming that bpp is an
integral type).

This works for all of the multi-bit depths mentioned by Earle. (I
haven't got the source so I don't know if 1-bit images would be
affected)

Although it's probably not important in this context, the above
approach is generally preferable for performance since, as well as
being intrinsically quicker, it removes any conditional code which
plays havoc with CPU branch prediction.  I only mention this because I
imagine that this scenario is replayed a lot throughout the server and
there may be useful gains to be made.  (Also, you could try replacing
the '/8' with '>>3', but I'm pretty certain that gcc is smart enough to
do that anyway.)

Cheers,
   Phil


**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.

www.mimesweeper.com
**********************************************************************


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]