All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alex J Lennon <ajlennon@dynamicdevices.co.uk>
To: Alexandru Vaduva <vaduva.jan.alexandru@gmail.com>,
	 Andrei Gherzan <andrei@gherzan.ro>
Cc: Yocto Project <yocto@yoctoproject.org>, Gary Thomas <gary@mlbassoc.com>
Subject: Re: [meta-raspberrypi] Using the camera
Date: Mon, 02 Jun 2014 02:18:22 +0100	[thread overview]
Message-ID: <538BD0DE.1020207@dynamicdevices.co.uk> (raw)
In-Reply-To: <538B9CA5.8040704@dynamicdevices.co.uk>

[-- Attachment #1: Type: text/plain, Size: 2755 bytes --]


On 01/06/2014 22:35, Alex J Lennon wrote:
>
> On 01/06/2014 22:22, Alexandru Vaduva wrote:
>> This are indeed some very good news Alex J Lennon.
>> I have some questions, but those maybe can be answered by the
>> maintainers of the meta-raspberrypi layer:
>> Why was this change done?
>>      -PREFERRED_PROVIDER_virtual/egl ?= "vc-graphics-hardfp"
>>      -PREFERRED_PROVIDER_virtual/libgles2 ?= "vc-graphics-hardfp"
>>      +PREFERRED_PROVIDER_virtual/egl ?= "userland"
>>      +PREFERRED_PROVIDER_virtual/libgles2 ?= "userland"
>> How it may affect other applications?
>> Andrei: Do you have any input on this?
>>
>>

I think I've worked out what is happening. It looks like an interesting,
and pretty obscure, effect of the default bitbake linker flags.

There's an __attribute__(constructor) decorated function that is
supposed to be executed when libmmal_vc_client.so is loaded.

However by default bitbake passes in LDFLAGS of --as-needed which means
that although raspivid is set to be linked against libmmal_vc_client,
the dependency, which is un-needed by raspivid as there's no call into
that library, is removed.

The userland code for Raspivid tries to create a component with a call
to  mmal_component_create() which is in libmmal_core

ref:
https://github.com/raspberrypi/userland/blob/master/host_applications/linux/apps/raspicam/RaspiVid.c

This function goes to a default constructor     which walks a list
mmal_component_supplier_create(const char *name, MMAL_COMPONENT_T
*component)

ref:
https://github.com/raspberrypi/userland/blob/master/interface/mmal/core/mmal_component.c

The function that populates the supplier list,
mmal_component_supplier_register(), is called from a function in another
library, libmmal_vc_client, which is decorated with

MMAL_CONSTRUCTOR(mmal_register_component_videocore);

which is defined as

# define MMAL_CONSTRUCTOR(func) void __attribute__((constructor,used))
func(void)

i.e. This registration function would normally execute when the library
it lives in is loaded, but because there's no call into that library
from raspivid, and because we linked with --as-needed, the library is
removed from the executable's dependency list, and the components are
never registered...

Diffing the working and non-working raspivids,

Dynamic Section:
   NEEDED               libmmal_core.so
   NEEDED               libmmal_util.so
-  NEEDED               libmmal_vc_client.so
   NEEDED               libvcos.so

So if I modify the userland_git.bb to remove the --as-needed

+LDFLAGS="-Wl,-O1 -Wl,--hash-style=gnu"

With this change I can now build userland out of meta-raspberrypi and
raspivid works for me.

Cheers,

Alex



 

[-- Attachment #2: Type: text/html, Size: 5163 bytes --]

  reply	other threads:[~2014-06-02  1:18 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-19 16:18 [meta-raspberrypi] Using the camera Edward Vidal
2013-11-19 16:22 ` Gary Thomas
2013-12-03 21:54   ` Andrei Gherzan
2013-12-03 22:13     ` jan alexandru vaduva
2014-05-25 11:36       ` Alex J Lennon
2014-05-25 20:51         ` Alexandru Vaduva
2014-05-26 10:39           ` Alex J Lennon
2014-05-26 17:56             ` Alex J Lennon
2014-05-26 18:24               ` Alexandru Vaduva
2014-05-26 18:34                 ` Alex J Lennon
2014-05-26 18:40                   ` Alexandru Vaduva
2014-06-01 21:07                     ` Alex J Lennon
2014-06-01 21:22                       ` Alexandru Vaduva
2014-06-01 21:35                         ` Alex J Lennon
2014-06-02  1:18                           ` Alex J Lennon [this message]
2014-06-10 18:01                             ` Andrei Gherzan
2014-06-10 19:21                               ` Andrei Gherzan
2014-06-11 12:54                                 ` Alex J Lennon
2014-06-11 17:00                                   ` Andrei Gherzan
  -- strict thread matches above, loose matches on Subject: below --
2013-11-18 20:37 Gary Thomas
2013-11-18 21:10 ` Philipp Wagner
2013-11-18 21:55   ` Gary Thomas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=538BD0DE.1020207@dynamicdevices.co.uk \
    --to=ajlennon@dynamicdevices.co.uk \
    --cc=andrei@gherzan.ro \
    --cc=gary@mlbassoc.com \
    --cc=vaduva.jan.alexandru@gmail.com \
    --cc=yocto@yoctoproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.