unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [PATCH] gnu: mesa: Add libva input.
@ 2015-04-28 13:14 Taylan Ulrich Bayırlı/Kammer
  2015-04-28 14:14 ` Taylan Ulrich Bayırlı/Kammer
  2015-04-28 14:20 ` 宋文武
  0 siblings, 2 replies; 15+ messages in thread
From: Taylan Ulrich Bayırlı/Kammer @ 2015-04-28 13:14 UTC (permalink / raw)
  To: guix-devel

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: 0002-gnu-mesa-Add-libva-input.patch --]
[-- Type: text/x-diff, Size: 1984 bytes --]

From 8bb21df5e4769797ba915a83643da57168f8dc9d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Taylan=20Ulrich=20Bay=C4=B1rl=C4=B1/Kammer?=
 <taylanbayirli@gmail.com>
Date: Tue, 28 Apr 2015 15:08:47 +0200
Subject: [PATCH 2/3] gnu: mesa: Add libva input.

There is a circular dependency between Mesa and libVA, so we use a
libva-for-mesa package that builds libVA without GLX and EGL support, and use
that for building Mesa.

* gnu/packages/gl.scm (libva-for-mesa): New variable.
(mesa): Add as input.
---
 gnu/packages/gl.scm | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/gnu/packages/gl.scm b/gnu/packages/gl.scm
index a40749e..69dd8b7 100644
--- a/gnu/packages/gl.scm
+++ b/gnu/packages/gl.scm
@@ -21,6 +21,7 @@
 
 (define-module (gnu packages gl)
   #:use-module (ice-9 match)
+  #:use-module (guix build utils)
   #:use-module ((guix licenses) #:prefix l:)
   #:use-module (guix packages)
   #:use-module (guix download)
@@ -37,6 +38,7 @@
   #:use-module (gnu packages xml)
   #:use-module (gnu packages fontutils)
   #:use-module (gnu packages guile)
+  #:use-module (gnu packages video)
   #:use-module (gnu packages xdisorg))
 
 (define-public glu
@@ -159,6 +161,12 @@ Polygon meshes, and Extruded polygon meshes")
 also known as DXTn or DXTC) for Mesa.")
     (license l:expat)))
 
+(define libva-for-mesa
+  (package
+    (inherit libva)
+    (inputs (alist-delete "mesa" (package-inputs libva)))
+    (arguments '(#:configure-flags '("--disable-glx" "--disable-egl")))))
+
 (define-public mesa
   (package
     (name "mesa")
@@ -188,8 +196,7 @@ also known as DXTn or DXTC) for Mesa.")
         ("dri3proto" ,dri3proto)
         ("presentproto" ,presentproto)
         ("expat" ,expat)
-        ;; TODO: Solve circular dependency with libva.
-        ;; ("libva" ,libva)
+        ("libva" ,libva-for-mesa)
         ("libxml2" ,libxml2)
         ;; TODO: Add 'libxml2-python' for OpenGL ES 1.1 and 2.0 support
         ("libxvmc" ,libxvmc)
-- 
2.2.1

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* Re: [PATCH] gnu: mesa: Add libva input.
  2015-04-28 13:14 [PATCH] gnu: mesa: Add libva input Taylan Ulrich Bayırlı/Kammer
@ 2015-04-28 14:14 ` Taylan Ulrich Bayırlı/Kammer
  2015-04-28 14:20 ` 宋文武
  1 sibling, 0 replies; 15+ messages in thread
From: Taylan Ulrich Bayırlı/Kammer @ 2015-04-28 14:14 UTC (permalink / raw)
  To: guix-devel

[-- Attachment #1: Type: text/plain, Size: 94 bytes --]

I forgot to add (name "libva-for-mesa") to the libva-for-mesa package.
Otherwise same patch:


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0002-gnu-mesa-Add-libva-input.patch --]
[-- Type: text/x-diff, Size: 2016 bytes --]

From b169a4b2c8bf838579c1aa1e5bc47df9446b5704 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Taylan=20Ulrich=20Bay=C4=B1rl=C4=B1/Kammer?=
 <taylanbayirli@gmail.com>
Date: Tue, 28 Apr 2015 15:08:47 +0200
Subject: [PATCH 2/3] gnu: mesa: Add libva input.

There is a circular dependency between Mesa and libVA, so we use a
libva-for-mesa package that builds libVA without GLX and EGL support, and use
that for building Mesa.

* gnu/packages/gl.scm (libva-for-mesa): New variable.
(mesa): Add as input.
---
 gnu/packages/gl.scm | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/gnu/packages/gl.scm b/gnu/packages/gl.scm
index a40749e..1d6c0fd 100644
--- a/gnu/packages/gl.scm
+++ b/gnu/packages/gl.scm
@@ -21,6 +21,7 @@
 
 (define-module (gnu packages gl)
   #:use-module (ice-9 match)
+  #:use-module (guix build utils)
   #:use-module ((guix licenses) #:prefix l:)
   #:use-module (guix packages)
   #:use-module (guix download)
@@ -37,6 +38,7 @@
   #:use-module (gnu packages xml)
   #:use-module (gnu packages fontutils)
   #:use-module (gnu packages guile)
+  #:use-module (gnu packages video)
   #:use-module (gnu packages xdisorg))
 
 (define-public glu
@@ -159,6 +161,13 @@ Polygon meshes, and Extruded polygon meshes")
 also known as DXTn or DXTC) for Mesa.")
     (license l:expat)))
 
+(define libva-for-mesa
+  (package
+    (inherit libva)
+    (name "libva-for-mesa")
+    (inputs (alist-delete "mesa" (package-inputs libva)))
+    (arguments '(#:configure-flags '("--disable-glx" "--disable-egl")))))
+
 (define-public mesa
   (package
     (name "mesa")
@@ -188,8 +197,7 @@ also known as DXTn or DXTC) for Mesa.")
         ("dri3proto" ,dri3proto)
         ("presentproto" ,presentproto)
         ("expat" ,expat)
-        ;; TODO: Solve circular dependency with libva.
-        ;; ("libva" ,libva)
+        ("libva" ,libva-for-mesa)
         ("libxml2" ,libxml2)
         ;; TODO: Add 'libxml2-python' for OpenGL ES 1.1 and 2.0 support
         ("libxvmc" ,libxvmc)
-- 
2.2.1


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* Re: [PATCH] gnu: mesa: Add libva input.
  2015-04-28 13:14 [PATCH] gnu: mesa: Add libva input Taylan Ulrich Bayırlı/Kammer
  2015-04-28 14:14 ` Taylan Ulrich Bayırlı/Kammer
@ 2015-04-28 14:20 ` 宋文武
  2015-04-28 20:21   ` Taylan Ulrich Bayırlı/Kammer
  1 sibling, 1 reply; 15+ messages in thread
From: 宋文武 @ 2015-04-28 14:20 UTC (permalink / raw)
  To: Taylan Ulrich Bayırlı/Kammer, guix-devel

"Taylan Ulrich Bayırlı/Kammer" <taylanbayirli@gmail.com> writes:

> From 8bb21df5e4769797ba915a83643da57168f8dc9d Mon Sep 17 00:00:00 2001
> From: =?UTF-8?q?Taylan=20Ulrich=20Bay=C4=B1rl=C4=B1/Kammer?=
>  <taylanbayirli@gmail.com>
> Date: Tue, 28 Apr 2015 15:08:47 +0200
> Subject: [PATCH 2/3] gnu: mesa: Add libva input.
>
> There is a circular dependency between Mesa and libVA, so we use a
> libva-for-mesa package that builds libVA without GLX and EGL support, and use
> that for building Mesa.
>
> * gnu/packages/gl.scm (libva-for-mesa): New variable.
> (mesa): Add as input.
> ---
>  gnu/packages/gl.scm | 11 +++++++++--
>  1 file changed, 9 insertions(+), 2 deletions(-)
>
> diff --git a/gnu/packages/gl.scm b/gnu/packages/gl.scm
> index a40749e..69dd8b7 100644
> --- a/gnu/packages/gl.scm
> +++ b/gnu/packages/gl.scm
> @@ -21,6 +21,7 @@
>  
>  (define-module (gnu packages gl)
>    #:use-module (ice-9 match)
> +  #:use-module (guix build utils)
>    #:use-module ((guix licenses) #:prefix l:)
>    #:use-module (guix packages)
>    #:use-module (guix download)
> @@ -37,6 +38,7 @@
>    #:use-module (gnu packages xml)
>    #:use-module (gnu packages fontutils)
>    #:use-module (gnu packages guile)
> +  #:use-module (gnu packages video)
>    #:use-module (gnu packages xdisorg))
>  
>  (define-public glu
> @@ -159,6 +161,12 @@ Polygon meshes, and Extruded polygon meshes")
>  also known as DXTn or DXTC) for Mesa.")
>      (license l:expat)))
>  
> +(define libva-for-mesa
> +  (package
> +    (inherit libva)
> +    (inputs (alist-delete "mesa" (package-inputs libva)))
> +    (arguments '(#:configure-flags '("--disable-glx" "--disable-egl")))))
> +
>  (define-public mesa
>    (package
>      (name "mesa")
> @@ -188,8 +196,7 @@ also known as DXTn or DXTC) for Mesa.")
>          ("dri3proto" ,dri3proto)
>          ("presentproto" ,presentproto)
>          ("expat" ,expat)
> -        ;; TODO: Solve circular dependency with libva.
> -        ;; ("libva" ,libva)
> +        ("libva" ,libva-for-mesa)
>          ("libxml2" ,libxml2)
>          ;; TODO: Add 'libxml2-python' for OpenGL ES 1.1 and 2.0 support
>          ("libxvmc" ,libxvmc)
> -- 
> 2.2.1
Look good to me, but how does it work?
According to archlinux, it will build 'gallium_drv_video.so',
described as VA-API implementation for gallium.
IIUC, libva may dlopen this gallium_drv_video.so?

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH] gnu: mesa: Add libva input.
  2015-04-28 14:20 ` 宋文武
@ 2015-04-28 20:21   ` Taylan Ulrich Bayırlı/Kammer
  2015-04-29  8:59     ` 宋文武
  2015-04-29 21:12     ` Andreas Enge
  0 siblings, 2 replies; 15+ messages in thread
From: Taylan Ulrich Bayırlı/Kammer @ 2015-04-28 20:21 UTC (permalink / raw)
  To: 宋文武; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 2583 bytes --]

宋文武 <iyzsong@gmail.com> writes:

> Look good to me, but how does it work?
> According to archlinux, it will build 'gallium_drv_video.so',
> described as VA-API implementation for gallium.
> IIUC, libva may dlopen this gallium_drv_video.so?

I had to tinker and research for several hours to be able to answer your
question, but good thing you asked. :-)

Firstly:

I grepped the libva sources for 'dlopen' and found three places it's
used:

- to open libatiadlxx.so, which AFAIUI is a proprietary ATI driver which
  we wouldn't support anyway,

- to open libva-x11.so, which it installs in $prefix/lib; I patched the
  .c file to use the absolute path to this .so, and

- to open drivers found in $LIBVA_DRIVERS_PATH, falling back to the CPP
  macro VA_DRIVERS_PATH, which should both contain absolute directory
  names so it's fine.

Secondly:

The default value for VA_DRIVERS_PATH is $prefix/lib/dri (where $prefix
is that of libva), which contains only some dummy driver installed by
libva; most drivers are instead in $mesa_prefix/lib/dri.  So it's
probably best to set VA_DRIVERS_PATH to $mesa_prefix/lib/dri.  So I
added --with-drivers-path to libva's configure flags (plus added a make
flag to solve a certain problem; see patch).

By the way:

If a package wants to use libva with a driver that doesn't come with
mesa, then they will have to set LIBVA_DRIVERS_PATH.  A user may also
add ~/.guix-profile/lib/dri to LIBVA_DRIVERS_PATH, and install any
number of packages installing graphics drivers there.

Thirdly, and I can finally answer your question:

Comes out "gallium_drv_video.so", found in Arch's "libva-mesa" package,
is actually Mesa's Gallium-based implementation of VA API, alternative
to stock libva.  (Arch also has a regular libva package, containing the
real libva.)  The gallium_drv_video.so driver is installed in mesa's
$prefix/lib/dri when building it is enabled, so all is fine.

Also, Mesa needs libva's header files for building it, and this actually
seems to be the sole reason Mesa depends on libva.  I considered making
a "libva-headers" package (like the mesa-headers package), but Mesa uses
pkg-config to test libva's presence so I'm not sure if that would work,
and libva is small anyway so building it twice should be OK.

Based on all that, here's a patch that applies *before* the one adding
libva to mesa, and then a fixed version of the patch adding libva to
mesa; notably I put the libva-without-mesa package into video.scm
because I was getting circular import problems:


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0002-gnu-libva-Patch-a-dlopen-call-set-drivers-path.patch --]
[-- Type: text/x-diff, Size: 2086 bytes --]

From 51e9e9d0510fc86278a7bd125366a765a10c365a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Taylan=20Ulrich=20Bay=C4=B1rl=C4=B1/Kammer?=
 <taylanbayirli@gmail.com>
Date: Tue, 28 Apr 2015 17:48:24 +0200
Subject: [PATCH 2/4] gnu: libva: Patch a dlopen call, set drivers path.

* gnu/packages/video.scm (libva): Patch the reference to libva-x11.so (passed
  to dlopen()) to use an absolute path.  Add --with-drivers-path= to
  #:configure-flags with a value pointing to mesa's $prefix/lib/dri.
---
 gnu/packages/video.scm | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/gnu/packages/video.scm b/gnu/packages/video.scm
index 2e2460d..c890d45 100644
--- a/gnu/packages/video.scm
+++ b/gnu/packages/video.scm
@@ -264,6 +264,27 @@ SMPTE 314M.")
        ("libxext" ,libxext)
        ("libxfixes" ,libxfixes)
        ("mesa" ,mesa)))
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-before
+          'build 'fix-dlopen-paths
+          (lambda* (#:key outputs #:allow-other-keys)
+            (let ((out (assoc-ref outputs "out")))
+              (substitute* "va/drm/va_drm_auth_x11.c"
+                (("\"libva-x11\\.so\\.%d\"")
+                 (string-append "\"" out "/lib/libva-x11.so.%d\"")))))))
+       ;; Most drivers are in mesa's $prefix/lib/dri, so use that.  (Can be
+       ;; overridden at run-time via LIBVA_DRIVERS_PATH.)
+       #:configure-flags
+       (list (string-append "--with-drivers-path="
+                            (assoc-ref %build-inputs "mesa") "/lib/dri"))
+       ;; However, we can't write to mesa's store directory, so override the
+       ;; following make variable to install the dummy driver to libva's
+       ;; $prefix/lib/dri directory.
+       #:make-flags
+       (list (string-append "dummy_drv_video_ladir="
+                            (assoc-ref %outputs "out") "/lib/dri"))))
     (home-page "http://www.freedesktop.org/wiki/Software/vaapi/")
     (synopsis "Video acceleration library")
     (description "The main motivation for VA-API (Video Acceleration API) is
-- 
2.2.1


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: 0003-gnu-mesa-Add-libva-input.patch --]
[-- Type: text/x-diff, Size: 2434 bytes --]

From 37bd105ec9ff3d50a72a785fc3f4cb4e9827bf06 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Taylan=20Ulrich=20Bay=C4=B1rl=C4=B1/Kammer?=
 <taylanbayirli@gmail.com>
Date: Tue, 28 Apr 2015 15:08:47 +0200
Subject: [PATCH 3/4] gnu: mesa: Add libva input.

There is a circular dependency between Mesa and libVA, so we use a
libva-for-mesa package that builds libVA without GLX and EGL support, and use
that for building Mesa.

* gnu/packages/gl.scm (libva-for-mesa): New variable.
(mesa): Add as input.
---
 gnu/packages/gl.scm    |  4 ++--
 gnu/packages/video.scm | 13 +++++++++++++
 2 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/gnu/packages/gl.scm b/gnu/packages/gl.scm
index a40749e..c350e29 100644
--- a/gnu/packages/gl.scm
+++ b/gnu/packages/gl.scm
@@ -37,6 +37,7 @@
   #:use-module (gnu packages xml)
   #:use-module (gnu packages fontutils)
   #:use-module (gnu packages guile)
+  #:use-module (gnu packages video)
   #:use-module (gnu packages xdisorg))
 
 (define-public glu
@@ -188,8 +189,7 @@ also known as DXTn or DXTC) for Mesa.")
         ("dri3proto" ,dri3proto)
         ("presentproto" ,presentproto)
         ("expat" ,expat)
-        ;; TODO: Solve circular dependency with libva.
-        ;; ("libva" ,libva)
+        ("libva" ,libva-no-mesa)
         ("libxml2" ,libxml2)
         ;; TODO: Add 'libxml2-python' for OpenGL ES 1.1 and 2.0 support
         ("libxvmc" ,libxvmc)
diff --git a/gnu/packages/video.scm b/gnu/packages/video.scm
index c890d45..4d8100d 100644
--- a/gnu/packages/video.scm
+++ b/gnu/packages/video.scm
@@ -21,6 +21,7 @@
 
 (define-module (gnu packages video)
   #:use-module (ice-9 match)
+  #:use-module (guix build utils)
   #:use-module ((guix licenses) #:prefix license:)
   #:use-module (guix utils)
   #:use-module (guix packages)
@@ -293,6 +294,18 @@ entry-points (VLD, IDCT, Motion Compensation etc.) for prevailing coding
 standards (MPEG-2, MPEG-4 ASP/H.263, MPEG-4 AVC/H.264, and VC-1/VMW3).")
     (license license:expat)))
 
+(define-public libva-no-mesa
+  (package
+    (inherit libva)
+    (name "libva-no-mesa")
+    (inputs (alist-delete "mesa" (package-inputs libva)))
+    (arguments
+     (strip-keyword-arguments
+      '(#:make-flags)
+      (substitute-keyword-arguments (package-arguments libva)
+        ((#:configure-flags flags)
+         '(list "--disable-glx" "--disable-egl")))))))
+
 (define-public ffmpeg
   (package
     (name "ffmpeg")
-- 
2.2.1


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* Re: [PATCH] gnu: mesa: Add libva input.
  2015-04-28 20:21   ` Taylan Ulrich Bayırlı/Kammer
@ 2015-04-29  8:59     ` 宋文武
  2015-04-29 21:12     ` Andreas Enge
  1 sibling, 0 replies; 15+ messages in thread
From: 宋文武 @ 2015-04-29  8:59 UTC (permalink / raw)
  To: Taylan Ulrich Bayırlı/Kammer; +Cc: guix-devel

"Taylan Ulrich Bayırlı/Kammer" <taylanbayirli@gmail.com> writes:

> 宋文武 <iyzsong@gmail.com> writes:
>
>> Look good to me, but how does it work?
>> According to archlinux, it will build 'gallium_drv_video.so',
>> described as VA-API implementation for gallium.
>> IIUC, libva may dlopen this gallium_drv_video.so?
>
> I had to tinker and research for several hours to be able to answer your
> question, but good thing you asked. :-)
>
> Firstly:
>
> I grepped the libva sources for 'dlopen' and found three places it's
> used:
>
> - to open libatiadlxx.so, which AFAIUI is a proprietary ATI driver which
>   we wouldn't support anyway,
>
> - to open libva-x11.so, which it installs in $prefix/lib; I patched the
>   .c file to use the absolute path to this .so, and
>
> - to open drivers found in $LIBVA_DRIVERS_PATH, falling back to the CPP
>   macro VA_DRIVERS_PATH, which should both contain absolute directory
>   names so it's fine.
>
> Secondly:
>
> The default value for VA_DRIVERS_PATH is $prefix/lib/dri (where $prefix
> is that of libva), which contains only some dummy driver installed by
> libva; most drivers are instead in $mesa_prefix/lib/dri.  So it's
> probably best to set VA_DRIVERS_PATH to $mesa_prefix/lib/dri.  So I
> added --with-drivers-path to libva's configure flags (plus added a make
> flag to solve a certain problem; see patch).
OK.
>
> By the way:
>
> If a package wants to use libva with a driver that doesn't come with
> mesa, then they will have to set LIBVA_DRIVERS_PATH.  A user may also
> add ~/.guix-profile/lib/dri to LIBVA_DRIVERS_PATH, and install any
> number of packages installing graphics drivers there.
Yes, it's reasonable.
>
> Thirdly, and I can finally answer your question:
>
> Comes out "gallium_drv_video.so", found in Arch's "libva-mesa" package,
> is actually Mesa's Gallium-based implementation of VA API, alternative
> to stock libva.  (Arch also has a regular libva package, containing the
> real libva.)  The gallium_drv_video.so driver is installed in mesa's
> $prefix/lib/dri when building it is enabled, so all is fine.
So, it's a 'backend' just like libva-intel-driver, get it.
>
> Also, Mesa needs libva's header files for building it, and this actually
> seems to be the sole reason Mesa depends on libva.  I considered making
> a "libva-headers" package (like the mesa-headers package), but Mesa uses
> pkg-config to test libva's presence so I'm not sure if that would work,
> and libva is small anyway so building it twice should be OK.
No problem, and if mesa only use the header, the libva-no-mesa
won't be included as dependencies when user download it from hydra.


Thanks for your detailed explanation!

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH] gnu: mesa: Add libva input.
  2015-04-28 20:21   ` Taylan Ulrich Bayırlı/Kammer
  2015-04-29  8:59     ` 宋文武
@ 2015-04-29 21:12     ` Andreas Enge
  2015-04-29 21:52       ` Taylan Ulrich Bayırlı/Kammer
  1 sibling, 1 reply; 15+ messages in thread
From: Andreas Enge @ 2015-04-29 21:12 UTC (permalink / raw)
  To: Taylan Ulrich Bayırlı/Kammer; +Cc: guix-devel

On Tue, Apr 28, 2015 at 10:21:25PM +0200, Taylan Ulrich Bayırlı/Kammer wrote:
> notably I put the libva-without-mesa package into video.scm
> because I was getting circular import problems:
> +(define-public libva-no-mesa

Is there no other solution that does not expose the package to the public?
After all, it is not supposed to be installed explicitly by a user if I
understood you correctly.

Andreas

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH] gnu: mesa: Add libva input.
  2015-04-29 21:12     ` Andreas Enge
@ 2015-04-29 21:52       ` Taylan Ulrich Bayırlı/Kammer
  2015-04-30  7:29         ` Andreas Enge
  0 siblings, 1 reply; 15+ messages in thread
From: Taylan Ulrich Bayırlı/Kammer @ 2015-04-29 21:52 UTC (permalink / raw)
  To: Andreas Enge; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 580 bytes --]

Andreas Enge <andreas@enge.fr> writes:

> On Tue, Apr 28, 2015 at 10:21:25PM +0200, Taylan Ulrich Bayırlı/Kammer wrote:
>> notably I put the libva-without-mesa package into video.scm
>> because I was getting circular import problems:
>> +(define-public libva-no-mesa
>
> Is there no other solution that does not expose the package to the public?
> After all, it is not supposed to be installed explicitly by a user if I
> understood you correctly.

Right.  I don't know what I did wrong before, but it actually seems to
work fine to put it in gl.scm.  New patch:


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0003-gnu-mesa-Add-libva-input.patch --]
[-- Type: text/x-diff, Size: 2386 bytes --]

From 88befe34eb2d92fe81ac2a897934b9aad0b9a22d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Taylan=20Ulrich=20Bay=C4=B1rl=C4=B1/Kammer?=
 <taylanbayirli@gmail.com>
Date: Tue, 28 Apr 2015 15:08:47 +0200
Subject: [PATCH 3/4] gnu: mesa: Add libva input.

There is a circular dependency between Mesa and libVA, so we use a
libva-for-mesa package that builds libVA without GLX and EGL support, and use
that for building Mesa.

* gnu/packages/gl.scm (libva-for-mesa): New variable.
(mesa): Add as input.
---
 gnu/packages/gl.scm | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/gnu/packages/gl.scm b/gnu/packages/gl.scm
index a40749e..8159073 100644
--- a/gnu/packages/gl.scm
+++ b/gnu/packages/gl.scm
@@ -21,11 +21,13 @@
 
 (define-module (gnu packages gl)
   #:use-module (ice-9 match)
+  #:use-module (guix build utils)
   #:use-module ((guix licenses) #:prefix l:)
   #:use-module (guix packages)
   #:use-module (guix download)
   #:use-module (guix build-system gnu)
   #:use-module (guix packages)
+  #:use-module (guix utils)
   #:use-module (gnu packages autotools)
   #:use-module (gnu packages bison)
   #:use-module (gnu packages flex)
@@ -37,6 +39,7 @@
   #:use-module (gnu packages xml)
   #:use-module (gnu packages fontutils)
   #:use-module (gnu packages guile)
+  #:use-module (gnu packages video)
   #:use-module (gnu packages xdisorg))
 
 (define-public glu
@@ -159,6 +162,18 @@ Polygon meshes, and Extruded polygon meshes")
 also known as DXTn or DXTC) for Mesa.")
     (license l:expat)))
 
+(define libva-no-mesa
+  (package
+    (inherit libva)
+    (name "libva-no-mesa")
+    (inputs (alist-delete "mesa" (package-inputs libva)))
+    (arguments
+     (strip-keyword-arguments
+      '(#:make-flags)
+      (substitute-keyword-arguments (package-arguments libva)
+        ((#:configure-flags flags)
+         '(list "--disable-glx" "--disable-egl")))))))
+
 (define-public mesa
   (package
     (name "mesa")
@@ -188,8 +203,7 @@ also known as DXTn or DXTC) for Mesa.")
         ("dri3proto" ,dri3proto)
         ("presentproto" ,presentproto)
         ("expat" ,expat)
-        ;; TODO: Solve circular dependency with libva.
-        ;; ("libva" ,libva)
+        ("libva" ,libva-no-mesa)
         ("libxml2" ,libxml2)
         ;; TODO: Add 'libxml2-python' for OpenGL ES 1.1 and 2.0 support
         ("libxvmc" ,libxvmc)
-- 
2.2.1


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* Re: [PATCH] gnu: mesa: Add libva input.
  2015-04-29 21:52       ` Taylan Ulrich Bayırlı/Kammer
@ 2015-04-30  7:29         ` Andreas Enge
  2015-04-30  7:31           ` Andreas Enge
                             ` (2 more replies)
  0 siblings, 3 replies; 15+ messages in thread
From: Andreas Enge @ 2015-04-30  7:29 UTC (permalink / raw)
  To: Taylan Ulrich Bayırlı/Kammer; +Cc: guix-devel

On Wed, Apr 29, 2015 at 11:52:30PM +0200, Taylan Ulrich Bayırlı/Kammer wrote:
> Right.  I don't know what I did wrong before, but it actually seems to
> work fine to put it in gl.scm.  New patch:

Okay, looks good.

I just realise that libva-without-mesa is maybe a semantically better name.

> -        ;; TODO: Solve circular dependency with libva.
> -        ;; ("libva" ,libva)
> +        ("libva" ,libva-no-mesa)

Maybe add a comment: "to solve the circular dependency".

Then please push!

Andreas

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH] gnu: mesa: Add libva input.
  2015-04-30  7:29         ` Andreas Enge
@ 2015-04-30  7:31           ` Andreas Enge
  2015-04-30  7:52             ` Taylan Ulrich Bayırlı/Kammer
  2015-04-30  7:49           ` Taylan Ulrich Bayırlı/Kammer
  2015-04-30  8:20           ` Taylan Ulrich Bayırlı/Kammer
  2 siblings, 1 reply; 15+ messages in thread
From: Andreas Enge @ 2015-04-30  7:31 UTC (permalink / raw)
  To: Taylan Ulrich Bayırlı/Kammer; +Cc: guix-devel

On Thu, Apr 30, 2015 at 09:29:34AM +0200, Andreas Enge wrote:
> Then please push!

Sorry, I forgot; maybe push to core-updates, or wait after it is merged
(do we have a time line for this)?

Andreas

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH] gnu: mesa: Add libva input.
  2015-04-30  7:29         ` Andreas Enge
  2015-04-30  7:31           ` Andreas Enge
@ 2015-04-30  7:49           ` Taylan Ulrich Bayırlı/Kammer
  2015-04-30  8:20           ` Taylan Ulrich Bayırlı/Kammer
  2 siblings, 0 replies; 15+ messages in thread
From: Taylan Ulrich Bayırlı/Kammer @ 2015-04-30  7:49 UTC (permalink / raw)
  To: Andreas Enge; +Cc: guix-devel

Andreas Enge <andreas@enge.fr> writes:

> On Wed, Apr 29, 2015 at 11:52:30PM +0200, Taylan Ulrich Bayırlı/Kammer wrote:
>> Right.  I don't know what I did wrong before, but it actually seems to
>> work fine to put it in gl.scm.  New patch:
>
> Okay, looks good.
>
> I just realise that libva-without-mesa is maybe a semantically better name.

Changed the name.

>> -        ;; TODO: Solve circular dependency with libva.
>> -        ;; ("libva" ,libva)
>> +        ("libva" ,libva-no-mesa)
>
> Maybe add a comment: "to solve the circular dependency".

Added a more elaborate comment above the libva-without-mesa definition.

Thanks for the feedback!

Taylan

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH] gnu: mesa: Add libva input.
  2015-04-30  7:31           ` Andreas Enge
@ 2015-04-30  7:52             ` Taylan Ulrich Bayırlı/Kammer
  2015-04-30 13:26               ` Taylan Ulrich Bayırlı/Kammer
  0 siblings, 1 reply; 15+ messages in thread
From: Taylan Ulrich Bayırlı/Kammer @ 2015-04-30  7:52 UTC (permalink / raw)
  To: Andreas Enge; +Cc: guix-devel

Andreas Enge <andreas@enge.fr> writes:

> On Thu, Apr 30, 2015 at 09:29:34AM +0200, Andreas Enge wrote:
>> Then please push!
>
> Sorry, I forgot; maybe push to core-updates, or wait after it is merged
> (do we have a time line for this)?

Waiting for Ludovic's input then...

Taylan

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH] gnu: mesa: Add libva input.
  2015-04-30  7:29         ` Andreas Enge
  2015-04-30  7:31           ` Andreas Enge
  2015-04-30  7:49           ` Taylan Ulrich Bayırlı/Kammer
@ 2015-04-30  8:20           ` Taylan Ulrich Bayırlı/Kammer
  2015-04-30 22:17             ` Ludovic Courtès
  2 siblings, 1 reply; 15+ messages in thread
From: Taylan Ulrich Bayırlı/Kammer @ 2015-04-30  8:20 UTC (permalink / raw)
  To: Andreas Enge; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 789 bytes --]

Andreas Enge <andreas@enge.fr> writes:

> On Wed, Apr 29, 2015 at 11:52:30PM +0200, Taylan Ulrich Bayırlı/Kammer wrote:
>> Right.  I don't know what I did wrong before, but it actually seems to
>> work fine to put it in gl.scm.  New patch:
>
> Okay, looks good.

Actually, I hit the problem again now; it's during the compilation of
.scm files.

The problem seems to be that 'inherit' fields of packages are evaluated
eagerly, so when video.scm directly or indirectly imports gl.scm before
having bound the libva variable to its value, and the libva-without-mesa
definition in gl.scm tries to reference libva, it errors.

I can solve this by wrapping the libva-without-mesa definition in a
delay, and forcing it in the input field of mesa.  Is that OK?

New patch:


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0002-gnu-mesa-Add-libva-input.patch --]
[-- Type: text/x-diff, Size: 2647 bytes --]

From 8ca6a9ea562f2f20763978c6cfc111a0ce34db16 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Taylan=20Ulrich=20Bay=C4=B1rl=C4=B1/Kammer?=
 <taylanbayirli@gmail.com>
Date: Tue, 28 Apr 2015 15:08:47 +0200
Subject: [PATCH 2/3] gnu: mesa: Add libva input.

There is a circular dependency between Mesa and libVA, so we use a
libva-no-mesa package that builds libVA without GLX and EGL support, and use
that for building Mesa.

* gnu/packages/gl.scm (libva-for-mesa): New variable.
(mesa): Add as input.
---
 gnu/packages/gl.scm | 22 +++++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/gl.scm b/gnu/packages/gl.scm
index e640f83..ea38f1e 100644
--- a/gnu/packages/gl.scm
+++ b/gnu/packages/gl.scm
@@ -21,11 +21,13 @@
 
 (define-module (gnu packages gl)
   #:use-module (ice-9 match)
+  #:use-module (guix build utils)
   #:use-module ((guix licenses) #:prefix l:)
   #:use-module (guix packages)
   #:use-module (guix download)
   #:use-module (guix build-system gnu)
   #:use-module (guix packages)
+  #:use-module (guix utils)
   #:use-module (gnu packages autotools)
   #:use-module (gnu packages bison)
   #:use-module (gnu packages flex)
@@ -37,6 +39,7 @@
   #:use-module (gnu packages xml)
   #:use-module (gnu packages fontutils)
   #:use-module (gnu packages guile)
+  #:use-module (gnu packages video)
   #:use-module (gnu packages xdisorg))
 
 (define-public glu
@@ -159,6 +162,23 @@ Polygon meshes, and Extruded polygon meshes")
 also known as DXTn or DXTC) for Mesa.")
     (license l:expat)))
 
+;;; Mesa needs LibVA headers to build its Gallium-based VA API implementation;
+;;; LibVA itself depends on Mesa.  We use the following to solve the circular
+;;; dependency.
+(define libva-without-mesa
+  ;; Delay to work around circular import problem.
+  (delay
+    (package
+      (inherit libva)
+      (name "libva-without-mesa")
+      (inputs (alist-delete "mesa" (package-inputs libva)))
+      (arguments
+       (strip-keyword-arguments
+        '(#:make-flags)
+        (substitute-keyword-arguments (package-arguments libva)
+          ((#:configure-flags flags)
+           '(list "--disable-glx" "--disable-egl"))))))))
+
 (define-public mesa
   (package
     (name "mesa")
@@ -187,8 +207,8 @@ also known as DXTn or DXTC) for Mesa.")
         ("dri3proto" ,dri3proto)
         ("presentproto" ,presentproto)
         ("expat" ,expat)
+        ("libva" ,(force libva-without-mesa))
         ("libxml2" ,libxml2)
-        ;; TODO: Add 'libva'
         ;; TODO: Add 'libxml2-python' for OpenGL ES 1.1 and 2.0 support
         ("makedepend" ,makedepend)
         ("s2tc" ,s2tc)))
-- 
2.2.1


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* Re: [PATCH] gnu: mesa: Add libva input.
  2015-04-30  7:52             ` Taylan Ulrich Bayırlı/Kammer
@ 2015-04-30 13:26               ` Taylan Ulrich Bayırlı/Kammer
  2015-04-30 22:18                 ` Ludovic Courtès
  0 siblings, 1 reply; 15+ messages in thread
From: Taylan Ulrich Bayırlı/Kammer @ 2015-04-30 13:26 UTC (permalink / raw)
  To: Andreas Enge; +Cc: guix-devel

taylanbayirli@gmail.com (Taylan Ulrich "Bayırlı/Kammer") writes:

> Andreas Enge <andreas@enge.fr> writes:
>
>> On Thu, Apr 30, 2015 at 09:29:34AM +0200, Andreas Enge wrote:
>>> Then please push!
>>
>> Sorry, I forgot; maybe push to core-updates, or wait after it is merged
>> (do we have a time line for this)?
>
> Waiting for Ludovic's input then...

As per Ludovic's input on IRC, I will push mesa commits to core-updates
when they're approved.

Taylan

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH] gnu: mesa: Add libva input.
  2015-04-30  8:20           ` Taylan Ulrich Bayırlı/Kammer
@ 2015-04-30 22:17             ` Ludovic Courtès
  0 siblings, 0 replies; 15+ messages in thread
From: Ludovic Courtès @ 2015-04-30 22:17 UTC (permalink / raw)
  To: Taylan Ulrich "Bayırlı/Kammer"; +Cc: guix-devel

taylanbayirli@gmail.com (Taylan Ulrich "Bayırlı/Kammer") skribis:

> Actually, I hit the problem again now; it's during the compilation of
> .scm files.
>
> The problem seems to be that 'inherit' fields of packages are evaluated
> eagerly, so when video.scm directly or indirectly imports gl.scm before
> having bound the libva variable to its value, and the libva-without-mesa
> definition in gl.scm tries to reference libva, it errors.
>
> I can solve this by wrapping the libva-without-mesa definition in a
> delay, and forcing it in the input field of mesa.  Is that OK?

Yes, indeed, the solution in such cases is to use a promise or a thunk,
or to have the two definitions in the same file.

Thanks,
Ludo’.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH] gnu: mesa: Add libva input.
  2015-04-30 13:26               ` Taylan Ulrich Bayırlı/Kammer
@ 2015-04-30 22:18                 ` Ludovic Courtès
  0 siblings, 0 replies; 15+ messages in thread
From: Ludovic Courtès @ 2015-04-30 22:18 UTC (permalink / raw)
  To: Taylan Ulrich "Bayırlı/Kammer"; +Cc: guix-devel

taylanbayirli@gmail.com (Taylan Ulrich "Bayırlı/Kammer") skribis:

> taylanbayirli@gmail.com (Taylan Ulrich "Bayırlı/Kammer") writes:
>
>> Andreas Enge <andreas@enge.fr> writes:
>>
>>> On Thu, Apr 30, 2015 at 09:29:34AM +0200, Andreas Enge wrote:
>>>> Then please push!
>>>
>>> Sorry, I forgot; maybe push to core-updates, or wait after it is merged
>>> (do we have a time line for this)?
>>
>> Waiting for Ludovic's input then...
>
> As per Ludovic's input on IRC, I will push mesa commits to core-updates
> when they're approved.

I trust the three of you, so go ahead!

Thanks,
Ludo’.

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2015-04-30 22:18 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-28 13:14 [PATCH] gnu: mesa: Add libva input Taylan Ulrich Bayırlı/Kammer
2015-04-28 14:14 ` Taylan Ulrich Bayırlı/Kammer
2015-04-28 14:20 ` 宋文武
2015-04-28 20:21   ` Taylan Ulrich Bayırlı/Kammer
2015-04-29  8:59     ` 宋文武
2015-04-29 21:12     ` Andreas Enge
2015-04-29 21:52       ` Taylan Ulrich Bayırlı/Kammer
2015-04-30  7:29         ` Andreas Enge
2015-04-30  7:31           ` Andreas Enge
2015-04-30  7:52             ` Taylan Ulrich Bayırlı/Kammer
2015-04-30 13:26               ` Taylan Ulrich Bayırlı/Kammer
2015-04-30 22:18                 ` Ludovic Courtès
2015-04-30  7:49           ` Taylan Ulrich Bayırlı/Kammer
2015-04-30  8:20           ` Taylan Ulrich Bayırlı/Kammer
2015-04-30 22:17             ` Ludovic Courtès

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).