Commit graph

137 commits

Author SHA1 Message Date
Matthew Waters 4bbda2b626 glframebuffer: rewrite for a more consistent API
Facilities are given to create fbo's and attach GL memory (renderbuffers
or textures).  It also keeps track of the renderable size for use with
effective use with glViewport().
2017-12-09 19:32:21 +00:00
Matthew Waters 1153684a94 glmemory: add the texture type to allocate to parameters
Rather than assuming something.  e.g. zerocopy on iOS with GLES3 requires
the use of Luminance/Luminance Alpha formats and does not work with
Red/RG textures.
2017-12-09 19:32:21 +00:00
Guillaume Desmottes f077d937ad glimagesink: fix query leak in test
https://bugzilla.gnome.org/show_bug.cgi?id=766663
2017-12-09 19:32:20 +00:00
Guillaume Desmottes a7f21fedc5 glimagesink: properly setup/teardown tests
tcase_add_checked_fixture() is suppose to call the setup and teardown
functions so the tests don't have to do it manually.

https://bugzilla.gnome.org/show_bug.cgi?id=766663
2017-12-09 19:32:20 +00:00
Guillaume Desmottes e7217fad33 glupload: fix shader leak in test
https://bugzilla.gnome.org/show_bug.cgi?id=766663
2017-12-09 19:32:20 +00:00
Matthew Waters ce72589510 tests/glcontext: update test for gen,del_texture removal 2017-12-09 19:32:20 +00:00
Matthew Waters e3b5214ac6 gl/examples: fix switchvideooverlay for wayland
and call XInitThreads() for X11
2017-12-09 19:32:18 +00:00
Matthew Waters df6a85725f gl/examples: remove duplicated videooverlay example
filtervideooverlay proved the exact same example (only with a extra glfiltercube).
2017-12-09 19:32:18 +00:00
Matthew Waters ed1ff251db gl/examples/3d: additions for wayland support 2017-12-09 19:32:18 +00:00
Sebastian Dröge 82a39d2227 gl/gtk: Fix compiler warning in example
fxtest.c: In function ‘main’:
fxtest.c:190:3: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement]
   GtkWidget *window;
   ^~~~~~~~~
2017-12-09 19:32:18 +00:00
Matthew Waters 015ec7587f gl/examples/qt: restrict the GL API to opengl where needed
Until the examples are ported to opengl3/gles2, they will not work with any
other GL api.
2017-12-09 19:32:18 +00:00
Matthew Waters d2542993dd gl/examples/gtk: call XInitThreads
Fixes some sporadic X11 threading assertions.
2017-12-09 19:32:18 +00:00
Matthew Waters 34e12a8837 gl/examples/cube*: choose opengl by default
The examples don't work with any other GL API.

Also fix the yuv example to not translate the cube out of the clipping area.
2017-12-09 19:32:17 +00:00
Matthew Waters c3e362a8a9 gl/examples/fxtest: add needed glupload to the pipeline
Fixes a negotiation failure in the example
2017-12-09 19:32:17 +00:00
Matthew Waters eb1a9bb9b0 gldisplay: make readding the same context a no-op
With e38af23044 returning the correct contexts,
gst_gl_display_add_context() was susceptible to causing infinte loops when
adding the same GstGLContext more than once.  Fix and add a test for
gst_gl_display_add_context().

Fixes glvideomixer gst-validate tests.
2017-12-09 19:32:17 +00:00
Matthew Waters 65533b807c gl: add a gstglquery object for arbitrary GL queries
Currently only GL_TIME_ELAPSED and GL_TIMESTAMP are supported
2017-12-09 19:32:15 +00:00
Matthew Waters 472970324c glcontext: implement checking whether a context has been shared
Some operations are unnecessary when running with only a single GL
context.
e.g. glFlush when setting a fence object as the flush happens on wait.

API: gst_gl_context_is_shared
2017-12-09 19:32:14 +00:00
Matthew Waters 9328ec33f3 tests/glmemory: output data pointer values on failure
Allows quicker inspection of what failed.
2017-12-09 19:32:14 +00:00
Sebastian Dröge eeb4fe6f63 glcolorconvert: Fix name of testsuite 2017-12-09 19:32:13 +00:00
Matthew Waters 09c8c23842 gl*memory*: reverse the parameter order of user_data and destroy notify
The convention is to have the destroy notify last after any user data
2017-12-09 19:32:13 +00:00
Matthew Waters 1673a6192f glmemorypbo: remove our own alloc()/wrapped()/etc functions
replaced by equivalent functionality within gst_gl_base_memory_alloc()
2017-12-09 19:32:13 +00:00
Sebastian Dröge f2e4344385 clutter: Fix compilation error in GL examples
Include gst/gl.h instead of specific headers to prevent such problems also in
the future.

In file included from ../../../../gst-libs/gst/gl/gl.h:47:0,
                 from ../../../../gst-libs/gst/gl/gstglbasememory.h:137,
                 from ../../../../gst-libs/gst/gl/gstglmemory.h:29,
                 from cluttershare.c:39:
../../../../gst-libs/gst/gl/gstglmemorypbo.h:51:20: error: field ‘mem’ has incomplete type
   GstGLMemory      mem;
                    ^
../../../../gst-libs/gst/gl/gstglmemorypbo.h:124:24: error: field ‘parent’ has incomplete type
   GstGLMemoryAllocator parent;
                        ^
../../../../gst-libs/gst/gl/gstglmemorypbo.h:134:29: error: field ‘parent_class’ has incomplete type
   GstGLMemoryAllocatorClass parent_class;
                             ^
2017-12-09 19:32:12 +00:00
Matthew Waters 56c3d97421 tests: update for glmemory api changes 2017-12-09 19:32:12 +00:00
Matthew Waters ba03bc2cba tests/glmemory: include the generic gl header
Including gstglmemory.h directly results in the compiler complaining
about incomplete types.
2017-12-09 19:32:12 +00:00
Matthew Waters 76a38dd66a glmemory: base classify and add the pbo memory on top
The base class is useful for having multiple backing memory types other
than the default.  e.g. IOSurface, EGLImage, dmabuf?

The PBO transfer logic is now inside GstGLMemoryPBO which uses GstGLBuffer
to manage the PBO memory.

This also moves the format utility functions into their own file.
2017-12-09 19:32:12 +00:00
Matthew Waters cd584d215c gluploadmeta; remove convenience helper API
It was not really useful as if one knows about libgstgl, one can just use
GLMemory objects directly.
2017-12-09 19:32:12 +00:00
Vineeth TM 0adc7e1bc4 tests:glsl: version_profile_s string leak
https://bugzilla.gnome.org/show_bug.cgi?id=758039
2017-12-09 19:32:11 +00:00
Vineeth TM 606e3dee98 tests:glupload: fix caps memory leak
https://bugzilla.gnome.org/show_bug.cgi?id=758039
2017-12-09 19:32:11 +00:00
Vineeth TM 2c4a14f7c7 tests:glcolorconvert: Fix caps memory leak
Output caps being got from video info is not getting freed

https://bugzilla.gnome.org/show_bug.cgi?id=757929
2017-12-09 19:32:11 +00:00
Matthew Waters 25e3e1eb7b gl/tests: update for glmemory api changes 2017-12-09 19:32:10 +00:00
Matthew Waters 681cb5b16d glmemory: add support for rectangle textures
Add the various tokens/strings for the differnet texture types (2D, rect, oes)

Changes the GLmemory api to include the GstGLTextureTarget in all relevant
functions.

Update the relevant caps/templates for 2D only textures.
2017-12-09 19:32:10 +00:00
Matthew Waters 28d6a3edec gl/tests: port glcontext test to opengl
Now uses vao's and vbo's when possible like the rest of the gstgl library.
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 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
Vineeth TM def421acf6 gstreamer: bad: Fix memory leaks when context parse fails
When g_option_context_parse fails, context and error variables are not getting free'd
which results in memory leaks. Free'ing the same.

And replacing g_error_free with g_clear_error, which checks if the error being passed
is not NULL and sets the variable to NULL on free'ing.

https://bugzilla.gnome.org/show_bug.cgi?id=753854
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
Edward Hervey 7e62a38569 checks: Ensure thread-safe libX11/GL when running tests 2017-12-09 19:32:07 +00:00
Matthew Waters 8cad1e5b49 tests/glcontext: fix INVALID_ENUM GL error in test 2017-12-09 19:32:07 +00:00
Nicolas Dufresne b817307165 glcolorconvert-test: Test notify function for setup_wrapped
gst_gl_memory_setup_wrapped() now takes a destroy notify function. This
destroy notify is called to track the memory life time, hence will
notify each time a memory get destroyed. This test check that the
callback count is correct.
2017-12-09 19:32:07 +00:00
Nicolas Dufresne f4a0c062dc glcolorconvert-test: Fix build 2017-12-09 19:32:07 +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 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
Jan Schmidt c096fec277 3dvideo: Add simple gtk example stereoscopic video player
https://bugzilla.gnome.org/show_bug.cgi?id=611157
2017-12-09 19:32:04 +00:00
Matthew Waters aff768f34c gl/examples: update qt examples for api changes 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
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
Julien Isorce 66c8c8ad87 gl/example: fix build error when compiling cocoa-videooverlay
libtool: error: ignoring unknown tag OBJC
and
clang: error: argument unused during compilation: '-pthread'
2017-12-09 19:32:03 +00:00
Edward Hervey 786b857e62 examples: Fix gl usage without wayland support
Not all platforms have wayland support. Handle that gracefully at
compile time
2017-12-09 19:32:03 +00:00
Matthew Waters 411d4d13b4 gl/examples: update gtk examples for glupload 2017-12-09 19:32:03 +00:00