Skip to content

Commit

Permalink
Debug for context and component mappings
Browse files Browse the repository at this point in the history
  • Loading branch information
6by9 committed Oct 25, 2019
1 parent 3ce3079 commit 605fe8e
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 0 deletions.
2 changes: 2 additions & 0 deletions interface/mmal/vc/mmal_vc_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -816,6 +816,8 @@ static MMAL_STATUS_T mmal_vc_component_destroy(MMAL_COMPONENT_T *component)
mmal_vc_release_client_component(component);
mmal_vc_shm_exit();
mmal_vc_deinit();
mmal_vc_dump_client_components();
mmal_vc_dump_client_contexts();
return status;
}

Expand Down
36 changes: 36 additions & 0 deletions interface/mmal/vc/mmal_vc_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,24 @@ void mmal_vc_release_client_component(MMAL_COMPONENT_T *component)
vcos_mutex_unlock(&client_component_pool.lock);
}

void mmal_vc_dump_client_components(void)
{
int i;
int count = 0;

vcos_mutex_lock(&client_component_pool.lock);
for (i=0; i<MAX_COMPONENT_HANDLES; i++)
{
if (client_component_pool.components[i].inuse)
{
LOG_ERROR("%s: Entry %d in use for context %p", __func__, i, client_component_pool.components[i].component);
count++;
}
}
vcos_mutex_unlock(&client_component_pool.lock);
LOG_ERROR("%s: %u entries in use", __func__, count);
}

#define MAX_CLIENT_CONTEXTS 128

typedef struct
Expand Down Expand Up @@ -220,6 +238,24 @@ void mmal_vc_release_client_context(MMAL_VC_CLIENT_BUFFER_CONTEXT_T *context)
vcos_mutex_unlock(&client_context_pool.lock);
}

void mmal_vc_dump_client_contexts(void)
{
int i;
int count = 0;

vcos_mutex_lock(&client_context_pool.lock);
for (i=0; i<MAX_CLIENT_CONTEXTS; i++)
{
if (client_context_pool.contexts[i].inuse)
{
LOG_ERROR("%s: Entry %d in use for context %p", __func__, i, client_context_pool.contexts[i].ctx);
count++;
}
}
vcos_mutex_unlock(&client_context_pool.lock);
LOG_ERROR("%s: %u entries in use", __func__, count);
}

/* One client per process/VC connection. Multiple threads may
* be using a single client.
*/
Expand Down
2 changes: 2 additions & 0 deletions interface/mmal/vc/mmal_vc_client_priv.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,11 @@ MMAL_STATUS_T mmal_vc_send_message(MMAL_CLIENT_T *client,

uint32_t mmal_vc_allocate_client_component(MMAL_COMPONENT_T *component);
void mmal_vc_release_client_component(MMAL_COMPONENT_T *component);
void mmal_vc_dump_client_components(void);

uint32_t mmal_vc_allocate_client_context(MMAL_VC_CLIENT_BUFFER_CONTEXT_T *context);
MMAL_VC_CLIENT_BUFFER_CONTEXT_T *mmal_vc_lookup_client_context(int index);
void mmal_vc_release_client_context(MMAL_VC_CLIENT_BUFFER_CONTEXT_T *context);
void mmal_vc_dump_client_contexts(void);
#endif

0 comments on commit 605fe8e

Please sign in to comment.