tizscheduler

group tizscheduler

Component event loop, OpenMAX IL handler initialisation and servant scheduling.

Defines

TIZ_COMP_MAX_PORTS

Maximum number of OpenMAX IL ports that may be registered with a Tizonia component.

TIZ_COMP_MAX_ROLES

Maximum number of roles that may be registered with a Tizonia component.

TIZ_COMP_MAX_TYPES

The maximum number of types that may be registered with a Tizonia component.

Typedefs

typedef OMX_PTR(* tiz_role_config_port_init_f)(OMX_HANDLETYPE ap_hdl)

‘Configuration port’ factory function prototype.

This function instantiates a ‘configuration port’ object for a specific component role. The ‘configuration’ port is a pseudo-port, it does not have an associated OpenMAX IL port index. It is used in libtizonia to encapsulate the logic for the component’s OpenMAX IL structures that are not associated to an actual OpenMAX IL port, i.e. OpenMAX IL parameter structures without an ‘nIndex’ member (e.g. OMX_PARAM_CONTENTURITYPE).

Note
Tizonia components require exactly one ‘configuration port’ to be functional.
Return
A pointer to a newly instantiated ‘configuration port’ object.
Parameters
  • ap_hdl: The component’s OpenMAX IL handle.

typedef OMX_PTR(* tiz_role_port_init_f)(OMX_HANDLETYPE ap_hdl)

‘port’ factory function prototype.

This function instantiates an OpenMAX IL ‘port’ object for a specific component role. Tizonia components require one or more ‘port’ objects to be functional.

Return
A pointer to a newly instantiated ‘port’ object.
Parameters
  • ap_hdl: The component’s OpenMAX IL handle.

typedef OMX_PTR(* tiz_role_proc_init_f)(OMX_HANDLETYPE ap_hdl)

‘processor’ factory function prototype.

This function instantiates an OpenMAX IL ‘processor’ object for a specific component role. Tizonia components require exactly one ‘processor’ object to be functional.

Return
A pointer to a newly instantiated ‘processor’ object.
Parameters
  • ap_hdl: The component’s OpenMAX IL handle.

typedef struct tiz_role_factory tiz_role_factory_t

OpenMAX IL role registration factory structure (typedef).

typedef struct tiz_event_pluggable tiz_event_pluggable_t

‘Pluggable’ event structure (typedef).

Functions

OMX_ERRORTYPE tiz_comp_init(const OMX_HANDLETYPE ap_hdl, const char * ap_cname)

Instantiate the OpenMAX IL component infrastructure.

When this function returns, the OpenMAX IL component handle is fully initialised. However, the component is still not functional until at least one role is registered (see tiz_comp_register_roles, and tiz_comp_register_types).

Note
This function must be called during the execution of the component’s entry point, usually OMX_ComponentInit.
Return
OMX_ErrorNone on success, other OMX_ERRORTYPE on error.
Parameters
  • ap_hdl: The OpenMAX IL handle.
  • ap_cname: The component name.

OMX_ERRORTYPE tiz_comp_register_roles(const OMX_HANDLETYPE ap_hdl, const tiz_role_factory_t * ap_role_list[], const OMX_U32 a_nroles)

Registration of component roles.

At least one factory must be registered for the component to be fully functional. At a minimum, this requires the specialisation of the ‘processor’ class (see tiz_comp_register_types).

Note
This function must be called during the execution of the component’s entry point, usually OMX_ComponentInit.
Return
OMX_ErrorNone on success, other OMX_ERRORTYPE on error.
Parameters
  • ap_hdl: The OpenMAX IL handle.
  • ap_role_list: A list of role factories.
  • a_nroles: The number of factories in the list.

OMX_ERRORTYPE tiz_comp_register_types(const OMX_HANDLETYPE ap_hdl, const tiz_type_factory_t * ap_type_list[], const OMX_U32 a_ntypes)

Registration of component types (a.k.a. classes).

Components need to register at least one additional class, a specialised ‘processor’ class. Ports may also need to be specialised.

Note
This function must be called during the execution of the component’s entry point, usually OMX_ComponentInit.
Return
OMX_ErrorNone on success, other OMX_ERRORTYPE on error.
Parameters
  • ap_hdl: The OpenMAX IL handle.
  • ap_type_list: A list of type/class factories.
  • a_ntypes: The number of factories in the list.

OMX_ERRORTYPE tiz_comp_register_alloc_hooks(const OMX_HANDLETYPE ap_hdl, const tiz_alloc_hooks_t * ap_new_hooks, tiz_alloc_hooks_t * ap_old_hooks)

Registration of port buffer allocation hooks.

Return
OMX_ErrorNone on success, other OMX_ERRORTYPE on error.
Parameters
  • ap_hdl: The OpenMAX IL handle.
  • ap_new_hooks: The new port buffer allocation hooks.
  • ap_old_hooks: The old allocation hooks (the ones replaced).

OMX_ERRORTYPE tiz_comp_register_eglimage_hook(const OMX_HANDLETYPE ap_hdl, const tiz_eglimage_hook_t * ap_hook)

Registration of the EGL image validation hook.

Return
OMX_ErrorNone on success, other OMX_ERRORTYPE on error.
Parameters
  • ap_hdl: The OpenMAX IL handle.
  • ap_hook: EGL image validation hook info.

OMX_ERRORTYPE tiz_comp_register_role_eglimage_hook(const OMX_HANDLETYPE ap_hdl, const OMX_U8 * ap_role, const tiz_eglimage_hook_t * ap_hook)

Registration of ‘per-role’ EGL image validation hooks.

Return
OMX_ErrorNone on success, other OMX_ERRORTYPE on error.
Parameters
  • ap_hdl: The OpenMAX IL handle.
  • ap_role: A role name (a string of up to OMX_MAX_STRINGNAME_SIZE).
  • ap_hook: EGL image validation hook info.

OMX_ERRORTYPE tiz_comp_event_pluggable(const OMX_HANDLETYPE ap_hdl, tiz_event_pluggable_t * ap_event)

Queueing of ‘pluggable’ events.

A ‘pluggable’ event is submitted to the component’s event queue using this function. The component’s event loop will deliver the event to its handler for processing within the component’s thread context.

Return
OMX_ErrorNone on success, other OMX_ERRORTYPE on error.
Parameters
  • ap_hdl: The OpenMAX IL handle.
  • ap_event: The pluggable event.

void tiz_comp_event_io(const OMX_HANDLETYPE ap_hdl, tiz_event_io_t * ap_ev_io, void * ap_arg, const uint32_t a_id, const int a_fd, const int a_events)

Queueing of ‘io’ events.

An ‘io’ event is submitted to the component’s event queue using this function. The component’s event loop will deliver the ‘io’ event to the ‘processor’ object for processing within the component’s thread context.

Return
OMX_ErrorNone on success, other OMX_ERRORTYPE on error.
Parameters
  • ap_hdl: The OpenMAX IL handle.
  • ap_ev_io:
  • ap_arg:
  • a_id:
  • a_fd:
  • a_events:

void tiz_comp_event_timer(const OMX_HANDLETYPE ap_hdl, tiz_event_timer_t * ap_ev_timer, void * ap_arg, const uint32_t a_id)

Queueing of ‘timer’ events.

An ‘timer’ event is submitted to the component’s event queue using this function. The component’s event loop will deliver the ‘timer’ event to the ‘processor’ object for processing within the component’s thread context.

Return
OMX_ErrorNone on success, other OMX_ERRORTYPE on error.
Parameters
  • ap_hdl: The OpenMAX IL handle.
  • ap_ev_timer:
  • ap_arg:
  • a_id:

void tiz_comp_event_stat(const OMX_HANDLETYPE ap_hdl, tiz_event_stat_t * ap_ev_stat, void * ap_arg, const uint32_t a_id, const int a_events)

Queueing of ‘stat’ events.

An ‘stat’ event is submitted to the component’s event queue using this function. The component’s event loop will deliver the ‘stat’ event to the ‘processor’ object for processing within the component’s thread context.

Return
OMX_ErrorNone on success, other OMX_ERRORTYPE on error.
Parameters
  • ap_hdl: The OpenMAX IL handle.
  • ap_ev_stat:
  • ap_arg:
  • a_id:
  • a_events:

size_t tiz_comp_event_queue_unused_spaces(const OMX_HANDLETYPE ap_hdl)

Retrieve the current maximum number of items that could be insterted into the queue.

Return
A registered type.
Parameters
  • ap_hdl: The OpenMAX IL handle.

void* tiz_get_fsm(const OMX_HANDLETYPE ap_hdl)

Retrieve the component’s ‘fsm’ servant object.

Return
The fsm servant.
Parameters
  • ap_hdl: The OpenMAX IL handle.

void* tiz_get_krn(const OMX_HANDLETYPE ap_hdl)

Retrieve the component’s ‘kernel’ servant object.

Return
The kernel servant.
Parameters
  • ap_hdl: The OpenMAX IL handle.

void* tiz_get_prc(const OMX_HANDLETYPE ap_hdl)

Retrieve the component’s ‘processor’ servant object.

Return
The processor servant.
Parameters
  • ap_hdl: The OpenMAX IL handle.

void* tiz_get_sched(const OMX_HANDLETYPE ap_hdl)

Retrieve the component’s servant ‘scheduler’ object.

Return
The scheduler object.
Parameters
  • ap_hdl: The OpenMAX IL handle.

void* tiz_get_type(const OMX_HANDLETYPE ap_hdl, const char * ap_type_name)

Retrieve a component’s registered type / class.

Return
A registered type.
Parameters
  • ap_hdl: The OpenMAX IL handle.

struct tiz_role_factory
#include <tizscheduler.h>

OpenMAX IL role registration factory structure.

This structure is used to hold the various factory functions and elements necessary to register a new role within the libtizonia component infrastrucure.

Public Members

tiz_role_config_port_init_f pf_cport

‘configuration port’ factory function

tiz_role_proc_init_f pf_proc

‘processor’ factory function

OMX_U32 nports

number of ports in this role

OMX_U8 tiz_role_factory::role[OMX_MAX_STRINGNAME_SIZE]

the role name

struct tiz_event_pluggable
#include <tizscheduler.h>

‘Pluggable’ event structure.

A ‘pluggable’ event is a user-defined event that gets queued up in the component’s event queue. Once in the component’s event loop, the event is then delivered (in the context of the component’s thread) to the corresponding servant object (‘fsm’, ‘kernel’, or ‘processor’) for processing.

The main use for this type of event is to allow the component’s ‘processor’ the processing of events coming from an external thread from within the component’s event loop and thread. Any data received in the external event tipically needs to be dup’ed before enqueueing the pluggable event (to avoid data races).

Public Members

OMX_PTR p_servant

The servant object that will be processing the external event.

tiz_event_pluggable_hdlr_f pf_hdlr

The event handler