Re: [Mesa-dev] [PATCH v3] vulkan: Fix compilation on older platforms

2018-07-25 Thread Danylo Piliaiev

Hi Emil,


On 24.07.18 19:23, Emil Velikov wrote:

Hi Danylo,

Having a closer look inspired by Eric's comments

On 24 July 2018 at 15:37, Danylo Piliaiev  wrote:

Check for DRM_EVENT_CONTEXT_VERSION >= 4 to use sequence_handler.


As you bump the libdrm version:
  - drop the existing DRM_EVENT_CONTEXT_VERSION guard
  - swap the DRM_EVENT_CONTEXT_VERSION macro with the actual version implemented

Makes sense, will be done.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=107170
https://bugs.freedesktop.org/show_bug.cgi?id=106972
https://bugs.freedesktop.org/show_bug.cgi?id=107176


Separate bugs it seems - hence separate patches?


Yes

+LIBDRM_CRT_SEQUENCE_REQUIRED=2.4.89
+

There is no need for yet another version - just bump LIBDRM_REQUIRED.

Bumping LIBDRM_REQUIRED would mean that older platforms won't be supported.
I don't know how the decisions about support of older platforms are made but
from my point of view bumping required libdrm version due to one vulkan
extension
may be overkill.


If we consider this as the only merit, then the number of
checks/version would practically explore.
Simply take each user libGL, libEGL, gbm, other multiply that with the
number of features we use.

Looking at Eero's bug (last one in the list) - he's using Ubuntu 16.04
which has 2.4.91 in xenial-updates



I didn't notice that libdrm is easy to update thus my argument fails.
Managing dependencies is hard...

Why do we need the new define? From a quick look we should be above to
reuse VK_USE_PLATFORM_DISPLAY_KHR, we simply need the ifdef guards.

If we will not bump global libdrm version requirement new define is
necessary because
rest of the code guarded by VK_USE_PLATFORM_DISPLAY_KHR works fine with
older libdrm versions.


And by addressing that, this can go - one diverging codepath less ;-)

For good.

HTH
Emil


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


Re: [Mesa-dev] [PATCH v3] vulkan: Fix compilation on older platforms

2018-07-25 Thread Danylo Piliaiev

Hi Eric,


On 24.07.18 18:43, Eric Engestrom wrote:

On Friday, 2018-07-13 16:57:34 +0300, Danylo Piliaiev wrote:

Make xlease automatically enabled only if xcb-randr >= 1.13,
check its version if manually enabled.

Enable VK_EXT_display_control only when libdrm >= 2.4.89

Check for DRM_EVENT_CONTEXT_VERSION >= 4 to use sequence_handler.

You're changing 3 unrelated things here; please send 3 patches :)


Ok, I'll separate patches this time:
1) xcb-randr check
2) Bumping libdrm for vulkan
3) Removal checks of DRM_EVENT_CONTEXT_VERSION as suggested by Emil.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=107170
   https://bugs.freedesktop.org/show_bug.cgi?id=106972
   https://bugs.freedesktop.org/show_bug.cgi?id=107176

v2: - Add 'protect="VK_USE_DISPLAY_CONTROL"' attribute to
VK_EXT_display_control in vk.xml
 - Add support for 'protect' attribute to anv_entrypoints_gen
(copied from radv_entrypoints_gen)
 - Turn #if into #ifdef
 - Remove unnecessary pkg-config call from meson build (Dylan Baker)

v3: by Dylan Baker
 - Remove previously added changes to vk.xml and entrypoints
generation because vk.xml is meant to be pulled from the external
source.

Signed-off-by: Danylo Piliaiev 
---
  configure.ac   | 29 +-
  meson.build| 10 -
  src/amd/vulkan/radv_extensions.py  |  9 +++-
  src/amd/vulkan/radv_wsi_display.c  |  5 ++---
  src/intel/vulkan/anv_extensions.py |  2 +-
  src/intel/vulkan/anv_extensions_gen.py |  7 +++
  src/intel/vulkan/anv_wsi_display.c |  4 ++--
  src/vulkan/wsi/wsi_common_display.c|  8 +--
  src/vulkan/wsi/wsi_common_display.h|  3 ++-
  9 files changed, 51 insertions(+), 26 deletions(-)

diff --git a/configure.ac b/configure.ac
index f135d05736..0b04525014 100644
--- a/configure.ac
+++ b/configure.ac
@@ -82,6 +82,8 @@ LIBDRM_FREEDRENO_REQUIRED=2.4.92
  LIBDRM_ETNAVIV_REQUIRED=2.4.89
  LIBDRM_VC4_REQUIRED=2.4.89
  
+LIBDRM_CRT_SEQUENCE_REQUIRED=2.4.89

I agree with everyone else here: just bump the libdrm version required
for vulkan :)

Making sure I got it right:
Since it's vulkan only issue LIBDRM_REQUIRED=2.4.75 should be left 
intact and

new variable like LIBDRM_VULKAN_REQUIRED=2.4.89 be introduced
which will be checked when vulkan is enabled.

libdrm is absolutely trivial to update; any system that can update its
mesa can also update its libdrm.


Didn't notice that it's easy to update, thanks.

+
  dnl Versions for external dependencies
  DRI2PROTO_REQUIRED=2.8
  GLPROTO_REQUIRED=1.4.14
@@ -97,6 +99,7 @@ XCBDRI2_REQUIRED=1.8
  XCBDRI3_MODIFIERS_REQUIRED=1.13
  XCBGLX_REQUIRED=1.8.1
  XCBPRESENT_MODIFIERS_REQUIRED=1.13
+XCBRANDR_XLEASE_REQUIRED=1.13
  XDAMAGE_REQUIRED=1.1
  XSHMFENCE_REQUIRED=1.1
  XVMC_REQUIRED=1.0.6
@@ -1874,20 +1877,6 @@ if test x"$enable_dri3" = xyes; then
  fi
  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])
-xlib_randr_modules="xrandr"
-PKG_CHECK_MODULES([XLIB_RANDR], [$xlib_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')
@@ -1905,14 +1894,24 @@ xno)
  ;;
  *)
  if echo "$platforms" | grep -q 'x11' && echo "$platforms" | grep -q 
'drm'; then
-enable_xlib_lease=yes
+xlease_modules="x11-xcb xcb-randr >= $XCBRANDR_XLEASE_REQUIRED xrandr"
+PKG_CHECK_EXISTS([$xlease_modules], [enable_xlib_lease=yes], 
[enable_xlib_lease=no])
  else
  enable_xlib_lease=no
  fi
  esac
  
+if test x"$enable_xlib_lease" = xyes; then

+randr_modules="x11-xcb xcb-randr >= $XCBRANDR_XLEASE_REQUIRED"
+PKG_CHECK_MODULES([XCB_RANDR], [$randr_modules])
+xlib_randr_modules="xrandr"
+PKG_CHECK_MODULES([XLIB_RANDR], [$xlib_randr_modules])
+fi
+
  AM_CONDITIONAL(HAVE_XLIB_LEASE, test "x$enable_xlib_lease" = xyes)
  
+PKG_CHECK_EXISTS([libdrm >= $LIBDRM_CRT_SEQUENCE_REQUIRED], [DEFINES="${DEFINES} -DVK_USE_DISPLAY_CONTROL"], [])

+
  dnl
  dnl More DRI setup
  dnl
diff --git a/meson.build b/meson.build
index 7d12af3d51..902074819c 100644
--- a/meson.build
+++ b/meson.build
@@ -1088,6 +1088,8 @@ _drm_freedreno_ver = '2.4.92'
  _drm_intel_ver = '2.4.75'
  _drm_ver = '2.4.75'
  
+_drm_crt_sequence_ver = '2.4.89'

+
  _libdrm_checks = [
['intel', with_dri_i915 or with_gallium_i915],
['amdgpu', with_amd_vk or with_gallium_radeonsi],
@@ -1361,11 +1363,17 @@ if with_platform_x11
  dep_xcb_xfixes = dependency('xcb-xfixes')
endif
if with_xlib_lease
-dep_xcb_xrandr = dependency('xcb-randr', version : '>= 

Re: [Mesa-dev] [PATCH v3] vulkan: Fix compilation on older platforms

2018-07-24 Thread Emil Velikov
Hi Danylo,

Having a closer look inspired by Eric's comments

On 24 July 2018 at 15:37, Danylo Piliaiev  wrote:
>>> Check for DRM_EVENT_CONTEXT_VERSION >= 4 to use sequence_handler.
>>>
As you bump the libdrm version:
 - drop the existing DRM_EVENT_CONTEXT_VERSION guard
 - swap the DRM_EVENT_CONTEXT_VERSION macro with the actual version implemented

>>> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=107170
>>>https://bugs.freedesktop.org/show_bug.cgi?id=106972
>>>https://bugs.freedesktop.org/show_bug.cgi?id=107176
>>>
Separate bugs it seems - hence separate patches?


>>>
>>> +LIBDRM_CRT_SEQUENCE_REQUIRED=2.4.89
>>> +
>>
>> There is no need for yet another version - just bump LIBDRM_REQUIRED.
>
> Bumping LIBDRM_REQUIRED would mean that older platforms won't be supported.
> I don't know how the decisions about support of older platforms are made but
> from my point of view bumping required libdrm version due to one vulkan
> extension
> may be overkill.
>
If we consider this as the only merit, then the number of
checks/version would practically explore.
Simply take each user libGL, libEGL, gbm, other multiply that with the
number of features we use.

Looking at Eero's bug (last one in the list) - he's using Ubuntu 16.04
which has 2.4.91 in xenial-updates


>> Why do we need the new define? From a quick look we should be above to
>> reuse VK_USE_PLATFORM_DISPLAY_KHR, we simply need the ifdef guards.
>
> If we will not bump global libdrm version requirement new define is
> necessary because
> rest of the code guarded by VK_USE_PLATFORM_DISPLAY_KHR works fine with
> older libdrm versions.
>
And by addressing that, this can go - one diverging codepath less ;-)

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


Re: [Mesa-dev] [PATCH v3] vulkan: Fix compilation on older platforms

2018-07-24 Thread Eric Engestrom
On Friday, 2018-07-13 16:57:34 +0300, Danylo Piliaiev wrote:
> Make xlease automatically enabled only if xcb-randr >= 1.13,
> check its version if manually enabled.
> 
> Enable VK_EXT_display_control only when libdrm >= 2.4.89
> 
> Check for DRM_EVENT_CONTEXT_VERSION >= 4 to use sequence_handler.

You're changing 3 unrelated things here; please send 3 patches :)

> 
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=107170
>   https://bugs.freedesktop.org/show_bug.cgi?id=106972
>   https://bugs.freedesktop.org/show_bug.cgi?id=107176
> 
> v2: - Add 'protect="VK_USE_DISPLAY_CONTROL"' attribute to
>VK_EXT_display_control in vk.xml
> - Add support for 'protect' attribute to anv_entrypoints_gen
>(copied from radv_entrypoints_gen)
> - Turn #if into #ifdef
> - Remove unnecessary pkg-config call from meson build (Dylan Baker)
> 
> v3: by Dylan Baker
> - Remove previously added changes to vk.xml and entrypoints
>generation because vk.xml is meant to be pulled from the external
>source.
> 
> Signed-off-by: Danylo Piliaiev 
> ---
>  configure.ac   | 29 +-
>  meson.build| 10 -
>  src/amd/vulkan/radv_extensions.py  |  9 +++-
>  src/amd/vulkan/radv_wsi_display.c  |  5 ++---
>  src/intel/vulkan/anv_extensions.py |  2 +-
>  src/intel/vulkan/anv_extensions_gen.py |  7 +++
>  src/intel/vulkan/anv_wsi_display.c |  4 ++--
>  src/vulkan/wsi/wsi_common_display.c|  8 +--
>  src/vulkan/wsi/wsi_common_display.h|  3 ++-
>  9 files changed, 51 insertions(+), 26 deletions(-)
> 
> diff --git a/configure.ac b/configure.ac
> index f135d05736..0b04525014 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -82,6 +82,8 @@ LIBDRM_FREEDRENO_REQUIRED=2.4.92
>  LIBDRM_ETNAVIV_REQUIRED=2.4.89
>  LIBDRM_VC4_REQUIRED=2.4.89
>  
> +LIBDRM_CRT_SEQUENCE_REQUIRED=2.4.89

I agree with everyone else here: just bump the libdrm version required
for vulkan :)

libdrm is absolutely trivial to update; any system that can update its
mesa can also update its libdrm.

> +
>  dnl Versions for external dependencies
>  DRI2PROTO_REQUIRED=2.8
>  GLPROTO_REQUIRED=1.4.14
> @@ -97,6 +99,7 @@ XCBDRI2_REQUIRED=1.8
>  XCBDRI3_MODIFIERS_REQUIRED=1.13
>  XCBGLX_REQUIRED=1.8.1
>  XCBPRESENT_MODIFIERS_REQUIRED=1.13
> +XCBRANDR_XLEASE_REQUIRED=1.13
>  XDAMAGE_REQUIRED=1.1
>  XSHMFENCE_REQUIRED=1.1
>  XVMC_REQUIRED=1.0.6
> @@ -1874,20 +1877,6 @@ if test x"$enable_dri3" = xyes; then
>  fi
>  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])
> -xlib_randr_modules="xrandr"
> -PKG_CHECK_MODULES([XLIB_RANDR], [$xlib_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')
> @@ -1905,14 +1894,24 @@ xno)
>  ;;
>  *)
>  if echo "$platforms" | grep -q 'x11' && echo "$platforms" | grep -q 
> 'drm'; then
> -enable_xlib_lease=yes
> +xlease_modules="x11-xcb xcb-randr >= $XCBRANDR_XLEASE_REQUIRED 
> xrandr"
> +PKG_CHECK_EXISTS([$xlease_modules], [enable_xlib_lease=yes], 
> [enable_xlib_lease=no])
>  else
>  enable_xlib_lease=no
>  fi
>  esac
>  
> +if test x"$enable_xlib_lease" = xyes; then
> +randr_modules="x11-xcb xcb-randr >= $XCBRANDR_XLEASE_REQUIRED"
> +PKG_CHECK_MODULES([XCB_RANDR], [$randr_modules])
> +xlib_randr_modules="xrandr"
> +PKG_CHECK_MODULES([XLIB_RANDR], [$xlib_randr_modules])
> +fi
> +
>  AM_CONDITIONAL(HAVE_XLIB_LEASE, test "x$enable_xlib_lease" = xyes)
>  
> +PKG_CHECK_EXISTS([libdrm >= $LIBDRM_CRT_SEQUENCE_REQUIRED], 
> [DEFINES="${DEFINES} -DVK_USE_DISPLAY_CONTROL"], [])
> +
>  dnl
>  dnl More DRI setup
>  dnl
> diff --git a/meson.build b/meson.build
> index 7d12af3d51..902074819c 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -1088,6 +1088,8 @@ _drm_freedreno_ver = '2.4.92'
>  _drm_intel_ver = '2.4.75'
>  _drm_ver = '2.4.75'
>  
> +_drm_crt_sequence_ver = '2.4.89'
> +
>  _libdrm_checks = [
>['intel', with_dri_i915 or with_gallium_i915],
>['amdgpu', with_amd_vk or with_gallium_radeonsi],
> @@ -1361,11 +1363,17 @@ if with_platform_x11
>  dep_xcb_xfixes = dependency('xcb-xfixes')
>endif
>if with_xlib_lease
> -dep_xcb_xrandr = dependency('xcb-randr', version : '>= 1.12')
> +dep_xcb_xrandr = dependency('xcb-randr', version : '>= 1.13')
>  dep_xlib_xrandr = dependency('xrandr', version : '>= 1.3')
>endif
>  endif
>  
> +if with_any_vk
> +  if dep_libdrm.version().version_compare('>= ' + _drm_crt_sequence_ver)
> +pre_args += 

Re: [Mesa-dev] [PATCH v3] vulkan: Fix compilation on older platforms

2018-07-24 Thread Danylo Piliaiev

Hi Emil,

On 24.07.18 17:10, Emil Velikov wrote:

Hi Danylo,

On 13 July 2018 at 14:57, Danylo Piliaiev  wrote:

Make xlease automatically enabled only if xcb-randr >= 1.13,
check its version if manually enabled.

Enable VK_EXT_display_control only when libdrm >= 2.4.89

Check for DRM_EVENT_CONTEXT_VERSION >= 4 to use sequence_handler.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=107170
   https://bugs.freedesktop.org/show_bug.cgi?id=106972
   https://bugs.freedesktop.org/show_bug.cgi?id=107176

v2: - Add 'protect="VK_USE_DISPLAY_CONTROL"' attribute to
VK_EXT_display_control in vk.xml
 - Add support for 'protect' attribute to anv_entrypoints_gen
(copied from radv_entrypoints_gen)
 - Turn #if into #ifdef
 - Remove unnecessary pkg-config call from meson build (Dylan Baker)

v3: by Dylan Baker
 - Remove previously added changes to vk.xml and entrypoints
generation because vk.xml is meant to be pulled from the external
source.

Signed-off-by: Danylo Piliaiev 
---
  configure.ac   | 29 +-
  meson.build| 10 -
  src/amd/vulkan/radv_extensions.py  |  9 +++-
  src/amd/vulkan/radv_wsi_display.c  |  5 ++---
  src/intel/vulkan/anv_extensions.py |  2 +-
  src/intel/vulkan/anv_extensions_gen.py |  7 +++
  src/intel/vulkan/anv_wsi_display.c |  4 ++--
  src/vulkan/wsi/wsi_common_display.c|  8 +--
  src/vulkan/wsi/wsi_common_display.h|  3 ++-
  9 files changed, 51 insertions(+), 26 deletions(-)

diff --git a/configure.ac b/configure.ac
index f135d05736..0b04525014 100644
--- a/configure.ac
+++ b/configure.ac
@@ -82,6 +82,8 @@ LIBDRM_FREEDRENO_REQUIRED=2.4.92
  LIBDRM_ETNAVIV_REQUIRED=2.4.89
  LIBDRM_VC4_REQUIRED=2.4.89

+LIBDRM_CRT_SEQUENCE_REQUIRED=2.4.89
+

There is no need for yet another version - just bump LIBDRM_REQUIRED.

Bumping LIBDRM_REQUIRED would mean that older platforms won't be supported.
I don't know how the decisions about support of older platforms are made 
but
from my point of view bumping required libdrm version due to one vulkan 
extension

may be overkill.

  dnl Versions for external dependencies
  DRI2PROTO_REQUIRED=2.8
  GLPROTO_REQUIRED=1.4.14
@@ -97,6 +99,7 @@ XCBDRI2_REQUIRED=1.8
  XCBDRI3_MODIFIERS_REQUIRED=1.13
  XCBGLX_REQUIRED=1.8.1
  XCBPRESENT_MODIFIERS_REQUIRED=1.13
+XCBRANDR_XLEASE_REQUIRED=1.13

Thinking out loud: I wonder if we cannot use a single variable for all
the xcb 1.13 bits.


  XDAMAGE_REQUIRED=1.1
  XSHMFENCE_REQUIRED=1.1
  XVMC_REQUIRED=1.0.6
@@ -1874,20 +1877,6 @@ if test x"$enable_dri3" = xyes; then
  fi
  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])
-xlib_randr_modules="xrandr"
-PKG_CHECK_MODULES([XLIB_RANDR], [$xlib_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')
@@ -1905,14 +1894,24 @@ xno)
  ;;
  *)
  if echo "$platforms" | grep -q 'x11' && echo "$platforms" | grep -q 
'drm'; then
-enable_xlib_lease=yes
+xlease_modules="x11-xcb xcb-randr >= $XCBRANDR_XLEASE_REQUIRED xrandr"
+PKG_CHECK_EXISTS([$xlease_modules], [enable_xlib_lease=yes], 
[enable_xlib_lease=no])
  else
  enable_xlib_lease=no
  fi
  esac

+if test x"$enable_xlib_lease" = xyes; then
+randr_modules="x11-xcb xcb-randr >= $XCBRANDR_XLEASE_REQUIRED"
+PKG_CHECK_MODULES([XCB_RANDR], [$randr_modules])
+xlib_randr_modules="xrandr"
+PKG_CHECK_MODULES([XLIB_RANDR], [$xlib_randr_modules])
+fi
+
  AM_CONDITIONAL(HAVE_XLIB_LEASE, test "x$enable_xlib_lease" = xyes)

+PKG_CHECK_EXISTS([libdrm >= $LIBDRM_CRT_SEQUENCE_REQUIRED], [DEFINES="${DEFINES} 
-DVK_USE_DISPLAY_CONTROL"], [])
+

Why do we need the new define? From a quick look we should be above to
reuse VK_USE_PLATFORM_DISPLAY_KHR, we simply need the ifdef guards.
If we will not bump global libdrm version requirement new define is 
necessary because
rest of the code guarded by VK_USE_PLATFORM_DISPLAY_KHR works fine with 
older libdrm versions.

The comments are more or less also applicable for meson.

HTH
Emil


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


Re: [Mesa-dev] [PATCH v3] vulkan: Fix compilation on older platforms

2018-07-24 Thread Emil Velikov
Hi Danylo,

On 13 July 2018 at 14:57, Danylo Piliaiev  wrote:
> Make xlease automatically enabled only if xcb-randr >= 1.13,
> check its version if manually enabled.
>
> Enable VK_EXT_display_control only when libdrm >= 2.4.89
>
> Check for DRM_EVENT_CONTEXT_VERSION >= 4 to use sequence_handler.
>
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=107170
>   https://bugs.freedesktop.org/show_bug.cgi?id=106972
>   https://bugs.freedesktop.org/show_bug.cgi?id=107176
>
> v2: - Add 'protect="VK_USE_DISPLAY_CONTROL"' attribute to
>VK_EXT_display_control in vk.xml
> - Add support for 'protect' attribute to anv_entrypoints_gen
>(copied from radv_entrypoints_gen)
> - Turn #if into #ifdef
> - Remove unnecessary pkg-config call from meson build (Dylan Baker)
>
> v3: by Dylan Baker
> - Remove previously added changes to vk.xml and entrypoints
>generation because vk.xml is meant to be pulled from the external
>source.
>
> Signed-off-by: Danylo Piliaiev 
> ---
>  configure.ac   | 29 +-
>  meson.build| 10 -
>  src/amd/vulkan/radv_extensions.py  |  9 +++-
>  src/amd/vulkan/radv_wsi_display.c  |  5 ++---
>  src/intel/vulkan/anv_extensions.py |  2 +-
>  src/intel/vulkan/anv_extensions_gen.py |  7 +++
>  src/intel/vulkan/anv_wsi_display.c |  4 ++--
>  src/vulkan/wsi/wsi_common_display.c|  8 +--
>  src/vulkan/wsi/wsi_common_display.h|  3 ++-
>  9 files changed, 51 insertions(+), 26 deletions(-)
>
> diff --git a/configure.ac b/configure.ac
> index f135d05736..0b04525014 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -82,6 +82,8 @@ LIBDRM_FREEDRENO_REQUIRED=2.4.92
>  LIBDRM_ETNAVIV_REQUIRED=2.4.89
>  LIBDRM_VC4_REQUIRED=2.4.89
>
> +LIBDRM_CRT_SEQUENCE_REQUIRED=2.4.89
> +
There is no need for yet another version - just bump LIBDRM_REQUIRED.

>  dnl Versions for external dependencies
>  DRI2PROTO_REQUIRED=2.8
>  GLPROTO_REQUIRED=1.4.14
> @@ -97,6 +99,7 @@ XCBDRI2_REQUIRED=1.8
>  XCBDRI3_MODIFIERS_REQUIRED=1.13
>  XCBGLX_REQUIRED=1.8.1
>  XCBPRESENT_MODIFIERS_REQUIRED=1.13
> +XCBRANDR_XLEASE_REQUIRED=1.13
Thinking out loud: I wonder if we cannot use a single variable for all
the xcb 1.13 bits.

>  XDAMAGE_REQUIRED=1.1
>  XSHMFENCE_REQUIRED=1.1
>  XVMC_REQUIRED=1.0.6
> @@ -1874,20 +1877,6 @@ if test x"$enable_dri3" = xyes; then
>  fi
>  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])
> -xlib_randr_modules="xrandr"
> -PKG_CHECK_MODULES([XLIB_RANDR], [$xlib_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')
> @@ -1905,14 +1894,24 @@ xno)
>  ;;
>  *)
>  if echo "$platforms" | grep -q 'x11' && echo "$platforms" | grep -q 
> 'drm'; then
> -enable_xlib_lease=yes
> +xlease_modules="x11-xcb xcb-randr >= $XCBRANDR_XLEASE_REQUIRED 
> xrandr"
> +PKG_CHECK_EXISTS([$xlease_modules], [enable_xlib_lease=yes], 
> [enable_xlib_lease=no])
>  else
>  enable_xlib_lease=no
>  fi
>  esac
>
> +if test x"$enable_xlib_lease" = xyes; then
> +randr_modules="x11-xcb xcb-randr >= $XCBRANDR_XLEASE_REQUIRED"
> +PKG_CHECK_MODULES([XCB_RANDR], [$randr_modules])
> +xlib_randr_modules="xrandr"
> +PKG_CHECK_MODULES([XLIB_RANDR], [$xlib_randr_modules])
> +fi
> +
>  AM_CONDITIONAL(HAVE_XLIB_LEASE, test "x$enable_xlib_lease" = xyes)
>
> +PKG_CHECK_EXISTS([libdrm >= $LIBDRM_CRT_SEQUENCE_REQUIRED], 
> [DEFINES="${DEFINES} -DVK_USE_DISPLAY_CONTROL"], [])
> +
Why do we need the new define? From a quick look we should be above to
reuse VK_USE_PLATFORM_DISPLAY_KHR, we simply need the ifdef guards.

The comments are more or less also applicable for meson.

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


[Mesa-dev] [PATCH v3] vulkan: Fix compilation on older platforms

2018-07-13 Thread Danylo Piliaiev
Make xlease automatically enabled only if xcb-randr >= 1.13,
check its version if manually enabled.

Enable VK_EXT_display_control only when libdrm >= 2.4.89

Check for DRM_EVENT_CONTEXT_VERSION >= 4 to use sequence_handler.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=107170
  https://bugs.freedesktop.org/show_bug.cgi?id=106972
  https://bugs.freedesktop.org/show_bug.cgi?id=107176

v2: - Add 'protect="VK_USE_DISPLAY_CONTROL"' attribute to
   VK_EXT_display_control in vk.xml
- Add support for 'protect' attribute to anv_entrypoints_gen
   (copied from radv_entrypoints_gen)
- Turn #if into #ifdef
- Remove unnecessary pkg-config call from meson build (Dylan Baker)

v3: by Dylan Baker
- Remove previously added changes to vk.xml and entrypoints
   generation because vk.xml is meant to be pulled from the external
   source.

Signed-off-by: Danylo Piliaiev 
---
 configure.ac   | 29 +-
 meson.build| 10 -
 src/amd/vulkan/radv_extensions.py  |  9 +++-
 src/amd/vulkan/radv_wsi_display.c  |  5 ++---
 src/intel/vulkan/anv_extensions.py |  2 +-
 src/intel/vulkan/anv_extensions_gen.py |  7 +++
 src/intel/vulkan/anv_wsi_display.c |  4 ++--
 src/vulkan/wsi/wsi_common_display.c|  8 +--
 src/vulkan/wsi/wsi_common_display.h|  3 ++-
 9 files changed, 51 insertions(+), 26 deletions(-)

diff --git a/configure.ac b/configure.ac
index f135d05736..0b04525014 100644
--- a/configure.ac
+++ b/configure.ac
@@ -82,6 +82,8 @@ LIBDRM_FREEDRENO_REQUIRED=2.4.92
 LIBDRM_ETNAVIV_REQUIRED=2.4.89
 LIBDRM_VC4_REQUIRED=2.4.89
 
+LIBDRM_CRT_SEQUENCE_REQUIRED=2.4.89
+
 dnl Versions for external dependencies
 DRI2PROTO_REQUIRED=2.8
 GLPROTO_REQUIRED=1.4.14
@@ -97,6 +99,7 @@ XCBDRI2_REQUIRED=1.8
 XCBDRI3_MODIFIERS_REQUIRED=1.13
 XCBGLX_REQUIRED=1.8.1
 XCBPRESENT_MODIFIERS_REQUIRED=1.13
+XCBRANDR_XLEASE_REQUIRED=1.13
 XDAMAGE_REQUIRED=1.1
 XSHMFENCE_REQUIRED=1.1
 XVMC_REQUIRED=1.0.6
@@ -1874,20 +1877,6 @@ if test x"$enable_dri3" = xyes; then
 fi
 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])
-xlib_randr_modules="xrandr"
-PKG_CHECK_MODULES([XLIB_RANDR], [$xlib_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')
@@ -1905,14 +1894,24 @@ xno)
 ;;
 *)
 if echo "$platforms" | grep -q 'x11' && echo "$platforms" | grep -q 'drm'; 
then
-enable_xlib_lease=yes
+xlease_modules="x11-xcb xcb-randr >= $XCBRANDR_XLEASE_REQUIRED xrandr"
+PKG_CHECK_EXISTS([$xlease_modules], [enable_xlib_lease=yes], 
[enable_xlib_lease=no])
 else
 enable_xlib_lease=no
 fi
 esac
 
+if test x"$enable_xlib_lease" = xyes; then
+randr_modules="x11-xcb xcb-randr >= $XCBRANDR_XLEASE_REQUIRED"
+PKG_CHECK_MODULES([XCB_RANDR], [$randr_modules])
+xlib_randr_modules="xrandr"
+PKG_CHECK_MODULES([XLIB_RANDR], [$xlib_randr_modules])
+fi
+
 AM_CONDITIONAL(HAVE_XLIB_LEASE, test "x$enable_xlib_lease" = xyes)
 
+PKG_CHECK_EXISTS([libdrm >= $LIBDRM_CRT_SEQUENCE_REQUIRED], 
[DEFINES="${DEFINES} -DVK_USE_DISPLAY_CONTROL"], [])
+
 dnl
 dnl More DRI setup
 dnl
diff --git a/meson.build b/meson.build
index 7d12af3d51..902074819c 100644
--- a/meson.build
+++ b/meson.build
@@ -1088,6 +1088,8 @@ _drm_freedreno_ver = '2.4.92'
 _drm_intel_ver = '2.4.75'
 _drm_ver = '2.4.75'
 
+_drm_crt_sequence_ver = '2.4.89'
+
 _libdrm_checks = [
   ['intel', with_dri_i915 or with_gallium_i915],
   ['amdgpu', with_amd_vk or with_gallium_radeonsi],
@@ -1361,11 +1363,17 @@ if with_platform_x11
 dep_xcb_xfixes = dependency('xcb-xfixes')
   endif
   if with_xlib_lease
-dep_xcb_xrandr = dependency('xcb-randr', version : '>= 1.12')
+dep_xcb_xrandr = dependency('xcb-randr', version : '>= 1.13')
 dep_xlib_xrandr = dependency('xrandr', version : '>= 1.3')
   endif
 endif
 
+if with_any_vk
+  if dep_libdrm.version().version_compare('>= ' + _drm_crt_sequence_ver)
+pre_args += '-DVK_USE_DISPLAY_CONTROL'
+  endif
+endif
+
 if get_option('gallium-extra-hud')
   pre_args += '-DHAVE_GALLIUM_EXTRA_HUD=1'
 endif
diff --git a/src/amd/vulkan/radv_extensions.py 
b/src/amd/vulkan/radv_extensions.py
index 094ed3bce3..35b49243a3 100644
--- a/src/amd/vulkan/radv_extensions.py
+++ b/src/amd/vulkan/radv_extensions.py
@@ -92,7 +92,7 @@ EXTENSIONS = [
 Extension('VK_EXT_direct_mode_display',   1, 
'VK_USE_PLATFORM_DISPLAY_KHR'),
 Extension('VK_EXT_acquire_xlib_display',  1, 
'VK_USE_PLATFORM_XLIB_XRANDR_EXT'),