diff options
author | Alexey Dokuchaev <danfe@FreeBSD.org> | 2015-11-21 09:27:04 +0000 |
---|---|---|
committer | Alexey Dokuchaev <danfe@FreeBSD.org> | 2015-11-21 09:27:04 +0000 |
commit | 3277928ffed4b20f0678c066b2b9878af0b80182 (patch) | |
tree | d6b589b040f0a75413dbf5d37e330f1e2e43bf43 /graphics/appleseed | |
parent | 39650cb2abb8a2bd86b590affcb8ad99873dea87 (diff) | |
download | ports-3277928ffed4b20f0678c066b2b9878af0b80182.tar.gz ports-3277928ffed4b20f0678c066b2b9878af0b80182.zip |
- Update to version 1.3.0-beta, which integrates most of our patches for
native FreeBSD support
- Provide the real ONLY_FOR_ARCHS_REASON
- Rename DISNEY_MATERIAL to simply DISNEY (previous name was too long)
Notes
Notes:
svn path=/head/; revision=402145
Diffstat (limited to 'graphics/appleseed')
20 files changed, 107 insertions, 821 deletions
diff --git a/graphics/appleseed/Makefile b/graphics/appleseed/Makefile index 6b5f5d9d5e4d..22425fb84cc0 100644 --- a/graphics/appleseed/Makefile +++ b/graphics/appleseed/Makefile @@ -2,8 +2,7 @@ # $FreeBSD$ PORTNAME= appleseed -DISTVERSION= 1.2.0-beta -PORTREVISION= 2 +DISTVERSION= 1.3.0-beta CATEGORIES= graphics MAINTAINER= danfe@FreeBSD.org @@ -20,7 +19,7 @@ USE_GITHUB= yes GH_ACCOUNT= ${PORTNAME}hq ONLY_FOR_ARCHS= i386 amd64 -ONLY_FOR_ARCHS_REASON= uses SSE instructions +ONLY_FOR_ARCHS_REASON= not ported to it yet USES= cmake:outsource USE_QT4= moc_build qmake_build rcc_build uic_build opengl @@ -41,29 +40,21 @@ PLIST_SUB= APPHOME=${CMAKE_INSTALL_PREFIX} SUB_FILES= pkg-message SUB_LIST:= ${PLIST_SUB} -OPTIONS_DEFINE= OSL DISNEY_MATERIAL -OPTIONS_DEFAULT= OSL DISNEY_MATERIAL +OPTIONS_DEFINE= OSL DISNEY +OPTIONS_DEFAULT= OSL DISNEY OPTIONS_SUB= yes OSL_DESC= Open Shading Language support -DISNEY_MATERIAL_DESC= Disney material support +DISNEY_DESC= Disney material support OSL_CMAKE_ON= -DWITH_OSL:BOOL=ON OSL_LIB_DEPENDS= liboslexec.so:${PORTSDIR}/graphics/openshadinglanguage -DISNEY_MATERIAL_CMAKE_ON= -DWITH_DISNEY_MATERIAL:BOOL=ON -DISNEY_MATERIAL_LIB_DEPENDS= libOpenImageIO.so:${PORTSDIR}/graphics/openimageio \ - libSeExprEditor.so:${PORTSDIR}/graphics/seexpr +DISNEY_CMAKE_ON= -DWITH_DISNEY_MATERIAL:BOOL=ON +DISNEY_LIB_DEPENDS= libOpenImageIO.so:${PORTSDIR}/graphics/openimageio \ + libSeExprEditor.so:${PORTSDIR}/graphics/seexpr post-patch: - @${REINPLACE_CMD} -e 's,Linux,${OPSYS},' \ - ${WRKSRC}/src/appleseed.cli/CMakeLists.txt \ - ${WRKSRC}/src/appleseed.studio/CMakeLists.txt \ - ${WRKSRC}/src/tools/animatecamera/CMakeLists.txt \ - ${WRKSRC}/src/tools/convertmeshfile/CMakeLists.txt \ - ${WRKSRC}/src/tools/dumpmetadata/CMakeLists.txt \ - ${WRKSRC}/src/tools/makefluffy/CMakeLists.txt \ - ${WRKSRC}/src/tools/updateprojectfile/CMakeLists.txt @${RMDIR} ${WRKSRC}/sandbox/docs/api .include <bsd.port.mk> diff --git a/graphics/appleseed/distinfo b/graphics/appleseed/distinfo index d694f3906406..4dbcfa221d62 100644 --- a/graphics/appleseed/distinfo +++ b/graphics/appleseed/distinfo @@ -1,2 +1,2 @@ -SHA256 (appleseedhq-appleseed-1.2.0-beta_GH0.tar.gz) = ec14a0846f2d357a39c6b4be163f85931e8effa56a1f0518b46e3203a4ae06d3 -SIZE (appleseedhq-appleseed-1.2.0-beta_GH0.tar.gz) = 107789060 +SHA256 (appleseedhq-appleseed-1.3.0-beta_GH0.tar.gz) = 454fd3cbc72e5ea35988871415a70d04c37b987b86288a36413b007ea8fcf37d +SIZE (appleseedhq-appleseed-1.3.0-beta_GH0.tar.gz) = 115256964 diff --git a/graphics/appleseed/files/patch-CMakeLists.txt b/graphics/appleseed/files/patch-CMakeLists.txt index 1dca4edca2bf..101038f4ac35 100644 --- a/graphics/appleseed/files/patch-CMakeLists.txt +++ b/graphics/appleseed/files/patch-CMakeLists.txt @@ -1,25 +1,17 @@ ---- CMakeLists.txt.orig 2015-06-13 09:38:53 UTC +--- CMakeLists.txt.orig 2015-11-03 13:40:41 UTC +++ CMakeLists.txt -@@ -84,6 +84,9 @@ option (USE_EXTERNAL_ZLIB "Use ext - option (WITH_CLI "Build appleseed.cli" ON) - option (WITH_STUDIO "Build appleseed.studio" ON) - option (WITH_TOOLS "Build appleseed tools" ON) -+option (WITH_DOXYGEN "Generate API Reference with Doxygen" ON) -+option (WITH_TESTS "Install unit tests and benchmarks" ON) -+option (WITH_HEADERS "Install header files" ON) - option (WITH_PYTHON "Build Python bindings" ON) - option (WITH_ALEMBIC "Build Alembic support" OFF) - option (WITH_OSL "Build OSL support" OFF) -@@ -115,7 +118,7 @@ if (CMAKE_SYSTEM_NAME STREQUAL "Windows" - include (src/cmake/config/win-vs.txt) - elseif (CMAKE_SYSTEM_NAME STREQUAL "Darwin") - include (src/cmake/config/mac-clang.txt) --elseif (CMAKE_SYSTEM_NAME STREQUAL "Linux") -+elseif (CMAKE_SYSTEM_NAME MATCHES "Linux|FreeBSD") - include (src/cmake/config/linux-gcc.txt) - else () - message (FATAL_ERROR "Unsupported platform or compiler (CMAKE_SYSTEM_NAME is \"${CMAKE_SYSTEM_NAME}\"). " -@@ -147,6 +150,9 @@ if (WITH_OSL) +@@ -107,6 +107,10 @@ option (USE_EXTERNAL_ZLIB + option (WITH_CLI "Build appleseed.cli" ON) + option (WITH_STUDIO "Build appleseed.studio" ON) + option (WITH_TOOLS "Build appleseed tools" ON) ++option (WITH_DOXYGEN "Generate API Reference with Doxygen" ON) ++option (WITH_SAMPLES "Intall sample files (require headers)" ON) ++option (WITH_HEADERS "Intall header files (to build samples)" ON) ++option (WITH_TESTS "Install unit tests and benchmarks" ON) + option (WITH_PYTHON "Build Python bindings" ON) + option (WITH_ALEMBIC "Build Alembic support" OFF) + option (WITH_OSL "Build OSL support" OFF) +@@ -178,6 +182,9 @@ if (WITH_OSL) ${PROJECT_SOURCE_DIR}/src/appleseed/renderer/kernel/shading/stdosl.h) endif () @@ -29,7 +21,7 @@ #-------------------------------------------------------------------------------------------------- # Boost libraries. -@@ -244,7 +250,6 @@ endif () +@@ -284,7 +291,6 @@ endif () # Common include paths. include_directories ( src/appleseed @@ -37,7 +29,7 @@ ${PYTHON_INCLUDE_DIRS} ) -@@ -546,7 +551,7 @@ endif () +@@ -595,7 +601,7 @@ endif () find_package (Doxygen) @@ -46,13 +38,21 @@ configure_file (${PROJECT_SOURCE_DIR}/scripts/appleseed.doxyfile.in ${PROJECT_BINARY_DIR}/appleseed.doxyfile @ONLY) add_custom_target ( doc ${DOXYGEN_EXECUTABLE} ${PROJECT_BINARY_DIR}/appleseed.doxyfile -@@ -596,22 +601,25 @@ install ( +@@ -644,23 +650,33 @@ endif () + install ( DIRECTORY sandbox/docs ++ DESTINATION . ++) ++ ++if (WITH_SAMPLES) ++install ( ++ DIRECTORY sandbox/samples - sandbox/share DESTINATION . ) ++endif () install ( - CODE "FILE (MAKE_DIRECTORY ${CMAKE_INSTALL_PREFIX}/images)" @@ -75,7 +75,7 @@ install ( DIRECTORY src/appleseed/foundation DESTINATION include -@@ -629,3 +637,4 @@ install ( +@@ -678,3 +694,4 @@ install ( DESTINATION include FILES_MATCHING PATTERN "*.h" ) diff --git a/graphics/appleseed/files/patch-sandbox_stylesheets_default.qss b/graphics/appleseed/files/patch-sandbox_stylesheets_default.qss deleted file mode 100644 index 064a19ecf99b..000000000000 --- a/graphics/appleseed/files/patch-sandbox_stylesheets_default.qss +++ /dev/null @@ -1,12 +0,0 @@ ---- sandbox/stylesheets/default.qss.orig 2015-06-13 09:38:53 UTC -+++ sandbox/stylesheets/default.qss -@@ -58,6 +58,9 @@ - #ifdef __linux__ - #define FIXED_WIDTH_FONT_FAMILY "Courier New" - #endif -+#ifdef __FreeBSD__ -+ #define FIXED_WIDTH_FONT_FAMILY "Courier New" -+#endif - - - /* diff --git a/graphics/appleseed/files/patch-src_appleseed.cli_continuoussavingtilecallback.cpp b/graphics/appleseed/files/patch-src_appleseed.cli_continuoussavingtilecallback.cpp deleted file mode 100644 index 95c7b600737f..000000000000 --- a/graphics/appleseed/files/patch-src_appleseed.cli_continuoussavingtilecallback.cpp +++ /dev/null @@ -1,20 +0,0 @@ ---- src/appleseed.cli/continuoussavingtilecallback.cpp.orig 2015-06-13 09:38:53 UTC -+++ src/appleseed.cli/continuoussavingtilecallback.cpp -@@ -85,7 +85,7 @@ namespace - } - - private: -- mutex m_mutex; -+ boost::mutex m_mutex; - filesystem::path m_output_path; - filesystem::path m_tmp_output_path; - bool m_write_tiled_image; -@@ -95,7 +95,7 @@ namespace - const size_t tile_x, - const size_t tile_y) APPLESEED_OVERRIDE - { -- mutex::scoped_lock lock(m_mutex); -+ boost::mutex::scoped_lock lock(m_mutex); - ProgressTileCallback::do_post_render_tile(frame, tile_x, tile_y); - frame->write_main_image(m_tmp_output_path.string().c_str()); - filesystem::rename(m_tmp_output_path, m_output_path); diff --git a/graphics/appleseed/files/patch-src_appleseed.shared_application_superlogger.cpp b/graphics/appleseed/files/patch-src_appleseed.shared_application_superlogger.cpp deleted file mode 100644 index 02eba93b59f7..000000000000 --- a/graphics/appleseed/files/patch-src_appleseed.shared_application_superlogger.cpp +++ /dev/null @@ -1,20 +0,0 @@ ---- src/appleseed.shared/application/superlogger.cpp.orig 2015-06-13 09:38:53 UTC -+++ src/appleseed.shared/application/superlogger.cpp -@@ -34,7 +34,7 @@ - #include <cstdio> - - // Platform headers. --#if defined __APPLE__ || defined __linux__ -+#ifndef _WIN32 - #include <unistd.h> - #endif - -@@ -74,7 +74,7 @@ ILogTarget& SuperLogger::get_log_target( - - void SuperLogger::enable_message_coloring() - { --#if defined __APPLE__ || defined __linux__ -+#ifndef _WIN32 - const int StdErrFileDesc = 2; - if (!isatty(StdErrFileDesc)) - return; diff --git a/graphics/appleseed/files/patch-src_appleseed.studio_main_main.cpp b/graphics/appleseed/files/patch-src_appleseed.studio_main_main.cpp deleted file mode 100644 index a2894a319ed4..000000000000 --- a/graphics/appleseed/files/patch-src_appleseed.studio_main_main.cpp +++ /dev/null @@ -1,12 +0,0 @@ ---- src/appleseed.studio/main/main.cpp.orig 2015-06-13 09:38:53 UTC -+++ src/appleseed.studio/main/main.cpp -@@ -174,6 +174,9 @@ namespace - #ifdef __linux__ - preprocessor.define_symbol("__linux__"); - #endif -+#ifdef __FreeBSD__ -+ preprocessor.define_symbol("__FreeBSD__"); -+#endif - - preprocessor.process(stylesheet.c_str()); - diff --git a/graphics/appleseed/files/patch-src_appleseed.studio_mainwindow_project_materialcollectionitem.cpp b/graphics/appleseed/files/patch-src_appleseed.studio_mainwindow_project_materialcollectionitem.cpp deleted file mode 100644 index a4b0d65ca305..000000000000 --- a/graphics/appleseed/files/patch-src_appleseed.studio_mainwindow_project_materialcollectionitem.cpp +++ /dev/null @@ -1,18 +0,0 @@ ---- src/appleseed.studio/mainwindow/project/materialcollectionitem.cpp.orig 2015-06-13 09:38:53 UTC -+++ src/appleseed.studio/mainwindow/project/materialcollectionitem.cpp -@@ -94,6 +94,7 @@ MaterialCollectionItem::MaterialCollecti - add_items(materials); - } - -+#ifdef APPLESEED_WITH_DISNEY_MATERIAL - const Material& MaterialCollectionItem::create_default_disney_material(const string& material_name) - { - auto_release_ptr<Material> material = -@@ -110,6 +111,7 @@ const Material& MaterialCollectionItem:: - - return *material_ptr; - } -+#endif // APPLESEED_WITH_DISNEY_MATERIAL - - QMenu* MaterialCollectionItem::get_single_item_context_menu() const - { diff --git a/graphics/appleseed/files/patch-src_appleseed.studio_mainwindow_project_objectinstanceitem.cpp b/graphics/appleseed/files/patch-src_appleseed.studio_mainwindow_project_objectinstanceitem.cpp deleted file mode 100644 index 9cc877b8d0ca..000000000000 --- a/graphics/appleseed/files/patch-src_appleseed.studio_mainwindow_project_objectinstanceitem.cpp +++ /dev/null @@ -1,48 +0,0 @@ ---- src/appleseed.studio/mainwindow/project/objectinstanceitem.cpp.orig 2015-06-13 09:38:53 UTC -+++ src/appleseed.studio/mainwindow/project/objectinstanceitem.cpp -@@ -124,8 +124,10 @@ QMenu* ObjectInstanceItem::get_single_it - { - QMenu* menu = ItemBase::get_single_item_context_menu(); - -+#ifdef APPLESEED_WITH_DISNEY_MATERIAL - menu->addSeparator(); - menu->addAction("Assign New Disney Material", this, SLOT(slot_assign_new_disney_material())); -+#endif // APPLESEED_WITH_DISNEY_MATERIAL - - menu->addSeparator(); - menu->addAction("Assign Materials...", this, SLOT(slot_open_material_assignment_editor())); -@@ -168,15 +170,18 @@ QMenu* ObjectInstanceItem::get_multiple_ - - QMenu* menu = ItemBase::get_multiple_items_context_menu(items); - -+#ifdef APPLESEED_WITH_DISNEY_MATERIAL - menu->addSeparator(); - menu->addAction("Assign New Disney Material", this, SLOT(slot_assign_new_disney_material())) - ->setData(QVariant::fromValue(items)); -+#endif // APPLESEED_WITH_DISNEY_MATERIAL - - add_material_assignment_menu_actions(menu, items); - - return menu; - } - -+#ifdef APPLESEED_WITH_DISNEY_MATERIAL - // Friend of ObjectInstanceItem class, thus cannot be placed in anonymous namespace. - class AssignNewDisneyMaterialAction - : public RenderingManager::IScheduledAction -@@ -255,12 +260,15 @@ class AssignNewDisneyMaterialAction - EntityEditorContext& m_editor_context; - const QList<ItemBase*> m_items; - }; -+#endif // APPLESEED_WITH_DISNEY_MATERIAL - - void ObjectInstanceItem::slot_assign_new_disney_material() - { -+#ifdef APPLESEED_WITH_DISNEY_MATERIAL - m_editor_context.m_rendering_manager.schedule_or_execute( - auto_ptr<RenderingManager::IScheduledAction>( - new AssignNewDisneyMaterialAction(m_editor_context, get_action_items()))); -+#endif // APPLESEED_WITH_DISNEY_MATERIAL - } - - void ObjectInstanceItem::slot_open_material_assignment_editor() diff --git a/graphics/appleseed/files/patch-src_appleseed_CMakeLists.txt b/graphics/appleseed/files/patch-src_appleseed_CMakeLists.txt deleted file mode 100644 index b20be337e449..000000000000 --- a/graphics/appleseed/files/patch-src_appleseed_CMakeLists.txt +++ /dev/null @@ -1,18 +0,0 @@ ---- src/appleseed/CMakeLists.txt.orig 2015-06-13 09:38:53 UTC -+++ src/appleseed/CMakeLists.txt -@@ -1082,10 +1082,14 @@ set (renderer_kernel_rendering_sources - renderer/kernel/rendering/timedrenderercontroller.cpp - renderer/kernel/rendering/timedrenderercontroller.h - ) --if (WITH_OSL) -+if (WITH_OSL OR WITH_DISNEY_MATERIAL) - list (APPEND renderer_kernel_rendering_sources - renderer/kernel/rendering/oiioerrorhandler.cpp - renderer/kernel/rendering/oiioerrorhandler.h -+ ) -+endif () -+if (WITH_OSL) -+ list (APPEND renderer_kernel_rendering_sources - renderer/kernel/rendering/rendererservices.cpp - renderer/kernel/rendering/rendererservices.h - ) diff --git a/graphics/appleseed/files/patch-src_appleseed_foundation_platform_compiler.cpp b/graphics/appleseed/files/patch-src_appleseed_foundation_platform_compiler.cpp deleted file mode 100644 index c3f1886effaf..000000000000 --- a/graphics/appleseed/files/patch-src_appleseed_foundation_platform_compiler.cpp +++ /dev/null @@ -1,26 +0,0 @@ ---- src/appleseed/foundation/platform/compiler.cpp.orig 2015-06-13 09:38:53 UTC -+++ src/appleseed/foundation/platform/compiler.cpp -@@ -43,6 +43,10 @@ const char* Compiler::get_compiler_name( - #if defined _MSC_VER - return "Microsoft Visual C++"; - -+// Clang. -+#elif defined __clang__ -+ return "clang"; -+ - // gcc. - #elif defined __GNUC__ - return "gcc"; -@@ -59,6 +63,12 @@ const char* Compiler::get_compiler_versi - #if defined _MSC_VER - return TO_STRING_EVAL(_MSC_VER); - -+// Clang. -+#elif defined __clang__ -+ return TO_STRING_EVAL(__clang_major__) "." -+ TO_STRING_EVAL(__clang_minor__) "." -+ TO_STRING_EVAL(__clang_patchlevel__); -+ - // gcc. - #elif defined __GNUC__ - return TO_STRING_EVAL(__GNUC__) "." diff --git a/graphics/appleseed/files/patch-src_appleseed_foundation_platform_path.cpp b/graphics/appleseed/files/patch-src_appleseed_foundation_platform_path.cpp deleted file mode 100644 index 05b215caa50e..000000000000 --- a/graphics/appleseed/files/patch-src_appleseed_foundation_platform_path.cpp +++ /dev/null @@ -1,29 +0,0 @@ ---- src/appleseed/foundation/platform/path.cpp.orig 2015-06-13 09:38:53 UTC -+++ src/appleseed/foundation/platform/path.cpp -@@ -49,6 +49,8 @@ - #include <mach-o/dyld.h> - #elif defined __linux__ - #include <unistd.h> -+#elif defined __FreeBSD__ -+#include <sys/sysctl.h> - #endif - - using namespace boost; -@@ -88,6 +90,17 @@ const char* get_executable_path() - assert(result > 0); - path[result] = '\0'; - -+// FreeBSD. -+#elif defined __FreeBSD__ -+ -+#if __FreeBSD_version > 900009 -+ const -+#endif -+ int mib[4] = { CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME, -1 }; -+ size_t len = sizeof(path); -+ const int result = sysctl(mib, 4, path, &len, 0x0, 0); -+ assert(result == 0); -+ - // Other platforms. - #else - diff --git a/graphics/appleseed/files/patch-src_appleseed_foundation_platform_path.h b/graphics/appleseed/files/patch-src_appleseed_foundation_platform_path.h deleted file mode 100644 index 8b7932365a70..000000000000 --- a/graphics/appleseed/files/patch-src_appleseed_foundation_platform_path.h +++ /dev/null @@ -1,20 +0,0 @@ ---- src/appleseed/foundation/platform/path.h.orig 2015-06-13 09:38:53 UTC -+++ src/appleseed/foundation/platform/path.h -@@ -42,7 +42,7 @@ - #include "boost/filesystem/path.hpp" - - // Platform headers. --#if defined __APPLE__ -+#if defined __APPLE__ || defined __FreeBSD__ - #include <sys/param.h> - #elif defined __linux__ - #include <linux/limits.h> -@@ -60,7 +60,7 @@ namespace foundation - #define FOUNDATION_MAX_PATH_LENGTH MAX_PATH - - // OS X. --#elif defined __APPLE__ -+#elif defined __APPLE__ || defined __FreeBSD__ - #define FOUNDATION_MAX_PATH_LENGTH MAXPATHLEN - - // Linux. diff --git a/graphics/appleseed/files/patch-src_appleseed_foundation_platform_system.cpp b/graphics/appleseed/files/patch-src_appleseed_foundation_platform_system.cpp deleted file mode 100644 index da6da5c86c95..000000000000 --- a/graphics/appleseed/files/patch-src_appleseed_foundation_platform_system.cpp +++ /dev/null @@ -1,408 +0,0 @@ ---- src/appleseed/foundation/platform/system.cpp.orig 2015-06-13 09:38:53 UTC -+++ src/appleseed/foundation/platform/system.cpp -@@ -74,6 +74,14 @@ - #include <sys/types.h> - #include <unistd.h> - -+// Linux. -+#elif defined __FreeBSD__ -+ -+ #include <sys/types.h> -+ #include <sys/resource.h> -+ #include <sys/sysctl.h> -+ #include <unistd.h> -+ - // Other platforms. - #else - -@@ -421,6 +429,390 @@ uint64 System::get_process_virtual_memor - return static_cast<uint64>(rss) * sysconf(_SC_PAGESIZE); - } - -+// ------------------------------------------------------------------------------------------------ -+// FreeBSD. -+// ------------------------------------------------------------------------------------------------ -+ -+#elif defined __FreeBSD__ && (__x86_64__ || __i386__) -+ -+// FreeBSD does not provide an API to query CPU cache information, so we'd -+// have to ask for it by ourselves... -+ -+#define bit(n) (1ul << (n)) -+#define bitmask(h,l) ((bit(h) | (bit(h) - 1)) & ~(bit(l) - 1)) -+#define bitfield(x,h,l) (((x) & bitmask(h, l)) >> l) -+ -+enum { L1D, L2, L3 }; -+enum { eax, ebx, ecx, edx }; -+ -+// Since we only want to know cache size and line size, structure below is -+// very simplistic. Initially, all caches have zero size (i.e. absent). -+static struct trivial_x86_cache -+{ -+ size_t size; -+ size_t linesize; -+} mycaches[3]; -+ -+// %ebx may be used to point to GOT (Global Offset Table) for PIC (Position -+// Independent Code) on 32-bit x86, so it must be preserved. Normally -+// compilers handle this implicitly because %ebx is also callee saved, but -+// GCC before 5.0 forbids any use of %ebx with PIC, so it must be performed -+// explicitly. Unfortunately, we need a separate implementation for x86-64 -+// to preserve %rbx because 32-bit operations would set the upper 32 bits -+// to zero. -+static inline void -+cpuid(uint32_t* regs) -+{ -+ asm( -+#if __x86_64__ -+ "movq %%rbx, %q1\n\t" -+ "cpuid\n\t" -+ "xchgq %%rbx, %q1" -+#else -+ "movl %%ebx, %1\n\t" -+ "cpuid\n\t" -+ "xchgl %%ebx, %1" -+#endif -+ : "+a" (regs[eax]), -+ "=r" (regs[ebx]), -+ "+c" (regs[ecx]), -+ "=d" (regs[edx])); -+} -+ -+// For modern CPUs, we use Deterministic Cache Parameters (Function 04h) to -+// obtain the cache data. -+static void -+get_cache_info_deterministic(struct trivial_x86_cache *caches) -+{ -+ uint32_t regs[4]; -+ -+ // Cycle up to ten possible caches to be extra sure -+ for (size_t i = 0; i < 10; i++) -+ { -+ regs[eax] = 4; -+ regs[ecx] = i; -+ cpuid(regs); -+ -+ unsigned type = bitfield(regs[eax], 4, 0); -+ if (type == 0) break; // no more caches, we're done -+ if (type == 2) continue; // ignore instruction caches -+ -+ unsigned level = bitfield(regs[eax], 7, 5); -+ unsigned linesize = bitfield(regs[ebx], 11, 0) + 1; -+ unsigned sets = bitfield(regs[ecx], 31, 0) + 1; -+ unsigned associativity = bitfield(regs[ebx], 31, 22) + 1; -+ -+ assert(level > 0); -+ -+ caches[level - 1].size = linesize * sets * associativity; -+ caches[level - 1].linesize = linesize; -+ } -+} -+ -+// On older CPUs we might have to rely on Cache Descriptors (Function 02h) -+// and Intel documentation (table of the known values). -+static void -+get_cache_info_from_table(struct trivial_x86_cache *caches) -+{ -+ uint32_t regs[4]; -+ int no_higher_level_cache = 0; -+ -+ regs[eax] = 2; -+ cpuid(regs); -+ // Doing only one call is technically wrong, but all CPUs -+ // up to Core i7 require a single call. Since this is a -+ // fallback code path for really old CPUs anyways (modern -+ // ones will provide Function 4), we should be safe, but -+ // let's add an assert() on the lower 8 bits just in case. -+ -+ assert ((regs[eax] & 0xFF) == 1); -+ -+ for (size_t i = 1; i < 4 * 4; i++) -+ { -+ // Check descriptor validity for every octet: if bit 31 is set, -+ // skip to next one. -+ if (i % 4 == 0 && (regs[i / 4] >> 31) == 1) -+ { -+ i += 4; -+ continue; -+ } -+ -+ // Descriptor decode values from the Intel manual, Table 2-7 -+ switch ((regs[i / 4] >> (i % 4) * 8) & 0xFF) -+ { -+ case 0x0A: -+ caches[L1D].size = 8; -+ caches[L1D].linesize = 32; -+ break; -+ case 0x0C: -+ caches[L1D].size = 16; -+ caches[L1D].linesize = 32; -+ break; -+ case 0x0D: -+ case 0x60: -+ case 0x67: -+ caches[L1D].size = 16; -+ caches[L1D].linesize = 64; -+ break; -+ case 0x21: -+ case 0x3C: -+ case 0x7A: -+ caches[L2].size = 256; -+ caches[L2].linesize = 64; -+ break; -+ case 0x22: -+ case 0xD0: -+ caches[L3].size = 512; -+ caches[L3].linesize = 64; -+ break; -+ case 0x23: -+ case 0xD1: -+ case 0xD6: -+ caches[L3].size = 1024; -+ caches[L3].linesize = 64; -+ break; -+ case 0x25: -+ case 0xD2: -+ case 0xD7: -+ case 0xE2: -+ caches[L3].size = 2048; -+ caches[L3].linesize = 64; -+ break; -+ case 0x29: -+ case 0x46: -+ case 0xD8: -+ case 0xE3: -+ caches[L3].size = 4096; -+ caches[L3].linesize = 64; -+ break; -+ case 0x2C: -+ caches[L1D].size = 32; -+ caches[L1D].linesize = 64; -+ break; -+ case 0x39: -+ case 0x3B: -+ case 0x79: -+ caches[L2].size = 128; -+ caches[L2].linesize = 64; -+ break; -+ case 0x3A: -+ caches[L2].size = 192; -+ caches[L2].linesize = 64; -+ break; -+ case 0x3D: -+ caches[L2].size = 384; -+ caches[L2].linesize = 64; -+ break; -+ case 0x3E: -+ case 0x7B: -+ case 0x7F: -+ case 0x86: -+ caches[L2].size = 512; -+ caches[L2].linesize = 64; -+ break; -+ case 0x40: -+ no_higher_level_cache = 1; -+ break; -+ case 0x41: -+ caches[L2].size = 128; -+ caches[L2].linesize = 32; -+ break; -+ case 0x42: -+ case 0x82: -+ caches[L2].size = 256; -+ caches[L2].linesize = 32; -+ break; -+ case 0x43: -+ case 0x83: -+ caches[L2].size = 512; -+ caches[L2].linesize = 32; -+ break; -+ case 0x44: -+ caches[L2].size = 1024; -+ caches[L2].linesize = 32; -+ break; -+ case 0x45: -+ caches[L2].size = 2048; -+ caches[L2].linesize = 32; -+ break; -+ case 0x47: -+ case 0x4B: -+ case 0xE4: -+ caches[L3].size = 8192; -+ caches[L3].linesize = 64; -+ break; -+ case 0x48: -+ caches[L2].size = 3072; -+ caches[L2].linesize = 64; -+ break; -+ case 0x49: -+ // TODO: check for Intel Xeon processor MP, Family 0Fh, -+ // Model 06h, because 0x49 means L3 cache (4MB, 16-way, -+ // 64-byte linesize) for this CPU. -+ caches[L2].size = 4096; -+ caches[L2].linesize = 64; -+ break; -+ case 0x4A: -+ case 0xDE: -+ caches[L3].size = 6 * 1024; -+ caches[L3].linesize = 64; -+ break; -+ case 0x4C: -+ case 0xEA: -+ caches[L3].size = 12 * 1024; -+ caches[L3].linesize = 64; -+ break; -+ case 0x4D: -+ caches[L3].size = 16 * 1024; -+ caches[L3].linesize = 64; -+ break; -+ case 0x4E: -+ caches[L2].size = 6 * 1024; -+ caches[L2].linesize = 64; -+ break; -+ case 0x66: -+ caches[L1D].size = 8; -+ caches[L1D].linesize = 64; -+ break; -+ case 0x68: -+ caches[L1D].size = 32; -+ caches[L1D].linesize = 64; -+ break; -+ case 0x78: -+ case 0x7C: -+ caches[L2].size = 1024; -+ caches[L2].linesize = 64; -+ break; -+ case 0x7D: -+ caches[L2].size = 2048; -+ caches[L2].linesize = 64; -+ break; -+ case 0x84: -+ caches[L2].size = 1024; -+ caches[L2].linesize = 32; -+ break; -+ case 0x85: -+ caches[L2].size = 2048; -+ caches[L2].linesize = 32; -+ break; -+ case 0x87: -+ caches[L2].size = 1024; -+ caches[L2].linesize = 64; -+ break; -+ case 0xDC: -+ caches[L3].size = 1536; -+ caches[L3].linesize = 64; -+ break; -+ case 0xDD: -+ caches[L3].size = 3 * 1024; -+ caches[L3].linesize = 64; -+ break; -+ case 0xEB: -+ caches[L3].size = 18 * 1024; -+ caches[L3].linesize = 64; -+ break; -+ case 0xEC: -+ caches[L3].size = 24 * 1024; -+ caches[L3].linesize = 64; -+ break; -+ } -+ } -+ // Convert Kbytes to bytes. -+ caches[L1D].size *= 1024; -+ caches[L2].size *= 1024; -+ caches[L3].size *= 1024; -+} -+ -+static void -+x86_get_cache_basic_info(struct trivial_x86_cache *caches) -+{ -+ uint32_t regs[4]; -+ -+ regs[eax] = 0; -+ cpuid(regs); -+ if (regs[eax] >= 4) -+ get_cache_info_deterministic(caches); -+ else if (regs[eax] >= 2) -+ get_cache_info_from_table(caches); -+} -+ -+size_t System::get_l1_data_cache_size() -+{ -+ // Here and below we'd check for L1D cache size: if it's initialized, -+ // it means that x86_get_cache_basic_info() was already called, and -+ // we don't have to do it again. -+ if (!mycaches[L1D].size) -+ x86_get_cache_basic_info(mycaches); -+ return mycaches[L1D].size; -+} -+ -+size_t System::get_l1_data_cache_line_size() -+{ -+ if (!mycaches[L1D].size) -+ x86_get_cache_basic_info(mycaches); -+ return mycaches[L1D].linesize; -+} -+ -+size_t System::get_l2_cache_size() -+{ -+ if (!mycaches[L1D].size) -+ x86_get_cache_basic_info(mycaches); -+ return mycaches[L2].size; -+} -+ -+size_t System::get_l2_cache_line_size() -+{ -+ if (!mycaches[L1D].size) -+ x86_get_cache_basic_info(mycaches); -+ return mycaches[L2].linesize; -+} -+ -+size_t System::get_l3_cache_size() -+{ -+ if (!mycaches[L1D].size) -+ x86_get_cache_basic_info(mycaches); -+ return mycaches[L3].size; -+} -+ -+size_t System::get_l3_cache_line_size() -+{ -+ if (!mycaches[L1D].size) -+ x86_get_cache_basic_info(mycaches); -+ return mycaches[L3].linesize; -+} -+ -+uint64 System::get_total_physical_memory_size() -+{ -+ const long pagesize = sysconf(_SC_PAGESIZE); -+ const long numpages = sysconf(_SC_PHYS_PAGES); -+ -+ return static_cast<uint64>(pagesize) * numpages; -+} -+ -+uint64 System::get_total_virtual_memory_size() -+{ -+ quad_t swap; -+ size_t len = sizeof(swap); -+ -+ const int result = sysctlbyname("vm.swap_total", &swap, &len, 0x0, 0); -+ assert(result == 0); -+ -+ return get_total_physical_memory_size() + swap; -+} -+ -+// curproc->p_stats->p_ru is updated on statclock tick and can be not very -+// granular (if called early in program's life, it can even yield zeros). -+// Reference: https://lists.freebsd.org/pipermail/freebsd-stable/2006-March/023262.html -+uint64 System::get_process_virtual_memory_size() -+{ -+ struct rusage ru; -+ -+ const int result = getrusage(RUSAGE_SELF, &ru); -+ assert(result == 0); -+ -+ return static_cast<uint64>(ru.ru_maxrss) * 1024; -+} -+ - #endif - - } // namespace foundation diff --git a/graphics/appleseed/files/patch-src_appleseed_foundation_platform_thread.cpp b/graphics/appleseed/files/patch-src_appleseed_foundation_platform_thread.cpp deleted file mode 100644 index aa64ee0123cd..000000000000 --- a/graphics/appleseed/files/patch-src_appleseed_foundation_platform_thread.cpp +++ /dev/null @@ -1,27 +0,0 @@ ---- src/appleseed/foundation/platform/thread.cpp.orig 2015-06-13 09:38:53 UTC -+++ src/appleseed/foundation/platform/thread.cpp -@@ -47,6 +47,9 @@ - // Platform headers. - #if defined __APPLE__ - #include <pthread.h> -+#elif defined __FreeBSD__ -+#include <pthread.h> -+#include <pthread_np.h> - #elif defined __linux__ - #include <sys/prctl.h> - #endif -@@ -325,6 +328,14 @@ namespace foundation - pthread_setname_np(name); - } - -+// FreeBSD. -+#elif defined __FreeBSD__ -+ -+ void set_current_thread_name(const char* name) -+ { -+ pthread_set_name_np(pthread_self(), name); -+ } -+ - // Linux. - #elif defined __linux__ - diff --git a/graphics/appleseed/files/patch-src_appleseed_foundation_platform_x86timer.cpp b/graphics/appleseed/files/patch-src_appleseed_foundation_platform_x86timer.cpp new file mode 100644 index 000000000000..406bb090e8a3 --- /dev/null +++ b/graphics/appleseed/files/patch-src_appleseed_foundation_platform_x86timer.cpp @@ -0,0 +1,72 @@ +--- src/appleseed/foundation/platform/x86timer.cpp.orig 2015-11-03 13:40:41 UTC ++++ src/appleseed/foundation/platform/x86timer.cpp +@@ -105,16 +105,26 @@ uint64 X86Timer::read_start() + // gcc. + #elif defined __GNUC__ + +- uint32 h, l; ++ uint32 h, l, _dummy; + ++ // %ebx may be used to point to GOT for PIC on 32-bit x86, so it must be ++ // preserved (cf. src/appleseed/foundation/platform/system.cpp). ++ // We force in-order execution of the RDTSC instruction by calling CPUID ++ // first. Reference: "Using the RDTSC Instruction for Performance ++ // Monitoring", Section 3.1, p. 3 [Intel 1997]. + asm volatile ( +- "cpuid\n\t" // force in-order execution of the RDTSC instruction +- "rdtsc\n\t" +- "mov %%edx, %0\n\t" +- "mov %%eax, %1\n\t" +- : "=r" (h), "=r" (l) // outputs +- : // inputs +- : "%rax", "%rbx", "%rcx", "%rdx" // clobbered registers ++#if __x86_64__ ++ "movq %%rbx, %q2\n\t" ++ "cpuid\n\t" ++ "xchgq %%rbx, %q2\n\t" ++#else ++ "movl %%ebx, %2\n\t" ++ "cpuid\n\t" ++ "xchgl %%ebx, %2\n\t" ++#endif ++ "rdtsc" ++ : "=d" (h), "=a" (l), "=r" (_dummy) ++ : : "ecx" + ); + + return (static_cast<uint64>(h) << 32) | l; +@@ -158,16 +168,27 @@ uint64 X86Timer::read_end() + // gcc. + #elif defined __GNUC__ + +- uint32 h, l; ++ uint32 h, l, _dummy; + ++ // Here we call CPUID to prevent instructions coming afterward from ++ // executing before the RDTSCP instruction. Reference: "How to ++ // Benchmark Code Execution Times on Intel IA-32 and IA-64 Instruction ++ // Set Architectures", Section 3.2.1, p. 16 [Intel 2010]. + asm volatile ( + "rdtscp\n\t" +- "mov %%edx, %0\n\t" +- "mov %%eax, %1\n\t" +- "cpuid\n\t" // prevent instructions coming afterward from executing before the RDTSCP instruction +- : "=r" (h), "=r" (l) // outputs +- : // inputs +- : "%rax", "%rbx", "%rcx", "%rdx" // clobbered registers ++ "movl %%edx, %0\n\t" ++ "movl %%eax, %1\n\t" ++#if __x86_64__ ++ "movq %%rbx, %q2\n\t" ++ "cpuid\n\t" ++ "xchgq %%rbx, %q2\n\t" ++#else ++ "movl %%ebx, %2\n\t" ++ "cpuid\n\t" ++ "xchgl %%ebx, %2\n\t" ++#endif ++ : "=m" (h), "=m" (l), "=r" (_dummy) ++ : : "eax", "ecx", "edx" + ); + + return (static_cast<uint64>(h) << 32) | l; diff --git a/graphics/appleseed/files/patch-src_appleseed_foundation_utility_job_workerthread.cpp b/graphics/appleseed/files/patch-src_appleseed_foundation_utility_job_workerthread.cpp deleted file mode 100644 index 5d84f4a85a7e..000000000000 --- a/graphics/appleseed/files/patch-src_appleseed_foundation_utility_job_workerthread.cpp +++ /dev/null @@ -1,38 +0,0 @@ ---- src/appleseed/foundation/utility/job/workerthread.cpp.orig 2015-06-13 09:38:53 UTC -+++ src/appleseed/foundation/utility/job/workerthread.cpp -@@ -80,7 +80,7 @@ void WorkerThread::start() - assert(!m_abort_switch.is_aborted()); - - // Start the thread. -- m_thread = new thread(m_thread_func); -+ m_thread = new boost::thread(m_thread_func); - } - - void WorkerThread::stop() -@@ -110,7 +110,7 @@ void WorkerThread::pause() - if (!m_thread) - return; - -- mutex::scoped_lock lock(m_pause_mutex); -+ boost::mutex::scoped_lock lock(m_pause_mutex); - m_pause_flag.set(); - } - -@@ -120,7 +120,7 @@ void WorkerThread::resume() - if (!m_thread) - return; - -- mutex::scoped_lock lock(m_pause_mutex); -+ boost::mutex::scoped_lock lock(m_pause_mutex); - m_pause_flag.clear(); - m_pause_event.notify_all(); - } -@@ -141,7 +141,7 @@ void WorkerThread::run() - if (m_pause_flag.is_set()) - { - // Wait until the resume event. -- mutex::scoped_lock lock(m_pause_mutex); -+ boost::mutex::scoped_lock lock(m_pause_mutex); - while (m_pause_flag.is_set()) - m_pause_event.wait(lock); - } diff --git a/graphics/appleseed/files/patch-src_appleseed_renderer_kernel_rendering_generic_genericframerenderer.cpp b/graphics/appleseed/files/patch-src_appleseed_renderer_kernel_rendering_generic_genericframerenderer.cpp deleted file mode 100644 index 4fdb64932c4e..000000000000 --- a/graphics/appleseed/files/patch-src_appleseed_renderer_kernel_rendering_generic_genericframerenderer.cpp +++ /dev/null @@ -1,20 +0,0 @@ ---- src/appleseed/renderer/kernel/rendering/generic/genericframerenderer.cpp.orig 2015-06-13 09:38:53 UTC -+++ src/appleseed/renderer/kernel/rendering/generic/genericframerenderer.cpp -@@ -169,7 +169,7 @@ namespace - m_abort_switch, - m_is_rendering)); - ThreadFunctionWrapper<PassManagerFunc> wrapper(m_pass_manager_func.get()); -- m_pass_manager_thread.reset(new thread(wrapper)); -+ m_pass_manager_thread.reset(new boost::thread(wrapper)); - } - - virtual void stop_rendering() APPLESEED_OVERRIDE -@@ -352,7 +352,7 @@ namespace - - bool m_is_rendering; - auto_ptr<PassManagerFunc> m_pass_manager_func; -- auto_ptr<thread> m_pass_manager_thread; -+ auto_ptr<boost::thread> m_pass_manager_thread; - - void print_tile_renderers_stats() const - { diff --git a/graphics/appleseed/files/patch-src_appleseed_renderer_kernel_rendering_progressive_progressiveframerenderer.cpp b/graphics/appleseed/files/patch-src_appleseed_renderer_kernel_rendering_progressive_progressiveframerenderer.cpp deleted file mode 100644 index 73ba2a7d3d6c..000000000000 --- a/graphics/appleseed/files/patch-src_appleseed_renderer_kernel_rendering_progressive_progressiveframerenderer.cpp +++ /dev/null @@ -1,34 +0,0 @@ ---- src/appleseed/renderer/kernel/rendering/progressive/progressiveframerenderer.cpp.orig 2015-06-13 09:38:53 UTC -+++ src/appleseed/renderer/kernel/rendering/progressive/progressiveframerenderer.cpp -@@ -235,7 +235,7 @@ namespace - m_ref_image_avg_lum, - m_abort_switch)); - m_statistics_thread.reset( -- new thread( -+ new boost::thread( - ThreadFunctionWrapper<StatisticsFunc>(m_statistics_func.get()))); - - // Create and start the display thread. -@@ -249,7 +249,7 @@ namespace - m_params.m_max_fps, - m_display_thread_abort_switch)); - m_display_thread.reset( -- new thread( -+ new boost::thread( - ThreadFunctionWrapper<DisplayFunc>(m_display_func.get()))); - } - -@@ -592,11 +592,11 @@ namespace - double m_ref_image_avg_lum; - - auto_ptr<DisplayFunc> m_display_func; -- auto_ptr<thread> m_display_thread; -+ auto_ptr<boost::thread> m_display_thread; - AbortSwitch m_display_thread_abort_switch; - - auto_ptr<StatisticsFunc> m_statistics_func; -- auto_ptr<thread> m_statistics_thread; -+ auto_ptr<boost::thread> m_statistics_thread; - - void print_sample_generators_stats() const - { diff --git a/graphics/appleseed/files/patch-src_appleseed_renderer_utility_plugin.cpp b/graphics/appleseed/files/patch-src_appleseed_renderer_utility_plugin.cpp deleted file mode 100644 index 715fbf493f6f..000000000000 --- a/graphics/appleseed/files/patch-src_appleseed_renderer_utility_plugin.cpp +++ /dev/null @@ -1,27 +0,0 @@ ---- src/appleseed/renderer/utility/plugin.cpp.orig 2015-06-13 09:38:53 UTC -+++ src/appleseed/renderer/utility/plugin.cpp -@@ -119,13 +119,13 @@ namespace - typedef map<string, boost::weak_ptr<SharedLibrary> > PluginCacheType; - - PluginCacheType g_plugin_cache; -- mutex g_plugin_cache_mutex; -+ boost::mutex g_plugin_cache_mutex; - - struct PluginDeleter - { - void operator()(SharedLibrary* p) - { -- lock_guard<mutex> lock(g_plugin_cache_mutex); -+ boost::lock_guard<boost::mutex> lock(g_plugin_cache_mutex); - - // Try to call the plugin uninitialize function if defined. - Plugin::UnInitPluginFnType uninit_fn = -@@ -141,7 +141,7 @@ namespace - - auto_release_ptr<Plugin> PluginCache::load(const char* path) - { -- lock_guard<mutex> lock(g_plugin_cache_mutex); -+ boost::lock_guard<boost::mutex> lock(g_plugin_cache_mutex); - - // Check if we loaded this plugin before. - PluginCacheType::iterator it = g_plugin_cache.find(path); |