vulkan: EXT_acquire_xlib_display requires libXrandr headers to build

Submitted by Keith Packard on June 19, 2018, 11:06 p.m.

Details

Message ID 20180619230614.21195-1-keithp@keithp.com
State Accepted
Commit 3f960c1338713d317ce6463be68cee162c968d8d
Headers show
Series "vulkan: EXT_acquire_xlib_display requires libXrandr headers to build" ( rev: 1 ) in Mesa

Not browsing as part of any series.

Commit Message

Keith Packard June 19, 2018, 11:06 p.m.
When VK_USE_PLATFORM_XLIB_XRANDR_EXT is defined, vulkan.h includes
X11/extensions/Xrandr.h for the RROutput typedef which is used in
the vkGetRandROutputDisplayEXT interface.

Make sure we have the required header by checking during the build,
and also set CFLAGS to point at the right directory.

We don't need to link against the library as we don't use any
functions from there, so don't add the _LIBS value in the autotools
build.

Signed-off-by: Keith Packard <keithp@keithp.com>
---
 configure.ac                 | 2 ++
 meson.build                  | 2 ++
 src/amd/vulkan/Makefile.am   | 3 ++-
 src/amd/vulkan/meson.build   | 2 +-
 src/intel/Makefile.vulkan.am | 3 ++-
 src/intel/vulkan/meson.build | 2 +-
 src/vulkan/Makefile.am       | 2 ++
 src/vulkan/wsi/meson.build   | 2 +-
 8 files changed, 13 insertions(+), 5 deletions(-)

Patch hide | download patch | download mbox

diff --git a/configure.ac b/configure.ac
index 06524107786..e4320e8da7a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1877,6 +1877,8 @@  fi
 if test x"$have_xlease" = xyes; then
     randr_modules="x11-xcb xcb-randr"
     PKG_CHECK_MODULES([XCB_RANDR], [$randr_modules])
+    xlib_randr_modules="xrandr"
+    PKG_CHECK_MODULES([XLIB_RANDR], [$xlib_randr_modules])
 fi
 
 AM_CONDITIONAL(HAVE_PLATFORM_X11, echo "$platforms" | grep -q 'x11')
diff --git a/meson.build b/meson.build
index ce54393fded..82279aad26c 100644
--- a/meson.build
+++ b/meson.build
@@ -1301,6 +1301,7 @@  dep_xcb_sync = null_dep
 dep_xcb_xfixes = null_dep
 dep_xshmfence = null_dep
 dep_xcb_xrandr = null_dep
+dep_xlib_xrandr = null_dep
 if with_platform_x11
   if with_glx == 'xlib' or with_glx == 'gallium-xlib'
     dep_x11 = dependency('x11')
@@ -1349,6 +1350,7 @@  if with_platform_x11
   endif
   if with_xlib_lease
     dep_xcb_xrandr = dependency('xcb-randr', version : '>= 1.12')
+    dep_xlib_xrandr = dependency('xrandr', version : '>= 1.3')
   endif
 endif
 
diff --git a/src/amd/vulkan/Makefile.am b/src/amd/vulkan/Makefile.am
index 8279fe4a81f..f9d3622f744 100644
--- a/src/amd/vulkan/Makefile.am
+++ b/src/amd/vulkan/Makefile.am
@@ -90,7 +90,8 @@  endif
 if HAVE_XLIB_LEASE
 AM_CPPFLAGS += \
 	-DVK_USE_PLATFORM_XLIB_XRANDR_EXT \
-	$(XCB_RANDR_CFLAGS)
+	$(XCB_RANDR_CFLAGS) \
+	$(XLIB_RANDR_CFLAGS)
 
 VULKAN_LIB_DEPS += $(XCB_RANDR_LIBS)
 endif
diff --git a/src/amd/vulkan/meson.build b/src/amd/vulkan/meson.build
index bcdf83e0609..22857926fa1 100644
--- a/src/amd/vulkan/meson.build
+++ b/src/amd/vulkan/meson.build
@@ -121,7 +121,7 @@  if with_platform_drm
 endif
 
 if with_xlib_lease
-  radv_deps += dep_xcb_xrandr
+  radv_deps += [dep_xcb_xrandr, dep_xlib_xrandr]
   radv_flags += '-DVK_USE_PLATFORM_XLIB_XRANDR_EXT'
 endif
 
diff --git a/src/intel/Makefile.vulkan.am b/src/intel/Makefile.vulkan.am
index ae625695814..4a80c3ae412 100644
--- a/src/intel/Makefile.vulkan.am
+++ b/src/intel/Makefile.vulkan.am
@@ -202,7 +202,8 @@  endif
 if HAVE_XLIB_LEASE
 VULKAN_CPPFLAGS += \
 	-DVK_USE_PLATFORM_XLIB_XRANDR_EXT \
-	$(XCB_RANDR_CFLAGS)
+	$(XCB_RANDR_CFLAGS) \
+	$(XLIB_RANDR_CFLAGS)
 VULKAN_LIB_DEPS += $(XCB_RANDR_LIBS)
 endif
 
diff --git a/src/intel/vulkan/meson.build b/src/intel/vulkan/meson.build
index 4b0652f757b..e427c7471f4 100644
--- a/src/intel/vulkan/meson.build
+++ b/src/intel/vulkan/meson.build
@@ -170,7 +170,7 @@  if with_platform_drm
 endif
 
 if with_xlib_lease
-  anv_deps += dep_xcb_xrandr
+  anv_deps += [dep_xcb_xrandr, dep_xlib_xrandr]
   anv_flags += '-DVK_USE_PLATFORM_XLIB_XRANDR_EXT'
 endif
 
diff --git a/src/vulkan/Makefile.am b/src/vulkan/Makefile.am
index 9deb6e18ff0..ce1a79d0c48 100644
--- a/src/vulkan/Makefile.am
+++ b/src/vulkan/Makefile.am
@@ -63,6 +63,8 @@  endif
 
 if HAVE_XLIB_LEASE
 AM_CPPFLAGS += \
+	$(XCB_RANDR_CFLAGS) \
+	$(XLIB_RANDR_CFLAGS) \
 	-DVK_USE_PLATFORM_XLIB_XRANDR_EXT
 endif
 
diff --git a/src/vulkan/wsi/meson.build b/src/vulkan/wsi/meson.build
index 3501a864e18..d073b23dc25 100644
--- a/src/vulkan/wsi/meson.build
+++ b/src/vulkan/wsi/meson.build
@@ -68,7 +68,7 @@  if with_platform_drm
 endif
 
 if with_xlib_lease
-  vulkan_wsi_deps += dep_xcb_xrandr
+  vulkan_wsi_deps += [dep_xcb_xrandr, dep_xlib_xrandr]
   vulkan_wsi_args += '-DVK_USE_PLATFORM_XLIB_XRANDR_EXT'
 endif
 

Comments

On Tuesday, 2018-06-19 16:06:14 -0700, Keith Packard wrote:
> When VK_USE_PLATFORM_XLIB_XRANDR_EXT is defined, vulkan.h includes
> X11/extensions/Xrandr.h for the RROutput typedef which is used in
> the vkGetRandROutputDisplayEXT interface.
> 
> Make sure we have the required header by checking during the build,
> and also set CFLAGS to point at the right directory.
> 
> We don't need to link against the library as we don't use any
> functions from there, so don't add the _LIBS value in the autotools
> build.
> 
> Signed-off-by: Keith Packard <keithp@keithp.com>

Fixes: dbac8e25f851ed44c51f "radv: Add EXT_acquire_xlib_display to radv driver [v2]"
Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>

> ---
>  configure.ac                 | 2 ++
>  meson.build                  | 2 ++
>  src/amd/vulkan/Makefile.am   | 3 ++-
>  src/amd/vulkan/meson.build   | 2 +-
>  src/intel/Makefile.vulkan.am | 3 ++-
>  src/intel/vulkan/meson.build | 2 +-
>  src/vulkan/Makefile.am       | 2 ++
>  src/vulkan/wsi/meson.build   | 2 +-
>  8 files changed, 13 insertions(+), 5 deletions(-)
> 
> diff --git a/configure.ac b/configure.ac
> index 06524107786..e4320e8da7a 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -1877,6 +1877,8 @@ fi
>  if test x"$have_xlease" = xyes; then
>      randr_modules="x11-xcb xcb-randr"
>      PKG_CHECK_MODULES([XCB_RANDR], [$randr_modules])
> +    xlib_randr_modules="xrandr"
> +    PKG_CHECK_MODULES([XLIB_RANDR], [$xlib_randr_modules])
>  fi
>  
>  AM_CONDITIONAL(HAVE_PLATFORM_X11, echo "$platforms" | grep -q 'x11')
> diff --git a/meson.build b/meson.build
> index ce54393fded..82279aad26c 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -1301,6 +1301,7 @@ dep_xcb_sync = null_dep
>  dep_xcb_xfixes = null_dep
>  dep_xshmfence = null_dep
>  dep_xcb_xrandr = null_dep
> +dep_xlib_xrandr = null_dep
>  if with_platform_x11
>    if with_glx == 'xlib' or with_glx == 'gallium-xlib'
>      dep_x11 = dependency('x11')
> @@ -1349,6 +1350,7 @@ if with_platform_x11
>    endif
>    if with_xlib_lease
>      dep_xcb_xrandr = dependency('xcb-randr', version : '>= 1.12')
> +    dep_xlib_xrandr = dependency('xrandr', version : '>= 1.3')
>    endif
>  endif
>  
> diff --git a/src/amd/vulkan/Makefile.am b/src/amd/vulkan/Makefile.am
> index 8279fe4a81f..f9d3622f744 100644
> --- a/src/amd/vulkan/Makefile.am
> +++ b/src/amd/vulkan/Makefile.am
> @@ -90,7 +90,8 @@ endif
>  if HAVE_XLIB_LEASE
>  AM_CPPFLAGS += \
>  	-DVK_USE_PLATFORM_XLIB_XRANDR_EXT \
> -	$(XCB_RANDR_CFLAGS)
> +	$(XCB_RANDR_CFLAGS) \
> +	$(XLIB_RANDR_CFLAGS)
>  
>  VULKAN_LIB_DEPS += $(XCB_RANDR_LIBS)
>  endif
> diff --git a/src/amd/vulkan/meson.build b/src/amd/vulkan/meson.build
> index bcdf83e0609..22857926fa1 100644
> --- a/src/amd/vulkan/meson.build
> +++ b/src/amd/vulkan/meson.build
> @@ -121,7 +121,7 @@ if with_platform_drm
>  endif
>  
>  if with_xlib_lease
> -  radv_deps += dep_xcb_xrandr
> +  radv_deps += [dep_xcb_xrandr, dep_xlib_xrandr]
>    radv_flags += '-DVK_USE_PLATFORM_XLIB_XRANDR_EXT'
>  endif
>  
> diff --git a/src/intel/Makefile.vulkan.am b/src/intel/Makefile.vulkan.am
> index ae625695814..4a80c3ae412 100644
> --- a/src/intel/Makefile.vulkan.am
> +++ b/src/intel/Makefile.vulkan.am
> @@ -202,7 +202,8 @@ endif
>  if HAVE_XLIB_LEASE
>  VULKAN_CPPFLAGS += \
>  	-DVK_USE_PLATFORM_XLIB_XRANDR_EXT \
> -	$(XCB_RANDR_CFLAGS)
> +	$(XCB_RANDR_CFLAGS) \
> +	$(XLIB_RANDR_CFLAGS)
>  VULKAN_LIB_DEPS += $(XCB_RANDR_LIBS)
>  endif
>  
> diff --git a/src/intel/vulkan/meson.build b/src/intel/vulkan/meson.build
> index 4b0652f757b..e427c7471f4 100644
> --- a/src/intel/vulkan/meson.build
> +++ b/src/intel/vulkan/meson.build
> @@ -170,7 +170,7 @@ if with_platform_drm
>  endif
>  
>  if with_xlib_lease
> -  anv_deps += dep_xcb_xrandr
> +  anv_deps += [dep_xcb_xrandr, dep_xlib_xrandr]
>    anv_flags += '-DVK_USE_PLATFORM_XLIB_XRANDR_EXT'
>  endif
>  
> diff --git a/src/vulkan/Makefile.am b/src/vulkan/Makefile.am
> index 9deb6e18ff0..ce1a79d0c48 100644
> --- a/src/vulkan/Makefile.am
> +++ b/src/vulkan/Makefile.am
> @@ -63,6 +63,8 @@ endif
>  
>  if HAVE_XLIB_LEASE
>  AM_CPPFLAGS += \
> +	$(XCB_RANDR_CFLAGS) \
> +	$(XLIB_RANDR_CFLAGS) \
>  	-DVK_USE_PLATFORM_XLIB_XRANDR_EXT
>  endif
>  
> diff --git a/src/vulkan/wsi/meson.build b/src/vulkan/wsi/meson.build
> index 3501a864e18..d073b23dc25 100644
> --- a/src/vulkan/wsi/meson.build
> +++ b/src/vulkan/wsi/meson.build
> @@ -68,7 +68,7 @@ if with_platform_drm
>  endif
>  
>  if with_xlib_lease
> -  vulkan_wsi_deps += dep_xcb_xrandr
> +  vulkan_wsi_deps += [dep_xcb_xrandr, dep_xlib_xrandr]
>    vulkan_wsi_args += '-DVK_USE_PLATFORM_XLIB_XRANDR_EXT'
>  endif
>  
> -- 
> 2.17.1
> 
> _______________________________________________
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Eric Engestrom <eric.engestrom@intel.com> writes:

> On Tuesday, 2018-06-19 16:06:14 -0700, Keith Packard wrote:
>> When VK_USE_PLATFORM_XLIB_XRANDR_EXT is defined, vulkan.h includes
>> X11/extensions/Xrandr.h for the RROutput typedef which is used in
>> the vkGetRandROutputDisplayEXT interface.
>> 
>> Make sure we have the required header by checking during the build,
>> and also set CFLAGS to point at the right directory.
>> 
>> We don't need to link against the library as we don't use any
>> functions from there, so don't add the _LIBS value in the autotools
>> build.
>> 
>> Signed-off-by: Keith Packard <keithp@keithp.com>
>
> Fixes: dbac8e25f851ed44c51f "radv: Add EXT_acquire_xlib_display to radv driver [v2]"
> Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>

Thanks for testing. I've pushed this to master.