Bug 165300 - [GTK] Process accelerated compositing env variables only if they are really enabled
Summary: [GTK] Process accelerated compositing env variables only if they are really e...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKitGTK (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Tomas Popela
URL:
Keywords:
Depends on: 165501
Blocks:
  Show dependency treegraph
 
Reported: 2016-12-02 04:26 PST by Tomas Popela
Modified: 2016-12-08 05:40 PST (History)
3 users (show)

See Also:


Attachments
Patch (1.79 KB, patch)
2016-12-02 04:30 PST, Tomas Popela
no flags Details | Formatted Diff | Diff
Patch (1.72 KB, patch)
2016-12-05 02:48 PST, Tomas Popela
no flags Details | Formatted Diff | Diff
Patch (1.84 KB, patch)
2016-12-08 03:46 PST, Tomas Popela
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Tomas Popela 2016-12-02 04:26:17 PST
Only process WEBKIT_FORCE_COMPOSITING_MODE and WEBKIT_DISABLE_COMPOSITING_MODE env variables if they are really enabled (eg. WEBKIT_DISABLE_COMPOSITING_MODE=1) and ignore others (eg. WEBKIT_DISABLE_COMPOSITING_MODE=0). This will help WebKitGTK+ consumers to be able to not disable AC through the env variable if the user wants the AC to be turned on (he will usually have "export WEBKIT_DISABLE_COMPOSITING_MODE=0" somewhere).
Comment 1 Tomas Popela 2016-12-02 04:30:24 PST
Created attachment 295940 [details]
Patch
Comment 2 Michael Catanzaro 2016-12-02 08:39:56 PST
Comment on attachment 295940 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=295940&action=review

> Source/WebKit2/UIProcess/gtk/WebPreferencesGtk.cpp:50
> -    if (getenv("WEBKIT_FORCE_COMPOSITING_MODE"))
> +    if (!g_strcmp0(getenv("WEBKIT_FORCE_COMPOSITING_MODE"), "1"))

How about if (g_strcmp0(getenv("WEBKIT_FORCE_COMPOSITING_MODE"), "0")), that way you can disable it by setting it to 0, but set it to anything else and it'd still be enabled? That seems more familiar to me; what do other popular applications do?

> Source/WebKit2/UIProcess/gtk/WebPreferencesGtk.cpp:54
> -    if (getenv("WEBKIT_DISABLE_COMPOSITING_MODE")) {
> +    if (!g_strcmp0(getenv("WEBKIT_DISABLE_COMPOSITING_MODE"), "1")) {

Ditto.
Comment 3 Tomas Popela 2016-12-05 02:16:30 PST
(In reply to comment #2)
> Comment on attachment 295940 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=295940&action=review
> 
> > Source/WebKit2/UIProcess/gtk/WebPreferencesGtk.cpp:50
> > -    if (getenv("WEBKIT_FORCE_COMPOSITING_MODE"))
> > +    if (!g_strcmp0(getenv("WEBKIT_FORCE_COMPOSITING_MODE"), "1"))
> 
> How about if (g_strcmp0(getenv("WEBKIT_FORCE_COMPOSITING_MODE"), "0")), that
> way you can disable it by setting it to 0, but set it to anything else and
> it'd still be enabled? That seems more familiar to me; what do other popular
> applications do?

Could be as I don't have a strong preference on any of them. I don't any env variable apart from gtk's GTK_OVERLAY_SCROLLING:

gtk/gtkscrolledwindow.c:4415:  if (g_strcmp0 (g_getenv ("GTK_OVERLAY_SCROLLING"), "0") == 0)
 
and that behaves the same way you described.. Let's rework the patch :)..
Comment 4 Tomas Popela 2016-12-05 02:48:23 PST
Created attachment 296135 [details]
Patch
Comment 5 Michael Catanzaro 2016-12-05 03:48:05 PST
Comment on attachment 296135 [details]
Patch

This way also avoids breaking previous instructions. I doubt anybody was dumb enough to define WEBKIT_FORCE_COMPOSITING_MODE=0 and expect to get compositing mode, but it's not hard to imagine someone using WEBKIT_FORCE_COMPOSITING_MODE= or something.
Comment 6 Tomas Popela 2016-12-06 04:16:38 PST
Comment on attachment 296135 [details]
Patch

Clearing flags on attachment: 296135

Committed r209391: <http://trac.webkit.org/changeset/209391>
Comment 7 Tomas Popela 2016-12-06 04:16:47 PST
All reviewed patches have been landed.  Closing bug.
Comment 8 WebKit Commit Bot 2016-12-06 16:38:28 PST
Re-opened since this is blocked by bug 165501
Comment 9 Michael Catanzaro 2016-12-07 05:27:00 PST
Sorry about the bad advice, Tom. :)  To do it properly you'll need to check if the env variable is set, and then use plain strcmp instead of g_strcmp0 only if it's set, like Milan suggested.
Comment 10 Tomas Popela 2016-12-08 03:46:19 PST
Created attachment 296508 [details]
Patch
Comment 11 Tomas Popela 2016-12-08 05:40:19 PST
Comment on attachment 296508 [details]
Patch

Clearing flags on attachment: 296508

Committed r209534: <http://trac.webkit.org/changeset/209534>
Comment 12 Tomas Popela 2016-12-08 05:40:28 PST
All reviewed patches have been landed.  Closing bug.