Commit graph

1404 commits

Author SHA1 Message Date
Matthew Waters
bf98930546 gl: sprinkle some debug markers to ease debugging 2017-12-09 19:32:08 +00:00
Matthew Waters
c486b1b3b0 gl/utils: add a function to insert a debug marker
These markers are visible in tools that record the GL function calls
such as apitrace, et al.

Makes it easier to match up GL draw commands with specific elements.
2017-12-09 19:32:08 +00:00
Matthew Waters
ec99383a21 gl: add some debugging prototypes 2017-12-09 19:32:08 +00:00
Matthew Waters
e9864e2e3e glwindow: remove unused draw_unlocked function
The functionality is provided by draw anyway and is leftover from
X11's specific threading requirements that no longer apply.
2017-12-09 19:32:08 +00:00
Julien Isorce
231e91c883 glfilter: use GL_ELEMENT_ARRAY_BUFFER for vbo indices
Fixes this error with chromium gpu process:
GL_INVALID_OPERATION, glBindBuffer: buffer bound to more than 1 target

https://bugzilla.gnome.org/show_bug.cgi?id=755618
2017-12-09 19:32:08 +00:00
Julien Isorce
d0bc54956d glmemory: fix texture leak in _gl_mem_copy
https://bugzilla.gnome.org/show_bug.cgi?id=755456
2017-12-09 19:32:08 +00:00
Matthew Waters
6de7db9a4e gl/dispmanx: fix rendering with recent resize state tracking
557ca6fda5 didn't change to the
necessary gst_gl_window_resize() call for the dispmanx backend.
2017-12-09 19:32:08 +00:00
Matthew Waters
718318ce19 gl/caopengllayer: fix non-existent selector warning
557ca6fda5 introduced the queueResize
call without implementing the selector
2017-12-09 19:32:08 +00:00
Jan Schmidt
6b67fdf2ef glwindow: Fix g_return_val_if_fail in a void function 2017-12-09 19:32:08 +00:00
Matthew Waters
63bbe9406a glwindow: add API to request a resize event on the next draw
- glimagesink needs to be able to resize the viewport on aspect ratio
  changes resulting from either caps changes or 3d output mode changes.
- Performing a glViewport outside the GstGLWindow::resize callback
  will not have the winsys' stack of viewports required to correctly
  place the output frame.

Provide a function to request a resize on the next draw event from the
winsys.

Also track size changes inside the base GstGLWindow class rather
than in each subclass.

https://bugzilla.gnome.org/show_bug.cgi?id=755111
2017-12-09 19:32:08 +00:00
Matthew Waters
a18cdf4781 gl/x11: store the correct dimension from the resize events
small typo s/width/height/
2017-12-09 19:32:08 +00:00
Vineeth T M
6944433677 gl: Fix GError leaks during failures
https://bugzilla.gnome.org/show_bug.cgi?id=755140
2017-12-09 19:32:08 +00:00
Tim-Philipp Müller
990a49fe4f gl: bufferpool take into account video stride alignment requirements
when allocating memory. Fixes crashes with avdec_h265 in the AVX2
code path which requires 32-byte stride alignment, but the
GstAllocationParams only specified a 16-byte alignment.

https://bugzilla.gnome.org/show_bug.cgi?id=754120
2017-12-09 19:32:08 +00:00
Matthew Waters
5adde7f98b gl/api: use public rather than private define
HAVE_IOS is only defined for the build of this module so
attempting to use gstgl in iOS would result in incorrect GL
includes.
Use GST_GL_HAVE_PLATFORM_EAGL instead for choosing the iOS GL
header.
2017-12-09 19:32:08 +00:00
Sebastian Dröge
cd326adacc gl/eagl: Also unbind renderbuffer after setting up framebuffer
https://bugzilla.gnome.org/show_bug.cgi?id=754757
2017-12-09 19:32:08 +00:00
Sebastian Dröge
ae721c54c2 gl/eagl: Don't make context uncurrent just to make it current again in the next line
Also binding the framebuffer again is unnecessary then as it was just bound a
few lines before while the context was current.

https://bugzilla.gnome.org/show_bug.cgi?id=754757
2017-12-09 19:32:08 +00:00
Tim-Philipp Müller
06a1954165 gtk, qt, gl: fix typo in debug and error messages 2017-12-09 19:32:08 +00:00
Sebastian Dröge
3d4f982045 gl/eagl: Unref context after setting a window handle
gst_gl_window_get_context() returns a new reference.

Hopefully fixes https://bugzilla.gnome.org/show_bug.cgi?id=753758
2017-12-09 19:32:08 +00:00
Nicolas Dufresne
d1cece731e gl: Let base transform relay the meta api for us
During allocation query, when this element is not passthrough, it must
relay the overlay compostion meta and it's parameters. Fortunatly, base
transform can do this for us.

https://bugzilla.gnome.org/show_bug.cgi?id=753850
2017-12-09 19:32:08 +00:00
Justin Kim
c8628fc43d glcontext: add specific error message when missing GL_SHADING_LANGUAGE_VERSION
GL_SHADING_LANGUAGE_VERSION was introduced since ES 2.0, but in some
android emulator doesn't support this feature. To prevent confusion for
developer, the error message need to be more clear.

https://bugzilla.gnome.org/show_bug.cgi?id=753905
2017-12-09 19:32:08 +00:00
Matthew Waters
d45e0f807f glbasefilter: only call gl_{stop,start} if the context changed
Removes the redundant GL object creation/deletion on every
decide_allocation call which is being called for every caps change.

Thus reduces the required GL state changes on reconfigure events
which are being sent by glimagesink/xvimagesink
2017-12-09 19:32:08 +00:00
Nicolas Dufresne
edd3c007ea glupload: Recalculate offset and size in raw upload
As we only expose the mapped portion of the frame into the GL
memory object (and not the original padding) we need to
re-calculate the size and offset.
2017-12-09 19:32:08 +00:00
Nicolas Dufresne
9fd57c9a6c gloverlaycompositor: Also disable the blend when done 2017-12-09 19:32:07 +00:00
Nicolas Dufresne
a342d95ca6 glsink: Enable sync meta on pools we offer
As the upload is asynchronous, we need to enable the sync meta to
gain correct rendering. The buffer pool receiver don't know about
that.
2017-12-09 19:32:07 +00:00
Sebastian Dröge
db8bbe067b opengl: Change GLclampd to double
GLclampd does not exist on GLES, only desktop GL.
2017-12-09 19:32:07 +00:00
Martin Kelly
7d314dd2ad opengl: add missing ClearDepth prototype
The ClearDepth call is missing.

https://bugzilla.gnome.org/show_bug.cgi?id=753639
2017-12-09 19:32:07 +00:00
Nicolas Dufresne
f3bd3d0b94 gl: Add opengl_version.h to the list of sources
Adding this private header to the list of sources. We don't want to make
this header public, but we need it in the list of sources otherwise it
won't be included in the tarball. This fixes make distcheck.

This regression was introduced by commit 1a6fe3db
2017-12-09 19:32:07 +00:00
Matthew Waters
3ba30d42a4 gl: use gles2 shaders everywhere
This effectively limits a glfilter subclass to be > GL(ES) 2.0.
rather than a possible GL 1.4.
2017-12-09 19:32:07 +00:00
Matthew Waters
6589c38d1a glcontext/wgl: implement gl3 core profile context selection 2017-12-09 19:32:07 +00:00
Nicolas Dufresne
d576a71e9a gloverlaycompositor: Add shader to convert BGRA/ARGB -> RGBA
Depending on the bytes order we will get BGRA (little) and ARGB (big)
from the composition overlay buffer while our GL code expects RGBA. Add
a fragment shader that do this conversion.

https://bugzilla.gnome.org/show_bug.cgi?id=752842
2017-12-09 19:32:07 +00:00
Matthew Waters
9f9e0e87cf gl/syncmeta: implement synchronisation without glFenceSync
Uses glFinish as that's the best we have for lesser OpenGL versions.
2017-12-09 19:32:07 +00:00
Matthew Waters
2034f78617 context/glx: only use glXCreateContextAttribs for OpenGL 3 contexts
mesa for example when creating a GL 3.1 compatibility context
overrides our context profile selection to create a core context.
2017-12-09 19:32:07 +00:00
Sebastian Dröge
260104e485 glupload: Remove debug output from gst_gl_upload_transform_caps()
We can't know if the GstGLUpload type is initialized at this point already,
and thus our debug category might not be initialized yet... and cause an
assertion here.

As we don't print debug output for any of the other transform functions, let's
defer this problem for now.
2017-12-09 19:32:07 +00:00
Nicolas Dufresne
f8dbf10e9e glupload: Add fixme about using bufferpool for raw
http://bugzilla.gnome.org/show_bug.cgi?id=752937
2017-12-09 19:32:07 +00:00
Nicolas Dufresne
2b2048d601 glupload: Keep input frame mapped as long as needed
When performing a raw upload, we need to keep the raw data mapped as
long as needed.

https://bugzilla.gnome.org/show_bug.cgi?id=752937
2017-12-09 19:32:07 +00:00
Nicolas Dufresne
37cc53d26f Revert "glupload: memcpy on raw data upload"
This reverts commit 82c0189b28.

https://bugzilla.gnome.org/show_bug.cgi?id=752937
2017-12-09 19:32:07 +00:00
Matthew Waters
ab142b2671 glcontext/wgl: fix defenition of gst_gl_context_wgl_new
gstglcontext_wgl.c: In function 'gst_gl_context_wgl_new':
gstglcontext_wgl.c:83:40: error: 'display' undeclared (first use in this function)
2017-12-09 19:32:07 +00:00
Matthew Waters
0ac95e3243 gl/cocoa: fix definition of gst_gl_context_new
gstglcontext_cocoa.m:75:1: error: conflicting types for 'gst_gl_context_cocoa_new'
2017-12-09 19:32:07 +00:00
Matthew Waters
7acca333fe gl/win32: fix definition of gst_gl_window_win32_new 2017-12-09 19:32:07 +00:00
Matthew Waters
70184c52f0 wayland: fail window open if the display is the correct type
Errors out cleanly if a wayland compositor is not running
2017-12-09 19:32:07 +00:00
Matthew Waters
6ccaafc0f3 glwindow: pass display to implementation's _new()
So they have to opportunity to fail if they cannot handle the
display connection.

https://bugzilla.gnome.org/show_bug.cgi?id=752743
2017-12-09 19:32:07 +00:00
Matthew Waters
9587eb477d glcontext: pass display to implentation's _new()
This allows the context to fail creation based on incompatible
display type's. e.g. glx context with an wayland display handle.

https://bugzilla.gnome.org/show_bug.cgi?id=752743
2017-12-09 19:32:06 +00:00
Julien Isorce
738ed418ad gl: support cgl, egl and glx within a same build
On osx, with the same build,
gst-launch-1.0 videotestsrc ! glimagesink works with:

GST_GL_PLATFORM=egl GST_GL_WINDOW=x11 GST_GL_API=gles2
GST_GL_PLATFORM=egl GST_GL_WINDOW=x11 GST_GL_API=opengl

GST_GL_PLATFORM=glx GST_GL_WINDOW=x11 GST_GL_API=opengl

GST_GL_PLATFORM=cgl GST_GL_WINDOW=cocoa GST_GL_API=opengl
GST_GL_PLATFORM=cgl GST_GL_WINDOW=cocoa GST_GL_API=opengl3

https://bugzilla.gnome.org/show_bug.cgi?id=752743
2017-12-09 19:32:06 +00:00
Jan Schmidt
3bacd64bf1 glupload: Check that caps contain desired caps features
Use 'contains' checks instead of equality checks on caps features
to allow for uploading when caps also contain GstVideoOverlayComposition
meta.

https://bugzilla.gnome.org/show_bug.cgi?id=752912
2017-12-09 19:32:06 +00:00
Julien Isorce
ac469a0d28 gl: move GL_NUM_EXTENSIONS definition after gl.h
https://bugzilla.gnome.org/show_bug.cgi?id=752743
2017-12-09 19:32:06 +00:00
Luis de Bethencourt
1eeeadb24e glupload: fix memory leak
GstCapsFeatures need to be freed with gst_caps_features_free() after use.

CID #1312136, CID #1312136
2017-12-09 19:32:06 +00:00
Nicolas Dufresne
df7bcb6ba7 gloverlaycompositor: Keep memory pointer alive
Keep the composition memory pointer alive while it's being
wrapped inside a GstGLMemory object.

https://bugzilla.gnome.org/show_bug.cgi?id=745107
2017-12-09 19:32:06 +00:00
Nicolas Dufresne
8884aeba87 gloverlaycompositor: Pass buffer stride
The overlay pixel buffer stride was not given back
to the GL image.

https://bugzilla.gnome.org/show_bug.cgi?id=745107
2017-12-09 19:32:06 +00:00
Nicolas Dufresne
b0546f9bfa gloverlaycompositor: Hide GstCompsitionOverlay object
This object is only used inside the compositor and does not
need to be expose in libgstgl API.

https://bugzilla.gnome.org/show_bug.cgi?id=745107
2017-12-09 19:32:06 +00:00
Nicolas Dufresne
9caaf9eb63 libgstgl: Makefile style fix 2017-12-09 19:32:06 +00:00
Nicolas Dufresne
1812c19291 composition-overlay: Positions are relative to texture
The coordinate are relative to the texture dimension and not
the window dimension now. There is no need to pass the window
dimension or to update the overlay if the dimension changes.

https://bugzilla.gnome.org/show_bug.cgi?id=745107
2017-12-09 19:32:06 +00:00
Lubosz Sarnecki
8abd2bbe35 gloverlaycompositor: Create own shader object
Make gloverlaycompositor independent of the shader used in the sink.

https://bugzilla.gnome.org/show_bug.cgi?id=745107
2017-12-09 19:32:06 +00:00
Luis de Bethencourt
3199b1b4a8 gloverlaycompositor: for loop initial declarations are only allowed in C99 mode
Fixes compiler warnings
2017-12-09 19:32:06 +00:00
Julien Isorce
f068020645 gl: use gst_gl_display_create_context in more elements.
glbasefilter, glbasemixer and gltestsrc.

https://bugzilla.gnome.org/show_bug.cgi?id=750310
2017-12-09 19:32:06 +00:00
Matthew Waters
11f058b1ca gl/build: fix typo in _HEADERS resulting in installing the wrong file
/usr/include/gstreamer-1.0/gst/gl/gl.h:51:43: fatal error:
    gst/gl/gstgloverlaycompositor.h: No such file or directory
2017-12-09 19:32:06 +00:00
Matthew Waters
41aeadc36e glcolorconvert: add RGB to NV12/NV21 conversion 2017-12-09 19:32:06 +00:00
Lubosz Sarnecki
26e6be8fad glcolorconvert: Apply GstVideoOverlayCompositionMeta buffer to converted buffer
Since glcolorconvert creates a new GstBuffer,
without the GstVideoOverlayCompositionMeta data,
it needs to be copied to not be dropped.

https://bugzilla.gnome.org/show_bug.cgi?id=745107
2017-12-09 19:32:06 +00:00
Lubosz Sarnecki
076d0517c8 glupload: Detect overlay meta buffers correctly
https://bugzilla.gnome.org/show_bug.cgi?id=745107
2017-12-09 19:32:06 +00:00
Lubosz Sarnecki
dc47e6d3c0 glimagesinkbin: Add GstVideoOverlayCompositionMeta caps features
https://bugzilla.gnome.org/show_bug.cgi?id=745107
2017-12-09 19:32:06 +00:00
Lubosz Sarnecki
4d010efea1 gloverlaycompositor: Add GstGLOverlayCompositor class
Manages the GstGLCompositionOverlay objects,
caches already uploaded overlays and draws them.

https://bugzilla.gnome.org/show_bug.cgi?id=745107
2017-12-09 19:32:06 +00:00
Lubosz Sarnecki
170ac41a87 glcompositionoverlay: Add compatibility for GL contexts without glGenVertexArrays
https://bugzilla.gnome.org/show_bug.cgi?id=745107
2017-12-09 19:32:06 +00:00
Lubosz Sarnecki
279c2b07b4 glcompositionoverlay: Add class for managing GstVideoOverlayCompositionOverlay buffers
Add a class to store and manage the OpenGL texture,
vertex buffer and GstVideoOverlayRectangle.
Transforms overlay coordinate space to vertex buffer space with aspect ratios in mind.

= Example Pipelines =

Simple pipeline

gst-launch-1.0 videotestsrc ! \
  textoverlay text="Hello World" font-desc="sans bold 30" ! \
  glimagesink

Display 3 static overlays at different positions

gst-launch-1.0 videotestsrc ! \
  textoverlay text="text1" valignment="top" font-desc="sans bold 30" ! \
  textoverlay text="text2" halignment="right" font-desc="sans bold 30" ! \
  textoverlay text="text3" halignment="left" font-desc="sans bold 30" ! \
  glimagesink

Display subtitle file over testsrc

gst-launch-1.0 videotestsrc ! \
  textoverlay name=foo filesrc location=foo.srt ! subparse ! queue ! foo. foo. ! \
  glimagesink

https://bugzilla.gnome.org/show_bug.cgi?id=745107
2017-12-09 19:32:05 +00:00
Lubosz Sarnecki
eb618aaac7 glupload: Move debug init to top of the file
https://bugzilla.gnome.org/show_bug.cgi?id=745107
2017-12-09 19:32:05 +00:00
Matthew Waters
1b4f99856f glmemory: check for pbo availability before attempting pbo download
https://bugzilla.gnome.org/show_bug.cgi?id=751165
2017-12-09 19:32:05 +00:00
Matthew Waters
66407b9877 glcontext: fix get_current_gl_api on x11/nvidia drivers
They require to get_proc_address some functions through the
platform specific {glX,egl}GetProcAddress rather than the default
GL library symbol lookup.
2017-12-09 19:32:05 +00:00
Matthew Waters
cfa9b94045 glcontext: consolidate get_proc_address function definition
Pass the GstGLAPI directly.
2017-12-09 19:32:05 +00:00
Matthew Waters
3343e2dccd glcontext/glx: try creating a context with the highest version
nvidia drivers return the exact version in glGstString (GL_VERSION)
we request on creation so start with the highest known version and
work our way down.
2017-12-09 19:32:05 +00:00
Matthew Waters
78957c45c2 glcontext: track sharedness with a cookie
The previous approach of traversing the other_context weak ref tree was
1. Less performant
2. Incorrect for context destruction removing a link in the tree

Example of 2:
c1 = context_create (NULL)
c2 = context_create (c1)
c3 = context_create (c2)
context_can_share (c1, c3) == TRUE
context_destroy (c2)
unref (c2)
context_can_share (c1, c3) returns FALSE when it should be TRUE!

This does not remove the restriction that context sharedness can only
be tracked between GstGLContext's.
2017-12-09 19:32:05 +00:00
Matthew Waters
2df7e0f9de glcontext: use the debug object variant for completeness 2017-12-09 19:32:05 +00:00
Matthew Waters
5043800a1d glupload: memcpy on raw data upload
Anything else requires keeping track of the GstVideoFrame mapping
across possible multiple buffers to ensure correct data pointer
usage.
2017-12-09 19:32:05 +00:00
Matthew Waters
841380e022 glbasebuffer: add some debug and zero the data pointers on init 2017-12-09 19:32:05 +00:00
Sebastian Dröge
cff2d74cd4 gl/eagl: Don't call anything synchronously from the main thread
This will deadlock if the main thread is the one who creates the GstGLContext.
All things we call from the main thread should be possible from any thread.

https://bugzilla.gnome.org/show_bug.cgi?id=751101
2017-12-09 19:32:05 +00:00
Matthew Waters
b7a3b54b2a download: only start a download transfer for sysmem caps features 2017-12-09 19:32:05 +00:00
Hyunjun Ko
f67eb2571d glsyncmeta: transform func: return FALSE if not supported or failed
https://bugzilla.gnome.org/show_bug.cgi?id=751778
2017-12-09 19:32:05 +00:00
Matthew Waters
6a7bb242f9 android: add missing egl.h include 2017-12-09 19:32:05 +00:00
Matthew Waters
afcb6aa1da gl: consolidate egl header includes to egl-only headers
They may conflict with other headers.
2017-12-09 19:32:05 +00:00
Julien Isorce
9b1eb32c49 gl: initialize output params to 0 before calling gl functions
The client side API of the Chromium's GPU Process has asserts
in debug mode that check that output params are initialized to 0.
2017-12-09 19:32:05 +00:00
Nicolas Dufresne
b8d3c2d2a5 gl: Don't leak pool if set_config failed 2017-12-09 19:32:05 +00:00
Nicolas Dufresne
79d5bbdc35 glfilter: Don't cache buffer pool
Caching and sharing to multiple element the same pool prevents
renegotiation from passthrough to not passthrough.
2017-12-09 19:32:05 +00:00
Sebastian Dröge
5df0fbfbca Revert "gl/window/x11: don't create our own X11 display"
This reverts commit 5697b6b89b.

https://bugzilla.gnome.org/show_bug.cgi?id=751003
2017-12-09 19:32:05 +00:00
Sebastian Dröge
30e13d6623 Revert "eagl: Don't dispatch_sync() to the main thread if we are on the main thread"
This reverts commit 0bff481011.

It wasn't supposed to be merged and also doesn't fix the problem.
2017-12-09 19:32:05 +00:00
Sebastian Dröge
c02891ba41 eagl: Don't dispatch_sync() to the main thread if we are on the main thread
This will otherwise deadlock.

https://bugzilla.gnome.org/show_bug.cgi?id=751101
2017-12-09 19:32:05 +00:00
John Ludwig
5e0b3b1c10 gl: Include texParameterf in the GL function table
https://bugzilla.gnome.org/show_bug.cgi?id=751228
2017-12-09 19:32:05 +00:00
Julien Isorce
1edc569069 glmemory: fix consistency about pbo availability.
https://bugzilla.gnome.org/show_bug.cgi?id=751165
2017-12-09 19:32:04 +00:00
Julien Isorce
76983d4454 gldisplay: add gst_gl_display_create_context
It also emits a create-context signal so that an application
can provide an external GstGLContext backend.

https://bugzilla.gnome.org/show_bug.cgi?id=750310
2017-12-09 19:32:04 +00:00
Julien Isorce
38a1939ea1 glcontext: move display from priv
https://bugzilla.gnome.org/show_bug.cgi?id=750310
2017-12-09 19:32:04 +00:00
Julien Isorce
cbc3f1242f Revert "glcontext: add gst_gl_context_set_display helper"
This reverts commit 71b8103cbd.
2017-12-09 19:32:04 +00:00
Julien Isorce
e29e67fa6e Revert "gl: add GstGLContextGPUProcess backend"
This reverts commit b377112ee3.
2017-12-09 19:32:04 +00:00
Nicolas Dufresne
2c1d4f4074 glviewconvert: Fix GLES2 compatibility 2017-12-09 19:32:04 +00:00
Nicolas Dufresne
7605b39eea glviewconvert: Fix broken validity check 2017-12-09 19:32:04 +00:00
Jan Schmidt
7b583526e9 gl libs: Add glviewconvert helper object
Add API for a helper object that can convert between different
stereoscopic video representations, and later do filtering
of multiple view streams.

https://bugzilla.gnome.org/show_bug.cgi?id=611157
2017-12-09 19:32:04 +00:00
Matthew Waters
2210ba5d46 glmemory: separate pbo transfer from texture transfers
When supported, the potentially longer pbo upload/download can be
initiated before the texture upload/download, potentially increasing
throughput.
2017-12-09 19:32:04 +00:00
Matthew Waters
900bcea9de glmemory: implement on top of glbasebuffer
Provides convenient access to PBO usage.

Currently texture updates are coupled tightly to data transfers.
2017-12-09 19:32:04 +00:00
Matthew Waters
1e87053475 gl: new glbasebuffer GstMemory object
Provides generic handling of GL buffer objects accessible using
the GL bind points (GL_ARRAY_BUFFER, GL_PIXEL_*_BUFFER).

Implementation based off the current GstGLMemory.
2017-12-09 19:32:04 +00:00
Matthew Waters
c9d99be28c gl/prototypes: add some buffer function prototypes 2017-12-09 19:32:04 +00:00
Matthew Waters
9900928403 gl/window/x11: only listen on the X Display when needed
5697b6b89b causes us to possibly listen
on a toolkit provided Display connection.  We thus could eat their
precious winsys events.  Only listen if we need to
(!foreign_display or videooverlay).
2017-12-09 19:32:04 +00:00
Jan Schmidt
8a1fc4ab4e gl: Add support for multiple views in upload, colour convert and download
Support multiple attached views on input/output buffers
by processing each one, not just the first.
2017-12-09 19:32:04 +00:00
Matthew Waters
1f7025c585 gl/window/x11: don't create our own X11 display
It's not needed anymore with most window operations occuring in the
GL thread.
2017-12-09 19:32:04 +00:00
Matthew Waters
e37cf3c55f gl/window/x11: handle_events() may be called before the window has been created
Fixes an XIO fatal error
2017-12-09 19:32:04 +00:00
Sebastian Dröge
1a995d1676 gl: OES_vertex_array_object is improperly implemented on PowerVR SGX 544MP
https://bugzilla.gnome.org/show_bug.cgi?id=750185
2017-12-09 19:32:03 +00:00
Thiago Santos
33b5cd5426 Fix a common typo: retreive -> retrieve
Seems to have been copy pasted around a few places
2017-12-09 19:32:03 +00:00
Philippe Normand
deedbd799c gl/dispmanx: Fix build 2017-12-09 19:32:03 +00:00
Matthew Waters
5404083158 gl/window/dispmanx: fix compiler warning 2017-12-09 19:32:03 +00:00
Matthew Waters
bb1de83ff2 gl/window: use the default main loop implementation for all backends
fixes glimagsink being unable to display.

https://bugzilla.gnome.org/show_bug.cgi?id=750337
2017-12-09 19:32:03 +00:00
Julien Isorce
9ac4280052 glwindow_cocoa: use parent default implementation
Fixes https://bugzilla.gnome.org/show_bug.cgi?id=750337
2017-12-09 19:32:03 +00:00
Jan Schmidt
f6a102c3e5 glsyncmeta: Set new sync point when copying
Set a new sync point when copying instead of
transferring the (non-refcounted) GL sync object
from the source meta.

https://bugzilla.gnome.org/show_bug.cgi?id=750279
2017-12-09 19:32:03 +00:00
Jan Schmidt
7a288b0189 glsyncmeta: Add some debug output 2017-12-09 19:32:03 +00:00
Matthew Waters
fd7348d064 glmemory: provide compatibility definition for GLES2 for GL_RGBA8 2017-12-09 19:32:03 +00:00
Matthew Waters
1e9f7b6303 gl: consolidate internal_rgba_format into glmemory
Expose some useful value format conversion functions available in
GstGLMemory.
2017-12-09 19:32:03 +00:00
Julien Isorce
f8ebadabcd glcontext_gpu_process: close the window when done 2017-12-09 19:32:03 +00:00
Julien Isorce
62130b34ff glwindow_gpu_process: avoid empty struct 2017-12-09 19:32:03 +00:00
Julien Isorce
210d2c2825 glwindow: move main loop/context creation back to init/finalize
Fixes https://bugzilla.gnome.org/show_bug.cgi?id=750199
2017-12-09 19:32:03 +00:00
Sebastian Dröge
7ae1efa8b3 gl: Fix compiler warning
gstglwindow_wayland_egl.c:246:41: error: unused variable 'surface_listener' [-Werror,-Wunused-const-variable]
static const struct wl_surface_listener surface_listener = {
                                        ^
2017-12-09 19:32:03 +00:00
Matthew Waters
fea0b65eb5 glwindow: fix compiler error
gstglwindow.c:1118:544: error: 'return' with no value, in function returning non-void [-Werror]
   g_return_if_fail (GST_GL_IS_WINDOW (window));
2017-12-09 19:32:03 +00:00
Matthew Waters
33d8bbaea4 gl/wayland: implement setting the render rectangle
Places our subsurface at the rectangle provided position
2017-12-09 19:32:03 +00:00
Matthew Waters
6c56aba687 glwindow: handle gst_video_overlay_set_render_rectangle 2017-12-09 19:32:03 +00:00
Matthew Waters
8332b1abe8 gl/wayland: don't block the event loop after poll
Use the dispatch_pending set of functions which just run the currently
queued up events instead of potentially waiting for an event to occur.
2017-12-09 19:32:03 +00:00
Matthew Waters
54199ea203 gl/wayland: implement basic video overlay support via subsurfaces
Currently does not position the subsurface relative to the parent surface at all
2017-12-09 19:32:03 +00:00
Matthew Waters
8404981dfb gl/wayland: allow a NULL wl_event_queue
perform operations on the default wl_display event queue in that case
2017-12-09 19:32:03 +00:00
Matthew Waters
79f4a5fcf3 gl/utils: implement wayland display GstContext
requried for sharing GL contexts or subsurface support
2017-12-09 19:32:03 +00:00
Matthew Waters
00cff1f9e4 gl/wayland: run each window on a separate queue
Based on patch by Julien Isorce <julien.isorce@collabora.co.uk>

https://bugzilla.gnome.org/show_bug.cgi?id=709747
2017-12-09 19:32:03 +00:00
Jan Schmidt
0f6b04c91d gl: Don't leak temp strings in _RGB_pixel_order()
Fix a memory leak of temporary strings when computing
swizzling of RGB formats.
2017-12-09 19:32:03 +00:00
Jan Schmidt
5007311198 glfilter: Add transform_internal_caps() vfunc
Add a vfunc that is called by glfilter before it sets
caps features and intersects with the peer caps, and
move removing the size from caps into its default
implementation. Allows sub-classes to do more
sophisticated management of the size fields in case they
don't support arbitrary resizing or have distinct
preferences.
2017-12-09 19:32:03 +00:00
Jan Schmidt
697107fe7d glfilter: Don't remove size fields from caps
Instead of removing size fields, set them to the full range
like videoscale does, so the caps are clearly unfixed in
all cases.
2017-12-09 19:32:03 +00:00
Julien Isorce
238edceda4 gl: add GstGLContextGPUProcess backend
It builds its GL vtable from a proc address provided
by the application.
2017-12-09 19:32:02 +00:00
Julien Isorce
fce0e0ba3c gl: add and use gst_gl_internal_format_rgba
Previously when compiling GstGL with both GL and GLES2,
GL_RGBA8 was picked from GL/gl.h. But a clash may happen at
runtime when one is selecting GLES2.

gst_gl_internal_format_rgba allows to check at runtime
if it should use GL_RGBA or GL_RGBA8.
2017-12-09 19:32:02 +00:00
Julien Isorce
2efeb71c83 glwindow_x11: use parent default implementation 2017-12-09 19:32:02 +00:00
Julien Isorce
fa7aafb4ff glcontext_glx: rename variable from window to context 2017-12-09 19:32:02 +00:00
Julien Isorce
01961ec44d glwindow: initialize debug in class_init
Useful if one uses gst_gl_window_x11_new directly
instead of gst_gl_window_new.
2017-12-09 19:32:02 +00:00
Julien Isorce
a81de2f282 glcontext: initialize debug in class_init
Useful if one uses gst_gl_context_egl_new directly
instead of gst_gl_context_new.
2017-12-09 19:32:02 +00:00
Julien Isorce
5849a9f657 glcontext: add gst_gl_context_set_display helper 2017-12-09 19:32:02 +00:00
Julien Isorce
bad3e16601 glcontext: add missing _CAST after G_TYPE_CHECK_CLASS 2017-12-09 19:32:02 +00:00
Julien Isorce
78ca5ce1c4 glwindow: add missing _CAST after G_TYPE_CHECK_CLASS 2017-12-09 19:32:02 +00:00
Julien Isorce
2472bcaaa6 glwindow: provides some default implementations to factorize with all backends 2017-12-09 19:32:02 +00:00
Xavier Claessens
840157230d gl: propagate return value from filter and filter_texture
https://bugzilla.gnome.org/show_bug.cgi?id=749846
2017-12-09 19:32:02 +00:00
Matthew Waters
4e58ec83e0 gl/wayland: remove dead event source code 2017-12-09 19:32:02 +00:00
Matthew Waters
9f704d7c2d gl/wayland: add GstGLDisplayWayland
Simple implementation split from GstGLWindowWayland

Can now have multiple glimagesink elements all displaying output
linked via GL or otherwise (barring GL platform limitations).

The intel driver is racy and can crash setting up the two glimagesink contexts.

e.g.
videotestsrc ! tee name=t ! queue ! glupload ! glimagesinkelement
  t. ! queue ! gleffects_blur ! glimagesinkelement

videotestsrc ! glupload ! glfiltercube ! tee name=t ! queue ! glimagesinkelement
  t. ! queue ! gleffects_blur ! glimagesinkelement
2017-12-09 19:32:02 +00:00
Matthew Waters
eba6f6b80f gl/calayer: provide the exact GL api version for the wrapped context
Otherwise we could end up being mistaken for the diference between a
gl3 and a gl2 context resulting in a failure getting the list of
extensions from the wrapped context due to the difference between
glGetString and glGetStringi for the GL_EXTENSIONS token.

https://bugzilla.gnome.org/show_bug.cgi?id=749728
2017-12-09 19:32:02 +00:00
Xavier Claessens
6db457a7d9 gl: win32: do not call SetParent in release_parent_win_id()
When called from gst_gl_window_win32_close(), internal window
could not exist, and if it does it's going to be destroyed just
after that anyway. Also it causes window_proc() to be called
and crash because it gets a NULL context.

When called from gst_gl_window_win32_set_window_handle() we are
going to set another parent anyway, and it's probably better to
reparent directly instead of passing by a NULL parent which could
cause the internal window to popup briefly.

https://bugzilla.gnome.org/show_bug.cgi?id=749601
2017-12-09 19:32:02 +00:00
Xavier Claessens
1d9ccc2189 gl: win32: remove unused code
https://bugzilla.gnome.org/show_bug.cgi?id=749601
2017-12-09 19:32:02 +00:00
Xavier Claessens
77e1e70fdc gl: win32: fix crash when finalizing GstGLContext
gst_gl_context_finalize() is calling gst_gl_window_win32_quit()
which was posting a message. But then window_proc takes window's
context and get a NULL.

Now that we've got a GMainLoop we can do like other backends and
simply call g_main_loop_quit().

This also remove duplicated code to release the parent window and
potential crash there because parent_proc could be NULL if we never
created the internal window. That could happen for example if setting
state to READY then setting a window_handle, and go back to NULL state.

https://bugzilla.gnome.org/show_bug.cgi?id=749601
2017-12-09 19:32:02 +00:00
Xavier Claessens
db0380a9ee gl: win32: Fix leaked GstGLContext
https://bugzilla.gnome.org/show_bug.cgi?id=749601
2017-12-09 19:32:02 +00:00
Xavier Claessens
8f268785d6 gl: win32: set the parent window when creating internal window
When _set_window_handle() was called in READY state, it wasn't
set to the internal window created later.

https://bugzilla.gnome.org/show_bug.cgi?id=749601
2017-12-09 19:32:02 +00:00
Xavier Claessens
886ea15c52 gl: win32: use a GMainContext to dispatch win32 messages
gst_gl_window_win32_send_message_async() could be called before the
internal window is created so we cannot use PostMessage there.

x11 and wayland backends both create a custom GSource for this,
so there is no reason to not do that for win32.

https://bugzilla.gnome.org/show_bug.cgi?id=749601
2017-12-09 19:32:02 +00:00
Jan Schmidt
95b08b75ba glupload: Don't leak all memory uploaded via raw uploads.
Remove an extra ref missed when switching over to not
reusing output textures
2017-12-09 19:32:02 +00:00
Matthew Waters
d4894caacf glcontext: require a shader version to initialize.
It's very near pointless to try our GL implementation without shaders.

https://bugzilla.gnome.org/show_bug.cgi?id=749284
2017-12-09 19:32:02 +00:00
Xavier Claessens
80fab54c0a gl: fix crash on windows with intel driver
https://bugzilla.gnome.org/show_bug.cgi?id=749430
2017-12-09 19:32:01 +00:00
Matthew Waters
e8e84cf6b3 gl/calayer: provide a current wrapped GstGLContext for callbacks
So that the draw and resize callbacks can get the current GstGLContext.
2017-12-09 19:32:01 +00:00
Matthew Waters
18b9519a66 glsyncmeta: ensure that the Fence is going to be executed
Otherwise it could stay client side without being submitted to the GL
server resulting in another context waiting on a Fence that will never
become signalled causing a deadlock.
2017-12-09 19:32:01 +00:00
Matthew Waters
62c2d98c52 glupload: don't reuse output textures for raw data upload
Causes stale textures to be used further down the chain.
2017-12-09 19:32:01 +00:00
Matthew Waters
d5e0d435e4 glframebuffer: don't clear the framebuffer
Breaks attempting to blend with the destination buffer and should be done
explicitly by the callback anyway.
2017-12-09 19:32:01 +00:00
Matthew Waters
5a275c77eb glbasefilter: track gl_start/stop correctly
Don't start multiple times without calling gl_stop.
2017-12-09 19:32:01 +00:00
Matthew Waters
5d8841c8e7 glcontext/cocoa: implement GL3 core context selection 2017-12-09 19:32:01 +00:00
Matthew Waters
72993f54fa gl: remove useless gl{En,Dis}able (GL_TEXTURE_*) calls
We are using shaders everywhere and so they are not needed
2017-12-09 19:32:01 +00:00
Matthew Waters
675f789871 glshader: attempt to detect the gles2 inside opengl3 case
This is necessary to use gles2 shaders in a GL 3 core context on
OS X which fails without a proper #version being set on the shaders.
2017-12-09 19:32:01 +00:00
Matthew Waters
2b4ce9435d glshader: remove references to gl3 specific shaders
We rely specifically on gles2 shaders being supported by the GL
implementation with GL3 core profile.
2017-12-09 19:32:01 +00:00
Matthew Waters
65c57b77ff gl: element buffers are part of vao state
Use them as such.  They are also required for GL3 core profile support
with glDrawElements on OS X.
2017-12-09 19:32:01 +00:00
Matthew Waters
cc587ce1f1 glmemory: properly detect (hopefully) the correct ext_rg/arb_rg variant
GL_EXT_texture_rg is only valid for GLES2. GLES3 uses similar wording to
the GL_ARB_texture_rg which requires a sized internal format that the
GL_EXT_texture_rg does not require.

https://www.khronos.org/registry/gles/extensions/EXT/EXT_texture_rg.txt
https://www.opengl.org/registry/specs/ARB/texture_rg.txt
2017-12-09 19:32:01 +00:00
Matthew Waters
16522a737c glcontext: propagate the version/extension failure upwards
Otherwise the calling code has no idea that the context failed to
be created fully.

https://bugzilla.gnome.org/show_bug.cgi?id=749284
2017-12-09 19:32:01 +00:00
Matthew Waters
50d3161ac5 gl: don't deadlock on context creation failure
https://bugzilla.gnome.org/show_bug.cgi?id=749284
2017-12-09 19:32:01 +00:00
Sebastian Dröge
51d3a0a059 Revert "gl: readd glupload/download onto element pads"
This reverts commit 87d8270f30.
2017-12-09 19:32:00 +00:00
Matthew Waters
5216434678 glsyncmeta: fixup size declaration 2017-12-09 19:32:00 +00:00
Jan Schmidt
c2450a28f5 glcolorconvert: Improve passthrough check when no conversion is needed.
Make the passthrough check contingent on only the fields we
can modify being unchanged, and pre-compute it when caps
change instead of checking on each buffer. Makes the passthrough
more lenient if consumers are lax about making input and output
caps complete.
2017-12-09 19:32:00 +00:00
Matthew Waters
343947f383 gl: readd glupload/download onto element pads
Allows insertion of gl elements into non-gl pipelines without converter
(upload/download) elements.

https://bugzilla.gnome.org/show_bug.cgi?id=743974
2017-12-09 19:32:00 +00:00
Jan Schmidt
9958df5dd1 glupload: Make upload method static caps non-const.
Retrieving a GstStaticCaps does a one time internal
initialisation and caches it - they can't be stored as
const structures.
2017-12-09 19:32:00 +00:00
Matthew Waters
84b61ad4d5 glmemory: remove uneeded unref
The call to _gl_mem_alloc_data will unref and NULLify 'dest' for us.
We just need to return.

https://bugzilla.gnome.org/show_bug.cgi?id=744246
2017-12-09 19:32:00 +00:00
Matthew Waters
c902a6f525 glupload: provide the sink template caps that could be used
https://bugzilla.gnome.org/show_bug.cgi?id=746399
2017-12-09 19:32:00 +00:00
Xavier Claessens
403ee23de1 egl: Use maximum bits per color instead of minimum
https://bugzilla.gnome.org/show_bug.cgi?id=748425
2017-12-09 19:32:00 +00:00
Matthew Waters
f4f3284161 gl: unref display/other-context in the correct place
Otherwise state changes from PLAYING->READY->PAUSED will cause there to
to be no display configured on the element.

https://bugzilla.gnome.org/show_bug.cgi?id=748405
2017-12-09 19:32:00 +00:00
Sebastian Dröge
ee6bfe0127 glfilter: De-camelcase onInitFBO() vfunc 2017-12-09 19:31:59 +00:00
Sebastian Dröge
3613ecfd0a glfilter: Remove onStart/onStop vfuncs, and unused onReset()
onStart/onStop are just duplicates of the basetransform ones, onReset
was never called but was used everywhere when stop should've been used.
2017-12-09 19:31:59 +00:00
Matthew Waters
db3bd840b9 glbasefilter: Unref other context in finalize, and display in READY->NULL
https://bugzilla.gnome.org/show_bug.cgi?id=748405
2017-12-09 19:31:59 +00:00
Matthew Waters
6445569abf glwindow: track context activation properly
We only need to deactivate/reactivate the context iff it was already
active.
2017-12-09 19:31:59 +00:00
Matthew Waters
03908c679e gldisplay: synchronize the searching and creation of GstGLContext's
Ootherwise we could end up with multiple elements in different chains
each creating a context.  Fixes context creation with glvideomixer.
2017-12-09 19:31:59 +00:00
Matthieu Bouron
d20af8338a glcontext: Make gst_gl_context_egl_activate fail if the old surface could not be destroyed
https://bugzilla.gnome.org/show_bug.cgi?id=746251
2017-12-09 19:31:59 +00:00
Matthieu Bouron
87a336350d glcontext: Make gst_gl_context_egl_activate fail if the surface could not be created
Also add some error logging.
2017-12-09 19:31:59 +00:00
Sebastian Dröge
659477c7c7 glcolorconvert: Fix last commit 2017-12-09 19:31:59 +00:00
Sebastian Dröge
4a8001e683 gl: Remove iOS/EAGL workaround for R/RG textures
This should be unneeded now after https://bugzilla.gnome.org/show_bug.cgi?id=732507
2017-12-09 19:31:58 +00:00
Sebastian Dröge
bd2821982f glcolorconvert: Add correct check for RG/R textures in glcolorconvert too
https://bugzilla.gnome.org/show_bug.cgi?id=732507
2017-12-09 19:31:58 +00:00
Anton Obzhirov
c45072ae86 glbasefilter: avoid segfault when gl platform is not available
https://bugzilla.gnome.org/show_bug.cgi?id=747124
2017-12-09 19:31:58 +00:00
Alessandro Decina
83990b491e libgstgl: fix rendering on iOS
Stop assuming that the handle has been set by the time ->create_context is
called. After bc7a7259f3 set_window_handle always
happens after ->create_context in fact.

See also https://bugzilla.gnome.org/show_bug.cgi?id=745090
2017-12-09 19:31:58 +00:00
Edward Hervey
0f4c79099e introspection: Don't use g-ir-scanner cache at compile time
It pollutes user directories and we don't need to cache it

https://bugzilla.gnome.org/show_bug.cgi?id=747095
2017-12-09 19:31:58 +00:00
Philippe Normand
79d340004d gl/dispmanx: surfaceless EGL context support
Show the DispmanX window only if there's no shared external GL context
set up. When a window is required by the context a transparent
DispmanX element is created and later on made visible by the ::show
method.

https://bugzilla.gnome.org/show_bug.cgi?id=746632
2017-12-09 19:31:58 +00:00
Julien Isorce
0142f551f8 glwindow: remove unused gl_thread field 2017-12-09 19:31:58 +00:00
Julien Isorce
a71d479cc3 gldisplay: fix GThread leak
https://bugzilla.gnome.org/show_bug.cgi?id=746541
2017-12-09 19:31:58 +00:00
Matthew Waters
0b5c7e8b49 gl/docs: update some doc comments 2017-12-09 19:31:58 +00:00
Matthew Waters
1c51ba395a gldisplay: tentative proper context collision detection
Fixes
tee name=t ! queue ! gliamgesink t. ! queue ! glimagesink
2017-12-09 19:31:58 +00:00
Víctor Manuel Jáquez Leal
55dbb25dcc glupload: move meta-data copy into gst-gl library
In some upload implementations the out buffer has more than one references,
turning the buffer not writable, so it won't be possible to modify its
meta-data.

This patch moves the meta-data copy before increasing the reference of the out
buffer.

https://bugzilla.gnome.org/show_bug.cgi?id=746173
2017-12-09 19:31:58 +00:00
Matthew Waters
420cdf9cf6 glmemory: fix the slight difference between EXT_rg and ARB_rg
GL_EXT_texture_rg doesn't take sized formats for the internalformat
parameter of TexImage* but GL_ARB_texture_rg and GL(ES)3 do.

https://bugzilla.gnome.org/show_bug.cgi?id=732507
2017-12-09 19:31:58 +00:00
Matthew Waters
93968916a4 glsyncmeta: make context to wait and set sync explicit
otherwise we may wait on a sync object in same context by accident
2017-12-09 19:31:58 +00:00
Julien Isorce
63366be8ad gl: add GstGLDisplayCocoa
https://bugzilla.gnome.org/show_bug.cgi?id=746012
2017-12-09 19:31:58 +00:00
Julien Isorce
d3b3887c52 gl/cocoa: do not terminate loop in gst_gl_window_cocoa_close
It is now done in _finalize.

Fix regression introduced by
"gl/window: create the main loop/context on init/finalize"
bc7a7259f3
2017-12-09 19:31:58 +00:00
Julien Isorce
a51680b1b3 gl: avoid overwriting display and context to NULL
It happens when the application provides display
and/or context.
2017-12-09 19:31:57 +00:00
Matthew Waters
15fd4e164a glshader: attribute locations are -1 on error 2017-12-09 19:31:57 +00:00
Neos3452
7d83351172 glshader: prevent from getting attributes without vertex shader
It doesn't make sense to query for vertex attributes without a vertex
shader. Moreover this is causing a crash on OSX.

https://bugzilla.gnome.org/show_bug.cgi?id=746168
2017-12-09 19:31:57 +00:00
Matthew Waters
7b9d70944b glupload: unref the bufferpool 2017-12-09 19:31:57 +00:00
Matthew Waters
92f0aa9bd8 gl: get the context from basemixer/basefilter 2017-12-09 19:31:57 +00:00
Matthew Waters
51620950e4 gl: retreive the gldisplay/app gl context as soon as possible
fixes the usage of gst_gl_display_filter_gl_api
2017-12-09 19:31:57 +00:00
Julien Isorce
d6e460095f glcolorconvert: cache indices in a buffer object 2017-12-09 19:31:57 +00:00
Matthew Waters
35476a4cb4 gl/cocoa: avoid deadlock when creating context on the main thread.
Make window/view creation async so that it is possible to
gst_gl_context_create from the main thread.
2017-12-09 19:31:57 +00:00
Matthew Waters
813fb633b4 gl: store the list of contexts within gldisplay
Removes the reliance on the allocation query to propogate GL contexts.

Allows thread safely getting a context for the a specific thread.
2017-12-09 19:31:57 +00:00
Matthew Waters
d44594c622 glcontext: store the thread current context 2017-12-09 19:31:57 +00:00
Matthew Waters
3e608bcce7 glfilter: don't use the library upload/convert objects 2017-12-09 19:31:57 +00:00
Matthew Waters
1ba38bc10a glupload: implement propose_allocation pool handling for glmemory upload 2017-12-09 19:31:56 +00:00
Matthew Waters
2ead0d97ed gl: add a new glbasefilter class below glfilter
It deals with propagating the gl display/contexts throughout the
application/pipeline
2017-12-09 19:31:56 +00:00
Matthew Waters
6d4cca89ef glutils: expose running a query on a set of src/sink pads 2017-12-09 19:31:56 +00:00
Matthew Waters
f9ac4984eb glfilter: advertise resize in the caps negotiation properly 2017-12-09 19:31:56 +00:00
Matthew Waters
1d4b82d5f8 glcolorconvert: we don't do resizing of the video frames
As we cannot do accurate texel sampling then due to the texture
coordinates being interpolated based on the output frame size.
2017-12-09 19:31:56 +00:00
Matthew Waters
39eb34eb43 gl/x11: don't XGetWindowAttributes every XEvent
fixes a deadlock in xcb where the X window may not exist.

https://bugzilla.gnome.org/show_bug.cgi?id=745633
2017-12-09 19:31:56 +00:00
Matthew Waters
9968b512c5 gl/window: hopefully fixup compile warnings on android/ios 2017-12-09 19:31:56 +00:00
Jan Schmidt
ebbdf29a24 glfilter: Remove redundant check for clearing context on reset.
The context is already cleared a few lines above.
2017-12-09 19:31:56 +00:00
Jan Schmidt
6350c35352 Remove a bunch of silly ';;' typos at the end of lines 2017-12-09 19:31:56 +00:00
Matthew Waters
5b8f3e7870 gl/window: create the main loop/context on init/finalize
Avoids races setting the window handle from the main thread.

https://bugzilla.gnome.org/show_bug.cgi?id=745633
2017-12-09 19:31:56 +00:00
Nicolas Dufresne
da41207841 glfilter: Don't chain downstream pool
Chaining a downstream pool would lead to two owner of the same
pool. In dynamic pipeline, if one owner is removed from the pipeline
the pool will be stopped, and the rest of the pipeline will fail
since the pool will now be flushing. Also fix proposed pool caching,
filter->pool was never set, never unrefed.

https://bugzilla.gnome.org/show_bug.cgi?id=745705
2017-12-09 19:31:56 +00:00
Sebastian Dröge
eeab6e881f gldownload: Simplify caps feature setting code 2017-12-09 19:31:56 +00:00
Sebastian Dröge
cb59ace574 gl: Remove format info in glcolorconvert's transform_caps function instead of on every caller
... and let glmixer actually transform the caps it is supposed to transform
instead of inventing new caps.
2017-12-09 19:31:56 +00:00
Sebastian Dröge
86d1280f2c glupload: Simplify caps feature setting code 2017-12-09 19:31:56 +00:00
Edward Hervey
285afe0861 gldisplay: Only use debugging if we have valid values
The debug category won't have been created/activated if it's not a
valid display
2017-12-09 19:31:56 +00:00
Nicolas Dufresne
c9ee5a4b87 glfilter: Get rid of uploader if caps have changed
We need to update the uploader format if that caps have changed.

https://bugzilla.gnome.org/show_bug.cgi?id=745549
2017-12-09 19:31:56 +00:00
Edward Hervey
961e847433 gl: Fix context leaks
Introduced by a12ca13750
2017-12-09 19:31:56 +00:00
Julien Isorce
befc24469c gl/cocoa: register only one custom nsapp loop
Otherwise the pipeline stalls when running
more than one glimagesink with gst-launch.

Also only register the custom nsapp loop
when setting up the nsapp from gstgl.
2017-12-09 19:31:56 +00:00
Julien Isorce
075a4ffaff gl/cocoa: instead of class_init use g_once to setup nsapp 2017-12-09 19:31:56 +00:00
Julien Isorce
9599b46416 gl/cocoa: check for deprecated constants prior to OSX 10.10 2017-12-09 19:31:56 +00:00
Nicolas Dufresne
50c491dd36 glbufferpool: Fix offset for odd height
We also need to recalculate the offset, since otherwise the frame
mapping will be forward two lines in the U and V planes (I420) due
to gst_video_info_align() round up the Y plane to a even number of
lines.

https://bugzilla.gnome.org/show_bug.cgi?id=745054
2017-12-09 19:31:56 +00:00
Nicolas Dufresne
b2aea709d0 glmemory: Support offset when downloading
Make sure we support offset and video alignment when downloading too.
This is currently not used (plane_start is always 0), but it makes
the code correct if we want to use that later.
2017-12-09 19:31:55 +00:00
Nicolas Dufresne
0cbe42af24 glmemory: Provide correct size on upload
Provide the right size to GL when uploading. Using maxsize is wrong
since we offset the data point with the memory offset and video
alignement offset.

https://bugzilla.gnome.org/show_bug.cgi?id=744246
2017-12-09 19:31:55 +00:00
Nicolas Dufresne
3405eec996 glmemory: Provide correct size on download
Provide the right size to GL when downloading. This fixes downloading
from GLMemory that where created for libav.

https://bugzilla.gnome.org/show_bug.cgi?id=744246
2017-12-09 19:31:55 +00:00
Nicolas Dufresne
33050939ff glmemory: Use fallback for partial copy
When the memory is partial copy, the texture size and videoinfo no
longer make sense. As we cannot guess what the application wants, we
safely copy into a sysmem memory.

https://bugzilla.gnome.org/show_bug.cgi?id=744246
2017-12-09 19:31:55 +00:00
Nicolas Dufresne
de79830b05 glmemory: Add GstAllocationParams and alignment support
This implements support for GstAllocationParams and memory alignments.
The parameters where simply ignored which could lead to crash on
certain platform when used with libav and no luck.

https://bugzilla.gnome.org/show_bug.cgi?id=744246
2017-12-09 19:31:55 +00:00
Matthew Waters
05a4c89f25 glupload: perform egl upload on the gl thread
Fixes EGLImage usage on raspberry pi

https://bugzilla.gnome.org/show_bug.cgi?id=743914
2017-12-09 19:31:55 +00:00
Víctor Manuel Jáquez Leal
e3d457ec8e glupload: Set freed method implementation to NULL
When trying to render buffers with meta:GLTextureUpload the glimagesink crashes
with a segmentation fault.

This patch workarounds this crash setting to NULL the method implementation
after free.

https://bugzilla.gnome.org/show_bug.cgi?id=745206
2017-12-09 19:31:55 +00:00
Edward Hervey
081f101f56 glwindow: Deactivate window before changing handle
When setting a new window handle, we need to ensure all implementations
will detect the change.

For that we deactivate the context before setting the window handle, then
reactivate the context

https://bugzilla.gnome.org/show_bug.cgi?id=745090
2017-12-09 19:31:55 +00:00
Edward Hervey
4fa2ddda96 gl/egl: Detect window handle changes
When (re)activating the context, the backing window handle might have changed.
If that happened, destroy the previous surface and create a new one

https://bugzilla.gnome.org/show_bug.cgi?id=745090
2017-12-09 19:31:55 +00:00
Luis de Bethencourt
6a515ab278 gl: remove docbook related warnings 2017-12-09 19:31:55 +00:00
Matthew Waters
fba2a2093f glmemory: allow sharing between buffers
There was no real reason why the flag was set.  We should be able
to handle it.  Fixes last-sample handling on gl sinks
2017-12-09 19:31:55 +00:00
Matthew Waters
5acb75cdf4 glsyncmeta: add compat definition for gles2 2017-12-09 19:31:55 +00:00
Matthew Waters
1cf843292b gl/calayer: don't use the async callback to render
not until we can provide equivalent functionality for other window
implementations.
2017-12-09 19:31:55 +00:00
Matthew Waters
844c0e77ee glsyncmeta: also supported with gles3 2017-12-09 19:31:55 +00:00
Alessandro Decina
464b9e7680 libgstgl: eagl: handle CALayer resize 2017-12-09 19:31:55 +00:00
Vasilis Liaskovitis
e10a2f8922 glmemory: Fix transfer_pbo memory leak
https://bugzilla.gnome.org/show_bug.cgi?id=744977
2017-12-09 19:31:55 +00:00
Julien Isorce
0ad168a258 gl/cocoa: reduce custom main loop latency
This fix a very slow rendering rate regression that only
happens when using gst-launch, i.e. in the case where
the main thread does not run any NSApp loop.

Git bisect reported it has been introduced by the commit
e10d2417e2:
"move to CGL and CAOpenGLLayer for rendering".

Then the commit 7d46357627:
"gstglwindow_cocoa: fix slow render rate" attempted to fix
the slow rendering rate problem when using gst-launch.

At least for me it does not work. I tried several
combinations, for example to flush CA transactions in the
custom app loop, as mentioned in the doc, but the only solution
that fixes the slow rendering is by reducing the loop latency.
From what I tested, no need to put less than 60ms, even if the
framerate has an interval much lower (16.6ms for 60 fps).
2017-12-09 19:31:55 +00:00
Mathieu Duponchelle
50ae80e0e6 gstglmemory: Remove now unused transfer_upload function. 2017-12-09 19:31:55 +00:00
Matthew Waters
2af5a108f1 glmemory: disable automatic pbo upload
until we can track where the data is/or is going to be.
2017-12-09 19:31:55 +00:00
Matthew Waters
af023d7c95 glememory: only store and act on the map flags on first/last map/unmap
Anytime else, we have no idea how to match up map and unmaps.
We also don't know exactly how the calling code is using us.
Also fixes the case where we're trying to transfer while someone else
is accessing our data pointer or texture resulting in mismatched video
frames.

https://bugzilla.gnome.org/show_bug.cgi?id=744839
2017-12-09 19:31:55 +00:00
Matthew Waters
3f32b45769 gl/cocoa: don't deadlock if the dispatch_sync is called from the main thread
Provide a helper function to check whether we are being called from
the main thread and act appropriately.
2017-12-09 19:31:55 +00:00
Matthew Waters
9938fe7fa9 gl/calayer: only start drawing if the parent gl context is ready
otherwise we may try to use GstGLFuncs * that hasn't been set yet
2017-12-09 19:31:54 +00:00
Matthew Waters
742e4a10a2 gl/cocoa: small refactor of layer/view creation into the window 2017-12-09 19:31:54 +00:00
Sebastian Dröge
c4e75844a8 glwindow: Remove assertion in gst_gl_window_show() for subclasses not implementing it
On Android and iOS we can't create a window ourselves, so also can't just show
one. That's not a problem and an assertion is not really needed here.
2017-12-09 19:31:54 +00:00
Edward Hervey
f56c4c541a gl: Add/Update more debug statements
Where possible, use the _OBJECT variants in order to track better from
which object the debug statement is coming from

Define (and use) GST_CAT_DEFAULT where applicable

Use GST_PTR_FORMAT where applicable
2017-12-09 19:31:54 +00:00
Edward Hervey
6d6c7f1f19 gl: Make glcontext debug category used in more places
As a bonus it makes the egl context debug messages visible now :)
2017-12-09 19:31:54 +00:00