Closed Bug 1583731 Opened 4 months ago Closed 3 months ago

[Wayland] Implement Wayland DMABuf texture backend for WebRender

Categories

(Core :: Graphics: WebRender, enhancement, P3)

enhancement

Tracking

()

RESOLVED FIXED
mozilla71
Tracking Status
firefox71 --- fixed

People

(Reporter: stransky, Assigned: stransky)

References

(Blocks 3 open bugs)

Details

Attachments

(3 files, 1 obsolete file)

We need to extent Wayland DMABuf texture backend (Bug 1578380) for WebRenderer.

Blocks: wr-linux
Priority: -- → P3
Summary: [Wayland] Implement Wayland DMABuf texture backend for WebRenderer → [Wayland] Implement Wayland DMABuf texture backend for WebRender
Assignee: nobody → stransky
Attached patch webrender-wayland-dmabuf.patch (obsolete) — Splinter Review

WIP patch, I'm getting this error with it:

Crash Annotation GraphicsCriticalError: |[0][GFX1-]: Failed to compile shader: brush_image
0:1236(27): error: no matching function for call to `textureSize(samplerExternalOES, int)'; candidates are:
0:1236(27): error: int textureSize(sampler1D, int)
0:1236(27): error: int textureSize(isampler1D, int)
0:1236(27): error: int textureSize(usampler1D, int)
....

so it needs more work on the GL side.

Attachment #9098488 - Flags: feedback?(sotaro.ikeda.g)

(In reply to Martin Stránský [:stransky] from comment #1)

Crash Annotation GraphicsCriticalError: |[0][GFX1-]: Failed to compile shader: brush_image
0:1236(27): error: no matching function for call to `textureSize(samplerExternalOES, int)'; candidates are:
0:1236(27): error: int textureSize(sampler1D, int)
0:1236(27): error: int textureSize(isampler1D, int)
0:1236(27): error: int textureSize(usampler1D, int)

I wonde why I get this bug, as GL_OES_EGL_image_external_essl3 is supported on my system and the shader is compiled with

#version 300 es

which is GLES 3.0 which is supposed to support samplerExternalOES.

I see it's https://github.com/servo/webrender/issues/3310
(I added #extension OES_EGL_image_external_essl3 : enable) to shader).

Hm, looks like I do something wrong here. ES3 should be enabled on WebRender, OES_EGL_image_external_essl3 is supported.
When I hardcode:

#define WR_FEATURE_TEXTURE_EXTERNAL 1

to the shader I get:

Hit MOZ_CRASH(Caught GL error 502 at tex_sub_image_3d_pbo) at gfx/wr/webrender/src/device/gl.rs:1253

which does not look correct.

(In reply to Martin Stránský [:stransky] from comment #2)

(In reply to Martin Stránský [:stransky] from comment #1)

Crash Annotation GraphicsCriticalError: |[0][GFX1-]: Failed to compile shader: brush_image
0:1236(27): error: no matching function for call to `textureSize(samplerExternalOES, int)'; candidates are:
0:1236(27): error: int textureSize(sampler1D, int)
0:1236(27): error: int textureSize(isampler1D, int)
0:1236(27): error: int textureSize(usampler1D, int)

Filed as https://gitlab.freedesktop.org/mesa/mesa/issues/1901

Comment on attachment 9098488 [details] [diff] [review]
webrender-wayland-dmabuf.patch

Review of attachment 9098488 [details] [diff] [review]:
-----------------------------------------------------------------

Sorry for my slow feedback. The patch looks good! As in Comment 5, the shader problems seems like a different problem.
I tried to test the patch. But nsWaylandDisplay::IsDMABufEnabled() returned false on my Ubuntu 18.04 by the following. Is there a way to enable DMABuf on Ubuntu 18.04?

https://searchfox.org/mozilla-central/source/widget/gtk/nsWaylandDisplay.cpp#458
>  if (!display->GetGbmFormat(/* aHasAlpha */ false) ||
>      !display->GetGbmFormat(/* aHasAlpha */ true)) {
Attachment #9098488 - Flags: feedback?(sotaro.ikeda.g) → feedback+

Thanks for testing! It should be enough to set widget.wayland_dmabuf_backend.enabled to true at about:config.

Btw. Did that DMABUF init failed with "Failed to create obtain pixel format, DMABUF/DRM won't be available!" ?

(In reply to Martin Stránský [:stransky] from comment #5)

Filed as https://gitlab.freedesktop.org/mesa/mesa/issues/1901

Mesa is fix is on the way so we can proceed here.

To get it working you also need mesa with a patch from https://gitlab.freedesktop.org/mesa/mesa/issues/1901

(In reply to Martin Stránský [:stransky] from comment #8)

Btw. Did that DMABUF init failed with "Failed to create obtain pixel format, DMABUF/DRM won't be available!" ?

On Ubuntu 18.04, dmabuf_modifiers() was not called. It seemed to make nsWaylandDisplay::GetGbmFormat() failure.

(In reply to Sotaro Ikeda [:sotaro] from comment #14)

On Ubuntu 18.04, dmabuf_modifiers() was not called. It seemed to make nsWaylandDisplay::GetGbmFormat() failure.

Yes, that means your Wayland compositor does not support zwp_linux_dmabuf_v1 version 3. It should be at mutter-3.25.90 [1] but I'm not entirely sure the which version. I have mutter-3.32.2 (Fedora 30).

[1] https://github.com/GNOME/mutter/blob/master/NEWS

Attachment #9098488 - Attachment is obsolete: true
Keywords: checkin-needed

Pushed by btara@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/927679118b14
[Wayland] Assert when EGLImage is already created at WaylandDMABufSurface::CreateEGLImage, r=jhorak
https://hg.mozilla.org/integration/autoland/rev/10315b0f4304
[Wayland] Implement RenderWaylandDMABUFTextureHostOGL based on WaylandDMABUFSurface, r=sotaro
https://hg.mozilla.org/integration/autoland/rev/1dfc280e1f0e
[Wayland] Use WebRender WaylandDMABufSurface backend when dmabuf is enabled, r=sotaro

Keywords: checkin-needed
Regressions: 1590536
You need to log in before you can comment on or make changes to this bug.