Commit graph

1837 commits

Author SHA1 Message Date
Sam Lantinga
a0978cdf4d indent
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403537
2009-02-17 05:57:54 +00:00
Sam Lantinga
605f1db186 Date: Thu, 27 Dec 2007 07:38:25 +0000
From: John Bartholomew
Subject: [SDL] SDL Semaphore implementation broken on Windows?
Hi,

Over the past couple of days, I've been battling with SDL, SDL_Mixer and SMPEG to try to find an audio hang bug.  I believe I've found the problem, which I think is a race condition inside SDL's semaphore implementation (at least the Windows implementation).  The semaphore code uses Windows' built in semaphore functions, but it also maintains a separate count value.  This count value is updated with bare increment and decrement operations in SemPost and SemWaitTimeout - no locking primitives to protect them.

In tracking down the apparent audio bug, I found that at some point a semaphore's count value was being decremented to -1, which is clearly not a valid value for it to take.

I'm still not certain exactly what sequence of operations is occuring for this to happen, but I believe that overall it's a race condition between a thread calling SemPost (which increments the count) and the thread on the other end calling SemWait (which decrements it).

I will try to make a test case to verify this, but I'm not sure if I'll be able to   (threading errors being difficult to reproduce even in the best    circumstances).

However, assuming this is the cause of my problems, there is a very
simple fix:
Windows provides InterlockedIncrement() and InterlockedDecrement()
functions to perform increments and decrements which are guaranteed to be atomic.  So the fix is in thread/win32/SDL_syssem.c: replace occurrences of --sem->count with InterlockedDecrement(&sem->count); and replace occurrences of ++sem->count with InterlockedIncrement(&sem->count);

This is using SDL v1.2.12, built with VC++ 2008 Express, running on a
Core 2 duo processor.

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403535
2009-02-17 05:39:18 +00:00
Sam Lantinga
d9d69026ef Fixed bug #633
Description From  Michael Stone   2008-09-25 19:27:29   (-) [reply]

To determine whether a pid is occupied with the kill(pid, 0) idiom, you have to
test

#include <signal.h>
#include <errno.h>
kill(pid, 0) < 0 && errno == ESRCH

not just

#include <signal.h>
kill(pid, 0) < 0

otherwise you get incorrect results when pid is running as a different user
(causing kill(pid, 0) to return -1 + EPERM).

src/audio/alsa/SDL_alsa_audio.c is certainly affected by this bug in both
1.2.13 and 1.3-trunk. It probably occurs in other places as well.

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403533
2009-02-17 05:17:51 +00:00
Sam Lantinga
b9924167f7 Fixed destination of XCopyArea()
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403530
2009-02-15 06:12:52 +00:00
Sam Lantinga
31ee34541c Fixed off by one error in line drawing code
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403527
2009-02-12 06:01:54 +00:00
Sam Lantinga
be79fbf0ec Throw a FIXME in there, we'll need to take care of this later.
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403522
2009-02-09 06:15:06 +00:00
Sam Lantinga
2aab251e38 Added test program for SDL_CreateWindowFrom()
Make sure OpenGL library is loaded before working with OpenGL windows,
even those created with SDL_CreateWindowFrom()

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403521
2009-02-09 05:32:12 +00:00
Sam Lantinga
0f598a332f Oh, Polyline() uses a pen, not a brush. Doh! :)
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403520
2009-02-08 15:35:06 +00:00
Sam Lantinga
a9ca68d613 indent
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403519
2009-02-07 18:03:46 +00:00
Sam Lantinga
62dd3e61df Fixed alpha blending textures with the GDI renderer
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403518
2009-02-07 17:56:08 +00:00
Sam Lantinga
d67835c3de When creating a software texture, synchronize the surface with the texture.
When creating a texture from a surface, synchronize the texture with the surface.

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403517
2009-01-30 06:40:16 +00:00
Sam Lantinga
d0b1ee8e2f indent
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403516
2009-01-30 06:38:44 +00:00
Sam Lantinga
feb6aa80f8 Fixed Altivec blitters for PPC
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403513
2009-01-25 05:14:29 +00:00
Sam Lantinga
182eefe860 Fixed compilation on Mac OS X 10.3.9
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403511
2009-01-19 15:15:03 +00:00
Sam Lantinga
62ab848372 Fix recommended by Eddy L O Jansson
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403509
2009-01-19 03:28:23 +00:00
Edgar Simo
cf3db86918 Some more safety around the SDL_HelperWindow stuff to avoid double creations.
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403508
2009-01-18 17:00:02 +00:00
Bob Pendleton
ffe056fff1 Changes to hopefully handle the creation of a colormap for 8 bit PseudoColor visuals in X11
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403506
2009-01-15 21:35:42 +00:00
Sam Lantinga
a2c7f4e1b4 Fixed OpenGL state issue reported by Dmytro Bogovych
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403503
2009-01-14 06:53:03 +00:00
Sam Lantinga
628262d3af indent
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403502
2009-01-14 04:25:32 +00:00
Couriersud
072760ebb7 Fix fullscreen crash with DirectFB <= 1.2.0
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403501
2009-01-13 23:27:08 +00:00
Couriersud
c11962b08c Fixed MakeSubSurface compiling issue for DirectFB <= 1.2.0
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403500
2009-01-13 22:59:02 +00:00
Couriersud
eeeee88591 Added DFB_VERSION_ATLEAST macro
First attempt at replacing MakeSubSurface for pre 1.2.0 ==> Scaling not yet working

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403499
2009-01-13 21:17:38 +00:00
Bob Pendleton
4907b7e608 Added
#ifndef SDL_VIDEO_DRIVER_X11_DYNAMIC_XSS
#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XSS NULL
#endif

so that the X code would compile. It looked like it was needed

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403498
2009-01-13 19:31:06 +00:00
Sam Lantinga
bb8513855f Removed Rafal Bursig's MMX RLE code, at his request.
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403497
2009-01-13 07:20:55 +00:00
Sam Lantinga
97baa9c439 Fixed NULL pointer dereference
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403496
2009-01-13 03:53:22 +00:00
Sam Lantinga
e43f6d619e Fixed Visual C++ build
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403494
2009-01-12 08:46:28 +00:00
Sam Lantinga
9116448bf3 Don't complain when the GNOME screensaver isn't running (or available)
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403493
2009-01-12 08:28:17 +00:00
Sam Lantinga
538276cc18 This is so wrong, it hurts.
Instead of the GNOME screensaver respecting the MIT-SCREEN-SAVER extension
and registering for the screensaver idle event, it uses a completely different
control mechanism.  Our alternatives are to use dbus (very complicated) or
this really painful hack.

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403492
2009-01-12 08:26:24 +00:00
Sam Lantinga
a097a4105f Re-enable the screensaver at exit, just in case it's needed...
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403491
2009-01-12 08:23:47 +00:00
Sam Lantinga
92091bf9b8 Don't disable the screen saver by default for windows applications
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403490
2009-01-12 08:23:12 +00:00
Sam Lantinga
439443508b Reverted SDL_LoadICO_RW() addition, this should go in SDL_image
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403488
2009-01-12 06:21:34 +00:00
Sam Lantinga
4ca3bd3da1 Added an API to enable/disable the screen saver.
The screensaver is disabled by default when using SDL 1.2 compatibility.
Use the new XScreenSaver extension, removed unused DPMS extension.

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403487
2009-01-12 06:19:05 +00:00
Couriersud
4bb83c1f39 Add SDL_LoadICO_RW to SDL. Loads best quality icon from *.ico file.
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403486
2009-01-11 23:56:19 +00:00
Couriersud
2cd9219893 DirectFB cleanups & simple window manager
- use SDL_getenv, not getenv ...
- no more support for 0.9.25 - not even mentioned any longer on directfb.org
- fix fullscreen issues
- add a simple window manager unless the directfb team comes up with a working wm.

The driver has support for a very, very basic window manager you may
want to use when runnning with "wm=default". Use

export SDL_DIRECTFB_WM=1

to enable basic window borders including icon support. In order to have the window title rendered,
you need to have the following font installed:

/usr/share/fonts/truetype/freefont/FreeSans.ttf

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403485
2009-01-11 23:49:23 +00:00
Couriersud
3e968cec07 Fix a 64bit issue in linux/SDL_sysjoystick (int != long on 64bit)
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403484
2009-01-11 23:39:11 +00:00
Ryan C. Gordon
fea75bcab7 First shot at new audio resampling code.
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403483
2009-01-11 04:46:42 +00:00
Ryan C. Gordon
8ca737d47a NULL-terminate the lists of autogenerated converters.
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403482
2009-01-11 04:46:14 +00:00
Ryan C. Gordon
ed652245d1 Allow builds that reduce or eliminate the converters/resamplers.
We should probably give options to drop resamplers by channels, too, for
 developers that know they'll never need more than stereo, etc.

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403481
2009-01-11 04:39:09 +00:00
Sam Lantinga
6350aaf230 Removed extra debug output
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403477
2009-01-10 23:57:12 +00:00
Sam Lantinga
d123950aa3 Reverted Bob's indent checkin
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403475
2009-01-10 21:50:26 +00:00
Sam Lantinga
e32916c7f0 Fixed Visual C++ release build for Visual C++ 2005
* Some math functions become intrinsic in release mode, so we need to
  convert all the math functions into SDL math functions, like we did
  with the stdlib functions.
* Constant initializers of 8-bit values become calls to memset() in
  release mode, but memset() itself is an intrinsic when explicitly
  called.  So we'll just explicitly call memset() in those cases.

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403474
2009-01-10 18:32:24 +00:00
Bob Pendleton
44fa7675c8 I ran a global "make indent" it modified the following files.
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403473
2009-01-09 20:43:30 +00:00
Bob Pendleton
d088f9a9ca Modified and totally untested code to load the color tables for DirectColor and PseudoColor windows.
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403472
2009-01-09 20:41:31 +00:00
Bob Pendleton
3f633e7313 Changed and hopefully fixed support for DirectColor with support for gammaramps.
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403471
2009-01-09 20:39:33 +00:00
Ryan C. Gordon
742f9c70bf First shot at autogenerated audio resamplers.
Don't check in a new SDL_audiotypecvt.c yet, though.

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403470
2009-01-09 15:41:45 +00:00
Sam Lantinga
3171d3d0a7 Fixed lines intersecting the top corners of a rectangle
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403466
2009-01-05 07:07:48 +00:00
Sam Lantinga
d1033aea54 Fixed mouse events with --disable-video-x11-xinput
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403465
2009-01-05 07:04:54 +00:00
Sam Lantinga
b1aa228b9c define this value if it's not in the system headers
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403464
2009-01-05 06:35:16 +00:00
Sam Lantinga
3209bc5b6d Fixed bug #669
Generate a full set of SDLKey mappings when setting up the keyboard layout

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403463
2009-01-05 06:28:50 +00:00
Sam Lantinga
fe0aae4a6f Whoops, missing files from Couriersud's update
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403462
2009-01-05 01:48:15 +00:00