WebKit Bugzilla
Attachment 373009 Details for
Bug 196966
: [GL][GStreamer] activate wrapped shared context
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-196966-20190627100052.patch (text/plain), 7.78 KB, created by
Víctor M. Jáquez L.
on 2019-06-27 01:00:24 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Víctor M. Jáquez L.
Created:
2019-06-27 01:00:24 PDT
Size:
7.78 KB
patch
obsolete
>Subversion Revision: 246835 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index e3c86f6388fa5a1c20eb155a981ce69076ba0414..42a5ae243bb530acbc9cee77eb7c5f00a6ba55b1 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,38 @@ >+2019-06-27 VÃctor Manuel Jáquez Leal <vjaquez@igalia.com> >+ >+ [GL][GStreamer] activate wrapped shared context >+ https://bugs.webkit.org/show_bug.cgi?id=196966 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ This patch consists in two parts: >+ >+ 1\ When the media player is instantiaded, and it is intended to >+ render textures, it will use a wrapped object of the application's >+ GL context, and in order to populate the wrapped object with the >+ GL vtable, the context has to be current. Thus, this patch makes >+ current the shared WebKit application context, and populate the >+ wrapped GstGLContext by activating it and filling in it. >+ >+ 2\ Also this patch makes GL texture use the RGBA color space, thus >+ the color transformation is done in GStreamer, and no further color >+ transformation is required in WebKit. >+ >+ No new tests because there is no behavior change. >+ >+ * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp: >+ (WebCore::MediaPlayerPrivateGStreamerBase::ensureGstGLContext): >+ Intializes the wrapped GL Context. >+ (WebCore::MediaPlayerPrivateGStreamerBase::updateTextureMapperFlags): >+ Removes color convertion. >+ (WebCore::MediaPlayerPrivateGStreamerBase::createVideoSinkGL): >+ Instead of parsing a string, the GstCaps are created manually, and >+ it is set to appsink, rather than a filtered linking. >+ * platform/graphics/gstreamer/VideoTextureCopierGStreamer.cpp: >+ (WebCore::VideoTextureCopierGStreamer::updateColorConversionMatrix): >+ Adds NoConvert option to texture copierx. >+ * platform/graphics/gstreamer/VideoTextureCopierGStreamer.h: >+ > 2019-06-25 Fujii Hironori <Hironori.Fujii@sony.com> > > [WinCairo] incorrect font height for 'Google Sans Display' font >diff --git a/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp b/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp >index d03d4b58a9abcd47ec1da5978c2db04f286361ed..12cc0970724dfcf8480b704954f4b518fd7d5b60 100644 >--- a/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp >+++ b/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp >@@ -54,19 +54,10 @@ > #endif > > #if USE(GSTREAMER_GL) >-#if G_BYTE_ORDER == G_LITTLE_ENDIAN >-#define GST_GL_CAPS_FORMAT "{ BGRx, BGRA }" >-#define TEXTURE_MAPPER_COLOR_CONVERT_FLAG TextureMapperGL::ShouldConvertTextureBGRAToRGBA >-#define TEXTURE_COPIER_COLOR_CONVERT_FLAG VideoTextureCopierGStreamer::ColorConversion::ConvertBGRAToRGBA >-#else >-#define GST_GL_CAPS_FORMAT "{ xRGB, ARGB }" >-#define TEXTURE_MAPPER_COLOR_CONVERT_FLAG TextureMapperGL::ShouldConvertTextureARGBToRGBA >-#define TEXTURE_COPIER_COLOR_CONVERT_FLAG VideoTextureCopierGStreamer::ColorConversion::ConvertARGBToRGBA >-#endif >+#define TEXTURE_COPIER_COLOR_CONVERT_FLAG VideoTextureCopierGStreamer::ColorConversion::NoConvert > > #include <gst/app/gstappsink.h> > >- > #include "GLContext.h" > #if USE(GLX) > #include "GLContextGLX.h" >@@ -466,6 +457,18 @@ bool MediaPlayerPrivateGStreamerBase::ensureGstGLContext() > else > m_glContext = gst_gl_context_new_wrapped(m_glDisplay.get(), reinterpret_cast<guintptr>(contextHandle), glPlatform, glAPI); > >+ // Activate and fill the GStreamer wrapped context with the Webkit's shared one. >+ auto previousActiveContext = GLContext::current(); >+ webkitContext->makeContextCurrent(); >+ if (gst_gl_context_activate(m_glContext.get(), TRUE)) { >+ GUniqueOutPtr<GError> error; >+ if (!gst_gl_context_fill_info(m_glContext.get(), &error.outPtr())) >+ GST_WARNING("Failed to fill in GStreamer context: %s", error->message); >+ } else >+ GST_WARNING("Failed to activate GStreamer context %" GST_PTR_FORMAT, m_glContext.get()); >+ if (previousActiveContext) >+ previousActiveContext->makeContextCurrent(); >+ > return true; > } > #endif // USE(GSTREAMER_GL) >@@ -984,14 +987,6 @@ void MediaPlayerPrivateGStreamerBase::updateTextureMapperFlags() > m_textureMapperFlags = 0; > break; > } >- >-#if USE(GSTREAMER_GL) >- // When the imxvpudecoder is used, the texture sampling of the >- // directviv-uploaded texture returns an RGB value, so there's no need to >- // convert it. >- if (m_videoDecoderPlatform != WebKitGstVideoDecoderPlatform::ImxVPU) >- m_textureMapperFlags |= TEXTURE_MAPPER_COLOR_CONVERT_FLAG; >-#endif > } > #endif > >@@ -1056,6 +1051,10 @@ GstElement* MediaPlayerPrivateGStreamerBase::createVideoSinkGL() > GstElement* colorconvert = gst_element_factory_make("glcolorconvert", nullptr); > GstElement* appsink = createGLAppSink(); > >+ // glsinkbin is not used because it includes glcolorconvert which only process RGBA, >+ // but in the future it would be possible to render YUV formats too: >+ // https://bugs.webkit.org/show_bug.cgi?id=132869 >+ > if (!appsink || !upload || !colorconvert) { > GST_WARNING("Failed to create GstGL elements"); > gst_object_unref(videoSink); >@@ -1073,10 +1072,11 @@ GstElement* MediaPlayerPrivateGStreamerBase::createVideoSinkGL() > > gst_bin_add_many(GST_BIN(videoSink), upload, colorconvert, appsink, nullptr); > >- GRefPtr<GstCaps> caps = adoptGRef(gst_caps_from_string("video/x-raw(" GST_CAPS_FEATURE_MEMORY_GL_MEMORY "), format = (string) " GST_GL_CAPS_FORMAT)); >+ GRefPtr<GstCaps> caps = adoptGRef(gst_caps_new_simple("video/x-raw", "format", G_TYPE_STRING, "RGBA", nullptr)); >+ gst_caps_set_features(caps.get(), 0, gst_caps_features_new(GST_CAPS_FEATURE_MEMORY_GL_MEMORY, nullptr)); >+ g_object_set(appsink, "caps", caps.get(), nullptr); > >- result &= gst_element_link_pads(upload, "src", colorconvert, "sink"); >- result &= gst_element_link_pads_filtered(colorconvert, "src", appsink, "sink", caps.get()); >+ result &= gst_element_link_many(upload, colorconvert, appsink, nullptr); > > GRefPtr<GstPad> pad = adoptGRef(gst_element_get_static_pad(upload, "sink")); > gst_element_add_pad(videoSink, gst_ghost_pad_new("sink", pad.get())); >diff --git a/Source/WebCore/platform/graphics/gstreamer/VideoTextureCopierGStreamer.cpp b/Source/WebCore/platform/graphics/gstreamer/VideoTextureCopierGStreamer.cpp >index 135333ea1b515eb5f5101cba56dbd672d80837df..f519b03ceb7561b89e815f0fdd1836f92df98f53 100644 >--- a/Source/WebCore/platform/graphics/gstreamer/VideoTextureCopierGStreamer.cpp >+++ b/Source/WebCore/platform/graphics/gstreamer/VideoTextureCopierGStreamer.cpp >@@ -84,6 +84,9 @@ void VideoTextureCopierGStreamer::updateColorConversionMatrix(ColorConversion co > case ColorConversion::ConvertARGBToRGBA: > m_colorConversionMatrix.setMatrix(0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 1.0, 0.0, 0.0, 0.0); > break; >+ case ColorConversion::NoConvert: >+ m_colorConversionMatrix.makeIdentity(); >+ break; > default: > RELEASE_ASSERT_NOT_REACHED(); > } >diff --git a/Source/WebCore/platform/graphics/gstreamer/VideoTextureCopierGStreamer.h b/Source/WebCore/platform/graphics/gstreamer/VideoTextureCopierGStreamer.h >index ed1d58f76cf642adb461de98a928208d35f5cfee..20fb663ef124310166547f402ce76303e0c71515 100644 >--- a/Source/WebCore/platform/graphics/gstreamer/VideoTextureCopierGStreamer.h >+++ b/Source/WebCore/platform/graphics/gstreamer/VideoTextureCopierGStreamer.h >@@ -36,7 +36,8 @@ class VideoTextureCopierGStreamer { > public: > enum class ColorConversion { > ConvertBGRAToRGBA, >- ConvertARGBToRGBA >+ ConvertARGBToRGBA, >+ NoConvert, > }; > > VideoTextureCopierGStreamer(ColorConversion);
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 196966
:
367520
|
373009
|
373013
|
373028
|
373228
|
373245
|
375229
|
375617