mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-01 22:58:50 -04:00
spa: add cpu method to get the VM type
Make a method to query the VM we are running on.
This commit is contained in:
parent
07c9dbbffa
commit
ce828af9e1
2 changed files with 95 additions and 1 deletions
|
|
@ -80,13 +80,31 @@ struct spa_cpu { struct spa_interface iface; };
|
|||
#define SPA_CPU_FLAG_ARMV8 (1 << 6)
|
||||
|
||||
#define SPA_CPU_FORCE_AUTODETECT ((uint32_t)-1)
|
||||
|
||||
#define SPA_CPU_VM_NONE (0)
|
||||
#define SPA_CPU_VM_OTHER (1 << 0)
|
||||
#define SPA_CPU_VM_KVM (1 << 1)
|
||||
#define SPA_CPU_VM_QEMU (1 << 2)
|
||||
#define SPA_CPU_VM_BOCHS (1 << 3)
|
||||
#define SPA_CPU_VM_XEN (1 << 4)
|
||||
#define SPA_CPU_VM_UML (1 << 5)
|
||||
#define SPA_CPU_VM_VMWARE (1 << 6)
|
||||
#define SPA_CPU_VM_ORACLE (1 << 7)
|
||||
#define SPA_CPU_VM_MICROSOFT (1 << 8)
|
||||
#define SPA_CPU_VM_ZVM (1 << 9)
|
||||
#define SPA_CPU_VM_PARALLELS (1 << 10)
|
||||
#define SPA_CPU_VM_BHYVE (1 << 11)
|
||||
#define SPA_CPU_VM_QNX (1 << 12)
|
||||
#define SPA_CPU_VM_ACRN (1 << 13)
|
||||
#define SPA_CPU_VM_POWERVM (1 << 14)
|
||||
|
||||
/**
|
||||
* methods
|
||||
*/
|
||||
struct spa_cpu_methods {
|
||||
/** the version of the methods. This can be used to expand this
|
||||
structure in the future */
|
||||
#define SPA_VERSION_CPU_METHODS 0
|
||||
#define SPA_VERSION_CPU_METHODS 1
|
||||
uint32_t version;
|
||||
|
||||
/** get CPU flags */
|
||||
|
|
@ -100,6 +118,9 @@ struct spa_cpu_methods {
|
|||
|
||||
/** get maximum required alignment of data */
|
||||
uint32_t (*get_max_align) (void *object);
|
||||
|
||||
/* check if running in a VM. Since:1 */
|
||||
uint32_t (*get_vm_type) (void *object);
|
||||
};
|
||||
|
||||
#define spa_cpu_method(o,method,version,...) \
|
||||
|
|
@ -115,6 +136,7 @@ struct spa_cpu_methods {
|
|||
#define spa_cpu_force_flags(c,f) spa_cpu_method(c, force_flags, 0, f)
|
||||
#define spa_cpu_get_count(c) spa_cpu_method(c, get_count, 0)
|
||||
#define spa_cpu_get_max_align(c) spa_cpu_method(c, get_max_align, 0)
|
||||
#define spa_cpu_get_vm_type(c) spa_cpu_method(c, get_vm_type, 1)
|
||||
|
||||
/** keys can be given when initializing the cpu handle */
|
||||
#define SPA_KEY_CPU_FORCE "cpu.force" /**< force cpu flags */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue