Mercurial > sdl-ios-xcode
view docs/html/sdlenvvars.html @ 3162:dc1eb82ffdaa
Von: Thomas Zimmermann
Betreff: [SDL] [PATCH] Make static variables const
Datum: Tue, 19 May 2009 19:45:37 +0200
Hi,
this is a set of simple changes which make some of SDL's internal static
arrays constant. The purpose is to shrink the number of write-able
static bytes and thus increase the number of memory pages shared between
SDL applications.
The patch set is against trunk@4513. Each of the attached patch files is
specific to a sub-system. The set is completed by a second mail, because
of the list's 40 KiB limit.
The files readelf-r4513.txt and readelf-const-patch.txt where made by
calling 'readelf -S libSDL.so'. They show the difference in ELF sections
without and with the patch. Some numbers measured on my x86-64:
Before
[13] .rodata PROGBITS 00000000000eaaa0 000eaaa0
0000000000008170 0000000000000000 A 0 0 32
[19] .data.rel.ro PROGBITS 00000000003045e0 001045e0
00000000000023d0 0000000000000000 WA 0 0 32
[23] .data PROGBITS 00000000003076e0 001076e0
0000000000004988 0000000000000000 WA 0 0 32
After
[13] .rodata PROGBITS 00000000000eaaa0 000eaaa0
0000000000009a50 0000000000000000 A 0 0 32
[19] .data.rel.ro PROGBITS 0000000000306040 00106040
0000000000002608 0000000000000000 WA 0 0 32
[23] .data PROGBITS 0000000000309360 00109360
0000000000002e88 0000000000000000 WA 0 0 32
The size of the write-able data section decreased considerably. Some
entries became const-after-relocation, while most of its content went
straight into the read-only data section.
Best regards, Thomas
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Wed, 03 Jun 2009 04:37:27 +0000 |
parents | 9c9c49b18693 |
children | b1fd24d62e55 |
line wrap: on
line source
<HTML ><HEAD ><TITLE >SDL_envvars</TITLE ><META NAME="GENERATOR" CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+ "><LINK REL="HOME" TITLE="SDL Library Documentation" HREF="index.html"><LINK REL="UP" TITLE="General" HREF="general.html"><LINK REL="PREVIOUS" TITLE="SDL_GetError" HREF="sdlgeterror.html"><LINK REL="NEXT" TITLE="Video" HREF="video.html"></HEAD ><BODY CLASS="REFENTRY" BGCOLOR="#FFF8DC" TEXT="#000000" LINK="#0000ee" VLINK="#551a8b" ALINK="#ff0000" ><DIV CLASS="NAVHEADER" ><TABLE SUMMARY="Header navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TH COLSPAN="3" ALIGN="center" >SDL Library Documentation</TH ></TR ><TR ><TD WIDTH="10%" ALIGN="left" VALIGN="bottom" ><A HREF="sdlgeterror.html" ACCESSKEY="P" >Prev</A ></TD ><TD WIDTH="80%" ALIGN="center" VALIGN="bottom" ></TD ><TD WIDTH="10%" ALIGN="right" VALIGN="bottom" ><A HREF="video.html" ACCESSKEY="N" >Next</A ></TD ></TR ></TABLE ><HR ALIGN="LEFT" WIDTH="100%"></DIV ><H1 ><A NAME="SDLENVVARS" ></A >SDL_envvars</H1 ><DIV CLASS="REFNAMEDIV" ><A NAME="AEN675" ></A ><H2 >Name</H2 >SDL_envvars -- SDL environment variables</DIV ><DIV CLASS="REFSECT1" ><A NAME="AEN678" ></A ><H2 >Description</H2 ><P >Not a function, set using setenv()</P ><P >Several environment variables are available to modify the behaviour of SDL. Using these variables isn't recommened and the names and presence of these variables aren't guaranteed from one release to the next. However, they can be very useful for debugging purposes.</P ></DIV ><DIV CLASS="REFSECT1" ><A NAME="AEN682" ></A ><H2 >Video</H2 ><P ></P ><DIV CLASS="VARIABLELIST" ><DL ><DT ><TT CLASS="LITERAL" >SDL_FBACCEL</TT ></DT ><DD ><P >If set to 0, disable hardware acceleration in the linux fbcon driver.</P ></DD ><DT ><TT CLASS="LITERAL" >SDL_FBDEV</TT ></DT ><DD ><P >Frame buffer device to use in the linux fbcon driver, instead of /dev/fb0</P ></DD ><DT ><TT CLASS="LITERAL" >SDL_FULLSCREEN_UPDATE</TT ></DT ><DD ><P >In the ps2gs driver, sets the <TT CLASS="LITERAL" >SDL_ASYNCBLIT</TT > flag on the display surface.</P ></DD ><DT ><TT CLASS="LITERAL" >SDL_VIDEODRIVER</TT ></DT ><DD ><P >Selectes the video driver for SDL to use. Possible values, in the order they are tried if this variable is not set:</P ><DIV CLASS="INFORMALTABLE" ><A NAME="AEN706" ></A ><P ></P ><TABLE BORDER="0" CLASS="CALSTABLE" ><TBODY ><TR ><TD ALIGN="LEFT" VALIGN="TOP" ><TT CLASS="LITERAL" >x11</TT ></TD ><TD ALIGN="LEFT" VALIGN="TOP" ><P ></P ></TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="TOP" ><TT CLASS="LITERAL" >dga</TT ></TD ><TD ALIGN="LEFT" VALIGN="TOP" ><P >(the XFree86 DGA2)</P ></TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="TOP" ><TT CLASS="LITERAL" >nanox</TT ></TD ><TD ALIGN="LEFT" VALIGN="TOP" ><P >(Linux)</P ></TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="TOP" ><TT CLASS="LITERAL" >fbcon</TT ></TD ><TD ALIGN="LEFT" VALIGN="TOP" ><P >(Linux)</P ></TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="TOP" ><TT CLASS="LITERAL" >directfb</TT ></TD ><TD ALIGN="LEFT" VALIGN="TOP" ><P >(Linux)</P ></TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="TOP" ><TT CLASS="LITERAL" >ps2gs</TT ></TD ><TD ALIGN="LEFT" VALIGN="TOP" ><P >(Playstation 2)</P ></TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="TOP" ><TT CLASS="LITERAL" >ggi</TT ></TD ><TD ALIGN="LEFT" VALIGN="TOP" ><P ></P ></TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="TOP" ><TT CLASS="LITERAL" >vgl</TT ></TD ><TD ALIGN="LEFT" VALIGN="TOP" ><P >(BSD)</P ></TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="TOP" ><TT CLASS="LITERAL" >svgalib</TT ></TD ><TD ALIGN="LEFT" VALIGN="TOP" ><P >(Linux)</P ></TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="TOP" ><TT CLASS="LITERAL" >aalib</TT ></TD ><TD ALIGN="LEFT" VALIGN="TOP" ><P ></P ></TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="TOP" ><TT CLASS="LITERAL" >directx</TT ></TD ><TD ALIGN="LEFT" VALIGN="TOP" ><P >(Win32)</P ></TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="TOP" ><TT CLASS="LITERAL" >windib</TT ></TD ><TD ALIGN="LEFT" VALIGN="TOP" ><P >(Win32)</P ></TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="TOP" ><TT CLASS="LITERAL" >bwindow</TT ></TD ><TD ALIGN="LEFT" VALIGN="TOP" ><P >(BeOS)</P ></TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="TOP" ><TT CLASS="LITERAL" >toolbox</TT ></TD ><TD ALIGN="LEFT" VALIGN="TOP" ><P >(MacOS Classic)</P ></TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="TOP" ><TT CLASS="LITERAL" >DSp</TT ></TD ><TD ALIGN="LEFT" VALIGN="TOP" ><P >(MacOS Classic)</P ></TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="TOP" ><TT CLASS="LITERAL" >Quartz</TT ></TD ><TD ALIGN="LEFT" VALIGN="TOP" ><P >(Mac OS X)</P ></TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="TOP" ><TT CLASS="LITERAL" >CGX</TT ></TD ><TD ALIGN="LEFT" VALIGN="TOP" ><P >(Amiga)</P ></TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="TOP" ><TT CLASS="LITERAL" >photon</TT ></TD ><TD ALIGN="LEFT" VALIGN="TOP" ><P >(QNX)</P ></TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="TOP" ><TT CLASS="LITERAL" >dummy</TT ></TD ><TD ALIGN="LEFT" VALIGN="TOP" ><P ></P ></TD ></TR ></TBODY ></TABLE ><P ></P ></DIV ></DD ><DT ><TT CLASS="LITERAL" >SDL_VIDEO_CENTERED</TT ></DT ><DD ><P >If set, tries to center the SDL window when running in X11 windowed mode, or using the CyberGrafix driver.</P ></DD ><DT ><TT CLASS="LITERAL" >SDL_VIDEO_GL_DRIVER</TT ></DT ><DD ><P >The openGL driver (shared library) to use for X11. Default is libGL.so.1</P ></DD ><DT ><TT CLASS="LITERAL" >SDL_VIDEO_X11_DGAMOUSE</TT ></DT ><DD ><P >With XFree86, enables use of DGA mouse if set.</P ></DD ><DT ><TT CLASS="LITERAL" >SDL_VIDEO_X11_MOUSEACCEL</TT ></DT ><DD ><P >For X11, sets the mouse acceleration. The value should be a string on the form:</P ><P >"<TT CLASS="PARAMETER" ><I >n</I ></TT >/<TT CLASS="PARAMETER" ><I >d</I ></TT >/<TT CLASS="PARAMETER" ><I >t</I ></TT >"</P ><P >where <TT CLASS="PARAMETER" ><I >n</I ></TT > and <TT CLASS="PARAMETER" ><I >d</I ></TT > are the acceleration numerator/denumerators (so mouse movement is accelerated by <TT CLASS="PARAMETER" ><I >n</I ></TT >/<TT CLASS="PARAMETER" ><I >d</I ></TT >), and <TT CLASS="PARAMETER" ><I >t</I ></TT > is the threshold above which acceleration applies (counted as number of pixels the mouse moves at once).</P ></DD ><DT ><TT CLASS="LITERAL" >SDL_VIDEO_X11_NODIRECTCOLOR</TT ></DT ><DD ><P >If set, don't attempt to use DirectColor visuals even if they are present. (SDL will use them otherwise for gamma correction). This is needed with older X servers when using the XVideo extension.</P ></DD ><DT ><TT CLASS="LITERAL" >SDL_VIDEO_X11_VISUALID</TT ></DT ><DD ><P >ID of an X11 visual to use, overriding SDL's default visual selection algorithm. It can be in decimal or in hex (prefixed by 0x).</P ></DD ><DT ><TT CLASS="LITERAL" >SDL_VIDEO_YUV_DIRECT</TT ></DT ><DD ><P >If set, display YUV overlay directly on the video surface if possible, instead of on the surface passed to <A HREF="sdlcreateyuvoverlay.html" ><TT CLASS="FUNCTION" >SDL_CreateYUVOverlay</TT ></A >.</P ></DD ><DT ><TT CLASS="LITERAL" >SDL_VIDEO_YUV_HWACCEL</TT ></DT ><DD ><P >If not set or set to a nonzero value, SDL will attempt to use hardware YUV acceleration for video playback.</P ></DD ><DT ><TT CLASS="LITERAL" >SDL_WINDOWID</TT ></DT ><DD ><P >For X11 or Win32, contains the ID number of the window to be used by SDL instead of creating its own window. Either in decimal or in hex (prefixed by 0x).</P ></DD ></DL ></DIV ></DIV ><DIV CLASS="REFSECT1" ><A NAME="AEN866" ></A ><H2 >Events/Input</H2 ><P ></P ><DIV CLASS="VARIABLELIST" ><DL ><DT ><TT CLASS="LITERAL" >SDL_MOUSE_RELATIVE</TT ></DT ><DD ><P >If set to 0, do not use mouse relative mode in X11. The default is to use it if the mouse is hidden and input is grabbed.</P ></DD ><DT ><TT CLASS="LITERAL" >SDL_MOUSEDEV</TT ></DT ><DD ><P >The mouse device to use for the linux fbcon driver. If not set, SDL first tries to use GPM in repeater mode, then various other devices (/dev/pcaux, /dev/adbmouse, /dev/mouse etc).</P ></DD ><DT ><TT CLASS="LITERAL" >SDL_MOUSEDEV_IMPS2</TT ></DT ><DD ><P >If set, SDL will not try to auto-detect the IMPS/2 protocol of a PS/2 mouse but use it right away. For the fbcon and ps2gs drivers.</P ></DD ><DT ><TT CLASS="LITERAL" >SDL_MOUSEDRV</TT ></DT ><DD ><P >For the linux fbcon driver: if set to ELO, use the ELO touchscreen controller as a pointer device</P ></DD ><DT ><TT CLASS="LITERAL" >SDL_NO_RAWKBD</TT ></DT ><DD ><P >For the libvga driver: If set, do not attempt to put the keyboard in raw mode.</P ></DD ><DT ><TT CLASS="LITERAL" >SDL_NOMOUSE</TT ></DT ><DD ><P >If set, the linux fbcon driver will not use a mouse at all.</P ></DD ></DL ></DIV ></DIV ><DIV CLASS="REFSECT1" ><A NAME="AEN899" ></A ><H2 >Audio</H2 ><P ></P ><DIV CLASS="VARIABLELIST" ><DL ><DT ><TT CLASS="LITERAL" >AUDIODEV</TT ></DT ><DD ><P >The audio device to use, if <TT CLASS="LITERAL" >SDL_PATH_DSP</TT > isn't set.</P ></DD ><DT ><TT CLASS="LITERAL" >SDL_AUDIODRIVER</TT ></DT ><DD ><P >Selects the audio driver for SDL to use. Possible values, in the order they are tried if this variable is not set:</P ><DIV CLASS="INFORMALTABLE" ><A NAME="AEN913" ></A ><P ></P ><TABLE BORDER="0" CLASS="CALSTABLE" ><TBODY ><TR ><TD ALIGN="LEFT" VALIGN="TOP" ><TT CLASS="LITERAL" >openbsd</TT ></TD ><TD ALIGN="LEFT" VALIGN="TOP" ><P >(OpenBSD)</P ></TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="TOP" ><TT CLASS="LITERAL" >dsp</TT ></TD ><TD ALIGN="LEFT" VALIGN="TOP" ><P >(OSS /dev/dsp: Linux, Solaris, BSD etc)</P ></TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="TOP" ><TT CLASS="LITERAL" >alsa</TT ></TD ><TD ALIGN="LEFT" VALIGN="TOP" ><P >(Linux)</P ></TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="TOP" ><TT CLASS="LITERAL" >audio</TT ></TD ><TD ALIGN="LEFT" VALIGN="TOP" ><P >(Unix style /dev/audio: SunOS, Solaris etc)</P ></TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="TOP" ><TT CLASS="LITERAL" >AL</TT ></TD ><TD ALIGN="LEFT" VALIGN="TOP" ><P >(Irix)</P ></TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="TOP" ><TT CLASS="LITERAL" >artsc</TT ></TD ><TD ALIGN="LEFT" VALIGN="TOP" ><P >(ARTS audio daemon)</P ></TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="TOP" ><TT CLASS="LITERAL" >esd</TT ></TD ><TD ALIGN="LEFT" VALIGN="TOP" ><P >(esound audio daemon)</P ></TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="TOP" ><TT CLASS="LITERAL" >nas</TT ></TD ><TD ALIGN="LEFT" VALIGN="TOP" ><P >(NAS audio daemon)</P ></TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="TOP" ><TT CLASS="LITERAL" >dma</TT ></TD ><TD ALIGN="LEFT" VALIGN="TOP" ><P >(OSS /dev/dsp, using DMA)</P ></TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="TOP" ><TT CLASS="LITERAL" >dsound</TT ></TD ><TD ALIGN="LEFT" VALIGN="TOP" ><P >(Win32 DirectX)</P ></TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="TOP" ><TT CLASS="LITERAL" >waveout</TT ></TD ><TD ALIGN="LEFT" VALIGN="TOP" ><P >(Win32 WaveOut)</P ></TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="TOP" ><TT CLASS="LITERAL" >baudio</TT ></TD ><TD ALIGN="LEFT" VALIGN="TOP" ><P >(BeOS)</P ></TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="TOP" ><TT CLASS="LITERAL" >sndmgr</TT ></TD ><TD ALIGN="LEFT" VALIGN="TOP" ><P >(MacOS SoundManager)</P ></TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="TOP" ><TT CLASS="LITERAL" >paud</TT ></TD ><TD ALIGN="LEFT" VALIGN="TOP" ><P >(AIX)</P ></TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="TOP" ><TT CLASS="LITERAL" >AHI</TT ></TD ><TD ALIGN="LEFT" VALIGN="TOP" ><P >(Amiga)</P ></TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="TOP" ><TT CLASS="LITERAL" >disk</TT ></TD ><TD ALIGN="LEFT" VALIGN="TOP" ><P >(all; output to file)</P ></TD ></TR ></TBODY ></TABLE ><P ></P ></DIV ></DD ><DT ><TT CLASS="LITERAL" >SDL_DISKAUDIOFILE</TT ></DT ><DD ><P >The name of the output file for the "disk" audio driver. If not set, the name <TT CLASS="LITERAL" >sdlaudio.raw</TT > is used.</P ></DD ><DT ><TT CLASS="LITERAL" >SDL_DISKAUDIODELAY</TT ></DT ><DD ><P >For the "disk" audio driver, how long to wait (in ms) before writing a full sound buffer. The default is 150 ms.</P ></DD ><DT ><TT CLASS="LITERAL" >SDL_DSP_NOSELECT</TT ></DT ><DD ><P >For some audio drivers (alsa, paud, dma and dsp), don't use select() but a timed method instead. May cure some audio problems, or cause others.</P ></DD ><DT ><TT CLASS="LITERAL" >SDL_PATH_DSP</TT ></DT ><DD ><P >The audio device to use. If not set, SDL tries AUDIODEV and then a platform-dependent default value (/dev/audio on Solaris, /dev/dsp on Linux etc).</P ></DD ></DL ></DIV ></DIV ><DIV CLASS="REFSECT1" ><A NAME="AEN1017" ></A ><H2 >CD-ROM</H2 ><P ></P ><DIV CLASS="VARIABLELIST" ><DL ><DT ><TT CLASS="LITERAL" >SDL_CDROM</TT ></DT ><DD ><P >A colon-separated list of CD-ROM devices to use, in addition to the standard devices (typically /dev/cdrom, platform-dependent).</P ></DD ></DL ></DIV ></DIV ><DIV CLASS="REFSECT1" ><A NAME="AEN1025" ></A ><H2 >Debugging</H2 ><P ></P ><DIV CLASS="VARIABLELIST" ><DL ><DT ><TT CLASS="LITERAL" >SDL_DEBUG</TT ></DT ><DD ><P >If set, causes every call to <TT CLASS="FUNCTION" >SDL_SetError</TT > (that is, every time SDL signals an error) to also print an error message on stderr.</P ></DD ></DL ></DIV ></DIV ><DIV CLASS="REFSECT1" ><A NAME="AEN1034" ></A ><H2 >Joystick</H2 ><P ></P ><DIV CLASS="VARIABLELIST" ><DL ><DT ><TT CLASS="LITERAL" >SDL_JOYSTICK_DEVICE</TT ></DT ><DD ><P >Joystick device to use in the linux joystick driver, in addition to the usual: /dev/js*, /dev/input/event*, /dev/input/js*</P ></DD ><DT ><TT CLASS="LITERAL" >SDL_LINUX_JOYSTICK</TT ></DT ><DD ><P >Special joystick configuration string for linux. The format is</P ><P >"<TT CLASS="PARAMETER" ><I >name</I ></TT > <TT CLASS="PARAMETER" ><I >numaxes</I ></TT > <TT CLASS="PARAMETER" ><I >numhats</I ></TT > <TT CLASS="PARAMETER" ><I >numballs</I ></TT >"</P ><P >where <TT CLASS="PARAMETER" ><I >name</I ></TT > is the name string of the joystick (possibly in single quotes), and the rest are the number of axes, hats and balls respectively.</P ></DD ></DL ></DIV ></DIV ><DIV CLASS="NAVFOOTER" ><HR ALIGN="LEFT" WIDTH="100%"><TABLE SUMMARY="Footer navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" ><A HREF="sdlgeterror.html" ACCESSKEY="P" >Prev</A ></TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="index.html" ACCESSKEY="H" >Home</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" ><A HREF="video.html" ACCESSKEY="N" >Next</A ></TD ></TR ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" >SDL_GetError</TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="general.html" ACCESSKEY="U" >Up</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" >Video</TD ></TR ></TABLE ></DIV ></BODY ></HTML >