pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/multimedia/libva libva: clean up va_trace.c patch, har...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/48bf4a245d33
branches:  trunk
changeset: 358969:48bf4a245d33
user:      maya <maya%pkgsrc.org@localhost>
date:      Fri Feb 24 16:44:03 2017 +0000

description:
libva: clean up va_trace.c patch, hard-code gallium, appease libtool.

have an else case for the va_trace.c else patch, it seems to work
fine. not sure if the thread id needs to exist for anything, but
provide it anyway.

if we don't hard-code galilum, in the case of nouveau, it'll attempt
to use nouveau - which doesn't define __vaDriverInit_0_39. only gallium
does, so force it.
this way it works without specifying env LIBVA_DRIVER_NAME.

don't use -ldl in the makefile, it makes libtool angry (restoring
old patch-ad), although I haven't checked whether it works without
the patch.

the available.mk file is probably bogus, and I'd really like to only
rule out platforms if a problem shows up (rather than assume one exists),
but I won't change the world order.

tested with mpv --vo=vaapi (after adding libva as a dependency),
nvidia GTX 770 (nouveau) on NetBSD. it claims to be using vaapi and
plays a video fine.

bump PKGREVISION.

diffstat:

 multimedia/libva/Makefile                     |  11 ++-
 multimedia/libva/PLIST                        |   4 +-
 multimedia/libva/available.mk                 |   4 +-
 multimedia/libva/distinfo                     |   6 +-
 multimedia/libva/patches/patch-va_Makefile.am |  67 ++++++++++++++++++++++
 multimedia/libva/patches/patch-va_va.c        |  29 +++++++++
 multimedia/libva/patches/patch-va_va__trace.c |  79 ++++++++++++--------------
 7 files changed, 150 insertions(+), 50 deletions(-)

diffs (truncated from 321 to 300 lines):

diff -r accc81d8a18a -r 48bf4a245d33 multimedia/libva/Makefile
--- a/multimedia/libva/Makefile Fri Feb 24 15:46:14 2017 +0000
+++ b/multimedia/libva/Makefile Fri Feb 24 16:44:03 2017 +0000
@@ -1,8 +1,8 @@
-# $NetBSD: Makefile,v 1.11 2017/02/24 03:25:36 maya Exp $
+# $NetBSD: Makefile,v 1.12 2017/02/24 16:44:03 maya Exp $
 #
 
 DISTNAME=      libva-1.7.3
-PKGREVISION=   1
+PKGREVISION=   2
 CATEGORIES=    multimedia
 MASTER_SITES=  http://www.freedesktop.org/software/vaapi/releases/libva/
 EXTRACT_SUFX=  .tar.bz2
@@ -18,7 +18,7 @@
 
 .include "../../mk/bsd.prefs.mk"
 
-DRIVER_SEARCH_PATH=    ${PREFIX}/lib/xorg/modules/dri
+DRIVER_SEARCH_PATH=    ${X11BASE}/lib/dri
 
 CONFIGURE_ARGS+=       --enable-i965-driver
 CONFIGURE_ARGS+=       --enable-shared
@@ -33,11 +33,14 @@
 PKGCONFIG_OVERRIDE+=   libva-x11.pc.in
 PKGCONFIG_OVERRIDE+=   libva.pc.in
 
-PLIST_VARS+=           egl
 
 pre-configure:
        cd ${WRKSRC} && autoreconf -i
 
+# XXX introduces a circular dependency if this package
+# is a dependency to MesaLib, but seems to work anyway
+# worth checking if it's necessary for anything
+#PLIST_VARS+=          egl
 #.include "../../graphics/MesaLib/buildlink3.mk"
 #.if !empty(MESALIB_SUPPORTS_EGL:Myes)
 #PLIST.egl=            yes
diff -r accc81d8a18a -r 48bf4a245d33 multimedia/libva/PLIST
--- a/multimedia/libva/PLIST    Fri Feb 24 15:46:14 2017 +0000
+++ b/multimedia/libva/PLIST    Fri Feb 24 16:44:03 2017 +0000
@@ -1,4 +1,4 @@
-@comment $NetBSD: PLIST,v 1.6 2017/02/24 03:25:36 maya Exp $
+@comment $NetBSD: PLIST,v 1.7 2017/02/24 16:44:03 maya Exp $
 include/va/va.h
 include/va/va_backend.h
 include/va/va_backend_tpi.h
@@ -22,6 +22,7 @@
 include/va/va_version.h
 include/va/va_vpp.h
 include/va/va_x11.h
+lib/dri/dummy_drv_video.la
 lib/libva-drm.la
 lib/libva-tpi.la
 lib/libva-x11.la
@@ -30,4 +31,3 @@
 lib/pkgconfig/libva-tpi.pc
 lib/pkgconfig/libva-x11.pc
 lib/pkgconfig/libva.pc
-lib/xorg/modules/dri/dummy_drv_video.la
diff -r accc81d8a18a -r 48bf4a245d33 multimedia/libva/available.mk
--- a/multimedia/libva/available.mk     Fri Feb 24 15:46:14 2017 +0000
+++ b/multimedia/libva/available.mk     Fri Feb 24 16:44:03 2017 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: available.mk,v 1.6 2017/02/24 03:25:36 maya Exp $
+# $NetBSD: available.mk,v 1.7 2017/02/24 16:44:03 maya Exp $
 
 .include "../../mk/bsd.prefs.mk"
 
@@ -7,6 +7,8 @@
 # i.e. in mplayer, xine, xbmc etc.  Have a look at buildlink3.mk too.
 
 # The following should be kept up-to-date!
+.if ${OPSYS} == "DragonFly"
+VAAPI_AVAILABLE=       yes
 .if ${OPSYS} == "FreeBSD"
 VAAPI_AVAILABLE=       yes
 .elif ${OPSYS} == "NetBSD"
diff -r accc81d8a18a -r 48bf4a245d33 multimedia/libva/distinfo
--- a/multimedia/libva/distinfo Fri Feb 24 15:46:14 2017 +0000
+++ b/multimedia/libva/distinfo Fri Feb 24 16:44:03 2017 +0000
@@ -1,4 +1,4 @@
-$NetBSD: distinfo,v 1.6 2017/02/24 03:25:36 maya Exp $
+$NetBSD: distinfo,v 1.7 2017/02/24 16:44:03 maya Exp $
 
 SHA1 (libva-1.7.3.tar.bz2) = 18e46f3d5a0e971eb0ec9fe14bc021e69eb13fb8
 RMD160 (libva-1.7.3.tar.bz2) = d29e432f666df9df8b312c45cd7d9ec2f6ef6e3c
@@ -6,5 +6,7 @@
 Size (libva-1.7.3.tar.bz2) = 824490 bytes
 SHA1 (patch-aa) = 3e4966037c46fada25cc869b672a7e78dda5b04b
 SHA1 (patch-ac) = 776cd2f381ec974bf25054b949912a713d832ae3
+SHA1 (patch-va_Makefile.am) = 0bf9bb930bce79994ef060e6ad44cb1bf9eb0773
 SHA1 (patch-va_glx_va__glx__private.h) = daf6552189295a86f1f073ef107b7449e4098251
-SHA1 (patch-va_va__trace.c) = 874c1ec2abd16368fb0df7de57ba17521d08b3c2
+SHA1 (patch-va_va.c) = 6987c93b7be0d2c9fda780b73e48894faaed60f1
+SHA1 (patch-va_va__trace.c) = 4dfdc200e9e34625929612e594d880cff1f6271d
diff -r accc81d8a18a -r 48bf4a245d33 multimedia/libva/patches/patch-va_Makefile.am
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/multimedia/libva/patches/patch-va_Makefile.am     Fri Feb 24 16:44:03 2017 +0000
@@ -0,0 +1,67 @@
+$NetBSD: patch-va_Makefile.am,v 1.1 2017/02/24 16:44:03 maya Exp $
+
+Don't hardcore -ldl
+
+--- va/Makefile.am.orig        2016-11-10 00:34:35.000000000 +0000
++++ va/Makefile.am
+@@ -76,13 +76,13 @@ noinst_HEADERS                     = $(libva_source_h_priv
+ libva_la_SOURCES              = $(libva_source_c)
+ libva_la_LDFLAGS              = $(libva_ldflags)
+ libva_la_DEPENDENCIES         = libva.syms
+-libva_la_LIBADD                       = $(LIBVA_LIBS) -ldl
++libva_la_LIBADD                       = $(LIBVA_LIBS)
+ 
+ lib_LTLIBRARIES                       += libva-tpi.la
+ libva_tpi_la_SOURCES          = va_tpi.c
+ libva_tpi_la_LDFLAGS          = $(LDADD) -no-undefined
+ libva_tpi_la_DEPENDENCIES     = libva.la 
+-libva_tpi_la_LIBADD           = libva.la -ldl
++libva_tpi_la_LIBADD           = libva.la
+ 
+ if USE_DRM
+ SUBDIRS                               += drm
+@@ -91,7 +91,7 @@ libva_drm_la_SOURCES         =
+ libva_drm_la_LDFLAGS          = $(LDADD)
+ libva_drm_la_DEPENDENCIES     = libva.la drm/libva_drm.la
+ libva_drm_la_LIBADD           = libva.la drm/libva_drm.la \
+-      $(LIBVA_LIBS) $(DRM_LIBS) -ldl
++      $(LIBVA_LIBS) $(DRM_LIBS)
+ endif
+ 
+ if USE_X11
+@@ -102,7 +102,7 @@ libva_x11_la_SOURCES               = 
+ libva_x11_la_LDFLAGS          = $(LDADD)
+ libva_x11_la_DEPENDENCIES     = libva.la x11/libva_x11.la
+ libva_x11_la_LIBADD           = libva.la x11/libva_x11.la \
+-      $(LIBVA_LIBS) $(X11_LIBS) $(XEXT_LIBS) $(XFIXES_LIBS) $(DRM_LIBS) -ldl
++      $(LIBVA_LIBS) $(X11_LIBS) $(XEXT_LIBS) $(XFIXES_LIBS) $(DRM_LIBS)
+ endif
+ 
+ if USE_GLX
+@@ -112,7 +112,7 @@ libva_glx_la_SOURCES               =
+ libva_glx_la_LDFLAGS          = $(LDADD)
+ libva_glx_la_DEPENDENCIES     = libva.la glx/libva_glx.la libva-x11.la
+ libva_glx_la_LIBADD           = libva.la glx/libva_glx.la libva-x11.la \
+-      $(GLX_LIBS) -ldl
++      $(GLX_LIBS)
+ endif
+ 
+ if USE_EGL
+@@ -122,7 +122,7 @@ libva_egl_la_SOURCES               =
+ libva_egl_la_LDFLAGS          = $(LDADD)
+ libva_egl_la_DEPENDENCIES     = libva.la egl/libva_egl.la 
+ libva_egl_la_LIBADD           = libva.la egl/libva_egl.la \
+-      $(EGL_LIBS) -ldl
++      $(EGL_LIBS)
+ endif
+ 
+ if USE_WAYLAND
+@@ -132,7 +132,7 @@ libva_wayland_la_SOURCES   =
+ libva_wayland_la_LDFLAGS      = $(LDADD)
+ libva_wayland_la_DEPENDENCIES = libva.la wayland/libva_wayland.la
+ libva_wayland_la_LIBADD               = libva.la wayland/libva_wayland.la \
+-      $(WAYLAND_LIBS) $(DRM_LIBS) -ldl
++      $(WAYLAND_LIBS) $(DRM_LIBS)
+ endif
+ 
+ DIST_SUBDIRS = x11 glx egl drm wayland
diff -r accc81d8a18a -r 48bf4a245d33 multimedia/libva/patches/patch-va_va.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/multimedia/libva/patches/patch-va_va.c    Fri Feb 24 16:44:03 2017 +0000
@@ -0,0 +1,29 @@
+$NetBSD: patch-va_va.c,v 1.1 2017/02/24 16:44:03 maya Exp $
+
+libva can currently (201702) only use gallium, having tested
+for the definition of __vaDriverInit in libraries in DRIVER_SEARCH_PATH
+(see package Makefile).
+
+however, it doesn't guess the right driver name for nouveau, so force
+it to use gallium.
+
+--- va/va.c.orig       2016-11-10 01:04:28.000000000 +0000
++++ va/va.c
+@@ -557,6 +557,17 @@ VAStatus vaInitialize (
+         driver_name = strdup(driver_name_env);
+         vaStatus = VA_STATUS_SUCCESS;
+         va_infoMessage("User requested driver '%s'\n", driver_name);
++    } else {
++      /*
++       * XXX 201702 only gallium works (provides the required __vaDriverInit)
++       * XXX but the correct name is not guessed, so force it.
++       */
++      if (driver_name) /* memory is allocated in va_getDriverName */
++              free(driver_name);
++
++      driver_name = strdup("gallium");
++      vaStatus = VA_STATUS_SUCCESS;
++      va_infoMessage("Using hard-coded gallium driver\n");
+     }
+ 
+     if ((VA_STATUS_SUCCESS == vaStatus) && (driver_name != NULL)) {
diff -r accc81d8a18a -r 48bf4a245d33 multimedia/libva/patches/patch-va_va__trace.c
--- a/multimedia/libva/patches/patch-va_va__trace.c     Fri Feb 24 15:46:14 2017 +0000
+++ b/multimedia/libva/patches/patch-va_va__trace.c     Fri Feb 24 16:44:03 2017 +0000
@@ -1,4 +1,4 @@
-$NetBSD: patch-va_va__trace.c,v 1.1 2017/02/24 03:25:36 maya Exp $
+$NetBSD: patch-va_va__trace.c,v 1.2 2017/02/24 16:44:03 maya Exp $
 
 attempt to provide syscall(__NR_gettid) for most
 systems. inspired by lldb Host.cpp
@@ -18,73 +18,70 @@
  #include <unistd.h>
  #include <time.h>
  #include <errno.h>
-@@ -294,7 +300,13 @@ static void add_trace_config_info(
+@@ -235,6 +241,21 @@ struct va_trace {
+ 
+ /* Prototype declarations (functions defined in va.c) */
+ 
++pid_t get_tid() {
++#if defined(__linux__)
++    return syscall(__NR_gettid);
++#elif defined(__NetBSD__)
++    return _lwp_self();
++#elif defined(__FreeBSD__) || defined(__DragonFly__)
++    return pthread_getthreadid_np();
++#elif defined(__OpenBSD__)
++    return syscall(SYS_getthrid);
++#else
++#warning "Don't know how to get thread id"
++    return 0;
++#endif
++}
++
+ void va_errorMessage(const char *msg, ...);
+ void va_infoMessage(const char *msg, ...);
+ 
+@@ -294,7 +315,7 @@ static void add_trace_config_info(
  {
      struct trace_config_info *pconfig_info;
      int idx = 0;
-+#if defined(__linux__)
-     pid_t thd_id = syscall(__NR_gettid);
-+#elif defined(__NetBSD__)
-+    pid_t thd_id = _lwp_self();
-+#elif defined(__FreeBSD__) || defined(__DragonFly__)
-+    pid_t thd_id = pthread_getthreadid_np();
-+#endif
+-    pid_t thd_id = syscall(__NR_gettid);
++    pid_t thd_id = get_tid();
  
      LOCK_RESOURCE(pva_trace);
  
-@@ -318,7 +330,13 @@ static void delete_trace_config_info(
+@@ -318,7 +339,7 @@ static void delete_trace_config_info(
  {
      struct trace_config_info *pconfig_info;
      int idx = 0;
-+#if defined(__linux__)
-     pid_t thd_id = syscall(__NR_gettid);
-+#elif defined(__NetBSD__)
-+    pid_t thd_id = _lwp_self();
-+#elif defined(__FreeBSD__) || defined(__DragonFly__)
-+    pid_t thd_id = pthread_getthreadid_np();
-+#endif
+-    pid_t thd_id = syscall(__NR_gettid);
++    pid_t thd_id = get_tid();
  
      LOCK_RESOURCE(pva_trace);
  
-@@ -665,7 +683,13 @@ static struct trace_log_file *start_trac
+@@ -665,7 +686,7 @@ static struct trace_log_file *start_trac
  {
      struct trace_log_files_manager *plog_files_mgr = NULL;
      struct trace_log_file *plog_file = NULL;
-+#if defined(__linux__)
-     pid_t thd_id = syscall(__NR_gettid);
-+#elif defined(__NetBSD__)
-+    pid_t thd_id = _lwp_self();
-+#elif defined(__FreeBSD__) || defined(__DragonFly__)
-+    pid_t thd_id = pthread_getthreadid_np();
-+#endif
+-    pid_t thd_id = syscall(__NR_gettid);
++    pid_t thd_id = get_tid();
      int i = 0;
  
      LOCK_RESOURCE(pva_trace);
-@@ -704,7 +728,13 @@ static void refresh_log_file(
+@@ -704,7 +725,7 @@ static void refresh_log_file(
      struct trace_context *ptra_ctx)
  {
      struct trace_log_file *plog_file = NULL;
-+#if defined(__linux__)
-     pid_t thd_id = syscall(__NR_gettid);
-+#elif defined(__NetBSD__)
-+    pid_t thd_id = _lwp_self();
-+#elif defined(__FreeBSD__) || defined(__DragonFly__)
-+    pid_t thd_id = pthread_getthreadid_np();
-+#endif
+-    pid_t thd_id = syscall(__NR_gettid);



Home | Main Index | Thread Index | Old Index