Commit graph

113 commits

Author SHA1 Message Date
Matthew Waters
eea03967e4 glmemory: add some thread safety for gl operations 2015-01-27 12:26:05 +11:00
Matthew Waters
9a55a3f98c 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
2015-01-27 12:26:04 +11:00
Matthew Waters
989af902fe 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.
2015-01-17 10:56:20 +11:00
Matthew Waters
8fef381417 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.
2015-01-15 09:50:02 +11:00
Matthew Waters
4ccf45823e glmemory: offset the data pointer for upload for GstVideoAlignment
otherwise we attempt to read from the padding data
2015-01-14 22:22:13 +11:00
Matthew Waters
d1e923765b glmemory: use pbo's for upload 2015-01-14 22:22:13 +11:00
Nicolas Dufresne
9954de1ccd 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
2014-12-19 12:11:08 -05:00
Nicolas Dufresne
da3ae06cd1 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
2014-12-19 11:45:35 -05:00
Nicolas Dufresne
4f3c33af3a glmemory: Handle custom stride with OPENGL3
https://bugzilla.gnome.org/show_bug.cgi?id=740900
2014-12-19 11:45:35 -05:00
Sebastian Dröge
b6ba579fa0 glmemory: Handle failure of memory allocation gracefully 2014-11-27 18:09:14 +01:00
Sebastian Dröge
f2dc9b2b8f 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.
2014-11-27 18:06:26 +01:00
Wang Xin-yu (王昕宇)
5eb538f9e2 glcolorconvert: support RGB16/BGR16 video format upload
https://bugzilla.gnome.org/show_bug.cgi?id=738842
2014-10-20 12:55:39 +02:00
Matthew Waters
7b0a30343a glmemory: unset the opposite corresponding transfer flags when mapped with write
fixes consistency with consecutive gst_memory_map()'s with
flags & GST_MAP_WRITE
2014-09-30 01:49:05 +10:00
Matthew Waters
64fc86844d glmemory: add debug line for freeing textures 2014-09-21 21:42:41 +10:00
Matthew Waters
acb38a2a79 glmemory: use the plane offsets to compute the size of the data pointer
Certain elements expect that there be a certain number of lines
that they can write into.  e.g. for odd heights, I420, YV12, NV12,
NV21 (and others) Y lines are expected to have exactly twice the
number of U/UV lines.

https://bugzilla.gnome.org/show_bug.cgi?id=733717
2014-07-31 15:19:54 +10:00
Matthew Waters
89636392fa glmemory: use GstVideoInfo everywhere
Simplifies a lot of the calling code

https://bugzilla.gnome.org/show_bug.cgi?id=733717
2014-07-31 15:19:54 +10:00
Matthew Waters
dc5b0c8c8d glmemory: reenable the texture_rg support for !eagl
The GST_GL_HAVE_PLATFORM_EAGL is always defined we need to compare
against the value instead.
2014-07-29 11:47:55 +10:00
Sebastian Dröge
4cbddec9fe eagl: Disable usage of R and RG textures on iOS
They don't work currently and just render zeroes, while the
fallback code path with LUM and LUM_ALPHA textures still works.

https://bugzilla.gnome.org/show_bug.cgi?id=732390
2014-06-30 19:16:13 +02:00
Matthew Waters
0f4485fc66 glmemory: remove uneeded gl api ifdefs 2014-05-30 12:29:54 +10:00
Matthew Waters
da35876537 glfeature: remove GST_GL_API_GLES3
instead check the gl version using gst_gl_context_check_gl_version()
2014-05-30 10:29:37 +10:00
Matthew Waters
dbffcffaee gl/memory: allocate the correct memory size
and avoid wasting resources we will never need

https://bugzilla.gnome.org/show_bug.cgi?id=730703
2014-05-25 11:45:59 +10:00
Matthew Waters
13402f0b98 gl/memory: provide compatability defines
fixes build on android/OS X
2014-05-23 12:07:50 +10:00
Matthew Waters
9a0129a0e4 gl/memory: RGBA/UNSIGNED_BYTE only format supported by ReadPixels GLES2
Error out in case we attempt to read with any other invalid format.
2014-05-23 11:25:11 +10:00
Matthew Waters
0c8ccd8c5f gl/memory: generate textures with a sized internal format
Required in order to generate RG and RED textured with GLES3.
2014-05-23 11:25:11 +10:00
Matthew Waters
001b92ba12 gl/memory: implement GL_EXT_texture_rg support
Which is used by default over the Luminance formats due to it
being color renderable with fbos (and deprecation/removal with
GL 3.x).

https://bugzilla.gnome.org/show_bug.cgi?id=729750
https://bugzilla.gnome.org/show_bug.cgi?id=704222
https://bugzilla.gnome.org/show_bug.cgi?id=728890
2014-05-23 11:25:11 +10:00
Matthew Waters
2da979831e gl/upload: switch the 'master' texture for YUY2, UYVY
From d4bcef3204 on, using a RGBA
texture to hold the data causes the glmemory to have half width
and a scaling of [2, 1].  Using a LA texture solves this problem
however cannot be attached to the framebuffer for copying into
a RGBA texture.  Which will be solved by moving to EXT_texture_rg.

https://bugzilla.gnome.org/show_bug.cgi?id=728890
2014-05-21 10:26:21 +10:00
Nicolas Dufresne
d4bcef3204 glmemory: Fix handling of stride with alignement larger then 8
Setting a scaled factor for X coordinate is not enough as the indexer
will still think stride is shorter and will not fully skip it. Instead,
update width, so the lines are as expected. Combined with the scale, it
will hide the cropped portion.

https://bugzilla.gnome.org/show_bug.cgi?id=729896
2014-05-13 11:43:45 -04:00
Matthew Waters
a49a371710 gl/upload: implement lazy init
Rename init_format to set_format
2014-05-08 15:33:43 +10:00
Matthew Waters
598a79a5e2 gl/mem: implement texture copying between formats with strides properly
Previously, we used the width to determine the amount of data to be
copied using pbos.  This, makes it allocate enough data for the
the strides as well.
2014-05-01 14:00:04 +10:00
Nicolas Dufresne
9205bcdedb glmemory: User g_slice_new0 to ensure fully initilized structure
The pbo pointer not being initialized would trigger a use of unitilialized variable
in valgrind.
2014-04-23 12:42:44 -04:00
Vincent Penquerc'h
6ec86ca1dc gl: prevent division by 0 on unsupported texture type
Coverity 1199697
2014-04-21 13:23:45 +01:00
Matthew Waters
b69e1f42bb gl/mem: cache the stride/unpack length for upload 2014-04-11 17:26:09 +10:00
Matthew Waters
d92eb6dbbe gl/mem: provide defines for tokens not defined in GLES2/ancient platforms 2014-04-11 11:04:43 +10:00
Matthew Waters
15d0c04933 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.
2014-04-11 10:37:06 +10:00
Matthew Waters
e01e2cce9f gl: pass video info's by reference 2014-04-02 23:05:47 +11:00
Matthew Waters
870503dc6b gl: silence all the compiler warnings 2014-03-16 15:17:44 +01:00
Matthew Waters
cd7bfb92d4 [876/906] glmem: use GstVideoInfo for format configuration
Allows use of strides
2014-03-15 18:37:06 +01:00
Matthew Waters
4386cc1c6b [873/906] upload: use GstVideoInfo for choosing the format 2014-03-15 18:37:05 +01:00
Matthew Waters
49a19fb6b1 [865/906] glmem: report successful copy to the caller 2014-03-15 18:37:05 +01:00
Matthew Waters
aa573cf138 [858/906] glmem: update the docs 2014-03-15 18:37:05 +01:00
Matthew Waters
4322266b97 [843/906] memory: provide copy_into_texture 2014-03-15 18:37:04 +01:00
Matthew Waters
b90d824626 [838/906] gl: Use GL_TEXTURE_2D instead of GL_TEXTURE_RECTANGLE
We create our textures (in Desktop GL) with GL_TEXTURE_RECTANGLE,
vaapi attempts to bind our texture to GL_TEXTURE_2D which throws a
GL_INVALID_OPERATION error and as thus, no video.

Also, by moving exclusively to GL_TEXTURE_2D and the npot extension
we also remove a difference between the Desktop GL and GLES2 code.

https://bugzilla.gnome.org/show_bug.cgi?id=712287
2014-03-15 18:37:03 +01:00
Matthew Waters
2313cea524 [819/906] make gen_texture/del_texture threadsafe
Use stack allocated instead of static variables

Conflicts:
	gst-libs/gst/gl/gstglutils.c
2014-03-15 18:37:02 +01:00
Matthew Waters
9b22b0e0ba [812/906] move the GL vtable from GstGLDisplay to GstGLContext
Conflicts:
	tests/check/libs/gstglcontext.c
2014-03-15 18:37:02 +01:00
Matthew Waters
f590a1ce23 [780/906] up/download: check return values
So we fail properly
2014-03-15 18:37:00 +01:00
Matthew Waters
71a70e78f6 [763/906] memory: copy properly depending on where the most recent data is 2014-03-15 18:36:59 +01:00
Julien Isorce
dd7e054e2c [732/906] build: fix repeated typedefs
Write forward declarations in another way to avoid
repeated typedefs "error: redefinition of typedef".
Raised when using i686-apple-darwin11-llvm-gcc-4.2
It seems that C apple compiler does not support
C11 feature.

https://bugzilla.gnome.org/show_bug.cgi?id=703885
2014-03-15 18:36:57 +01:00
Matthew Waters
2d69905592 [703/906] x11: don't segfault if destroy_cb is NULL 2014-03-15 18:36:55 +01:00
Matthew Waters
dbeb6a911b [701/906] display: move context creation into window 2014-03-15 18:36:55 +01:00
Matthew Waters
96114e62cb [699/906] display: remove list of upload and download objects
and only create an up/download object when needed.
2014-03-15 18:36:55 +01:00
Matthew Waters
74209b9e9e [677/906] memory: fix GSIZE printf format on win32 2014-03-15 18:36:54 +01:00
Matthew Waters
7b03a572d9 [647/906] remove dependecy on glew 2014-03-15 18:36:52 +01:00
Matthew Waters
fa3c3b8434 [642/906] add gstglconfig.h for apps to find out what our capabilites are
ie libgstgl can be compiled with any combination of opengl/gles2
2014-03-15 18:36:52 +01:00
Matthew Waters
cc8e54541b [624/906] OPENGL_ES2 => HAVE_GLES2 and add HAVE_OPENGL
use GstGLAPI to determine which code paths to execute.
perform some cleanups
2014-03-15 18:36:51 +01:00
Matthew Waters
93f7e993ad [603/906] update FSF address 2014-03-15 18:36:50 +01:00
Matthew Waters
12bf1cfa27 [600/906] docs: add docs for new objects and expand on some existing ones 2014-03-15 18:36:49 +01:00
Matthew Waters
fad1b94c41 [592/906] memory: update for up/download API changes 2014-03-15 18:36:49 +01:00
Matthew Waters
28863c4bb4 [586/906] fix up some debug statements to get them into the right categories 2014-03-15 18:36:49 +01:00
Matthew Waters
5d1395f435 [574/906] memory: implement transperent upload/download for data
(not async yet)
2014-03-15 18:36:48 +01:00
Matthew
20406c1de3 [567/906] fix OpenGL|ES2 ifdef'ed code 2014-03-15 18:36:47 +01:00
Matthew Waters
0ef8174881 [554/906] GstGLMemory: update for GstAllocator API changes 2014-03-15 18:36:47 +01:00
Matthew Waters
2141571de9 [521/906] GstGLMemory: update for GstAllocator changes 2014-03-15 18:36:45 +01:00
Matthew Waters
1331611094 [514/906] add GstGLMemory and allocator
implement custom GstMemory for GL textures
currently map/unmap returns NULL although it might be favourable to upload/download/cache the image data
2014-03-15 18:36:44 +01:00