vulkan: Update logging in compute plugins

Use SPA_LOG_TOPIC_DEFAULT to name the log messages
This commit is contained in:
columbarius 2024-01-30 00:41:54 +01:00 committed by Wim Taymans
parent a1615fe6a3
commit bcf3cdc159
2 changed files with 19 additions and 15 deletions

View file

@ -25,7 +25,9 @@
#include "vulkan-compute-utils.h" #include "vulkan-compute-utils.h"
#define NAME "vulkan-compute-filter" #undef SPA_LOG_TOPIC_DEFAULT
#define SPA_LOG_TOPIC_DEFAULT &log_topic
SPA_LOG_TOPIC_DEFINE_STATIC(log_topic, "spa.vulkan.compute-filter");
struct buffer { struct buffer {
uint32_t id; uint32_t id;
@ -152,7 +154,7 @@ static inline void reuse_buffer(struct impl *this, struct port *port, uint32_t i
struct buffer *b = &port->buffers[id]; struct buffer *b = &port->buffers[id];
if (SPA_FLAG_IS_SET(b->flags, BUFFER_FLAG_OUT)) { if (SPA_FLAG_IS_SET(b->flags, BUFFER_FLAG_OUT)) {
spa_log_debug(this->log, NAME " %p: reuse buffer %d", this, id); spa_log_debug(this->log, "%p: reuse buffer %d", this, id);
SPA_FLAG_CLEAR(b->flags, BUFFER_FLAG_OUT); SPA_FLAG_CLEAR(b->flags, BUFFER_FLAG_OUT);
spa_list_append(&port->empty, &b->link); spa_list_append(&port->empty, &b->link);
@ -346,7 +348,7 @@ impl_node_port_enum_params(void *object, int seq,
if (result.index > 0) if (result.index > 0)
return 0; return 0;
spa_log_debug(this->log, NAME" %p: %dx%d stride %d", this, spa_log_debug(this->log, "%p: %dx%d stride %d", this,
this->position->video.size.width, this->position->video.size.width,
this->position->video.size.height, this->position->video.size.height,
this->position->video.stride); this->position->video.stride);
@ -403,7 +405,7 @@ impl_node_port_enum_params(void *object, int seq,
static int clear_buffers(struct impl *this, struct port *port) 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, "%p: clear buffers", this);
spa_vulkan_compute_stop(&this->state); spa_vulkan_compute_stop(&this->state);
spa_vulkan_compute_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;
@ -463,7 +465,7 @@ static int port_set_format(struct impl *this, struct port *port,
if (spa_vulkan_compute_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, "modifier fixated %"PRIu64, fixed_modifier);
info.info.dsp.modifier = fixed_modifier; info.info.dsp.modifier = fixed_modifier;
info.info.dsp.flags &= ~SPA_VIDEO_FLAG_MODIFIER_FIXATION_REQUIRED; info.info.dsp.flags &= ~SPA_VIDEO_FLAG_MODIFIER_FIXATION_REQUIRED;
@ -640,7 +642,7 @@ static int impl_node_process(void *object)
} }
if (spa_list_is_empty(&outport->empty)) { if (spa_list_is_empty(&outport->empty)) {
spa_log_debug(this->log, NAME " %p: out of buffers", this); spa_log_debug(this->log, "%p: out of buffers", this);
return -EPIPE; return -EPIPE;
} }
b = &inport->buffers[inio->buffer_id]; b = &inport->buffers[inio->buffer_id];

View file

@ -26,7 +26,9 @@
#include "vulkan-compute-utils.h" #include "vulkan-compute-utils.h"
#define NAME "vulkan-compute-source" #undef SPA_LOG_TOPIC_DEFAULT
#define SPA_LOG_TOPIC_DEFAULT &log_topic
SPA_LOG_TOPIC_DEFINE_STATIC(log_topic, "spa.vulkan.compute-source");
#define FRAMES_TO_TIME(this,f) ((this->position->video.framerate.denom * (f) * SPA_NSEC_PER_SEC) / \ #define FRAMES_TO_TIME(this,f) ((this->position->video.framerate.denom * (f) * SPA_NSEC_PER_SEC) / \
(this->position->video.framerate.num)) (this->position->video.framerate.num))
@ -257,7 +259,7 @@ static int read_timer(struct impl *this)
if ((res = spa_system_timerfd_read(this->data_system, if ((res = spa_system_timerfd_read(this->data_system,
this->timer_source.fd, &expirations)) < 0) { this->timer_source.fd, &expirations)) < 0) {
if (res != -EAGAIN) if (res != -EAGAIN)
spa_log_error(this->log, NAME " %p: timerfd error: %s", spa_log_error(this->log, "%p: timerfd error: %s",
this, spa_strerror(res)); this, spa_strerror(res));
} }
} }
@ -281,7 +283,7 @@ static int make_buffer(struct impl *this)
if (spa_list_is_empty(&port->empty)) { if (spa_list_is_empty(&port->empty)) {
set_timer(this, false); set_timer(this, false);
spa_log_error(this->log, NAME " %p: out of buffers", this); spa_log_error(this->log, "%p: out of buffers", this);
return -EPIPE; return -EPIPE;
} }
b = spa_list_first(&port->empty, struct buffer, link); b = spa_list_first(&port->empty, struct buffer, link);
@ -289,7 +291,7 @@ static int make_buffer(struct impl *this)
n_bytes = b->outbuf->datas[0].maxsize; n_bytes = b->outbuf->datas[0].maxsize;
spa_log_trace(this->log, NAME " %p: dequeue buffer %d", this, b->id); spa_log_trace(this->log, "%p: dequeue buffer %d", this, b->id);
this->state.constants.time = this->elapsed_time / (float) SPA_NSEC_PER_SEC; this->state.constants.time = this->elapsed_time / (float) SPA_NSEC_PER_SEC;
this->state.constants.frame = this->frame_count; this->state.constants.frame = this->frame_count;
@ -302,7 +304,7 @@ static int make_buffer(struct impl *this)
this->state.streams[0].ready_buffer_id = SPA_ID_INVALID; this->state.streams[0].ready_buffer_id = SPA_ID_INVALID;
spa_log_trace(this->log, NAME " %p: ready buffer %d", this, b->id); spa_log_trace(this->log, "%p: ready buffer %d", this, b->id);
b->outbuf->datas[0].chunk->offset = 0; b->outbuf->datas[0].chunk->offset = 0;
b->outbuf->datas[0].chunk->size = n_bytes; b->outbuf->datas[0].chunk->size = n_bytes;
@ -331,7 +333,7 @@ static inline void reuse_buffer(struct impl *this, struct port *port, uint32_t i
struct buffer *b = &port->buffers[id]; struct buffer *b = &port->buffers[id];
if (SPA_FLAG_IS_SET(b->flags, BUFFER_FLAG_OUT)) { if (SPA_FLAG_IS_SET(b->flags, BUFFER_FLAG_OUT)) {
spa_log_trace(this->log, NAME " %p: reuse buffer %d", this, id); spa_log_trace(this->log, "%p: reuse buffer %d", this, id);
SPA_FLAG_CLEAR(b->flags, BUFFER_FLAG_OUT); SPA_FLAG_CLEAR(b->flags, BUFFER_FLAG_OUT);
spa_list_append(&port->empty, &b->link); spa_list_append(&port->empty, &b->link);
@ -580,7 +582,7 @@ impl_node_port_enum_params(void *object, int seq,
if (result.index > 0) if (result.index > 0)
return 0; return 0;
spa_log_debug(this->log, NAME" %p: %dx%d stride %d", this, spa_log_debug(this->log, "%p: %dx%d stride %d", this,
this->position->video.size.width, this->position->video.size.width,
this->position->video.size.height, this->position->video.size.height,
this->position->video.stride); this->position->video.stride);
@ -638,7 +640,7 @@ impl_node_port_enum_params(void *object, int seq,
static int clear_buffers(struct impl *this, struct port *port) 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, "%p: clear buffers", this);
spa_vulkan_compute_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);
@ -698,7 +700,7 @@ static int port_set_format(struct impl *this, struct port *port,
if (spa_vulkan_compute_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, "modifier fixated %"PRIu64, fixed_modifier);
info.info.dsp.modifier = fixed_modifier; info.info.dsp.modifier = fixed_modifier;
info.info.dsp.flags &= ~SPA_VIDEO_FLAG_MODIFIER_FIXATION_REQUIRED; info.info.dsp.flags &= ~SPA_VIDEO_FLAG_MODIFIER_FIXATION_REQUIRED;