Bug 1106

Summary: wrong amount of offscreen memory w/ accel
Product: xorg Reporter: Thomas Winischhofer <thomas>
Component: Driver/RadeonAssignee: Xorg Project Team <xorg-team>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: high CC: eric, mharris
Version: git   
Hardware: x86 (IA32)   
OS: All   
Whiteboard:
i915 platform: i915 features:
Bug Depends on:    
Bug Blocks: 1690    
Attachments:
Description Flags
Proposed fix. ajax: 6.9/7.0+

Description Thomas Winischhofer 2004-08-16 17:38:26 UTC
The radeon driver's RENDER acceleration code allocates offscreen memory using
xf86AllocateOffscreenLinear(). However, given the fact that the "size" argument
to that call is supposed to be in units of "pixels" (and thus depending on the
current screen's depth), it does this the wrong way:

Currently, this looks like this:

  tex_bytepp = PICT_FORMAT_BPP(format) >> 3;
  [...]
  dst_pitch = (width * tex_bytepp + 31) & ~31;
  size = dst_pitch * height;

  AllocateLinear(size);  

This is wrong because the result is the size of the texture in bytes, not screen
pixels. The "size" has to be calculated like this (where as bpp =
pScrn->bitsPerPixel >> 3):

  size = ((dst_pitch + bpp - 1) / bpp) * height;
Comment 1 Alex Deucher 2004-08-27 07:06:40 UTC
*** Bug 1196 has been marked as a duplicate of this bug. ***
Comment 2 T. Hood 2005-09-26 07:40:30 UTC
Has this been fixed in CVS?

The code now looks like this:

    tex_bytepp = PICT_FORMAT_BPP(format) >> 3;
    dst_pitch = (width * tex_bytepp + 63) & ~63;
    size = dst_pitch * height;
    AllocateLinear(pScrn, size)
    --(sizeNeeded=size)-->
    xf86AllocateOffscreenLinear(pScrn->pScreen, sizeNeeded, 32, NULL,
RemoveLinear, info);

Comment 3 Michel Dänzer 2005-11-08 08:16:20 UTC
Created attachment 3737 [details] [review]
Proposed fix.

Please review and/or test with XAA. Look for RENDER regressions (or possibly
even improvements :).
Comment 4 Adam Jackson 2005-11-19 13:58:51 UTC
Comment on attachment 3737 [details] [review]
Proposed fix.

looks obviously correct to me.
Comment 5 Adam Jackson 2005-12-10 03:29:48 UTC
Comment on attachment 3737 [details] [review]
Proposed fix.

approved, i'll check this in.
Comment 6 Adam Jackson 2005-12-10 05:11:50 UTC
fixed, thanks

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.