mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	cpu: add CPU_FORCE option to cpu interface
This commit is contained in:
		
							parent
							
								
									92d7da0103
								
							
						
					
					
						commit
						3f5c75c52d
					
				
					 2 changed files with 13 additions and 1 deletions
				
			
		| 
						 | 
					@ -114,6 +114,9 @@ struct spa_cpu_methods {
 | 
				
			||||||
#define spa_cpu_get_count(c)		spa_cpu_method(c, get_count, 0)
 | 
					#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_max_align(c)	spa_cpu_method(c, get_max_align, 0)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/** keys can be given when initializing the cpu handle */
 | 
				
			||||||
 | 
					#define SPA_KEY_CPU_FORCE		"cpu.force"		/**< force cpu flags */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef __cplusplus
 | 
					#ifdef __cplusplus
 | 
				
			||||||
}  /* extern "C" */
 | 
					}  /* extern "C" */
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -142,6 +142,7 @@ impl_init(const struct spa_handle_factory *factory,
 | 
				
			||||||
	  uint32_t n_support)
 | 
						  uint32_t n_support)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct impl *this;
 | 
						struct impl *this;
 | 
				
			||||||
 | 
						const char *str;
 | 
				
			||||||
	uint32_t i;
 | 
						uint32_t i;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	spa_return_val_if_fail(factory != NULL, -EINVAL);
 | 
						spa_return_val_if_fail(factory != NULL, -EINVAL);
 | 
				
			||||||
| 
						 | 
					@ -158,8 +159,11 @@ impl_init(const struct spa_handle_factory *factory,
 | 
				
			||||||
			&impl_cpu, this);
 | 
								&impl_cpu, this);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for (i = 0; i < n_support; i++) {
 | 
						for (i = 0; i < n_support; i++) {
 | 
				
			||||||
		if (support[i].type == SPA_TYPE_INTERFACE_Log)
 | 
							switch (support[i].type) {
 | 
				
			||||||
 | 
							case SPA_TYPE_INTERFACE_Log:
 | 
				
			||||||
			this->log = support[i].data;
 | 
								this->log = support[i].data;
 | 
				
			||||||
 | 
								break;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	this->flags = 0;
 | 
						this->flags = 0;
 | 
				
			||||||
	this->force = SPA_CPU_FORCE_AUTODETECT;
 | 
						this->force = SPA_CPU_FORCE_AUTODETECT;
 | 
				
			||||||
| 
						 | 
					@ -167,6 +171,11 @@ impl_init(const struct spa_handle_factory *factory,
 | 
				
			||||||
	this->count = get_count(this);
 | 
						this->count = get_count(this);
 | 
				
			||||||
	init(this);
 | 
						init(this);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (info) {
 | 
				
			||||||
 | 
							if ((str = spa_dict_lookup(info, SPA_KEY_CPU_FORCE)) != NULL)
 | 
				
			||||||
 | 
								this->flags = atoi(str);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	spa_log_debug(this->log, NAME " %p: count:%d align:%d flags:%08x",
 | 
						spa_log_debug(this->log, NAME " %p: count:%d align:%d flags:%08x",
 | 
				
			||||||
			this, this->count, this->max_align, this->flags);
 | 
								this, this->count, this->max_align, this->flags);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue