Re: [Mesa-dev] [PATCH 3/4] meson: build libEGL

2017-10-20 Thread Eric Engestrom
On Thursday, 2017-10-19 16:27:02 +, Eric Engestrom wrote:
> On Thursday, 2017-10-19 14:34:28 +, Daniel Stone wrote:
> > Hi Dylan,
> > 
> > On 19 October 2017 at 01:55, Dylan Baker  wrote:
> > > This is based heavily on Daniel Stone's work for the same, rebased on
> > > master and with a number of TODO's fixed.
> > >
> > > This does not implement glvnd (which is coming in a later patch)
> > >
> > > Meson builds egl slightly differently than autotools, namely it doesn't
> > > build an intermediate shared library. It doesn't do this because meson
> > > doesn't have problems with the name of the library being dynamically
> > > generated, so the glvnd and non-glvnd code can follow the same path.
> > 
> > Thanks a million for picking this up, and fixing all the egregious
> > bugs / gaps / variable name inconsistency! Is this available in a
> > fully-baked git branch somewhere?
> 
> cf. cover letter:
> https://github.com/dcbaker/mesa submit/meson-egl
> 
> I'm having trouble testing it though, didn't have enough time to debug
> tonight but eglInit() is failing

New day, fresh brain cells. I needed to `ninja install`, using the libs
directly from the build dir didn't work.

Series is:
Tested-by: Eric Engestrom 

> 
> > 
> > > +linux_dmabuf_unstable_v1_protocol_c = custom_target(
> > > +  'linux-dmabuf-unstable-v1-protocol.c',
> > > +  input : wayland_dmabuf_xml,
> > > +  output : 'linux-dmabuf-unstable-v1-protocol.c',
> > > +  command : [prog_wl_scanner, 'code', '@INPUT@', '@OUTPUT@'],
> > > +)
> > > +
> > > +linux_dmabuf_unstable_v1_client_protocol_h = custom_target(
> > > +  'linux-dmabuf-unstable-v1-client-protocol.h',
> > > +  input : wayland_dmabuf_xml,
> > > +  output : 'linux-dmabuf-unstable-v1-client-protocol.h',
> > > +  command : [prog_wl_scanner, 'client-header', '@INPUT@', '@OUTPUT@'],
> > > +)
> > 
> > Could you please move these into src/egl/wayland/wayland-drm? They're
> > not actually wl_drm of course, but I have patches out to use
> > linux-dmabuf inside Vulkan as well, so having wl_drm and
> > zwp_linux_dmabuf in the same place where it's just built once seems
> > like an idea. Then it'd be trivial to hoist that out of src/egl/
> > later.
> > 
> > > +libwayland_egl = shared_library(
> > > +  'wayland-egl',
> > > +  'wayland-egl.c',
> > > +  c_args : [c_vis_args],
> > > +  link_args : ld_args_gc_sections,
> > > +  version : '1.0.0',
> > > +  install : true,
> > >  )
> > 
> > As a drive-by musing, is there a reason c_vis_args isn't part of the
> > global arguments? I realised after the fact that I'd left it out of
> > quite a few places in my branch.
> > 
> > Other than that, it looks good to me, so:
> > Reviewed-by: Daniel Stone 
> > 
> > Cheers,
> > Daniel
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 3/4] meson: build libEGL

2017-10-20 Thread Daniel Stone
Hi Dylan,

On 19 October 2017 at 19:14, Dylan Baker  wrote:
> Quoting Daniel Stone (2017-10-19 07:34:28)
>> Could you please move these into src/egl/wayland/wayland-drm? They're
>> not actually wl_drm of course, but I have patches out to use
>> linux-dmabuf inside Vulkan as well, so having wl_drm and
>> zwp_linux_dmabuf in the same place where it's just built once seems
>> like an idea. Then it'd be trivial to hoist that out of src/egl/
>> later.
>
> Jason and I talked about this, and he thought that the better thing to do 
> would
> be to make a src/wsi folder that could have things like src/wsi/wayland,
> src/wsi/x11, etc. and we could move it in there. I like that idea too, would
> that be okay as follow up work?

Yeah, sure. src/loader/ already has some shared bits for X11/DRI3, but
it's not really related to loading. I'd be happy to see the Wayland
bits move to either there or a new src/wsi/.

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


Re: [Mesa-dev] [PATCH 3/4] meson: build libEGL

2017-10-19 Thread Dylan Baker
Quoting Daniel Stone (2017-10-19 07:34:28)
> Hi Dylan,
> 
> On 19 October 2017 at 01:55, Dylan Baker  wrote:
> > This is based heavily on Daniel Stone's work for the same, rebased on
> > master and with a number of TODO's fixed.
> >
> > This does not implement glvnd (which is coming in a later patch)
> >
> > Meson builds egl slightly differently than autotools, namely it doesn't
> > build an intermediate shared library. It doesn't do this because meson
> > doesn't have problems with the name of the library being dynamically
> > generated, so the glvnd and non-glvnd code can follow the same path.
> 
> Thanks a million for picking this up, and fixing all the egregious
> bugs / gaps / variable name inconsistency! Is this available in a
> fully-baked git branch somewhere?

https://github.com/dcbaker/mesa submit/meson-egl

> 
> > +linux_dmabuf_unstable_v1_protocol_c = custom_target(
> > +  'linux-dmabuf-unstable-v1-protocol.c',
> > +  input : wayland_dmabuf_xml,
> > +  output : 'linux-dmabuf-unstable-v1-protocol.c',
> > +  command : [prog_wl_scanner, 'code', '@INPUT@', '@OUTPUT@'],
> > +)
> > +
> > +linux_dmabuf_unstable_v1_client_protocol_h = custom_target(
> > +  'linux-dmabuf-unstable-v1-client-protocol.h',
> > +  input : wayland_dmabuf_xml,
> > +  output : 'linux-dmabuf-unstable-v1-client-protocol.h',
> > +  command : [prog_wl_scanner, 'client-header', '@INPUT@', '@OUTPUT@'],
> > +)
> 
> Could you please move these into src/egl/wayland/wayland-drm? They're
> not actually wl_drm of course, but I have patches out to use
> linux-dmabuf inside Vulkan as well, so having wl_drm and
> zwp_linux_dmabuf in the same place where it's just built once seems
> like an idea. Then it'd be trivial to hoist that out of src/egl/
> later.

Jason and I talked about this, and he thought that the better thing to do would
be to make a src/wsi folder that could have things like src/wsi/wayland,
src/wsi/x11, etc. and we could move it in there. I like that idea too, would
that be okay as follow up work?

> 
> > +libwayland_egl = shared_library(
> > +  'wayland-egl',
> > +  'wayland-egl.c',
> > +  c_args : [c_vis_args],
> > +  link_args : ld_args_gc_sections,
> > +  version : '1.0.0',
> > +  install : true,
> >  )
> 
> As a drive-by musing, is there a reason c_vis_args isn't part of the
> global arguments? I realised after the fact that I'd left it out of
> quite a few places in my branch.

There are actually some targets that don't have visibility flags set for them.
Maybe those are just oversights?

> 
> Other than that, it looks good to me, so:
> Reviewed-by: Daniel Stone 
> 
> Cheers,
> Daniel


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 3/4] meson: build libEGL

2017-10-19 Thread Eric Engestrom
On Thursday, 2017-10-19 05:10:29 +, Dylan Baker wrote:
> Quoting Eric Engestrom (2017-10-18 17:25:05)
> > On Wednesday, 2017-10-18 23:56:00 +, Dylan Baker wrote:
> > > This is based heavily on Daniel Stone's work for the same, rebased on
> > > master and with a number of TODO's fixed.
> > > 
> > > This does not implement glvnd (which is coming in a later patch)
> > > 
> > > Meson builds egl slightly differently than autotools, namely it doesn't
> > > build an intermediate shared library. It doesn't do this because meson
> > > doesn't have problems with the name of the library being dynamically
> > > generated, so the glvnd and non-glvnd code can follow the same path.
> > > 
> > > Signed-off-by: Dylan Baker 
> > > ---
> > >  include/meson.build|   8 ++
> > >  meson.build|  81 ++--
> > >  meson_options.txt  |   9 +-
> > >  src/egl/meson.build| 144 
> > > +
> > >  src/egl/wayland/wayland-drm/meson.build|  14 ++
> > >  .../{wayland-drm => wayland-egl}/meson.build   |  29 +++--
> > >  src/gbm/meson.build|  12 +-
> > >  src/glx/meson.build|  22 
> > >  src/meson.build|   7 +-
> > >  9 files changed, 281 insertions(+), 45 deletions(-)
> > >  create mode 100644 src/egl/meson.build
> > >  copy src/egl/wayland/{wayland-drm => wayland-egl}/meson.build (66%)
> > > 
> > > diff --git a/include/meson.build b/include/meson.build
> > > index e33a8569d76..88e66a1a8f4 100644
> > > --- a/include/meson.build
> > > +++ b/include/meson.build
> > > @@ -58,3 +58,11 @@ endif
> > >  if with_osmesa
> > >install_headers('GL/osmesa.h', subdir : 'GL')
> > >  endif
> > > +
> > > +if with_egl
> > > +  install_headers(
> > > +'EGL/eglext.h', 'EGL/egl.h', 'EGL/eglextchromium.h', 
> > > 'EGL/eglmesaext.h',
> > > +'EGL/eglplatform.h',
> > > +subdir : 'EGL',
> > > +  )
> > > +endif
> > > diff --git a/meson.build b/meson.build
> > > index 13d9e400ba7..9eef48340d7 100644
> > > --- a/meson.build
> > > +++ b/meson.build
> > > @@ -130,16 +130,20 @@ endif
> > >  # TODO: other OSes
> > >  with_dri_platform = 'drm'
> > >  
> > > -# TODO: there are more platforms required for non-vulkan drivers
> > > +# TODO: android platform
> > >  with_platform_wayland = false
> > >  with_platform_x11 = false
> > >  with_platform_drm = false
> > > +with_platform_surfaceless = false
> > > +egl_native_platform = ''
> > >  _platforms = get_option('platforms')
> > >  if _platforms != ''
> > >_split = _platforms.split(',')
> > >with_platform_x11 = _split.contains('x11')
> > >with_platform_wayland = _split.contains('wayland')
> > >with_platform_drm = _split.contains('drm')
> > > +  with_platform_surfaceless = _split.contains('surfaceless')
> > > +  egl_native_platform = _split[0]
> > >  endif
> > 
> > I quite liked daniels' `foreach if/elif/else` structure, it had the
> > added advantage of being able to reject invalid platforms instead of
> > silently ignoring them.
> 
> Well, I keep hoping that this will land and we can switch to it:
> https://github.com/mesonbuild/meson/pull/2390

That looks great! Let's hope it gets merged :)

> And this approach requires no changes if/when that happens, but I guess I 
> don't
> have a problem with the loop either.
> 
> > 
> > >  
> > >  with_gbm = get_option('gbm')
> > > @@ -154,6 +158,27 @@ else
> > >with_gbm = false
> > >  endif
> > >  
> > > +with_egl = get_option('egl')
> > > +if with_egl == 'auto'
> > > +  with_egl = with_dri and with_shared_glapi and egl_native_platform != ''
> > 
> > I don't like the var name reuse, once as a string, then as a bool.
> > How about `_egl = get_option('egl')`, as with `_platforms` above?
> > 
> > I'll have another look tomorrow, but I think other than that this patch
> > is good (not giving my r-b just yet though).
> 
> I can change that.
> 
> > 
> > > +elif with_egl == 'yes'
> > > +  if not with_dri
> > > +error('EGL requires dri')
> > > +  elif not with_shared_glapi
> > > +error('EGL requires shared-glapi')
> > > +  elif egl_native_platform == ''
> > > +error('No platforms specified, consider -Dplatforms=drm,x11 at 
> > > least')
> > > +  endif
> > > +  with_egl = true
> > > +else
> > > +  with_egl = false
> > > +endif
> > > +
> > > +# TODO: or virgl
> > > +if with_egl and with_gallium_radeonsi and not (with_platform_drm or 
> > > with_platform_surfaceless)
> > > +  error('RadeonSI requires drm or surfaceless platform when using EGL')
> > > +endif
> > > +
> > >  pre_args += '-DGLX_USE_TLS'
> > >  with_glx = get_option('glx')
> > >  if with_glx != 'disabled'
> > > @@ -228,7 +253,7 @@ if with_any_vk and (with_platform_x11 and not 
> > > with_dri3)
> > >error('Vulkan drivers require dri3 for X11 support')
> > >  endif
> > >  if 

Re: [Mesa-dev] [PATCH 3/4] meson: build libEGL

2017-10-19 Thread Eric Engestrom
On Thursday, 2017-10-19 14:34:28 +, Daniel Stone wrote:
> Hi Dylan,
> 
> On 19 October 2017 at 01:55, Dylan Baker  wrote:
> > This is based heavily on Daniel Stone's work for the same, rebased on
> > master and with a number of TODO's fixed.
> >
> > This does not implement glvnd (which is coming in a later patch)
> >
> > Meson builds egl slightly differently than autotools, namely it doesn't
> > build an intermediate shared library. It doesn't do this because meson
> > doesn't have problems with the name of the library being dynamically
> > generated, so the glvnd and non-glvnd code can follow the same path.
> 
> Thanks a million for picking this up, and fixing all the egregious
> bugs / gaps / variable name inconsistency! Is this available in a
> fully-baked git branch somewhere?

cf. cover letter:
https://github.com/dcbaker/mesa submit/meson-egl

I'm having trouble testing it though, didn't have enough time to debug
tonight but eglInit() is failing

> 
> > +linux_dmabuf_unstable_v1_protocol_c = custom_target(
> > +  'linux-dmabuf-unstable-v1-protocol.c',
> > +  input : wayland_dmabuf_xml,
> > +  output : 'linux-dmabuf-unstable-v1-protocol.c',
> > +  command : [prog_wl_scanner, 'code', '@INPUT@', '@OUTPUT@'],
> > +)
> > +
> > +linux_dmabuf_unstable_v1_client_protocol_h = custom_target(
> > +  'linux-dmabuf-unstable-v1-client-protocol.h',
> > +  input : wayland_dmabuf_xml,
> > +  output : 'linux-dmabuf-unstable-v1-client-protocol.h',
> > +  command : [prog_wl_scanner, 'client-header', '@INPUT@', '@OUTPUT@'],
> > +)
> 
> Could you please move these into src/egl/wayland/wayland-drm? They're
> not actually wl_drm of course, but I have patches out to use
> linux-dmabuf inside Vulkan as well, so having wl_drm and
> zwp_linux_dmabuf in the same place where it's just built once seems
> like an idea. Then it'd be trivial to hoist that out of src/egl/
> later.
> 
> > +libwayland_egl = shared_library(
> > +  'wayland-egl',
> > +  'wayland-egl.c',
> > +  c_args : [c_vis_args],
> > +  link_args : ld_args_gc_sections,
> > +  version : '1.0.0',
> > +  install : true,
> >  )
> 
> As a drive-by musing, is there a reason c_vis_args isn't part of the
> global arguments? I realised after the fact that I'd left it out of
> quite a few places in my branch.
> 
> Other than that, it looks good to me, so:
> Reviewed-by: Daniel Stone 
> 
> Cheers,
> Daniel
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 3/4] meson: build libEGL

2017-10-19 Thread Daniel Stone
Hi Dylan,

On 19 October 2017 at 01:55, Dylan Baker  wrote:
> This is based heavily on Daniel Stone's work for the same, rebased on
> master and with a number of TODO's fixed.
>
> This does not implement glvnd (which is coming in a later patch)
>
> Meson builds egl slightly differently than autotools, namely it doesn't
> build an intermediate shared library. It doesn't do this because meson
> doesn't have problems with the name of the library being dynamically
> generated, so the glvnd and non-glvnd code can follow the same path.

Thanks a million for picking this up, and fixing all the egregious
bugs / gaps / variable name inconsistency! Is this available in a
fully-baked git branch somewhere?

> +linux_dmabuf_unstable_v1_protocol_c = custom_target(
> +  'linux-dmabuf-unstable-v1-protocol.c',
> +  input : wayland_dmabuf_xml,
> +  output : 'linux-dmabuf-unstable-v1-protocol.c',
> +  command : [prog_wl_scanner, 'code', '@INPUT@', '@OUTPUT@'],
> +)
> +
> +linux_dmabuf_unstable_v1_client_protocol_h = custom_target(
> +  'linux-dmabuf-unstable-v1-client-protocol.h',
> +  input : wayland_dmabuf_xml,
> +  output : 'linux-dmabuf-unstable-v1-client-protocol.h',
> +  command : [prog_wl_scanner, 'client-header', '@INPUT@', '@OUTPUT@'],
> +)

Could you please move these into src/egl/wayland/wayland-drm? They're
not actually wl_drm of course, but I have patches out to use
linux-dmabuf inside Vulkan as well, so having wl_drm and
zwp_linux_dmabuf in the same place where it's just built once seems
like an idea. Then it'd be trivial to hoist that out of src/egl/
later.

> +libwayland_egl = shared_library(
> +  'wayland-egl',
> +  'wayland-egl.c',
> +  c_args : [c_vis_args],
> +  link_args : ld_args_gc_sections,
> +  version : '1.0.0',
> +  install : true,
>  )

As a drive-by musing, is there a reason c_vis_args isn't part of the
global arguments? I realised after the fact that I'd left it out of
quite a few places in my branch.

Other than that, it looks good to me, so:
Reviewed-by: Daniel Stone 

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


Re: [Mesa-dev] [PATCH 3/4] meson: build libEGL

2017-10-18 Thread Dylan Baker
Quoting Eric Engestrom (2017-10-18 17:25:05)
> On Wednesday, 2017-10-18 23:56:00 +, Dylan Baker wrote:
> > This is based heavily on Daniel Stone's work for the same, rebased on
> > master and with a number of TODO's fixed.
> > 
> > This does not implement glvnd (which is coming in a later patch)
> > 
> > Meson builds egl slightly differently than autotools, namely it doesn't
> > build an intermediate shared library. It doesn't do this because meson
> > doesn't have problems with the name of the library being dynamically
> > generated, so the glvnd and non-glvnd code can follow the same path.
> > 
> > Signed-off-by: Dylan Baker 
> > ---
> >  include/meson.build|   8 ++
> >  meson.build|  81 ++--
> >  meson_options.txt  |   9 +-
> >  src/egl/meson.build| 144 
> > +
> >  src/egl/wayland/wayland-drm/meson.build|  14 ++
> >  .../{wayland-drm => wayland-egl}/meson.build   |  29 +++--
> >  src/gbm/meson.build|  12 +-
> >  src/glx/meson.build|  22 
> >  src/meson.build|   7 +-
> >  9 files changed, 281 insertions(+), 45 deletions(-)
> >  create mode 100644 src/egl/meson.build
> >  copy src/egl/wayland/{wayland-drm => wayland-egl}/meson.build (66%)
> > 
> > diff --git a/include/meson.build b/include/meson.build
> > index e33a8569d76..88e66a1a8f4 100644
> > --- a/include/meson.build
> > +++ b/include/meson.build
> > @@ -58,3 +58,11 @@ endif
> >  if with_osmesa
> >install_headers('GL/osmesa.h', subdir : 'GL')
> >  endif
> > +
> > +if with_egl
> > +  install_headers(
> > +'EGL/eglext.h', 'EGL/egl.h', 'EGL/eglextchromium.h', 
> > 'EGL/eglmesaext.h',
> > +'EGL/eglplatform.h',
> > +subdir : 'EGL',
> > +  )
> > +endif
> > diff --git a/meson.build b/meson.build
> > index 13d9e400ba7..9eef48340d7 100644
> > --- a/meson.build
> > +++ b/meson.build
> > @@ -130,16 +130,20 @@ endif
> >  # TODO: other OSes
> >  with_dri_platform = 'drm'
> >  
> > -# TODO: there are more platforms required for non-vulkan drivers
> > +# TODO: android platform
> >  with_platform_wayland = false
> >  with_platform_x11 = false
> >  with_platform_drm = false
> > +with_platform_surfaceless = false
> > +egl_native_platform = ''
> >  _platforms = get_option('platforms')
> >  if _platforms != ''
> >_split = _platforms.split(',')
> >with_platform_x11 = _split.contains('x11')
> >with_platform_wayland = _split.contains('wayland')
> >with_platform_drm = _split.contains('drm')
> > +  with_platform_surfaceless = _split.contains('surfaceless')
> > +  egl_native_platform = _split[0]
> >  endif
> 
> I quite liked daniels' `foreach if/elif/else` structure, it had the
> added advantage of being able to reject invalid platforms instead of
> silently ignoring them.

Well, I keep hoping that this will land and we can switch to it:
https://github.com/mesonbuild/meson/pull/2390
And this approach requires no changes if/when that happens, but I guess I don't
have a problem with the loop either.

> 
> >  
> >  with_gbm = get_option('gbm')
> > @@ -154,6 +158,27 @@ else
> >with_gbm = false
> >  endif
> >  
> > +with_egl = get_option('egl')
> > +if with_egl == 'auto'
> > +  with_egl = with_dri and with_shared_glapi and egl_native_platform != ''
> 
> I don't like the var name reuse, once as a string, then as a bool.
> How about `_egl = get_option('egl')`, as with `_platforms` above?
> 
> I'll have another look tomorrow, but I think other than that this patch
> is good (not giving my r-b just yet though).

I can change that.

> 
> > +elif with_egl == 'yes'
> > +  if not with_dri
> > +error('EGL requires dri')
> > +  elif not with_shared_glapi
> > +error('EGL requires shared-glapi')
> > +  elif egl_native_platform == ''
> > +error('No platforms specified, consider -Dplatforms=drm,x11 at least')
> > +  endif
> > +  with_egl = true
> > +else
> > +  with_egl = false
> > +endif
> > +
> > +# TODO: or virgl
> > +if with_egl and with_gallium_radeonsi and not (with_platform_drm or 
> > with_platform_surfaceless)
> > +  error('RadeonSI requires drm or surfaceless platform when using EGL')
> > +endif
> > +
> >  pre_args += '-DGLX_USE_TLS'
> >  with_glx = get_option('glx')
> >  if with_glx != 'disabled'
> > @@ -228,7 +253,7 @@ if with_any_vk and (with_platform_x11 and not with_dri3)
> >error('Vulkan drivers require dri3 for X11 support')
> >  endif
> >  if with_dri or with_gallium
> > -  if with_glx == 'disabled' # TODO: or egl
> > +  if with_glx == 'disabled' and not with_egl
> >  error('building dri or gallium drivers require at least one window 
> > system')
> >endif
> >  endif
> > @@ -250,6 +275,7 @@ if _drivers != ''
> >  with_gallium_omx or with_gallium_va)
> >  endif
> >  
> > 

Re: [Mesa-dev] [PATCH 3/4] meson: build libEGL

2017-10-18 Thread Eric Engestrom
On Wednesday, 2017-10-18 23:56:00 +, Dylan Baker wrote:
> This is based heavily on Daniel Stone's work for the same, rebased on
> master and with a number of TODO's fixed.
> 
> This does not implement glvnd (which is coming in a later patch)
> 
> Meson builds egl slightly differently than autotools, namely it doesn't
> build an intermediate shared library. It doesn't do this because meson
> doesn't have problems with the name of the library being dynamically
> generated, so the glvnd and non-glvnd code can follow the same path.
> 
> Signed-off-by: Dylan Baker 
> ---
>  include/meson.build|   8 ++
>  meson.build|  81 ++--
>  meson_options.txt  |   9 +-
>  src/egl/meson.build| 144 
> +
>  src/egl/wayland/wayland-drm/meson.build|  14 ++
>  .../{wayland-drm => wayland-egl}/meson.build   |  29 +++--
>  src/gbm/meson.build|  12 +-
>  src/glx/meson.build|  22 
>  src/meson.build|   7 +-
>  9 files changed, 281 insertions(+), 45 deletions(-)
>  create mode 100644 src/egl/meson.build
>  copy src/egl/wayland/{wayland-drm => wayland-egl}/meson.build (66%)
> 
> diff --git a/include/meson.build b/include/meson.build
> index e33a8569d76..88e66a1a8f4 100644
> --- a/include/meson.build
> +++ b/include/meson.build
> @@ -58,3 +58,11 @@ endif
>  if with_osmesa
>install_headers('GL/osmesa.h', subdir : 'GL')
>  endif
> +
> +if with_egl
> +  install_headers(
> +'EGL/eglext.h', 'EGL/egl.h', 'EGL/eglextchromium.h', 'EGL/eglmesaext.h',
> +'EGL/eglplatform.h',
> +subdir : 'EGL',
> +  )
> +endif
> diff --git a/meson.build b/meson.build
> index 13d9e400ba7..9eef48340d7 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -130,16 +130,20 @@ endif
>  # TODO: other OSes
>  with_dri_platform = 'drm'
>  
> -# TODO: there are more platforms required for non-vulkan drivers
> +# TODO: android platform
>  with_platform_wayland = false
>  with_platform_x11 = false
>  with_platform_drm = false
> +with_platform_surfaceless = false
> +egl_native_platform = ''
>  _platforms = get_option('platforms')
>  if _platforms != ''
>_split = _platforms.split(',')
>with_platform_x11 = _split.contains('x11')
>with_platform_wayland = _split.contains('wayland')
>with_platform_drm = _split.contains('drm')
> +  with_platform_surfaceless = _split.contains('surfaceless')
> +  egl_native_platform = _split[0]
>  endif

I quite liked daniels' `foreach if/elif/else` structure, it had the
added advantage of being able to reject invalid platforms instead of
silently ignoring them.

>  
>  with_gbm = get_option('gbm')
> @@ -154,6 +158,27 @@ else
>with_gbm = false
>  endif
>  
> +with_egl = get_option('egl')
> +if with_egl == 'auto'
> +  with_egl = with_dri and with_shared_glapi and egl_native_platform != ''

I don't like the var name reuse, once as a string, then as a bool.
How about `_egl = get_option('egl')`, as with `_platforms` above?

I'll have another look tomorrow, but I think other than that this patch
is good (not giving my r-b just yet though).

> +elif with_egl == 'yes'
> +  if not with_dri
> +error('EGL requires dri')
> +  elif not with_shared_glapi
> +error('EGL requires shared-glapi')
> +  elif egl_native_platform == ''
> +error('No platforms specified, consider -Dplatforms=drm,x11 at least')
> +  endif
> +  with_egl = true
> +else
> +  with_egl = false
> +endif
> +
> +# TODO: or virgl
> +if with_egl and with_gallium_radeonsi and not (with_platform_drm or 
> with_platform_surfaceless)
> +  error('RadeonSI requires drm or surfaceless platform when using EGL')
> +endif
> +
>  pre_args += '-DGLX_USE_TLS'
>  with_glx = get_option('glx')
>  if with_glx != 'disabled'
> @@ -228,7 +253,7 @@ if with_any_vk and (with_platform_x11 and not with_dri3)
>error('Vulkan drivers require dri3 for X11 support')
>  endif
>  if with_dri or with_gallium
> -  if with_glx == 'disabled' # TODO: or egl
> +  if with_glx == 'disabled' and not with_egl
>  error('building dri or gallium drivers require at least one window 
> system')
>endif
>  endif
> @@ -250,6 +275,7 @@ if _drivers != ''
>  with_gallium_omx or with_gallium_va)
>  endif
>  
> +gl_pkgconfig_c_flags = []
>  if with_platform_x11
>if with_any_vk or (with_glx == 'dri' and with_dri_platform == 'drm')
>  pre_args += '-DHAVE_X11_PLATFORM'
> @@ -269,6 +295,18 @@ if with_platform_x11
>pre_args += '-DGLX_USE_DRM'
>  endif
>endif
> +else
> +  pre_args += '-DMESA_EGL_NO_X11_HEADERS'
> +  gl_pkgconfig_c_flags += '-DMESA_EGL_NO_X11_HEADERS'
> +endif
> +if with_platform_drm
> +  if with_egl and not with_gbm
> +error('EGL drm platform requires gbm')
> +  endif
> +  pre_args += '-DHAVE_DRM_PLATFORM'
> +endif
> +if 

[Mesa-dev] [PATCH 3/4] meson: build libEGL

2017-10-18 Thread Dylan Baker
This is based heavily on Daniel Stone's work for the same, rebased on
master and with a number of TODO's fixed.

This does not implement glvnd (which is coming in a later patch)

Meson builds egl slightly differently than autotools, namely it doesn't
build an intermediate shared library. It doesn't do this because meson
doesn't have problems with the name of the library being dynamically
generated, so the glvnd and non-glvnd code can follow the same path.

Signed-off-by: Dylan Baker 
---
 include/meson.build|   8 ++
 meson.build|  81 ++--
 meson_options.txt  |   9 +-
 src/egl/meson.build| 144 +
 src/egl/wayland/wayland-drm/meson.build|  14 ++
 .../{wayland-drm => wayland-egl}/meson.build   |  29 +++--
 src/gbm/meson.build|  12 +-
 src/glx/meson.build|  22 
 src/meson.build|   7 +-
 9 files changed, 281 insertions(+), 45 deletions(-)
 create mode 100644 src/egl/meson.build
 copy src/egl/wayland/{wayland-drm => wayland-egl}/meson.build (66%)

diff --git a/include/meson.build b/include/meson.build
index e33a8569d76..88e66a1a8f4 100644
--- a/include/meson.build
+++ b/include/meson.build
@@ -58,3 +58,11 @@ endif
 if with_osmesa
   install_headers('GL/osmesa.h', subdir : 'GL')
 endif
+
+if with_egl
+  install_headers(
+'EGL/eglext.h', 'EGL/egl.h', 'EGL/eglextchromium.h', 'EGL/eglmesaext.h',
+'EGL/eglplatform.h',
+subdir : 'EGL',
+  )
+endif
diff --git a/meson.build b/meson.build
index 13d9e400ba7..9eef48340d7 100644
--- a/meson.build
+++ b/meson.build
@@ -130,16 +130,20 @@ endif
 # TODO: other OSes
 with_dri_platform = 'drm'
 
-# TODO: there are more platforms required for non-vulkan drivers
+# TODO: android platform
 with_platform_wayland = false
 with_platform_x11 = false
 with_platform_drm = false
+with_platform_surfaceless = false
+egl_native_platform = ''
 _platforms = get_option('platforms')
 if _platforms != ''
   _split = _platforms.split(',')
   with_platform_x11 = _split.contains('x11')
   with_platform_wayland = _split.contains('wayland')
   with_platform_drm = _split.contains('drm')
+  with_platform_surfaceless = _split.contains('surfaceless')
+  egl_native_platform = _split[0]
 endif
 
 with_gbm = get_option('gbm')
@@ -154,6 +158,27 @@ else
   with_gbm = false
 endif
 
+with_egl = get_option('egl')
+if with_egl == 'auto'
+  with_egl = with_dri and with_shared_glapi and egl_native_platform != ''
+elif with_egl == 'yes'
+  if not with_dri
+error('EGL requires dri')
+  elif not with_shared_glapi
+error('EGL requires shared-glapi')
+  elif egl_native_platform == ''
+error('No platforms specified, consider -Dplatforms=drm,x11 at least')
+  endif
+  with_egl = true
+else
+  with_egl = false
+endif
+
+# TODO: or virgl
+if with_egl and with_gallium_radeonsi and not (with_platform_drm or 
with_platform_surfaceless)
+  error('RadeonSI requires drm or surfaceless platform when using EGL')
+endif
+
 pre_args += '-DGLX_USE_TLS'
 with_glx = get_option('glx')
 if with_glx != 'disabled'
@@ -228,7 +253,7 @@ if with_any_vk and (with_platform_x11 and not with_dri3)
   error('Vulkan drivers require dri3 for X11 support')
 endif
 if with_dri or with_gallium
-  if with_glx == 'disabled' # TODO: or egl
+  if with_glx == 'disabled' and not with_egl
 error('building dri or gallium drivers require at least one window system')
   endif
 endif
@@ -250,6 +275,7 @@ if _drivers != ''
 with_gallium_omx or with_gallium_va)
 endif
 
+gl_pkgconfig_c_flags = []
 if with_platform_x11
   if with_any_vk or (with_glx == 'dri' and with_dri_platform == 'drm')
 pre_args += '-DHAVE_X11_PLATFORM'
@@ -269,6 +295,18 @@ if with_platform_x11
   pre_args += '-DGLX_USE_DRM'
 endif
   endif
+else
+  pre_args += '-DMESA_EGL_NO_X11_HEADERS'
+  gl_pkgconfig_c_flags += '-DMESA_EGL_NO_X11_HEADERS'
+endif
+if with_platform_drm
+  if with_egl and not with_gbm
+error('EGL drm platform requires gbm')
+  endif
+  pre_args += '-DHAVE_DRM_PLATFORM'
+endif
+if with_platform_surfaceless
+  pre_args += '-DHAVE_SURFACELESS_PLATFORM'
 endif
 
 prog_python2 = find_program('python2')
@@ -646,18 +684,22 @@ endif
 
 # TODO: symbol mangling
 
-# TODO: egl configuration
-
 if with_platform_wayland
   prog_wl_scanner = find_program('wayland-scanner')
   dep_wl_protocols = dependency('wayland-protocols', version : '>= 1.8')
   dep_wayland_client = dependency('wayland-client', version : '>=1.11')
   dep_wayland_server = dependency('wayland-server', version : '>=1.11')
+  wayland_dmabuf_xml = join_paths(
+dep_wl_protocols.get_pkgconfig_variable('pkgdatadir'), 'unstable',
+'linux-dmabuf', 'linux-dmabuf-unstable-v1.xml'
+  )
+  pre_args += ['-DHAVE_WAYLAND_PLATFORM', '-DWL_HIDE_DEPRECATED']
 else