Update preference to set macOS render performance

This commit is contained in:
Robin Gareus 2023-02-04 22:34:12 +01:00
parent 509504acf2
commit 380005f50f
8 changed files with 17 additions and 40 deletions

View file

@ -80,7 +80,7 @@ Editor::initialize_canvas ()
_track_canvas = _track_canvas_viewport->canvas (); _track_canvas = _track_canvas_viewport->canvas ();
_track_canvas->set_background_color (UIConfiguration::instance().color ("arrange base")); _track_canvas->set_background_color (UIConfiguration::instance().color ("arrange base"));
_track_canvas->use_nsglview (); _track_canvas->use_nsglview (UIConfiguration::instance().get_nsgl_view_mode () == NSGLHiRes);
/* scroll group for items that should not automatically scroll /* scroll group for items that should not automatically scroll
* (e.g verbose cursor). It shares the canvas coordinate space. * (e.g verbose cursor). It shares the canvas coordinate space.

View file

@ -66,7 +66,7 @@ EditorSummary::EditorSummary (Editor* e)
_image (0), _image (0),
_background_dirty (true) _background_dirty (true)
{ {
CairoWidget::use_nsglview (); CairoWidget::use_nsglview (UIConfiguration::instance().get_nsgl_view_mode () == NSGLHiRes);
add_events (Gdk::POINTER_MOTION_MASK|Gdk::KEY_PRESS_MASK|Gdk::KEY_RELEASE_MASK|Gdk::ENTER_NOTIFY_MASK|Gdk::LEAVE_NOTIFY_MASK); add_events (Gdk::POINTER_MOTION_MASK|Gdk::KEY_PRESS_MASK|Gdk::KEY_RELEASE_MASK|Gdk::ENTER_NOTIFY_MASK|Gdk::LEAVE_NOTIFY_MASK);
set_can_focus (); set_can_focus ();

View file

@ -92,8 +92,6 @@ using namespace ARDOUR;
using namespace ARDOUR_UI_UTILS; using namespace ARDOUR_UI_UTILS;
using namespace ArdourWidgets; using namespace ArdourWidgets;
extern int query_darwin_version (); // cocoacarbon.mm
class ClickOptions : public OptionEditorMiniPage class ClickOptions : public OptionEditorMiniPage
{ {
public: public:
@ -3021,17 +3019,17 @@ These settings will only take effect after %1 is restarted.\n\
#ifdef __APPLE__ #ifdef __APPLE__
ComboOption<AppleNSGLViewMode>* glmode = new ComboOption<AppleNSGLViewMode> ( ComboOption<AppleNSGLViewMode>* glmode = new ComboOption<AppleNSGLViewMode> (
"use-opengl-view", "nsgl-view-mode",
_("Render Canvas on openGL texture (requires restart)"), _("Render Canvas on openGL texture (requires restart)"),
sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::get_use_opengl_view), sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::get_nsgl_view_mode),
sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::set_use_opengl_view) sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::set_nsgl_view_mode)
); );
glmode->add (NSGLAuto, _("Automatic")); glmode->add (NSGLHiRes, _("Yes, with Retina scaling"));
glmode->add (NSGLLoRes, _("Yes, low resolution"));
glmode->add (NSGLDisable, _("No")); glmode->add (NSGLDisable, _("No"));
glmode->add (NSGLEnable, _("Yes"));
Gtkmm2ext::UI::instance()->set_tip (glmode->tip_widget(), string_compose ( Gtkmm2ext::UI::instance()->set_tip (glmode->tip_widget(), string_compose (
_("Render editor canvas, on a openGL texture, bypassing color-correction and retina scaling.\nThis requires restarting %1 before having an effect"), PROGRAM_NAME)); _("Render editor canvas, on a openGL texture which may improve graphics performance.\nThis requires restarting %1 before having an effect"), PROGRAM_NAME));
add_option (_("Appearance"), glmode); add_option (_("Appearance"), glmode);
#endif #endif
@ -4901,15 +4899,6 @@ RCOptionEditor::parameter_changed (string const & p)
plugin_scan_refresh (); plugin_scan_refresh ();
} else if (p == "conceal-vst2-if-vst3-exists") { } else if (p == "conceal-vst2-if-vst3-exists") {
plugin_scan_refresh (); plugin_scan_refresh ();
} else if (p == "use-opengl-view" && _cairo_image_surface) {
#ifdef __APPLE__
AppleNSGLViewMode m = UIConfiguration::instance().get_use_opengl_view ();
if (m == NSGLEnable || (m == NSGLAuto && query_darwin_version () < 23)) {
_cairo_image_surface->set_sensitive (false);
} else {
_cairo_image_surface->set_sensitive (true);
}
#endif
} }
} }

View file

@ -239,20 +239,8 @@ UIConfiguration::pre_gui_init ()
} }
#endif #endif
#ifdef __APPLE__ #ifdef __APPLE__
switch (get_use_opengl_view()) { if (NSGLDisable == get_nsgl_view_mode()) {
case NSGLAuto: g_setenv ("ARDOUR_NSGL", "0", 0);
if (query_darwin_version () >= 23) {
g_setenv ("ARDOUR_NSGL", "0", 0);
} else {
g_setenv ("ARDOUR_NSGL", "1", 0);
}
break;
case NSGLDisable:
g_setenv ("ARDOUR_NSGL", "0", 0);
break;
case NSGLEnable:
g_setenv ("ARDOUR_NSGL", "1", 0);
break;
} }
#endif #endif
return 0; return 0;

View file

@ -107,7 +107,7 @@ UI_CONFIG_VARIABLE (double, waveform_clip_level, "waveform-clip-level", -0.09339
UI_CONFIG_VARIABLE (bool, no_new_session_dialog, "no-new-session-dialog", false) UI_CONFIG_VARIABLE (bool, no_new_session_dialog, "no-new-session-dialog", false)
UI_CONFIG_VARIABLE (bool, buggy_gradients, "buggy-gradients", false) UI_CONFIG_VARIABLE (bool, buggy_gradients, "buggy-gradients", false)
UI_CONFIG_VARIABLE (bool, cairo_image_surface, "cairo-image-surface", false) UI_CONFIG_VARIABLE (bool, cairo_image_surface, "cairo-image-surface", false)
UI_CONFIG_VARIABLE (ARDOUR::AppleNSGLViewMode, use_opengl_view, "use-opengl-view", NSGLAuto) UI_CONFIG_VARIABLE (ARDOUR::AppleNSGLViewMode, nsgl_view_mode, "nsgl-view-mode", NSGLHiRes)
UI_CONFIG_VARIABLE (uint64_t, waveform_cache_size, "waveform-cache-size", 100) /* units of megagbytes */ UI_CONFIG_VARIABLE (uint64_t, waveform_cache_size, "waveform-cache-size", 100) /* units of megagbytes */
UI_CONFIG_VARIABLE (int32_t, recent_session_sort, "recent-session-sort", 0) UI_CONFIG_VARIABLE (int32_t, recent_session_sort, "recent-session-sort", 0)
UI_CONFIG_VARIABLE (bool, save_export_analysis_image, "save-export-analysis-image", false) UI_CONFIG_VARIABLE (bool, save_export_analysis_image, "save-export-analysis-image", false)

View file

@ -686,9 +686,9 @@ enum PluginGUIBehavior {
}; };
enum AppleNSGLViewMode { enum AppleNSGLViewMode {
NSGLAuto, // disable on Catalina and above NSGLHiRes,
NSGLLoRes,
NSGLDisable, NSGLDisable,
NSGLEnable
}; };
/** A struct used to describe changes to processors in a route. /** A struct used to describe changes to processors in a route.

View file

@ -762,9 +762,9 @@ setup_enum_writer ()
REGISTER_ENUM(PluginGUIDestroyVST); REGISTER_ENUM(PluginGUIDestroyVST);
REGISTER(_PluginGUIBehavior); REGISTER(_PluginGUIBehavior);
REGISTER_ENUM(NSGLAuto); REGISTER_ENUM(NSGLHiRes);
REGISTER_ENUM(NSGLLoRes);
REGISTER_ENUM(NSGLDisable); REGISTER_ENUM(NSGLDisable);
REGISTER_ENUM(NSGLEnable);
REGISTER(_AppleNSGLViewMode); REGISTER(_AppleNSGLViewMode);
REGISTER_ENUM (Small); REGISTER_ENUM (Small);

View file

@ -2582,9 +2582,9 @@ LuaBindings::common (lua_State* L)
.endNamespace () .endNamespace ()
.beginNamespace ("AppleNSGLViewMode") .beginNamespace ("AppleNSGLViewMode")
.addConst ("NSGLAuto", ARDOUR::AppleNSGLViewMode(NSGLAuto)) .addConst ("NSGLHiRes", ARDOUR::AppleNSGLViewMode(NSGLHiRes))
.addConst ("NSGLLoRes", ARDOUR::AppleNSGLViewMode(NSGLLoRes))
.addConst ("NSGLDisable", ARDOUR::AppleNSGLViewMode(NSGLDisable)) .addConst ("NSGLDisable", ARDOUR::AppleNSGLViewMode(NSGLDisable))
.addConst ("NSGLEnable", ARDOUR::AppleNSGLViewMode(NSGLEnable))
.endNamespace () .endNamespace ()
.beginNamespace ("PluginGUIBehavior") .beginNamespace ("PluginGUIBehavior")