Commit graph

1226 commits

Author SHA1 Message Date
Matthew Waters aa32408926 glcolorconvert: order the caps template so that RGBA is first
glcolorconvert ! glcolorconvert would sometimes negotiated RGB
(the first list entry) otherwise.
2017-12-09 19:32:10 +00:00
Matthew Waters 33f73b400d glbufferpool: move typedef's into the forward decleration file
Otherwise, for example, clang will warn about typedef redefinitions
being a C11 feature.
2017-12-09 19:32:10 +00:00
Julien Isorce 6bb560a4eb glslstage: 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:10 +00:00
Matthew Waters ad49a39e5b glcolorconvert: allow outputting multiple textures for gles3 contexts
the USING_GLES2 includes all GLES3 contexts as well which does support
drawing to multiple buffers.  Instead make or decision solely based on
whether glDrawBuffers is available or not.
2017-12-09 19:32:10 +00:00
Matthew Waters cfb0d7e9f3 glviewconvert: expose the element on gles2 platforms
We can do everything with gles3 however gles2 restricts us not allowing
separated or frame-by-frame multiview modes due to multiple draw buffers.
2017-12-09 19:32:09 +00:00
Matthew Waters 764c4a33bc gl: fix usage of string.h and stdio.h functions without including the headers
e.g:
gstglcontext_egl.c:613:7: error: implicit declaration of function 'strcmp'
[-Werror=implicit-function-declaration]
   if (strcmp (G_MODULE_SUFFIX, "so") == 0)
2017-12-09 19:32:09 +00:00
Matthew Waters 4d46edfd50 gl: remove unneeded shader variable parsing code 2017-12-09 19:32:09 +00:00
Matthew Waters 06de6998e5 gl: be consistent in gobject boilerpate
GST_GL_IS_* vs GST_IS_GL_*

git grep -l 'GST_GL_IS_' | xargs sed -i 's/GST_GL_IS_/GST_IS_GL_/g'
2017-12-09 19:32:09 +00:00
Matthew Waters 463e23bb47 glslstage: add brackets around pointer dereference referencing an array
While technically, i is always 0 and *vertex_sources[i++] is equivalant
to (*vertex_sources)[i++].  Be future-proof in the case of code
moves/changes/etc.

CID 1327406
2017-12-09 19:32:09 +00:00
Matthew Waters f688a8f0b2 glshader: port to using GstGLSLStage objects for string management
A GstGLShader is now simply a collection of stages that are
compiled and linked together into a program.  The uniform/attribute
interface has remained the same.
2017-12-09 19:32:09 +00:00
Matthew Waters 8c922ca96b glsl: add a shader stage object GstGLSLStage
Represents a stage (vertex, geometry, fragment, etc) in the shader
pipeline.
2017-12-09 19:32:09 +00:00
Matthew Waters 18e205dcbb gl/shader/variables: include generic gl.h header
Otherwise we may miss some forward declarations

Fixes build error: undefined reference to GstGLSLStage
2017-12-09 19:32:09 +00:00
Matthew Waters 332543f3cf gl: add some GLSL utility functions
Specifically parsing/setting GLSL versions and the shader related
function table.
2017-12-09 19:32:09 +00:00
Guillaume Desmottes 01e1046dbc gl: fix leak in gst_gl_insert_debug_marker()
The string allocated by g_vasprintf() was leaked.

Reproduced using the
validate.file.compositor.simple.play_15s.synchronized validate scenario.

https://bugzilla.gnome.org/show_bug.cgi?id=756492
2017-12-09 19:32:09 +00:00
Matthew Waters 16ee1636dc gl: move debugging related functions to their own file 2017-12-09 19:32:09 +00:00
Antoine Jacoutot 9117b50cfb gl: Pass GL_CFLAGS to g-ir-scanner
This unbreaks building when some headers are under a non-standard path.
e.g. /usr/X11R6/include as on OpenBSD.

https://bugzilla.gnome.org/show_bug.cgi?id=755850
2017-12-09 19:32:09 +00:00
Matthew Waters 37047a1050 glcontext: fixup strstr lengths so we don't overrun 2017-12-09 19:32:09 +00:00
Matthew Waters 73bad9e856 glupload: remove useless release_buffer
It's a leftover from when we weren't outputting GstBuffer's and
returning raw texture id's.
2017-12-09 19:32:09 +00:00
Matthew Waters 0580536fa1 glutils: use gst_element_set_context for setting display/other_context
1. So we get tracking inside GstElement properly when e.g. adding to a bin
2. Removes redundant code.  Now only one place where
   GstContext->GstGLDisplay/GstGLContext transformation occurs
3. Fixes a memory leak in the process
4. Make the retrieval of debug categories thread safe
2017-12-09 19:32:09 +00:00
Matthew Waters 977c335460 gl/eagl: use the default GL context debug category 2017-12-09 19:32:09 +00:00
Matthew Waters dc469454d7 gl: set the context on the element on a context query
Otherwise it's possible to lose the context information if the
context is only propagated through queries.
2017-12-09 19:32:09 +00:00
Matthew Waters 8187171908 gl: chain up to the parent class for GstElement::set_context
https://bugzilla.gnome.org/show_bug.cgi?id=705579
2017-12-09 19:32:08 +00:00
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