Skip to content

EGL VCSM buffers #344

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Nov 30, 2016
Merged

EGL VCSM buffers #344

merged 3 commits into from
Nov 30, 2016

Conversation

timg236
Copy link
Contributor

@timg236 timg236 commented Oct 7, 2016

Enable zero-copy access to EGL textures and framebuffers from the CPU by adding an EGL extension that allocates buffers from VCSM.
Buffers must be RGBA raster order.
For normal 3D rendering it's much slower to use RSO buffers, however, for image processing it can be more efficient to use an RSO buffer if the buffer is only used once e.g. as part of an OpenCV pipeline.
This requires a beta version of the firmware.

@6by9
Copy link
Contributor

6by9 commented Oct 7, 2016

Can't really comment on the test app, but the other changes look OK.
Firmware changes need to be merged before these though.

popcornmix added a commit to raspberrypi/firmware that referenced this pull request Nov 16, 2016
See: raspberrypi/userland#344

firmware: egl_client: Avoid missing return value warning

firmware: debug_sym: Use pointer type for user address
popcornmix added a commit to Hexxeh/rpi-firmware that referenced this pull request Nov 16, 2016
See: raspberrypi/userland#344

firmware: egl_client: Avoid missing return value warning

firmware: debug_sym: Use pointer type for user address
@Ruffio
Copy link

Ruffio commented Nov 18, 2016

@6by9 Can this be merged now or we waiting for other firmware merges?

@popcornmix
Copy link
Contributor

popcornmix commented Nov 18, 2016

@Ruffio Currently the CMakefile change can break existing makefiles (easy enough to fix up, but will potential break a number of applications until that is done).

@timgover is aware and is thinking of a solution.

(edit: as the firmware side has been merged, users are able to test this PR by manually applying it).

@timg236
Copy link
Contributor Author

timg236 commented Nov 21, 2016

My plan is to change the dependency between the EGL library and VCSM to be a pure run-time version i.e. dlopen. That way it shouldn't matter whether VCSM is present or not and should be resilient to random combinations of EGL libraries.

I think it's a pretty simple change because there are only a couple of function calls.

Define the target for EGL images stored in VideoCore shared memory.
@timg236
Copy link
Contributor Author

timg236 commented Nov 26, 2016

I've removed the static library dependency between EGL and VCSM. It now loads libvcsm.so via dlopen so this should be compatible with Pi distributions without VCSM.

If anyone wants to have a static build dependency then modifying CMakeLists.txt to defined KHRONOS_HAVE_VCSM still works.

I verified this by building and verifying libraries with ldd and removing libvcsm.so

If there's a specific OS I should test with then please let me know, it's only verified on Raspbian Pixel so far.

Allocate a VCSM buffer using the dimensions supplied by the caller and
pass the vc mem-handle to 3D driver.

N.B. This API requires an update to the VideoCore firmware. If the update
is not present then eglCreateImageKHR will return an error if VCSM EGL
images are requested.

If HAVE_VCSM is defined then EGL is statically linked with libvcsm,
otherwise, libvcsm is loaded lazily as a plug-in when the first VCSM
EGL vcsm image target is requested.
Add a new RaspiStill example scene (vcsm_square) that shows how to
render a camera buffer using a GLES2 shader to an frame-buffer texture
in shared memory. The texture is then modified by the CPU and drawn to
the window surface.

The example just draws an animated rectangle to demonstrate that the
pipeline is working. A more interesting example might use a GL
shader to do edge detect, pass the output to OpenVC and then render
or composite the result.

To run 'raspistill --gl --glscene vcsm_square'
@timg236
Copy link
Contributor Author

timg236 commented Nov 27, 2016

Minor tidyup to error handling in egl_init_vcsm. I think that case would only be possible if the application is statically linked with libvcsm.a but libvcsm.so is missing which seems unlikely.

@popcornmix popcornmix merged commit bb15afe into raspberrypi:master Nov 30, 2016
@popcornmix
Copy link
Contributor

popcornmix commented Nov 30, 2016

Thanks - seems to work for me and isn't breaking other libs using egl. Thanks for making the changes!

mkreisl added a commit to xbianonpi/xbian-package-firmware that referenced this pull request Dec 1, 2016
- firmware: isp: Add isp and isp_ilc to standard Pi variant as a cheap resize
- firmware: MMAL: Add parameters to configure source pattern
- firmware: IL Camera: Minor tidy up in RGB output handling
- firmware: Video_render: Support YV12 and NV21 (YVU formats
- firmware: IL Source: Add support for YV12 output (YVU420PackedPlanar)
- firmware: IL ISP: Major updates
- firmware: mmal_ril: Relay buffer alignment from RIL to MMAL

- firmware: ldconfig: Increase line buffer length from 80 to 100

- firmware: h264: Fix skipping of SPSX in header bytes
  See: https://discourse.osmc.tv/t/video-does-not-work-with-hardware-acceleartion/6629/11

- firmware: display: Allow display blanking to affect DPI output
  See: #672

- firmware: Video_decode: Check licenced codecs at component create

- firmware: dispmanx: Report transform or display as the display_rotate variable
  See: raspberrypi/userland#348

- firmware: arm_loader: Don't lose force_turbo when initial_turbo completes
  See: #667

- firmware: mmal: improvements to mmal_queue code

- firmware: arm_dt: Silence system-supplied dtparams

- firmware: vc_image: Remove obsolete processor support using _VC_VERSION
- firmware: vc_image: Include colourspace in RGB to YUV conversions

- firmware: OV5647/IMX219: Shutdown lines in reverse order to opening
  See: https://www.raspberrypi.org/forums/viewtopic.php?f=43&t=138290#p1052932

- firmware: logging: Fix issue when logging end is at 1G

- firmware: hello_pi: Add hello_mmal_encode example
  See: raspberrypi/userland#349

- firmware: IL ISP: Update to support opaque input
- firmware: IL ISP: Fix for opaque EOS and excessive finalise calls

- firmware: khronos: Use low 256M allocations for bin allocations

- firmware: logging: Fix issue when logging end is at 1G part 2

- firmware: arm_loader: Ensure mbox failure paths return failure

- firmware: arm_loader: Add options for setting shared buffers from kernel driver

- firmware: vcdbg: Use dma driver to access gpu memory

- firmware: dispmanx: Support framebuffer_aspect=-1 for ignore aspect ratio
  See: #638

- firmware: Raspistill: Only fail setting restart int if not 0
- firmware: RaspiVid: -sg option could try opening null file
- firmware: RaspiVid: Segment PTS file too if set
  See: raspberrypi/userland#354

- firmware: RaspiVid: Add raw (YUV420, RGB or grayscale) video output
  See: raspberrypi/userland#342

- firmware: Add support for EGL images allocated by VCSM
  See: raspberrypi/userland#344

- firmware: egl_client: Avoid missing return value warning

- firmware: debug_sym: Use pointer type for user address

- firmware: Video_splitter: store and pass on frame rate information

- firmware: TC358762: Fix broken backlight ratelimiting
neuschaefer pushed a commit to neuschaefer/raspi-binary-firmware that referenced this pull request Feb 27, 2017
See: raspberrypi/userland#344

firmware: egl_client: Avoid missing return value warning

firmware: debug_sym: Use pointer type for user address
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants