Re: [Mesa-dev] [PATCH 2/4] meson: disable x86 asm in fewer cases.

2017-11-17 Thread Eric Engestrom
On Thursday, 2017-11-16 14:16:38 -0800, Dylan Baker wrote:
> Quoting Eric Engestrom (2017-11-16 03:46:04)
> > On Wednesday, 2017-11-15 17:11:00 -0800, Dylan Baker wrote:
> > > This patch allows building asm for x86 on x86_64 platforms, when the
> > > operating system is the same. Previously cross compile always turned off
> > > assembly. This allows using a cross file to cross compile x86 binaries
> > > on x86_64 with asm.
> > > 
> > > This could probably be relaxed further thanks to meson's "exe_wrapper",
> > > which is way to specify an emulator or compatibility layer (wine) that
> > > can run the foreign binaries on the build system. Since the meson build
> > > at this point only supports building on Linux I can't test this and I
> > > don't want to write/enable code that cannot even be build tested.
> > > 
> > > Signed-off-by: Dylan Baker 
> > > ---
> > >  meson.build | 17 ++---
> > >  1 file changed, 10 insertions(+), 7 deletions(-)
> > > 
> > > diff --git a/meson.build b/meson.build
> > > index 0d201c711a0..261c4753427 100644
> > > --- a/meson.build
> > > +++ b/meson.build
> > > @@ -554,13 +554,16 @@ endif
> > >  
> > >  # TODO: texture-float (gallium/mesa only)
> > >  
> > > -# TODO: cross-compiling. I don't think this is relavent to meson
> > > -
> > > -# FIXME: enable asm when cross compiler
> > > -# This is doable (autotools does it), but it's not of immediate concern
> > > -if meson.is_cross_build() and host_machine.cpu_family().startswith('x86')
> > > -  message('Cross compiling, disabling x86/x86_64 asm')
> > > -  with_asm = false
> > > +# Building x86 assembly code requires running x86 binaries. It is 
> > > possible for
> > > +# x86_64 OSes to run x86 binaries, so don't disable asm in those cases
> > > +# TODO: it should be possible to use an exe_wrapper to run the binary 
> > > durring
> > 
> > "during"
> > 
> > > +# the build. 
> > > +if meson.is_cross_build() 
> > > +  if (not (build_machine.cpu_family() == 'x86_64' and 
> > > host_machine.cpu_family() == 'x86')
> > > +  and build_machine.system() == host_machine.system())
> > > +message('Cross compiling to x86 from non-x86, disabling asm')
> > > +with_asm = false
> > > +  endif
> > 
> > This looks off to me.
> > Shouldn't the `and build_os==host_os` be `or not build_os==host_os`?
> > 
> > In other words, if cross-building on the same os from 64bit to 32bit,
> > allow asm, and otherwise disable it?
> > 
> > If so, you could factor the `not` out, and it would be:
> >   if not (build_os==host_os and build==64bit and host==32bit)
> > with_asm = false
> 
> This is covering for a very specific case. As part of the x86 and x64 asm
> process we build an executable matypes, which needs to be of the target
> architecture, because it detects how big certain structs are, and returns 
> those
> values.
> 
> So this can be built only in 1 cross compiling case, x64 building x86 (since 
> x64
> can run x86 binaries), and only if the OSes are the same (unless we had
> exe_wrapper, but I haven't gotten there yet).
> 
> However, I think you're right that the not should apply to both conditions, or
> the second hsould be build != host. Does that seem correct?

Yup :)
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 2/4] meson: disable x86 asm in fewer cases.

2017-11-16 Thread Dylan Baker
Quoting Eric Engestrom (2017-11-16 03:46:04)
> On Wednesday, 2017-11-15 17:11:00 -0800, Dylan Baker wrote:
> > This patch allows building asm for x86 on x86_64 platforms, when the
> > operating system is the same. Previously cross compile always turned off
> > assembly. This allows using a cross file to cross compile x86 binaries
> > on x86_64 with asm.
> > 
> > This could probably be relaxed further thanks to meson's "exe_wrapper",
> > which is way to specify an emulator or compatibility layer (wine) that
> > can run the foreign binaries on the build system. Since the meson build
> > at this point only supports building on Linux I can't test this and I
> > don't want to write/enable code that cannot even be build tested.
> > 
> > Signed-off-by: Dylan Baker 
> > ---
> >  meson.build | 17 ++---
> >  1 file changed, 10 insertions(+), 7 deletions(-)
> > 
> > diff --git a/meson.build b/meson.build
> > index 0d201c711a0..261c4753427 100644
> > --- a/meson.build
> > +++ b/meson.build
> > @@ -554,13 +554,16 @@ endif
> >  
> >  # TODO: texture-float (gallium/mesa only)
> >  
> > -# TODO: cross-compiling. I don't think this is relavent to meson
> > -
> > -# FIXME: enable asm when cross compiler
> > -# This is doable (autotools does it), but it's not of immediate concern
> > -if meson.is_cross_build() and host_machine.cpu_family().startswith('x86')
> > -  message('Cross compiling, disabling x86/x86_64 asm')
> > -  with_asm = false
> > +# Building x86 assembly code requires running x86 binaries. It is possible 
> > for
> > +# x86_64 OSes to run x86 binaries, so don't disable asm in those cases
> > +# TODO: it should be possible to use an exe_wrapper to run the binary 
> > durring
> 
> "during"
> 
> > +# the build. 
> > +if meson.is_cross_build() 
> > +  if (not (build_machine.cpu_family() == 'x86_64' and 
> > host_machine.cpu_family() == 'x86')
> > +  and build_machine.system() == host_machine.system())
> > +message('Cross compiling to x86 from non-x86, disabling asm')
> > +with_asm = false
> > +  endif
> 
> This looks off to me.
> Shouldn't the `and build_os==host_os` be `or not build_os==host_os`?
> 
> In other words, if cross-building on the same os from 64bit to 32bit,
> allow asm, and otherwise disable it?
> 
> If so, you could factor the `not` out, and it would be:
>   if not (build_os==host_os and build==64bit and host==32bit)
> with_asm = false

This is covering for a very specific case. As part of the x86 and x64 asm
process we build an executable matypes, which needs to be of the target
architecture, because it detects how big certain structs are, and returns those
values.

So this can be built only in 1 cross compiling case, x64 building x86 (since x64
can run x86 binaries), and only if the OSes are the same (unless we had
exe_wrapper, but I haven't gotten there yet).

However, I think you're right that the not should apply to both conditions, or
the second hsould be build != host. Does that seem correct?



signature.asc
Description: signature
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 2/4] meson: disable x86 asm in fewer cases.

2017-11-16 Thread Eric Engestrom
On Wednesday, 2017-11-15 17:11:00 -0800, Dylan Baker wrote:
> This patch allows building asm for x86 on x86_64 platforms, when the
> operating system is the same. Previously cross compile always turned off
> assembly. This allows using a cross file to cross compile x86 binaries
> on x86_64 with asm.
> 
> This could probably be relaxed further thanks to meson's "exe_wrapper",
> which is way to specify an emulator or compatibility layer (wine) that
> can run the foreign binaries on the build system. Since the meson build
> at this point only supports building on Linux I can't test this and I
> don't want to write/enable code that cannot even be build tested.
> 
> Signed-off-by: Dylan Baker 
> ---
>  meson.build | 17 ++---
>  1 file changed, 10 insertions(+), 7 deletions(-)
> 
> diff --git a/meson.build b/meson.build
> index 0d201c711a0..261c4753427 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -554,13 +554,16 @@ endif
>  
>  # TODO: texture-float (gallium/mesa only)
>  
> -# TODO: cross-compiling. I don't think this is relavent to meson
> -
> -# FIXME: enable asm when cross compiler
> -# This is doable (autotools does it), but it's not of immediate concern
> -if meson.is_cross_build() and host_machine.cpu_family().startswith('x86')
> -  message('Cross compiling, disabling x86/x86_64 asm')
> -  with_asm = false
> +# Building x86 assembly code requires running x86 binaries. It is possible 
> for
> +# x86_64 OSes to run x86 binaries, so don't disable asm in those cases
> +# TODO: it should be possible to use an exe_wrapper to run the binary durring

"during"

> +# the build. 
> +if meson.is_cross_build() 
> +  if (not (build_machine.cpu_family() == 'x86_64' and 
> host_machine.cpu_family() == 'x86')
> +  and build_machine.system() == host_machine.system())
> +message('Cross compiling to x86 from non-x86, disabling asm')
> +with_asm = false
> +  endif

This looks off to me.
Shouldn't the `and build_os==host_os` be `or not build_os==host_os`?

In other words, if cross-building on the same os from 64bit to 32bit,
allow asm, and otherwise disable it?

If so, you could factor the `not` out, and it would be:
  if not (build_os==host_os and build==64bit and host==32bit)
with_asm = false

>  endif
>  
>  with_asm_arch = ''
> -- 
> 2.15.0
> 
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 2/4] meson: disable x86 asm in fewer cases.

2017-11-15 Thread Dylan Baker
This patch allows building asm for x86 on x86_64 platforms, when the
operating system is the same. Previously cross compile always turned off
assembly. This allows using a cross file to cross compile x86 binaries
on x86_64 with asm.

This could probably be relaxed further thanks to meson's "exe_wrapper",
which is way to specify an emulator or compatibility layer (wine) that
can run the foreign binaries on the build system. Since the meson build
at this point only supports building on Linux I can't test this and I
don't want to write/enable code that cannot even be build tested.

Signed-off-by: Dylan Baker 
---
 meson.build | 17 ++---
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/meson.build b/meson.build
index 0d201c711a0..261c4753427 100644
--- a/meson.build
+++ b/meson.build
@@ -554,13 +554,16 @@ endif
 
 # TODO: texture-float (gallium/mesa only)
 
-# TODO: cross-compiling. I don't think this is relavent to meson
-
-# FIXME: enable asm when cross compiler
-# This is doable (autotools does it), but it's not of immediate concern
-if meson.is_cross_build() and host_machine.cpu_family().startswith('x86')
-  message('Cross compiling, disabling x86/x86_64 asm')
-  with_asm = false
+# Building x86 assembly code requires running x86 binaries. It is possible for
+# x86_64 OSes to run x86 binaries, so don't disable asm in those cases
+# TODO: it should be possible to use an exe_wrapper to run the binary durring
+# the build. 
+if meson.is_cross_build() 
+  if (not (build_machine.cpu_family() == 'x86_64' and 
host_machine.cpu_family() == 'x86')
+  and build_machine.system() == host_machine.system())
+message('Cross compiling to x86 from non-x86, disabling asm')
+with_asm = false
+  endif
 endif
 
 with_asm_arch = ''
-- 
2.15.0

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev