Bug 214544 - WIP: [GStreamer][GPUProcess] enable GPUProcess through envvar
Summary: WIP: [GStreamer][GPUProcess] enable GPUProcess through envvar
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: Media (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-07-20 01:18 PDT by Víctor M. Jáquez L.
Modified: 2021-03-13 20:26 PST (History)
3 users (show)

See Also:


Attachments
Patch for GPUProcess enabling (9.06 KB, patch)
2020-07-20 01:18 PDT, Víctor M. Jáquez L.
no flags Details | Formatted Diff | Diff
WIP: enable GPUProcess capture devices with envvar (1.93 KB, patch)
2020-07-23 03:45 PDT, Víctor M. Jáquez L.
no flags Details | Formatted Diff | Diff
WIP: a mechanism to enable the GPUProcess with an envvar (5.22 KB, patch)
2020-08-05 09:26 PDT, Víctor M. Jáquez L.
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Víctor M. Jáquez L. 2020-07-20 01:18:37 PDT
Created attachment 404700 [details]
Patch for GPUProcess enabling

This is just a RFC of how to enable GPUProcess in webkitgtk/wpe.

Is this approach correct?
Comment 1 Carlos Garcia Campos 2020-07-20 01:39:57 PDT
Comment on attachment 404700 [details]
Patch for GPUProcess enabling

I don't think we want to expose a setting in the API for this. Should the user decide about this and in a per web view basis?
Comment 2 Víctor M. Jáquez L. 2020-07-20 01:56:56 PDT
(In reply to Carlos Garcia Campos from comment #1)
> Comment on attachment 404700 [details]
> Patch for GPUProcess enabling
> 
> I don't think we want to expose a setting in the API for this. Should the
> user decide about this and in a per web view basis?

As far as I understand Mac code, it is decided by the user 
https://github.com/WebKit/webkit/blob/master/Source/WebKitLegacy/mac/WebView/WebView.mm#L3411

And, even it is configured per web view, it looks like a global thing.


Also, I wonder if I should approach to use Pipewire for capture devices in GPUProcess rather than GStreamer as it is now.
Comment 3 Víctor M. Jáquez L. 2020-07-20 02:18:08 PDT
(In reply to Víctor M. Jáquez L. from comment #2)
> Also, I wonder if I should approach to use Pipewire for capture devices in
> GPUProcess rather than GStreamer as it is now.

Phil commented it's too early to migrate to pipewire, in his opinion, since we need a very recent xdg-desktop-portal + working pipewire 0.3 daemon on the host, and in the SDK the versions used at too old currently.
Comment 4 Víctor M. Jáquez L. 2020-07-20 02:53:01 PDT
(In reply to Carlos Garcia Campos from comment #1)
> Comment on attachment 404700 [details]
> Patch for GPUProcess enabling
> 
> I don't think we want to expose a setting in the API for this.

Which other mechanisms do we have for handling these optional settings?
Comment 5 Philippe Normand 2020-07-20 03:10:47 PDT
Maybe instead of a setting you could enable the GPU process only when mediastream is being enabled? Because for the time being my understanding is that this process will be used only for capture devices in WPE/GTK.
Comment 6 Carlos Garcia Campos 2020-07-20 07:37:27 PDT
Right, I need to understand what the gpu process is for to answer the question. If the gpu process will handle all media eventually, (like network process handles networking) and we want a setting because it's not complete yet, then I don't think we want to expose a setting to decide, we can use internal API in WebProcessPool and use an env var or whatever to enable/disable it. If it's something the user really has to decide, then the user need to understand what the gpu process is to, know whether to enable it or not and when. If it's a global setting, it fits better as WebKitWebContext API, not a setting.
Comment 7 Víctor M. Jáquez L. 2020-07-23 03:45:38 PDT
Created attachment 405031 [details]
WIP: enable GPUProcess capture devices with envvar

This is another approach, using a environment variable, but not WebProcessPool, but in WebPreferencesDefaultValues.

This approach indeed enables the GPUProcess, and surprisingly, the camera stream is processed, though it does not live in the GPUProces but in the old WebProcess :(

Does this approach is more acceptable?
Comment 8 Carlos Garcia Campos 2020-07-23 03:51:10 PDT
Yes, but it's not at the right place. Check the env vars in WebPreferences::platformInitializeStore() (in WebPreferencesGtk.cpp and you will have to add one for WPE) and just set the appropriate value for the preferences according to the env var.
Comment 9 Víctor M. Jáquez L. 2020-08-05 09:26:46 PDT
Created attachment 406007 [details]
WIP: a mechanism to enable the GPUProcess with an envvar

I think this approach is correct.
Comment 10 Philippe Normand 2020-08-06 01:11:12 PDT
Comment on attachment 406007 [details]
WIP: a mechanism to enable the GPUProcess with an envvar

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

> Source/WebKit/UIProcess/wpe/WebPreferencesWPE.cpp:33
> +    bool webrtcEnableGPUProcess = (std::getenv("WEBKIT_WEBRTC_ENABLE_GPU_PROCESS") != nullptr);

Perhaps check the env var contents too?