Skip to content
This repository was archived by the owner on Aug 27, 2025. It is now read-only.

Commit 605fe8e

Browse files
committed
Debug for context and component mappings
1 parent 3ce3079 commit 605fe8e

File tree

3 files changed

+40
-0
lines changed

3 files changed

+40
-0
lines changed

interface/mmal/vc/mmal_vc_api.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -816,6 +816,8 @@ static MMAL_STATUS_T mmal_vc_component_destroy(MMAL_COMPONENT_T *component)
816816
mmal_vc_release_client_component(component);
817817
mmal_vc_shm_exit();
818818
mmal_vc_deinit();
819+
mmal_vc_dump_client_components();
820+
mmal_vc_dump_client_contexts();
819821
return status;
820822
}
821823

interface/mmal/vc/mmal_vc_client.c

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,24 @@ void mmal_vc_release_client_component(MMAL_COMPONENT_T *component)
154154
vcos_mutex_unlock(&client_component_pool.lock);
155155
}
156156

157+
void mmal_vc_dump_client_components(void)
158+
{
159+
int i;
160+
int count = 0;
161+
162+
vcos_mutex_lock(&client_component_pool.lock);
163+
for (i=0; i<MAX_COMPONENT_HANDLES; i++)
164+
{
165+
if (client_component_pool.components[i].inuse)
166+
{
167+
LOG_ERROR("%s: Entry %d in use for context %p", __func__, i, client_component_pool.components[i].component);
168+
count++;
169+
}
170+
}
171+
vcos_mutex_unlock(&client_component_pool.lock);
172+
LOG_ERROR("%s: %u entries in use", __func__, count);
173+
}
174+
157175
#define MAX_CLIENT_CONTEXTS 128
158176

159177
typedef struct
@@ -220,6 +238,24 @@ void mmal_vc_release_client_context(MMAL_VC_CLIENT_BUFFER_CONTEXT_T *context)
220238
vcos_mutex_unlock(&client_context_pool.lock);
221239
}
222240

241+
void mmal_vc_dump_client_contexts(void)
242+
{
243+
int i;
244+
int count = 0;
245+
246+
vcos_mutex_lock(&client_context_pool.lock);
247+
for (i=0; i<MAX_CLIENT_CONTEXTS; i++)
248+
{
249+
if (client_context_pool.contexts[i].inuse)
250+
{
251+
LOG_ERROR("%s: Entry %d in use for context %p", __func__, i, client_context_pool.contexts[i].ctx);
252+
count++;
253+
}
254+
}
255+
vcos_mutex_unlock(&client_context_pool.lock);
256+
LOG_ERROR("%s: %u entries in use", __func__, count);
257+
}
258+
223259
/* One client per process/VC connection. Multiple threads may
224260
* be using a single client.
225261
*/

interface/mmal/vc/mmal_vc_client_priv.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,11 @@ MMAL_STATUS_T mmal_vc_send_message(MMAL_CLIENT_T *client,
7878

7979
uint32_t mmal_vc_allocate_client_component(MMAL_COMPONENT_T *component);
8080
void mmal_vc_release_client_component(MMAL_COMPONENT_T *component);
81+
void mmal_vc_dump_client_components(void);
8182

8283
uint32_t mmal_vc_allocate_client_context(MMAL_VC_CLIENT_BUFFER_CONTEXT_T *context);
8384
MMAL_VC_CLIENT_BUFFER_CONTEXT_T *mmal_vc_lookup_client_context(int index);
8485
void mmal_vc_release_client_context(MMAL_VC_CLIENT_BUFFER_CONTEXT_T *context);
86+
void mmal_vc_dump_client_contexts(void);
8587
#endif
8688

0 commit comments

Comments
 (0)