mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	vulkan: announce SPA_PARAM_BUFFERS wrt. modifiers
This commit is contained in:
		
							parent
							
								
									3274880e8e
								
							
						
					
					
						commit
						a673c56eea
					
				
					 4 changed files with 46 additions and 14 deletions
				
			
		| 
						 | 
					@ -406,13 +406,25 @@ impl_node_port_enum_params(void *object, int seq,
 | 
				
			||||||
				this->position->video.size.height,
 | 
									this->position->video.size.height,
 | 
				
			||||||
				this->position->video.stride);
 | 
									this->position->video.stride);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							if (port->current_format.info.dsp.flags & SPA_VIDEO_FLAG_MODIFIER) {
 | 
				
			||||||
 | 
								struct vulkan_modifier_info *mod_info = spa_vulkan_get_modifier_info(&this->state,
 | 
				
			||||||
 | 
									&port->current_format.info.dsp);
 | 
				
			||||||
 | 
								param = spa_pod_builder_add_object(&b,
 | 
				
			||||||
 | 
									SPA_TYPE_OBJECT_ParamBuffers, id,
 | 
				
			||||||
 | 
									SPA_PARAM_BUFFERS_buffers, SPA_POD_CHOICE_RANGE_Int(2, 1, MAX_BUFFERS),
 | 
				
			||||||
 | 
									SPA_PARAM_BUFFERS_blocks,  SPA_POD_Int(mod_info->props.drmFormatModifierPlaneCount),
 | 
				
			||||||
 | 
									SPA_PARAM_BUFFERS_dataType, SPA_POD_CHOICE_FLAGS_Int(1<<SPA_DATA_DmaBuf));
 | 
				
			||||||
 | 
							} else {
 | 
				
			||||||
			param = spa_pod_builder_add_object(&b,
 | 
								param = spa_pod_builder_add_object(&b,
 | 
				
			||||||
				SPA_TYPE_OBJECT_ParamBuffers, id,
 | 
									SPA_TYPE_OBJECT_ParamBuffers, id,
 | 
				
			||||||
				SPA_PARAM_BUFFERS_buffers, SPA_POD_CHOICE_RANGE_Int(2, 1, MAX_BUFFERS),
 | 
									SPA_PARAM_BUFFERS_buffers, SPA_POD_CHOICE_RANGE_Int(2, 1, MAX_BUFFERS),
 | 
				
			||||||
				SPA_PARAM_BUFFERS_blocks,  SPA_POD_Int(1),
 | 
									SPA_PARAM_BUFFERS_blocks,  SPA_POD_Int(1),
 | 
				
			||||||
				SPA_PARAM_BUFFERS_size,  SPA_POD_Int(this->position->video.stride *
 | 
									SPA_PARAM_BUFFERS_size,  SPA_POD_Int(this->position->video.stride *
 | 
				
			||||||
					this->position->video.size.height),
 | 
										this->position->video.size.height),
 | 
				
			||||||
			SPA_PARAM_BUFFERS_stride,  SPA_POD_Int(this->position->video.stride));
 | 
									SPA_PARAM_BUFFERS_stride,  SPA_POD_Int(this->position->video.stride),
 | 
				
			||||||
 | 
									SPA_PARAM_BUFFERS_dataType, SPA_POD_CHOICE_FLAGS_Int(1<<SPA_DATA_MemPtr));
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		break;
 | 
							break;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	case SPA_PARAM_Meta:
 | 
						case SPA_PARAM_Meta:
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -640,13 +640,26 @@ impl_node_port_enum_params(void *object, int seq,
 | 
				
			||||||
				this->position->video.size.height,
 | 
									this->position->video.size.height,
 | 
				
			||||||
				this->position->video.stride);
 | 
									this->position->video.stride);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							if (port->current_format.info.dsp.flags & SPA_VIDEO_FLAG_MODIFIER) {
 | 
				
			||||||
 | 
								struct vulkan_modifier_info *mod_info = spa_vulkan_get_modifier_info(&this->state,
 | 
				
			||||||
 | 
									&port->current_format.info.dsp);
 | 
				
			||||||
 | 
								param = spa_pod_builder_add_object(&b,
 | 
				
			||||||
 | 
									SPA_TYPE_OBJECT_ParamBuffers, id,
 | 
				
			||||||
 | 
									SPA_PARAM_BUFFERS_buffers, SPA_POD_CHOICE_RANGE_Int(2, 1, MAX_BUFFERS),
 | 
				
			||||||
 | 
									SPA_PARAM_BUFFERS_blocks,  SPA_POD_Int(mod_info->props.drmFormatModifierPlaneCount),
 | 
				
			||||||
 | 
									SPA_PARAM_BUFFERS_dataType, SPA_POD_CHOICE_FLAGS_Int(1<<SPA_DATA_DmaBuf));
 | 
				
			||||||
 | 
							} else {
 | 
				
			||||||
			param = spa_pod_builder_add_object(&b,
 | 
								param = spa_pod_builder_add_object(&b,
 | 
				
			||||||
				SPA_TYPE_OBJECT_ParamBuffers, id,
 | 
									SPA_TYPE_OBJECT_ParamBuffers, id,
 | 
				
			||||||
				SPA_PARAM_BUFFERS_buffers, SPA_POD_CHOICE_RANGE_Int(2, 1, MAX_BUFFERS),
 | 
									SPA_PARAM_BUFFERS_buffers, SPA_POD_CHOICE_RANGE_Int(2, 1, MAX_BUFFERS),
 | 
				
			||||||
				SPA_PARAM_BUFFERS_blocks,  SPA_POD_Int(1),
 | 
									SPA_PARAM_BUFFERS_blocks,  SPA_POD_Int(1),
 | 
				
			||||||
				SPA_PARAM_BUFFERS_size,    SPA_POD_Int(this->position->video.stride *
 | 
									SPA_PARAM_BUFFERS_size,    SPA_POD_Int(this->position->video.stride *
 | 
				
			||||||
					this->position->video.size.height),
 | 
										this->position->video.size.height),
 | 
				
			||||||
			SPA_PARAM_BUFFERS_stride,  SPA_POD_Int(this->position->video.stride));
 | 
									SPA_PARAM_BUFFERS_stride,  SPA_POD_Int(this->position->video.stride),
 | 
				
			||||||
 | 
									SPA_PARAM_BUFFERS_dataType, SPA_POD_CHOICE_FLAGS_Int(1<<SPA_DATA_MemPtr));
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		break;
 | 
							break;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	case SPA_PARAM_Meta:
 | 
						case SPA_PARAM_Meta:
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -503,6 +503,11 @@ int spa_vulkan_get_buffer_caps(struct vulkan_compute_state *s, enum spa_directio
 | 
				
			||||||
	return 0;
 | 
						return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					struct vulkan_modifier_info *spa_vulkan_get_modifier_info(struct vulkan_compute_state *s, struct spa_video_info_dsp *info) {
 | 
				
			||||||
 | 
						VkFormat vk_format = vulkan_id_to_vkformat(info->format);
 | 
				
			||||||
 | 
						return vulkan_modifierInfo_find(&s->base, vk_format, info->modifier);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int spa_vulkan_init(struct vulkan_compute_state *s)
 | 
					int spa_vulkan_init(struct vulkan_compute_state *s)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	s->base.log = s->log;
 | 
						s->base.log = s->log;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -72,6 +72,8 @@ int spa_vulkan_process(struct vulkan_compute_state *s);
 | 
				
			||||||
int spa_vulkan_cleanup(struct vulkan_compute_state *s);
 | 
					int spa_vulkan_cleanup(struct vulkan_compute_state *s);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int spa_vulkan_get_buffer_caps(struct vulkan_compute_state *s, enum spa_direction direction);
 | 
					int spa_vulkan_get_buffer_caps(struct vulkan_compute_state *s, enum spa_direction direction);
 | 
				
			||||||
 | 
					struct vulkan_modifier_info *spa_vulkan_get_modifier_info(struct vulkan_compute_state *s,
 | 
				
			||||||
 | 
							struct spa_video_info_dsp *dsp_info);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int spa_vulkan_init(struct vulkan_compute_state *s);
 | 
					int spa_vulkan_init(struct vulkan_compute_state *s);
 | 
				
			||||||
void spa_vulkan_deinit(struct vulkan_compute_state *s);
 | 
					void spa_vulkan_deinit(struct vulkan_compute_state *s);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue