mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	mem: MAPPABLE -> UNMAPPABLE
Change the flag from MAPPABLE to UNMAPPABLE to ease compatibility. Older servers with newer client will not set the flag and so memory is mappable for the client. Newer server will set the flag but the client will ignore it and act like before.
This commit is contained in:
		
							parent
							
								
									8115bf3eeb
								
							
						
					
					
						commit
						39ca1bb9ed
					
				
					 9 changed files with 7 additions and 10 deletions
				
			
		| 
						 | 
					@ -859,8 +859,8 @@ do_port_use_buffers(struct impl *impl,
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
				uint32_t flags = PW_MEMBLOCK_FLAG_DONT_CLOSE;
 | 
									uint32_t flags = PW_MEMBLOCK_FLAG_DONT_CLOSE;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
				if (d->flags & SPA_DATA_FLAG_MAPPABLE)
 | 
									if (!(d->flags & SPA_DATA_FLAG_MAPPABLE))
 | 
				
			||||||
					flags |= PW_MEMBLOCK_FLAG_MAPPABLE;
 | 
										flags |= PW_MEMBLOCK_FLAG_UNMAPPABLE;
 | 
				
			||||||
				if (d->flags & SPA_DATA_FLAG_READABLE)
 | 
									if (d->flags & SPA_DATA_FLAG_READABLE)
 | 
				
			||||||
					flags |= PW_MEMBLOCK_FLAG_READABLE;
 | 
										flags |= PW_MEMBLOCK_FLAG_READABLE;
 | 
				
			||||||
				if (d->flags & SPA_DATA_FLAG_WRITABLE)
 | 
									if (d->flags & SPA_DATA_FLAG_WRITABLE)
 | 
				
			||||||
| 
						 | 
					@ -1357,7 +1357,6 @@ static int add_area(struct impl *impl)
 | 
				
			||||||
	area = pw_mempool_alloc(impl->context_pool,
 | 
						area = pw_mempool_alloc(impl->context_pool,
 | 
				
			||||||
			PW_MEMBLOCK_FLAG_READWRITE |
 | 
								PW_MEMBLOCK_FLAG_READWRITE |
 | 
				
			||||||
			PW_MEMBLOCK_FLAG_SEAL |
 | 
								PW_MEMBLOCK_FLAG_SEAL |
 | 
				
			||||||
			PW_MEMBLOCK_FLAG_MAPPABLE |
 | 
					 | 
				
			||||||
			PW_MEMBLOCK_FLAG_MAP,
 | 
								PW_MEMBLOCK_FLAG_MAP,
 | 
				
			||||||
			SPA_DATA_MemFd, size);
 | 
								SPA_DATA_MemFd, size);
 | 
				
			||||||
	if (area == NULL)
 | 
						if (area == NULL)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -192,7 +192,6 @@ pw_client_node0_transport_new(struct pw_context *context,
 | 
				
			||||||
	impl->mem = pw_mempool_alloc(pw_context_get_mempool(context),
 | 
						impl->mem = pw_mempool_alloc(pw_context_get_mempool(context),
 | 
				
			||||||
			PW_MEMBLOCK_FLAG_READWRITE |
 | 
								PW_MEMBLOCK_FLAG_READWRITE |
 | 
				
			||||||
			PW_MEMBLOCK_FLAG_SEAL |
 | 
								PW_MEMBLOCK_FLAG_SEAL |
 | 
				
			||||||
			PW_MEMBLOCK_FLAG_MAPPABLE |
 | 
					 | 
				
			||||||
			PW_MEMBLOCK_FLAG_MAP,
 | 
								PW_MEMBLOCK_FLAG_MAP,
 | 
				
			||||||
			SPA_DATA_MemFd, area_get_size(&area));
 | 
								SPA_DATA_MemFd, area_get_size(&area));
 | 
				
			||||||
	if (impl->mem == NULL) {
 | 
						if (impl->mem == NULL) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -83,7 +83,6 @@ static int alloc_buffers(struct pw_mempool *pool,
 | 
				
			||||||
		m = pw_mempool_alloc(pool,
 | 
							m = pw_mempool_alloc(pool,
 | 
				
			||||||
				PW_MEMBLOCK_FLAG_READWRITE |
 | 
									PW_MEMBLOCK_FLAG_READWRITE |
 | 
				
			||||||
				PW_MEMBLOCK_FLAG_SEAL |
 | 
									PW_MEMBLOCK_FLAG_SEAL |
 | 
				
			||||||
				PW_MEMBLOCK_FLAG_MAPPABLE |
 | 
					 | 
				
			||||||
				PW_MEMBLOCK_FLAG_MAP,
 | 
									PW_MEMBLOCK_FLAG_MAP,
 | 
				
			||||||
				SPA_DATA_MemFd,
 | 
									SPA_DATA_MemFd,
 | 
				
			||||||
				n_buffers * info.mem_size);
 | 
									n_buffers * info.mem_size);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -170,7 +170,6 @@ int pw_control_add_link(struct pw_control *control, uint32_t cmix,
 | 
				
			||||||
		impl->mem = pw_mempool_alloc(control->context->pool,
 | 
							impl->mem = pw_mempool_alloc(control->context->pool,
 | 
				
			||||||
						PW_MEMBLOCK_FLAG_READWRITE |
 | 
											PW_MEMBLOCK_FLAG_READWRITE |
 | 
				
			||||||
						PW_MEMBLOCK_FLAG_SEAL |
 | 
											PW_MEMBLOCK_FLAG_SEAL |
 | 
				
			||||||
						PW_MEMBLOCK_FLAG_MAPPABLE |
 | 
					 | 
				
			||||||
						PW_MEMBLOCK_FLAG_MAP,
 | 
											PW_MEMBLOCK_FLAG_MAP,
 | 
				
			||||||
						SPA_DATA_MemFd, size);
 | 
											SPA_DATA_MemFd, size);
 | 
				
			||||||
		if (impl->mem == NULL) {
 | 
							if (impl->mem == NULL) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -209,6 +209,8 @@ struct pw_core_events {
 | 
				
			||||||
	 * \param id bound object ID
 | 
						 * \param id bound object ID
 | 
				
			||||||
	 * \param global_id the global id bound to
 | 
						 * \param global_id the global id bound to
 | 
				
			||||||
	 * \param props The properties of the new global object.
 | 
						 * \param props The properties of the new global object.
 | 
				
			||||||
 | 
						 *
 | 
				
			||||||
 | 
						 * Since version 4:1
 | 
				
			||||||
	 */
 | 
						 */
 | 
				
			||||||
	void (*bound_props) (void *data, uint32_t id, uint32_t global_id, const struct spa_dict *props);
 | 
						void (*bound_props) (void *data, uint32_t id, uint32_t global_id, const struct spa_dict *props);
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -382,7 +382,7 @@ static void pool_added(void *data, struct pw_memblock *block)
 | 
				
			||||||
	if (client->core_resource) {
 | 
						if (client->core_resource) {
 | 
				
			||||||
		pw_core_resource_add_mem(client->core_resource,
 | 
							pw_core_resource_add_mem(client->core_resource,
 | 
				
			||||||
				block->id, block->type, block->fd,
 | 
									block->id, block->type, block->fd,
 | 
				
			||||||
				block->flags & (PW_MEMBLOCK_FLAG_READWRITE | PW_MEMBLOCK_FLAG_MAPPABLE));
 | 
									block->flags & (PW_MEMBLOCK_FLAG_READWRITE | PW_MEMBLOCK_FLAG_UNMAPPABLE));
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1479,7 +1479,6 @@ struct pw_impl_node *pw_context_create_node(struct pw_context *context,
 | 
				
			||||||
	this->activation = pw_mempool_alloc(this->context->pool,
 | 
						this->activation = pw_mempool_alloc(this->context->pool,
 | 
				
			||||||
			PW_MEMBLOCK_FLAG_READWRITE |
 | 
								PW_MEMBLOCK_FLAG_READWRITE |
 | 
				
			||||||
			PW_MEMBLOCK_FLAG_SEAL |
 | 
								PW_MEMBLOCK_FLAG_SEAL |
 | 
				
			||||||
			PW_MEMBLOCK_FLAG_MAPPABLE |
 | 
					 | 
				
			||||||
			PW_MEMBLOCK_FLAG_MAP,
 | 
								PW_MEMBLOCK_FLAG_MAP,
 | 
				
			||||||
			SPA_DATA_MemFd, size);
 | 
								SPA_DATA_MemFd, size);
 | 
				
			||||||
	if (this->activation == NULL) {
 | 
						if (this->activation == NULL) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -323,7 +323,7 @@ static struct mapping * memblock_map(struct memblock *b,
 | 
				
			||||||
		return NULL;
 | 
							return NULL;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!(b->this.flags & PW_MEMBLOCK_FLAG_MAPPABLE)) {
 | 
						if ((b->this.flags & PW_MEMBLOCK_FLAG_UNMAPPABLE)) {
 | 
				
			||||||
		pw_log_error("%p: block:%p can't be mmaped", p, &b->this);
 | 
							pw_log_error("%p: block:%p can't be mmaped", p, &b->this);
 | 
				
			||||||
		errno = EPERM;
 | 
							errno = EPERM;
 | 
				
			||||||
		return NULL;
 | 
							return NULL;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -29,7 +29,7 @@ enum pw_memblock_flags {
 | 
				
			||||||
	PW_MEMBLOCK_FLAG_MAP =		(1 << 3),	/**< mmap the fd */
 | 
						PW_MEMBLOCK_FLAG_MAP =		(1 << 3),	/**< mmap the fd */
 | 
				
			||||||
	PW_MEMBLOCK_FLAG_DONT_CLOSE =	(1 << 4),	/**< don't close fd */
 | 
						PW_MEMBLOCK_FLAG_DONT_CLOSE =	(1 << 4),	/**< don't close fd */
 | 
				
			||||||
	PW_MEMBLOCK_FLAG_DONT_NOTIFY =	(1 << 5),	/**< don't notify events */
 | 
						PW_MEMBLOCK_FLAG_DONT_NOTIFY =	(1 << 5),	/**< don't notify events */
 | 
				
			||||||
	PW_MEMBLOCK_FLAG_MAPPABLE =	(1 << 6),	/**< the fd can be mmapped */
 | 
						PW_MEMBLOCK_FLAG_UNMAPPABLE =	(1 << 6),	/**< the fd can not be mmapped */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	PW_MEMBLOCK_FLAG_READWRITE = PW_MEMBLOCK_FLAG_READABLE | PW_MEMBLOCK_FLAG_WRITABLE,
 | 
						PW_MEMBLOCK_FLAG_READWRITE = PW_MEMBLOCK_FLAG_READABLE | PW_MEMBLOCK_FLAG_WRITABLE,
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue