[epiphany/mcatanzaro/hardware-acceleration-policy: 4/4] Expose setting to configure hardware acceleration policy
- From: Jan-Michael Brummer <jbrummer src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [epiphany/mcatanzaro/hardware-acceleration-policy: 4/4] Expose setting to configure hardware acceleration policy
- Date: Thu, 31 Jan 2019 17:23:25 +0000 (UTC)
commit 1618a34e7b66947a4cbcda39870a6fa525dc3a92
Author: Michael Catanzaro <mcatanzaro igalia com>
Date: Wed Jan 30 18:58:06 2019 -0600
Expose setting to configure hardware acceleration policy
Accelerated compositing mode is required to achieve acceptable
performance on certain hardware that we care about, but also causes
unacceptable performance degredation on other hardware. It also
significantly increases memory usage requirements.
Let's allow the user to choose. Distributors can use a gsettings
override if needed to target particular hardware.
Default policy will be on-demand, at least for now. Might be revisited
again soon. Maybe very soon.
data/org.gnome.epiphany.gschema.xml | 5 +++
embed/ephy-embed-prefs.c | 30 +++++++++++++++++
lib/ephy-prefs.h | 65 +++++++++++++++++++++----------------
3 files changed, 72 insertions(+), 28 deletions(-)
---
diff --git a/data/org.gnome.epiphany.gschema.xml b/data/org.gnome.epiphany.gschema.xml
index 2654b4940..643cd3e28 100644
--- a/data/org.gnome.epiphany.gschema.xml
+++ b/data/org.gnome.epiphany.gschema.xml
@@ -228,6 +228,11 @@
<summary>Last download directory</summary>
<description>Keep track of last download directory</description>
</key>
+ <key name="hardware-acceleration-policy"
enum="org.gnome.Epiphany.EphyPrefsWebHardwareAccelerationPolicy">
+ <default>'on-demand'</default>
+ <summary>Hardware acceleration policy</summary>
+ <description>Whether to enable hardware acceleration. Possible values are
“on-demand”, “always”, and “never”. Hardware acceleration may be required to achieve acceptable performance
on embedded devices, but increases memory usage requirements and could expose severe hardware-specific
graphics driver bugs. When the policy is “on-demand”, hardware acceleration will be used only when required
to display 3D transforms.</description>
+ </key>
</schema>
<schema id="org.gnome.Epiphany.webapp">
<key type="as" name="additional-urls">
diff --git a/embed/ephy-embed-prefs.c b/embed/ephy-embed-prefs.c
index 615624552..ae4ab843e 100644
--- a/embed/ephy-embed-prefs.c
+++ b/embed/ephy-embed-prefs.c
@@ -395,6 +395,32 @@ webkit_pref_callback_enable_spell_checking (GSettings *settings,
}
}
+static void
+webkit_pref_callback_hardware_acceleration_policy (GSettings *settings,
+ const char *key,
+ gpointer data)
+{
+ EphyPrefsWebHardwareAccelerationPolicy value;
+
+ value = g_settings_get_enum (settings, key);
+ switch (value) {
+ case EPHY_PREFS_WEB_HARDWARE_ACCELERATION_POLICY_ALWAYS:
+ webkit_settings_set_hardware_acceleration_policy (webkit_settings,
+ WEBKIT_HARDWARE_ACCELERATION_POLICY_ALWAYS);
+ break;
+ case EPHY_PREFS_WEB_HARDWARE_ACCELERATION_POLICY_NEVER:
+ webkit_settings_set_hardware_acceleration_policy (webkit_settings,
+ WEBKIT_HARDWARE_ACCELERATION_POLICY_NEVER);
+ break;
+ case EPHY_PREFS_WEB_HARDWARE_ACCELERATION_POLICY_ON_DEMAND:
+ /* Fallthrough */
+ default:
+ webkit_settings_set_hardware_acceleration_policy (webkit_settings,
+ WEBKIT_HARDWARE_ACCELERATION_POLICY_ON_DEMAND);
+ break;
+ }
+}
+
static const PrefData webkit_pref_entries[] =
{
/* Epiphany font settings */
@@ -449,6 +475,10 @@ static const PrefData webkit_pref_entries[] =
EPHY_PREFS_WEB_COOKIES_POLICY,
"accept-policy",
webkit_pref_callback_cookie_accept_policy },
+ { EPHY_PREFS_WEB_SCHEMA,
+ EPHY_PREFS_WEB_HARDWARE_ACCELERATION_POLICY,
+ "hardware-acceleration-policy",
+ webkit_pref_callback_hardware_acceleration_policy },
};
static gpointer
diff --git a/lib/ephy-prefs.h b/lib/ephy-prefs.h
index 9050ba76b..430cc99ff 100644
--- a/lib/ephy-prefs.h
+++ b/lib/ephy-prefs.h
@@ -64,6 +64,13 @@ typedef enum
EPHY_PREFS_WEB_COOKIES_POLICY_NEVER
} EphyPrefsWebCookiesPolicy;
+typedef enum
+{
+ EPHY_PREFS_WEB_HARDWARE_ACCELERATION_POLICY_ON_DEMAND,
+ EPHY_PREFS_WEB_HARDWARE_ACCELERATION_POLICY_ALWAYS,
+ EPHY_PREFS_WEB_HARDWARE_ACCELERATION_POLICY_NEVER
+} EphyPrefsWebHardwareAccelerationPolicy;
+
#define EPHY_PREFS_UI_SCHEMA "org.gnome.Epiphany.ui"
#define EPHY_PREFS_UI_EXPAND_TABS_BAR "expand-tabs-bar"
#define EPHY_PREFS_UI_TABS_BAR_POSITION "tabs-bar-position"
@@ -89,34 +96,35 @@ static const char * const ephy_prefs_state_schema[] = {
EPHY_PREFS_STATE_IS_MAXIMIZED
};
-#define EPHY_PREFS_WEB_SCHEMA "org.gnome.Epiphany.web"
-#define EPHY_PREFS_WEB_FONT_MIN_SIZE "min-font-size"
-#define EPHY_PREFS_WEB_LANGUAGE "language"
-#define EPHY_PREFS_WEB_USE_GNOME_FONTS "use-gnome-fonts"
-#define EPHY_PREFS_WEB_SANS_SERIF_FONT "sans-serif-font"
-#define EPHY_PREFS_WEB_SERIF_FONT "serif-font"
-#define EPHY_PREFS_WEB_MONOSPACE_FONT "monospace-font"
-#define EPHY_PREFS_WEB_ENABLE_USER_CSS "enable-user-css"
-#define EPHY_PREFS_WEB_ENABLE_POPUPS "enable-popups"
-#define EPHY_PREFS_WEB_ENABLE_PLUGINS "enable-plugins"
-#define EPHY_PREFS_WEB_ENABLE_SPELL_CHECKING "enable-spell-checking"
-#define EPHY_PREFS_WEB_ENABLE_WEBGL "enable-webgl"
-#define EPHY_PREFS_WEB_ENABLE_WEBAUDIO "enable-webaudio"
-#define EPHY_PREFS_WEB_ENABLE_SMOOTH_SCROLLING "enable-smooth-scrolling"
-#define EPHY_PREFS_WEB_USER_AGENT "user-agent"
-#define EPHY_PREFS_WEB_COOKIES_POLICY "cookies-policy"
-#define EPHY_PREFS_WEB_DEFAULT_ENCODING "default-encoding"
-#define EPHY_PREFS_WEB_DO_NOT_TRACK "do-not-track"
-#define EPHY_PREFS_WEB_ENABLE_ADBLOCK "enable-adblock"
-#define EPHY_PREFS_WEB_REMEMBER_PASSWORDS "remember-passwords"
-#define EPHY_PREFS_WEB_ENABLE_SITE_SPECIFIC_QUIRKS "enable-site-specific-quirks"
-#define EPHY_PREFS_WEB_ENABLE_SAFE_BROWSING "enable-safe-browsing"
-#define EPHY_PREFS_WEB_GSB_API_KEY "gsb-api-key"
-#define EPHY_PREFS_WEB_DEFAULT_ZOOM_LEVEL "default-zoom-level"
-#define EPHY_PREFS_WEB_ENABLE_AUTOSEARCH "enable-autosearch"
-#define EPHY_PREFS_WEB_ENABLE_MOUSE_GESTURES "enable-mouse-gestures"
-#define EPHY_PREFS_WEB_LAST_UPLOAD_DIRECTORY "last-upload-directory"
-#define EPHY_PREFS_WEB_LAST_DOWNLOAD_DIRECTORY "last-download-directory"
+#define EPHY_PREFS_WEB_SCHEMA "org.gnome.Epiphany.web"
+#define EPHY_PREFS_WEB_FONT_MIN_SIZE "min-font-size"
+#define EPHY_PREFS_WEB_LANGUAGE "language"
+#define EPHY_PREFS_WEB_USE_GNOME_FONTS "use-gnome-fonts"
+#define EPHY_PREFS_WEB_SANS_SERIF_FONT "sans-serif-font"
+#define EPHY_PREFS_WEB_SERIF_FONT "serif-font"
+#define EPHY_PREFS_WEB_MONOSPACE_FONT "monospace-font"
+#define EPHY_PREFS_WEB_ENABLE_USER_CSS "enable-user-css"
+#define EPHY_PREFS_WEB_ENABLE_POPUPS "enable-popups"
+#define EPHY_PREFS_WEB_ENABLE_PLUGINS "enable-plugins"
+#define EPHY_PREFS_WEB_ENABLE_SPELL_CHECKING "enable-spell-checking"
+#define EPHY_PREFS_WEB_ENABLE_WEBGL "enable-webgl"
+#define EPHY_PREFS_WEB_ENABLE_WEBAUDIO "enable-webaudio"
+#define EPHY_PREFS_WEB_ENABLE_SMOOTH_SCROLLING "enable-smooth-scrolling"
+#define EPHY_PREFS_WEB_USER_AGENT "user-agent"
+#define EPHY_PREFS_WEB_COOKIES_POLICY "cookies-policy"
+#define EPHY_PREFS_WEB_DEFAULT_ENCODING "default-encoding"
+#define EPHY_PREFS_WEB_DO_NOT_TRACK "do-not-track"
+#define EPHY_PREFS_WEB_ENABLE_ADBLOCK "enable-adblock"
+#define EPHY_PREFS_WEB_REMEMBER_PASSWORDS "remember-passwords"
+#define EPHY_PREFS_WEB_ENABLE_SITE_SPECIFIC_QUIRKS "enable-site-specific-quirks"
+#define EPHY_PREFS_WEB_ENABLE_SAFE_BROWSING "enable-safe-browsing"
+#define EPHY_PREFS_WEB_GSB_API_KEY "gsb-api-key"
+#define EPHY_PREFS_WEB_DEFAULT_ZOOM_LEVEL "default-zoom-level"
+#define EPHY_PREFS_WEB_ENABLE_AUTOSEARCH "enable-autosearch"
+#define EPHY_PREFS_WEB_ENABLE_MOUSE_GESTURES "enable-mouse-gestures"
+#define EPHY_PREFS_WEB_LAST_UPLOAD_DIRECTORY "last-upload-directory"
+#define EPHY_PREFS_WEB_LAST_DOWNLOAD_DIRECTORY "last-download-directory"
+#define EPHY_PREFS_WEB_HARDWARE_ACCELERATION_POLICY "hardware-acceleration-policy"
static const char * const ephy_prefs_web_schema[] = {
EPHY_PREFS_WEB_FONT_MIN_SIZE,
@@ -146,6 +154,7 @@ static const char * const ephy_prefs_web_schema[] = {
EPHY_PREFS_WEB_ENABLE_MOUSE_GESTURES,
EPHY_PREFS_WEB_LAST_UPLOAD_DIRECTORY,
EPHY_PREFS_WEB_LAST_DOWNLOAD_DIRECTORY,
+ EPHY_PREFS_WEB_HARDWARE_ACCELERATION_POLICY,
};
#define EPHY_PREFS_SCHEMA "org.gnome.Epiphany"
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]