On Tuesday, 2018-02-13 16:31:20 -0800, Keith Packard wrote:
> This extension adds the ability to borrow an X RandR output for
> temporary use directly by a Vulkan application. For DRM, we use the
> Linux resource leasing mechanism.
>
> Signed-off-by: Keith Packard
> ---
> configure.ac| 32 +++
> meson.build | 17 ++
> meson_options.txt | 7 +
> src/vulkan/Makefile.am | 5 +
> src/vulkan/wsi/meson.build | 7 +
> src/vulkan/wsi/wsi_common_display.c | 472
>
> src/vulkan/wsi/wsi_common_display.h | 17 ++
> 7 files changed, 557 insertions(+)
>
> diff --git a/configure.ac b/configure.ac
> index 46318365603..cf05d049c26 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -1547,6 +1547,7 @@ AM_CONDITIONAL(HAVE_APPLEDRI, test "x$enable_dri" =
> xyes -a "x$dri_platform" = x
> AM_CONDITIONAL(HAVE_LMSENSORS, test "x$enable_lmsensors" = xyes )
> AM_CONDITIONAL(HAVE_GALLIUM_EXTRA_HUD, test "x$enable_gallium_extra_hud" =
> xyes )
> AM_CONDITIONAL(HAVE_WINDOWSDRI, test "x$enable_dri" = xyes -a
> "x$dri_platform" = xwindows )
> +AM_CONDITIONAL(HAVE_XLEASE, test "x$have_xlease" = xyes )
>
> AC_ARG_ENABLE([shared-glapi],
> [AS_HELP_STRING([--enable-shared-glapi],
> @@ -1846,6 +1847,18 @@ if test x"$enable_dri3" = xyes; then
> PKG_CHECK_MODULES([XCB_DRI3], [$dri3_modules])
> fi
>
> +
> +if echo "$platforms" | grep -q 'x11' && echo "$platforms" | grep -q 'drm';
> then
> +have_xlease=yes
> +else
> +have_xlease=no
> +fi
> +
> +if test x"$have_xlease" = xyes; then
> +randr_modules="x11-xcb xcb-randr"
> +PKG_CHECK_MODULES([XCB_RANDR], [$randr_modules])
> +fi
> +
> AM_CONDITIONAL(HAVE_PLATFORM_X11, echo "$platforms" | grep -q 'x11')
> AM_CONDITIONAL(HAVE_PLATFORM_WAYLAND, echo "$platforms" | grep -q 'wayland')
> AM_CONDITIONAL(HAVE_PLATFORM_DRM, echo "$platforms" | grep -q 'drm')
> @@ -1853,6 +1866,25 @@ AM_CONDITIONAL(HAVE_PLATFORM_DISPLAY, echo
> "$platforms" | grep -q 'drm')
> AM_CONDITIONAL(HAVE_PLATFORM_SURFACELESS, echo "$platforms" | grep -q
> 'surfaceless')
> AM_CONDITIONAL(HAVE_PLATFORM_ANDROID, echo "$platforms" | grep -q 'android')
>
> +AC_ARG_ENABLE(xlib-lease,
> +[AS_HELP_STRING([--enable-xlib-lease]
> +[enable VK_acquire_xlib_display using X leases])],
> +[enable_xlib_lease=$enableval], [enable_xlib_lease=auto])
> +case "x$enable_xlib_lease" in
> +xyes)
> +;;
> +xno)
> +;;
> +*)
> +if echo "$platforms" | grep -q 'x11' && echo "$platforms" | grep -q
> 'drm'; then
> +enable_xlib_lease=yes
> +else
> +enable_xlib_lease=no
> +fi
> +esac
> +
> +AM_CONDITIONAL(HAVE_XLIB_LEASE, test "x$enable_xlib_lease" = xyes)
> +
> dnl
> dnl More DRI setup
> dnl
> diff --git a/meson.build b/meson.build
> index aeb7f5e2917..595b0f66cd7 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -262,6 +262,19 @@ if _platforms != ''
>egl_native_platform = _split[0]
> endif
>
> +with_xlib_lease = get_option('xlib-lease')
> +if with_xlib_lease == 'auto'
> + if with_platform_x11 and with_platform_display
> +with_xlib_lease = true
> + else
> +with_xlib_lease = false
> + endif
> +elif with_xlib_lease == 'true'
> + with_xlib_lease = true
> +else
> + with_xlib_lease = false
> +endif
Can be simplified a bit:
_xlib_lease = get_option('xlib-lease')
if _xlib_lease == 'auto'
with_xlib_lease = with_platform_x11 and with_platform_display
else
with_xlib_lease = _xlib_lease == 'true'
endif
(We also usually try to avoid changing the type of a var, and meson might
start being more strict with types in future releases)
> +
> with_glx = get_option('glx')
> if with_glx == 'auto'
>if with_dri
> @@ -1151,6 +1164,7 @@ dep_xcb_present = []
> dep_xcb_sync = []
> dep_xcb_xfixes = []
> dep_xshmfence = []
> +dep_xcb_xrandr = []
> if with_platform_x11
>if with_glx == 'xlib' or with_glx == 'gallium-xlib'
> dep_x11 = dependency('x11')
> @@ -1190,6 +1204,9 @@ if with_platform_x11
>if with_egl
> dep_xcb_xfixes = dependency('xcb-xfixes')
>endif
> + if with_xlib_lease
> +dep_xcb_xrandr = dependency('xcb-randr', version : '>= 1.12')
> + endif
> endif
>
> if get_option('gallium-extra-hud')
> diff --git a/meson_options.txt b/meson_options.txt
> index 7fafe2deaac..d38c9aa6149 100644
> --- a/meson_options.txt
> +++ b/meson_options.txt
> @@ -286,3 +286,10 @@ option(
>value : '',
>description : 'Comma delimited list of tools to build. choices :
> freedreno,glsl,intel,nir,nouveau or all'
> )
> +option(
> + 'xlib-lease',
> + type : 'combo',
> + value : 'auto',
> + choices : ['auto', 'true', 'false'],
> + description : 'Enable VK_EXT_acquire_xlib_display.'
> +)
> diff --git a/src/vulkan/Makefile.am b/src/vulkan/Makefile.am
> index c33ac5758f7..e96ef68972c 100644
> --- a/src/vulkan/Makefile.am
> +++ b/src/vulkan/Makefile.am
> @@ -64,6 +64,11 @@ AM