System: More work on making system functions pluggable

Move the epoll functions to the system functions and make the loop
use those. Use simple mask for events instead of enum.
Add the used system api in pw_loop.
Add System API to spa_support and use it where possible.
Pass the system API used in the realtime loops in spa_support as
well and use this in the realtime paths.
Improve bootstrapping, load only the log and cpu interfaces because
those can/need to be shared between instances. Let the core load
the other interfaces.
Add keys to configure the System and Loop implementations used in
pw_loop.
This commit is contained in:
Wim Taymans 2019-06-06 15:21:40 +02:00
parent 86dc0496a5
commit db88e9f954
22 changed files with 455 additions and 342 deletions

View file

@ -32,6 +32,7 @@ extern "C" {
#include <spa/utils/defs.h>
#include <spa/utils/hook.h>
#include <spa/utils/result.h>
#include <spa/support/system.h>
#define SPA_VERSION_LOOP 0
struct spa_loop { struct spa_interface iface; };
@ -41,13 +42,6 @@ struct spa_loop_control { struct spa_interface iface; };
struct spa_loop_utils { struct spa_interface iface; };
struct spa_source;
enum spa_io {
SPA_IO_IN = (1 << 0),
SPA_IO_OUT = (1 << 1),
SPA_IO_HUP = (1 << 2),
SPA_IO_ERR = (1 << 3),
};
typedef void (*spa_source_func_t) (struct spa_source *source);
struct spa_source {
@ -55,8 +49,8 @@ struct spa_source {
spa_source_func_t func;
void *data;
int fd;
enum spa_io mask;
enum spa_io rmask;
uint32_t mask;
uint32_t rmask;
};
typedef int (*spa_invoke_func_t) (struct spa_loop *loop,
@ -202,7 +196,7 @@ struct spa_loop_control_methods {
#define spa_loop_control_leave(l) spa_loop_control_method_v(l,leave,0)
#define spa_loop_control_iterate(l,...) spa_loop_control_method_r(l,iterate,0,__VA_ARGS__)
typedef void (*spa_source_io_func_t) (void *data, int fd, enum spa_io mask);
typedef void (*spa_source_io_func_t) (void *data, int fd, uint32_t mask);
typedef void (*spa_source_idle_func_t) (void *data);
typedef void (*spa_source_event_func_t) (void *data, uint64_t count);
typedef void (*spa_source_timer_func_t) (void *data, uint64_t expirations);
@ -219,11 +213,11 @@ struct spa_loop_utils_methods {
struct spa_source *(*add_io) (void *object,
int fd,
enum spa_io mask,
uint32_t mask,
bool close,
spa_source_io_func_t func, void *data);
int (*update_io) (void *object, struct spa_source *source, enum spa_io mask);
int (*update_io) (void *object, struct spa_source *source, uint32_t mask);
struct spa_source *(*add_idle) (void *object,
bool enabled,