Please note that User Registration has been temporarily disabled due to a recent increase in automated registrations. If anyone needs an account, please request one here: RequestAccount. Thanks for your patience!--Wmat (talk)
Please email User:Wmat if you experience any issues with the Request Account form.

Difference between revisions of "Raspberry Pi VideoCore APIs"

From eLinux.org
Jump to: navigation, search
(Start a community-driven documentation for the Raspberry Pi's VideoCore APIs)
 
(EGL: Forgot links, added them)
Line 41: Line 41:
 
''TODO''
 
''TODO''
 
=== EGL ===
 
=== EGL ===
[http://www.khronos.org/egl/ EGL (Native Platform Graphics Interface)] is an interface between Khronos rendering APIs such as OpenGL ES or OpenVG and the underlying native platform. The Raspberry Pi supports Version 1.4 and the following EGL extensions (links are to EGL registry documentation):<ref name="egl-info">eglinfo, http://www.raspberrypi.org/phpBB3/viewtopic.php?p=35942#p35942 , http://www.raspberrypi.org/phpBB3/viewtopic.php?p=36318#p36318</ref>
+
[http://www.khronos.org/egl/ EGL (Native Platform Graphics Interface)] is an interface between Khronos rendering APIs such as OpenGL ES or OpenVG and the underlying native platform. The Raspberry Pi supports [http://www.khronos.org/registry/egl/specs/eglspec.1.4.20110406.pdf EGL Version 1.4] and the following EGL extensions (links are to EGL registry documentation):<ref name="egl-info">eglinfo, http://www.raspberrypi.org/phpBB3/viewtopic.php?p=35942#p35942 , http://www.raspberrypi.org/phpBB3/viewtopic.php?p=36318#p36318</ref>
*EGL_KHR_image
+
*[http://www.khronos.org/registry/egl/extensions/KHR/EGL_KHR_image.txt EGL_KHR_image]
*EGL_KHR_image_base
+
*[http://www.khronos.org/registry/egl/extensions/KHR/EGL_KHR_image_base.txt EGL_KHR_image_base]
*EGL_KHR_image_pixmap
+
*[http://www.khronos.org/registry/egl/extensions/KHR/EGL_KHR_image_pixmap.txt EGL_KHR_image_pixmap]
*EGL_KHR_vg_parent_image
+
*[http://www.khronos.org/registry/egl/extensions/KHR/EGL_KHR_vg_parent_image.txt EGL_KHR_vg_parent_image]
*EGL_KHR_gl_texture_2D_image
+
*[http://www.khronos.org/registry/egl/extensions/KHR/EGL_KHR_gl_image.txt EGL_KHR_gl_texture_2D_image]
*EGL_KHR_gl_texture_cubemap_image
+
*[http://www.khronos.org/registry/egl/extensions/KHR/EGL_KHR_gl_image.txt EGL_KHR_gl_texture_cubemap_image]
*EGL_KHR_lock_surface
+
*[http://www.khronos.org/registry/egl/extensions/KHR/EGL_KHR_lock_surface.txt EGL_KHR_lock_surface]
  
 
==== Samples====
 
==== Samples====

Revision as of 14:52, 20 June 2012

Back to the Hub.


Software & Distributions:

Software - an overview.

Distributions - operating systems and development environments for the Raspberry Pi.

Kernel Compilation - advice on compiling a kernel.

Performance - measures of the Raspberry Pi's performance.

Programming - programming languages that might be used on the Raspberry Pi.

The Raspberry Pi contains a Broadcom VideoCore IV GPU providing OpenGL ES 1.1, OpenGL ES 2.0, hardware-accelerated OpenVG 1.1, Open EGL, OpenMAX and 1080p30 H.264 high-profile decode. There are 24 GFLOPS of general purpose compute and a bunch of texture filtering and DMA infrastructure. Eben worked on the architecture team for this and the Raspberry Pi team are looking at how they can make some of the proprietary features available to application programmers.

Currently C header files and libraries for many of the Broadcom APIs are located in /opt/vc/include and /opt/vc/lib respectively, or available from GitHub within the same directory structure. Some documentation is contained within comments in the header files, as well as documentation for the OpenMAX IL components in the documentation directory on Github, however it is severely lacking and difficult to understand in a general sense for people wanting to experiment with the device due to it being proprietary. As such, we encourage you to edit this page to help us build a much better open documentation.

Quirks

  • The Raspberry Pi requires that the bcm_host_init() function is called first before any GPU calls can be made.
  • graphics_get_display_size() is a broadcom-specific function

Sample Programs

The Raspberry Pi comes with 7 sample programs and two helper libraries in the /opt/vc/src/hello_pi directory showing some of the system's capabilities and sample code.

hello_video

This sample decodes h264 video using the OpenMAX APIs and the ilclient library, and is distributed with a short scene of Big Buck Bunny

ilclient helper library

This library is described as: This API defines helper functions for writing IL clients.

*
* This file defines an IL client side library.  This is useful when
* writing IL clients, since there tends to be much repeated and
* common code across both single and multiple clients.  This library
* seeks to remove that common code and abstract some of the
* interactions with components.  There is a wrapper around a
* component and tunnel, and some operations can be done on lists of
* these.  The callbacks from components are handled, and specific
* events can be checked or waited for.
*/


Libraries

vc_dispmanx_*

TODO

vc_tvservice_*

These APIs allow controlling the HDMI and SDTV video outputs of the Raspberry Pi.

TODO: Describe better

vc_cec_*

TODO

vc_gencmd_*

TODO

EGL

EGL (Native Platform Graphics Interface) is an interface between Khronos rendering APIs such as OpenGL ES or OpenVG and the underlying native platform. The Raspberry Pi supports EGL Version 1.4 and the following EGL extensions (links are to EGL registry documentation):[1]

Samples

See Getting Started with EGL post by Jon Macey

Function Documentation

int32_t graphics_get_display_size( const uint16_t display_number, uint32_t *width, uint32_t *height);

This function allows you to get the size of the display, and is often used in creating an EGL Surface. width and height are pointers that you pass in to where you want the response values to be written to, display number 0 is usually used for the Raspberry Pi. return value meaning is unknown.

Bugs present in early versions of the firmware caused this function to always return 1920x1080, however this can easily be fixed by updating the firmware with Hexxeh's rpi-update.[2]

OpenGL ES

The Raspberry Pi supports OpenGL ES 2.0 with the following extensions: [1]

  • GL_OES_compressed_ETC1_RGB8_texture
  • GL_OES_compressed_paletted_texture
  • GL_OES_texture_npot GL_OES_depth24
  • GL_OES_vertex_half_float
  • GL_OES_EGL_image
  • GL_OES_EGL_image_external
  • GL_EXT_discard_framebuffer
  • GL_OES_rgb8_rgba8
  • GL_OES_depth32
  • GL_OES_mapbuffer
  • GL_EXT_texture_format_BGRA8888
  • GL_APPLE_rgb_422
  • GL_EXT_debug_marker

TODO: Sample of how to use/initalise OpenGL ES

OpenMAX

See /documentation/ilcomponents on GitHub firmware repository for official documentation.

TODO: Sample of how to use OpenMAX to decode audio/video/images, etc.

Other Programming Languages

TODO: Find and list any libraries written for other languages (e.g. Python) that interface with the Pi's GPU

Programs designed to work with the Raspberry Pi's VideoCore APIs

  • omxplayer - a command line a/v player for the Raspberry Pi utilising the OpenMAX APIs and ffmpeg
  • XBMC - a media center, omxplayer's "big brother"
  • piNGL - port of the NGL graphics library to Raspberry Pi
  • qt5 samples - TODO: Find link

References

  1. 1.0 1.1 eglinfo, http://www.raspberrypi.org/phpBB3/viewtopic.php?p=35942#p35942 , http://www.raspberrypi.org/phpBB3/viewtopic.php?p=36318#p36318
  2. http://www.raspberrypi.org/phpBB3/viewtopic.php?f=68&t=8252