mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	v4l2: DmaBuf and MemFd are mostly the same
If the caller asks for MemFd, pass a DmaBuf because it is mostly the same for v4l2. Not very correct but it's not yet trivial to fall back to memfd. And this way we have something to give to the clients that will work when the client asks for MemFd or MemPtr.
This commit is contained in:
		
							parent
							
								
									c68a7cd603
								
							
						
					
					
						commit
						d6a569620c
					
				
					 1 changed files with 5 additions and 2 deletions
				
			
		| 
						 | 
					@ -1462,7 +1462,7 @@ mmap_init(struct impl *this,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (port->have_expbuf &&
 | 
							if (port->have_expbuf &&
 | 
				
			||||||
		    d[0].type != SPA_ID_INVALID &&
 | 
							    d[0].type != SPA_ID_INVALID &&
 | 
				
			||||||
		    (d[0].type & (1u << SPA_DATA_DmaBuf))) {
 | 
							    (d[0].type & ((1u << SPA_DATA_DmaBuf)|(1u<<SPA_DATA_MemFd)))) {
 | 
				
			||||||
			struct v4l2_exportbuffer expbuf;
 | 
								struct v4l2_exportbuffer expbuf;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			spa_zero(expbuf);
 | 
								spa_zero(expbuf);
 | 
				
			||||||
| 
						 | 
					@ -1479,7 +1479,10 @@ mmap_init(struct impl *this,
 | 
				
			||||||
				spa_log_error(this->log, "v4l2: '%s' VIDIOC_EXPBUF: %m", this->props.device);
 | 
									spa_log_error(this->log, "v4l2: '%s' VIDIOC_EXPBUF: %m", this->props.device);
 | 
				
			||||||
				return -errno;
 | 
									return -errno;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			d[0].type = SPA_DATA_DmaBuf;
 | 
								if (d[0].type & (1u<<SPA_DATA_DmaBuf))
 | 
				
			||||||
 | 
									d[0].type = SPA_DATA_DmaBuf;
 | 
				
			||||||
 | 
								else
 | 
				
			||||||
 | 
									d[0].type = SPA_DATA_MemFd;
 | 
				
			||||||
			d[0].flags = SPA_DATA_FLAG_READABLE;
 | 
								d[0].flags = SPA_DATA_FLAG_READABLE;
 | 
				
			||||||
			d[0].fd = expbuf.fd;
 | 
								d[0].fd = expbuf.fd;
 | 
				
			||||||
			d[0].data = NULL;
 | 
								d[0].data = NULL;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue