Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mmal: Hack to make mmal core register VideoCore components #714

Merged
merged 1 commit into from
Nov 25, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion interface/mmal/core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ add_library (mmal_core ${LIBRARY_TYPE}
mmal_clock.c
)

target_link_libraries (mmal_core vcos)
target_link_libraries (mmal_core vcos mmal_vc_client)

install(TARGETS mmal_core DESTINATION lib)
install(FILES
Expand Down
8 changes: 8 additions & 0 deletions interface/mmal/core/mmal_component.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "core/mmal_core_private.h"
#include "mmal_logging.h"

#include "vc/mmal_vc_api.h"

/* Minimum number of buffers that will be available on the control port */
#define MMAL_CONTROL_PORT_BUFFERS_MIN 4

Expand Down Expand Up @@ -665,6 +667,12 @@ MMAL_STATUS_T mmal_component_action_unlock(MMAL_COMPONENT_T *component)
static void mmal_core_init_once(void)
{
vcos_mutex_create(&mmal_core_lock, VCOS_FUNCTION);

/* Horrid hack as linkers are now setting --as-needed by default, so fail
* to see the requirement for mmal_vc_client as a library because the core
* never calls it.
*/
mmal_register_component_videocore();
}

static void mmal_core_init(void)
Expand Down
4 changes: 4 additions & 0 deletions interface/mmal/vc/mmal_vc_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -1508,7 +1508,11 @@ static MMAL_STATUS_T mmal_vc_component_create(const char *name, MMAL_COMPONENT_T
return status;
}

/*
* Do NOT register as a constructor due to horrid hack where the core will register
* these components in case the linker has determined that they weren't needed.
MMAL_CONSTRUCTOR(mmal_register_component_videocore);
*/
void mmal_register_component_videocore(void)
{
mmal_component_supplier_register(VIDEOCORE_PREFIX, mmal_vc_component_create);
Expand Down
1 change: 1 addition & 0 deletions interface/mmal/vc/mmal_vc_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,7 @@ MMAL_STATUS_T mmal_vc_compact(MMAL_VC_COMPACT_MODE_T mode, uint32_t *duration);
*/
MMAL_STATUS_T mmal_vc_lmk(uint32_t alloc_size);

void mmal_register_component_videocore(void);
#ifdef __cplusplus
}
#endif
Expand Down