mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	vulkan: namespace functions in compute-utils to spa_vulkan_compute
Rename compute functions to allow for shared common functions for non oppinionated vulkan helpers. No functional changes.
This commit is contained in:
		
							parent
							
								
									7d97e47e28
								
							
						
					
					
						commit
						51b7d49cff
					
				
					 4 changed files with 58 additions and 58 deletions
				
			
		| 
						 | 
					@ -172,7 +172,7 @@ static int impl_node_send_command(void *object, const struct spa_command *comman
 | 
				
			||||||
			return 0;
 | 
								return 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		this->started = true;
 | 
							this->started = true;
 | 
				
			||||||
		spa_vulkan_start(&this->state);
 | 
							spa_vulkan_compute_start(&this->state);
 | 
				
			||||||
		break;
 | 
							break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	case SPA_NODE_COMMAND_Suspend:
 | 
						case SPA_NODE_COMMAND_Suspend:
 | 
				
			||||||
| 
						 | 
					@ -181,7 +181,7 @@ static int impl_node_send_command(void *object, const struct spa_command *comman
 | 
				
			||||||
			return 0;
 | 
								return 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		this->started = false;
 | 
							this->started = false;
 | 
				
			||||||
		spa_vulkan_stop(&this->state);
 | 
							spa_vulkan_compute_stop(&this->state);
 | 
				
			||||||
		break;
 | 
							break;
 | 
				
			||||||
	default:
 | 
						default:
 | 
				
			||||||
		return -ENOTSUP;
 | 
							return -ENOTSUP;
 | 
				
			||||||
| 
						 | 
					@ -347,10 +347,10 @@ static int port_enum_formats(void *object,
 | 
				
			||||||
			*param = spa_format_video_dsp_build(builder, SPA_PARAM_EnumFormat, &this->port[port_id].current_format.info.dsp);
 | 
								*param = spa_format_video_dsp_build(builder, SPA_PARAM_EnumFormat, &this->port[port_id].current_format.info.dsp);
 | 
				
			||||||
			return 1;
 | 
								return 1;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		if (!find_EnumFormatInfo(&this->state.base, index-1, spa_vulkan_get_buffer_caps(&this->state, direction), &fmt_index, &has_modifier))
 | 
							if (!find_EnumFormatInfo(&this->state.base, index-1, spa_vulkan_compute_get_buffer_caps(&this->state, direction), &fmt_index, &has_modifier))
 | 
				
			||||||
			return 0;
 | 
								return 0;
 | 
				
			||||||
	} else {
 | 
						} else {
 | 
				
			||||||
		if (!find_EnumFormatInfo(&this->state.base, index, spa_vulkan_get_buffer_caps(&this->state, direction), &fmt_index, &has_modifier))
 | 
							if (!find_EnumFormatInfo(&this->state.base, index, spa_vulkan_compute_get_buffer_caps(&this->state, direction), &fmt_index, &has_modifier))
 | 
				
			||||||
			return 0;
 | 
								return 0;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -420,7 +420,7 @@ impl_node_port_enum_params(void *object, int seq,
 | 
				
			||||||
				this->position->video.stride);
 | 
									this->position->video.stride);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (port->current_format.info.dsp.flags & SPA_VIDEO_FLAG_MODIFIER) {
 | 
							if (port->current_format.info.dsp.flags & SPA_VIDEO_FLAG_MODIFIER) {
 | 
				
			||||||
			struct vulkan_modifier_info *mod_info = spa_vulkan_get_modifier_info(&this->state,
 | 
								struct vulkan_modifier_info *mod_info = spa_vulkan_compute_get_modifier_info(&this->state,
 | 
				
			||||||
				&port->current_format.info.dsp);
 | 
									&port->current_format.info.dsp);
 | 
				
			||||||
			param = spa_pod_builder_add_object(&b,
 | 
								param = spa_pod_builder_add_object(&b,
 | 
				
			||||||
				SPA_TYPE_OBJECT_ParamBuffers, id,
 | 
									SPA_TYPE_OBJECT_ParamBuffers, id,
 | 
				
			||||||
| 
						 | 
					@ -472,8 +472,8 @@ static int clear_buffers(struct impl *this, struct port *port)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	if (port->n_buffers > 0) {
 | 
						if (port->n_buffers > 0) {
 | 
				
			||||||
		spa_log_debug(this->log, NAME " %p: clear buffers", this);
 | 
							spa_log_debug(this->log, NAME " %p: clear buffers", this);
 | 
				
			||||||
		spa_vulkan_stop(&this->state);
 | 
							spa_vulkan_compute_stop(&this->state);
 | 
				
			||||||
		spa_vulkan_use_buffers(&this->state, &this->state.streams[port->stream_id], 0, &port->current_format.info.dsp, 0, NULL);
 | 
							spa_vulkan_compute_use_buffers(&this->state, &this->state.streams[port->stream_id], 0, &port->current_format.info.dsp, 0, NULL);
 | 
				
			||||||
		port->n_buffers = 0;
 | 
							port->n_buffers = 0;
 | 
				
			||||||
		spa_list_init(&port->empty);
 | 
							spa_list_init(&port->empty);
 | 
				
			||||||
		spa_list_init(&port->ready);
 | 
							spa_list_init(&port->ready);
 | 
				
			||||||
| 
						 | 
					@ -491,7 +491,7 @@ static int port_set_format(struct impl *this, struct port *port,
 | 
				
			||||||
	if (format == NULL) {
 | 
						if (format == NULL) {
 | 
				
			||||||
		port->have_format = false;
 | 
							port->have_format = false;
 | 
				
			||||||
		clear_buffers(this, port);
 | 
							clear_buffers(this, port);
 | 
				
			||||||
		spa_vulkan_unprepare(&this->state);
 | 
							spa_vulkan_compute_unprepare(&this->state);
 | 
				
			||||||
	} else {
 | 
						} else {
 | 
				
			||||||
		struct spa_video_info info = { 0 };
 | 
							struct spa_video_info info = { 0 };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -528,7 +528,7 @@ static int port_set_format(struct impl *this, struct port *port,
 | 
				
			||||||
			modifierCount -= 1;
 | 
								modifierCount -= 1;
 | 
				
			||||||
			modifiers++;
 | 
								modifiers++;
 | 
				
			||||||
			uint64_t fixed_modifier;
 | 
								uint64_t fixed_modifier;
 | 
				
			||||||
			if (spa_vulkan_fixate_modifier(&this->state, &this->state.streams[port->stream_id], &info.info.dsp, modifierCount, modifiers, &fixed_modifier) != 0)
 | 
								if (spa_vulkan_compute_fixate_modifier(&this->state, &this->state.streams[port->stream_id], &info.info.dsp, modifierCount, modifiers, &fixed_modifier) != 0)
 | 
				
			||||||
				return -EINVAL;
 | 
									return -EINVAL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			spa_log_info(this->log, NAME ": modifier fixated %"PRIu64, fixed_modifier);
 | 
								spa_log_info(this->log, NAME ": modifier fixated %"PRIu64, fixed_modifier);
 | 
				
			||||||
| 
						 | 
					@ -628,7 +628,7 @@ impl_node_port_use_buffers(void *object,
 | 
				
			||||||
		spa_log_info(this->log, "%p: %d:%d add buffer %p", port, direction, port_id, b);
 | 
							spa_log_info(this->log, "%p: %d:%d add buffer %p", port, direction, port_id, b);
 | 
				
			||||||
		spa_list_append(&port->empty, &b->link);
 | 
							spa_list_append(&port->empty, &b->link);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	spa_vulkan_use_buffers(&this->state, &this->state.streams[port->stream_id], flags, &port->current_format.info.dsp, n_buffers, buffers);
 | 
						spa_vulkan_compute_use_buffers(&this->state, &this->state.streams[port->stream_id], flags, &port->current_format.info.dsp, n_buffers, buffers);
 | 
				
			||||||
	port->n_buffers = n_buffers;
 | 
						port->n_buffers = n_buffers;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return 0;
 | 
						return 0;
 | 
				
			||||||
| 
						 | 
					@ -725,7 +725,7 @@ static int impl_node_process(void *object)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	spa_log_debug(this->log, "filter into %d", b->id);
 | 
						spa_log_debug(this->log, "filter into %d", b->id);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	spa_vulkan_process(&this->state);
 | 
						spa_vulkan_compute_process(&this->state);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	b->outbuf->datas[0].chunk->offset = 0;
 | 
						b->outbuf->datas[0].chunk->offset = 0;
 | 
				
			||||||
	b->outbuf->datas[0].chunk->size = b->outbuf->datas[0].maxsize;
 | 
						b->outbuf->datas[0].chunk->size = b->outbuf->datas[0].maxsize;
 | 
				
			||||||
| 
						 | 
					@ -780,7 +780,7 @@ static int impl_clear(struct spa_handle *handle)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	this = (struct impl *) handle;
 | 
						this = (struct impl *) handle;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	spa_vulkan_deinit(&this->state);
 | 
						spa_vulkan_compute_deinit(&this->state);
 | 
				
			||||||
	return 0;
 | 
						return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -847,7 +847,7 @@ impl_init(const struct spa_handle_factory *factory,
 | 
				
			||||||
	port->params[4] = SPA_PARAM_INFO(SPA_PARAM_Buffers, 0);
 | 
						port->params[4] = SPA_PARAM_INFO(SPA_PARAM_Buffers, 0);
 | 
				
			||||||
	port->info.params = port->params;
 | 
						port->info.params = port->params;
 | 
				
			||||||
	port->info.n_params = 5;
 | 
						port->info.n_params = 5;
 | 
				
			||||||
	spa_vulkan_init_stream(&this->state, &this->state.streams[port->stream_id],
 | 
						spa_vulkan_compute_init_stream(&this->state, &this->state.streams[port->stream_id],
 | 
				
			||||||
			SPA_DIRECTION_INPUT, NULL);
 | 
								SPA_DIRECTION_INPUT, NULL);
 | 
				
			||||||
	spa_list_init(&port->empty);
 | 
						spa_list_init(&port->empty);
 | 
				
			||||||
	spa_list_init(&port->ready);
 | 
						spa_list_init(&port->ready);
 | 
				
			||||||
| 
						 | 
					@ -869,12 +869,12 @@ impl_init(const struct spa_handle_factory *factory,
 | 
				
			||||||
	port->info.n_params = 5;
 | 
						port->info.n_params = 5;
 | 
				
			||||||
	spa_list_init(&port->empty);
 | 
						spa_list_init(&port->empty);
 | 
				
			||||||
	spa_list_init(&port->ready);
 | 
						spa_list_init(&port->ready);
 | 
				
			||||||
	spa_vulkan_init_stream(&this->state, &this->state.streams[port->stream_id],
 | 
						spa_vulkan_compute_init_stream(&this->state, &this->state.streams[port->stream_id],
 | 
				
			||||||
			SPA_DIRECTION_OUTPUT, NULL);
 | 
								SPA_DIRECTION_OUTPUT, NULL);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	this->state.n_streams = 2;
 | 
						this->state.n_streams = 2;
 | 
				
			||||||
	spa_vulkan_init(&this->state);
 | 
						spa_vulkan_compute_init(&this->state);
 | 
				
			||||||
	spa_vulkan_prepare(&this->state);
 | 
						spa_vulkan_compute_prepare(&this->state);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return 0;
 | 
						return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -274,7 +274,7 @@ static int make_buffer(struct impl *this)
 | 
				
			||||||
	if (read_timer(this) < 0)
 | 
						if (read_timer(this) < 0)
 | 
				
			||||||
		return 0;
 | 
							return 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if ((res = spa_vulkan_ready(&this->state)) < 0) {
 | 
						if ((res = spa_vulkan_compute_ready(&this->state)) < 0) {
 | 
				
			||||||
		res = SPA_STATUS_OK;
 | 
							res = SPA_STATUS_OK;
 | 
				
			||||||
		goto next;
 | 
							goto next;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					@ -295,7 +295,7 @@ static int make_buffer(struct impl *this)
 | 
				
			||||||
	this->state.constants.frame = this->frame_count;
 | 
						this->state.constants.frame = this->frame_count;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	this->state.streams[0].pending_buffer_id = b->id;
 | 
						this->state.streams[0].pending_buffer_id = b->id;
 | 
				
			||||||
	spa_vulkan_process(&this->state);
 | 
						spa_vulkan_compute_process(&this->state);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (this->state.streams[0].ready_buffer_id != SPA_ID_INVALID) {
 | 
						if (this->state.streams[0].ready_buffer_id != SPA_ID_INVALID) {
 | 
				
			||||||
		struct buffer *b = &port->buffers[this->state.streams[0].ready_buffer_id];
 | 
							struct buffer *b = &port->buffers[this->state.streams[0].ready_buffer_id];
 | 
				
			||||||
| 
						 | 
					@ -405,7 +405,7 @@ static int impl_node_send_command(void *object, const struct spa_command *comman
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		this->started = true;
 | 
							this->started = true;
 | 
				
			||||||
		set_timer(this, true);
 | 
							set_timer(this, true);
 | 
				
			||||||
		spa_vulkan_start(&this->state);
 | 
							spa_vulkan_compute_start(&this->state);
 | 
				
			||||||
		break;
 | 
							break;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	case SPA_NODE_COMMAND_Suspend:
 | 
						case SPA_NODE_COMMAND_Suspend:
 | 
				
			||||||
| 
						 | 
					@ -415,7 +415,7 @@ static int impl_node_send_command(void *object, const struct spa_command *comman
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		this->started = false;
 | 
							this->started = false;
 | 
				
			||||||
		set_timer(this, false);
 | 
							set_timer(this, false);
 | 
				
			||||||
		spa_vulkan_stop(&this->state);
 | 
							spa_vulkan_compute_stop(&this->state);
 | 
				
			||||||
		break;
 | 
							break;
 | 
				
			||||||
	default:
 | 
						default:
 | 
				
			||||||
		return -ENOTSUP;
 | 
							return -ENOTSUP;
 | 
				
			||||||
| 
						 | 
					@ -581,10 +581,10 @@ static int port_enum_formats(void *object,
 | 
				
			||||||
			*param = spa_format_video_dsp_build(builder, SPA_PARAM_EnumFormat, &this->port.current_format.info.dsp);
 | 
								*param = spa_format_video_dsp_build(builder, SPA_PARAM_EnumFormat, &this->port.current_format.info.dsp);
 | 
				
			||||||
			return 1;
 | 
								return 1;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		if (!find_EnumFormatInfo(&this->state.base, index-1, spa_vulkan_get_buffer_caps(&this->state, direction), &fmt_index, &has_modifier))
 | 
							if (!find_EnumFormatInfo(&this->state.base, index-1, spa_vulkan_compute_get_buffer_caps(&this->state, direction), &fmt_index, &has_modifier))
 | 
				
			||||||
			return 0;
 | 
								return 0;
 | 
				
			||||||
	} else {
 | 
						} else {
 | 
				
			||||||
		if (!find_EnumFormatInfo(&this->state.base, index, spa_vulkan_get_buffer_caps(&this->state, direction), &fmt_index, &has_modifier))
 | 
							if (!find_EnumFormatInfo(&this->state.base, index, spa_vulkan_compute_get_buffer_caps(&this->state, direction), &fmt_index, &has_modifier))
 | 
				
			||||||
			return 0;
 | 
								return 0;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -655,7 +655,7 @@ impl_node_port_enum_params(void *object, int seq,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (port->current_format.info.dsp.flags & SPA_VIDEO_FLAG_MODIFIER) {
 | 
							if (port->current_format.info.dsp.flags & SPA_VIDEO_FLAG_MODIFIER) {
 | 
				
			||||||
			struct vulkan_modifier_info *mod_info = spa_vulkan_get_modifier_info(&this->state,
 | 
								struct vulkan_modifier_info *mod_info = spa_vulkan_compute_get_modifier_info(&this->state,
 | 
				
			||||||
				&port->current_format.info.dsp);
 | 
									&port->current_format.info.dsp);
 | 
				
			||||||
			param = spa_pod_builder_add_object(&b,
 | 
								param = spa_pod_builder_add_object(&b,
 | 
				
			||||||
				SPA_TYPE_OBJECT_ParamBuffers, id,
 | 
									SPA_TYPE_OBJECT_ParamBuffers, id,
 | 
				
			||||||
| 
						 | 
					@ -707,7 +707,7 @@ static int clear_buffers(struct impl *this, struct port *port)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	if (port->n_buffers > 0) {
 | 
						if (port->n_buffers > 0) {
 | 
				
			||||||
		spa_log_debug(this->log, NAME " %p: clear buffers", this);
 | 
							spa_log_debug(this->log, NAME " %p: clear buffers", this);
 | 
				
			||||||
		spa_vulkan_use_buffers(&this->state, &this->state.streams[0], 0, &port->current_format.info.dsp, 0, NULL);
 | 
							spa_vulkan_compute_use_buffers(&this->state, &this->state.streams[0], 0, &port->current_format.info.dsp, 0, NULL);
 | 
				
			||||||
		port->n_buffers = 0;
 | 
							port->n_buffers = 0;
 | 
				
			||||||
		spa_list_init(&port->empty);
 | 
							spa_list_init(&port->empty);
 | 
				
			||||||
		spa_list_init(&port->ready);
 | 
							spa_list_init(&port->ready);
 | 
				
			||||||
| 
						 | 
					@ -726,7 +726,7 @@ static int port_set_format(struct impl *this, struct port *port,
 | 
				
			||||||
	if (format == NULL) {
 | 
						if (format == NULL) {
 | 
				
			||||||
		port->have_format = false;
 | 
							port->have_format = false;
 | 
				
			||||||
		clear_buffers(this, port);
 | 
							clear_buffers(this, port);
 | 
				
			||||||
		spa_vulkan_unprepare(&this->state);
 | 
							spa_vulkan_compute_unprepare(&this->state);
 | 
				
			||||||
	} else {
 | 
						} else {
 | 
				
			||||||
		struct spa_video_info info = { 0 };
 | 
							struct spa_video_info info = { 0 };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -763,7 +763,7 @@ static int port_set_format(struct impl *this, struct port *port,
 | 
				
			||||||
			modifiers++;
 | 
								modifiers++;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			uint64_t fixed_modifier;
 | 
								uint64_t fixed_modifier;
 | 
				
			||||||
			if (spa_vulkan_fixate_modifier(&this->state, &this->state.streams[0], &info.info.dsp, modifierCount, modifiers, &fixed_modifier) != 0)
 | 
								if (spa_vulkan_compute_fixate_modifier(&this->state, &this->state.streams[0], &info.info.dsp, modifierCount, modifiers, &fixed_modifier) != 0)
 | 
				
			||||||
				return -EINVAL;
 | 
									return -EINVAL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			spa_log_info(this->log, NAME ": modifier fixated %"PRIu64, fixed_modifier);
 | 
								spa_log_info(this->log, NAME ": modifier fixated %"PRIu64, fixed_modifier);
 | 
				
			||||||
| 
						 | 
					@ -782,7 +782,7 @@ static int port_set_format(struct impl *this, struct port *port,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		port->current_format = info;
 | 
							port->current_format = info;
 | 
				
			||||||
		port->have_format = true;
 | 
							port->have_format = true;
 | 
				
			||||||
		spa_vulkan_prepare(&this->state);
 | 
							spa_vulkan_compute_prepare(&this->state);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (modifier_fixed) {
 | 
							if (modifier_fixed) {
 | 
				
			||||||
			port->info.change_mask |= SPA_PORT_CHANGE_MASK_PARAMS;
 | 
								port->info.change_mask |= SPA_PORT_CHANGE_MASK_PARAMS;
 | 
				
			||||||
| 
						 | 
					@ -864,7 +864,7 @@ impl_node_port_use_buffers(void *object,
 | 
				
			||||||
		spa_log_info(this->log, "%p: %d:%d add buffer %p", port, direction, port_id, b);
 | 
							spa_log_info(this->log, "%p: %d:%d add buffer %p", port, direction, port_id, b);
 | 
				
			||||||
		spa_list_append(&port->empty, &b->link);
 | 
							spa_list_append(&port->empty, &b->link);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	spa_vulkan_use_buffers(&this->state, &this->state.streams[0], flags, &port->current_format.info.dsp, n_buffers, buffers);
 | 
						spa_vulkan_compute_use_buffers(&this->state, &this->state.streams[0], flags, &port->current_format.info.dsp, n_buffers, buffers);
 | 
				
			||||||
	port->n_buffers = n_buffers;
 | 
						port->n_buffers = n_buffers;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return 0;
 | 
						return 0;
 | 
				
			||||||
| 
						 | 
					@ -985,7 +985,7 @@ static int impl_clear(struct spa_handle *handle)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	this = (struct impl *) handle;
 | 
						this = (struct impl *) handle;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	spa_vulkan_deinit(&this->state);
 | 
						spa_vulkan_compute_deinit(&this->state);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (this->data_loop)
 | 
						if (this->data_loop)
 | 
				
			||||||
		spa_loop_invoke(this->data_loop, do_remove_timer, 0, NULL, 0, true, this);
 | 
							spa_loop_invoke(this->data_loop, do_remove_timer, 0, NULL, 0, true, this);
 | 
				
			||||||
| 
						 | 
					@ -1075,11 +1075,11 @@ impl_init(const struct spa_handle_factory *factory,
 | 
				
			||||||
	spa_list_init(&port->ready);
 | 
						spa_list_init(&port->ready);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	this->state.log = this->log;
 | 
						this->state.log = this->log;
 | 
				
			||||||
	spa_vulkan_init_stream(&this->state, &this->state.streams[0],
 | 
						spa_vulkan_compute_init_stream(&this->state, &this->state.streams[0],
 | 
				
			||||||
			SPA_DIRECTION_OUTPUT, NULL);
 | 
								SPA_DIRECTION_OUTPUT, NULL);
 | 
				
			||||||
	this->state.shaderName = "spa/plugins/vulkan/shaders/main.spv";
 | 
						this->state.shaderName = "spa/plugins/vulkan/shaders/main.spv";
 | 
				
			||||||
	this->state.n_streams = 1;
 | 
						this->state.n_streams = 1;
 | 
				
			||||||
	spa_vulkan_init(&this->state);
 | 
						spa_vulkan_compute_init(&this->state);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return 0;
 | 
						return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -460,7 +460,7 @@ static void clear_streams(struct vulkan_compute_state *s)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int spa_vulkan_fixate_modifier(struct vulkan_compute_state *s, struct vulkan_stream *p, struct spa_video_info_dsp *dsp_info,
 | 
					int spa_vulkan_compute_fixate_modifier(struct vulkan_compute_state *s, struct vulkan_stream *p, struct spa_video_info_dsp *dsp_info,
 | 
				
			||||||
		uint32_t modifierCount, uint64_t *modifiers, uint64_t *modifier)
 | 
							uint32_t modifierCount, uint64_t *modifiers, uint64_t *modifier)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	VkFormat format = vulkan_id_to_vkformat(dsp_info->format);
 | 
						VkFormat format = vulkan_id_to_vkformat(dsp_info->format);
 | 
				
			||||||
| 
						 | 
					@ -479,7 +479,7 @@ int spa_vulkan_fixate_modifier(struct vulkan_compute_state *s, struct vulkan_str
 | 
				
			||||||
	return vulkan_fixate_modifier(&s->base, &fixation_info, modifier);
 | 
						return vulkan_fixate_modifier(&s->base, &fixation_info, modifier);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int spa_vulkan_use_buffers(struct vulkan_compute_state *s, struct vulkan_stream *p, uint32_t flags,
 | 
					int spa_vulkan_compute_use_buffers(struct vulkan_compute_state *s, struct vulkan_stream *p, uint32_t flags,
 | 
				
			||||||
		struct spa_video_info_dsp *dsp_info, uint32_t n_buffers, struct spa_buffer **buffers)
 | 
							struct spa_video_info_dsp *dsp_info, uint32_t n_buffers, struct spa_buffer **buffers)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	VkFormat format = vulkan_id_to_vkformat(dsp_info->format);
 | 
						VkFormat format = vulkan_id_to_vkformat(dsp_info->format);
 | 
				
			||||||
| 
						 | 
					@ -553,13 +553,13 @@ int spa_vulkan_use_buffers(struct vulkan_compute_state *s, struct vulkan_stream
 | 
				
			||||||
	return 0;
 | 
						return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int spa_vulkan_init_stream(struct vulkan_compute_state *s, struct vulkan_stream *stream,
 | 
					int spa_vulkan_compute_init_stream(struct vulkan_compute_state *s, struct vulkan_stream *stream,
 | 
				
			||||||
		enum spa_direction direction, struct spa_dict *props)
 | 
							enum spa_direction direction, struct spa_dict *props)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	return vulkan_stream_init(stream, direction, props);
 | 
						return vulkan_stream_init(stream, direction, props);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int spa_vulkan_prepare(struct vulkan_compute_state *s)
 | 
					int spa_vulkan_compute_prepare(struct vulkan_compute_state *s)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	if (!s->prepared) {
 | 
						if (!s->prepared) {
 | 
				
			||||||
		CHECK(createFence(s));
 | 
							CHECK(createFence(s));
 | 
				
			||||||
| 
						 | 
					@ -571,7 +571,7 @@ int spa_vulkan_prepare(struct vulkan_compute_state *s)
 | 
				
			||||||
	return 0;
 | 
						return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int spa_vulkan_unprepare(struct vulkan_compute_state *s)
 | 
					int spa_vulkan_compute_unprepare(struct vulkan_compute_state *s)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	if (s->prepared) {
 | 
						if (s->prepared) {
 | 
				
			||||||
		vkDestroyShaderModule(s->base.device, s->computeShaderModule, NULL);
 | 
							vkDestroyShaderModule(s->base.device, s->computeShaderModule, NULL);
 | 
				
			||||||
| 
						 | 
					@ -587,7 +587,7 @@ int spa_vulkan_unprepare(struct vulkan_compute_state *s)
 | 
				
			||||||
	return 0;
 | 
						return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int spa_vulkan_start(struct vulkan_compute_state *s)
 | 
					int spa_vulkan_compute_start(struct vulkan_compute_state *s)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	uint32_t i;
 | 
						uint32_t i;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -600,7 +600,7 @@ int spa_vulkan_start(struct vulkan_compute_state *s)
 | 
				
			||||||
	return 0;
 | 
						return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int spa_vulkan_stop(struct vulkan_compute_state *s)
 | 
					int spa_vulkan_compute_stop(struct vulkan_compute_state *s)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
        VK_CHECK_RESULT(vkDeviceWaitIdle(s->base.device));
 | 
					        VK_CHECK_RESULT(vkDeviceWaitIdle(s->base.device));
 | 
				
			||||||
	clear_streams(s);
 | 
						clear_streams(s);
 | 
				
			||||||
| 
						 | 
					@ -608,7 +608,7 @@ int spa_vulkan_stop(struct vulkan_compute_state *s)
 | 
				
			||||||
	return 0;
 | 
						return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int spa_vulkan_ready(struct vulkan_compute_state *s)
 | 
					int spa_vulkan_compute_ready(struct vulkan_compute_state *s)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	uint32_t i;
 | 
						uint32_t i;
 | 
				
			||||||
	VkResult result;
 | 
						VkResult result;
 | 
				
			||||||
| 
						 | 
					@ -631,7 +631,7 @@ int spa_vulkan_ready(struct vulkan_compute_state *s)
 | 
				
			||||||
	return 0;
 | 
						return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int spa_vulkan_process(struct vulkan_compute_state *s)
 | 
					int spa_vulkan_compute_process(struct vulkan_compute_state *s)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	CHECK(updateDescriptors(s));
 | 
						CHECK(updateDescriptors(s));
 | 
				
			||||||
	CHECK(runCommandBuffer(s));
 | 
						CHECK(runCommandBuffer(s));
 | 
				
			||||||
| 
						 | 
					@ -641,7 +641,7 @@ int spa_vulkan_process(struct vulkan_compute_state *s)
 | 
				
			||||||
	return 0;
 | 
						return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int spa_vulkan_get_buffer_caps(struct vulkan_compute_state *s, enum spa_direction direction)
 | 
					int spa_vulkan_compute_get_buffer_caps(struct vulkan_compute_state *s, enum spa_direction direction)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	switch (direction) {
 | 
						switch (direction) {
 | 
				
			||||||
	case SPA_DIRECTION_INPUT:
 | 
						case SPA_DIRECTION_INPUT:
 | 
				
			||||||
| 
						 | 
					@ -652,12 +652,12 @@ 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) {
 | 
					struct vulkan_modifier_info *spa_vulkan_compute_get_modifier_info(struct vulkan_compute_state *s, struct spa_video_info_dsp *info) {
 | 
				
			||||||
	VkFormat vk_format = vulkan_id_to_vkformat(info->format);
 | 
						VkFormat vk_format = vulkan_id_to_vkformat(info->format);
 | 
				
			||||||
	return vulkan_modifierInfo_find(&s->base, vk_format, info->modifier);
 | 
						return vulkan_modifierInfo_find(&s->base, vk_format, info->modifier);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int spa_vulkan_init(struct vulkan_compute_state *s)
 | 
					int spa_vulkan_compute_init(struct vulkan_compute_state *s)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	s->base.log = s->log;
 | 
						s->base.log = s->log;
 | 
				
			||||||
	uint32_t dsp_format = SPA_VIDEO_FORMAT_DSP_F32;
 | 
						uint32_t dsp_format = SPA_VIDEO_FORMAT_DSP_F32;
 | 
				
			||||||
| 
						 | 
					@ -669,7 +669,7 @@ int spa_vulkan_init(struct vulkan_compute_state *s)
 | 
				
			||||||
	return vulkan_base_init(&s->base, &baseInfo);
 | 
						return vulkan_base_init(&s->base, &baseInfo);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void spa_vulkan_deinit(struct vulkan_compute_state *s)
 | 
					void spa_vulkan_compute_deinit(struct vulkan_compute_state *s)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	vulkan_base_deinit(&s->base);
 | 
						vulkan_base_deinit(&s->base);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -56,25 +56,25 @@ struct vulkan_compute_state {
 | 
				
			||||||
	struct vulkan_stream streams[MAX_STREAMS];
 | 
						struct vulkan_stream streams[MAX_STREAMS];
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int spa_vulkan_init_stream(struct vulkan_compute_state *s, struct vulkan_stream *stream, enum spa_direction,
 | 
					int spa_vulkan_compute_init_stream(struct vulkan_compute_state *s, struct vulkan_stream *stream, enum spa_direction,
 | 
				
			||||||
		struct spa_dict *props);
 | 
							struct spa_dict *props);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int spa_vulkan_fixate_modifier(struct vulkan_compute_state *s, struct vulkan_stream *p, struct spa_video_info_dsp *dsp_info,
 | 
					int spa_vulkan_compute_fixate_modifier(struct vulkan_compute_state *s, struct vulkan_stream *p, struct spa_video_info_dsp *dsp_info,
 | 
				
			||||||
		uint32_t modifierCount, uint64_t *modifiers, uint64_t *modifier);
 | 
							uint32_t modifierCount, uint64_t *modifiers, uint64_t *modifier);
 | 
				
			||||||
int spa_vulkan_prepare(struct vulkan_compute_state *s);
 | 
					int spa_vulkan_compute_prepare(struct vulkan_compute_state *s);
 | 
				
			||||||
int spa_vulkan_use_buffers(struct vulkan_compute_state *s, struct vulkan_stream *stream, uint32_t flags,
 | 
					int spa_vulkan_compute_use_buffers(struct vulkan_compute_state *s, struct vulkan_stream *stream, uint32_t flags,
 | 
				
			||||||
		struct spa_video_info_dsp *dsp_info, uint32_t n_buffers, struct spa_buffer **buffers);
 | 
							struct spa_video_info_dsp *dsp_info, uint32_t n_buffers, struct spa_buffer **buffers);
 | 
				
			||||||
int spa_vulkan_unprepare(struct vulkan_compute_state *s);
 | 
					int spa_vulkan_compute_unprepare(struct vulkan_compute_state *s);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int spa_vulkan_start(struct vulkan_compute_state *s);
 | 
					int spa_vulkan_compute_start(struct vulkan_compute_state *s);
 | 
				
			||||||
int spa_vulkan_stop(struct vulkan_compute_state *s);
 | 
					int spa_vulkan_compute_stop(struct vulkan_compute_state *s);
 | 
				
			||||||
int spa_vulkan_ready(struct vulkan_compute_state *s);
 | 
					int spa_vulkan_compute_ready(struct vulkan_compute_state *s);
 | 
				
			||||||
int spa_vulkan_process(struct vulkan_compute_state *s);
 | 
					int spa_vulkan_compute_process(struct vulkan_compute_state *s);
 | 
				
			||||||
int spa_vulkan_cleanup(struct vulkan_compute_state *s);
 | 
					int spa_vulkan_compute_cleanup(struct vulkan_compute_state *s);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int spa_vulkan_get_buffer_caps(struct vulkan_compute_state *s, enum spa_direction direction);
 | 
					int spa_vulkan_compute_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 vulkan_modifier_info *spa_vulkan_compute_get_modifier_info(struct vulkan_compute_state *s,
 | 
				
			||||||
		struct spa_video_info_dsp *dsp_info);
 | 
							struct spa_video_info_dsp *dsp_info);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int spa_vulkan_init(struct vulkan_compute_state *s);
 | 
					int spa_vulkan_compute_init(struct vulkan_compute_state *s);
 | 
				
			||||||
void spa_vulkan_deinit(struct vulkan_compute_state *s);
 | 
					void spa_vulkan_compute_deinit(struct vulkan_compute_state *s);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue