From d4830f40f0fab7b2f8d36cb0d066b56267f6c7d5 Mon Sep 17 00:00:00 2001 From: rdb Date: Wed, 24 Feb 2021 15:51:14 +0100 Subject: [PATCH 1/4] makepanda: Fix strftime error using SOURCE_DATE_EPOCH on Windows Seems to occur when using Python 2.7 --- makepanda/makepanda.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/makepanda/makepanda.py b/makepanda/makepanda.py index 9c57b37129..14dbcbaa2d 100755 --- a/makepanda/makepanda.py +++ b/makepanda/makepanda.py @@ -3006,7 +3006,12 @@ def CreatePandaVersionFiles(): if source_date: # This matches the GCC / Clang format for __DATE__ __TIME__ source_date = time.gmtime(int(source_date)) - source_date = time.strftime('%b %e %Y %H:%M:%S', source_date) + try: + source_date = time.strftime('%b %e %Y %H:%M:%S', source_date) + except ValueError: + source_date = time.strftime('%b %d %Y %H:%M:%S', source_date) + if source_date[3:5] == ' 0': + source_date = source_date[:3] + ' ' + source_date[5:] pandaversion_h += "\n#define PANDA_BUILD_DATE_STR \"%s\"\n" % (source_date) if not RUNTIME: From 3955c71435a8a336df96037b37ddf9e1830832d9 Mon Sep 17 00:00:00 2001 From: rdb Date: Wed, 24 Feb 2021 16:14:59 +0100 Subject: [PATCH 2/4] makepackage: skip message boxes if running NSIS installer in silent mode Fixes #1088 --- makepanda/installer.nsi | 2 ++ 1 file changed, 2 insertions(+) diff --git a/makepanda/installer.nsi b/makepanda/installer.nsi index 6d8cf561e5..0600d8c449 100644 --- a/makepanda/installer.nsi +++ b/makepanda/installer.nsi @@ -470,6 +470,7 @@ Section "Python ${INCLUDE_PYVER}" SecPython IfFileExists "$0\python.exe" AskRegPath RegPath AskRegPath: + IfSilent SkipRegPath MessageBox MB_YESNO|MB_ICONQUESTION \ "You already have a copy of Python ${INCLUDE_PYVER} installed in:$\r$\n$0$\r$\n$\r$\nPanda3D installs its own copy of Python ${INCLUDE_PYVER}, which will install alongside your existing copy. Would you like to make Panda's copy the default Python for your user account?" \ IDNO SkipRegPath @@ -619,6 +620,7 @@ Function ConfirmPythonSelection ; No compatible Python version found (that wasn't shipped as part ; of a different Panda3D build.) Ask the user if he's sure about this. AskConfirmation: + IfSilent SkipCheck MessageBox MB_YESNO|MB_ICONQUESTION \ "You do not appear to have a ${REGVIEW}-bit version of Python ${INCLUDE_PYVER} installed. Are you sure you don't want Panda to install a compatible copy of Python?$\r$\n$\r$\nIf you choose Yes, you will not be able to do Python development with Panda3D until you install a ${REGVIEW}-bit version of Python and install the bindings for this version." \ IDYES SkipCheck From 2d9cc2dea0ba543958037454712669acc0afa433 Mon Sep 17 00:00:00 2001 From: rdb Date: Wed, 24 Feb 2021 17:30:48 +0100 Subject: [PATCH 3/4] egl: Further robustify EGL device initialization process Sometimes, the default device fails to initialize, so then we need to fall back to alternatives (eg. GBM) --- panda/src/egldisplay/eglGraphicsPipe.cxx | 40 +++++++++++++++++------- 1 file changed, 29 insertions(+), 11 deletions(-) diff --git a/panda/src/egldisplay/eglGraphicsPipe.cxx b/panda/src/egldisplay/eglGraphicsPipe.cxx index e3df7e8a97..6ce38433cb 100644 --- a/panda/src/egldisplay/eglGraphicsPipe.cxx +++ b/panda/src/egldisplay/eglGraphicsPipe.cxx @@ -49,6 +49,8 @@ eglGraphicsPipe() { << "EGL client extensions not supported.\n"; } + EGLint major, minor; + //NB. if the X11 display failed to open, _display will be 0, which is a valid // input to eglGetDisplay - it means to open the default display. #ifdef HAVE_X11 @@ -56,6 +58,12 @@ eglGraphicsPipe() { #else _egl_display = eglGetDisplay(EGL_DEFAULT_DISPLAY); #endif + if (_egl_display && !eglInitialize(_egl_display, &major, &minor)) { + egldisplay_cat.warning() + << "Couldn't initialize the default EGL display: " + << get_egl_error_string(eglGetError()) << "\n"; + _egl_display = EGL_NO_DISPLAY; + } if (!_egl_display && std::find(extensions.begin(), extensions.end(), "EGL_EXT_platform_device") != extensions.end() && @@ -65,7 +73,9 @@ eglGraphicsPipe() { (PFNEGLQUERYDEVICESEXTPROC)eglGetProcAddress("eglQueryDevicesEXT"); EGLint num_devices = 0; - if (eglQueryDevicesEXT(0, nullptr, &num_devices) && num_devices > 0) { + if (eglQueryDevicesEXT != nullptr && + eglQueryDevicesEXT(0, nullptr, &num_devices) && + num_devices > 0) { EGLDeviceEXT *devices = (EGLDeviceEXT *)alloca(sizeof(EGLDeviceEXT) * num_devices); eglQueryDevicesEXT(num_devices, devices, &num_devices); @@ -77,25 +87,33 @@ eglGraphicsPipe() { PFNEGLGETPLATFORMDISPLAYEXTPROC eglGetPlatformDisplayEXT = (PFNEGLGETPLATFORMDISPLAYEXTPROC)eglGetProcAddress("eglGetPlatformDisplayEXT"); - for (EGLint i = 0; i < num_devices && !_egl_display; ++i) { - _egl_display = eglGetPlatformDisplayEXT(EGL_PLATFORM_DEVICE_EXT, devices[i], nullptr); - } - } + if (eglGetPlatformDisplayEXT != nullptr) { + for (EGLint i = 0; i < num_devices && !_egl_display; ++i) { + _egl_display = eglGetPlatformDisplayEXT(EGL_PLATFORM_DEVICE_EXT, devices[i], nullptr); - if (!_egl_display) { - egldisplay_cat.error() - << "Couldn't find a suitable EGL platform device.\n"; + if (_egl_display && !eglInitialize(_egl_display, &major, &minor)) { + egldisplay_cat.warning() + << "Couldn't initialize EGL platform display " << i << ": " + << get_egl_error_string(eglGetError()) << "\n"; + _egl_display = EGL_NO_DISPLAY; + } + } + } } } - if (!eglInitialize(_egl_display, nullptr, nullptr)) { + if (!_egl_display) { egldisplay_cat.error() - << "Couldn't initialize the EGL display: " - << get_egl_error_string(eglGetError()) << "\n"; + << "Failed to find or initialize a suitable EGL display connection.\n"; _is_valid = false; return; } + if (egldisplay_cat.is_debug()) { + egldisplay_cat.debug() + << "Successfully initialized EGL display, got version " << major << "." << minor << "\n"; + } + #if defined(OPENGLES_1) || defined(OPENGLES_2) if (!eglBindAPI(EGL_OPENGL_ES_API)) { egldisplay_cat.error() From 57f7d0423109f315e69f38625625339c5d5cd5bf Mon Sep 17 00:00:00 2001 From: rdb Date: Wed, 24 Feb 2021 17:32:30 +0100 Subject: [PATCH 4/4] makepanda: Don't set HAVE_GLX in dtool_config.h It's only used for disambiguation in pandagl.cxx, we don't need to expose this, and it should be possible to build pandagl.cxx without GLX --- makepanda/makepanda.py | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/makepanda/makepanda.py b/makepanda/makepanda.py index 14dbcbaa2d..1b243ea73e 100755 --- a/makepanda/makepanda.py +++ b/makepanda/makepanda.py @@ -2521,7 +2521,6 @@ DTOOL_CONFIG=[ ("REPORT_OPENSSL_ERRORS", '1', '1'), ("USE_PANDAFILESTREAM", '1', '1'), ("USE_DELETED_CHAIN", '1', '1'), - ("HAVE_GLX", 'UNDEF', '1'), ("HAVE_WGL", '1', 'UNDEF'), ("HAVE_DX9", 'UNDEF', 'UNDEF'), ("HAVE_THREADS", '1', '1'), @@ -2689,15 +2688,11 @@ def WriteConfigSettings(): dtool_config["PHAVE_SYS_MALLOC_H"] = '1' dtool_config["HAVE_OPENAL_FRAMEWORK"] = '1' dtool_config["HAVE_X11"] = 'UNDEF' # We might have X11, but we don't need it. - dtool_config["HAVE_GLX"] = 'UNDEF' dtool_config["IS_LINUX"] = 'UNDEF' dtool_config["HAVE_VIDEO4LINUX"] = 'UNDEF' dtool_config["PHAVE_LINUX_INPUT_H"] = 'UNDEF' dtool_config["IS_OSX"] = '1' - if PkgSkip("X11"): - dtool_config["HAVE_GLX"] = 'UNDEF' - if (GetTarget() == "freebsd"): dtool_config["IS_LINUX"] = 'UNDEF' dtool_config["HAVE_VIDEO4LINUX"] = 'UNDEF' @@ -5084,9 +5079,10 @@ if (GetTarget() not in ['windows', 'darwin'] and PkgSkip("X11")==0 and not RUNTI # if (GetTarget() not in ['windows', 'darwin'] and PkgSkip("GL")==0 and PkgSkip("X11")==0 and not RUNTIME): - OPTS=['DIR:panda/src/glxdisplay', 'BUILDING:PANDAGL', 'GL', 'NVIDIACG', 'CGGL'] + DefSymbol('GLX', 'HAVE_GLX', '') + OPTS=['DIR:panda/src/glxdisplay', 'BUILDING:PANDAGL', 'GL', 'NVIDIACG', 'CGGL', 'GLX'] TargetAdd('p3glxdisplay_composite1.obj', opts=OPTS, input='p3glxdisplay_composite1.cxx') - OPTS=['DIR:panda/metalibs/pandagl', 'BUILDING:PANDAGL', 'GL', 'NVIDIACG', 'CGGL'] + OPTS=['DIR:panda/metalibs/pandagl', 'BUILDING:PANDAGL', 'GL', 'NVIDIACG', 'CGGL', 'GLX'] TargetAdd('pandagl_pandagl.obj', opts=OPTS, input='pandagl.cxx') TargetAdd('libpandagl.dll', input='p3x11display_composite1.obj') TargetAdd('libpandagl.dll', input='pandagl_pandagl.obj')