diff mbox

[v2,04/30] gst-ffmpeg: use the new BR2_ARM_CPU_ARM* options

Message ID 1413923237-2861-5-git-send-email-thomas.petazzoni@free-electrons.com
State Accepted
Headers show

Commit Message

Thomas Petazzoni Oct. 21, 2014, 8:26 p.m. UTC
Instead of using the Config.in options for each individual ARM core,
use the newly introduced BR2_ARM_CPU_ARM* options, which exist per ARM
architecture.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
 package/gstreamer/gst-ffmpeg/gst-ffmpeg.mk | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Yann E. MORIN Oct. 21, 2014, 9:18 p.m. UTC | #1
Thomas, All,

On 2014-10-21 22:26 +0200, Thomas Petazzoni spake thusly:
> Instead of using the Config.in options for each individual ARM core,
> use the newly introduced BR2_ARM_CPU_ARM* options, which exist per ARM
> architecture.
> 
> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>

Reviewed-by: "Yann E. MORIN" <yann.morin.1998@free.fr>

However, a side comment, see below...

> ---
>  package/gstreamer/gst-ffmpeg/gst-ffmpeg.mk | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/package/gstreamer/gst-ffmpeg/gst-ffmpeg.mk b/package/gstreamer/gst-ffmpeg/gst-ffmpeg.mk
> index b94fb0f..5e55363 100644
> --- a/package/gstreamer/gst-ffmpeg/gst-ffmpeg.mk
> +++ b/package/gstreamer/gst-ffmpeg/gst-ffmpeg.mk
> @@ -51,10 +51,10 @@ endif
>  # Explicitly disable everything that doesn't match for ARM
>  # FFMPEG "autodetects" by compiling an extended instruction via AS
>  # This works on compilers that aren't built for generic by default
> -ifeq ($(BR2_arm920t)$(BR2_arm922t)$(BR2_strongarm)$(BR2_fa526),y)
> +ifeq ($(BR2_ARM_CPU_ARMV4),y)
>  GST_FFMPEG_CONF_EXTRA_OPTS += --disable-armv5te
>  endif
> -ifeq ($(BR2_arm1136jf_s)$(BR2_arm1176jz_s)$(BR2_arm1176jzf_s),y)
> +ifeq ($(BR2_ARM_CPU_ARMV6),y)
>  GST_FFMPEG_CONF_EXTRA_OPTS += --enable-armv6
>  else
>  GST_FFMPEG_CONF_EXTRA_OPTS += --disable-armv6 --disable-armv6t2

armv6t2: does that hint that we can tune to use Thumb-2 ?

Unrelated to the series, though...

Regards,
Yann E. MORIN.

> -- 
> 2.0.0
> 
> _______________________________________________
> buildroot mailing list
> buildroot@busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot
Thomas Petazzoni Oct. 22, 2014, 7:34 a.m. UTC | #2
Dear Yann E. MORIN,

On Tue, 21 Oct 2014 23:18:11 +0200, Yann E. MORIN wrote:

> > -ifeq ($(BR2_arm1136jf_s)$(BR2_arm1176jz_s)$(BR2_arm1176jzf_s),y)
> > +ifeq ($(BR2_ARM_CPU_ARMV6),y)
> >  GST_FFMPEG_CONF_EXTRA_OPTS += --enable-armv6
> >  else
> >  GST_FFMPEG_CONF_EXTRA_OPTS += --disable-armv6 --disable-armv6t2
> 
> armv6t2: does that hint that we can tune to use Thumb-2 ?

I thought Thumb-2 was only introduced with ARMv7, but it turns out it's
not the case. It has in fact been introduced in ARM1156, part of the
ARMv6 architecture.

However, this ARM1156 is not supported in Buildroot, and I have never
heard of it in any publicly available SoC.

However, this means that --enable-armv6t2 can be used for ARMv7.

Best regards,

Thomas
Arnout Vandecappelle Oct. 22, 2014, 4:14 p.m. UTC | #3
On 22/10/14 09:34, Thomas Petazzoni wrote:
> Dear Yann E. MORIN,
> 
> On Tue, 21 Oct 2014 23:18:11 +0200, Yann E. MORIN wrote:
> 
>>> -ifeq ($(BR2_arm1136jf_s)$(BR2_arm1176jz_s)$(BR2_arm1176jzf_s),y)
>>> +ifeq ($(BR2_ARM_CPU_ARMV6),y)
>>>  GST_FFMPEG_CONF_EXTRA_OPTS += --enable-armv6
>>>  else
>>>  GST_FFMPEG_CONF_EXTRA_OPTS += --disable-armv6 --disable-armv6t2
>>
>> armv6t2: does that hint that we can tune to use Thumb-2 ?
> 
> I thought Thumb-2 was only introduced with ARMv7, but it turns out it's
> not the case. It has in fact been introduced in ARM1156, part of the
> ARMv6 architecture.
> 
> However, this ARM1156 is not supported in Buildroot, and I have never
> heard of it in any publicly available SoC.
> 
> However, this means that --enable-armv6t2 can be used for ARMv7.

 I wouldn't want to actually use it unless tested on real hardware, however.

 Regards,
 Arnout
Thomas Petazzoni Oct. 23, 2014, 7:49 a.m. UTC | #4
Dear Arnout Vandecappelle,

On Wed, 22 Oct 2014 18:14:21 +0200, Arnout Vandecappelle wrote:

>  I wouldn't want to actually use it unless tested on real hardware, however.

Well, if you grep through the gst-ffmpeg tree, you will that the
ARMV6T2 condition is only used in two places in
gst-libs/ext/libav/libavcodec/arm/asm.S :

.macro  mov32   rd, val
#if HAVE_ARMV6T2
        movw            \rd, #(\val) & 0xffff
    .if (\val) >> 16
        movt            \rd, #(\val) >> 16
    .endif
#else
        ldr             \rd, =\val
#endif
.endm

.macro  movrel rd, val
#if HAVE_ARMV6T2 && !CONFIG_PIC && !defined(__APPLE__)
        movw            \rd, #:lower16:\val
        movt            \rd, #:upper16:\val
#else
        ldr             \rd, =\val
#endif
.endm

So when you have ARMV6T2, it uses movw/movt instead of ldr. That's the
only difference with the non-ARMV6T2 mode. Then you can read
http://community.arm.com/groups/processors/blog/2010/07/27/how-to-load-constants-in-assembly-for-arm-architecture,
which says:

"""
As mentioned earlier, there are other ways to load a constant. In the
latest version of the ARM architecture, ARMv7, two new instructions
were introduced to improve the situation:

- movw, or move wide, will move a 16-bit constant into a register,
  implicitly zeroing the top 16 bits of the target register.

- movt, or move top, will move a 16-bit constant into the top half of a
  given register without altering the bottom 16 bits. Now moving an
  arbitrary 32-bit constant is as simple as this:
"""

So I think it's safe to say than --enable-armv6t2 can be used on ARMv7
as well.

Best regards,

Thomas
Arnout Vandecappelle Oct. 23, 2014, 8:27 a.m. UTC | #5
On 23/10/14 09:49, Thomas Petazzoni wrote:
> Dear Arnout Vandecappelle,
> 
> On Wed, 22 Oct 2014 18:14:21 +0200, Arnout Vandecappelle wrote:
> 
>>  I wouldn't want to actually use it unless tested on real hardware, however.
> 
> Well, if you grep through the gst-ffmpeg tree, you will that the
> ARMV6T2 condition is only used in two places in
> gst-libs/ext/libav/libavcodec/arm/asm.S :
> 
> .macro  mov32   rd, val
> #if HAVE_ARMV6T2
>         movw            \rd, #(\val) & 0xffff
>     .if (\val) >> 16
>         movt            \rd, #(\val) >> 16
>     .endif
> #else
>         ldr             \rd, =\val
> #endif
> .endm
> 
> .macro  movrel rd, val
> #if HAVE_ARMV6T2 && !CONFIG_PIC && !defined(__APPLE__)
>         movw            \rd, #:lower16:\val
>         movt            \rd, #:upper16:\val
> #else
>         ldr             \rd, =\val
> #endif
> .endm
> 
> So when you have ARMV6T2, it uses movw/movt instead of ldr. That's the
> only difference with the non-ARMV6T2 mode. Then you can read
> http://community.arm.com/groups/processors/blog/2010/07/27/how-to-load-constants-in-assembly-for-arm-architecture,
> which says:
> 
> """
> As mentioned earlier, there are other ways to load a constant. In the
> latest version of the ARM architecture, ARMv7, two new instructions
> were introduced to improve the situation:
> 
> - movw, or move wide, will move a 16-bit constant into a register,
>   implicitly zeroing the top 16 bits of the target register.
> 
> - movt, or move top, will move a 16-bit constant into the top half of a
>   given register without altering the bottom 16 bits. Now moving an
>   arbitrary 32-bit constant is as simple as this:
> """
> 
> So I think it's safe to say than --enable-armv6t2 can be used on ARMv7
> as well.

 Okay, that's good enough for me.


 Regards,
 Arnout
diff mbox

Patch

diff --git a/package/gstreamer/gst-ffmpeg/gst-ffmpeg.mk b/package/gstreamer/gst-ffmpeg/gst-ffmpeg.mk
index b94fb0f..5e55363 100644
--- a/package/gstreamer/gst-ffmpeg/gst-ffmpeg.mk
+++ b/package/gstreamer/gst-ffmpeg/gst-ffmpeg.mk
@@ -51,10 +51,10 @@  endif
 # Explicitly disable everything that doesn't match for ARM
 # FFMPEG "autodetects" by compiling an extended instruction via AS
 # This works on compilers that aren't built for generic by default
-ifeq ($(BR2_arm920t)$(BR2_arm922t)$(BR2_strongarm)$(BR2_fa526),y)
+ifeq ($(BR2_ARM_CPU_ARMV4),y)
 GST_FFMPEG_CONF_EXTRA_OPTS += --disable-armv5te
 endif
-ifeq ($(BR2_arm1136jf_s)$(BR2_arm1176jz_s)$(BR2_arm1176jzf_s),y)
+ifeq ($(BR2_ARM_CPU_ARMV6),y)
 GST_FFMPEG_CONF_EXTRA_OPTS += --enable-armv6
 else
 GST_FFMPEG_CONF_EXTRA_OPTS += --disable-armv6 --disable-armv6t2