Mon, 09 Jan 2012 00:24:08 -0500Futzing around with strip settings
Sam Lantinga [Mon, 09 Jan 2012 00:24:08 -0500] rev 6197
Futzing around with strip settings

Sun, 08 Jan 2012 17:31:11 -0500Fixed memory corruption in the upsampling code, caught by valgrind
Sam Lantinga [Sun, 08 Jan 2012 17:31:11 -0500] rev 6196
Fixed memory corruption in the upsampling code, caught by valgrind

Sun, 08 Jan 2012 17:20:33 -0500Fixed bug 1091 - Hardcoded size in SDL_audiocvt.c may lead to heap/stack corruption
Sam Lantinga [Sun, 08 Jan 2012 17:20:33 -0500] rev 6195
Fixed bug 1091 - Hardcoded size in SDL_audiocvt.c may lead to heap/stack corruption

Markovtsev Vadim 2011-01-18 22:00:16 PST

SDL_audiocvt.c:

static void SDLCALL
SDL_ConvertStereo(SDL_AudioCVT * cvt, SDL_AudioFormat format):

#define dup_chans_1_to_2(type) \
{ \
const type *src = (const type *) (cvt->buf + cvt->len_cvt); \
type *dst = (type *) (cvt->buf + cvt->len_cvt * 2); \
for (i = cvt->len_cvt / 2; i; --i, --src) { \
const type val = *src; \
dst -= 2; \
dst[0] = dst[1] = val; \
} \
}

Pay attention to cvt->len_cvt / 2. 2 is the sizeof(Uint16), hovewer, below we
see that the conversion function supports Uint8 and Uint32:

switch (SDL_AUDIO_BITSIZE(format)) {
case 8:
dup_chans_1_to_2(Uint8);
break;
case 16:
dup_chans_1_to_2(Uint16);
break;
case 32:
dup_chans_1_to_2(Uint32);
break;
}

If type is Uint32, src will be decreased twice as it should be, memory being
written before the cvt->buf. If type is Uint8, the conversion will not be
complete. I suggest to change that define to

#define dup_chans_1_to_2(type) \
{ \
const type *src = (const type *) (cvt->buf + cvt->len_cvt); \
type *dst = (type *) (cvt->buf + cvt->len_cvt * 2); \
for (i = cvt->len_cvt / sizeof(type); i; --i, --src) { \
const type val = *src; \
dst -= 2; \
dst[0] = dst[1] = val; \
} \
}

I tested that and now it's working fine. I did not consider the similar defines
in functions nearby.

Sun, 08 Jan 2012 17:10:57 -0500Fixed bug 1014 - SDL_ConvertAudio crashes
Sam Lantinga [Sun, 08 Jan 2012 17:10:57 -0500] rev 6194
Fixed bug 1014 - SDL_ConvertAudio crashes

The patch Mark attached looks good and valgrind gives it a clean bill of health:

Mark.Howson@ntu.ac.uk 2010-12-15 07:45:25 PST

Reproducible here under Windows and Linux. Looking at the code for
SDL_Upsample_S16LSB_2c:

const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 2;
const Sint16 *target = ((const Sint16 *) cvt->buf) - 2;
while (dst > target) {
dst[1] = ((Sint16) SDL_SwapLE16(sample1));
dst[0] = ((Sint16) SDL_SwapLE16(sample0));
dst -= 2;
...

if dstsize is odd (and therefore dst), it'll write to target[1] which is one
byte before the allocated buf.

The attached patch to sdlgenaudiocvt.pl changes dst > target to dst >= target,
and removes the - $channels for the upsample case. The patch is not fully
tested, but seems to work here.

Sun, 08 Jan 2012 14:45:57 -0500Updated Xcode project
Sam Lantinga [Sun, 08 Jan 2012 14:45:57 -0500] rev 6193
Updated Xcode project

Sun, 08 Jan 2012 14:45:19 -0500Updated Xcode project SDL-1.2
Sam Lantinga [Sun, 08 Jan 2012 14:45:19 -0500] rev 6192
Updated Xcode project

Sun, 08 Jan 2012 13:42:03 -0500Made the application activity events consistent between iOS and Android
Sam Lantinga [Sun, 08 Jan 2012 13:42:03 -0500] rev 6191
Made the application activity events consistent between iOS and Android

Sun, 08 Jan 2012 13:31:22 -0500X11 OpenGL ES minor corrections
Sam Lantinga [Sun, 08 Jan 2012 13:31:22 -0500] rev 6190
X11 OpenGL ES minor corrections

Scott Percival 2012-01-08 04:21:22 PST

I tested the new build on my two ARM machines, and fixed a few bugs:
- if SDL_VIDEO_DRIVER_UIKIT, SDL_VIDEO_DRIVER_ANDROID or
SDL_VIDEO_DRIVER_PANDORA are specified, function pointers are grabbed from the
compile-linked library instead of through SDL_GL_GetProcAddress. (not sure if
this is the best way to go about it)
- removing "/usr/lib/" from all the library names (hey, with multiarch you
can't be too sure anymore)
- added glFinish to glesfuncs.h
- changed the eglGetProcAddress arg type to "const char *" as per the EGL spec
- filled in the stubs for X11_GLES_SetSwapInterval and X11_GLES_GetSwapInterval

Fri, 26 Aug 2011 13:23:40 +0100* Take a global reference to the activity to prevent the reference being GCed
Tim Angus [Fri, 26 Aug 2011 13:23:40 +0100] rev 6189
* Take a global reference to the activity to prevent the reference being GCed

Sun, 08 Jan 2012 02:23:37 -0500Fixed bug 1242 - PATCH: Improve support for OpenGL ES under X11
Sam Lantinga [Sun, 08 Jan 2012 02:23:37 -0500] rev 6188
Fixed bug 1242 - PATCH: Improve support for OpenGL ES under X11

Scott Percival 2011-07-03 06:41:51 PDT

This submission is aimed at making life easier for OpenGL ES capable devices
running a X11 stack (e.g. Maemo, Meego, TrimSlice, other ARM SoC boards not
running Android). SDL's Pandora support already has the neccesary GLES-to-X11
glue code, however it's all ghetto'd off in Makefile.pandora and not very
flexible.

The patch:
- adds an awesome --enable-video-opengles option to configure
- re-modifies the opengles and opengles2 SDL_renderers to use function pointers
- no idea why this was removed?
- for SDL_Renderers, links in libGLESv1_CM, libGLES_CM (for PowerVR fans) or
libGLESv2 at runtime
- links in libEGL.so at runtime - the old code made an assumption that
eglFunctions could be pulled from the active GLES library, PowerVR for one
doesn't let you do that with their libGLESv2
- allows you to pick which of GLES v1 or v2 to load via
SDL_GL_CONTEXT_MAJOR_VERSION

So far I've tested this on a Nokia N900 (OMAP 3430/SGX 530 running Maemo 5) and
a Toshiba AC100 (Tegra 2 running Ubuntu 10.10). I haven't tested it on... well,
everything that isn't those two, such as a Pandora, iOS or Android device. The
Pandora specific code should be kept intact (fingers crossed), and nothing
painfully drastic has been added to the SDL_renderers. The library loading
sequence in SDL_x11opengles has been updated to accomodate both NVIDIA's
propensity to let developers get away with murder and PowerVR's alternative of
punishing every missed step.

The test apps work okay with GLES or GLES2 as the renderer. For some reason
alpha blending doesn't seem to work on the Tegra 2; last week NVIDIA pushed out
a new set of X11 GLES drivers, so I'll try and investigate once I upgrade
those. Also, this patch adds things to configure.in, include/SDL_config.h.in
and test/configure.in. I didn't know what the policy was re. committing
generated spaghetti from autotools, so ./autogen.sh has to be run again. Sorry.

I think that's about everything, let me know if there's anything I've
overlooked.