diff options
| author | Carl Hetherington <cth@carlh.net> | 2023-09-24 12:09:16 +0200 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2023-12-16 02:07:38 +0100 |
| commit | e36811385ea745d7a331af50aeec906b6c22140b (patch) | |
| tree | db2ef6a77bf5c6c992797463e0237e30fea3756d | |
| parent | 2da3ac05bc5c610ab621d26c6e7ff01ccccea57d (diff) | |
Only build grok for Ubuntu 22.04.
| -rw-r--r-- | cscript | 3 | ||||
| -rw-r--r-- | src/lib/j2k_encoder.cc | 27 | ||||
| -rw-r--r-- | src/lib/j2k_encoder.h | 6 | ||||
| -rw-r--r-- | src/lib/writer.h | 1 | ||||
| -rw-r--r-- | src/lib/wscript | 4 | ||||
| -rw-r--r-- | src/tools/dcpomatic.cc | 4 | ||||
| -rw-r--r-- | src/tools/dcpomatic_batch.cc | 4 | ||||
| -rw-r--r-- | src/tools/dcpomatic_server.cc | 4 | ||||
| -rw-r--r-- | src/tools/dcpomatic_server_cli.cc | 4 | ||||
| -rw-r--r-- | src/wx/full_config_dialog.cc | 4 | ||||
| -rw-r--r-- | wscript | 5 |
11 files changed, 60 insertions, 6 deletions
@@ -564,6 +564,9 @@ def configure_options(target, options, for_package=False): if target.platform == 'osx' and target.arch == 'arm64': opt += ' --target-macos-arm64 --wx-config=%s/wx-config' % target.bin + if target.platform == 'linux' and target.distro == 'ubuntu' and target.version in ['22.04']: + opt += ' --enable-grok' + return opt def build(target, options, for_package): diff --git a/src/lib/j2k_encoder.cc b/src/lib/j2k_encoder.cc index c023e4bf3..7d695245a 100644 --- a/src/lib/j2k_encoder.cc +++ b/src/lib/j2k_encoder.cc @@ -33,7 +33,9 @@ #include "encode_server_finder.h" #include "film.h" #include "cpu_j2k_encoder_thread.h" +#ifdef DCPOMATIC_GROK #include "grok_j2k_encoder_thread.h" +#endif #include "remote_j2k_encoder_thread.h" #include "j2k_encoder.h" #include "log.h" @@ -65,8 +67,10 @@ J2KEncoder::J2KEncoder(shared_ptr<const Film> film, Writer& writer) : _film (film) , _history (200) , _writer (writer) +#ifdef DCPOMATIC_GROK , _dcpomatic_context(film, writer, _history, Config::instance()->gpu_binary_location()) , _context(Config::instance()->enable_gpu() ? new grk_plugin::GrokContext(_dcpomatic_context) : nullptr) +#endif { } @@ -77,7 +81,9 @@ J2KEncoder::~J2KEncoder () terminate_threads(); +#ifdef DCPOMATIC_GROK delete _context; +#endif } @@ -115,8 +121,10 @@ J2KEncoder::pause() /* Something might have been thrown during terminate_threads */ rethrow (); +#ifdef DCPOMATIC_GROK delete _context; _context = nullptr; +#endif } @@ -126,7 +134,9 @@ void J2KEncoder::resume() return; } +#ifdef DCPOMATIC_GROK _context = new grk_plugin::GrokContext(_dcpomatic_context); +#endif servers_list_changed(); } @@ -163,13 +173,16 @@ J2KEncoder::end() So just mop up anything left in the queue here. */ for (auto & i: _queue) { +#ifdef DCPOMATIC_GROK if (Config::instance()->enable_gpu ()) { if (!_context->scheduleCompress(i)){ LOG_GENERAL (N_("[%1] J2KEncoder thread pushes frame %2 back onto queue after failure"), thread_id(), i.index()); // handle error } - } - else { + } else { +#else + { +#endif LOG_GENERAL(N_("Encode left-over frame %1"), i.index()); try { _writer.write( @@ -184,8 +197,10 @@ J2KEncoder::end() } } +#ifdef DCPOMATIC_GROK delete _context; _context = nullptr; +#endif } @@ -311,7 +326,11 @@ J2KEncoder::terminate_threads () void +#ifdef DCPOMATIC_GROK J2KEncoder::remake_threads(int cpu, int gpu, list<EncodeServerDescription> servers) +#else +J2KEncoder::remake_threads(int cpu, int, list<EncodeServerDescription> servers) +#endif { boost::mutex::scoped_lock lm (_threads_mutex); if (_ending) { @@ -345,7 +364,7 @@ J2KEncoder::remake_threads(int cpu, int gpu, list<EncodeServerDescription> serve remove_threads(cpu, current_cpu_threads, is_cpu_thread); - +#ifdef DCPOMATIC_GROK /* GPU */ auto const is_grok_thread = [](shared_ptr<J2KEncoderThread> thread) { @@ -361,7 +380,7 @@ J2KEncoder::remake_threads(int cpu, int gpu, list<EncodeServerDescription> serve } remove_threads(gpu, current_gpu_threads, is_grok_thread); - +#endif /* Remote */ diff --git a/src/lib/j2k_encoder.h b/src/lib/j2k_encoder.h index a6e190dcf..9d9d85894 100644 --- a/src/lib/j2k_encoder.h +++ b/src/lib/j2k_encoder.h @@ -28,11 +28,13 @@ */ -#include "grok/context.h" #include "cross.h" #include "enum_indexed_vector.h" #include "event_history.h" #include "exception_store.h" +#ifdef DCPOMATIC_GROK +#include "grok/context.h" +#endif #include "j2k_encoder_thread.h" #include "writer.h" #include <boost/optional.hpp> @@ -122,8 +124,10 @@ private: boost::signals2::scoped_connection _server_found_connection; +#ifdef DCPOMATIC_GROK grk_plugin::DcpomaticContext _dcpomatic_context; grk_plugin::GrokContext *_context; +#endif bool _ending = false; }; diff --git a/src/lib/writer.h b/src/lib/writer.h index efb6a17d8..1cd278221 100644 --- a/src/lib/writer.h +++ b/src/lib/writer.h @@ -34,6 +34,7 @@ #include "exception_store.h" #include "font_id_map.h" #include "player_text.h" +#include "text_type.h" #include "weak_film.h" #include <dcp/atmos_frame.h> #include <boost/thread.hpp> diff --git a/src/lib/wscript b/src/lib/wscript index e0cfaa79c..67c6b5869 100644 --- a/src/lib/wscript +++ b/src/lib/wscript @@ -123,7 +123,6 @@ sources = """ font_id_map.cc frame_interval_checker.cc frame_rate_change.cc - grok_j2k_encoder_thread.cc guess_crop.cc hints.cc internet.cc @@ -246,6 +245,9 @@ def build(bld): if bld.env.TARGET_LINUX: obj.uselib += ' POLKIT' + if bld.env.ENABLE_GROK: + obj.source += ' grok_j2k_encoder_thread.cc' + if bld.env.TARGET_WINDOWS_64 or bld.env.TARGET_WINDOWS_32: obj.uselib += ' WINSOCK2 DBGHELP SHLWAPI MSWSOCK BOOST_LOCALE SETUPAPI OLE32 UUID' obj.source += ' cross_windows.cc' diff --git a/src/tools/dcpomatic.cc b/src/tools/dcpomatic.cc index 90ae920ee..956735198 100644 --- a/src/tools/dcpomatic.cc +++ b/src/tools/dcpomatic.cc @@ -75,7 +75,9 @@ #include "lib/ffmpeg_encoder.h" #include "lib/film.h" #include "lib/font_config.h" +#ifdef DCPOMATIC_GROK #include "lib/grok/context.h" +#endif #include "lib/hints.h" #include "lib/job_manager.h" #include "lib/kdm_with_metadata.h" @@ -1723,7 +1725,9 @@ private: notes.ShowModal(); } +#ifdef DCPOMATIC_GROK grk_plugin::setMessengerLogger(new grk_plugin::GrokLogger("[GROK] ")); +#endif } catch (exception& e) { diff --git a/src/tools/dcpomatic_batch.cc b/src/tools/dcpomatic_batch.cc index 590ddafd5..eff425f25 100644 --- a/src/tools/dcpomatic_batch.cc +++ b/src/tools/dcpomatic_batch.cc @@ -31,7 +31,9 @@ #include "lib/config.h" #include "lib/dcpomatic_socket.h" #include "lib/film.h" +#ifdef DCPOMATIC_GROK #include "lib/grok/context.h" +#endif #include "lib/job.h" #include "lib/job_manager.h" #include "lib/make_dcp.h" @@ -499,7 +501,9 @@ class App : public wxApp } } +#ifdef DCPOMATIC_GROK grk_plugin::setMessengerLogger(new grk_plugin::GrokLogger("[GROK] ")); +#endif return true; } diff --git a/src/tools/dcpomatic_server.cc b/src/tools/dcpomatic_server.cc index 528af8858..b7100d62a 100644 --- a/src/tools/dcpomatic_server.cc +++ b/src/tools/dcpomatic_server.cc @@ -25,7 +25,9 @@ #include "lib/encoded_log_entry.h" #include "lib/encode_server.h" #include "lib/config.h" +#ifdef DCPOMATIC_GROK #include "lib/grok/context.h" +#endif #include "lib/log.h" #include "lib/signaller.h" #include "lib/cross.h" @@ -327,7 +329,9 @@ private: SetExitOnFrameDelete (false); +#ifdef DCPOMATIC_GROK grk_plugin::setMessengerLogger(new grk_plugin::GrokLogger("[GROK] ")); +#endif return true; } diff --git a/src/tools/dcpomatic_server_cli.cc b/src/tools/dcpomatic_server_cli.cc index 30f119a5e..9e4a8814f 100644 --- a/src/tools/dcpomatic_server_cli.cc +++ b/src/tools/dcpomatic_server_cli.cc @@ -25,7 +25,9 @@ #include "lib/config.h" #include "lib/image.h" #include "lib/file_log.h" +#ifdef DCPOMATIC_GROK #include "lib/grok/context.h" +#endif #include "lib/null_log.h" #include "lib/version.h" #include "lib/encode_server.h" @@ -110,7 +112,9 @@ main (int argc, char* argv[]) dcpomatic_log.reset (new FileLog("dcpomatic_server_cli.log")); } +#ifdef DCPOMATIC_GROK setMessengerLogger(new grk_plugin::GrokLogger("[GROK] ")); +#endif EncodeServer server (verbose, num_threads); diff --git a/src/wx/full_config_dialog.cc b/src/wx/full_config_dialog.cc index 119091af3..bc5b5de4e 100644 --- a/src/wx/full_config_dialog.cc +++ b/src/wx/full_config_dialog.cc @@ -45,7 +45,9 @@ #include "send_test_email_dialog.h" #include "server_dialog.h" #include "static_text.h" +#ifdef DCPOMATIC_GROK #include "grok/gpu_config_panel.h" +#endif #include "wx_util.h" #include "lib/config.h" #include "lib/cross.h" @@ -1945,7 +1947,9 @@ create_full_config_dialog () e->AddPage (new SoundPage (ps, border)); e->AddPage (new DefaultsPage (ps, border)); e->AddPage (new EncodingServersPage(ps, border)); +#ifdef DCPOMATIC_GROK e->AddPage (new GPUPage (ps, border)); +#endif e->AddPage (new KeysPage (ps, border)); e->AddPage (new TMSPage (ps, border)); e->AddPage (new EmailPage (ps, border)); @@ -76,6 +76,7 @@ def options(opt): opt.add_option('--workaround-gssapi', action='store_true', default=False, help='link to gssapi_krb5') opt.add_option('--use-lld', action='store_true', default=False, help='use lld linker') opt.add_option('--enable-disk', action='store_true', default=False, help='build dcpomatic2_disk tool; requires Boost process, lwext4 and nanomsg libraries') + opt.add_option('--enable-grok', action='store_true', default=False, help='build with support for grok J2K encoder') opt.add_option('--warnings-are-errors', action='store_true', default=False, help='build with -Werror') opt.add_option('--wx-config', help='path to wx-config') @@ -96,6 +97,7 @@ def configure(conf): conf.env.DEBUG = conf.options.enable_debug conf.env.STATIC_DCPOMATIC = conf.options.static_dcpomatic conf.env.ENABLE_DISK = conf.options.enable_disk + conf.env.ENABLE_GROK = conf.options.enable_grok if conf.options.destdir == '': conf.env.INSTALL_PREFIX = conf.options.prefix else: @@ -140,6 +142,9 @@ def configure(conf): if conf.options.enable_disk: conf.env.append_value('CXXFLAGS', '-DDCPOMATIC_DISK') + if conf.options.enable_grok: + conf.env.append_value('CXXFLAGS', '-DDCPOMATIC_GROK') + if conf.options.use_lld: try: conf.find_program('ld.lld') |
