RE: [RFC v2 2/2] ui: Add a plain Wayland backend for Qemu UI

2021-09-14 Thread Kasireddy, Vivek
Hi Daniel,
 
> On Mon, Sep 13, 2021 at 03:20:36PM -0700, Vivek Kasireddy wrote:
> > Cc: Gerd Hoffmann 
> > Signed-off-by: Vivek Kasireddy 
> > ---
> >  configure |   8 +-
> >  meson.build   |  33 +++
> >  meson_options.txt |   2 +
> >  qapi/ui.json  |   3 +
> >  ui/meson.build|  52 
> >  ui/wayland.c  | 628 ++
> >  6 files changed, 725 insertions(+), 1 deletion(-)  create mode 100644
> > ui/wayland.c
> 
> 
> > diff --git a/ui/meson.build b/ui/meson.build index
> > a73beb0e54..86fc324c82 100644
> > --- a/ui/meson.build
> > +++ b/ui/meson.build
> > @@ -64,6 +64,58 @@ if config_host.has_key('CONFIG_OPENGL') and gbm.found()
> >ui_modules += {'egl-headless' : egl_headless_ss}  endif
> >
> > +wayland_scanner = find_program('wayland-scanner') proto_sources = [
> > +  ['xdg-shell', 'stable', ],
> > +  ['fullscreen-shell', 'unstable', 'v1', ],
> > +  ['linux-dmabuf', 'unstable', 'v1', ], ] wayland_headers = []
> > +wayland_proto_sources = []
> > +
> > +if wayland.found()
> > +  foreach p: proto_sources
> > +proto_name = p.get(0)
> > +proto_stability = p.get(1)
> > +
> > +if proto_stability == 'stable'
> > +  output_base = proto_name
> > +  input = files(join_paths(wlproto_dir,
> '@0@/@1@/@2@.xml'.format(proto_stability, proto_name, output_base)))
> > +else
> > +  proto_version = p.get(2)
> > +  output_base = '@0@-@1@-@2@'.format(proto_name, proto_stability,
> proto_version)
> > +  input = files(join_paths(wlproto_dir,
> '@0@/@1@/@2@.xml'.format(proto_stability, proto_name, output_base)))
> > +endif
> > +
> > +wayland_headers += custom_target('@0@ client 
> > header'.format(output_base),
> > +  input: input,
> > +  output: '@0@-client-protocol.h'.format(output_base),
> > +  command: [
> > +wayland_scanner,
> > +'client-header',
> > +'@INPUT@', '@OUTPUT@',
> > +  ], build_by_default: true
> > +)
> > +
> > +wayland_proto_sources += custom_target('@0@ 
> > source'.format(output_base),
> > +  input: input,
> > +  output: '@0@-protocol.c'.format(output_base),
> > +  command: [
> > +wayland_scanner,
> > +'private-code',
> > +'@INPUT@', '@OUTPUT@',
> > +  ], build_by_default: true
> > +)
> > +  endforeach
> > +endif
> > +
> > +if wayland.found()
> > +  wayland_ss = ss.source_set()
> > +  wayland_ss.add(when: wayland, if_true: files('wayland.c',
> > +'xdg-shell-protocol.c',
> > +'fullscreen-shell-unstable-v1-protocol.c','linux-dmabuf-unstable-v1-p
> > +rotocol.c'))
> > +  #wayland_ss.add(when: wayland, if_true: files('wayland.c'),
> > +[wayland_proto_sources])
> > +  ui_modules += {'wayland' : wayland_ss} endif
> 
> Configure fails on this
> 
>   Program wayland-scanner found: YES (/usr/bin/wayland-scanner)
> 
>   ../ui/meson.build:114:13: ERROR: File xdg-shell-protocol.c does not exist.
> 
> 
> the code a few lines above generates xdg-shell-protocol.c, but that isn't run 
> until you type
> "make", so when meson is resolving the source files they don't exist.
> 
> The alternative line you have commented out looks more like what we would 
> need, but it
> doesn't work either as its syntax is invalid.
[Kasireddy, Vivek] Right, the commented line is the one we'd need but despite 
exhaustively
trying various different combinations, I couldn't get Meson to include the 
auto-generated
protocol sources. If it is not too much trouble, could you please point me to 
an example
where this is done elsewhere in Qemu source that I can look at?

> 
> How did you actually compile this series ?
[Kasireddy, Vivek] Oh, as a workaround, I just manually added the protocol 
sources. I am
sorry I did not realize that this code would be compiled/tested; I mainly 
posted these
RFC/WIP patches to provide additional context to the discussion associated with 
the DRM/
Virtio-gpu kernel patches.

Thanks,
Vivek

> 
> 
> Regards,
> Daniel
> --
> |: https://berrange.com  -o-https://www.flickr.com/photos/dberrange :|
> |: https://libvirt.org -o-https://fstop138.berrange.com :|
> |: https://entangle-photo.org-o-https://www.instagram.com/dberrange :|



Re: [RFC v2 2/2] ui: Add a plain Wayland backend for Qemu UI

2021-09-14 Thread Daniel P . Berrangé
On Mon, Sep 13, 2021 at 03:20:36PM -0700, Vivek Kasireddy wrote:
> Cc: Gerd Hoffmann 
> Signed-off-by: Vivek Kasireddy 
> ---
>  configure |   8 +-
>  meson.build   |  33 +++
>  meson_options.txt |   2 +
>  qapi/ui.json  |   3 +
>  ui/meson.build|  52 
>  ui/wayland.c  | 628 ++
>  6 files changed, 725 insertions(+), 1 deletion(-)
>  create mode 100644 ui/wayland.c


> diff --git a/ui/meson.build b/ui/meson.build
> index a73beb0e54..86fc324c82 100644
> --- a/ui/meson.build
> +++ b/ui/meson.build
> @@ -64,6 +64,58 @@ if config_host.has_key('CONFIG_OPENGL') and gbm.found()
>ui_modules += {'egl-headless' : egl_headless_ss}
>  endif
>  
> +wayland_scanner = find_program('wayland-scanner')
> +proto_sources = [
> +  ['xdg-shell', 'stable', ],
> +  ['fullscreen-shell', 'unstable', 'v1', ],
> +  ['linux-dmabuf', 'unstable', 'v1', ],
> +]
> +wayland_headers = []
> +wayland_proto_sources = []
> +
> +if wayland.found()
> +  foreach p: proto_sources
> +proto_name = p.get(0)
> +proto_stability = p.get(1)
> +
> +if proto_stability == 'stable'
> +  output_base = proto_name
> +  input = files(join_paths(wlproto_dir, 
> '@0@/@1@/@2@.xml'.format(proto_stability, proto_name, output_base)))
> +else
> +  proto_version = p.get(2)
> +  output_base = '@0@-@1@-@2@'.format(proto_name, proto_stability, 
> proto_version)
> +  input = files(join_paths(wlproto_dir, 
> '@0@/@1@/@2@.xml'.format(proto_stability, proto_name, output_base)))
> +endif
> +
> +wayland_headers += custom_target('@0@ client header'.format(output_base),
> +  input: input,
> +  output: '@0@-client-protocol.h'.format(output_base),
> +  command: [
> +wayland_scanner,
> +'client-header',
> +'@INPUT@', '@OUTPUT@',
> +  ], build_by_default: true
> +)
> +
> +wayland_proto_sources += custom_target('@0@ source'.format(output_base),
> +  input: input,
> +  output: '@0@-protocol.c'.format(output_base),
> +  command: [
> +wayland_scanner,
> +'private-code',
> +'@INPUT@', '@OUTPUT@',
> +  ], build_by_default: true
> +)
> +  endforeach
> +endif
> +
> +if wayland.found()
> +  wayland_ss = ss.source_set()
> +  wayland_ss.add(when: wayland, if_true: files('wayland.c', 
> 'xdg-shell-protocol.c', 
> 'fullscreen-shell-unstable-v1-protocol.c','linux-dmabuf-unstable-v1-protocol.c'))
> +  #wayland_ss.add(when: wayland, if_true: files('wayland.c'), 
> [wayland_proto_sources])
> +  ui_modules += {'wayland' : wayland_ss}
> +endif

Configure fails on this

  Program wayland-scanner found: YES (/usr/bin/wayland-scanner)

  ../ui/meson.build:114:13: ERROR: File xdg-shell-protocol.c does not exist.


the code a few lines above generates xdg-shell-protocol.c, but that
isn't run until you type "make", so when meson is resolving the
source files they don't exist.

The alternative line you have commented out looks more like what we
would need, but it doesn't work either as its syntax is invalid.

How did you actually compile this series ?


Regards,
Daniel
-- 
|: https://berrange.com  -o-https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o-https://fstop138.berrange.com :|
|: https://entangle-photo.org-o-https://www.instagram.com/dberrange :|




Re: [RFC v2 2/2] ui: Add a plain Wayland backend for Qemu UI

2021-09-14 Thread Eric Blake
On Mon, Sep 13, 2021 at 03:20:36PM -0700, Vivek Kasireddy wrote:
> Cc: Gerd Hoffmann 
> Signed-off-by: Vivek Kasireddy 
> ---
>  configure |   8 +-
>  meson.build   |  33 +++
>  meson_options.txt |   2 +
>  qapi/ui.json  |   3 +
>  ui/meson.build|  52 
>  ui/wayland.c  | 628 ++
>  6 files changed, 725 insertions(+), 1 deletion(-)
>  create mode 100644 ui/wayland.c

UI review:

> +++ b/qapi/ui.json
> @@ -1112,6 +1112,8 @@
>  #DRI device. Graphical display need to be paired with
>  #VNC or Spice. (Since 3.1)
>  #
> +# @wayland: The Wayland user interface.

Missing a '(since 6.2)' tag.

> +#
>  # @curses: Display video output via curses.  For graphics device
>  #  models which support a text mode, QEMU can display this
>  #  output using a curses/ncurses interface. Nothing is
> @@ -1135,6 +1137,7 @@
>  { 'name': 'none' },
>  { 'name': 'gtk', 'if': 'CONFIG_GTK' },
>  { 'name': 'sdl', 'if': 'CONFIG_SDL' },
> +{ 'name': 'wayland', 'if': 'CONFIG_WAYLAND' },
>  { 'name': 'egl-headless',
>'if': { 'all': ['CONFIG_OPENGL', 'CONFIG_GBM'] } },
>  { 'name': 'curses', 'if': 'CONFIG_CURSES' },

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.   +1-919-301-3266
Virtualization:  qemu.org | libvirt.org