guix-devel
[Top][All Lists]
Advanced

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

[PATCHES] Mesa dlopen() calls & more optional features


From: Taylan Ulrich Bayırlı/Kammer
Subject: [PATCHES] Mesa dlopen() calls & more optional features
Date: Tue, 17 Mar 2015 17:26:55 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux)

Here's a pair of patches, the first patching all non-absolute dlopen()
uses I could detect (except for GBM), and the second enabling a few
optional features of Mesa, including GBM, and adding that last GBM
dlopen() patch.  (My intent is to keep the patches stylistically
agnostic to each other; I guess it doesn't really matter much.)  (And
FWIW, GBM is enabled automatically when one enables the DRM platform
support for EGL...)

>From 8e3324c0b5d63aa3d53341b7dea090c9a64d3c40 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Taylan=20Ulrich=20Bay=C4=B1rl=C4=B1/Kammer?=
 <address@hidden>
Date: Sat, 14 Mar 2015 14:57:27 +0100
Subject: [PATCH 5/6] gnu: mesa: Fix file names passed to dlopen(3).

* gnu/packages/gl.scm (mesa): Patch source files to make file names passed to
  dlopen(3) absolute.
---
 gnu/packages/gl.scm | 22 ++++++++++++++++++----
 1 file changed, 18 insertions(+), 4 deletions(-)

diff --git a/gnu/packages/gl.scm b/gnu/packages/gl.scm
index 5e2f72a..e811142 100644
--- a/gnu/packages/gl.scm
+++ b/gnu/packages/gl.scm
@@ -222,16 +222,30 @@ also known as DXTn or DXTC) for Mesa.")
                     (substitute* 
"src/glsl/tests/lower_jumps/create_test_cases.py"
                       (("/usr/bin/env bash") (which "bash"))))
                   (alist-cons-before
-                   'build 'fix-dxtn-libname
-                   (lambda* (#:key inputs #:allow-other-keys)
-                     (let ((s2tc (assoc-ref inputs "s2tc")))
+                   'build 'fix-dlopen-libnames
+                   (lambda* (#:key inputs outputs #:allow-other-keys)
+                     (let ((s2tc (assoc-ref inputs "s2tc"))
+                           (udev (assoc-ref inputs "udev"))
+                           (out (assoc-ref outputs "out")))
                        ;; Remain agnostic to .so.X.Y.Z versions while doing
                        ;; the substitutions so we're future-safe.
                        (substitute*
                            '("src/gallium/auxiliary/util/u_format_s3tc.c"
                              "src/mesa/main/texcompress_s3tc.c")
                          (("\"libtxc_dxtn\\.so")
-                          (string-append "\"" s2tc "/lib/libtxc_dxtn.so")))))
+                          (string-append "\"" s2tc "/lib/libtxc_dxtn.so")))
+                       (substitute* "src/gallium/targets/egl-static/egl_st.c"
+                         (("\"libglapi\"")
+                          (string-append "\"" out "/lib/libglapi\"")))
+                       (substitute* "src/loader/loader.c"
+                         (("dlopen\\(\"libudev\\.so")
+                          (string-append "dlopen(\"" udev "/lib/libudev.so")))
+                       (substitute* "src/glx/dri_common.c"
+                         (("dlopen\\(\"libGL\\.so")
+                          (string-append "dlopen(\"" out "/lib/libGL.so")))
+                       (substitute* "src/egl/drivers/dri2/egl_dri2.c"
+                         (("\"libglapi\\.so")
+                          (string-append "\"" out "/lib/libglapi.so")))))
                    %standard-phases)))))
     (home-page "http://mesa3d.org/";)
     (synopsis "OpenGL implementation")
-- 
2.2.1

>From 5deb64affa47dfa9a9521dc20fbbc58e90f1f7e3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Taylan=20Ulrich=20Bay=C4=B1rl=C4=B1/Kammer?=
 <address@hidden>
Date: Tue, 17 Mar 2015 17:15:52 +0100
Subject: [PATCH 6/6] gnu: mesa: Enable more optional features.

* gnu/packages/gl.scm (mesa): Enable DRM support of EGL, thread local storage
  in GLX, and off-screen rendering.
---
 gnu/packages/gl.scm | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/gl.scm b/gnu/packages/gl.scm
index e811142..ef0485c 100644
--- a/gnu/packages/gl.scm
+++ b/gnu/packages/gl.scm
@@ -198,6 +198,13 @@ also known as DXTn or DXTC) for Mesa.")
      `(#:configure-flags
        '(;; drop r300 from default gallium drivers, as it requires llvm
          "--with-gallium-drivers=r600,svga,swrast"
+         ;; Enable various optional features.  TODO: opencl requires libclc,
+         ;; omx requires libomxil-bellagio
+         "--with-egl-platforms=x11,drm"
+         "--enable-glx-tls"        ;Thread Local Storage, improves performance
+         ;; "--enable-opencl"
+         ;; "--enable-omx"
+         "--enable-osmesa"
          "--enable-xa"
 
          ;; on non-intel systems, drop i915 and i965
@@ -245,7 +252,13 @@ also known as DXTn or DXTC) for Mesa.")
                           (string-append "dlopen(\"" out "/lib/libGL.so")))
                        (substitute* "src/egl/drivers/dri2/egl_dri2.c"
                          (("\"libglapi\\.so")
-                          (string-append "\"" out "/lib/libglapi.so")))))
+                          (string-append "\"" out "/lib/libglapi.so")))
+                       (substitute* "src/gbm/main/backend.c"
+                         ;; No need to patch the gbm_gallium_drm.so reference;
+                         ;; it's never installed since Mesa removed its
+                         ;; egl_gallium support.
+                         (("\"gbm_dri\\.so")
+                          (string-append "\"" out "/lib/dri/gbm_dri.so")))))
                    %standard-phases)))))
     (home-page "http://mesa3d.org/";)
     (synopsis "OpenGL implementation")
-- 
2.2.1


reply via email to

[Prev in Thread] Current Thread [Next in Thread]