Skip to content

Commit

Permalink
Merge pull request #846 from Psychtoolbox-3/master
Browse files Browse the repository at this point in the history
Psychtoolbox 3.0.19.14 "Sommerloch" update.

### Compatibility changes wrt. Psychtoolbox 3.0.19.13:

- None expected.

### Highlights:

- None.

### All:

- ``Screen('DrawDots')``: Only apply a margin to non-square dot types.
  Only round dots get trimmed in the fragment shader, and so dot_type=4
  was left with too much padding from the vertex shader. Bug fix contributed
  by Alex Forrence @aforren1

- Python extensions built from this release onwards should also work with
  NumPy 2.x in addition to NumPy 1.x. Changes contributed by Eric Larson.

### Linux:

- Psychtoolbox was built and tested against Matlab R2024a.

- Undo ``Screen('OpenMovie')`` compatibility fix for Ubuntu 24.04-LTS, of
  using pipewiresink as audio sink. While this does fix the pulseaudio bugs
  of delayed playback (see Psychtoolbox 3.0.19.12), the pipewiresink plugin
  itself, as shipping in Ubuntu 24.04-LTS / GStreamer 1.24, has its own bugs,
  which are worse and impact more frequent use cases, e.g., seeking, change
  of playback speed, reverse playback, and instabilities or hangs at end of
  playback for some common movies. Iow. use of pipewiresink causes regressions.

  See forum bug report here:

  <https://psychtoolbox.discourse.group/t/10-second-delay-with-with-gst-state-change-async/3924>

  GStreamer folks know about the problem but there ain't a solution yet.

  As of this release, the pipewiresink can still be used as an active opt-in,
  accepting other potential types of audio playback problems, and if opted in,
  should fix the following issue on Ubuntu 24.04-LTS and later, and other
  distributions that use Pipewire as desktop sound server and have an outdated
  buggy Pulseaudio 16 installation, instead of the more recent Pulseaudio 17.

  See the following issue for this bug, which is luckily not encountered often:

  <Psychtoolbox-3#814>

  On unfixed affected systems (mostly Ubuntu 22.04-LTS), if there is
  a notable time delay between ``Screen('OpenMovie')`` and start of
  video+audio playback via ``Screen('PlayMovie')``, then the movie
  playback will freeze after displaying the 1st video frame for the
  duration of that delay between OpenMovie and PlayMovie, then
  continue. Problem didn't exist in earler Linux distributions like
  Ubuntu 20.04-LTS and is fixed by this bug fix for later distros like
  Ubuntu 24.04-LTS from April 2024.

  The use of pipewiresink can be enforced as workaround by specifying the
  following string as 'movieoptions' parameter in ``Screen('Openmovie', ...);``
  'AudioSink=pipewiresink'.

- RaspberryPi now also allows GetSecs clock selection, like the Intel
  variants do since a few releases.

### Windows:

- Psychtoolbox was built and lightly tested against Matlab R2024a and
  Octave 7.3.

- ``GetGitPath()``: Fix path to git on MS-Windows. Bug fix contributed by
  Alex Forrence @aforren1

### macOS:

- Psychtoolbox was built and tested against Matlab R2024a and against
  Octave 9.2 from HomeBrew.

- SetupPsychtoolbox(): Try to fix it properly for macOS with xattr calls.
  Skip xattr calls for .mltbx installed files via Matlab Add-On explorer,
  as those already have their quarantine flags removed.

  For other (zip file) install locations, handle blanks/spaces in the
  installation path.

  Also some output text cleanups and fixes. Tested with .mltbx and zip file
  path install on path with spaces etc. Lets hope this goes better.
  • Loading branch information
kleinerm authored Aug 11, 2024
2 parents 5c919e9 + 0361006 commit 38377d8
Show file tree
Hide file tree
Showing 40 changed files with 232 additions and 83 deletions.
2 changes: 1 addition & 1 deletion PsychPython/psychtoolbox/_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '3.0.19.13'
__version__ = '3.0.19.14'
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
/* Begin PBXFileReference section */
089C1667FE841158C02AAC07 /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = "<group>"; };
32BAE0B70371A74B00C91783 /* HID Utilities_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "HID Utilities_Prefix.pch"; sourceTree = "<group>"; };
83571B171551F7FD00EE961F /* libstatic library.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = "libstatic library.dylib"; sourceTree = BUILT_PRODUCTS_DIR; };
83571B171551F7FD00EE961F /* libHIDUtilities.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libHIDUtilities.dylib; sourceTree = BUILT_PRODUCTS_DIR; };
8D07F2C70486CC7A007CD1D0 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist; path = Info.plist; sourceTree = "<group>"; };
8D07F2C80486CC7A007CD1D0 /* HID Utilities.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = "HID Utilities.framework"; sourceTree = BUILT_PRODUCTS_DIR; };
97876DB31033682400AD1095 /* HID_Utilities_External.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HID_Utilities_External.h; sourceTree = "<group>"; };
Expand Down Expand Up @@ -152,7 +152,7 @@
children = (
8D07F2C80486CC7A007CD1D0 /* HID Utilities.framework */,
97F808C710347C9A00D58924 /* libHID_Utilities.dylib */,
83571B171551F7FD00EE961F /* libstatic library.dylib */,
83571B171551F7FD00EE961F /* libHIDUtilities.dylib */,
);
name = Products;
sourceTree = "<group>";
Expand Down Expand Up @@ -267,7 +267,7 @@
);
name = "static library";
productName = "HID Utilities dylib";
productReference = 83571B171551F7FD00EE961F /* libstatic library.dylib */;
productReference = 83571B171551F7FD00EE961F /* libHIDUtilities.dylib */;
productType = "com.apple.product-type.library.dynamic";
};
8D07F2BC0486CC7A007CD1D0 /* Framework */ = {
Expand Down Expand Up @@ -319,6 +319,7 @@
developmentRegion = English;
hasScannedForEncodings = 1;
knownRegions = (
English,
en,
);
mainGroup = 0867D691FE84028FC02AAC07 /* HID Utilities */;
Expand Down Expand Up @@ -480,7 +481,7 @@
4FADC24708B4156D00ABE55E /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
ARCHS = "$(ARCHS_STANDARD)";
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = dwarf;
DEPLOYMENT_LOCATION = YES;
Expand All @@ -494,6 +495,7 @@
"DEBUG=1",
"_NDEBUG=1",
"NDEBUG=1",
"__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES=1",
);
GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
Expand All @@ -512,8 +514,13 @@
GCC_WARN_UNUSED_PARAMETER = YES;
GCC_WARN_UNUSED_VALUE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
LD_DYLIB_INSTALL_NAME = /usr/local/lib/libHID_Utilities64.a;
MACOSX_DEPLOYMENT_TARGET = 10.5;
INSTALL_PATH = "";
"INSTALL_PATH[sdk=*]" = /usr/local/lib/;
LD_DYLIB_INSTALL_NAME = libHID_Utilities64.a;
MACOSX_DEPLOYMENT_TARGET = 10.13;
NEW_SETTING = "";
NEW_SETTING1 = "";
"NEW_SETTING[arch=*]" = " __ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES";
ONLY_ACTIVE_ARCH = YES;
OTHER_CFLAGS = (
"$(value)",
Expand Down Expand Up @@ -541,7 +548,7 @@
4FADC24808B4156D00ABE55E /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
ARCHS = "$(ARCHS_STANDARD)";
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEPLOYMENT_LOCATION = YES;
Expand All @@ -550,10 +557,17 @@
GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
GCC_OPTIMIZATION_LEVEL = s;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
"GCC_PREPROCESSOR_DEFINITIONS[arch=*]" = " __ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES=1";
GCC_WARN_FOUR_CHARACTER_CONSTANTS = NO;
LD_DYLIB_INSTALL_NAME = /usr/local/lib/libHID_Utilities64.a;
MACOSX_DEPLOYMENT_TARGET = 10.5;
ONLY_ACTIVE_ARCH = NO;
INSTALL_PATH = "";
"INSTALL_PATH[sdk=*]" = /usr/local/lib/;
LD_DYLIB_INSTALL_NAME = libHID_Utilities64.a;
"LD_DYLIB_INSTALL_NAME[sdk=macosx*]" = libHID_Utilities64.a;
MACOSX_DEPLOYMENT_TARGET = 10.13;
NEW_SETTING = "";
NEW_SETTING1 = "";
"NEW_SETTING[arch=*]" = " __ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES";
ONLY_ACTIVE_ARCH = YES;
ZERO_LINK = NO;
};
name = Release;
Expand All @@ -565,6 +579,7 @@
GCC_DYNAMIC_NO_PIC = NO;
INSTALL_PATH = /usr/local/lib;
MACH_O_TYPE = staticlib;
MACOSX_DEPLOYMENT_TARGET = 10.13;
PRODUCT_NAME = HIDUtilities;
};
name = Debug;
Expand All @@ -575,13 +590,15 @@
EXECUTABLE_PREFIX = lib;
INSTALL_PATH = /usr/local/lib;
MACH_O_TYPE = staticlib;
MACOSX_DEPLOYMENT_TARGET = 10.13;
PRODUCT_NAME = HIDUtilities;
};
name = Release;
};
97F808C810347C9C00D58924 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD)";
EXECUTABLE_PREFIX = lib;
GCC_DYNAMIC_NO_PIC = NO;
INSTALL_PATH = /usr/local/lib;
Expand All @@ -592,6 +609,7 @@
97F808C910347C9C00D58924 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD)";
EXECUTABLE_PREFIX = lib;
INSTALL_PATH = /usr/local/lib;
PRODUCT_NAME = HID_Utilities;
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,16 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>BuildLocationStyle</key>
<string>UseAppPreferences</string>
<key>CustomBuildLocationType</key>
<string>RelativeToDerivedData</string>
<key>DerivedDataLocationStyle</key>
<string>Default</string>
<key>HasAskedToTakeAutomaticSnapshotBeforeSignificantChanges</key>
<true/>
<key>ShowSharedSchemesAutomaticallyEnabled</key>
<true/>
<key>SnapshotAutomaticallyBeforeSignificantChanges</key>
<true/>
</dict>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,38 +14,37 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "83571B041551F7FD00EE961F"
BuildableName = "libHID_Utilities.dylib"
BuildableName = "libHIDUtilities.dylib"
BlueprintName = "static library"
ReferencedContainer = "container:HID Utilities.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
buildConfiguration = "Debug">
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
buildConfiguration = "Debug"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
buildConfiguration = "Release"
debugDocumentVersioning = "YES">
</ProfileAction>
<AnalyzeAction
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -686,8 +686,8 @@ void mxSetField(PyObject* pStructOuter, int index, const char* fieldName, PyObje
{
if (psych_refcount_debug && pStructInner)
printf("PTB-DEBUG: In mxSetField: refcount of external object %p at enter is %li. %s\n",
pStructInner, PyArray_REFCOUNT(pStructInner),
(PyArray_REFCOUNT(pStructInner) > 1) ? "MIGHT leak if caller does not take care." : "");
pStructInner, Py_REFCNT(pStructInner),
(Py_REFCNT(pStructInner) > 1) ? "MIGHT leak if caller does not take care." : "");

if (!mxIsStruct(pStructOuter)) {
Py_XDECREF(pStructInner);
Expand Down Expand Up @@ -1123,9 +1123,9 @@ PyObject* PsychScriptingGluePythonDispatch(PyObject* self, PyObject* args)
// and just need to return return arguments and clean up:
if (psych_refcount_debug) {
for (i = 0; i < MAX_OUTPUT_ARGS; i++) {
if (plhsGLUE[recLevel][i] && (PyArray_REFCOUNT(plhsGLUE[recLevel][i]) >= psych_refcount_debug))
if (plhsGLUE[recLevel][i] && (Py_REFCNT(plhsGLUE[recLevel][i]) >= psych_refcount_debug))
printf("PTB-DEBUG: At non-error exit of PsychScriptingGluePythonDispatch: Refcount of plhsGLUE[recLevel %i][arg %i] = %li.\n",
recLevel, i, PyArray_REFCOUNT(plhsGLUE[recLevel][i]));
recLevel, i, Py_REFCNT(plhsGLUE[recLevel][i]));
}
}

Expand Down Expand Up @@ -1202,9 +1202,9 @@ PyObject* PsychScriptingGluePythonDispatch(PyObject* self, PyObject* args)
// Release "orphaned" output arguments that haven't been returned to the interpreter,
// e.g., because of a PythonFunctionCleanup - error return:
for (i = 0; i < MAX_OUTPUT_ARGS; i++) {
if (psych_refcount_debug && plhsGLUE[recLevel][i] && (PyArray_REFCOUNT(plhsGLUE[recLevel][i]) >= psych_refcount_debug))
if (psych_refcount_debug && plhsGLUE[recLevel][i] && (Py_REFCNT(plhsGLUE[recLevel][i]) >= psych_refcount_debug))
printf("PTB-DEBUG: Orphaned output argument at cleanup: Refcount of plhsGLUE[recLevel %i][arg %i] = %li --> unref --> %li.\n",
recLevel, i, PyArray_REFCOUNT(plhsGLUE[recLevel][i]), PyArray_REFCOUNT(plhsGLUE[recLevel][i]) - 1);
recLevel, i, Py_REFCNT(plhsGLUE[recLevel][i]), Py_REFCNT(plhsGLUE[recLevel][i]) - 1);

Py_XDECREF(plhsGLUE[recLevel][i]);
plhsGLUE[recLevel][i] = NULL;
Expand Down Expand Up @@ -1254,9 +1254,9 @@ static PyObject* PsychPyArgGet(int position)
{
PyObject *ret = prhsGLUE[recLevel][position];

if (psych_refcount_debug && (PyArray_REFCOUNT(prhsGLUE[recLevel][position]) >= psych_refcount_debug))
if (psych_refcount_debug && (Py_REFCNT(prhsGLUE[recLevel][position]) >= psych_refcount_debug))
printf("PTB-DEBUG:%s:PsychPyArgGet: Before convert: Refcount of prhsGLUE[recLevel %i][arg %i] = %li.\n",
PsychGetFunctionName(), recLevel, position, PyArray_REFCOUNT(prhsGLUE[recLevel][position]));
PsychGetFunctionName(), recLevel, position, Py_REFCNT(prhsGLUE[recLevel][position]));

// Does this input argument need conversion to a NumPy array of suitable format?
if (prhsNeedsConversion[recLevel][position]) {
Expand All @@ -1279,7 +1279,7 @@ static PyObject* PsychPyArgGet(int position)
if (DEBUG_PTBPYTHONGLUE || psych_refcount_debug)
printf("PTB-DEBUG:%s:PsychPyArgGet: Arg %i: Conversion to NumPy array of %s triggered [refcount now %li]: %s\n",
PsychGetFunctionName(),
position, use_C_memory_layout[recLevel] ? "C layout" : "Fortran layout", PyArray_REFCOUNT(ret),
position, use_C_memory_layout[recLevel] ? "C layout" : "Fortran layout", Py_REFCNT(ret),
(ret == prhsGLUE[recLevel][position]) ? "No-Op passthrough." : "New object.");

// Now that the new ret is a NumPy array in the wanted final format,
Expand All @@ -1296,9 +1296,9 @@ static PyObject* PsychPyArgGet(int position)
// by dropping its refcount by one to zero.
}

if (psych_refcount_debug && (PyArray_REFCOUNT(prhsGLUE[recLevel][position]) >= psych_refcount_debug))
if (psych_refcount_debug && (Py_REFCNT(prhsGLUE[recLevel][position]) >= psych_refcount_debug))
printf("PTB-DEBUG:%s:PsychPyArgGet: After convert: Refcount of prhsGLUE[recLevel %i][arg %i] = %li.\n",
PsychGetFunctionName(), recLevel, position, PyArray_REFCOUNT(prhsGLUE[recLevel][position]));
PsychGetFunctionName(), recLevel, position, Py_REFCNT(prhsGLUE[recLevel][position]));

return(ret);
}
Expand Down Expand Up @@ -2980,8 +2980,8 @@ int PsychRuntimePutVariable(const char* workspace, const char* variable, PsychGe

if (psych_refcount_debug && pcontent)
printf("PTB-DEBUG: In mxSetField: refcount of external object %p at enter is %li. %s\n",
pcontent, PyArray_REFCOUNT(pcontent),
(PyArray_REFCOUNT(pcontent) > 1) ? "MIGHT leak if caller does not take care." : "");
pcontent, Py_REFCNT(pcontent),
(Py_REFCNT(pcontent) > 1) ? "MIGHT leak if caller does not take care." : "");

// Drop one reference, so the function steals a reference to pcontent and the
// calling client is no longer responsible for managing it, regardless of success
Expand Down
Loading

0 comments on commit 38377d8

Please sign in to comment.