[Y-devel] Small patch
Phil phil at www.y-windows.org
Sun Apr 24 20:57:59 BST 2005
Hi all,
Just finished a few small changes which might improve performance on x86
systems. The MIN and MAX macros should also be safer now on GCC systems, but a
convenient all-C99-compilers fix is unfortunately not possible.
Don't get too hung up on the colourBlend*() changes, as my plan to add 12- 16-,
24- and 32-bit/channel rendering paths will mean rewriting the 8-bit/channel
path shortly anyway. Of course, if this is massively better/worse do let us
know so we can do (or avoid doing) similar things elsewhere.
Here is the change log:
New-patches: phil at www.y-windows.org--2005-kalimdor/Y--phil--0.2--patch-7
Summary: Make use of GCC's __attribute__ keyword and compound-statement-expressions
Keywords: __attribute__ GCC
Y/util/colour.h:
Added const, warn_unused_result, always_inline and regparm(3) attributes to
colourBlend and colourBlendSourceOver. Changed them to return a result rather
than modify a parameter. Removed the register qualifier from all variables -
the x86 doesn't have enough registers, and I suspect the compiler can do the
job better in any case. Use unions instead of pointer aliasing to access
individual channels.
Y/util/colour.c:
Updated extern implementation of colourBlend and colourBlendSourceOver to
match new prototype. Removed register qualifier from all variables - the x86
doesn't have enough registers, and I suspect the compiler can do the job
better in any case.
Y/buffer/rgbabuffer.c:
Updated calls to colourBlend to match new prototype
Y/main/y.c:
Inform GCC that show_usage and show_version do not return
Y/screen/swrenderer.c modules/drivers/video/fbdev/fbdev.c
modules/drivers/video/sdl/sdl.c modules/themes/basic/window.c:
Updated calls to colourBlendSourceOver to match new prototype
Y/util/yutil.h:
Inform GCC that ymalloc and ystrdup return non-aliased pointers. Advise GCC
that failing to look at the return value of ymalloc or ystrdup is a problem
worthy of a diagnostic. Advies GCC that yfree and ystrdup should not be
passed NULL under normal circumstances. Add regparm(1) to ymalloc, ystrdup
and yfree to speed up calls on x86. Make MAX and MIN a wee bit safer for GCC:
previously each parameter would be evaluated at least once and at most twice;
now each parameter will be evaluated exactly once.
Y/y.h:
Add a definition for __attribute__ on non-gcc systems.
config/server.conf:
Now matches my system. It'll never be perfect for everyone, but in my
repository it should at least be right for me.
Enjoy....
More information about the Y-devel mailing list
2026 © www.Y-Windows.Org - All Rights Reserved