Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package libva for openSUSE:Factory checked 
in at 2022-10-03 13:44:24
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/libva (Old)
 and      /work/SRC/openSUSE:Factory/.libva.new.2275 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "libva"

Mon Oct  3 13:44:24 2022 rev:66 rq:1007250 version:2.16.0

Changes:
--------
--- /work/SRC/openSUSE:Factory/libva/libva-gl.changes   2022-07-09 
16:59:10.956449194 +0200
+++ /work/SRC/openSUSE:Factory/.libva.new.2275/libva-gl.changes 2022-10-03 
13:44:37.849332113 +0200
@@ -2 +2,30 @@
-Wed Jul  6 03:25:12 UTC 2022 - Soc Virnyl Estela <socvirnyl.est...@gmail.com>
+Thu Sep 29 19:17:18 UTC 2022 - Dirk M??ller <dmuel...@suse.com>
+
+- update to 2.16.0:
+  * add: Add HierarchicalFlag & hierarchical_level_plus1 for AV1e.
+  * dep: Update README.md to remove badge links
+  * dep: Removed waffle-io badge from README to fix broken link
+  * dep: Drop mailing list, IRC and Slack
+  * autotools: use wayland-scanner private-code
+  * autotools: use the wayland-scanner.pc to locate the prog
+  * meson: use wayland-scanner private-code
+  * meson: request native wayland-scanner
+  * meson: use the wayland-scanner.pc to locate the prog
+  * meson: set HAVE_VA_X11 when applicable
+  * style:Correct slight coding style in several new commits
+  * trace: add Linux ftrace mode for va trace
+  * trace: Add missing pthread_mutex_destroy
+  * drm: remove no-longer needed X == X mappings
+  * drm: fallback to drm driver name == va driver name
+  * drm: simplify the mapping table
+  * x11: simplify the mapping table
+
+-------------------------------------------------------------------
+Mon Jul 11 11:19:17 UTC 2022 - Stefan Dirsch <sndir...@suse.com>
+
+- No code changes
+- Update to version 2.15.0 was part of Intel oneVPL GPU Runtime
+  2022Q2 Release 22.4.4
+
+-------------------------------------------------------------------
+Wed Jul  6 03:23:06 UTC 2022 - Soc Virnyl Estela <socvirnyl.est...@gmail.com>
@@ -18 +47 @@
-Tue Mar  1 00:15:06 UTC 2022 - Aaron Stern <ukbeas...@protonmail.com>
+Tue Mar  1 00:07:18 UTC 2022 - Aaron Stern <ukbeas...@protonmail.com>
--- /work/SRC/openSUSE:Factory/libva/libva.changes      2022-07-09 
16:59:10.972449218 +0200
+++ /work/SRC/openSUSE:Factory/.libva.new.2275/libva.changes    2022-10-03 
13:44:37.889332201 +0200
@@ -1,0 +2,29 @@
+Thu Sep 29 19:17:18 UTC 2022 - Dirk M??ller <dmuel...@suse.com>
+
+- update to 2.16.0:
+  * add: Add HierarchicalFlag & hierarchical_level_plus1 for AV1e.
+  * dep: Update README.md to remove badge links
+  * dep: Removed waffle-io badge from README to fix broken link
+  * dep: Drop mailing list, IRC and Slack
+  * autotools: use wayland-scanner private-code
+  * autotools: use the wayland-scanner.pc to locate the prog
+  * meson: use wayland-scanner private-code
+  * meson: request native wayland-scanner
+  * meson: use the wayland-scanner.pc to locate the prog
+  * meson: set HAVE_VA_X11 when applicable
+  * style:Correct slight coding style in several new commits
+  * trace: add Linux ftrace mode for va trace
+  * trace: Add missing pthread_mutex_destroy
+  * drm: remove no-longer needed X == X mappings
+  * drm: fallback to drm driver name == va driver name
+  * drm: simplify the mapping table
+  * x11: simplify the mapping table
+
+-------------------------------------------------------------------
+Mon Jul 11 11:19:17 UTC 2022 - Stefan Dirsch <sndir...@suse.com>
+
+- No code changes
+- Update to version 2.15.0 was part of Intel oneVPL GPU Runtime
+  2022Q2 Release 22.4.4
+
+-------------------------------------------------------------------

Old:
----
  libva-2.15.0.tar.gz

New:
----
  libva-2.16.0.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ libva-gl.spec ++++++
--- /var/tmp/diff_new_pack.6WdK4u/_old  2022-10-03 13:44:39.889336601 +0200
+++ /var/tmp/diff_new_pack.6WdK4u/_new  2022-10-03 13:44:39.897336618 +0200
@@ -23,7 +23,7 @@
 
 Name:           libva-gl
 %define _name   libva
-Version:        2.15.0
+Version:        2.16.0
 Release:        0
 Summary:        Video Acceleration (VA) API
 License:        MIT

++++++ libva.spec ++++++
--- /var/tmp/diff_new_pack.6WdK4u/_old  2022-10-03 13:44:39.921336672 +0200
+++ /var/tmp/diff_new_pack.6WdK4u/_new  2022-10-03 13:44:39.925336680 +0200
@@ -23,7 +23,7 @@
 
 Name:           libva
 %define _name   libva
-Version:        2.15.0
+Version:        2.16.0
 Release:        0
 Summary:        Video Acceleration (VA) API
 License:        MIT

++++++ libva-2.15.0.tar.gz -> libva-2.16.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libva-2.15.0/.github/workflows/freebsd.yml 
new/libva-2.16.0/.github/workflows/freebsd.yml
--- old/libva-2.15.0/.github/workflows/freebsd.yml      2022-06-28 
14:39:46.000000000 +0200
+++ new/libva-2.16.0/.github/workflows/freebsd.yml      2022-09-27 
09:38:26.000000000 +0200
@@ -12,11 +12,11 @@
 
 jobs:
   freebsd:
-    runs-on: macos-10.15
+    runs-on: macos-12
     steps:
     - uses: actions/checkout@v2
     - name: test
-      uses: vmactions/freebsd-vm@v0.1.5
+      uses: vmactions/freebsd-vm@v0
       with:
         prepare: |
           pkg install -y meson pkgconf libdrm libXext libXfixes wayland
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libva-2.15.0/.github/workflows/ubuntu.yml 
new/libva-2.16.0/.github/workflows/ubuntu.yml
--- old/libva-2.15.0/.github/workflows/ubuntu.yml       2022-06-28 
14:39:46.000000000 +0200
+++ new/libva-2.16.0/.github/workflows/ubuntu.yml       2022-09-27 
09:38:26.000000000 +0200
@@ -10,11 +10,28 @@
     - '.github/workflows/**'
     - '!.github/workflows/ubuntu.yml'
 
+env:
+  CFLAGS: -Wall -Werror
+
 jobs:
-  ubuntu-latest:
-    runs-on: ubuntu-latest
+  clang-15:
+    runs-on: ubuntu-22.04
+    env:
+      CC: /usr/bin/clang-15
+      CXX: /usr/bin/clang++-15
+      ASM: /usr/bin/clang-15
     steps:
     - uses: actions/checkout@v2
+    - name: install toolchain
+      run: |
+        if [[ -e $CC && -e $CXX ]]; then \
+          echo "clang-15 already presents in the image"; \
+        else \
+          echo "clang-15 missed in the image, installing from llvm"; \
+          echo "deb [trusted=yes] http://apt.llvm.org/jammy/ 
llvm-toolchain-jammy-15 main" | sudo tee -a /etc/apt/sources.list; \
+          sudo apt-get update; \
+          sudo apt-get install -y --no-install-recommends clang-15; \
+        fi
     - name: install prerequisites
       run: |
         sudo apt-get update
@@ -35,8 +52,8 @@
     - name: install
       run: sudo make install
 
-  ubuntu-20-04:
-    runs-on: ubuntu-20.04
+  ubuntu-22-04:
+    runs-on: ubuntu-22.04
     steps:
     - uses: actions/checkout@v2
     - name: install prerequisites
@@ -59,8 +76,8 @@
     - name: install
       run: sudo make install
 
-  ubuntu-18-04:
-    runs-on: ubuntu-18.04
+  ubuntu-20-04:
+    runs-on: ubuntu-20.04
     steps:
     - uses: actions/checkout@v2
     - name: install prerequisites
@@ -82,3 +99,4 @@
       run: make check
     - name: install
       run: sudo make install
+
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libva-2.15.0/.gitignore new/libva-2.16.0/.gitignore
--- old/libva-2.15.0/.gitignore 2022-06-28 14:39:46.000000000 +0200
+++ new/libva-2.16.0/.gitignore 2022-09-27 09:38:26.000000000 +0200
@@ -30,7 +30,6 @@
 missing
 stamp-h1
 /va/va_version.h
-/va/wayland/wayland-drm-client-protocol-export.c
 /va/wayland/wayland-drm-client-protocol.*
 /doc/Doxyfile
 /doc/html-out
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libva-2.15.0/NEWS new/libva-2.16.0/NEWS
--- old/libva-2.15.0/NEWS       2022-06-28 14:39:46.000000000 +0200
+++ new/libva-2.16.0/NEWS       2022-09-27 09:38:26.000000000 +0200
@@ -1,6 +1,32 @@
-libva NEWS -- summary of user visible changes.  2022-06-28
+libva NEWS -- summary of user visible changes.  2022-09-27
 Copyright (C) 2009-2022 Intel Corporation
 
+version 2.16.0 - 27.Sep.2022
+* add: Add HierarchicalFlag & hierarchical_level_plus1 for AV1e.
+* dep: Update README.md to remove badge links
+* dep: Removed waffle-io badge from README to fix broken link
+* dep: Drop mailing list, IRC and Slack
+* autotools: use wayland-scanner private-code
+* autotools: use the wayland-scanner.pc to locate the prog
+* meson: use wayland-scanner private-code
+* meson: request native wayland-scanner
+* meson: use the wayland-scanner.pc to locate the prog
+* meson: set HAVE_VA_X11 when applicable
+* style:Correct slight coding style in several new commits
+* trace: add Linux ftrace mode for va trace
+* trace: Add missing pthread_mutex_destroy
+* drm: remove no-longer needed X == X mappings
+* drm: fallback to drm driver name == va driver name
+* drm: simplify the mapping table
+* x11: simplify the mapping table
+* android: open() with O_CLOEXEC for device fd
+* android: remove convoluted open_device() helper
+* android: drop va_fool references
+* ci: strengthen ci with -Werror
+* ci: va/x11/nvctl: fix Wdeprecated-non-prototype on close_display
+* ci: add clang-15 coverage and rearrange runners
+* ci: upgrade FreeBSD to 13.1
+
 version 2.15.0 - 28.Jun.2022
 * Add: new display HW attribute to report PCI ID
 * Add: sample depth related parameters for AV1e
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libva-2.15.0/README.md new/libva-2.16.0/README.md
--- old/libva-2.15.0/README.md  2022-06-28 14:39:46.000000000 +0200
+++ new/libva-2.16.0/README.md  2022-09-27 09:38:26.000000000 +0200
@@ -1,7 +1,3 @@
-[![Stories in 
Ready](https://badge.waffle.io/intel/libva.png?label=ready&title=Ready)](http://waffle.io/intel/libva)
-[![Build 
Status](https://travis-ci.org/intel/libva.svg?branch=master)](https://travis-ci.org/intel/libva)
-[![Coverity Scan Build 
Status](https://scan.coverity.com/projects/11605/badge.svg)](https://scan.coverity.com/projects/intel-libva)
-
 # Libva Project
 
 Libva is an implementation for VA-API (Video Acceleration API)
@@ -9,7 +5,7 @@
 VA-API is an open-source library and API specification, which
 provides access to graphics hardware acceleration capabilities
 for video processing. It consists of a main library and
-driver-specific acceleration backends for each supported hardware 
+driver-specific acceleration backends for each supported hardware
 vendor.
 
 If you would like to contribute to libva, check our [Contributing
@@ -26,13 +22,4 @@
 be accessed directly through [github pages
 libva](http://intel.github.io/libva/)
 
-The libva development team can be reached via our [mailing
-list](https://lists.01.org/postorius/lists/intel-vaapi-media.lists.01.org) and 
on IRC
-in channel ##intel-media on [Freenode](https://freenode.net/kb/answer/chat).
-
-We also use [#Slack](https://slack.com) and host [VAAPI Media Slack
-Team](https://intel-media.slack.com).  You can signup by submitting your email 
-address to our [Slack Team invite 
page](https://slack-join-intel-media.herokuapp.com).
-
-Slack complements our other means of communication.  Pick the one that works
-best for you!
+The libva development team can be reached via github issues.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libva-2.15.0/configure.ac 
new/libva-2.16.0/configure.ac
--- old/libva-2.15.0/configure.ac       2022-06-28 14:39:46.000000000 +0200
+++ new/libva-2.16.0/configure.ac       2022-09-27 09:38:26.000000000 +0200
@@ -27,7 +27,7 @@
 # - reset micro version to zero when minor version is incremented
 # - reset minor version to zero when major version is incremented
 m4_define([va_api_major_version], [1])
-m4_define([va_api_minor_version], [15])
+m4_define([va_api_minor_version], [16])
 m4_define([va_api_micro_version], [0])
 
 m4_define([va_api_version],
@@ -325,11 +325,15 @@
 
     if test "$USE_WAYLAND" = "yes"; then
 
-        WAYLAND_PREFIX=`$PKG_CONFIG --variable=prefix wayland-client`
-        AC_PATH_PROG([WAYLAND_SCANNER], [wayland-scanner],,
-                     [${WAYLAND_PREFIX}/bin$PATH_SEPARATOR$PATH])
+        AC_PATH_PROG([WAYLAND_SCANNER], [wayland-scanner])
         if test "x$WAYLAND_SCANNER" = "x"; then
-            AC_MSG_ERROR([wayland-scanner not found: Install it or use 
--disable-wayland])
+            PKG_CHECK_MODULES([WL_SCANNER], [wayland-scanner >= 1.15],
+                [USE_WAYLAND="yes"], [:])
+
+            if test "x$USE_WAYLAND" = "xno" -a "x$enable_wayland" = "xyes"; 
then
+                AC_MSG_ERROR([wayland explicitly enabled, however 
$WL_SCANNER_PKG_ERRORS])
+            fi
+            AC_SUBST(WAYLAND_SCANNER, `$PKG_CONFIG --variable=wayland_scanner 
wayland-scanner`)
         fi
 
         AC_DEFINE([HAVE_VA_WAYLAND], [1],
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libva-2.15.0/meson.build new/libva-2.16.0/meson.build
--- old/libva-2.15.0/meson.build        2022-06-28 14:39:46.000000000 +0200
+++ new/libva-2.16.0/meson.build        2022-09-27 09:38:26.000000000 +0200
@@ -7,7 +7,7 @@
 # - reset micro version to zero when VA-API major or minor version is changed
 project(
   'libva', 'c',
-  version : '2.15.0',
+  version : '2.16.0',
   meson_version : '>= 0.53.0',
   default_options : [ 'warning_level=1',
                       'buildtype=debugoptimized' ])
@@ -19,7 +19,7 @@
 # - reset micro version to zero when minor version is incremented
 # - reset minor version to zero when major version is incremented
 va_api_major_version = 1
-va_api_minor_version = 15
+va_api_minor_version = 16
 va_api_micro_version = 0
 
 va_api_version = '@0@.@1@.@2@'.format(va_api_major_version,
@@ -102,12 +102,13 @@
 if get_option('with_wayland') != 'no'
   wayland_dep = dependency('wayland-client', version : '>= 1.11.0',
                           required : get_option('with_wayland') == 'yes')
-  if wayland_dep.found()
-    wl_prefix = wayland_dep.get_variable(pkgconfig: 'prefix')
-    wl_scanner = find_program('wayland-scanner',
-                             wl_prefix + '/bin/wayland-scanner')
+  wayland_scanner_dep = dependency('wayland-scanner', version : '>= 1.15',
+                                   required : get_option('with_wayland') == 
'yes',
+                                   native : true)
+  if wayland_scanner_dep.found()
+    wl_scanner = find_program(wayland_scanner_dep.get_variable(pkgconfig: 
'wayland_scanner'))
   endif
-  WITH_WAYLAND = wayland_dep.found()
+  WITH_WAYLAND = wayland_dep.found() and wayland_scanner_dep.found()
 endif
 
 va_c_args = []
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libva-2.15.0/va/Android.mk 
new/libva-2.16.0/va/Android.mk
--- old/libva-2.15.0/va/Android.mk      2022-06-28 14:39:46.000000000 +0200
+++ new/libva-2.16.0/va/Android.mk      2022-09-27 09:38:26.000000000 +0200
@@ -41,7 +41,6 @@
 LOCAL_SRC_FILES := \
        va.c \
        va_trace.c \
-       va_fool.c  \
        va_str.c
 
 LOCAL_CFLAGS_32 += \
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libva-2.15.0/va/android/va_android.cpp 
new/libva-2.16.0/va/android/va_android.cpp
--- old/libva-2.15.0/va/android/va_android.cpp  2022-06-28 14:39:46.000000000 
+0200
+++ new/libva-2.16.0/va/android/va_android.cpp  2022-09-27 09:38:26.000000000 
+0200
@@ -28,7 +28,6 @@
 #include "va_backend.h"
 #include "va_internal.h"
 #include "va_trace.h"
-#include "va_fool.h"
 #include "va_android.h"
 #include "va_drmcommon.h"
 #include "va_drm_utils.h"
@@ -44,33 +43,6 @@
 #define CHECK_SYMBOL(func) { if (!func) printf("func %s not found\n", #func); 
return VA_STATUS_ERROR_UNKNOWN; }
 #define DEVICE_NAME "/dev/dri/renderD128"
 
-static int open_device(char *dev_name)
-{
-    struct stat st;
-    int fd;
-
-    if (-1 == stat(dev_name, &st)) {
-        printf("Cannot identify '%s': %d, %s\n",
-               dev_name, errno, strerror(errno));
-        return -1;
-    }
-
-    if (!S_ISCHR(st.st_mode)) {
-        printf("%s is no device\n", dev_name);
-        return -1;
-    }
-
-    fd = open(dev_name, O_RDWR);
-
-    if (-1 == fd) {
-        fprintf(stderr, "Cannot open '%s': %d, %s\n",
-                dev_name, errno, strerror(errno));
-        return -1;
-    }
-
-    return fd;
-}
-
 static int va_DisplayContextIsValid(
     VADisplayContextP pDisplayContext
 )
@@ -106,10 +78,11 @@
     struct drm_state * drm_state = (struct drm_state *)ctx->drm_state;
 
     memset(drm_state, 0, sizeof(*drm_state));
-    drm_state->fd = open_device((char *)DEVICE_NAME);
+    drm_state->fd = open(DEVICE_NAME, O_RDWR | O_CLOEXEC);
 
     if (drm_state->fd < 0) {
-        fprintf(stderr, "can't open DRM devices\n");
+        fprintf(stderr, "Cannot open DRM device '%s': %d, %s\n",
+                DEVICE_NAME, errno, strerror(errno));
         return VA_STATUS_ERROR_UNKNOWN;
     }
     drm_state->auth_type = VA_DRM_AUTH_CUSTOM;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libva-2.15.0/va/drm/va_drm_utils.c 
new/libva-2.16.0/va/drm/va_drm_utils.c
--- old/libva-2.15.0/va/drm/va_drm_utils.c      2022-06-28 14:39:46.000000000 
+0200
+++ new/libva-2.16.0/va/drm/va_drm_utils.c      2022-09-27 09:38:26.000000000 
+0200
@@ -32,45 +32,67 @@
 
 struct driver_name_map {
     const char *key;
-    int         key_len;
     const char *name;
 };
 
 static const struct driver_name_map g_driver_name_map[] = {
-    { "i915",       4, "iHD"    }, // Intel Media driver
-    { "i915",       4, "i965"   }, // Intel OTC GenX driver
-    { "pvrsrvkm",   8, "pvr"    }, // Intel UMG PVR driver
-    { "emgd",       4, "emgd"   }, // Intel ECG PVR driver
-    { "hybrid",     6, "hybrid" }, // Intel OTC Hybrid driver
-    { "nouveau",    7, "nouveau"  }, // Mesa Gallium driver
-    { "radeon",     6, "r600"     }, // Mesa Gallium driver
-    { "amdgpu",     6, "radeonsi" }, // Mesa Gallium driver
-    { "nvidia-drm",10, "nvidia"   }, // NVIDIA driver
-    { NULL,         0, NULL }
+    { "i915",       "iHD"    }, // Intel Media driver
+    { "i915",       "i965"   }, // Intel OTC GenX driver
+    { "pvrsrvkm",   "pvr"    }, // Intel UMG PVR driver
+    { "radeon",     "r600"     }, // Mesa Gallium driver
+    { "amdgpu",     "radeonsi" }, // Mesa Gallium driver
+    { "nvidia-drm", "nvidia"   }, // NVIDIA driver
+    { NULL,         NULL }
 };
 
+static char *
+va_DRM_GetDrmDriverName(int fd)
+{
+    drmVersionPtr drm_version = drmGetVersion(fd);
+    char *driver_name;
+
+    if (!drm_version)
+        return NULL;
+
+    driver_name = strdup(drm_version->name);
+    drmFreeVersion(drm_version);
+
+    return driver_name;
+}
+
 /* Returns the VA driver candidate num for the active display*/
 VAStatus
 VA_DRM_GetNumCandidates(VADriverContextP ctx, int * num_candidates)
 {
     struct drm_state * const drm_state = ctx->drm_state;
-    drmVersionPtr drm_version;
     int count = 0;
     const struct driver_name_map *m = NULL;
+    char *driver_name;
+
     if (!drm_state || drm_state->fd < 0)
         return VA_STATUS_ERROR_INVALID_DISPLAY;
-    drm_version = drmGetVersion(drm_state->fd);
-    if (!drm_version)
+
+    driver_name = va_DRM_GetDrmDriverName(drm_state->fd);
+    if (!driver_name)
         return VA_STATUS_ERROR_UNKNOWN;
+
     for (m = g_driver_name_map; m->key != NULL; m++) {
-        if (drm_version->name_len >= m->key_len &&
-            strncmp(drm_version->name, m->key, m->key_len) == 0) {
+        if (strcmp(m->key, driver_name) == 0) {
             count ++;
         }
     }
-    drmFreeVersion(drm_version);
+
+    free(driver_name);
+
+    /*
+     * If the drm driver name does not have a mapped vaapi driver name, then
+     * assume they have the same name.
+     */
+    if (count == 0)
+        count = 1;
+
     *num_candidates = count;
-    return count ? VA_STATUS_SUCCESS : VA_STATUS_ERROR_UNKNOWN;
+    return VA_STATUS_SUCCESS;
 }
 
 /* Returns the VA driver name for the active display */
@@ -78,8 +100,6 @@
 VA_DRM_GetDriverName(VADriverContextP ctx, char **driver_name_ptr, int 
candidate_index)
 {
     struct drm_state * const drm_state = ctx->drm_state;
-    drmVersionPtr drm_version;
-    char *driver_name = NULL;
     const struct driver_name_map *m;
     int current_index = 0;
 
@@ -88,29 +108,32 @@
     if (!drm_state || drm_state->fd < 0)
         return VA_STATUS_ERROR_INVALID_DISPLAY;
 
-    drm_version = drmGetVersion(drm_state->fd);
-    if (!drm_version)
+    *driver_name_ptr = va_DRM_GetDrmDriverName(drm_state->fd);
+    if (!*driver_name_ptr)
         return VA_STATUS_ERROR_UNKNOWN;
 
     for (m = g_driver_name_map; m->key != NULL; m++) {
-        if (drm_version->name_len >= m->key_len &&
-            strncmp(drm_version->name, m->key, m->key_len) == 0) {
+        if (strcmp(m->key, *driver_name_ptr) == 0) {
             if (current_index == candidate_index) {
                 break;
             }
             current_index ++;
         }
     }
-    drmFreeVersion(drm_version);
 
+    /*
+     * If the drm driver name does not have a mapped vaapi driver name, then
+     * assume they have the same name.
+     */
     if (!m->name)
-        return VA_STATUS_ERROR_UNKNOWN;
+        return VA_STATUS_SUCCESS;
 
-    driver_name = strdup(m->name);
-    if (!driver_name)
+    /* Use the mapped vaapi driver name */
+    free(*driver_name_ptr);
+    *driver_name_ptr = strdup(m->name);
+    if (!*driver_name_ptr)
         return VA_STATUS_ERROR_ALLOCATION_FAILED;
 
-    *driver_name_ptr = driver_name;
     return VA_STATUS_SUCCESS;
 }
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libva-2.15.0/va/meson.build 
new/libva-2.16.0/va/meson.build
--- old/libva-2.15.0/va/meson.build     2022-06-28 14:39:46.000000000 +0200
+++ new/libva-2.16.0/va/meson.build     2022-09-27 09:38:26.000000000 +0200
@@ -101,9 +101,10 @@
   deps = [ libdrm_dep ]
 
   libva_drm_args = []
-  if get_option('with_x11') != 'no' and x11_dep.found()
+  if WITH_X11
     libva_drm_sources += [ 'drm/va_drm_auth_x11.c' ]
     libva_drm_args += [
+      '-DHAVE_VA_X11',
       '-DLIBVA_MAJOR_VERSION=@0@'.format(libva_major_version)
     ]
     deps += [ x11_dep ]
@@ -238,7 +239,7 @@
       'wayland-drm-client-protocol.c',
       output : 'wayland-drm-client-protocol.c',
       input : 'wayland/wayland-drm.xml',
-      command : [wl_scanner, 'code', '@INPUT@', '@OUTPUT@']),
+      command : [wl_scanner, 'private-code', '@INPUT@', '@OUTPUT@']),
 
     custom_target(
       'wayland-drm-client-protocol.h',
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libva-2.15.0/va/va.c new/libva-2.16.0/va/va.c
--- old/libva-2.15.0/va/va.c    2022-06-28 14:39:46.000000000 +0200
+++ new/libva-2.16.0/va/va.c    2022-09-27 09:38:26.000000000 +0200
@@ -922,11 +922,13 @@
     CHECK_DISPLAY(dpy);
     ctx = CTX(dpy);
 
+    VA_TRACE_VVVA(dpy, CREATE_CONFIG, TRACE_BEGIN, profile, entrypoint, 
num_attribs, attrib_list);
     vaStatus = ctx->vtable->vaCreateConfig(ctx, profile, entrypoint, 
attrib_list, num_attribs, config_id);
 
     /* record the current entrypoint for further trace/fool determination */
     VA_TRACE_ALL(va_TraceCreateConfig, dpy, profile, entrypoint, attrib_list, 
num_attribs, config_id);
     VA_TRACE_RET(dpy, vaStatus);
+    VA_TRACE_PV(dpy, CREATE_CONFIG, TRACE_END, config_id, vaStatus);
     return vaStatus;
 }
 
@@ -941,10 +943,12 @@
     CHECK_DISPLAY(dpy);
     ctx = CTX(dpy);
 
+    VA_TRACE_V(dpy, DESTROY_CONFIG, TRACE_BEGIN, config_id);
     vaStatus = ctx->vtable->vaDestroyConfig(ctx, config_id);
 
     VA_TRACE_ALL(va_TraceDestroyConfig, dpy, config_id);
     VA_TRACE_RET(dpy, vaStatus);
+    VA_TRACE_V(dpy, DESTROY_CONFIG, TRACE_END, vaStatus);
 
     return vaStatus;
 }
@@ -1139,6 +1143,7 @@
     if (!ctx)
         return VA_STATUS_ERROR_INVALID_DISPLAY;
 
+    VA_TRACE_V(dpy, QUERY_SURFACE_ATTR, TRACE_BEGIN, config);
     if (!ctx->vtable->vaQuerySurfaceAttributes)
         vaStatus = va_impl_query_surface_attributes(ctx, config,
                    attrib_list, num_attribs);
@@ -1148,6 +1153,7 @@
 
     VA_TRACE_LOG(va_TraceQuerySurfaceAttributes, dpy, config, attrib_list, 
num_attribs);
     VA_TRACE_RET(dpy, vaStatus);
+    VA_TRACE_PA(dpy, QUERY_SURFACE_ATTR, TRACE_END, num_attribs, attrib_list);
 
     return vaStatus;
 }
@@ -1172,6 +1178,7 @@
     if (!ctx)
         return VA_STATUS_ERROR_INVALID_DISPLAY;
 
+    VA_TRACE_VVVVA(dpy, CREATE_SURFACE, TRACE_BEGIN, width, height, format, 
num_attribs, attrib_list);
     if (ctx->vtable->vaCreateSurfaces2)
         vaStatus = ctx->vtable->vaCreateSurfaces2(ctx, format, width, height,
                    surfaces, num_surfaces,
@@ -1185,6 +1192,7 @@
                  dpy, width, height, format, num_surfaces, surfaces,
                  attrib_list, num_attribs);
     VA_TRACE_RET(dpy, vaStatus);
+    VA_TRACE_VVA(dpy, CREATE_SURFACE, TRACE_END, vaStatus, num_surfaces, 
surfaces);
 
     return vaStatus;
 }
@@ -1202,11 +1210,13 @@
     CHECK_DISPLAY(dpy);
     ctx = CTX(dpy);
 
+    VA_TRACE_VA(dpy, DESTROY_SURFACE, TRACE_BEGIN, num_surfaces, surface_list);
     VA_TRACE_LOG(va_TraceDestroySurfaces,
                  dpy, surface_list, num_surfaces);
 
     vaStatus = ctx->vtable->vaDestroySurfaces(ctx, surface_list, num_surfaces);
     VA_TRACE_RET(dpy, vaStatus);
+    VA_TRACE_V(dpy, DESTROY_SURFACE, TRACE_END, vaStatus);
 
     return vaStatus;
 }
@@ -1228,12 +1238,14 @@
     CHECK_DISPLAY(dpy);
     ctx = CTX(dpy);
 
+    VA_TRACE_VVVVVA(dpy, CREATE_CONTEXT, TRACE_BEGIN, config_id, 
picture_width, picture_height, flag, num_render_targets, render_targets);
     vaStatus = ctx->vtable->vaCreateContext(ctx, config_id, picture_width, 
picture_height,
                                             flag, render_targets, 
num_render_targets, context);
 
     /* keep current encode/decode resoluton */
     VA_TRACE_ALL(va_TraceCreateContext, dpy, config_id, picture_width, 
picture_height, flag, render_targets, num_render_targets, context);
     VA_TRACE_RET(dpy, vaStatus);
+    VA_TRACE_PV(dpy, CREATE_CONTEXT, TRACE_END, context, vaStatus);
 
     return vaStatus;
 }
@@ -1249,10 +1261,12 @@
     CHECK_DISPLAY(dpy);
     ctx = CTX(dpy);
 
+    VA_TRACE_V(dpy, DESTROY_CONTEXT, TRACE_BEGIN, context);
     vaStatus = ctx->vtable->vaDestroyContext(ctx, context);
 
     VA_TRACE_ALL(va_TraceDestroyContext, dpy, context);
     VA_TRACE_RET(dpy, vaStatus);
+    VA_TRACE_V(dpy, DESTROY_CONTEXT, TRACE_END, vaStatus);
 
     return vaStatus;
 }
@@ -1363,12 +1377,14 @@
     CHECK_DISPLAY(dpy);
     ctx = CTX(dpy);
 
+    VA_TRACE_VVVV(dpy, CREATE_BUFFER, TRACE_BEGIN, context, type, size, 
num_elements);
     vaStatus = ctx->vtable->vaCreateBuffer(ctx, context, type, size, 
num_elements, data, buf_id);
 
     VA_TRACE_LOG(va_TraceCreateBuffer,
                  dpy, context, type, size, num_elements, data, buf_id);
 
     VA_TRACE_RET(dpy, vaStatus);
+    VA_TRACE_PV(dpy, CREATE_BUFFER, TRACE_END, buf_id, vaStatus);
     return vaStatus;
 }
 
@@ -1462,11 +1478,13 @@
     CHECK_DISPLAY(dpy);
     ctx = CTX(dpy);
 
+    VA_TRACE_V(dpy, DESTROY_BUFFER, TRACE_BEGIN, buffer_id);
     VA_TRACE_LOG(va_TraceDestroyBuffer,
                  dpy, buffer_id);
 
     vaStatus = ctx->vtable->vaDestroyBuffer(ctx, buffer_id);
     VA_TRACE_RET(dpy, vaStatus);
+    VA_TRACE_V(dpy, DESTROY_BUFFER, TRACE_END, vaStatus);
     return vaStatus;
 }
 
@@ -1559,10 +1577,12 @@
     CHECK_DISPLAY(dpy);
     ctx = CTX(dpy);
 
+    VA_TRACE_VV(dpy, BEGIN_PICTURE, TRACE_BEGIN, context, render_target);
     VA_TRACE_ALL(va_TraceBeginPicture, dpy, context, render_target);
 
     va_status = ctx->vtable->vaBeginPicture(ctx, context, render_target);
     VA_TRACE_RET(dpy, va_status);
+    VA_TRACE_V(dpy, BEGIN_PICTURE, TRACE_END, va_status);
 
     return va_status;
 }
@@ -1580,10 +1600,13 @@
     CHECK_DISPLAY(dpy);
     ctx = CTX(dpy);
 
+    VA_TRACE_VVA(dpy, RENDER_PICTURE, TRACE_BEGIN, context, num_buffers, 
buffers);
+    VA_TRACE_BUFFERS(dpy, context, num_buffers, buffers);
     VA_TRACE_LOG(va_TraceRenderPicture, dpy, context, buffers, num_buffers);
 
     vaStatus = ctx->vtable->vaRenderPicture(ctx, context, buffers, 
num_buffers);
     VA_TRACE_RET(dpy, vaStatus);
+    VA_TRACE_V(dpy, RENDER_PICTURE, TRACE_END, vaStatus);
     return vaStatus;
 }
 
@@ -1598,11 +1621,13 @@
     CHECK_DISPLAY(dpy);
     ctx = CTX(dpy);
 
+    VA_TRACE_V(dpy, END_PICTURE, TRACE_BEGIN, context);
     VA_TRACE_ALL(va_TraceEndPicture, dpy, context, 0);
     va_status = ctx->vtable->vaEndPicture(ctx, context);
     VA_TRACE_RET(dpy, va_status);
     /* dump surface content */
     VA_TRACE_ALL(va_TraceEndPictureExt, dpy, context, 1);
+    VA_TRACE_V(dpy, END_PICTURE, TRACE_END, va_status);
 
     return va_status;
 }
@@ -1618,9 +1643,11 @@
     CHECK_DISPLAY(dpy);
     ctx = CTX(dpy);
 
+    VA_TRACE_V(dpy, SYNC_SURFACE, TRACE_BEGIN, render_target);
     va_status = ctx->vtable->vaSyncSurface(ctx, render_target);
     VA_TRACE_LOG(va_TraceSyncSurface, dpy, render_target);
     VA_TRACE_RET(dpy, va_status);
+    VA_TRACE_V(dpy, SYNC_SURFACE, TRACE_END, va_status);
 
     return va_status;
 }
@@ -1637,12 +1664,14 @@
     CHECK_DISPLAY(dpy);
     ctx = CTX(dpy);
 
+    VA_TRACE_VV(dpy, SYNC_SURFACE2, TRACE_BEGIN, surface, timeout_ns);
     if (ctx->vtable->vaSyncSurface2)
         va_status = ctx->vtable->vaSyncSurface2(ctx, surface, timeout_ns);
     else
         va_status = VA_STATUS_ERROR_UNIMPLEMENTED;
     VA_TRACE_LOG(va_TraceSyncSurface2, dpy, surface, timeout_ns);
     VA_TRACE_RET(dpy, va_status);
+    VA_TRACE_V(dpy, SYNC_SURFACE2, TRACE_END, va_status);
 
     return va_status;
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libva-2.15.0/va/va_enc_av1.h 
new/libva-2.16.0/va/va_enc_av1.h
--- old/libva-2.15.0/va/va_enc_av1.h    2022-06-28 14:39:46.000000000 +0200
+++ new/libva-2.16.0/va/va_enc_av1.h    2022-09-27 09:38:26.000000000 +0200
@@ -249,7 +249,10 @@
      */
     uint8_t     seq_tier;
 
-    uint8_t     reserved8b;
+    /** \brief Indicates whether or not the encoding is in dyadic hierarchical 
GOP structure.
+     *  value range [0..1].
+     */
+    uint8_t     hierarchical_flag;
 
     /** \brief Period between intra_only frames. */
     uint32_t    intra_period;
@@ -428,7 +431,7 @@
     /**
      * \brief Segment map.
      * Size of this map is indicated by \ref segmentMapDataSize and each 
element
-        * in this map contains the segment id of a particular block.
+     * in this map contains the segment id of a particular block.
      * The element is indexed by raster scan order.
      * The value of each entry should be in the range [0..7], inclusive.
      */
@@ -448,7 +451,7 @@
     VAAV1EncTransformationCount
 } VAEncTransformationTypeAV1;
 
-typedef struct _VAEncWarpedMotionParamsAV1{
+typedef struct _VAEncWarpedMotionParamsAV1 {
 
     /** \brief Specify the type of warped motion. */
     VAEncTransformationTypeAV1  wmtype;
@@ -479,8 +482,7 @@
  *
  */
 typedef union {
-       struct
-       {
+    struct {
         /**
          * \brief Value used as index into ref_frame_idx[] to indicate that 
frame
          * will be included in the reference list.
@@ -526,8 +528,8 @@
 
         /** \brief Reserved bytes for future use, must be zero. */
         uint32_t Reserved    : 11;
-       } fields;
-       uint32_t value;
+    } fields;
+    uint32_t value;
 } VARefFrameCtrlAV1;
 
 /**
@@ -536,8 +538,7 @@
  * This structure conveys picture level parameters.
  *
  */
-typedef struct  _VAEncPictureParameterBufferAV1
-{
+typedef struct  _VAEncPictureParameterBufferAV1 {
     /** \brief AV1 encoder may support SupRes and dynamic scaling function.
      *  For SupRes, underline encoder is responsible to do downscaling.
      *  For dynamic scaling, app should provide the scaled raw source.
@@ -581,7 +582,11 @@
      */
     uint8_t     ref_frame_idx[7];
 
-    uint8_t     reserved8bits0;
+    /** \brief When hierarchical_level_plus1 > 0, hierarchical_level_plus1-1 
indicates
+     *  the current frame's level. If VAEncMiscParameterTemporalLayerStructure
+     *  is valid (number_of_layers >0), hierarchical_level_plus1 shouldn't 
larger than number_of_layers.
+     */
+    uint8_t     hierarchical_level_plus1;
 
     /** \brief primary reference frame.
      *  Index into reference_frames[]
@@ -597,6 +602,7 @@
     /** \brief Corresponds to AV1 syntax element of the same name. */
     uint8_t     refresh_frame_flags;
 
+    /** \brief Reserved bytes for future use, must be zero. */
     uint8_t     reserved8bits1;
 
     /** \brief Suggest which frames to be used as references.
@@ -743,6 +749,7 @@
         uint16_t    value;
     } qmatrix_flags;
 
+    /** \brief Reserved bytes for future use, must be zero. */
     uint16_t reserved16bits1;
 
     union {
@@ -799,6 +806,7 @@
     /** \brief Number of tile rows. */
     uint8_t     tile_rows;
 
+    /** \brief Reserved bytes for future use, must be zero. */
     uint16_t    reserved16bits2;
 
     /** \brief The last tile column or row size needs to be derived. */
@@ -951,6 +959,7 @@
      */
     uint8_t     number_skip_frames;
 
+    /** \brief Reserved bytes for future use, must be zero. */
     uint16_t    reserved16bits3;
 
     /** \brief Indicates the application forced frame size change in bytes.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libva-2.15.0/va/va_trace.c 
new/libva-2.16.0/va/va_trace.c
--- old/libva-2.15.0/va/va_trace.c      2022-06-28 14:39:46.000000000 +0200
+++ new/libva-2.16.0/va/va_trace.c      2022-09-27 09:38:26.000000000 +0200
@@ -52,6 +52,7 @@
 #include <unistd.h>
 #include <sys/time.h>
 #include <errno.h>
+#include <fcntl.h>
 
 #if defined(__linux__)
 #include <sys/syscall.h>
@@ -85,7 +86,9 @@
 /*
  * Env. to debug some issue, e.g. the decode/encode issue in a video 
conference scenerio:
  * .LIBVA_TRACE=log_file: general VA parameters saved into log_file
+ * .LIBVA_TRACE=FTRACE: trace general VA parameters into linux ftrace 
framework, use trace-cmd to capture and parse by tracetool in libva-utils
  * .LIBVA_TRACE_BUFDATA: dump all VA data buffer into log_file
+ *                       when LIBVA_TRACE in FTRACE mode, all data are 
redirected to linux ftrace, finally parsed by tracetool
  * .LIBVA_TRACE_CODEDBUF=coded_clip_file: save the coded clip into file 
coded_clip_file
  * .LIBVA_TRACE_SURFACE=yuv_file: save surface YUV into file yuv_file. Use 
file name to determine
  *                                decode/encode or jpeg surfaces
@@ -190,6 +193,7 @@
     pthread_mutex_t resource_mutex;
     pthread_mutex_t context_mutex;
     VADisplay dpy;
+    int ftrace_fd;
 };
 
 #define LOCK_RESOURCE(pva_trace)                                    \
@@ -263,6 +267,11 @@
 } while (0)
 
 
+#define VA_TRACE_MAX_SIZE          (1024)
+#define VA_TRACE_HEADER_SIZE       (sizeof(uint32_t)*3)
+#define VA_TRACE_ID                (0x45544156)   // VATraceEvent in little 
endian
+#define FTRACE_ENTRY               "/sys/kernel/debug/tracing/trace_marker_raw"
+
 VAStatus vaBufferInfo(
     VADisplay dpy,
     VAContextID context,        /* in */
@@ -772,25 +781,38 @@
     }
 
     pva_trace->dpy = dpy;
+    pva_trace->ftrace_fd = -1;
 
     pthread_mutex_init(&pva_trace->resource_mutex, NULL);
     pthread_mutex_init(&pva_trace->context_mutex, NULL);
 
+
     if (va_parseConfig("LIBVA_TRACE", &env_value[0]) == 0) {
         pva_trace->fn_log_env = strdup(env_value);
-        trace_ctx->plog_file = start_tracing2log_file(pva_trace);
-        if (trace_ctx->plog_file) {
-            trace_ctx->plog_file_list[0] = trace_ctx->plog_file;
-            va_trace_flag = VA_TRACE_FLAG_LOG;
-
-            va_infoMessage(dpy, "LIBVA_TRACE is on, save log into %s\n",
-                           trace_ctx->plog_file->fn_log);
-        } else
-            va_errorMessage(dpy, "Open file %s failed (%s)\n", env_value, 
strerror(errno));
+        if (strcmp(env_value, "FTRACE") == 0) {
+            pva_trace->ftrace_fd = open(FTRACE_ENTRY, O_WRONLY);
+            if (pva_trace->ftrace_fd >= 0) {
+                va_trace_flag = VA_TRACE_FLAG_FTRACE;
+                va_infoMessage(dpy, "LIBVA_TRACE is active in ftrace mode, use 
trace-cmd to capture\n");
+            } else {
+                va_errorMessage(dpy, "Open ftrace entry failed (%s)\n", 
strerror(errno));
+            }
+        } else {
+            trace_ctx->plog_file = start_tracing2log_file(pva_trace);
+            if (trace_ctx->plog_file) {
+                trace_ctx->plog_file_list[0] = trace_ctx->plog_file;
+                va_trace_flag = VA_TRACE_FLAG_LOG;
+
+                va_infoMessage(dpy, "LIBVA_TRACE is on, save log into %s\n",
+                               trace_ctx->plog_file->fn_log);
+            } else {
+                va_errorMessage(dpy, "Open file %s failed (%s)\n", env_value, 
strerror(errno));
+            }
+        }
     }
 
     /* may re-get the global settings for multiple context */
-    if ((va_trace_flag & VA_TRACE_FLAG_LOG) && 
(va_parseConfig("LIBVA_TRACE_BUFDATA", NULL) == 0)) {
+    if ((va_trace_flag & (VA_TRACE_FLAG_LOG | VA_TRACE_FLAG_FTRACE)) && 
(va_parseConfig("LIBVA_TRACE_BUFDATA", NULL) == 0)) {
         va_trace_flag |= VA_TRACE_FLAG_BUFDATA;
 
         va_infoMessage(dpy, "LIBVA_TRACE_BUFDATA is on, dump buffer into log 
file\n");
@@ -906,8 +928,14 @@
         }
     }
     free(pva_trace->ptra_ctx[MAX_TRACE_CTX_NUM]);
+    // close ftrace file if have
+    if (pva_trace->ftrace_fd >= 0) {
+        close(pva_trace->ftrace_fd);
+    }
 
     pva_trace->dpy = NULL;
+    pthread_mutex_destroy(&pva_trace->resource_mutex);
+    pthread_mutex_destroy(&pva_trace->context_mutex);
     free(pva_trace);
     ((VADisplayContextP)dpy)->vatrace = NULL;
 }
@@ -1377,9 +1405,9 @@
     trace_ctx->trace_context = *context;
     TRACE_FUNCNAME(idx);
     va_TraceMsg(trace_ctx, "\tcontext = 0x%08x va_trace_flag 0x%x\n", 
*context, va_trace_flag);
-    va_TraceMsg(trace_ctx, "\tprofile = %d,%s entrypoint = 
%d,%s\n",trace_ctx->trace_profile,
-               
vaProfileStr(trace_ctx->trace_profile),trace_ctx->trace_entrypoint,
-               vaEntrypointStr(trace_ctx->trace_entrypoint));
+    va_TraceMsg(trace_ctx, "\tprofile = %d,%s entrypoint = %d,%s\n", 
trace_ctx->trace_profile,
+                vaProfileStr(trace_ctx->trace_profile), 
trace_ctx->trace_entrypoint,
+                vaEntrypointStr(trace_ctx->trace_entrypoint));
     va_TraceMsg(trace_ctx, "\tconfig = 0x%08x\n", config_id);
     va_TraceMsg(trace_ctx, "\twidth = %d\n", picture_width);
     va_TraceMsg(trace_ctx, "\theight = %d\n", picture_height);
@@ -4183,7 +4211,7 @@
     va_TraceMsg(trace_ctx, 
"\tsegments.seg_flags.bits.segmentation_temporal_update = %d\n", 
p->segments.seg_flags.bits.segmentation_temporal_update);
     va_TraceMsg(trace_ctx, "\tsegments.segment_number = %d\n", 
p->segments.segment_number);
 
-    for (i = 0; i < 8; i++){
+    for (i = 0; i < 8; i++) {
         for (j = 0; j < 8; j++)
             va_TraceMsg(trace_ctx, "\tsegments.feature_data[%d][%d] = %d\n", 
i, j, p->segments.feature_data[i][j]);
     }
@@ -4213,7 +4241,7 @@
     va_TraceMsg(trace_ctx, "\tloop_restoration_flags.bits.lr_unit_shift = 
%d\n", p->loop_restoration_flags.bits.lr_unit_shift);
     va_TraceMsg(trace_ctx, "\tloop_restoration_flags.bits.lr_uv_shift = %d\n", 
p->loop_restoration_flags.bits.lr_uv_shift);
 
-    for (i = 0; i < 7; i++){
+    for (i = 0; i < 7; i++) {
         va_TraceMsg(trace_ctx, "\twm[%d].wmtype= %d\n", i, p->wm[i].wmtype);
         for (j = 0; j < 8; j++)
             va_TraceMsg(trace_ctx, "\twm[%d].wmmat[%d]= %d\n", i, j, 
p->wm[i].wmmat[j]);
@@ -6058,3 +6086,105 @@
     va_TraceMsg(trace_ctx, "=========%s ret = %s, %s \n", funcName, 
vaStatusStr(status), vaErrorStr(status));
     DPY2TRACE_VIRCTX_EXIT(pva_trace);
 }
+
+void va_TraceEvent(
+    VADisplay dpy,
+    unsigned short id,
+    unsigned short opcode,
+    unsigned int num,
+    VAEventData *desc
+)
+{
+    struct va_trace *pva_trace = (struct va_trace 
*)(((VADisplayContextP)dpy)->vatrace);
+    int data[VA_TRACE_MAX_SIZE / sizeof(int)];
+    size_t write_size = 0;
+    char *p_data;
+    int i;
+
+    if (pva_trace == NULL || pva_trace->ftrace_fd < 0) {
+        return;
+    }
+    /* trace event header: 32bit va trace id; 32bit event id + size; 32bit 
opcode */
+    data[0] = VA_TRACE_ID;
+    data[1] = id << 16;
+    data[2] = opcode;
+    /* append event data in scattered list */
+    p_data = (char *)&data[3];
+    write_size = VA_TRACE_HEADER_SIZE;
+    for (i = 0; i < num; i++) {
+        if (write_size + desc[i].size > VA_TRACE_MAX_SIZE) {
+            va_errorMessage(pva_trace->dpy, "error: trace event %d carry too 
big data. max size \n", id, VA_TRACE_MAX_SIZE);
+            break;
+        }
+        if (desc[i].buf) {
+            memcpy(p_data, desc[i].buf, desc[i].size);
+        } else {
+            /*fill with 0xff for null input. 0 could be valid some case. */
+            memset(p_data, 0xff, desc[i].size);
+        }
+        p_data += desc[i].size;
+        write_size += desc[i].size;
+    }
+    if (i == num) {
+        data[1] |= write_size; /* set event data size before write */
+        write_size = write(pva_trace->ftrace_fd, data, write_size);
+    }
+    return;
+}
+
+void va_TraceEventBuffers(
+    VADisplay dpy,
+    VAContextID context,
+    int num_buffers,
+    VABufferID *buffers)
+{
+    struct va_trace *pva_trace = (struct va_trace 
*)(((VADisplayContextP)dpy)->vatrace);
+    VABufferType type;
+    unsigned int size, num;
+    int i;
+
+    if (pva_trace == NULL || pva_trace->ftrace_fd < 0) {
+        return;
+    }
+    for (i = 0; i < num_buffers; i++) {
+        unsigned char *pbuf = NULL;
+        unsigned int total = 0;
+        int data[3];
+        vaBufferInfo(dpy, context, buffers[i], &type, &size, &num);
+        vaMapBuffer(dpy, buffers[i], (void **)&pbuf);
+        if (pbuf == NULL)
+            continue;
+        total = size * num;
+        /* fill buffer dump header */
+        data[0] = type;
+        data[1] = size;
+        data[2] = total;
+        /* apeend buffer data */
+        if (VA_TRACE_HEADER_SIZE + sizeof(data) + total <= VA_TRACE_MAX_SIZE) {
+            /* send in trace info opcode if data is small */
+            VAEventData desc[] = {{data, sizeof(data)}, {pbuf, total}};
+            va_TraceEvent(dpy, BUFFER_DATA, TRACE_INFO, 2, desc);
+        } else {
+            // split buffer data to send in multi trace event
+            VAEventData desc[2] = {{data, sizeof(data)}, {NULL, 0}};
+            unsigned int write_size = 0;
+
+            va_TraceEvent(dpy, BUFFER_DATA, TRACE_BEGIN, 1, desc);
+            desc[0].buf = &write_size;
+            desc[0].size = sizeof(write_size);
+            while (total > 0) {
+                write_size = total;
+                if (write_size > VA_TRACE_MAX_SIZE - VA_TRACE_HEADER_SIZE - 
sizeof(unsigned int)) {
+                    write_size = VA_TRACE_MAX_SIZE - VA_TRACE_HEADER_SIZE - 
sizeof(unsigned int);
+                }
+                desc[1].buf = pbuf;
+                desc[1].size = write_size;
+                va_TraceEvent(dpy, BUFFER_DATA, TRACE_DATA, 2, desc);
+                total -= write_size;
+                pbuf += write_size;
+            }
+            va_TraceEvent(dpy, BUFFER_DATA, TRACE_END, 0, NULL);
+        }
+    }
+    return;
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libva-2.15.0/va/va_trace.h 
new/libva-2.16.0/va/va_trace.h
--- old/libva-2.15.0/va/va_trace.h      2022-06-28 14:39:46.000000000 +0200
+++ new/libva-2.16.0/va/va_trace.h      2022-09-27 09:38:26.000000000 +0200
@@ -40,6 +40,9 @@
 #define VA_TRACE_FLAG_SURFACE         (VA_TRACE_FLAG_SURFACE_DECODE | \
                                        VA_TRACE_FLAG_SURFACE_ENCODE | \
                                        VA_TRACE_FLAG_SURFACE_JPEG)
+#define VA_TRACE_FLAG_FTRACE          0x40
+#define VA_TRACE_FLAG_FTRACE_BUFDATA  (VA_TRACE_FLAG_FTRACE | \
+                                       VA_TRACE_FLAG_BUFDATA)
 
 #define VA_TRACE_LOG(trace_func,...)            \
     if (va_trace_flag & VA_TRACE_FLAG_LOG) {    \
@@ -54,6 +57,183 @@
         va_TraceStatus(dpy, __func__, ret);     \
     }
 
+/** \brief event id definition
+ * identifier of trace event, coresponding the task value in the manifest, 
located in libva-util/tracetool
+ * the trace tool will translate this id to event name, also the trace data 
carried along.
+ * Note: make sure event id definition backward compatible */
+enum {
+    INVALIDE_ID = 0,
+    CREATE_CONFIG = 1,
+    DESTROY_CONFIG,
+    CREATE_CONTEXT,
+    DESTROY_CONTEXT,
+    CREATE_BUFFER,
+    DESTROY_BUFFER,
+    CREATE_SURFACE,
+    DESTROY_SURFACE,
+    BEGIN_PICTURE,
+    RENDER_PICTURE,
+    END_PICTURE,
+    BUFFER_DATA,
+    SYNC_SURFACE,
+    SYNC_SURFACE2,
+    QUERY_SURFACE_ATTR,
+};
+
+/** \brief event opcode definition
+ * identifier of trace event operation, coresponding the opcode value in the 
manifest.
+ * 4 predefined opcode */
+#define TRACE_INFO  0
+#define TRACE_BEGIN 1
+#define TRACE_END   2
+#define TRACE_DATA  3
+
+/** \brief event data structure
+ * structure list to pass event data without copy, each entry contain the 
event data address and size.
+ * va_TraceEvent will write these raw data into ftrace entry */
+typedef struct va_event_data {
+    void *buf;
+    unsigned int size;
+} VAEventData;
+
+
+/** \brief VA_TRACE
+ * trace interface to send out trace event with empty event data. */
+#define VA_TRACE(dpy,id,op) do {                        \
+        if (va_trace_flag & VA_TRACE_FLAG_FTRACE) {     \
+            va_TraceEvent(dpy, id, op, 0, NULL);        \
+        }                                               \
+    } while (0)
+/** \brief VA_TRACE_V
+ * trace interface to send out trace event with 1 data element from variable. 
the variable data type could be 8/16/32/64 bitsize */
+#define VA_TRACE_V(dpy,id,op,v) do {                    \
+        if (va_trace_flag & VA_TRACE_FLAG_FTRACE) {     \
+            VAEventData desc[1] = {{&v, sizeof(v)}};    \
+            va_TraceEvent(dpy, id, op, 1, desc);        \
+        }                                               \
+    } while (0)
+/** \brief VA_TRACE_PV
+ * trace interface to send out trace event with 2 data element, from pointer 
and variable. their data size could be 8/16/32/64 bitsize */
+#define VA_TRACE_PV(dpy,id,op,p,v) do {                 \
+        if (va_trace_flag & VA_TRACE_FLAG_FTRACE) {     \
+            VAEventData desc[2] = {{p, sizeof(*p)},     \
+                                   {&v, sizeof(v)}};    \
+            va_TraceEvent(dpy, id, op, 2, desc);        \
+        }                                               \
+    } while (0)
+/** \brief VA_TRACE_VV
+ * trace interface to send out trace event with 2 data element, both from 
variable. their data size could be 8/16/32/64 bitsize */
+#define VA_TRACE_VV(dpy,id,op,v1,v2) do {               \
+        if (va_trace_flag & VA_TRACE_FLAG_FTRACE) {     \
+            VAEventData desc[2] = {{&v1, sizeof(v1)},   \
+                                   {&v2, sizeof(v2)}};  \
+            va_TraceEvent(dpy, id, op, 2, desc);        \
+        }                                               \
+    } while (0)
+/** \brief VA_TRACE_VVVV
+ * trace interface to send out trace event with 4 data element, all from 
variable. their data size could be 8/16/32/64 bitsize */
+#define VA_TRACE_VVVV(dpy,id,op,v1,v2,v3,v4) do {       \
+        if (va_trace_flag & VA_TRACE_FLAG_FTRACE) {     \
+            VAEventData desc[4] = { {&v1, sizeof(v1)},  \
+                                    {&v2, sizeof(v2)},  \
+                                    {&v3, sizeof(v3)},  \
+                                    {&v4, sizeof(v4)}}; \
+            va_TraceEvent(dpy, id, op, 4, desc);        \
+        }                                               \
+    } while (0)
+/** \brief VA_TRACE_VA
+ * trace interface to send out trace event with a dynamic length array data 
element, array length from variable.
+ * high 16bits of array length is used to set bitssize of array element. */
+#define VA_TRACE_VA(dpy,id,op,n,a) do {                  \
+        if (va_trace_flag & VA_TRACE_FLAG_FTRACE) {      \
+            int num = n | sizeof(*a) << 16;              \
+            VAEventData desc[2] = {{&num, sizeof(num)},  \
+                                   {a, n * sizeof(*a)}}; \
+            va_TraceEvent(dpy, id, op, 2, desc);         \
+        }                                                \
+    } while (0)
+/** \brief VA_TRACE_PA
+ * trace interface to send out trace event with a dynamic length array data 
element, array length from pointer. need check null before set.
+ * high 16bits of array length is used to set bitssize of array element. */
+#define VA_TRACE_PA(dpy,id,op,pn,a) do {                 \
+        if (va_trace_flag & VA_TRACE_FLAG_FTRACE) {      \
+            int num = sizeof(*a) << 16;                  \
+            VAEventData desc[2] = {{&num, sizeof(num)},  \
+                                   {a, 0}};              \
+            if (pn) {                                    \
+                num |= *pn;                              \
+                desc[1].size = (*pn) * sizeof(*a);       \
+            }                                            \
+            va_TraceEvent(dpy, id, op, 2, desc);         \
+        }                                                \
+    } while (0)
+/** \brief VA_TRACE_VVA
+ * trace interface to send out trace event with 1 data element and a dynamic 
length array data element, array length from variable.
+ * high 16bits of array length is used to set bitssize of array element. */
+#define VA_TRACE_VVA(dpy,id,op,v,n,a) do {               \
+        if (va_trace_flag & VA_TRACE_FLAG_FTRACE) {      \
+            int num = n | (sizeof(*a) << 16);            \
+            VAEventData desc[3] = {{&v, sizeof(v)},      \
+                                   {&num, sizeof(num)},  \
+                                   {a, n*sizeof(*a)}};   \
+            va_TraceEvent(dpy, id, op, 3, desc);         \
+        }                                                \
+    } while (0)
+/** \brief VA_TRACE_VVVA
+ * trace interface to send out trace event with 2 data element and a dynamic 
length array data element, array length from variable.
+ * high 16bits of array length is used to set bitssize of array element. */
+#define VA_TRACE_VVVA(dpy,id,op,v1,v2,n,a) do {          \
+        if (va_trace_flag & VA_TRACE_FLAG_FTRACE) {      \
+            int num = n | (sizeof(*a) << 16);            \
+            VAEventData desc[4] = {{&v1, sizeof(v1)},    \
+                                   {&v2, sizeof(v2)},    \
+                                   {&num, sizeof(num)},  \
+                                   {a, n*sizeof(*a)}};   \
+            va_TraceEvent(dpy, id, op, 4, desc);         \
+        }                                                \
+    } while (0)
+/** \brief VA_TRACE_VVVVA
+ * trace interface to send out trace event with 3 data element and a dynamic 
length array data element, array length from variable.
+ * high 16bits of array length is used to set bitssize of array element. */
+#define VA_TRACE_VVVVA(dpy,id,op,v1,v2,v3,n,a) do {      \
+        if (va_trace_flag & VA_TRACE_FLAG_FTRACE) {      \
+            int num = n | (sizeof(*a) << 16);            \
+            VAEventData desc[5] = {{&v1, sizeof(v1)},    \
+                                   {&v2, sizeof(v2)},    \
+                                   {&v3, sizeof(v3)},    \
+                                   {&num, sizeof(num)},  \
+                                   {a, n*sizeof(*a)}};   \
+            va_TraceEvent(dpy, id, op, 5, desc);         \
+        }                                                \
+    } while (0)
+/** \brief VA_TRACE_VVVVVA
+ * trace interface to send out trace event with 4 data elsement and a dynamic 
length array data element, array length from variable.
+ * high 16bits of array length is used to set bitssize of array element. */
+#define VA_TRACE_VVVVVA(dpy,id,op,v1,v2,v3,v4,n,a) do {  \
+        if (va_trace_flag & VA_TRACE_FLAG_FTRACE) {      \
+            int num = n | (sizeof(*a) << 16);            \
+            VAEventData desc[6] = {{&v1, sizeof(v1)},    \
+                                   {&v2, sizeof(v2)},    \
+                                   {&v3, sizeof(v3)},    \
+                                   {&v4, sizeof(v4)},    \
+                                   {&num, sizeof(num)},  \
+                                   {a, n*sizeof(*a)}};   \
+            va_TraceEvent(dpy, id, op, 6, desc);         \
+        }                                                \
+    } while (0)
+
+/* add macro interface to support new data type combination */
+
+
+/** \brief VA_TRACE_BUFFERS
+ * trace interface to dump all data in va buffer ids into trace.
+ * libva-utils will parse buffer into fields according to buffer type */
+#define VA_TRACE_BUFFERS(dpy,ctx,num,buffers) do {                             
               \
+        if ((va_trace_flag & VA_TRACE_FLAG_FTRACE_BUFDATA) == 
VA_TRACE_FLAG_FTRACE_BUFDATA) { \
+            va_TraceEventBuffers(dpy, ctx, num, buffers);                      
               \
+        }                                                                      
               \
+    } while (0)
+
 DLL_HIDDEN
 void va_TraceInit(VADisplay dpy);
 DLL_HIDDEN
@@ -296,6 +476,23 @@
 
 void va_TraceStatus(VADisplay dpy, const char * funcName, VAStatus status);
 
+/** \brief va_TraceEvent
+ * common trace interface to send out trace event with scatterd event data. */
+void va_TraceEvent(
+    VADisplay dpy,
+    unsigned short id,
+    unsigned short opcode,
+    unsigned int num,
+    VAEventData *desc);
+
+/** \brief va_TraceEventBuffers
+ * trace buffer interface to send out data in buffers. */
+void va_TraceEventBuffers(
+    VADisplay dpy,
+    VAContextID context,
+    int num_buffers,
+    VABufferID *buffers);
+
 #ifdef __cplusplus
 }
 #endif
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libva-2.15.0/va/wayland/Makefile.am 
new/libva-2.16.0/va/wayland/Makefile.am
--- old/libva-2.15.0/va/wayland/Makefile.am     2022-06-28 14:39:46.000000000 
+0200
+++ new/libva-2.16.0/va/wayland/Makefile.am     2022-09-27 09:38:26.000000000 
+0200
@@ -45,10 +45,6 @@
        va_wayland_private.h    \
        $(NULL)
 
-protocol_source_export_c = \
-       wayland-drm-client-protocol-export.c    \
-       $(NULL)
-
 protocol_source_c = \
        wayland-drm-client-protocol.c   \
        $(NULL)
@@ -67,18 +63,14 @@
 va_wayland_drm.c: $(protocol_source_h)
 %-client-protocol.h : %.xml
        $(AM_V_GEN)$(WAYLAND_SCANNER) client-header < $< > $@
-%-client-protocol-export.c : %.xml
-       $(AM_V_GEN)$(WAYLAND_SCANNER) code < $< > $@
-%-client-protocol.c: %-client-protocol-export.c
-       $(AM_V_GEN){ echo '#include "sysdeps.h"'; $(SED) \
-               -e 's@WL_EXPORT@DLL_HIDDEN@g' \
-               < $<; } > $@
+%-client-protocol.c : %.xml
+       $(AM_V_GEN)$(WAYLAND_SCANNER) private-code < $< > $@
 
 EXTRA_DIST = \
        wayland-drm.xml         \
        $(NULL)
 
-BUILT_SOURCES = $(protocol_source_h) $(protocol_source_c) 
$(protocol_source_export_c)
+BUILT_SOURCES = $(protocol_source_h) $(protocol_source_c)
 CLEANFILES = $(BUILT_SOURCES)
 
 # Extra clean files so that maintainer-clean removes *everything*
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libva-2.15.0/va/x11/dri2_util.c 
new/libva-2.16.0/va/x11/dri2_util.c
--- old/libva-2.15.0/va/x11/dri2_util.c 2022-06-28 14:39:46.000000000 +0200
+++ new/libva-2.16.0/va/x11/dri2_util.c 2022-09-27 09:38:26.000000000 +0200
@@ -231,7 +231,7 @@
             goto err_out;
 
         if (!VA_DRI2Authenticate(ctx->native_dpy, RootWindow(ctx->native_dpy, 
ctx->x11_screen),
-                                magic))
+                                 magic))
             goto err_out;
     }
     dri_state->base.auth_type = VA_DRI2;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libva-2.15.0/va/x11/va_dricommon.c 
new/libva-2.16.0/va/x11/va_dricommon.c
--- old/libva-2.15.0/va/x11/va_dricommon.c      2022-06-28 14:39:46.000000000 
+0200
+++ new/libva-2.16.0/va/x11/va_dricommon.c      2022-09-27 09:38:26.000000000 
+0200
@@ -71,12 +71,10 @@
         dri_drawable = dri_drawable->next;
     }
 
-    if(dri_state->createDrawable)
-    {
+    if (dri_state->createDrawable) {
         dri_drawable = dri_state->createDrawable(ctx, drawable);
     }
-    if(dri_drawable)
-    {
+    if (dri_drawable) {
         dri_drawable->x_drawable = drawable;
         dri_drawable->is_window = is_window(ctx->native_dpy, drawable);
         dri_drawable->next = dri_state->drawable_hash[index];
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libva-2.15.0/va/x11/va_nvctrl.c 
new/libva-2.16.0/va/x11/va_nvctrl.c
--- old/libva-2.15.0/va/x11/va_nvctrl.c 2022-06-28 14:39:46.000000000 +0200
+++ new/libva-2.16.0/va/x11/va_nvctrl.c 2022-09-27 09:38:26.000000000 +0200
@@ -130,7 +130,8 @@
 #define XNVCTRLSimpleCheckExtension(dpy,i) \
   XextSimpleCheckExtension (dpy, i, nvctrl_extension_name)
 
-static int close_display();
+static XEXT_GENERATE_CLOSE_DISPLAY(close_display, nvctrl_ext_info)
+
 static /* const */ XExtensionHooks nvctrl_extension_hooks = {
     NULL,                               /* create_gc */
     NULL,                               /* copy_gc */
@@ -150,8 +151,6 @@
                                   &nvctrl_extension_hooks,
                                   NV_CONTROL_EVENTS, NVCTRL_EXT_NEED_CHECK)
 
-static XEXT_GENERATE_CLOSE_DISPLAY(close_display, nvctrl_ext_info)
-
 static Bool XNVCTRLQueryVersion(Display *dpy, int *major, int *minor);
 
 /*
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libva-2.15.0/va/x11/va_x11.c 
new/libva-2.16.0/va/x11/va_x11.c
--- old/libva-2.15.0/va/x11/va_x11.c    2022-06-28 14:39:46.000000000 +0200
+++ new/libva-2.16.0/va/x11/va_x11.c    2022-09-27 09:38:26.000000000 +0200
@@ -45,17 +45,16 @@
 
 struct driver_name_map {
     const char *key;
-    int         key_len;
     const char *name;
 };
 
 static const struct driver_name_map g_dri2_driver_name_map[] = {
-    { "i965",       4, "iHD"    }, // Intel iHD  VAAPI driver with i965 DRI 
driver
-    { "i965",       4, "i965"   }, // Intel i965 VAAPI driver with i965 DRI 
driver
-    { "iris",       4, "iHD"    }, // Intel iHD  VAAPI driver with iris DRI 
driver
-    { "iris",       4, "i965"   }, // Intel i965 VAAPI driver with iris DRI 
driver
-    { "crocus",     6, "i965"   }, // Intel i965 VAAPI driver with crocus DRI 
driver
-    { NULL,         0, NULL }
+    { "i965",       "iHD"    }, // Intel iHD  VAAPI driver with i965 DRI driver
+    { "i965",       "i965"   }, // Intel i965 VAAPI driver with i965 DRI driver
+    { "iris",       "iHD"    }, // Intel iHD  VAAPI driver with iris DRI driver
+    { "iris",       "i965"   }, // Intel i965 VAAPI driver with iris DRI driver
+    { "crocus",     "i965"   }, // Intel i965 VAAPI driver with crocus DRI 
driver
+    { NULL,         NULL }
 };
 
 static int va_DisplayContextIsValid(
@@ -102,8 +101,7 @@
         return VA_STATUS_ERROR_UNKNOWN;
 
     for (m = g_dri2_driver_name_map; m->key != NULL; m++) {
-        if (strlen(driver_name) >= m->key_len &&
-            strncmp(driver_name, m->key, m->key_len) == 0) {
+        if (strcmp(m->key, driver_name) == 0) {
             (*num_candidates)++;
         }
     }
@@ -136,8 +134,7 @@
         return VA_STATUS_ERROR_UNKNOWN;
 
     for (m = g_dri2_driver_name_map; m->key != NULL; m++) {
-        if (strlen(*driver_name_ptr) >= m->key_len &&
-            strncmp(*driver_name_ptr, m->key, m->key_len) == 0) {
+        if (strcmp(m->key, *driver_name_ptr) == 0) {
             if (current_index == candidate_index) {
                 break;
             }

Reply via email to