Commit graph

1048 commits

Author SHA1 Message Date
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
Tim-Philipp Müller 13706c2c05 gl: shadervariables: make parsing of floats locale-independent
Floating point numbers are written differently in different
locales, e.g. in many countries 1/2 = 0,5 instead of 0.5, and
strtod will not be able to parse "0.5" correctly in such a
locale.
2017-12-09 19:31:50 +00:00
Matthew Waters 97607a0d50 glshadervariables: also trim \r as well as \n 2017-12-09 19:31:50 +00:00
Matthew Waters 00506bf183 glupload: rearchitecture for non GLMemory inputs/outputs
Allows other memory types to be implemented/returned/used by the caller.
2017-12-09 19:31:50 +00:00
Vineeth T M d747c65d4c glcontext: build errors when GST_GL_HAVE_OPENGL is 0
Moving variables within #if GST_GL_HAVE_OPENGL, which are not going to be used otherwise.
and which are needed only when OpenGl is present

https://bugzilla.gnome.org/show_bug.cgi?id=740235
2017-12-09 19:31:50 +00:00
Matthew Waters e731762984 glfilter: add read-only context property 2017-12-09 19:31:50 +00:00
Sebastian Dröge 8f5faa3872 gl/cocoa: Only use convertRectToBacking on OSX >= 10.7
It does not exist before and older versions also don't have
support for HiDPI displays anyway.

https://bugzilla.gnome.org/show_bug.cgi?id=740201
2017-12-09 19:31:50 +00:00
Sebastian Dröge d70f6a9b5e gl: Use numeric OSX version instead of the macro
The macro is not defined on older OSX versions and evaluates to 0.

https://bugzilla.gnome.org/show_bug.cgi?id=740201
2017-12-09 19:31:50 +00:00
Sebastian Dröge 3fe5be7c9a gl/cocoa: Don't override the application delegate
Otherwise interesting things will happen in Cocoa applications, like
infinite event loops that block the NSApplication loop forever.

This was only needed for GNUStep and thus can safely be removed now.
2017-12-09 19:31:50 +00:00
Sebastian Dröge 673b0190af gl/cocoa: Remove GNUStep support
Until gcc and GNUStep properly support Objective-C blocks and other
"new" features of Objective-C we can't properly support them without
making the code much more ugly.

https://bugzilla.gnome.org/show_bug.cgi?id=739152
2017-12-09 19:31:50 +00:00
Hyunjun Ko db6ea1b3bd gl: Correct invalid comment text 2017-12-09 19:31:49 +00:00
Julien Isorce af59b771fd gl: do not raise a critical msg if the backend does not handle window events
Fix "assertion 'window_class->handle_events != NULL' failed"
if not using a X11 window.
2017-12-09 19:31:49 +00:00
Matthew Waters af9b73043e gl: remove the width/height fields from the caps to support frame resizing
It was previously only occuring with sysmem caps features

https://bugzilla.gnome.org/show_bug.cgi?id=739334
2017-12-09 19:31:49 +00:00
Sebastian Dröge 90022c451c gstglconfig: Put gstglconfig.h into $(libdir)/gstreamer-1.0/include
It's architecture dependent and should not be placed into the include
directory as the assumption is that all those headers are architecture
independent.

https://bugzilla.gnome.org/show_bug.cgi?id=739767
2017-12-09 19:31:49 +00:00
Matthew Waters d738b78229 glutils: only attempt getting the app context when we don't already have a display
avoids querying/messaging the world on each frame
2017-12-09 19:31:49 +00:00
Matthew Waters e2f61d20a2 glcontext: fail context creation if glGetString returns NULL 2017-12-09 19:31:49 +00:00
Lubosz Sarnecki 64dd17bde6 glimagesink: implement gst_video_overlay_handle_events
https://bugzilla.gnome.org/show_bug.cgi?id=736035
2017-12-09 19:31:49 +00:00
Julien Isorce f1365f1051 gl/cocoa: use NSAutoreleasePool to free resize data
Otherwise when resizing the window you will also get messages like:
class NSConcreteMapTable autoreleased with no pool in place - just leaking
class NSConcreteValue autoreleased with no pool in place - just leaking
class NSConcreteValue autoreleased with no pool in place - just leaking
class __NSCFDictionary autoreleased with no pool in place - just leaking
2017-12-09 19:31:49 +00:00
Julien Isorce ef707ee9d5 gl/cocoa: include gl3.h to have GL_CONTEXT_PROFILE_MASK 2017-12-09 19:31:49 +00:00
Julien Isorce f44b430bc7 gl/cocoa: make sure to turn on frame rectangle changes notifications
Default value of property postsFrameChangedNotifications is YES
but it is worth to explicitly enable it.
2017-12-09 19:31:49 +00:00
Julien Isorce 4a736caded gl/cocoa: fix uncaught exception 'unrecognized selector sent to instance'
Need to set the ':' as the reshape method now takes one parameter.
For the story, the GstGLNSView was previously inheriting from
NSOpenGLView which has a reshape function without any parameter.
Now the GstGLNSView inherits from NSView and we re-use the reshape
function manually.
2017-12-09 19:31:49 +00:00
Julien Isorce a581d479ff gl/cocoa: fix compiler warning
Use the reshape function after being defined. The other way
would have been to declare the reshape function in the header.

gstglwindow_cocoa.m: In function '-[GstGLNSView drawRect:]':
gstglwindow_cocoa.m:555: warning: 'GstGLNSView' may not respond to '-reshape'
gstglwindow_cocoa.m:555: warning: (Messages without a matching method signature
gstglwindow_cocoa.m:555: warning: will be assumed to return 'id' and accept
gstglwindow_cocoa.m:555: warning: '...' as arguments.)
2017-12-09 19:31:49 +00:00
Tim-Philipp Müller 653c04b121 gl: fix Since marker for gst_gl_window_run_navigation() 2017-12-09 19:31:49 +00:00
Luis de Bethencourt f16b75aa49 glshader: Fix memory leak
Memory is only freed in the TRUE clause of the if conditional. Free in the else
clause as well.
Also, consolidate g_malloc + sprintf into a g_strdup_printf().

CID #1212171

https://bugzilla.gnome.org/show_bug.cgi?id=739368
2017-12-09 19:31:49 +00:00
Luis de Bethencourt eabcf66f2f glcolorconvert: fix comments that confuse gtk-doc
GTK-Doc uses a special syntax for code documentation. A multiline comment that
starts with an additional '*' marks a documentation block that will be processed
by the GTK-Doc tools. So GTK-Doc is confused if a comment block starts with that
additional '*' but isn't meant to be processed. Removing this additional '*'.

https://bugzilla.gnome.org/show_bug.cgi?id=739444
2017-12-09 19:31:49 +00:00
Matthew Waters 35e9b5ab8b gl: sprinkle some Since markers 2017-12-09 19:31:49 +00:00
Matthew Waters 6811c39ff9 gl/examples: update for other-context property removal 2017-12-09 19:31:49 +00:00
Matthew Waters 7d97a35139 glcontext: add more functionality to wrapped contexts
Implements get_current_context() and get_proc_address() for wrapped
contexts.
2017-12-09 19:31:49 +00:00
Matthew Waters 366eaea6d2 glshader: advertise the default vertex and fragment shaders on desktop GL 2017-12-09 19:31:49 +00:00
Matthew Waters 59e4a039c9 glfilter: get the config from the correct pool 2017-12-09 19:31:48 +00:00
Matthew Waters cc2e0a7288 glfilter: avoid uninitialized variable size when chaining multiple glfilters
https://bugzilla.gnome.org/show_bug.cgi?id=739277
2017-12-09 19:31:48 +00:00
Matthew Waters f1dddf4f6b glfilter: gst-indent file 2017-12-09 19:31:48 +00:00
Matthew Waters be5d0d81e4 glcontext: add api for retreiving the current context and api
that is current in the calling thread.
2017-12-09 19:31:48 +00:00
Matthew Waters 91a7bd0d9a glprototypes: add vertex attribute array definitions 2017-12-09 19:31:48 +00:00
Matthew Waters 62e3c40d97 gl: propogate other-context using GstContext 2017-12-09 19:31:48 +00:00
Sebastian Dröge 3d7a6c8db6 gl/cocoa: Fix compiler warning
gstglwindow_cocoa.m: In function '-[GstGLNSView drawRect:]':
gstglwindow_cocoa.m:555: warning: 'GstGLNSView' may not respond to '-reshape'
gstglwindow_cocoa.m:555: warning: (Messages without a matching method signature
gstglwindow_cocoa.m:555: warning: will be assumed to return 'id' and accept
gstglwindow_cocoa.m:555: warning: '...' as arguments.)
2017-12-09 19:31:48 +00:00
Matthew Waters 0806de5c75 glbufferpool: add the GstVideoGLTextureUploadMeta buffer pool option 2017-12-09 19:31:48 +00:00
Wang Xin-yu (王昕宇) 77682a51e6 glcolorconvert: support RGB16/BGR16 video format upload
https://bugzilla.gnome.org/show_bug.cgi?id=738842
2017-12-09 19:31:48 +00:00
Brion Vibber 02a0b92d9d gl/cocoa: Fix for building on Mac OS X 10.10
Using NSApp directly seems to confuse something, as the compiler
was expecting an id<NSFileManagerDelegate>. Switched to using
[NSApplication sharedApplication], and specified the delegate
protocol on the window class as well.

https://bugzilla.gnome.org/show_bug.cgi?id=738740
2017-12-09 19:31:48 +00:00
Matthew Waters 6663967994 glfilter: add uploaded_buffer field 2017-12-09 19:31:48 +00:00
Sebastian Dröge 6d273084eb gl/cocoa: Add support for HiDPI displays
Without this our GL surface would be upscaled after rendering
by Cocoa, which would reduce image quality.
2017-12-09 19:31:48 +00:00
Matthew Waters 3439402164 glcolorconvert: output why we cannot convert a buffer 2017-12-09 19:31:48 +00:00
Matthew Waters df6967c274 glcolorconvert: fix planar YUV download
- sample the u and v planes properly
- output the correctly scaled u and v planes for different chroma block sizes
2017-12-09 19:31:48 +00:00
Matthew Waters a771b40474 glcolorconvert: fix UYVY download green screen 2017-12-09 19:31:47 +00:00
Matthew Waters ea711807d8 glcolrconvert: fix YUY2 download
- The shader was outputing the wrong values compared with raw
  videotestsrc.
- deal with the texture edge properly.
- properly sample the 2x1 rectangle for the u and v values
- don't double sample the y value
2017-12-09 19:31:47 +00:00
Sebastian Dröge 435810b238 gl/cocoa: Always update our viewport if Cocoa tells us something has changed
The visible rect and bounds might be the same as before, but Cocoa
might've changed our viewport without us nothing. This happens if
you hide the view and show it again.
2017-12-09 19:31:47 +00:00
Sebastian Dröge b44798d549 gl/cocoa: Handle NSView::renewGState() properly
Don't update the screen until we redraw, this prevents flickering during
scrolling, clipping, resizing, etc
2017-12-09 19:31:47 +00:00
Matthew Waters e6bd70d580 glcolorconvert: convert xRGB into ARGB properly
The alpha channel might not be the last component so check which one
it is in and clobber that one instead.
2017-12-09 19:31:47 +00:00
Matthew Waters 5c7b5e0210 glmemory: unset the opposite corresponding transfer flags when mapped with write
fixes consistency with consecutive gst_memory_map()'s with
flags & GST_MAP_WRITE
2017-12-09 19:31:47 +00:00
Sebastian Dröge b1a5ae7c0d gl/cocoa: Update viewport according to the current clipping
We have to update the GL viewport if the NSView is only partially
visible. Otherwise the content of the frame will be visibly offset.
2017-12-09 19:31:47 +00:00
Sebastian Dröge 9ff86a3c54 gl/cocoa: Improve the NSApplication initialization
This is only for non-Cocoa apps but previously caused a 2 second
waiting during startup for Cocoa apps. This is unacceptable.

Instead we now check a bit more extensive if something actually
runs on the GLib default main context, and if not don't even
bother waiting for something to happen from there.
2017-12-09 19:31:47 +00:00
Sebastian Dröge 7cf214796a gl/cocoa: NSView::drawRect() should call into reshape too
We a) need to render again because part of the window was
obscured and b) might need to reshape because of clipping
changes.
2017-12-09 19:31:47 +00:00
Sebastian Dröge 32b23a340e gl/cocoa: Call UI related API from the application main thread 2017-12-09 19:31:47 +00:00
Sebastian Dröge 02b3e26854 gl/cocoa: Switch to a plain NSView subclass instead of NSOpenGLView
We don't and can't use NSOpenGLView as it's supposed to be used and
it gets into our way by being to clever in various situations.
2017-12-09 19:31:47 +00:00
Edward Hervey ef00d85f16 glcontext: Initialize variable
Avoids the following warning:

gstglcontext.c:647:58: error: 'prev' may be used uninitialized in
 this function [-Werror=maybe-uninitialized]
2017-12-09 19:31:47 +00:00
Matthew Waters ca476f03a8 glcontext: fixup error in sharegroup comment 2017-12-09 19:31:47 +00:00
Matthew Waters 817417c005 glcontext: detect the sharegroup case where the context are in different chains
In the end they will lead to the same root context in the tree so check that
for equality.
2017-12-09 19:31:47 +00:00
Matthew Waters 80be2d046b glfilter: silence a warning with empty input caps
discovered with the doublecube example

gst_caps_get_features: assertion 'index < GST_CAPS_LEN (caps)' failed
2017-12-09 19:31:47 +00:00
Sebastian Dröge ec0d04acec gl/cocoa: Switch from our custom main loop to a GMainLoop
Simplifies code a lot and makes it more similar to the other backends.
2017-12-09 19:31:46 +00:00
Sebastian Dröge 6c8f7f9dd5 gl/cocoa: Clear the current GL context when it should happen 2017-12-09 19:31:46 +00:00
Matthew Waters ae919f4475 gl: download whenever we have sysmem capsfeatures
Otherwise we could pass on a RGBA formatted buffer and downstream would
misinterpret that as some other video format.

Fixes pipelines of the form

    gleffects ! tee ! xvimagesink
2017-12-09 19:31:46 +00:00
Matthew Waters ccf8f014f0 glupload: fallback to upload if contexts cannot share GL resources
Fixes pipelines of the form

    gleffects ! tee ! glimagesink

as tee does not pass on the allocation query.
2017-12-09 19:31:46 +00:00
Matthew Waters 14630fac38 glcontext: add gst_gl_context_can_share
Which determines whether two GstGLContext's can share sharable
OpenGL resources.
2017-12-09 19:31:46 +00:00
Sebastian Dröge 9dd4f40ad6 gl: Let gst_gl_context_get_thread() return a new reference to the GThread
Otherwise it might go away in the meantime and the caller has some random pointer.
2017-12-09 19:31:46 +00:00
Anuj Jaiswal e9e84da30a gl: consecutive return, break statement
Signed-off-by: Anuj Jaiswal <anuj.jaiswal@samsung.com>

https://bugzilla.gnome.org/show_bug.cgi?id=736939
2017-12-09 19:31:46 +00:00
Matthew Waters 678e7b49b2 gl/debug: desktop GL does not have the KHR suffixes 2017-12-09 19:31:46 +00:00