Bug 1106 - wrong amount of offscreen memory w/ accel
Summary: wrong amount of offscreen memory w/ accel
Status: RESOLVED FIXED
Alias: None
Product: xorg
Classification: Unclassified
Component: Driver/Radeon (show other bugs)
Version: git
Hardware: x86 (IA32) All
: high normal
Assignee: Xorg Project Team
QA Contact:
URL:
Whiteboard:
Keywords:
: 1196 (view as bug list)
Depends on:
Blocks: 1690
  Show dependency treegraph
 
Reported: 2004-08-16 17:38 UTC by Thomas Winischhofer
Modified: 2005-12-09 10:11 UTC (History)
2 users (show)

See Also:
i915 platform:
i915 features:


Attachments
Proposed fix. (1.01 KB, patch)
2005-11-08 08:16 UTC, Michel Dänzer
ajax: 6.9/7.0+
Details | Splinter Review

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.