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
Alessandro Decina
c24f0f49a8
libgstgl: set user data and GDestroyNotify for wrapped textures
2017-12-09 19:31:54 +00:00
Matthew Waters
2ad315b9e9
glproto/vao: only supported in core for ES 3.0+
...
Was causing horizontally flipped video for frame 2 onward on android
2017-12-09 19:31:54 +00:00
Matthew Waters
ff4951fe85
glfilter: ensure that the input upload/colorconvert are always available
2017-12-09 19:31:54 +00:00
Matthew Waters
608a3ddc7b
glupload: restrict EGL and UploadMeta to RGBA
...
other formats are highly untested.
2017-12-09 19:31:54 +00:00
Matthew Waters
ae14797982
glcolorconvert: don't intersect with the input caps
...
that limits our formats to whatever is in the input caps
2017-12-09 19:31:54 +00:00
Luis de Bethencourt
f524507659
gl: fix memory leak
...
In gst_gl_filter_fixate_caps () it can goto done without freeing the memory of
the tmp GstStructure. This makes it go out of scope and leak.
CID #1265765
2017-12-09 19:31:54 +00:00
Matthew Waters
17dba52ff3
gl: remove the egl caps from the src pads
...
we don't actually support producing EGLImage buffers anywhere.
2017-12-09 19:31:54 +00:00
Matthew Waters
68dc0fef6d
glcolorconvert: put GstGLSyncMeta on output buffers
...
allows thread safely using the provided output buffer in a separate
thread
2017-12-09 19:31:54 +00:00
Matthew Waters
f180fe8dc8
glupload: only try the glmemory upload for sysmem/glmemory caps features
...
Allows selecting/testing the upload path with explicit caps features.
2017-12-09 19:31:54 +00:00
Matthew Waters
c2149ec12c
glmemory: add missing initilisation of tex_target when copying
...
fixes:
glcolorscale ! video/x-raw\(meta:GstVideoGLTextureUploadMeta\) !
glimagesink
2017-12-09 19:31:54 +00:00
Matthew Waters
29ca0e8a44
glupload: allow NULL buffer for accept vfunc
2017-12-09 19:31:54 +00:00
Matthew Waters
45e6e77ff0
glupload: remove unsed convert field in private struct
2017-12-09 19:31:54 +00:00
Matthew Waters
530ae2cbb0
glupload/download/convert: provide transform_caps functions
...
Allows finer grain decisions about formats and features at each
stage of the pipeline.
Also provide propose_allocation for glupload besed on the supported
methods.
2017-12-09 19:31:54 +00:00
Alessandro Decina
0c459222f8
gstglwindow_cocoa: fix slow render rate
...
In gst_gl_window_cocoa_draw we used to just call setNeedsDisplay:YES. That was
creating an implicit CA transaction which was getting committed at the next
runloop iteration. Since we don't know how often the main runloop is running,
and when we run it implicitly (from gst_gl_window_cocoa_nsapp_iteration) we only
do so every 200ms, use an explicit CA transaction instead and commit it
immediately. CA transactions nest and debounce automatically so this will never
result in extra work.
2017-12-09 19:31:54 +00:00
Matthew Waters
f3beaecfa0
gstglcaopengllayer: use the correct rectangle type for iOS and OS X
2017-12-09 19:31:54 +00:00
Matthew Waters
dac1e577e7
glcolorconvert: use the correct caps feature for supported caps
...
glcolorconvert currently only supports converting between GLMemory
targets.
2017-12-09 19:31:54 +00:00
Matthew Waters
572265206c
glsyncmeta: don't use the gst debug object variants
...
We are not a GObject or any inferable GstMiniObject supported by
the gst debug system. Also fixes a segfault.
2017-12-09 19:31:54 +00:00
Alessandro Decina
1c1084881b
Revert "libgstgl: gstglcaopengllayer: set the layer as opaque"
...
This reverts commit 6f152d381c
.
The layer shouldn't be always opaque, it should be made a property.
2017-12-09 19:31:54 +00:00
Alessandro Decina
9f2f3fec17
libgstgl: gstglcaopengllayer: set the layer as opaque
2017-12-09 19:31:54 +00:00
Sebastian Dröge
78aaa6b1de
glcolorconvert: Add FIXME comment about possibility of non-Apple YCbCr422 rectangular textures
2017-12-09 19:31:53 +00:00
Sebastian Dröge
46086ac1fe
glcolorconvert: Only use GL_TEXTURE_RECTANGLE with OpenGL
...
It's not defined for GLES.
2017-12-09 19:31:53 +00:00
Alessandro Decina
9f1cb84523
libgstgl: run a custom shader to convert YUV to RGB on mac and ios
...
When GL_APPLE_ycbcr_422 is available, run a custom shader to convert
GL_TEXTURE_RECTANGLE textures from YUV to RGB.
See https://www.opengl.org/registry/specs/APPLE/ycbcr_422.txt
2017-12-09 19:31:53 +00:00
Alessandro Decina
966cad27d7
gl: initial support for texture targets other than GL_TEXTURE_2D
...
Make GstGLMemory hold the texture target (tex_target) the texture it represents
(tex_id) is bound to. Modify gst_gl_memory_wrapped_texture and
gst_gl_download_perform_with_data to take the texture target as an argument.
This change is needed to support wrapping textures created outside libgstgl,
which might be bound to a target other than GL_TEXTURE_2D. For example on OSX
textures coming from VideoToolbox have target GL_TEXTURE_RECTANGLE.
With this change we still keep (and sometimes imply) GL_TEXTURE_2D as the
target of textures created with libgstgl.
API: modify GstGLMemory
API: modify gst_gl_memory_wrapped_texture
API: gst_gl_download_perform_with_data
2017-12-09 19:31:53 +00:00
Alessandro Decina
f31ba88835
gstglcolorconvert: micro optimization
...
Don't call glClear && glClearColor at each draw since we're going to draw the
whole viewport anyway. Gets rid of a glFlush triggered by glClear on OSX.
2017-12-09 19:31:53 +00:00
Alessandro Decina
5c81a68eb1
gstglcolorconvert: relax caps features check
...
Require caps to have the GST_CAPS_FEATURE_MEMORY_GL_MEMORY feature but allow
them to have more features.
2017-12-09 19:31:53 +00:00
Matthew Waters
66cec1c47a
gl/win32: fixup compilation
2017-12-09 19:31:53 +00:00
Matthew Waters
598715fc4b
glwindow: make showing a window explicit
...
Also fixes the cgl context always displaying a window to render to for
every GstGLContextCocoa created
2017-12-09 19:31:53 +00:00
Matthew Waters
200842b3f8
gl/calayer: add resize callback based on the bounds rectangle
2017-12-09 19:31:53 +00:00
Matthew Waters
e8878507cb
gl/caopengllayer: draw asynchronously
...
This essentially makes the CAOpenGLLayer draw every refresh cycle.
2017-12-09 19:31:53 +00:00
Matthew Waters
c5bc8663ae
gl/cocoa: don't segfault if we have a NULL draw/resize/close callback
2017-12-09 19:31:53 +00:00
Matthew Waters
698f1236a4
cgl/calayer: use a callback instead of hardcoding the draw functionality
2017-12-09 19:31:53 +00:00
Matthew Waters
0cfeddbd05
cgl: install the gl context and gl layer headers
2017-12-09 19:31:53 +00:00
Matthew Waters
e57fb35bc0
cgl: add a header for the CAOpenGLLayer support
2017-12-09 19:31:53 +00:00
Philippe Normand
81f768be3e
gl/dispmanx: fix build
...
Commit ab48bb6f0f
changed the API of
GstGLWindow.
2017-12-09 19:31:53 +00:00
Matthew Waters
3f52b33c7a
glmemory: more compatibility defines for gles2 systems
2017-12-09 19:31:53 +00:00
Matthew Waters
03135a2238
glmemory: add some thread safety for gl operations
2017-12-09 19:31:53 +00:00
Matthew Waters
d8cc4cfc47
glmemory: use pbo's for download
...
In order to use pbo's efficiently, the transfer operation has to
be separated from the use of the downloaded data which requires some
rearchitecturing around glcolorconvert/gldownload and elements
2017-12-09 19:31:53 +00:00
Matthew Waters
230d19e172
glprototypes: add some (un)map buffer variants for GL/GLES
2017-12-09 19:31:53 +00:00
Matthew Waters
580c144fd7
gl/window/eagl: fix a couple of typos
2017-12-09 19:31:53 +00:00
Matthew Waters
fb103253d7
glwindow: cleanup/reorganize functions/members into logical groups
2017-12-09 19:31:53 +00:00
Matthew Waters
019367c128
glwindow: remove width/height from _draw()
...
Depending on the platform, it was only ever implemented to 1) set a
default surface size, 2) resize based on the video frame or 3) nothing.
Instead, provide a set_preferred_size () that elements/applications
can use to request a certain size which may be ignored for
videooverlay/other cases.
2017-12-09 19:31:53 +00:00
Matthew Waters
01248b1864
glcontext/cocoa: avoid destroying a possibly 0 GSource id
2017-12-09 19:31:53 +00:00
Matthew Waters
0e835bc374
gl/cocoa: move to CGL and CAOpenGLLayer for rendering
...
Removes the use of NSOpenGL* variety and functions. Any Cocoa
specific functions that took/returned a NSOpenGL* object now
take/return the CGL equivalents.
2017-12-09 19:31:53 +00:00
Matthew Waters
971e9e3128
glcontext/cocoa: add debug category
2017-12-09 19:31:53 +00:00
Sebastian Dröge
39e719fb33
Constify some static arrays everywhere
2017-12-09 19:31:53 +00:00
Lasse Laursen
2e3d26192f
glapi: fix compilation with latest MSVC
...
https://bugzilla.gnome.org/show_bug.cgi?id=743041
2017-12-09 19:31:52 +00:00
Matthew Waters
e3d3049641
glmemory: use the correct size for the pbo
...
It was missing the GstVideoAlignment padding which could cause GL
errors related to overrunning the size of the pbo.
2017-12-09 19:31:52 +00:00
Matthew Waters
aedfadd972
glmemory: remove spurious gst_video_info_align
...
That will be taken care of by the calling code (typically a bufferpool).
The GstVideoAlignment is purely informational to compute plane data sizes.
2017-12-09 19:31:52 +00:00
Matthew Waters
1dfeae2c42
gl: split glcolorconvert usage from glupload
...
the separation allows the transfer operation to occur in a separate
thread/time which may increase performance in specific circumstances.
2017-12-09 19:31:52 +00:00
Matthew Waters
19fbe2afbc
glmemory: offset the data pointer for upload for GstVideoAlignment
...
otherwise we attempt to read from the padding data
2017-12-09 19:31:52 +00:00
Matthew Waters
a2af67aef0
glmemory: use pbo's for upload
2017-12-09 19:31:52 +00:00
Matthew Waters
4288866e55
glupload: relax the GLMemory uploader check for input caps features
...
As there may be a sysmem caps features with GLMemory filled buffers.
e.g.
videotestsrc ! glimagesink
2017-12-09 19:31:52 +00:00
Nicola Murino
ef987be337
glcolorconvert: fix memleak
...
https://bugzilla.gnome.org/show_bug.cgi?id=741943
2017-12-09 19:31:52 +00:00
Nicola Murino
209fbd950f
glupload: fix some memory leaks
...
https://bugzilla.gnome.org/show_bug.cgi?id=741943
2017-12-09 19:31:52 +00:00
Matthew Waters
bef3f020a6
glcontext: allow wrapped contexts to be utilised like non-wrapped contexts
...
Fill in the missing pieces like get_proc_address, the gl function vtable
2017-12-09 19:31:52 +00:00
Sebastian Dröge
50a11e4a77
gl/cocoa: Disable hack for NSApp iteration with a special #define
...
The hack causes deadlocks and other interesting problems and it really
can only be fixed properly inside GLib. We will include a patch for
GLib in our builds for now that handles this, and hopefully at some
point GLib will also merge a proper solution.
A proper solution would first require to refactor the polling in
GMainContext to only provide a single fd, e.g. via epoll/kqueue
or a thread like the one added by our patch. Then this single
fd could be retrieved from the GMainContext and directly integrated
into a NSRunLoop.
https://bugzilla.gnome.org/show_bug.cgi?id=741450
https://bugzilla.gnome.org/show_bug.cgi?id=704374
2017-12-09 19:31:52 +00:00
Sebastian Dröge
c3f86ece48
gl/cocoa: Don't init and clear static GMutex / GCond
...
We would potentially use it from the main loop later in
gst_gl_window_cocoa_init_nsapp() if it timed out before.
2017-12-09 19:31:52 +00:00
Luis de Bethencourt
9d9d07168f
glfilter: remove logically dead code
...
Soon after setting two variables to 1, the code checks if their values are
different from each other. This would never be true. Removing this.
CID 1226443
2017-12-09 19:31:52 +00:00
Nicolas Dufresne
eeda7a29ce
glbufferpool: Always recalculate buffer size
...
Actually we should always recalculate buffer size since our buffer size
even when not-padded is smaller for many sub-sampled formats. This is
because we don't add padding between the planes.
https://bugzilla.gnome.org/show_bug.cgi?id=740900
2017-12-09 19:31:52 +00:00
Nicolas Dufresne
04cd97ae59
glmemory: No need for padding
...
A memory object cannot be put on stack, so no need for padding.
2017-12-09 19:31:52 +00:00
Nicolas Dufresne
a1e02726ee
gl: Add support for GstVideoAlignment
...
This allow saving a copy with libav video decoders or decoders with
similar padding requirement.
https://bugzilla.gnome.org/show_bug.cgi?id=740900
2017-12-09 19:31:52 +00:00
Nicolas Dufresne
45ac36ca26
glmemory: Handle upload/download flags from map
...
Problem was that if buffer was mapped READWRITE (state of buffers from
libav right now), mapping it READ/GL will not upload. This is because the
flag is only set when the buffer is unmapped. We can fix this by setting
the flags in map. This result in already mapped buffer that get mapped
to be read in GL will be uploaded. The problem is that if the write
mapper makes modification afterward, the modification will never get
uploaded.
https://bugzilla.gnome.org/show_bug.cgi?id=740900
2017-12-09 19:31:52 +00:00
Nicolas Dufresne
197e8de6e6
glmemory: Handle custom stride with OPENGL3
...
https://bugzilla.gnome.org/show_bug.cgi?id=740900
2017-12-09 19:31:52 +00:00
Wang Xin-yu (王昕宇)
fc09b8b93c
glfilter: fix position/texcoord attrib index usage
...
https://bugzilla.gnome.org/show_bug.cgi?id=741231
2017-12-09 19:31:52 +00:00
Matthew Waters
ba3a3cd783
gl: fixup vao and vbo usage for legacy GL
2017-12-09 19:31:52 +00:00
Philippe Normand
7c6d9b4c59
glsyncmeta: add G_END_DECLS
2017-12-09 19:31:51 +00:00
Julien Isorce
690b20b9f4
glcontext: try cgl before glx
...
It was already done by commit
f506e80686
but it has been broken by commit
45ec777cea
2017-12-09 19:31:51 +00:00
Matthew Waters
bbac8bf8d0
glcontext: require GL_ARB_ES2_compatibility for opengl3
...
until we generate gl3 compliant shaders
https://bugzilla.gnome.org/show_bug.cgi?id=740012
2017-12-09 19:31:51 +00:00
Matthew Waters
0af6dcfa23
gl: fixup compat definition for GLuint64 for OS X
2017-12-09 19:31:51 +00:00
Matthew Waters
462a202427
gl: add compat definition for GLuint64 for android
...
../../../../gst-libs/gst/gl/glprototypes/sync.h:41:23: error: unknown type name 'GLuint64'
GLuint64 timeout))
2017-12-09 19:31:51 +00:00
Matthew Waters
81a470905b
glsync: fix build with desktop gl
2017-12-09 19:31:51 +00:00
Matthew Waters
3be1edc634
gl: fix various build errors without desktop gl
2017-12-09 19:31:51 +00:00
Matthew Waters
a2a8059daf
gldisplay: fix build error
...
gstgldisplay.c:234:541: error: 'return' with no value, in function returning non-void [-Werror]
g_return_if_fail (GST_IS_GL_DISPLAY (display));
2017-12-09 19:31:51 +00:00
Matthew Waters
4bd62ebb03
gldisplay: implement runtime GL api filtering
...
Needed so that the pipeline/application can limit the choice of GL api
to what it supports
2017-12-09 19:31:51 +00:00
Matthew Waters
892d056a44
gl: remove the use of glu
2017-12-09 19:31:51 +00:00
Matthew Waters
6bb113f685
gl: add a sync meta for synchronizing across GL contexts
...
A context can create a GLsync object that can be waited on in order
to ensure that GL resources created in one context are able to be
used in another shared context without any chance of reading invalid
data.
This meta would be placed on buffers that are known to cross from
one context to another. The receiving element would then wait
on the sync object to ensure that the data to be used is complete.
2017-12-09 19:31:51 +00:00
Matthew Waters
f4dbfec17b
glprototypes: add sync function definitions
2017-12-09 19:31:51 +00:00
Matthew Waters
8e98591153
glfilter: add a gl3 code path using vao's and vbo's
2017-12-09 19:31:51 +00:00
Matthew Waters
414a319f03
glframebuffer: add support for gl3
2017-12-09 19:31:50 +00:00
Matthew Waters
b6fc74c9b8
glcolorconvert: add support for gl3
2017-12-09 19:31:50 +00:00
Matthew Waters
dcd5fce8fb
glshader add support for gl3
2017-12-09 19:31:50 +00:00
Matthew Waters
86c084f1af
glx: ask for a GL3 core context
2017-12-09 19:31:50 +00:00
Sebastian Dröge
a6f02d4b29
glcolorconvert: Unref buffer with the correct function
2017-12-09 19:31:50 +00:00
Sebastian Dröge
5b13dca0ce
glmemory: Handle failure of memory allocation gracefully
2017-12-09 19:31:50 +00:00
Sebastian Dröge
47a8242399
glmemory: Use g_try_malloc() in the appropriate places
...
g_malloc() aborts if allocation fails, it's pointless to check against NULL
afterwards. That's why g_try_malloc() exists.
2017-12-09 19:31:50 +00:00
Wang Xin-yu (王昕宇)
45db2931c8
glcolorconvert: support RGB16/BGR16 video format download
...
https://bugzilla.gnome.org/show_bug.cgi?id=740801
2017-12-09 19:31:50 +00:00
Matthew Waters
e32c4a62c2
gl/wayland: implement resizing the window using the right mouse button
2017-12-09 19:31:50 +00:00
Matthew Waters
e252c908e7
glfilter: support fixed dimensions on both sides of the element
...
Fixes:
width=320,height=240 ! glfilter ! width=800,height=600
width=230,height=240 ! glfilter ! width=600
... ! glfilter ! width=800
2017-12-09 19:31:50 +00:00
Ramprakash Jelari
c5804b9af5
glcontext: Fix unused variable warning by moving declaration where it is actually used
2017-12-09 19:31:50 +00:00
Sebastian Dröge
3c7095e5ad
glupload: Fix valid compiler warning
...
gstglupload.c:442:32: error: if statement has empty body [-Werror,-Wempty-body]
if (upload->texture_ids[i]);
^
2017-12-09 19:31:50 +00:00
Philippe Normand
ce58219124
gl: ship the gstglcontext_egl.h header
...
It is required by gsteglimagememory.h.
https://bugzilla.gnome.org/show_bug.cgi?id=740611
2017-12-09 19:31:50 +00:00