[packages/libva] - updated to 1.1.0; new source URL - added am patch (fixes build with automake 1.13) - added wayland
qboosh
qboosh at pld-linux.org
Sun Feb 17 10:16:40 CET 2013
commit e299214a9b88e2f912582e68c4861a70125efa7c
Author: Jakub Bogusz <qboosh at pld-linux.org>
Date: Sun Feb 17 10:16:45 2013 +0100
- updated to 1.1.0; new source URL
- added am patch (fixes build with automake 1.13)
- added wayland patch (update for Wayland 1.0 API from libva git)
- fine-grained split (separated interfaces with external dependencies)
libva-am.patch | 11 ++
libva-wayland.patch | 382 ++++++++++++++++++++++++++++++++++++++++++++++++++++
libva.spec | 340 ++++++++++++++++++++++++++++++++++++++++++----
3 files changed, 709 insertions(+), 24 deletions(-)
---
diff --git a/libva.spec b/libva.spec
index ca9abdc..2394d8d 100644
--- a/libva.spec
+++ b/libva.spec
@@ -1,24 +1,27 @@
Summary: VAAPI (Video Acceleration API)
Summary(pl.UTF-8): VAAPI (Video Acceleration API) - API akceleracji filmów
Name: libva
-Version: 1.0.15
+Version: 1.1.0
Release: 1
License: MIT
Group: Libraries
-#Source0Download: http://cgit.freedesktop.org/libva/
-Source0: http://cgit.freedesktop.org/libva/snapshot/%{name}-%{version}.tar.bz2
-# Source0-md5: ad8a94ba87ff0563a533c3c142816794
+Source0: http://www.freedesktop.org/software/vaapi/releases/libva/%{name}-%{version}.tar.bz2
+# Source0-md5: 51bb3b8de1de14ea036f68ef5065a932
+Patch0: %{name}-am.patch
+Patch1: %{name}-wayland.patch
URL: http://www.freedesktop.org/wiki/Software/vaapi
+BuildRequires: Mesa-libEGL-devel
BuildRequires: Mesa-libGL-devel
BuildRequires: autoconf >= 2.57
BuildRequires: automake
BuildRequires: libdrm-devel >= 2.4
BuildRequires: libtool
BuildRequires: pkgconfig
+# wayland-client
+BuildRequires: wayland-devel >= 1.0.0
BuildRequires: xorg-lib-libX11-devel
BuildRequires: xorg-lib-libXext-devel
BuildRequires: xorg-lib-libXfixes-devel
-Requires: libdrm >= 2.4
BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
%description
@@ -58,8 +61,206 @@ Static libva libraries.
%description static -l pl.UTF-8
Statyczne biblioteki libva.
+%package drm
+Summary: VAAPI - DRM interface library
+Summary(pl.UTF-8): VAAPI - biblioteka interfejsu DRM
+Group: Libraries
+Requires: %{name} = %{version}-%{release}
+Requires: libdrm >= 2.4
+
+%description drm
+VAAPI - DRM interface library.
+
+%description drm -l pl.UTF-8
+VAAPI - biblioteka interfejsu DRM.
+
+%package drm-devel
+Summary: Header files for VAAPI DRM interface library
+Summary(pl.UTF-8): Pliki nagłówkowe biblioteki interfejsu DRM VAAPI
+Group: Development/Libraries
+Requires: %{name}-devel = %{version}-%{release}
+Requires: %{name}-drm = %{version}-%{release}
+Requires: libdrm-devel >= 2.4
+
+%description drm-devel
+Header files for VAAPI DRM interface library.
+
+%description drm-devel -l pl.UTF-8
+Pliki nagłówkowe biblioteki interfejsu DRM VAAPI.
+
+%package drm-static
+Summary: VAAPI - DRM interface static library
+Summary(pl.UTF-8): VAAPI - statyczna biblioteka interfejsu DRM
+Group: Development/Libraries
+Requires: %{name}-drm-devel = %{version}-%{release}
+
+%description drm-static
+VAAPI - DRM interface static library.
+
+%description drm-static -l pl.UTF-8
+VAAPI - statyczna biblioteka interfejsu DRM.
+
+%package egl
+Summary: VAAPI - EGL interface library
+Summary(pl.UTF-8): VAAPI - biblioteka interfejsu EGL
+Group: Libraries
+Requires: %{name}-x11 = %{version}-%{release}
+
+%description egl
+VAAPI - EGL interface library.
+
+%description egl -l pl.UTF-8
+VAAPI - biblioteka interfejsu EGL.
+
+%package egl-devel
+Summary: Header files for VAAPI EGL interface library
+Summary(pl.UTF-8): Pliki nagłówkowe biblioteki interfejsu EGL VAAPI
+Group: Development/Libraries
+Requires: %{name}-egl = %{version}-%{release}
+Requires: %{name}-x11-devel = %{version}-%{release}
+Requires: EGL-devel
+
+%description egl-devel
+Header files for VAAPI EGL interface library.
+
+%description egl-devel -l pl.UTF-8
+Pliki nagłówkowe biblioteki interfejsu EGL VAAPI.
+
+%package egl-static
+Summary: VAAPI - EGL interface static library
+Summary(pl.UTF-8): VAAPI - statyczna biblioteka interfejsu EGL
+Group: Development/Libraries
+Requires: %{name}-egl-devel = %{version}-%{release}
+
+%description egl-static
+VAAPI - EGL interface static library.
+
+%description egl-static -l pl.UTF-8
+VAAPI - statyczna biblioteka interfejsu EGL.
+
+%package glx
+Summary: VAAPI - GLX interface library
+Summary(pl.UTF-8): VAAPI - biblioteka interfejsu GLX
+Group: Libraries
+Requires: %{name}-x11 = %{version}-%{release}
+
+%description glx
+VAAPI - GLX interface library.
+
+%description glx -l pl.UTF-8
+VAAPI - biblioteka interfejsu GLX.
+
+%package glx-devel
+Summary: Header files for VAAPI GLX interface library
+Summary(pl.UTF-8): Pliki nagłówkowe biblioteki interfejsu GLX VAAPI
+Group: Development/Libraries
+Requires: %{name}-glx = %{version}-%{release}
+Requires: %{name}-x11-devel = %{version}-%{release}
+Requires: OpenGL-GLX-devel
+
+%description glx-devel
+Header files for VAAPI GLX interface library.
+
+%description glx-devel -l pl.UTF-8
+Pliki nagłówkowe biblioteki interfejsu GLX VAAPI.
+
+%package glx-static
+Summary: VAAPI - GLX interface static library
+Summary(pl.UTF-8): VAAPI - statyczna biblioteka interfejsu GLX
+Group: Development/Libraries
+Requires: %{name}-glx-devel = %{version}-%{release}
+
+%description glx-static
+VAAPI - GLX interface static library.
+
+%description glx-static -l pl.UTF-8
+VAAPI - statyczna biblioteka interfejsu GLX.
+
+%package wayland
+Summary: VAAPI - Wayland interface library
+Summary(pl.UTF-8): VAAPI - biblioteka interfejsu Wayland
+Group: Libraries
+Requires: %{name} = %{version}-%{release}
+Requires: wayland >= 1.0.0
+
+%description wayland
+VAAPI - Wayland interface library.
+
+%description wayland -l pl.UTF-8
+VAAPI - biblioteka interfejsu Wayland.
+
+%package wayland-devel
+Summary: Header files for VAAPI Wayland interface library
+Summary(pl.UTF-8): Pliki nagłówkowe biblioteki interfejsu Wayland VAAPI
+Group: Development/Libraries
+Requires: %{name}-devel = %{version}-%{release}
+Requires: %{name}-wayland = %{version}-%{release}
+Requires: wayland-devel >= 1.0.0
+
+%description wayland-devel
+Header files for VAAPI Wayland interface library.
+
+%description wayland-devel -l pl.UTF-8
+Pliki nagłówkowe biblioteki interfejsu Wayland VAAPI.
+
+%package wayland-static
+Summary: VAAPI - Wayland interface static library
+Summary(pl.UTF-8): VAAPI - statyczna biblioteka interfejsu Wayland
+Group: Development/Libraries
+Requires: %{name}-wayland-devel = %{version}-%{release}
+
+%description wayland-static
+VAAPI - Wayland interface static library.
+
+%description wayland-static -l pl.UTF-8
+VAAPI - statyczna biblioteka interfejsu Wayland.
+
+%package x11
+Summary: VAAPI - X11 interface library
+Summary(pl.UTF-8): VAAPI - biblioteka interfejsu X11
+Group: Libraries
+Requires: %{name} = %{version}-%{release}
+Requires: libdrm >= 2.4
+
+%description x11
+VAAPI - X11 interface library.
+
+%description x11 -l pl.UTF-8
+VAAPI - biblioteka interfejsu X11.
+
+%package x11-devel
+Summary: Header files for VAAPI X11 interface library
+Summary(pl.UTF-8): Pliki nagłówkowe biblioteki interfejsu X11 VAAPI
+Group: Development/Libraries
+Requires: %{name}-devel = %{version}-%{release}
+Requires: %{name}-x11 = %{version}-%{release}
+Requires: libdrm-devel >= 2.4
+Requires: xorg-lib-libX11-devel
+Requires: xorg-lib-libXext-devel
+Requires: xorg-lib-libXfixes-devel
+
+%description x11-devel
+Header files for VAAPI X11 interface library.
+
+%description x11-devel -l pl.UTF-8
+Pliki nagłówkowe biblioteki interfejsu X11 VAAPI.
+
+%package x11-static
+Summary: VAAPI - X11 interface static library
+Summary(pl.UTF-8): VAAPI - statyczna biblioteka interfejsu X11
+Group: Development/Libraries
+Requires: %{name}-x11-devel = %{version}-%{release}
+
+%description x11-static
+VAAPI - X11 interface static library.
+
+%description x11-static -l pl.UTF-8
+VAAPI - statyczna biblioteka interfejsu X11.
+
%prep
%setup -q
+%patch0 -p1
+%patch1 -p1
%build
%{__libtoolize}
@@ -85,27 +286,37 @@ rm -rf $RPM_BUILD_ROOT
%clean
rm -rf $RPM_BUILD_ROOT
-%post -p /sbin/ldconfig
-%postun -p /sbin/ldconfig
+%post -p /sbin/ldconfig
+%postun -p /sbin/ldconfig
+
+%post drm -p /sbin/ldconfig
+%postun drm -p /sbin/ldconfig
+
+%post egl -p /sbin/ldconfig
+%postun egl -p /sbin/ldconfig
+
+%post glx -p /sbin/ldconfig
+%postun glx -p /sbin/ldconfig
+
+%post wayland -p /sbin/ldconfig
+%postun wayland -p /sbin/ldconfig
+
+%post x11 -p /sbin/ldconfig
+%postun x11 -p /sbin/ldconfig
%files
%defattr(644,root,root,755)
%doc COPYING NEWS
%attr(755,root,root) %{_bindir}/avcenc
%attr(755,root,root) %{_bindir}/h264encode
+%attr(755,root,root) %{_bindir}/loadjpeg
%attr(755,root,root) %{_bindir}/mpeg2vldemo
%attr(755,root,root) %{_bindir}/putsurface
%attr(755,root,root) %{_bindir}/vainfo
%attr(755,root,root) %{_libdir}/libva.so.*.*.*
%attr(755,root,root) %ghost %{_libdir}/libva.so.1
-%attr(755,root,root) %{_libdir}/libva-egl.so.*.*.*
-%attr(755,root,root) %ghost %{_libdir}/libva-egl.so.1
-%attr(755,root,root) %{_libdir}/libva-glx.so.*.*.*
-%attr(755,root,root) %ghost %{_libdir}/libva-glx.so.1
%attr(755,root,root) %{_libdir}/libva-tpi.so.*.*.*
%attr(755,root,root) %ghost %{_libdir}/libva-tpi.so.1
-%attr(755,root,root) %{_libdir}/libva-x11.so.*.*.*
-%attr(755,root,root) %ghost %{_libdir}/libva-x11.so.1
%dir %{_libdir}/%{name}
%dir %{_libdir}/%{name}/dri
%attr(755,root,root) %{_libdir}/%{name}/dri/dummy_drv_video.so
@@ -113,26 +324,107 @@ rm -rf $RPM_BUILD_ROOT
%files devel
%defattr(644,root,root,755)
%attr(755,root,root) %{_libdir}/libva.so
-%attr(755,root,root) %{_libdir}/libva-egl.so
-%attr(755,root,root) %{_libdir}/libva-glx.so
%attr(755,root,root) %{_libdir}/libva-tpi.so
-%attr(755,root,root) %{_libdir}/libva-x11.so
%{_libdir}/libva.la
-%{_libdir}/libva-egl.la
-%{_libdir}/libva-glx.la
%{_libdir}/libva-tpi.la
-%{_libdir}/libva-x11.la
-%{_includedir}/va
+%dir %{_includedir}/va
+%{_includedir}/va/va.h
+%{_includedir}/va/va_backend.h
+%{_includedir}/va/va_backend_tpi.h
+%{_includedir}/va/va_dec_jpeg.h
+%{_includedir}/va/va_drmcommon.h
+%{_includedir}/va/va_tpi.h
+%{_includedir}/va/va_version.h
%{_pkgconfigdir}/libva.pc
-%{_pkgconfigdir}/libva-egl.pc
-%{_pkgconfigdir}/libva-glx.pc
%{_pkgconfigdir}/libva-tpi.pc
-%{_pkgconfigdir}/libva-x11.pc
%files static
%defattr(644,root,root,755)
%{_libdir}/libva.a
+%{_libdir}/libva-tpi.a
+
+%files drm
+%defattr(644,root,root,755)
+%attr(755,root,root) %{_libdir}/libva-drm.so.*.*.*
+%attr(755,root,root) %ghost %{_libdir}/libva-drm.so.1
+
+%files drm-devel
+%defattr(644,root,root,755)
+%attr(755,root,root) %{_libdir}/libva-drm.so
+%{_libdir}/libva-drm.la
+%{_includedir}/va/va_drm.h
+%{_pkgconfigdir}/libva-drm.pc
+
+%files drm-static
+%defattr(644,root,root,755)
+%{_libdir}/libva-drm.a
+
+%files egl
+%defattr(644,root,root,755)
+%attr(755,root,root) %{_libdir}/libva-egl.so.*.*.*
+%attr(755,root,root) %ghost %{_libdir}/libva-egl.so.1
+
+%files egl-devel
+%defattr(644,root,root,755)
+%attr(755,root,root) %{_libdir}/libva-egl.so
+%{_libdir}/libva-egl.la
+%{_includedir}/va/va_backend_egl.h
+%{_includedir}/va/va_egl.h
+%{_pkgconfigdir}/libva-egl.pc
+
+%files egl-static
+%defattr(644,root,root,755)
%{_libdir}/libva-egl.a
+
+%files glx
+%defattr(644,root,root,755)
+%attr(755,root,root) %{_libdir}/libva-glx.so.*.*.*
+%attr(755,root,root) %ghost %{_libdir}/libva-glx.so.1
+
+%files glx-devel
+%defattr(644,root,root,755)
+%attr(755,root,root) %{_libdir}/libva-glx.so
+%{_libdir}/libva-glx.la
+%{_includedir}/va/va_backend_glx.h
+%{_includedir}/va/va_glx.h
+%{_pkgconfigdir}/libva-glx.pc
+
+%files glx-static
+%defattr(644,root,root,755)
%{_libdir}/libva-glx.a
-%{_libdir}/libva-tpi.a
+
+%files wayland
+%defattr(644,root,root,755)
+%attr(755,root,root) %{_bindir}/putsurface_wayland
+%attr(755,root,root) %{_libdir}/libva-wayland.so.*.*.*
+%attr(755,root,root) %ghost %{_libdir}/libva-wayland.so.1
+
+%files wayland-devel
+%defattr(644,root,root,755)
+%attr(755,root,root) %{_libdir}/libva-wayland.so
+%{_libdir}/libva-wayland.la
+%{_includedir}/va/va_backend_wayland.h
+%{_includedir}/va/va_wayland.h
+%{_pkgconfigdir}/libva-wayland.pc
+
+%files wayland-static
+%defattr(644,root,root,755)
+%{_libdir}/libva-wayland.a
+
+%files x11
+%defattr(644,root,root,755)
+%attr(755,root,root) %{_libdir}/libva-x11.so.*.*.*
+%attr(755,root,root) %ghost %{_libdir}/libva-x11.so.1
+
+%files x11-devel
+%defattr(644,root,root,755)
+%attr(755,root,root) %{_libdir}/libva-x11.so
+%{_libdir}/libva-x11.la
+%{_includedir}/va/va_dri2.h
+%{_includedir}/va/va_dricommon.h
+%{_includedir}/va/va_x11.h
+%{_pkgconfigdir}/libva-x11.pc
+
+%files x11-static
+%defattr(644,root,root,755)
%{_libdir}/libva-x11.a
diff --git a/libva-am.patch b/libva-am.patch
new file mode 100644
index 0000000..134ce30
--- /dev/null
+++ b/libva-am.patch
@@ -0,0 +1,11 @@
+--- libva-1.1.0/configure.ac.orig 2012-10-04 15:30:51.000000000 +0200
++++ libva-1.1.0/configure.ac 2013-02-17 08:40:38.856133006 +0100
+@@ -86,7 +86,7 @@
+ AC_CONFIG_MACRO_DIR([m4])
+ AM_INIT_AUTOMAKE([dist-bzip2])
+
+-AM_CONFIG_HEADER([config.h])
++AC_CONFIG_HEADERS([config.h])
+ m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
+
+ TODAY="`LC_ALL=C date +'%a, %d %b %Y %X %z'`"
diff --git a/libva-wayland.patch b/libva-wayland.patch
new file mode 100644
index 0000000..4a42083
--- /dev/null
+++ b/libva-wayland.patch
@@ -0,0 +1,382 @@
+From eb2ba290f679c6cefe621ee6d9fa4302acbadc51 Mon Sep 17 00:00:00 2001
+From: Rob Bradford <rob at linux.intel.com>
+Date: Fri, 02 Nov 2012 11:39:33 +0000
+Subject: tests: fix printf in putsurface_wayland test
+
+Signed-off-by: Rob Bradford <rob at linux.intel.com>
+---
+diff --git a/test/putsurface/putsurface_common.c b/test/putsurface/putsurface_common.c
+index 06f394f..2116ce4 100644
+--- a/test/putsurface/putsurface_common.c
++++ b/test/putsurface/putsurface_common.c
+@@ -190,7 +190,7 @@ static void* putsurface_thread(void *data)
+ while (surface_id == VA_INVALID_SURFACE)
+ surface_id = get_next_free_surface(&index);
+
+- if (verbose) printf("Thread %x Display surface 0x%p,\n", (unsigned int)drawable, (void *)surface_id);
++ if (verbose) printf("Thread: %p Display surface 0x%x,\n", drawable, surface_id);
+
+ if (multi_thread)
+ upload_surface(va_dpy, surface_id, box_width, row_shift, display_field);
+--
+cgit v0.9.0.2-2-gbebe
+From b1cf861a087234eb797c402040403a538adbe0cc Mon Sep 17 00:00:00 2001
+From: Rob Bradford <rob at linux.intel.com>
+Date: Fri, 02 Nov 2012 10:57:47 +0000
+Subject: wayland: port to 1.0 protocol.
+
+With the change in protocol the hash of globals maintained by the client was
+dropped. Instead we must setup a listener on the registry and get the globals
+in a stream from that.
+
+Signed-off-by: Rob Bradford <rob at linux.intel.com>
+Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne at intel.com>
+---
+diff --git a/configure.ac b/configure.ac
+index de83e35..257964d 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -78,7 +78,7 @@ m4_define([libva_lt_age],
+ m4_define([libdrm_version], [2.4])
+
+ # Wayland minimum version number
+-m4_define([wayland_api_version], [0.95.0])
++m4_define([wayland_api_version], [1.0.0])
+
+ AC_PREREQ(2.57)
+ AC_INIT([libva], [libva_version], [waldo.bastian at intel.com], libva)
+diff --git a/test/common/va_display_wayland.c b/test/common/va_display_wayland.c
+index 332d16d..abcb2b6 100644
+--- a/test/common/va_display_wayland.c
++++ b/test/common/va_display_wayland.c
+@@ -33,42 +33,39 @@
+
+ struct display {
+ struct wl_display *display;
++ struct wl_registry *registry;
+ struct wl_compositor *compositor;
+ struct wl_shell *shell;
+ struct wl_shell_surface *shell_surface;
+ struct wl_surface *surface;
+ unsigned int ref_count;
+ int event_fd;
+- unsigned int event_mask;
+ };
+
+ static struct display *g_display;
+
+ static void
+-display_handle_global(
+- struct wl_display *display,
+- uint32_t id,
+- const char *interface,
+- uint32_t version,
+- void *data
++registry_handle_global(
++ void *data,
++ struct wl_registry *registry,
++ uint32_t id,
++ const char *interface,
++ uint32_t version
+ )
+ {
+ struct display * const d = data;
+
+ if (strcmp(interface, "wl_compositor") == 0)
+- d->compositor = wl_display_bind(display, id, &wl_compositor_interface);
++ d->compositor =
++ wl_registry_bind(registry, id, &wl_compositor_interface, 1);
+ else if (strcmp(interface, "wl_shell") == 0)
+- d->shell = wl_display_bind(display, id, &wl_shell_interface);
++ d->shell = wl_registry_bind(registry, id, &wl_shell_interface, 1);
+ }
+
+-static int
+-event_mask_update(uint32_t mask, void *data)
+-{
+- struct display * const d = data;
+-
+- d->event_mask = mask;
+- return 0;
+-}
++static const struct wl_registry_listener registry_listener = {
++ registry_handle_global,
++ NULL,
++};
+
+ static VADisplay
+ va_open_display_wayland(void)
+@@ -91,9 +88,10 @@ va_open_display_wayland(void)
+ return NULL;
+ }
+ wl_display_set_user_data(d->display, d);
+- wl_display_add_global_listener(d->display, display_handle_global, d);
+- d->event_fd = wl_display_get_fd(d->display, event_mask_update, d);
+- wl_display_iterate(d->display, d->event_mask);
++ d->registry = wl_display_get_registry(d->display);
++ wl_registry_add_listener(d->registry, ®istry_listener, d);
++ d->event_fd = wl_display_get_fd(d->display);
++ wl_display_dispatch(d->display);
+
+ d->ref_count = 1;
+ g_display = d;
+@@ -182,6 +180,7 @@ va_put_surface_wayland(
+ dst_rect->x, dst_rect->y, dst_rect->width, dst_rect->height
+ );
+
++ wl_surface_commit(d->surface);
+ wl_display_flush(d->display);
+ return VA_STATUS_SUCCESS;
+ }
+diff --git a/test/putsurface/putsurface_wayland.c b/test/putsurface/putsurface_wayland.c
+index 3e1d495..b93334d 100644
+--- a/test/putsurface/putsurface_wayland.c
++++ b/test/putsurface/putsurface_wayland.c
+@@ -102,7 +102,7 @@ struct display {
+ struct wl_display *display;
+ struct wl_compositor *compositor;
+ struct wl_shell *shell;
+- uint32_t mask;
++ struct wl_registry *registry;
+ int event_fd;
+ };
+
+@@ -153,7 +153,7 @@ va_put_surface(
+ if (wl_drawable->redraw_pending) {
+ wl_display_flush(d->display);
+ while (wl_drawable->redraw_pending)
+- wl_display_iterate(wl_drawable->display, WL_DISPLAY_READABLE);
++ wl_display_dispatch(wl_drawable->display);
+ }
+
+ va_status = vaGetSurfaceBufferWl(va_dpy, va_surface, VA_FRAME_PICTURE, &buffer);
+@@ -169,35 +169,33 @@ va_put_surface(
+ wl_display_flush(d->display);
+ wl_drawable->redraw_pending = 1;
+ callback = wl_surface_frame(wl_drawable->surface);
++ wl_surface_commit(wl_drawable->surface);
+ wl_callback_add_listener(callback, &frame_callback_listener, wl_drawable);
+ return VA_STATUS_SUCCESS;
+ }
+
+ static void
+-display_handle_global(
+- struct wl_display *display,
+- uint32_t id,
+- const char *interface,
+- uint32_t version,
+- void *data
++registry_handle_global(
++ void *data,
++ struct wl_registry *registry,
++ uint32_t id,
++ const char *interface,
++ uint32_t version
+ )
+ {
+ struct display * const d = data;
+
+ if (strcmp(interface, "wl_compositor") == 0)
+- d->compositor = wl_display_bind(display, id, &wl_compositor_interface);
++ d->compositor =
++ wl_registry_bind(registry, id, &wl_compositor_interface, 1);
+ else if (strcmp(interface, "wl_shell") == 0)
+- d->shell = wl_display_bind(display, id, &wl_shell_interface);
++ d->shell = wl_registry_bind(registry, id, &wl_shell_interface, 1);
+ }
+
+-static int
+-event_mask_update(uint32_t mask, void *data)
+-{
+- struct display * const d = data;
+-
+- d->mask = mask;
+- return 0;
+-}
++static const struct wl_registry_listener registry_listener = {
++ registry_handle_global,
++ NULL,
++};
+
+ static void *
+ open_display(void)
+@@ -213,9 +211,10 @@ open_display(void)
+ return NULL;
+
+ wl_display_set_user_data(d->display, d);
+- wl_display_add_global_listener(d->display, display_handle_global, d);
+- d->event_fd = wl_display_get_fd(d->display, event_mask_update, d);
+- wl_display_iterate(d->display, d->mask);
++ d->registry = wl_display_get_registry(d->display);
++ wl_registry_add_listener(d->registry, ®istry_listener, d);
++ d->event_fd = wl_display_get_fd(d->display);
++ wl_display_dispatch(d->display);
+ return d->display;
+ }
+
+@@ -298,9 +297,6 @@ check_window_event(
+ if (check_event == 0)
+ return 0;
+
+- if (!(d->mask & WL_DISPLAY_READABLE))
+- return 0;
+-
+ tv.tv_sec = 0;
+ tv.tv_usec = 0;
+ do {
+@@ -313,7 +309,7 @@ check_window_event(
+ break;
+ }
+ if (retval == 1)
+- wl_display_iterate(d->display, WL_DISPLAY_READABLE);
++ wl_display_dispatch(d->display);
+ } while (retval > 0);
+
+ #if 0
+diff --git a/va/wayland/va_wayland_drm.c b/va/wayland/va_wayland_drm.c
+index 30c3953..d292316 100644
+--- a/va/wayland/va_wayland_drm.c
++++ b/va/wayland/va_wayland_drm.c
+@@ -44,6 +44,7 @@ typedef struct va_wayland_drm_context {
+ struct va_wayland_context base;
+ void *handle;
+ struct wl_drm *drm;
++ struct wl_registry *registry;
+ void *drm_interface;
+ unsigned int is_authenticated : 1;
+ } VADisplayContextWaylandDRM;
+@@ -142,6 +143,28 @@ va_wayland_drm_destroy(VADisplayContextP pDisplayContext)
+ }
+ }
+
++static void
++registry_handle_global(
++ void *data,
++ struct wl_registry *registry,
++ uint32_t id,
++ const char *interface,
++ uint32_t version
++)
++{
++ struct va_wayland_drm_context *wl_drm_ctx = data;
++
++ if (strcmp(interface, "wl_drm") == 0) {
++ wl_drm_ctx->drm =
++ wl_registry_bind(wl_drm_ctx->registry, id, wl_drm_ctx->drm_interface, 1);
++ }
++}
++
++static const struct wl_registry_listener registry_listener = {
++ registry_handle_global,
++ NULL,
++};
++
+ bool
+ va_wayland_drm_create(VADisplayContextP pDisplayContext)
+ {
+@@ -168,14 +191,6 @@ va_wayland_drm_create(VADisplayContextP pDisplayContext)
+ drm_state->auth_type = 0;
+ ctx->drm_state = drm_state;
+
+- id = wl_display_get_global(ctx->native_dpy, "wl_drm", 1);
+- if (!id) {
+- wl_display_roundtrip(ctx->native_dpy);
+- id = wl_display_get_global(ctx->native_dpy, "wl_drm", 1);
+- if (!id)
+- return false;
+- }
+-
+ wl_drm_ctx->handle = dlopen(LIBWAYLAND_DRM_NAME, RTLD_LAZY|RTLD_LOCAL);
+ if (!wl_drm_ctx->handle)
+ return false;
+@@ -185,8 +200,14 @@ va_wayland_drm_create(VADisplayContextP pDisplayContext)
+ if (!wl_drm_ctx->drm_interface)
+ return false;
+
+- wl_drm_ctx->drm =
+- wl_display_bind(ctx->native_dpy, id, wl_drm_ctx->drm_interface);
++ wl_drm_ctx->registry = wl_display_get_registry(ctx->native_dpy);
++ wl_registry_add_listener(wl_drm_ctx->registry, ®istry_listener, wl_drm_ctx);
++ wl_display_roundtrip(ctx->native_dpy);
++
++ /* registry_handle_global should have been called by the
++ * wl_display_roundtrip above
++ */
++
+ if (!wl_drm_ctx->drm)
+ return false;
+
+diff --git a/va/wayland/va_wayland_emgd.c b/va/wayland/va_wayland_emgd.c
+index 73e6802..cb885d1 100644
+--- a/va/wayland/va_wayland_emgd.c
++++ b/va/wayland/va_wayland_emgd.c
+@@ -40,6 +40,7 @@ typedef struct va_wayland_emgd_context {
+ struct wl_emgd *emgd;
+ void *emgd_interface;
+ unsigned int is_created : 1;
++ struct wl_registry *registry;
+ } VADisplayContextWaylandEMGD;
+
+ static inline void
+@@ -86,6 +87,28 @@ va_wayland_emgd_destroy(VADisplayContextP pDisplayContext)
+ }
+ }
+
++static void
++registry_handle_global(
++ void *data,
++ struct wl_registry *registry,
++ uint32_t id,
++ const char *interface,
++ uint32_t version
++)
++{
++ VADisplayContextWaylandEMGD *wl_emgd_ctx = data;
++
++ if (strcmp(interface, "wl_emgd") == 0) {
++ wl_emgd_ctx->emgd =
++ wl_registry_bind(registry, id, wl_emgd_ctx->emgd_interface, 1);
++ }
++}
++
++static const struct wl_registry_listener registry_listener = {
++ registry_handle_global,
++ NULL,
++};
++
+ bool
+ va_wayland_emgd_create(VADisplayContextP pDisplayContext)
+ {
+@@ -112,14 +135,6 @@ va_wayland_emgd_create(VADisplayContextP pDisplayContext)
+ drm_state->auth_type = 0;
+ ctx->drm_state = drm_state;
+
+- id = wl_display_get_global(ctx->native_dpy, "wl_emgd", 1);
+- if (!id) {
+- wl_display_roundtrip(ctx->native_dpy);
+- id = wl_display_get_global(ctx->native_dpy, "wl_emgd", 1);
+- if (!id)
+- return false;
+- }
+-
+ wl_emgd_ctx->handle = dlopen(LIBWAYLAND_EMGD_NAME, RTLD_LAZY|RTLD_LOCAL);
+ if (!wl_emgd_ctx->handle)
+ return false;
+@@ -129,8 +144,13 @@ va_wayland_emgd_create(VADisplayContextP pDisplayContext)
+ if (!wl_emgd_ctx->emgd_interface)
+ return false;
+
+- wl_emgd_ctx->emgd =
+- wl_display_bind(ctx->native_dpy, id, wl_emgd_ctx->emgd_interface);
++ wl_emgd_ctx->registry = wl_display_get_registry(ctx->native_dpy);
++ wl_registry_add_listener(wl_emgd_ctx->registry, ®istry_listener, wl_emgd_ctx);
++ wl_display_roundtrip(ctx->native_dpy);
++
++ /* registry_handle_global should have been called by the
++ * wl_display_roundtrip above
++ */
+ if (!wl_emgd_ctx->emgd)
+ return false;
+ return true;
+--
+cgit v0.9.0.2-2-gbebe
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/libva.git/commitdiff/e299214a9b88e2f912582e68c4861a70125efa7c
More information about the pld-cvs-commit
mailing list