mirror of
https://github.com/raspberrypi/linux.git
synced 2025-12-07 18:40:10 +00:00
staging/mmal-vchiq: Add module parameter to enable logging.
Adds a module parameter "debug" to enable various logging levels. Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
This commit is contained in:
committed by
Dom Cobley
parent
7560b9a3a2
commit
eb338e09ca
@@ -34,6 +34,16 @@
|
|||||||
|
|
||||||
#include "../vc-sm-cma/vc_sm_knl.h"
|
#include "../vc-sm-cma/vc_sm_knl.h"
|
||||||
|
|
||||||
|
#define pr_dbg_lvl(__level, __debug, __fmt, __arg...) \
|
||||||
|
do { \
|
||||||
|
if (__debug >= (__level)) \
|
||||||
|
printk(KERN_DEBUG __fmt, ##__arg); \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
static unsigned int debug;
|
||||||
|
module_param(debug, uint, 0644);
|
||||||
|
MODULE_PARM_DESC(debug, "activates debug info (0-3)");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* maximum number of components supported.
|
* maximum number of components supported.
|
||||||
* This matches the maximum permitted by default on the VPU
|
* This matches the maximum permitted by default on the VPU
|
||||||
@@ -381,7 +391,8 @@ buffer_from_host(struct vchiq_mmal_instance *instance,
|
|||||||
if (!port->enabled)
|
if (!port->enabled)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
pr_debug("instance:%u buffer:%p\n", instance->service_handle, buf);
|
pr_dbg_lvl(3, debug, "instance:%u buffer:%p\n",
|
||||||
|
instance->service_handle, buf);
|
||||||
|
|
||||||
/* get context */
|
/* get context */
|
||||||
if (!buf->msg_context) {
|
if (!buf->msg_context) {
|
||||||
@@ -549,7 +560,7 @@ static void event_to_host_cb(struct vchiq_mmal_instance *instance,
|
|||||||
msg_context->u.bulk.pts = MMAL_TIME_UNKNOWN;
|
msg_context->u.bulk.pts = MMAL_TIME_UNKNOWN;
|
||||||
msg_context->u.bulk.cmd = msg->u.event_to_host.cmd;
|
msg_context->u.bulk.cmd = msg->u.event_to_host.cmd;
|
||||||
|
|
||||||
pr_debug("event component:%u port type:%d num:%d cmd:0x%x length:%d\n",
|
pr_dbg_lvl(3, debug, "event component:%u port type:%d num:%d cmd:0x%x length:%d\n",
|
||||||
msg->u.event_to_host.client_component,
|
msg->u.event_to_host.client_component,
|
||||||
msg->u.event_to_host.port_type,
|
msg->u.event_to_host.port_type,
|
||||||
msg->u.event_to_host.port_num,
|
msg->u.event_to_host.port_num,
|
||||||
@@ -566,7 +577,7 @@ static void buffer_to_host_cb(struct vchiq_mmal_instance *instance,
|
|||||||
struct mmal_msg_context *msg_context;
|
struct mmal_msg_context *msg_context;
|
||||||
u32 handle;
|
u32 handle;
|
||||||
|
|
||||||
pr_debug("%s: instance:%p msg:%p msg_len:%d\n",
|
pr_dbg_lvl(3, debug, "%s: instance:%p msg:%p msg_len:%d\n",
|
||||||
__func__, instance, msg, msg_len);
|
__func__, instance, msg, msg_len);
|
||||||
|
|
||||||
if (msg->u.buffer_from_host.drvbuf.magic == MMAL_MAGIC) {
|
if (msg->u.buffer_from_host.drvbuf.magic == MMAL_MAGIC) {
|
||||||
@@ -838,39 +849,42 @@ static int send_synchronous_mmal_msg(struct vchiq_mmal_instance *instance,
|
|||||||
|
|
||||||
static void dump_port_info(struct vchiq_mmal_port *port)
|
static void dump_port_info(struct vchiq_mmal_port *port)
|
||||||
{
|
{
|
||||||
pr_debug("port handle:0x%x enabled:%d\n", port->handle, port->enabled);
|
pr_dbg_lvl(3, debug, "port handle:0x%x enabled:%d\n", port->handle,
|
||||||
|
port->enabled);
|
||||||
|
|
||||||
pr_debug("buffer minimum num:%d size:%d align:%d\n",
|
pr_dbg_lvl(3, debug, "buffer minimum num:%d size:%d align:%d\n",
|
||||||
port->minimum_buffer.num,
|
port->minimum_buffer.num,
|
||||||
port->minimum_buffer.size, port->minimum_buffer.alignment);
|
port->minimum_buffer.size, port->minimum_buffer.alignment);
|
||||||
|
|
||||||
pr_debug("buffer recommended num:%d size:%d align:%d\n",
|
pr_dbg_lvl(3, debug, "buffer recommended num:%d size:%d align:%d\n",
|
||||||
port->recommended_buffer.num,
|
port->recommended_buffer.num,
|
||||||
port->recommended_buffer.size,
|
port->recommended_buffer.size,
|
||||||
port->recommended_buffer.alignment);
|
port->recommended_buffer.alignment);
|
||||||
|
|
||||||
pr_debug("buffer current values num:%d size:%d align:%d\n",
|
pr_dbg_lvl(3, debug, "buffer current values num:%d size:%d align:%d\n",
|
||||||
port->current_buffer.num,
|
port->current_buffer.num,
|
||||||
port->current_buffer.size, port->current_buffer.alignment);
|
port->current_buffer.size, port->current_buffer.alignment);
|
||||||
|
|
||||||
pr_debug("elementary stream: type:%d encoding:0x%x variant:0x%x\n",
|
pr_dbg_lvl(3, debug, "elementary stream: type:%d encoding:0x%x variant:0x%x\n",
|
||||||
port->format.type,
|
port->format.type,
|
||||||
port->format.encoding, port->format.encoding_variant);
|
port->format.encoding, port->format.encoding_variant);
|
||||||
|
|
||||||
pr_debug(" bitrate:%d flags:0x%x\n",
|
pr_dbg_lvl(3, debug, " bitrate:%d flags:0x%x\n",
|
||||||
port->format.bitrate, port->format.flags);
|
port->format.bitrate, port->format.flags);
|
||||||
|
|
||||||
if (port->format.type == MMAL_ES_TYPE_VIDEO) {
|
if (port->format.type == MMAL_ES_TYPE_VIDEO) {
|
||||||
pr_debug
|
pr_dbg_lvl(3, debug,
|
||||||
("es video format: width:%d height:%d colourspace:0x%x\n",
|
"es video format: width:%d height:%d colourspace:0x%x\n",
|
||||||
port->es.video.width, port->es.video.height,
|
port->es.video.width, port->es.video.height,
|
||||||
port->es.video.color_space);
|
port->es.video.color_space);
|
||||||
|
|
||||||
pr_debug(" : crop xywh %d,%d,%d,%d\n",
|
pr_dbg_lvl(3, debug,
|
||||||
|
" : crop xywh %d,%d,%d,%d\n",
|
||||||
port->es.video.crop.x,
|
port->es.video.crop.x,
|
||||||
port->es.video.crop.y,
|
port->es.video.crop.y,
|
||||||
port->es.video.crop.width, port->es.video.crop.height);
|
port->es.video.crop.width, port->es.video.crop.height);
|
||||||
pr_debug(" : framerate %d/%d aspect %d/%d\n",
|
pr_dbg_lvl(3, debug,
|
||||||
|
" : framerate %d/%d aspect %d/%d\n",
|
||||||
port->es.video.frame_rate.numerator,
|
port->es.video.frame_rate.numerator,
|
||||||
port->es.video.frame_rate.denominator,
|
port->es.video.frame_rate.denominator,
|
||||||
port->es.video.par.numerator, port->es.video.par.denominator);
|
port->es.video.par.numerator, port->es.video.par.denominator);
|
||||||
@@ -904,7 +918,7 @@ static int port_info_set(struct vchiq_mmal_instance *instance,
|
|||||||
struct mmal_msg *rmsg;
|
struct mmal_msg *rmsg;
|
||||||
struct vchiq_header *rmsg_handle;
|
struct vchiq_header *rmsg_handle;
|
||||||
|
|
||||||
pr_debug("setting port info port %p\n", port);
|
pr_dbg_lvl(1, debug, "setting port info port %p\n", port);
|
||||||
if (!port)
|
if (!port)
|
||||||
return -1;
|
return -1;
|
||||||
dump_port_info(port);
|
dump_port_info(port);
|
||||||
@@ -947,8 +961,8 @@ static int port_info_set(struct vchiq_mmal_instance *instance,
|
|||||||
/* return operation status */
|
/* return operation status */
|
||||||
ret = -rmsg->u.port_info_get_reply.status;
|
ret = -rmsg->u.port_info_get_reply.status;
|
||||||
|
|
||||||
pr_debug("%s:result:%d component:0x%x port:%d\n", __func__, ret,
|
pr_dbg_lvl(1, debug, "%s:result:%d component:0x%x port:%d\n", __func__,
|
||||||
port->component->handle, port->handle);
|
ret, port->component->handle, port->handle);
|
||||||
|
|
||||||
release_msg:
|
release_msg:
|
||||||
vchiq_release_message(instance->vchiq_instance, instance->service_handle, rmsg_handle);
|
vchiq_release_message(instance->vchiq_instance, instance->service_handle, rmsg_handle);
|
||||||
@@ -1038,12 +1052,12 @@ static int port_info_get(struct vchiq_mmal_instance *instance,
|
|||||||
rmsg->u.port_info_get_reply.extradata,
|
rmsg->u.port_info_get_reply.extradata,
|
||||||
port->format.extradata_size);
|
port->format.extradata_size);
|
||||||
|
|
||||||
pr_debug("received port info\n");
|
pr_dbg_lvl(1, debug, "received port info\n");
|
||||||
dump_port_info(port);
|
dump_port_info(port);
|
||||||
|
|
||||||
release_msg:
|
release_msg:
|
||||||
|
|
||||||
pr_debug("%s:result:%d component:0x%x port:%d\n",
|
pr_dbg_lvl(1, debug, "%s:result:%d component:0x%x port:%d\n",
|
||||||
__func__, ret, port->component->handle, port->handle);
|
__func__, ret, port->component->handle, port->handle);
|
||||||
|
|
||||||
vchiq_release_message(instance->vchiq_instance, instance->service_handle, rmsg_handle);
|
vchiq_release_message(instance->vchiq_instance, instance->service_handle, rmsg_handle);
|
||||||
@@ -1090,7 +1104,7 @@ static int create_component(struct vchiq_mmal_instance *instance,
|
|||||||
component->outputs = rmsg->u.component_create_reply.output_num;
|
component->outputs = rmsg->u.component_create_reply.output_num;
|
||||||
component->clocks = rmsg->u.component_create_reply.clock_num;
|
component->clocks = rmsg->u.component_create_reply.clock_num;
|
||||||
|
|
||||||
pr_debug("Component handle:0x%x in:%d out:%d clock:%d\n",
|
pr_dbg_lvl(2, debug, "Component handle:0x%x in:%d out:%d clock:%d\n",
|
||||||
component->handle,
|
component->handle,
|
||||||
component->inputs, component->outputs, component->clocks);
|
component->inputs, component->outputs, component->clocks);
|
||||||
|
|
||||||
@@ -1261,9 +1275,8 @@ static int port_action_port(struct vchiq_mmal_instance *instance,
|
|||||||
|
|
||||||
ret = -rmsg->u.port_action_reply.status;
|
ret = -rmsg->u.port_action_reply.status;
|
||||||
|
|
||||||
pr_debug("%s:result:%d component:0x%x port:%d action:%s(%d)\n",
|
pr_dbg_lvl(2, debug, "%s:result:%d component:0x%x port:%d action:%s(%d)\n",
|
||||||
__func__,
|
__func__, ret, port->component->handle, port->handle,
|
||||||
ret, port->component->handle, port->handle,
|
|
||||||
port_action_type_names[action_type], action_type);
|
port_action_type_names[action_type], action_type);
|
||||||
|
|
||||||
release_msg:
|
release_msg:
|
||||||
@@ -1308,9 +1321,9 @@ static int port_action_handle(struct vchiq_mmal_instance *instance,
|
|||||||
|
|
||||||
ret = -rmsg->u.port_action_reply.status;
|
ret = -rmsg->u.port_action_reply.status;
|
||||||
|
|
||||||
pr_debug("%s:result:%d component:0x%x port:%d action:%s(%d) connect component:0x%x connect port:%d\n",
|
pr_dbg_lvl(2, debug,
|
||||||
__func__,
|
"%s:result:%d component:0x%x port:%d action:%s(%d) connect component:0x%x connect port:%d\n",
|
||||||
ret, port->component->handle, port->handle,
|
__func__, ret, port->component->handle, port->handle,
|
||||||
port_action_type_names[action_type],
|
port_action_type_names[action_type],
|
||||||
action_type, connect_component_handle, connect_port_handle);
|
action_type, connect_component_handle, connect_port_handle);
|
||||||
|
|
||||||
@@ -1351,9 +1364,9 @@ static int port_parameter_set(struct vchiq_mmal_instance *instance,
|
|||||||
|
|
||||||
ret = -rmsg->u.port_parameter_set_reply.status;
|
ret = -rmsg->u.port_parameter_set_reply.status;
|
||||||
|
|
||||||
pr_debug("%s:result:%d component:0x%x port:%d parameter:%d\n",
|
pr_dbg_lvl(1, debug, "%s:result:%d component:0x%x port:%d parameter:%d\n",
|
||||||
__func__,
|
__func__, ret, port->component->handle, port->handle,
|
||||||
ret, port->component->handle, port->handle, parameter_id);
|
parameter_id);
|
||||||
|
|
||||||
release_msg:
|
release_msg:
|
||||||
vchiq_release_message(instance->vchiq_instance, instance->service_handle, rmsg_handle);
|
vchiq_release_message(instance->vchiq_instance, instance->service_handle, rmsg_handle);
|
||||||
@@ -1411,8 +1424,9 @@ static int port_parameter_get(struct vchiq_mmal_instance *instance,
|
|||||||
/* Always report the size of the returned parameter to the caller */
|
/* Always report the size of the returned parameter to the caller */
|
||||||
*value_size = rmsg->u.port_parameter_get_reply.size;
|
*value_size = rmsg->u.port_parameter_get_reply.size;
|
||||||
|
|
||||||
pr_debug("%s:result:%d component:0x%x port:%d parameter:%d\n", __func__,
|
pr_dbg_lvl(1, debug, "%s:result:%d component:0x%x port:%d parameter:%d\n",
|
||||||
ret, port->component->handle, port->handle, parameter_id);
|
__func__, ret, port->component->handle, port->handle,
|
||||||
|
parameter_id);
|
||||||
|
|
||||||
release_msg:
|
release_msg:
|
||||||
vchiq_release_message(instance->vchiq_instance, instance->service_handle, rmsg_handle);
|
vchiq_release_message(instance->vchiq_instance, instance->service_handle, rmsg_handle);
|
||||||
@@ -1669,7 +1683,7 @@ int vchiq_mmal_port_connect_tunnel(struct vchiq_mmal_instance *instance,
|
|||||||
if (!dst) {
|
if (!dst) {
|
||||||
/* do not make new connection */
|
/* do not make new connection */
|
||||||
ret = 0;
|
ret = 0;
|
||||||
pr_debug("not making new connection\n");
|
pr_dbg_lvl(3, debug, "not making new connection\n");
|
||||||
goto release_unlock;
|
goto release_unlock;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1687,14 +1701,14 @@ int vchiq_mmal_port_connect_tunnel(struct vchiq_mmal_instance *instance,
|
|||||||
/* set new format */
|
/* set new format */
|
||||||
ret = port_info_set(instance, dst);
|
ret = port_info_set(instance, dst);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
pr_debug("setting port info failed\n");
|
pr_dbg_lvl(1, debug, "setting port info failed\n");
|
||||||
goto release_unlock;
|
goto release_unlock;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* read what has actually been set */
|
/* read what has actually been set */
|
||||||
ret = port_info_get(instance, dst);
|
ret = port_info_get(instance, dst);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
pr_debug("read back port info failed\n");
|
pr_dbg_lvl(1, debug, "read back port info failed\n");
|
||||||
goto release_unlock;
|
goto release_unlock;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1703,7 +1717,7 @@ int vchiq_mmal_port_connect_tunnel(struct vchiq_mmal_instance *instance,
|
|||||||
MMAL_MSG_PORT_ACTION_TYPE_CONNECT,
|
MMAL_MSG_PORT_ACTION_TYPE_CONNECT,
|
||||||
dst->component->handle, dst->handle);
|
dst->component->handle, dst->handle);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
pr_debug("connecting port %d:%d to %d:%d failed\n",
|
pr_dbg_lvl(2, debug, "connecting port %d:%d to %d:%d failed\n",
|
||||||
src->component->handle, src->handle,
|
src->component->handle, src->handle,
|
||||||
dst->component->handle, dst->handle);
|
dst->component->handle, dst->handle);
|
||||||
goto release_unlock;
|
goto release_unlock;
|
||||||
@@ -1730,7 +1744,8 @@ int vchiq_mmal_submit_buffer(struct vchiq_mmal_instance *instance,
|
|||||||
* videobuf2 won't let us have the dmabuf there.
|
* videobuf2 won't let us have the dmabuf there.
|
||||||
*/
|
*/
|
||||||
if (port->zero_copy && buffer->dma_buf && !buffer->vcsm_handle) {
|
if (port->zero_copy && buffer->dma_buf && !buffer->vcsm_handle) {
|
||||||
pr_debug("%s: import dmabuf %p\n", __func__, buffer->dma_buf);
|
pr_dbg_lvl(2, debug, "%s: import dmabuf %p\n",
|
||||||
|
__func__, buffer->dma_buf);
|
||||||
ret = vc_sm_cma_import_dmabuf(buffer->dma_buf,
|
ret = vc_sm_cma_import_dmabuf(buffer->dma_buf,
|
||||||
&buffer->vcsm_handle);
|
&buffer->vcsm_handle);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
@@ -1746,7 +1761,7 @@ int vchiq_mmal_submit_buffer(struct vchiq_mmal_instance *instance,
|
|||||||
vc_sm_cma_free(buffer->vcsm_handle);
|
vc_sm_cma_free(buffer->vcsm_handle);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
pr_debug("%s: import dmabuf %p - got vc handle %08X\n",
|
pr_dbg_lvl(2, debug, "%s: import dmabuf %p - got vc handle %08X\n",
|
||||||
__func__, buffer->dma_buf, buffer->vc_handle);
|
__func__, buffer->dma_buf, buffer->vc_handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1786,7 +1801,7 @@ int mmal_vchi_buffer_cleanup(struct mmal_buffer *buf)
|
|||||||
if (buf->vcsm_handle) {
|
if (buf->vcsm_handle) {
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
pr_debug("%s: vc_sm_cma_free on handle %p\n", __func__,
|
pr_dbg_lvl(2, debug, "%s: vc_sm_cma_free on handle %p\n", __func__,
|
||||||
buf->vcsm_handle);
|
buf->vcsm_handle);
|
||||||
ret = vc_sm_cma_free(buf->vcsm_handle);
|
ret = vc_sm_cma_free(buf->vcsm_handle);
|
||||||
if (ret)
|
if (ret)
|
||||||
|
|||||||
Reference in New Issue
Block a user