Commit graph

242 commits

Author SHA1 Message Date
Reynaldo H. Verdejo Pinochet
32861ab0a7 eglglessink: Move DAR query & store to surface init
The DAR (display's pixel aspect ratio) should remain a
constant at runtime so there's no point on repeatedly
query and store this value. Doing it at surface setup
should be enough. As an added bonus this change should
make rendering a bit faster.
2012-10-18 14:35:19 +02:00
Sebastian Dröge
406630a294 eglglessink: Don't signal the GCond too often 2012-10-18 14:35:19 +02:00
Sebastian Dröge
82dc2a3544 eglglessink: Add myself as author 2012-10-18 14:35:19 +02:00
Sebastian Dröge
87a028a0a4 eglglessink: Make sure to always reset the display region in start() 2012-10-18 14:35:19 +02:00
Sebastian Dröge
28fe3f7888 eglglessink: Also commit missing changes to the header file 2012-10-18 14:35:19 +02:00
Sebastian Dröge
610e33b049 eglglessink: Also include $(GST_BASE_CFLAGS) 2012-10-18 14:35:19 +02:00
Sebastian Dröge
caf9d1febd eglglessink: Fix race condition 2012-10-18 14:35:19 +02:00
Sebastian Dröge
99f738bbc0 eglglessink: Refactor rendering and all context specific GL things into a separate thread
Also fixes some threading related problems.
2012-10-18 14:35:19 +02:00
Sebastian Dröge
11ec917ee0 eglglessink: Re-add accidentially reverted commit 2012-10-18 14:35:19 +02:00
Sebastian Dröge
ba3274c8f0 eglglessink: Remove unneeded flow_lock
Use the object lock in the few places necessary, everything
else is protected by other things already.

Also store the context directly inside the instance struct
instead of allocating some memory for it.
2012-10-18 14:35:19 +02:00
Sebastian Dröge
2b3279c9b5 eglglessink: Fix debug output and constant names 2012-10-18 14:35:19 +02:00
Sebastian Dröge
1f0bf75075 eglglessink: start()/stop() is called in READY<->NULL in basesink
But this should be called in PAUSED<->READY.
2012-10-18 14:35:18 +02:00
Reynaldo H. Verdejo Pinochet
d2dcecfc8a eglglessink: Fix for outbound DAR reported by EGL
Some EGL implementations don't honor the spec
requirement of returning DAR values as w/h *
EGL_DISPLAY_SCALING.

This changeset:

- Fixes rendering on the Samsung Galaxy III
- Fixes wrong check on required 1.2 EGL version
- Reorders the code a bit.
2012-10-18 14:35:18 +02:00
Sebastian Dröge
dde62cee8e eglglessink: Fix crashes if there are no EGL or GLES extensions 2012-10-18 14:35:18 +02:00
Reynaldo H. Verdejo Pinochet
a317f6936c eglglessink: Fix crash at element instantiation 2012-10-18 14:35:18 +02:00
Reynaldo H. Verdejo Pinochet
af009b7de7 eglglessink: GLSL: Save one extra texture lookup 2012-10-18 14:35:18 +02:00
Reynaldo H. Verdejo Pinochet
0ed02803f7 eglglessink: GLSL: Minor named index access tweak xyz -> rgb 2012-10-18 14:35:18 +02:00
Reynaldo H. Verdejo Pinochet
5c2b1dc631 eglglessink: GLSL: Assorted fixes to optimized code
- Don't copy over opos as it's already a vec2
- Fix index order access at frag_YUY2_YVYU_UYVY_prog
2012-10-18 14:35:18 +02:00
Reynaldo H. Verdejo Pinochet
73d865091c eglglessink: GLSL: Planar YUV converters optimization
- Use consts for the transform's offset and cofficients values
- Use dot product instead of mult and add
- Avoid unneeded texture lookups
2012-10-18 14:35:18 +02:00
Reynaldo H. Verdejo Pinochet
846e77871b Geglglessink: LSL: Optimize frag_YUY2_YVYU_UYVY_prog
- Avoid repeatedly performing the texture lookup
- Use consts for the transform's offset and cofficients values
- Use the dot product instead of the explicit mult and add
2012-10-18 14:35:18 +02:00
Reynaldo H. Verdejo Pinochet
eb8f7d63d5 eglglessink: GLSL: Drop unneded nxy vec2 2012-10-18 14:35:18 +02:00
Reynaldo H. Verdejo Pinochet
bb0b872644 eglglessink: Fix missing double quotation mark in GLSL code 2012-10-18 14:35:18 +02:00
Reynaldo H. Verdejo Pinochet
a95834a491 eglglessink: GLSL: Optimize frag_AYUV_prog
- Avoid repeatedly performing the texture lookup
- Use consts for the transform's offset and cofficients values
- Use the dot product instead of the explicit mult and add
2012-10-18 14:35:18 +02:00
Reynaldo H. Verdejo Pinochet
a7a2dcc433 eglglessink: Documentation: GstEglGlesSink struct 2012-10-18 14:35:18 +02:00
Reynaldo H. Verdejo Pinochet
38ca631a7a eglglessink: Documentation: GstEglGlesBuffer struct (DRAFT) 2012-10-18 14:35:17 +02:00
Reynaldo H. Verdejo Pinochet
c27c11582e eglglessink: Documentation: GstEglGlesImageFmt struct 2012-10-18 14:35:17 +02:00
Reynaldo H. Verdejo Pinochet
945b11fd02 eglglessink: Documentation: GstEglGlesRenderContext struct 2012-10-18 14:35:17 +02:00
Reynaldo H. Verdejo Pinochet
d97b3dba60 eglglessink: Assorted doc and reordering fixes 2012-10-18 14:35:17 +02:00
Reynaldo H. Verdejo Pinochet
031b6a57ac eglglessink: Documentation: Element properties
Brief explanatory comments plus some reordering
to group default setting of properties and runtime
flags values.
2012-10-18 14:35:17 +02:00
Sebastian Dröge
81463a1cb7 eglglessink: Add support for YVYU 2012-10-18 14:35:17 +02:00
Reynaldo H. Verdejo Pinochet
95a223a030 eglglessink: Documentation: GLSL Shaders
Brief explanatory comments plus some rerdering
to group packed/planar converters.
2012-10-18 14:35:17 +02:00
Reynaldo H. Verdejo Pinochet
731be48dac eglglessink: Documentation: Element overview 2012-10-18 14:35:17 +02:00
Reynaldo H. Verdejo Pinochet
1eef329725 eglglessink: Refactor REORDER shader.
Avoid unneededly calling texture2D() 3 consecutive times.
2012-10-18 14:35:17 +02:00
Sebastian Dröge
c91238a2af eglglessink: Fix handling of caps changes by only releasing what needs to be released
And not terminating the display connection
2012-10-18 14:35:17 +02:00
Reynaldo H. Verdejo Pinochet
310e5111b7 eglglessink: Move display_region reset to locked section 2012-10-18 14:35:17 +02:00
Reynaldo H. Verdejo Pinochet
884e5fa173 eglglessink: Reset display_region dims at caps renego 2012-10-18 14:35:17 +02:00
Reynaldo H. Verdejo Pinochet
f28f5df29e eglglessink: Cosmetics 2012-10-18 14:35:17 +02:00
Reynaldo H. Verdejo Pinochet
c255aa5dd4 eglglessink: Don't access local value from struct 2012-10-18 14:35:16 +02:00
Reynaldo H. Verdejo Pinochet
2ab9de8e4f eglglessink: Terminate display connection at caps renego 2012-10-18 14:35:16 +02:00
Reynaldo H. Verdejo Pinochet
734ac85bb4 eglglessink: Cosmetics 2012-10-18 14:35:16 +02:00
Sebastian Dröge
e022fc5389 eglglessink: Only attach the context once to the streaming thread 2012-10-18 14:35:16 +02:00
Sebastian Dröge
09b3518bae eglglessink: Make the context current for the thread and unbind it again around every use
This fixes some crashes and leaking of our context into other
OpenGL code on the same thread.
2012-10-18 14:35:16 +02:00
Sebastian Dröge
113253b292 eglglessink: Improve cleanup 2012-10-18 14:35:16 +02:00
Sebastian Dröge
70d077acd8 eglglessink: Remove unused label 2012-10-18 14:35:16 +02:00
Sebastian Dröge
f058b5d78b eglglessink: Allow setting a NULL handle 2012-10-18 14:35:16 +02:00
Sebastian Dröge
fc0dc0055a eglglessink: Revert "Do not update_surface_dims() once per frame"
This reverts commit 82103376ede2bc7c63dd699f5982168660f67852.

We have to update the surface dimensions on every frame to
make sure that we get notified about updates. This happens
for example if the Android window gets re-layouted because
a widget takes more space than before.
2012-10-18 14:35:16 +02:00
Reynaldo H. Verdejo Pinochet
a818d5c771 eglglessink: Do not update_surface_dims() once per frame
And.. Upgrade debug message to warging on weird DAR.
Correct fix to avoid spaming with this message
once per each frame is avoid calling update_surface_dims()
at render_and_display(). This is handled at egl surface
init.
2012-10-18 14:35:16 +02:00
Sebastian Dröge
162f63e064 eglglessink: And downgrade another warning too 2012-10-18 14:35:16 +02:00
Sebastian Dröge
7307ddd54b eglglessink: Downgrade GST_WARNING to GST_DEBUG 2012-10-18 14:35:16 +02:00
Sebastian Dröge
8dabfbfca8 eglglessink: Add some {} to if statements make them work as expected 2012-10-18 14:35:16 +02:00
Reynaldo H. Verdejo Pinochet
20a05726b3 eglglessink: Drop stale defines for max frame size 2012-10-18 14:35:16 +02:00
Reynaldo H. Verdejo Pinochet
a3530d9a3d eglglessink: Small commentary fixes here an there 2012-10-18 14:35:15 +02:00
Reynaldo H. Verdejo Pinochet
2b706d3fbe eglglessink: Avoid setting height or width twice 2012-10-18 14:35:15 +02:00
Reynaldo H. Verdejo Pinochet
eeb3b84d07 eglglessink: Use PAR/DAR to set viewport 2012-10-18 14:35:15 +02:00
Sebastian Dröge
c3fb44aef3 eglglessink: Correctly resize if the surface dimensions change 2012-10-18 14:35:15 +02:00
Sebastian Dröge
3fcea0dc5e eglglessink: Update surface dimensions on every buffer 2012-10-18 14:35:15 +02:00
Sebastian Dröge
2b2ae0fd6f eglglessink: More consistent naming of shader related variables 2012-10-18 14:35:15 +02:00
Sebastian Dröge
1ad253b9b7 eglglessink: Some variable name cleanup 2012-10-18 14:35:15 +02:00
Sebastian Dröge
e8f4829c13 eglglessink: Remove default-width/height properties
These are completely unneeded
2012-10-18 14:35:15 +02:00
Sebastian Dröge
985a185ffc eglglessink: Fix double free() 2012-10-18 14:35:15 +02:00
Sebastian Dröge
b5b98fc874 eglglessink: Don't leak EGL/ES render context 2012-10-18 14:35:15 +02:00
Reynaldo H. Verdejo Pinochet
bab81de275 eglglessink: Put EGL/GLES context vars on their own struct 2012-10-18 14:35:15 +02:00
Reynaldo H. Verdejo Pinochet
5526737ec8 eglglessink: Small TODO reformatting 2012-10-18 14:35:15 +02:00
Reynaldo H. Verdejo Pinochet
e8ed9e1097 eglglessink: Add TODO file 2012-10-18 14:35:15 +02:00
Sebastian Dröge
2323c40f1b eglglessink: Correctly implement ::expose()
We don't need the past buffer for this, the old one is still available
as texture and we just need to draw our rectangle again.
2012-10-18 14:35:15 +02:00
Sebastian Dröge
18e473307f eglglessink: Allow setting another window for the next time we reconfigure everything 2012-10-18 14:35:14 +02:00
Sebastian Dröge
aa463f0274 eglglessink: Also unref current caps after usage 2012-10-18 14:35:14 +02:00
Sebastian Dröge
c2de59b19c eglglessink: Implement support for caps changes 2012-10-18 14:35:14 +02:00
Sebastian Dröge
d91621d2ce eglglessink: More cleanup and making the element reusable 2012-10-18 14:35:14 +02:00
Sebastian Dröge
56b711bd29 eglglessink: Properly init/release resources when going from NULL->READY and the other way around 2012-10-18 14:35:14 +02:00
Sebastian Dröge
15c93da54e eglglessink: Generate the sink caps exactly once 2012-10-18 14:35:14 +02:00
Sebastian Dröge
ad6e314a6e eglglessink: Fix code style a bit to stop confusing indent 2012-10-18 14:35:14 +02:00
Sebastian Dröge
4e637ddb7b eglglessink: Fix support for YUY2 and UYVY 2012-10-18 14:35:14 +02:00
Sebastian Dröge
9e094541b0 eglglessink: Some property cleanup 2012-10-18 14:35:14 +02:00
Sebastian Dröge
25eb488f30 eglglessink: Add support for the remaining RGB formats 2012-10-18 14:35:14 +02:00
Sebastian Dröge
11368b49b2 eglglessink: Add support for Y444, Y42B and Y41B, just because it's so easy 2012-10-18 14:35:14 +02:00
Sebastian Dröge
d98d5c657e eglglessink: Add some simple TODOs 2012-10-18 14:35:14 +02:00
Reynaldo H. Verdejo Pinochet
98b9862167 eglglessink: Lock while altering display region coords 2012-10-18 14:35:14 +02:00
Reynaldo H. Verdejo Pinochet
a2fce44139 eglglessink: Fix _get_compat_format_from_caps() logic
It's a getter so it shouldn't messing with the sink context.
Adding insult to injury it was setting selected_fmt without
locking.
The associated changes to the buffer functions are merely
make-it build fixes. Those functions are barely drafted
and in WIP state.
2012-10-18 14:35:13 +02:00
Reynaldo H. Verdejo Pinochet
47d0505f40 eglglessink: Drop unneded initial set to NULL 2012-10-18 14:35:13 +02:00
Reynaldo H. Verdejo Pinochet
0c681dc2a6 eglglessink: Minor formatting and comment fixes 2012-10-18 14:35:13 +02:00
Reynaldo H. Verdejo Pinochet
63d8cd88c7 eglglessink: Clean-up gl/egl allocations at _stop()
Also, conditionaly destroy window if the sink created its own.
2012-10-18 14:35:13 +02:00
Sebastian Dröge
99765c3333 eglglessink: Add support for NV12 and NV21
Also YUY2 and UYVY but this is disabled for now as it
doesn't work completely yet. Something is wrong with
the chroma.
2012-10-18 14:35:13 +02:00
Sebastian Dröge
72d05a681f eglglessink: Add support for I420 and YV12 color formats 2012-10-18 14:35:13 +02:00
Sebastian Dröge
d3995c1a7b eglglessink: Preparations for supporting multiple textures for more YUV formats 2012-10-18 14:35:13 +02:00
Sebastian Dröge
3f734aafc7 eglglessink: Use the attrib locations as really used inside the shader 2012-10-18 14:35:13 +02:00
Sebastian Dröge
24261a4fe7 eglglessink: Really decouple vertex and texture positions in the shader 2012-10-18 14:35:13 +02:00
Sebastian Dröge
dafcdb0da3 eglglessink: Decouple texture and vertex positions 2012-10-18 14:35:13 +02:00
Sebastian Dröge
cb034b2ecd eglglessink: Reorder vertex value order to make a bit more sense 2012-10-18 14:35:13 +02:00
Reynaldo H. Verdejo Pinochet
8018681187 eglglessink: Handle frame scaling to fill surface 2012-10-18 14:35:13 +02:00
Reynaldo H. Verdejo Pinochet
90d5b76dc5 eglglessink: Draft set_render_rectangle() from the xOverlay interface 2012-10-18 14:35:13 +02:00
Reynaldo H. Verdejo Pinochet
f8b69a7c7f eglglessink: Remove stale comment 2012-10-18 14:35:13 +02:00
Reynaldo H. Verdejo Pinochet
1c008e95b3 eglglessink: Move VBO setup to setcaps 2012-10-18 14:35:12 +02:00
Reynaldo H. Verdejo Pinochet
d56d126031 eglglessink: Don't do context ops at render
We don't need to repeatedly call
eglMakeCurrent() while using the
same context anyway.
2012-10-18 14:35:12 +02:00
Reynaldo H. Verdejo Pinochet
ca74f676fd eglglessink: Don't clear surface color at render 2012-10-18 14:35:12 +02:00
Sebastian Dröge
9e23d0fc87 eglglessink: Rename shader variables to make more sense 2012-10-18 14:35:12 +02:00
Sebastian Dröge
d42d5e1139 eglglessink: Add support for AYUV 2012-10-18 14:35:12 +02:00
Sebastian Dröge
c4643491c4 eglglessink: Reorder caps a bit to make more sense 2012-10-18 14:35:12 +02:00
Sebastian Dröge
6adf608c99 eglglessink: Set rank to PRIMARY 2012-10-18 14:35:12 +02:00
Sebastian Dröge
1c58d921ff eglglessink: Add support for RGBA 2012-10-18 14:35:12 +02:00
Sebastian Dröge
930b4c179e eglglessink: Correctly generated caps for the supported formats 2012-10-18 14:35:12 +02:00
Sebastian Dröge
f9a5fc255d eglglessink: Add ::get_caps() vfunc that returns the actually supported caps 2012-10-18 14:35:12 +02:00
Sebastian Dröge
86ebf86433 eglglessink: Also require a configuration with EGL_SURFACE_TYPE containing EGL_WINDOW_BIT 2012-10-18 14:35:12 +02:00
Sebastian Dröge
7e8cc569dd eglglessink: Fix compiler warnings 2012-10-18 14:35:12 +02:00
Reynaldo H. Verdejo Pinochet
19c3b4d892 eglglessink: Clear surface to black by default 2012-10-18 14:35:12 +02:00
Reynaldo H. Verdejo Pinochet
19739bfb74 eglglessink: Make sure we get a config we can use with GLES2 2012-10-18 14:35:12 +02:00
Reynaldo H. Verdejo Pinochet
24b926a6cc eglglessink: set_window_handle() has been tested to work now 2012-10-18 14:35:11 +02:00
Reynaldo H. Verdejo Pinochet
7ac284b1a1 eglglessink: Avoid autoscaling by default 2012-10-18 14:35:11 +02:00
Reynaldo H. Verdejo Pinochet
a81b036355 eglglessink: Avoid repeatedly setting 2D resizing params
Moved to initial texture setup so it hapens
just once while on the same context.
2012-10-18 14:35:11 +02:00
Reynaldo H. Verdejo Pinochet
a96fa541ee eglglessink: Avoid initializing EGL at _set_window_handle()
_start() should take care of that.
This change asumes _setcaps() will
happen always after _start() is
done.
2012-10-18 14:35:11 +02:00
Reynaldo H. Verdejo Pinochet
ead20f4f0b eglglessink: Don't ask for a window if we already have one 2012-10-18 14:35:11 +02:00
Reynaldo H. Verdejo Pinochet
22eb374b57 eglglessink: Fix EGL attribs var naming 2012-10-18 14:35:11 +02:00
Reynaldo H. Verdejo Pinochet
c2cf1fa639 eglglessink: Fix slow path rendering on Android
Specify missing and mandatory params for npot
Before calling glTexImage2D.

In particular, _WRAP_T and _WRAP_S need to be
set to GL_CLAMP_TO_EDGE to avoid all-black
rendering with npot sized frames.
2012-10-18 14:35:11 +02:00
Reynaldo H. Verdejo Pinochet
f33167f95b eglglessink: Add test on usable eglconfigs returned 2012-10-18 14:35:11 +02:00
Reynaldo H. Verdejo Pinochet
303a346fc2 eglglessink: Drop stale error_locked label 2012-10-18 14:35:11 +02:00
Reynaldo H. Verdejo Pinochet
5763c8d308 eglglessink: Cleanup stale code comments 2012-10-18 14:35:11 +02:00
Reynaldo H. Verdejo Pinochet
391137a20e eglglessink: GlViewPort() should use actual surface size 2012-10-18 14:35:11 +02:00
Reynaldo H. Verdejo Pinochet
f707961183 eglglessink: Avoid reiniting EGL after the first time 2012-10-18 14:35:11 +02:00
Reynaldo H. Verdejo Pinochet
75fe18200a eglglessink: Use correct template caps 2012-10-18 14:35:11 +02:00
Reynaldo H. Verdejo Pinochet
e439c01382 eglglessink: Fix missing texture setup bits 2012-10-18 14:35:11 +02:00
Reynaldo H. Verdejo Pinochet
68eac71910 eglglessink: Add error checking on eglSwapBuffers 2012-10-18 14:35:10 +02:00
Reynaldo H. Verdejo Pinochet
f8dcc8aaa5 eglglessink: Fix stale&wrong 0.5 alpha blend 2012-10-18 14:35:10 +02:00
Reynaldo H. Verdejo Pinochet
12d66a7d54 eglglessink: Add float precision specifier to fragment shader
This is required by GLES and fixes compilation of fragment
shader prog.
2012-10-18 14:35:10 +02:00
Reynaldo H. Verdejo Pinochet
28aadcad4e eglglessink: Add log reporting at shader compilation failure 2012-10-18 14:35:10 +02:00
Reynaldo H. Verdejo Pinochet
b4887425cc eglglessink: Add some missing checks on shader ops
- Check whether there is shader compiler support
  and bail out otherwise.
- Add checks on compile and linking ops
2012-10-18 14:35:10 +02:00
Reynaldo H. Verdejo Pinochet
2a84a72fe7 eglglessink: Fix setup chain logic
Mostly a procedural reordering. Idea is to avoid
trying to setup a surface without a display.This
change relies on the asumption that:

1.- set_window_handle() can happen at any time
2.- setcaps will never get called before _start()
    is done.

If both conditions are meet the new procedure
should work as expected.
2012-10-18 14:35:10 +02:00
Reynaldo H. Verdejo Pinochet
40d6cc2099 eglglessink: WIP: Reorder locking 2012-10-18 14:35:10 +02:00
Reynaldo H. Verdejo Pinochet
289f388085 eglglessink: Fix xOverlay logic
Several fixes dealing with correct window
creation and set_handle() ops. Tested on
X11/mesa with internal window creation.
2012-10-18 14:35:10 +02:00
Reynaldo H. Verdejo Pinochet
9e18b29be2 eglglessink: Actually test EGL configs before claiming support 2012-10-18 14:35:10 +02:00
Reynaldo H. Verdejo Pinochet
59b1870ac1 eglglessink: Caps nego EGL fixes
- Fix alloc lol on format list: Asked for 2 slices and used 3.
- Reordered display & context init logic to prepare for actual
  config checking before claiming support for a given format.
  Change deals basically with setting up EGL display at start()
  and choose an EGL config only at setcaps time.
2012-10-18 14:35:10 +02:00
Reynaldo H. Verdejo Pinochet
a8f60690aa eglglessink: Caps nego. Start extending RGB support to a set. 2012-10-18 14:35:10 +02:00
Sebastian Dröge
bd28c42fae eglglessink: Fix build of static plugin 2012-10-18 14:35:10 +02:00
Reynaldo H. Verdejo Pinochet
a83dae1b54 eglglessink: Drop wrong format test on _setcaps (draft leftover) 2012-10-18 14:35:10 +02:00
Reynaldo H. Verdejo Pinochet
75d4bf420a eglglessink: Support RGB24 by default 2012-10-18 14:35:10 +02:00
Reynaldo H. Verdejo Pinochet
1d77bf6c0f eglglessink: Instrument EGL error reporting 2012-10-18 14:35:09 +02:00
Reynaldo H. Verdejo Pinochet
b8c83f98b7 eglglessink: Correctly return GstFlowReturn from render_and_display() 2012-10-18 14:35:09 +02:00
Reynaldo H. Verdejo Pinochet
cca08a02a1 eglglessink: Move VBO setup to it's own function 2012-10-18 14:35:09 +02:00
Reynaldo H. Verdejo Pinochet
3fce24549f eglglessink: Fix render_and_display logic
Switch procedure according to enabled rendering path
2012-10-18 14:35:09 +02:00
Reynaldo H. Verdejo Pinochet
ada5a83eb4 eglglessink: Fix sample launch line with disabled window creation 2012-10-18 14:35:09 +02:00
Reynaldo H. Verdejo Pinochet
086563195c eglglessink: Rename stale android leftover 2012-10-18 14:35:09 +02:00
Reynaldo H. Verdejo Pinochet
ea03067f3f eglglessink: Move eglgles Sink to ext/ #2 2012-10-18 14:35:09 +02:00
Reynaldo H. Verdejo Pinochet
85250eb9e2 eglglessink: Move eglgles Sink to ext/ 2012-10-18 14:35:09 +02:00