thomas at winischhofer.net
Sat Aug 14 07:26:36 PDT 2004
Thomas Winischhofer wrote:
> Both the radeon and the mga driver allocate offscreen memory for RENDER
> acceleration using xf86AllocateOffscreenLinear(). However, the "size"
> argument for this call is calculated differently:
> The mga driver's RENDER acceleration calculates the "size" argument like
> this (simplified):
> size = width * height
> if (pScrn->bitsPerPixel == 16) size <<= 1;
> The radeon driver does this like this:
> size = width * PICT_FORMAT_BPP(texFormat) * height
> Both the mga and the radeon drivers' video code allocates offscreen
> video memory calculating "size" like this:
> size = (width * height) / (pScrn->bitsPerPixel >> 3)
> So, what IS the unit of "size" for xf86AllocateOffscreenLinear()?
> "pixel" (=bpp-dependent) or "byte"?
> If it's "pixel", the radeon driver's RENDER acceleration is broken in
> this regard.
Answering to my own posting: Size is in PIXELS. This means that the
radeon driver's RENDER acceleration does not allocate the correct amount
of memory as it only bases its calculation on the source bitmap's format
but not the current screen layout's depth. That should probably be
something in the line of:
dst_pitch = (width * tex_bytepp + 31) & ~31;
size = dst_pitch * height;
+ sbpp = pScrn->bitsPerPixel >> 3;
- if (!AllocateLinear(pScrn, size))
+ if (!AllocateLinear(pScrn, (size + sbpp - 1) / sbpp))
thomas AT winischhofer DOT net http://www.winischhofer.net/
twini AT xfree86 DOT org
More information about the xorg