We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 648 - GCC optimizations break BlitRGBtoRGBSurfaceAlpha128MMX
Summary: GCC optimizations break BlitRGBtoRGBSurfaceAlpha128MMX
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: video (show other bugs)
Version: HG 1.2
Hardware: x86 Linux
: P2 normal
Assignee: Ryan C. Gordon
QA Contact: Sam Lantinga
URL:
Keywords: target-1.2.14
Depends on:
Blocks:
 
Reported: 2008-11-28 02:17 UTC by Neil T.
Modified: 2009-09-28 21:04 UTC (History)
1 user (show)

See Also:


Attachments
png from previous comment (744.63 KB, image/png)
2009-09-18 11:34 UTC, Rene Dudfield
Details
patch from above comment (3.01 KB, patch)
2009-09-18 11:36 UTC, Rene Dudfield
Details | Diff
example problem showing the problem with the blitter (757 bytes, text/plain)
2009-09-18 11:37 UTC, Rene Dudfield
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Neil T. 2008-11-28 02:17:26 UTC
BlitRGBtoRGBSurfaceAlpha128MMX passes the "load" value (SDL-1.2/src/video/SDL_blit_A.c:240 rev 4144) as a Uint8 to the asm block, so GCC seems to be assuming that the upper doubleword doesn't need to be initialized as it is reinitialized later as 0x00010101. This results in a mask like 0x0000200000fefefeULL instead of 0x00fefefe00fefefeULL.
Causes issues with surface alpha=128 blitting: http://www.boswars.org/dev/screenbug.png
Compiled with default options from ./configure (-g -O2)
GCC version: Debian 4.3.2-1.
Comment 1 Neil T. 2008-11-28 02:45:15 UTC
Getting an error from Bugzilla when trying to add an attachment:
undef error - Undefined subroutine Fh::slice at data/template/template/en/default/global/hidden-fields.html.tmpl line 58 

Example program (http://pastebin.com/f3cb38cbe) should display a solid colored rectangle, but the rectangle has vertical stripes.
Patch (http://pastebin.com/f3d695d3c) changes Uint8[8] to Uint64, which forces GCC to initialize the whole value.
Blit565to565SurfaceAlphaMMX and Blit555to555SurfaceAlphaMMX also appear to be affected, but I haven't had a chance to test them before/after applying the patch.
Comment 2 Ryan C. Gordon 2009-09-13 16:33:32 UTC
Tagging this bug with "target-1.2.14" so we can try to resolve it for SDL 1.2.14.

Please note that we may choose to resolve it as WONTFIX. This tag is largely so we have a comprehensive wishlist of bugs to examine for 1.2.14 (and so we can close bugs that we'll never fix, rather than have them live forever in Bugzilla).

--ryan.
Comment 3 Rene Dudfield 2009-09-18 11:34:06 UTC
Created attachment 362 [details]
png from previous comment

here's the png from the above comment as an attachment.
Comment 4 Rene Dudfield 2009-09-18 11:36:55 UTC
Created attachment 363 [details]
patch from above comment
Comment 5 Rene Dudfield 2009-09-18 11:37:52 UTC
Created attachment 364 [details]
example problem showing the problem with the blitter
Comment 6 Sam Lantinga 2009-09-21 04:36:42 UTC
Ryan, this looks like a good fix to me.  You want to try it out and see if the other functions mentioned need a similar fix?
Comment 7 Ryan C. Gordon 2009-09-28 21:04:20 UTC
This patch is svn revision #4885, thanks!

--ryan.