Upstream commit: https://webrtc.googlesource.com/src/+/0eed0180f3477fc96e21a1fb8ddd2dae0cb23a40 Avoid copies when passing heavy objects by value - Introduced move constructors to SdpVideoFormat and Codec. - Addressed a few stray places where objects were copied. Bug: webrtc:374845009 Change-Id: Id8b558e49441f3e537ca385337bf1d0bb045975c Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/493760 Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org> Commit-Queue: Fredrik Solenberg <solenberg@webrtc.org> Cr-Commit-Position: refs/heads/main@{#48320}
75 lines
3.0 KiB
Diff
75 lines
3.0 KiB
Diff
From: Jan Grulich <jgrulich@redhat.com>
|
|
Date: Fri, 10 Mar 2023 09:21:00 +0000
|
|
Subject: Bug 1819035 - get EGL display based on the used platform in the
|
|
browser r=webrtc-reviewers,ng
|
|
|
|
Because of a possible misconfiguration or a possible driver issue it
|
|
might happen that the browser will use a different driver on X11 and
|
|
end up using yet another one for wayland/gbm, which might lead to not
|
|
working screen sharing in the better case, but also to a crash in the
|
|
other driver (Nvidia). This adds a check for platform the browser runs
|
|
on, if it's XWayland or Wayland and based on that query EGL display for
|
|
that specific platform, rather than going for the Wayland one only.
|
|
|
|
Differential Revision: https://phabricator.services.mozilla.com/D171858
|
|
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/c8606497de1f461a6352456e0e511c2ae498d526
|
|
---
|
|
.../linux/wayland/egl_dmabuf.cc | 30 +++++++++++++++++--
|
|
1 file changed, 28 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/modules/desktop_capture/linux/wayland/egl_dmabuf.cc b/modules/desktop_capture/linux/wayland/egl_dmabuf.cc
|
|
index 2a80bd4ed3..5d7e22e569 100644
|
|
--- a/modules/desktop_capture/linux/wayland/egl_dmabuf.cc
|
|
+++ b/modules/desktop_capture/linux/wayland/egl_dmabuf.cc
|
|
@@ -19,6 +19,7 @@
|
|
#include <dlfcn.h>
|
|
#include <fcntl.h>
|
|
#include <gbm.h>
|
|
+#include <gdk/gdk.h>
|
|
#include <libdrm/drm_fourcc.h>
|
|
#include <spa/param/video/raw.h>
|
|
#include <sys/stat.h>
|
|
@@ -239,6 +240,26 @@ static void CloseLibrary(void* library) {
|
|
}
|
|
}
|
|
|
|
+static bool IsWaylandDisplay() {
|
|
+ static auto sGdkWaylandDisplayGetType =
|
|
+ (GType (*)(void))dlsym(RTLD_DEFAULT, "gdk_wayland_display_get_type");
|
|
+ if (!sGdkWaylandDisplayGetType) {
|
|
+ return false;
|
|
+ }
|
|
+ return (G_TYPE_CHECK_INSTANCE_TYPE ((gdk_display_get_default()),
|
|
+ sGdkWaylandDisplayGetType()));
|
|
+}
|
|
+
|
|
+static bool IsX11Display() {
|
|
+ static auto sGdkX11DisplayGetType =
|
|
+ (GType (*)(void))dlsym(RTLD_DEFAULT, "gdk_x11_display_get_type");
|
|
+ if (!sGdkX11DisplayGetType) {
|
|
+ return false;
|
|
+ }
|
|
+ return (G_TYPE_CHECK_INSTANCE_TYPE ((gdk_display_get_default()),
|
|
+ sGdkX11DisplayGetType()));
|
|
+}
|
|
+
|
|
RTC_NO_SANITIZE("cfi-icall")
|
|
static std::vector<std::string> GetClientExtensions(EGLDisplay display,
|
|
EGLint name) {
|
|
@@ -817,8 +838,13 @@ RTC_NO_SANITIZE("cfi-icall")
|
|
bool EglDmaBuf::CreatePlatformDevice() {
|
|
EGLDisplay display = EGL_NO_DISPLAY;
|
|
|
|
- display = EglGetPlatformDisplay(EGL_PLATFORM_WAYLAND_KHR,
|
|
- (void*)EGL_DEFAULT_DISPLAY, nullptr);
|
|
+ if (IsWaylandDisplay()) {
|
|
+ display = EglGetPlatformDisplay(EGL_PLATFORM_WAYLAND_KHR,
|
|
+ (void*)EGL_DEFAULT_DISPLAY, nullptr);
|
|
+ } else if (IsX11Display()) {
|
|
+ display = EglGetPlatformDisplay(EGL_PLATFORM_X11_KHR,
|
|
+ (void*)EGL_DEFAULT_DISPLAY, nullptr);
|
|
+ }
|
|
|
|
if (display == EGL_NO_DISPLAY) {
|
|
RTC_LOG(LS_ERROR) << "Failed to obtain platform EGL display: "
|