3131#endif
3232
3333#if !defined(_WIN32) && !defined(__APPLE__)
34+ #include < obs-nix-platform.h>
35+
3436#include " drm-format.hpp"
3537#endif
3638
@@ -369,6 +371,7 @@ void BrowserClient::OnAcceleratedPaint(CefRefPtr<CefBrowser>, PaintElementType t
369371 return ;
370372
371373 struct obs_cef_video_format format = obs_cef_format_from_cef_type (info.format );
374+ uint64_t modifier = info.modifier ;
372375
373376 if (format.gs_format == GS_UNKNOWN)
374377 return ;
@@ -378,14 +381,19 @@ void BrowserClient::OnAcceleratedPaint(CefRefPtr<CefBrowser>, PaintElementType t
378381 uint64_t *modifiers = (uint64_t *)alloca (info.plane_count * sizeof (uint64_t ));
379382 int *fds = (int *)alloca (info.plane_count * sizeof (int ));
380383
384+ /* NOTE: This a workaround under X11 where the modifier is always invalid where it can mean "no modifier" in
385+ * Chromium's code. */
386+ if (obs_get_nix_platform () == OBS_NIX_PLATFORM_X11_EGL && modifier == DRM_FORMAT_MOD_INVALID)
387+ modifier = DRM_FORMAT_MOD_LINEAR;
388+
381389 for (size_t i = 0 ; i < kAcceleratedPaintMaxPlanes ; i++) {
382390 auto *plane = &info.planes [i];
383391
384392 strides[i] = plane->stride ;
385393 offsets[i] = plane->offset ;
386394 fds[i] = plane->fd ;
387395
388- modifiers[i] = info. modifier ;
396+ modifiers[i] = modifier;
389397 }
390398#endif
391399
@@ -423,7 +431,7 @@ void BrowserClient::OnAcceleratedPaint(CefRefPtr<CefBrowser>, PaintElementType t
423431#else
424432 bs->texture = gs_texture_create_from_dmabuf (bs->width , bs->height , format.drm_format , format.gs_format ,
425433 info.plane_count , fds, strides, offsets,
426- info. modifier != DRM_FORMAT_MOD_INVALID ? modifiers : NULL );
434+ modifier != DRM_FORMAT_MOD_INVALID ? modifiers : NULL );
427435#endif
428436 UpdateExtraTexture ();
429437 obs_leave_graphics ();
0 commit comments