Bug 208572

Summary: [GStreamer][GL] External OES textures rendering support
Product: WebKit Reporter: Philippe Normand <pnormand>
Component: PlatformAssignee: Philippe Normand <pnormand>
Status: RESOLVED FIXED    
Severity: Normal CC: calvaris, cgarcia, cmarcelo, eric.carlson, ews-watchlist, glenn, gustavo, jer.noble, kondapallykalyan, luiz, magomez, menard, noam, philipj, sergio, vjaquez, webkit-bug-importer, zan
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch
none
Patch
none
Patch zan: review+

Description Philippe Normand 2020-03-04 07:10:36 PST
.
Comment 1 Philippe Normand 2020-03-04 07:16:15 PST
Created attachment 392412 [details]
Patch
Comment 2 Philippe Normand 2020-03-04 07:21:09 PST
Checking GTK build.
Comment 3 Xabier Rodríguez Calvar 2020-03-04 07:52:53 PST
Comment on attachment 392412 [details]
Patch

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

This looks good from the GStreamer perspective but maybe some other people with more graphics proficiency could have another look.

> Source/WebCore/platform/graphics/gstreamer/GLVideoSinkGStreamer.cpp:235
> -    gst_pad_add_probe(pad.get(), static_cast<GstPadProbeType>(GST_PAD_PROBE_TYPE_PUSH | GST_PAD_PROBE_TYPE_QUERY_DOWNSTREAM | GST_PAD_PROBE_TYPE_EVENT_FLUSH), [] (GstPad*, GstPadProbeInfo* info,  gpointer userData) -> GstPadProbeReturn {
> +    gst_pad_add_probe(pad.get(), static_cast<GstPadProbeType>(GST_PAD_PROBE_TYPE_PUSH | GST_PAD_PROBE_TYPE_QUERY_DOWNSTREAM | GST_PAD_PROBE_TYPE_EVENT_FLUSH), [] (GstPad* pad, GstPadProbeInfo* info,  gpointer userData) -> GstPadProbeReturn {
> +

These change seems to be unnecessary.
Comment 4 Philippe Normand 2020-03-04 08:15:12 PST
Comment on attachment 392412 [details]
Patch

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

> Source/WebCore/platform/graphics/texmap/TextureMapperShaderProgram.cpp:173
> +    GLSL_DIRECTIVE(extension GL_OES_EGL_image_external : require)

This and the sampler declaration break GTK at runtime. The shader seems to fail to compile but no error is reported.
Comment 5 Philippe Normand 2020-03-04 09:53:15 PST
Created attachment 392430 [details]
Patch
Comment 6 Philippe Normand 2020-03-04 09:55:32 PST
Created attachment 392431 [details]
Patch
Comment 7 Zan Dobersek 2020-03-05 02:23:46 PST
Comment on attachment 392431 [details]
Patch

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

> Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:331
> -            return makeUnique<Buffer>(Buffer::TextureVariant { Buffer::RGBTexture { *static_cast<GLuint*>(m_videoFrame.data[0]) } }, m_size, m_flags, GL_RGBA);
> +            return makeUnique<Buffer>(Buffer::TextureVariant { Buffer::RGBTexture { m_textureID } }, m_size, m_flags, GL_RGBA);

For a separate patch: we could maybe drop m_textureID in favor of using m_videoFrame.data directly.

> Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:394
> +    GstGLTextureTarget m_textureTarget;

This could be default-initialized to `GST_GL_TEXTURE_TARGET_NONE`.

> Source/WebCore/platform/graphics/texmap/TextureMapperShaderProgram.cpp:178
> +    OES_EGL_IMAGE_EXTERNAL_DIRECTIVE

I think this directive should be written only if the program options demand it.
Comment 8 Philippe Normand 2020-03-05 03:06:14 PST
Created attachment 392553 [details]
Patch
Comment 9 Zan Dobersek 2020-03-10 01:10:31 PDT
Comment on attachment 392553 [details]
Patch

LGTM.
Comment 10 Philippe Normand 2020-03-10 05:09:13 PDT
Committed r258197: <https://trac.webkit.org/changeset/258197>
Comment 11 Radar WebKit Bug Importer 2020-03-10 05:10:13 PDT
<rdar://problem/60269338>