Commit graph

650 commits

Author SHA1 Message Date
Matthew Waters
12ecf507b8 gl: fix incorrect usage of g_return_if_fail 2017-12-09 19:31:36 +00:00
Matthew Waters
30c6efc432 gl/mem: allocate the memory per plane
This patch provides the basic infrastructure required for this.
Upload and Download has been ported to this.

Has the nice effect of allowing GstGLMemory to be our
refcounted texture object for any texture type (not just RGBA).

Should not lose any features/video formats.
2017-12-09 19:31:36 +00:00
Matthew Waters
ea2d4cb446 gl/eglimage: #if 0 unused code 2017-12-09 19:31:36 +00:00
Matthew Waters
fba49c3463 gl: add colorconvert object that converts between color spaces/formats
Currently used by both upload and download objects separately.
2017-12-09 19:31:36 +00:00
Vincent Penquerc'h
7de81a33ca gl: fix leaks
As the relevant variables are initialized to 0/NULL, we can loop
over the full range and make sure we free partial allocations
when an error happens partway through initialization.
2017-12-09 19:31:36 +00:00
Matthew Waters
a20a5d36e2 gl: pass video info's by reference 2017-12-09 19:31:35 +00:00
Matthew Waters
ff52514714 gl/glx: use the context's display rather than asking for the window's 2017-12-09 19:31:35 +00:00
Matthew Waters
71548893bf gl: avoid adding a NULL pool to propose allocation 2017-12-09 19:31:35 +00:00
Matthew Waters
790f34c7a6 gl: fix detection of extensions with GL versions < 3
Mesa, for example returns valid pointers for glGetIntegerv and
glGetStringi even if the gl version is less than that required for
both those functions to supposedly exist.

https://bugzilla.gnome.org/show_bug.cgi?id=727324
2017-12-09 19:31:35 +00:00
Tim-Philipp Müller
82555e80ba gl: egl: fix distcheck and out of source build 2017-12-09 19:31:35 +00:00
Rico Tzschichholz
34a4eef1ec build: Fix make dist 2017-12-09 19:31:35 +00:00
Matthew Waters
6491e4d275 gl: fix out-of-source builds pt2
21b897de2f did this for x11 and wayland.
Do it for the other backends as well.
2017-12-09 19:31:35 +00:00
Julien Isorce
0233939eaa gl: only set CAPS_FEATURE_MEMORY_EGL_IMAGE on egl platform 2017-12-09 19:31:35 +00:00
Julien Isorce
6614df6478 gl: let the user includes itself our egl headers if needed
Forgot to address this change.

https://bugzilla.gnome.org/show_bug.cgi?id=703343
2017-12-09 19:31:35 +00:00
Julien Isorce
c2471aec81 gl: add EGLImage support
* picked from old libgstegl:
  - GstEGLImageMemory
  - GstEGLImageAllocator
  - last_buffer management from removed GstEGLImageBufferPool

* add-ons:
  - GstEGLImageMemory now old a reference on GstGLContext
    so that it can delete the EGLImage and its gltexture source
    while having the associated gl context being current.
  - add EGLImage support for GstVideoGLTextureUploadMeta which
    mainly call EGLImageTargetTexture2D
  - GstGLBufferPool now supports GstEGLImageAllocator
  - glimagesink / glfilters / etc.. now propose GstEGLImageAllocator
    to upstream

https://bugzilla.gnome.org/show_bug.cgi?id=703343
2017-12-09 19:31:35 +00:00
Julien Isorce
cb9521ab05 gl: deploy egl headers in gst/gl/egl instead of gst/gl
https://bugzilla.gnome.org/show_bug.cgi?id=703343
2017-12-09 19:31:35 +00:00
Julien Isorce
f55e8b3ea8 gl: remove commented and unsued code in x11 Makefile.am
https://bugzilla.gnome.org/show_bug.cgi?id=703343
2017-12-09 19:31:35 +00:00
Julien Isorce
3e3b573503 gl: fix crash if _build_extension_string is not called
On GLES2 then (gl->GetIntegerv && gl->GetStringi) is false
regression introduced by cc6df204e2

https://bugzilla.gnome.org/show_bug.cgi?id=703343
2017-12-09 19:31:35 +00:00
Gwenole Beauchesne
14521a89cb gl: fix out-of-source builds.
Always use the locally generated <gst/gl/gstglconfig.h> file.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2017-12-09 19:31:35 +00:00
Matthew Waters
adebb3b7f8 gl/download: add support for the bt709 color matrix 2017-12-09 19:31:35 +00:00
Matthew Waters
ee0c102ac5 gl/upload: add support for the bt709 color matrix 2017-12-09 19:31:35 +00:00
Matthew Waters
0fa966bb3d gl: remove explicit reference to X_CFLAGS
They are in GL_CFLAGS if required
2017-12-09 19:31:35 +00:00
Matthew Waters
16a30a12aa gl/upload: remove the legacy GL 1.x upload path
uploading requires shaders and fbos available in GL2.
2017-12-09 19:31:35 +00:00
Julien Isorce
da24ea1956 gl: fallback to glGetString if GL_NUM_EXTENSIONS fails
Need it on MacOSX 10.7.5
2017-12-09 19:31:35 +00:00
Matthew Waters
3c27e588c3 gl: and update the Makefile 2017-12-09 19:31:35 +00:00
Matthew Waters
45c71eb3e1 gl: reorganize the extension headers by function rather than api 2017-12-09 19:31:35 +00:00
Matthew Waters
350981b14c gl/win32: use the correct include and gst-indent 2017-12-09 19:31:35 +00:00
Wang Xin-yu (王昕宇)
369bee2031 gl: use wglCreateContextAttribsARB to create share context
https://bugzilla.gnome.org/show_bug.cgi?id=726494
2017-12-09 19:31:35 +00:00
Matthew Waters
d3a823c459 gl/mixer: fix download check for failure 2017-12-09 19:31:35 +00:00
Matthew Waters
a9070713a2 gl: silence a critical if upstream does not provide us with meta params 2017-12-09 19:31:35 +00:00
Julien Isorce
19d138601b gl: silence warnings building for RPI related to 'vcos_*'
Similar than 1190a79b19
2017-12-09 19:31:34 +00:00
Julien Isorce
b30d15d4b8 gl: keep only one occurence of '#include <EGL/egl.h>'
To simply maintainance if we need to put specific includes around it.
2017-12-09 19:31:34 +00:00
Руслан Ижбулатов
8c2c3d8dbf gl: fix the use of always-defined macros
After 2a0f0399ae GST_GL_* macros are always
defined to 0 or 1. Don't use #ifdef ... or #if defined() on them.

https://bugzilla.gnome.org/show_bug.cgi?id=726591
2017-12-09 19:31:34 +00:00
Matthew Waters
4a28b62d5a gl: add GModule libs for win32 2017-12-09 19:31:34 +00:00
Matthew Waters
9b5a5a3c37 gl: only link against gstegl if we are using egl
Assuming if we are building egl that the egl library is built
2017-12-09 19:31:34 +00:00
Matthew Waters
f98fee49c2 gl: add path of the gstegl library
Temporary until we merge the two libraries
2017-12-09 19:31:34 +00:00
Matthew Waters
891f7e2ce8 Revert "gl: add dep on gstegl"
It was already in _LIBADD

This reverts commit b10a353080.
2017-12-09 19:31:34 +00:00
Matthew Waters
95e7f50355 gl: add dep on gstegl
Temporary until we merge the two libraries
2017-12-09 19:31:34 +00:00
Edward Hervey
3ab0b67318 gl/cocoa: Fix debug statements and platform 2017-12-09 19:31:34 +00:00
Edward Hervey
46034834e0 gl: Fix static build with objective-C
--tag=CC is needed for static build
2017-12-09 19:31:34 +00:00
Matthew Waters
894035f0d7 gl: Add EGLDisplay display subclass 2017-12-09 19:31:34 +00:00
Matthew Waters
1af7847fdc gl/window: add a dummy window class
Effective for the case where we have a platform that does not
require a native window.  We require a mainloop to run the GL
commands which is currently operated by GstGLWindow.
2017-12-09 19:31:34 +00:00
Matthew Waters
d55eb1e859 gl: fix undeclared symbol when building without GST_DEBUG 2017-12-09 19:31:34 +00:00
Matthew Waters
e51e0a8869 gl: fix a double unref of the query when building without X 2017-12-09 19:31:34 +00:00
Matthew Waters
312741634d gl: silence a compiler warning about missing prototypes 2017-12-09 19:31:34 +00:00
Matthew Waters
f64292325d gl/utils: add x11 GstContext handling
https://bugzilla.gnome.org/show_bug.cgi?id=726360
2017-12-09 19:31:34 +00:00
Matthew Waters
1732e378f1 gl: define GL_NUM_EXTENSIONS if not defined 2017-12-09 19:31:34 +00:00
Matthew Waters
e225af3e0d gl: silence all the compiler warnings 2017-12-09 19:31:34 +00:00
Matthew Waters
4a18aa4b70 [906/906] filter: warn about trying to share with multiple contexts at once 2017-12-09 19:31:34 +00:00
Matthew Waters
3f5b68b072 [905/906] Add GL context sharing support for non-gstgl elements 2017-12-09 19:31:34 +00:00
Matthew Waters
344ad5fe6f [904/906] mixer: ask for display handles on pad activation 2017-12-09 19:31:34 +00:00
Matthew Waters
f772bc1afc [903/906] api: add GstGLPlatform to/from string 2017-12-09 19:31:34 +00:00
Matthew Waters
d6e6ac471d [902/906] context: implement glGetStringi handling for GL core contexts/GLES3 2017-12-09 19:31:34 +00:00
Matthew Waters
6300c2ef1b [901/906] glx: use the display handle from the global display
Intel drivers require the display handles be the same for context
sharing to occur.  Also solves some cases of use after free of the
display when integrating with gstreamer-vaapi.

See https://bugs.freedesktop.org/show_bug.cgi?id=41736 for the intel bug.
2017-12-09 19:31:34 +00:00
Matthew Waters
07ed5dd637 [899/906] egl: warn if we resort to display handles from the window 2017-12-09 19:31:34 +00:00
Matthew Waters
e64051fd1f [897/906] api: plugin a small memory leak
Found by adrien.schwartzentruber@gmail.com
2017-12-09 19:31:34 +00:00
Matthew Waters
0fb0776432 [896/906] utils: use the vtable for deleting the texture 2017-12-09 19:31:34 +00:00
Matthew Waters
4b42da6141 [895/906] context: call window_class->close last
We should destroy resources before closing the display connection

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=725048
2017-12-09 19:31:33 +00:00
Wang Xin-yu (王昕宇)
af033ae60a [894/906] gl: add missing G_BEGIN_DECLS/G_END_DECLS
https://bugzilla.gnome.org/show_bug.cgi?id=725111
2017-12-09 19:31:33 +00:00
Matthew Waters
8f29fffc2f [893/906] x11: close both of the display's we use
(the comment doesn't seem to apply anymore)

https://bugzilla.gnome.org/show_bug.cgi?id=725048
2017-12-09 19:31:33 +00:00
Matthew Waters
d169aa05dc [892/906] silence a compiler warning on older gcc versions (4.6) 2017-12-09 19:31:33 +00:00
Matthew Waters
97f6bc0bfc [891/906] context: add support for wrapping external contexts 2017-12-09 19:31:33 +00:00
Matthew Waters
303b77eeff [890/906] x11: add display subclass
GstGLDisplayX11 holds the display connection and name.  Each thread requires
it's own X11 Display connection (initialised from name) due to the fact that
we do not want to call XInitThreads().  Doing so would result in segfaults
when integrating with GUI toolkits Gtk, Qt, etc.

The Display connection is for OpenGL platforms where a constant display is
required in order to share contexts (egl).  In the case of a wrapped context
(added later), we do not have GstGLWindow to retreive the display from so a
'master' connection is used instead.
2017-12-09 19:31:33 +00:00
Matthew Waters
adfbafe36c [889/906] display: add display type enum 2017-12-09 19:31:33 +00:00
Adrien SCH
d382eab15e [888/906] correct error handling in gstgldownload.c 2017-12-09 19:31:33 +00:00
Matthew Waters
1e5851fa00 [887/906] mixer: fixup a memory leak of the context in the GLTextureUploadMeta path
gst_structure_get returns a reference to the object and we asked
for another with gst_object_replace.

https://bugzilla.gnome.org/show_bug.cgi?id=724816
2017-12-09 19:31:33 +00:00
Matthew Waters
3c9f5e6e5e [886/906] fixup a memory leak of the context in the GLTextureUploadMeta path
gst_structure_get returns a reference to the object and we asked
for another with gst_object_replace.

https://bugzilla.gnome.org/show_bug.cgi?id=724816
2017-12-09 19:31:33 +00:00
Matthew Waters
c2e1e6a2d1 [885/906] filter: free our data
plugs some memory leaks

https://bugzilla.gnome.org/show_bug.cgi?id=724816
2017-12-09 19:31:33 +00:00
Matthew Waters
f292e785ce [884/906] filter: return the pad template caps in transform_caps
We can transform from any input in our caps to any output.
With the following pipeline snippet:

  ... ! vaapidecode ! glcolorscale ! xvimagesink

GstVideoGLTextureUploadMeta was being used on both src and sink
pads causing linking to fail.  This allows the usage of the meta
on either pad without affecting whether the meta is chosen on the
other pad.
2017-12-09 19:31:33 +00:00
Matthew Waters
cd53fbba24 [883/906] api: provide from_string()
Also s/gst_gl_api_string/gst_gl_api_to_string/g
2017-12-09 19:31:33 +00:00
Matthew Waters
6c594a0b15 [881/906] upload: restore default values for unpack_length
fixes elements that upload a supplementary texture (glbumber,
gldifferencematte, etc)
2017-12-09 19:31:33 +00:00
Matthew Waters
10f18a151e [879/906] build: don't add X_CFLAGS to CFLAGS
It should already be included if needed inside GL_CFLAGS
2017-12-09 19:31:33 +00:00
Chris Paulson-Ellis
b6f6d585c3 [877/906] x11: Use correct format string for guintptr
https://bugzilla.gnome.org/show_bug.cgi?id=723537
2017-12-09 19:31:33 +00:00
Matthew Waters
d233bb66a9 [876/906] glmem: use GstVideoInfo for format configuration
Allows use of strides
2017-12-09 19:31:33 +00:00
Matthew Waters
d84bb0b3b2 [875/906] upload: support for arbitrary strides
Using GL_UNPACK_ALIGNMENT for GLES2 and GL_UNPACK_ROW_LENGTH for everything else
2017-12-09 19:31:33 +00:00
Matthew Waters
8daa7693cf [874/906] filter: implement draw_texture for GLES2
(taken from gleffects)
2017-12-09 19:31:33 +00:00
Matthew Waters
2eb7938db9 [873/906] upload: use GstVideoInfo for choosing the format 2017-12-09 19:31:33 +00:00
Matthew Waters
a9f6679e90 [872/906] upload: consolidate data _fill 2017-12-09 19:31:33 +00:00
Matthew Waters
bc8b4085b5 [871/906] upload: fix texture scaling for YUY2/UYVY with GLES2
Another artifact from the transition to GL_TEXTURE_2D
2017-12-09 19:31:33 +00:00
Matthew Waters
1f4d041d5b [870/906] upload: remove superflous g_mutex_init 2017-12-09 19:31:33 +00:00
Matthew Waters
970fbacf96 [869/906] tests: add some upload tests 2017-12-09 19:31:33 +00:00
Matthew Waters
8d67249633 [868/906] upload: fix compilation for GLES2 2017-12-09 19:31:33 +00:00
Wang Xin-yu (王昕宇)
5168d86d9e [867/906] glupload: Add GRAY8/GRAY16LE/BE upload support to glimagesink
the 16bit data is uploaded as LUMINANCE_ALPHA, then expanded, composed
in shader. value weight is a little complicate, high byte weight is
255*256/65535 (denormalize to [0~255] ,shift to high byte,then normalize
to [0~1]), low byte weight is 255/65535(similar)

https://bugzilla.gnome.org/show_bug.cgi?id=722670
2017-12-09 19:31:33 +00:00
Matthew Waters
95833db905 [866/906] upload: update some docs 2017-12-09 19:31:33 +00:00
Matthew Waters
89a203abe3 [865/906] glmem: report successful copy to the caller 2017-12-09 19:31:33 +00:00
Matthew Waters
253fe220df [863/906] window: hold a ref to our GstGLDisplay 2017-12-09 19:31:33 +00:00
Matthew Waters
2026f60879 [862/906] window: remove set_need_lock
No-one is using it.  The only code that did was the x11 one which
doesn't need it anymore.
2017-12-09 19:31:33 +00:00
Wang Xin-yu (王昕宇)
0f4c10aed9 [861/906] glprototypes: Add missing glScalef declare
https://bugzilla.gnome.org/show_bug.cgi?id=721903
2017-12-09 19:31:33 +00:00
Matthew Waters
8cc37b903c [860/906] docs: misc updates 2017-12-09 19:31:32 +00:00
Matthew Waters
dadce598ba [859/906] window: provide some documetation 2017-12-09 19:31:32 +00:00
Matthew Waters
148607f6da [858/906] glmem: update the docs 2017-12-09 19:31:32 +00:00
Matthew Waters
54923d1909 [857/906] display: document the new GstContext api 2017-12-09 19:31:32 +00:00
Matthew Waters
d6bdcbe751 [856/906] context: document it 2017-12-09 19:31:32 +00:00
Matthew Waters
1e02438715 [855/906] upload: add support for GstVideoGLTextureUploadMeta 2017-12-09 19:31:32 +00:00
Matthew Waters
2623734d19 [854/906] use the allocation query to propogate GstGLContext
uses the GstVideoGLTextureUploadMeta api type for the query
2017-12-09 19:31:32 +00:00
Matthew Waters
84425ad43d [853/906] display: remove _{set,get}_context
A GstGLDisplay doesn't need a GstGLContext and its use
was cause a reference cycle
2017-12-09 19:31:32 +00:00
Matthew Waters
64fad7a6d2 [852/906] use GstContext for GstGLDisplay propogation
implements the hooks required in GstElement::set_context and the context query
2017-12-09 19:31:32 +00:00
Matthew Waters
f15206082a [850/906] glupload: Remove texture scaling artifacts from the TEXTURE_RECTANGLE -> TEXTURE_2D transition
fixes the funky colours in some of the yuv formats

https://bugzilla.gnome.org/show_bug.cgi?id=721155
2017-12-09 19:31:32 +00:00
Matthew Waters
689e722dfa [848/906] filter: a little code cleanup 2017-12-09 19:31:32 +00:00
Matthew Waters
ad315254e9 [847/906] mixer: unmap the video frames we map
plugs a memory leak
2017-12-09 19:31:32 +00:00