[Webkit-unassigned] [Bug 159928] [GStreamer] Support a direct GPU-to-GPU copy of video textures to WebGL

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Sep 22 01:04:13 PDT 2016


https://bugs.webkit.org/show_bug.cgi?id=159928

--- Comment #15 from Carlos Garcia Campos <cgarcia at igalia.com> ---
Comment on attachment 289463
  --> https://bugs.webkit.org/attachment.cgi?id=289463
Patch

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

> Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:700
> +bool MediaPlayerPrivateGStreamerBase::paintToCairoSurface(RefPtr<cairo_surface_t> outputSurface, cairo_device_t* device, GstVideoInfo* videoInfo)

I don't think you need to pass the smart pointer to this function, and in that case I would pass a reference instead of a copy, but I think you can simply pass the pointer.

> Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:702
> +    // m_sampleMutex should be locked by the caller

I would move this comment before the function, saying something like: // This should be called with the sample mutex locked.

> Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:710
> -    IntSize size = IntSize(GST_VIDEO_INFO_WIDTH(&videoInfo), GST_VIDEO_INFO_HEIGHT(&videoInfo));
> +    IntSize size = IntSize(GST_VIDEO_INFO_WIDTH(videoInfo), GST_VIDEO_INFO_HEIGHT(videoInfo));

Both callers do this, maybe you could pass this as a const reference.

> Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:713
>      IntSize rotatedSize = m_videoSourceOrientation.usesWidthAsHeight() ? size.transposedSize() : size;

Ditto.

> Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:773
> +    GLContext* glContext = PlatformDisplay::sharedDisplayForCompositing().sharingGLContext();
> +    cairo_device_t* device = glContext->cairoDevice();
> +
> +    // Thread-awareness is a huge performance hit on non-Intel drivers.
> +    cairo_gl_device_set_thread_aware(device, FALSE);
> +
> +    IntSize size = IntSize(GST_VIDEO_INFO_WIDTH(&videoInfo), GST_VIDEO_INFO_HEIGHT(&videoInfo));
> +    IntSize rotatedSize = m_videoSourceOrientation.usesWidthAsHeight() ? size.transposedSize() : size;
> +

Don't you need to make the context current in this case?

> Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:813
> +    GstVideoInfo videoInfo;
> +    WTF::GMutexLocker<GMutex> lock(m_sampleMutex);
> +    if (!getSampleVideoInfo(m_sample.get(), videoInfo))
> +        return nullptr;
> +
> +    GLContext* context = PlatformDisplay::sharedDisplayForCompositing().sharingGLContext();
> +    context->makeContextCurrent();
> +    cairo_device_t* device = context->cairoDevice();
> +
> +    // Thread-awareness is a huge performance hit on non-Intel drivers.
> +    cairo_gl_device_set_thread_aware(device, FALSE);
> +
> +    IntSize size = IntSize(GST_VIDEO_INFO_WIDTH(&videoInfo), GST_VIDEO_INFO_HEIGHT(&videoInfo));
> +    IntSize rotatedSize = m_videoSourceOrientation.usesWidthAsHeight() ? size.transposedSize() : size;

All this is mostly duplicated code, could we move it to a helper function? maybe a function that prepares the context and returns the GLContext as return value, and video info, and sizes as output parameters

> Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:119
> +    bool paintToCairoSurface(RefPtr<cairo_surface_t> outputSurface, cairo_device_t*, GstVideoInfo*);

This should be private.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.webkit.org/pipermail/webkit-unassigned/attachments/20160922/2d07af3a/attachment.html>


More information about the webkit-unassigned mailing list